Repository navigation
fix(sensor): age-skip old legacy DSH sessions instead of reporting drift - #215
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
DshParser checked the session generation before the lookback window, so every legacy (pre-v3) session directory was counted as unsupported_schema on every run, however old it was. That marked DSH health "partial" with suspected_schema_drift for anyone with finished legacy sessions. Legacy generations older than the lookback window are now counted as file_age_skipped; recent ones are still reported as unsupported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of PR is this? (check all applicable)
Related issue: N/A (found by reading the code; reproduced on
mainat 6b33dff)What changed?
Pass the cutoff into
_select_session_generations; non-v3 generations older than the cutoff are counted asfile_age_skipped(like old v3 files) instead ofunsupported_schema. Recent legacy sessions andmax_age_days <= 0keep the old behaviour.Why?
DshParser.parse_all calls
_select_session_generations()(Sensor/adr_sensor/parsers/dsh_parser.py:48, 96-101) before the lookback filter, and that method recordsunsupported_schemafor every directory whose newest file is not v3 (e.g.session.v2.jsonl), regardless of age. The age filter at :53 only ever sees v3 files. Result: a legacy session finished months ago is reported as unsupported_schema on every run, which health_record turns into status "partial" withsuspected_schema_drift: true.How did you test it?
tests/test_dsh_parser.py::test_old_legacy_generation_is_age_skipped_not_reported_as_drift(v2 session with mtime 1970 -> expects {'file_age_skipped': 1}; plus a recent v2 session -> still unsupported_schema). main parser: FAILED ({'unsupported_schema': 1} == {'file_age_skipped': 1}); branch: passed. Existingtest_future_or_legacy_generation_is_not_parsed_as_v3still passes.pytest tests/ -q(py3.14) 609 passed; ruff clean.Potential risks
The change only affects the input described above; other paths go through the same code as before, and the component's existing tests pass.