Fix(analysis): _is_yaml_stale treats missing source_last_modified as stale (Fixes #152) #213
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.
Issue
Fixes #152
Summary
Fixed the
_is_yaml_stalemethod insrc/intugle/analysis/models.pyto correctly identify YAML cache as stale when thesource_last_modifiedtimestamp is missing orNone.Problem
The previous implementation returned
False(not stale) whensource_last_modifiedwas missing, which could lead to the system using potentially outdated cached data since freshness could not be verified.Solution
Modified the conditional logic to explicitly return
True(stale) whensource_last_modifiedis missing orNone, ensuring the system re-profiles data when cache validity cannot be determined.Changes
src/intugle/analysis/models.py: Updated_is_yaml_staleto returnTruewhensource_last_modifiedis missingtests/analysis/test_dataset_analysis.py: Added 3 new test cases:test_is_yaml_stale_missing_source_last_modifiedtest_is_yaml_stale_with_none_source_last_modifiedtest_is_yaml_stale_with_valid_source_last_modifiedTesting
All tests pass locally: