Complete freshness dependencies and honest scan state (v0.6.0) - #28
Merged
Merged
Conversation
v0.5.1 fixed results that were wrong. This fixes results that were stale while claiming to be current. Freshness: - Verification recorded only the bounded evidence shown to a user and used it as the invalidation set. Results now record a complete dependency set - handlers, tests, guards, helpers - plus a fingerprint of the claim's surface. - Reproduced and fixed: editing the TEST that justified a route association left the claim FRESH; DELETING an evidence file left it FRESH because the old files row survived with a matching hash; adding a NEW route left a set-level claim FRESH because no recorded file changed. - A dependency that changed, disappeared, or was not seen by the latest scan marks the claim STALE and names it. A result with no recorded dependencies is NEEDS_VERIFICATION, never assumed fresh. Unrelated edits still change nothing. Scan state: - dtc verify recomputes from the last persisted scan, which is not the working tree. It now performs a bounded read-only comparison and reports the relationship before any result. JSON gains evidence_snapshot; the MCP verify_claim tool gains staleness_warning so an agent that cannot see the user's files is told which snapshot it reasoned about. Association: - Tests that request an exact route path (supertest, FastAPI TestClient) now establish association, restoring usefulness that v0.5.1 traded away for correctness. Method identity is preserved: requesting GET /users establishes nothing about POST /users. Name similarity remains a suggestion only. - Routes declared relative to an unresolved router mount prefix are reported as unresolved rather than untested: that gap belongs to DevTime, not the repo. Migration: verifications gains inventory_fingerprint via an idempotent ALTER; pre-v0.6.0 rows keep NULL and are re-verified rather than assumed fresh. Decisions and scan history are untouched. JSON stays schema_version 2. 173 tests (16 new). Version 0.6.0.
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.
Why
v0.5.1 fixed results that were wrong. This fixes results that were stale while claiming to be current - the same failure wearing a timestamp.
All four problems were reproduced against v0.5.1 before being changed:
filesrow still matched)dtc verifywithout rescanningWhat changed
Dependencies are separate from displayed evidence. Verification was fingerprinting the bounded list shown to a user and treating it as the invalidation set. Results now record a complete dependency set - handler files, tests, guards, helpers - plus a fingerprint of the claim's surface, so adding a route invalidates a claim about "all routes" even though no recorded file changed. A result that recorded nothing is
NEEDS_VERIFICATION, never assumed fresh. Unrelated edits still change nothing.dtc verifyreports which snapshot it used. A bounded, read-only comparison against the working tree, surfaced before any result, in JSON asevidence_snapshot, and in MCP as an explicitstaleness_warning- agents can't see your files, so they must be told.Request-based association restores usefulness legitimately. Tests that request the exact route path (supertest, FastAPI TestClient) now count, alongside imports. Method identity holds: requesting
GET /usersestablishes nothing aboutPOST /users. Name similarity is still only a suggestion.Unresolved is not untested. Routes declared against an unresolved router mount prefix are reported as unresolved with the reason - that gap belongs to DevTime, not the repository. On the FastAPI template this correctly separates 10 unresolvable routes from 13 genuinely unassociated ones.
Migration
verificationsgainsinventory_fingerprintvia an idempotentALTER. Verified against a simulated pre-v0.6.0 database. Pre-existing rows keep NULL and get re-verified rather than assumed fresh. Decisions and scan history untouched. JSON staysschema_version: 2(additive fields only).Verification
cache.get("users")not being mistaken for an HTTP request.Version 0.6.0. No tag, no publish - awaiting approval.