Fix: Automatic detection and refresh of corrupted cache data #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #135
This PR fixes a critical issue where corrupted cache files with null resume data would prevent the system from working correctly, even after configuration issues were resolved.
Problem
Solution
Added automatic cache validation that:
Changes Made
Added
is_valid_resume_cache()function:Falseif all main sections are empty/nullAdded
is_valid_github_cache()function:Falsefor empty or malformed dataEnhanced cache loading logic:
Code Example
Before (Problematic):
After (Fixed):
Testing
✅ Test Case 1: Normal operation with valid cache
✅ Test Case 2: Corrupted resume cache detection
✅ Test Case 3: Corrupted GitHub cache detection
✅ Test Case 4: JSON parsing errors
User Experience Improvements
Before:
After:
Impact
Code Formatting
Smoke Tests Performed
✅ Test with corrupted cache: Created cache with all null values, system detected and refreshed automatically
✅ Test with valid cache: Existing valid cache files are loaded correctly without reprocessing
✅ Test with malformed JSON: Invalid cache files are handled gracefully and removed
✅ Test end-to-end flow: Full resume processing works correctly after cache refresh
Files Modified
score.py- Added cache validation functions and enhanced cache loading logicThis fix ensures users always get valid resume data regardless of cache state, while maintaining the performance benefits of caching for valid data.
Fixes #135