Repository navigation
test(reflect): characterize _is_stale across changed/unchanged/vanished sources - #4996
PratikDhanave wants to merge 1 commit into
Conversation
…ed sources Add three characterization tests pinning the existing, correct behavior of the learning-overlay staleness check (graphify/reflect.py::_is_stale) directly at the helper level: - unchanged source (stored fingerprint still matches) -> fresh (False) - changed source content -> stale (True) - vanished / unresolvable source path -> stale (True), the deliberate over-flagging safe direction for a re-verify hint They use the writer's own _code_fingerprint to seed the stored fingerprint, documenting that writer and reader agree on an unchanged file. No behavior change.
|
Thanks for the pull request, @PratikDhanave. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify reviewed this change.
No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.
Not checked: tests were not run; no formal proof of the changed code.
Graphify review — findings
Adds characterization tests that exercise _is_stale directly, rather than only through the loader tests. They cover three cases: an unchanged source file reads as fresh, an edited file reads as stale, and a source path that no longer resolves reads as stale whatever fingerprint was stored. That last case is the deliberate over-flagging direction, so a re-verify hint is never silently dropped.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 118 functions depend on the 118 functions this change touches.
Health — grade A; 2 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):
_make_graph()— 4 callers, 6 callees (medium)test_lessons_artifact_cannot_be_globbed_back_into_memory()— 0 callers, 6 callees (medium)
Verification — 118 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 118 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
1 of 518 test file(s) selected (0%) via static blast radius.
tests/test_reflect.py— impact, changed-test
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
|
Landed in 0.9.103 (published to PyPI), cherry-picked with your authorship preserved. Thanks @PratikDhanave. |
What
Adds three characterization tests for the learning-overlay staleness check
_is_staleingraphify/reflect.py. These lock in the existing, correct behavior at the helper level — complementing the loader-level tests already intests/test_reflect.pythat exercise the same logic end-to-end throughload_learning_overlay.This is not a bug fix. No production code is touched; the behavior under test is already correct. The tests simply pin it down so future refactors of the fingerprint/resolution path can't silently regress it.
Behavior characterized
_is_stalerecomputes the source file's content hash and compares it to the fingerprint the writer stored, using the same file resolution + hash as the writer (_code_fingerprint):False)True)True) — the deliberate over-flagging (safe) direction for a re-verify hintEach test seeds the stored fingerprint via the writer's own
_code_fingerprint, documenting that writer and reader agree on an unchanged file, then asserts the baseline before mutating.Verification
Tests only; no runtime/behavior change.