fix(verification): bind verified.type_check records to file content - #133
Merged
Conversation
verification.Record had no link between a recorded pass and the bytes it was a pass of — only kind + target. An append-only, project-scoped log means a passing record from an earlier session or a since-reverted edit stays in .lex/verified.jsonl forever, and task_spec.lex's seen/ seen_on only checked whether a matching record existed anywhere, not whether it still applied. Reproduced live in #91: a stale record from an unrelated successful run satisfied a task-spec criterion for a file whose current content failed lex check in the same report. Record gains sig :: Str, a sha256 of the target's content at record time. linter.record_verified (the #90 write/edit path) hashes the file it just checked; verification.harvest (the session-log path for the standalone lex_check tool) hashes the target right after the turn that produced the record, since the session-log event itself never carried content. A record naming a target with no sig, or a sig that no longer matches the target's current bytes, does not count as seen. task_spec.lex's seen/seen_on become presence_on/presence, returning a three-state Absent | Fresh | Stale rather than a bool, so a stale record reports "checked before, but the file has changed since" rather than being indistinguishable from "never checked." Fixes #91 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
verification.Recordhad no binding between a recorded pass and the content it was a pass of — onlykind+target. Since the log is append-only and project-scoped (by design, per feat: auto-attestation pipeline — write trail records when verification passes #32), a passing record from an earlier session or a since-reverted edit stays in.lex/verified.jsonlforever, andtask_spec.lex's oldseen/seen_ononly checked whether any matching record existed, never whether it still applied.verified.type_checkrecord from an unrelated, older, successful run satisfied a task-spec criterion for a file whose current content failedlex checkin the very same report.Recordgainssig :: Str— a sha256 of the target's content at the moment the record was made:linter.record_verified(thewrite/editimplicit-check path from Write's implicit lex check never reaches the attestation trail, so a correct fix can still fail verification #90) hashes the file right after it just passedlex check— the freshest possible signal.verification.harvest(the session-log path for the standalonelex_checktool, viadispatch_one_traced) hashes the target right after the turn that produced the record, since the session-log event itself never carried file content.sig(legacy, or unhashable), or with asigthat no longer matches the target's current bytes, does not count as seen.task_spec.lex'sseen/seen_onbecomepresence/presence_on, returning a three-stateAbsent | Fresh | Staleinstead of a bool — a stale record now reports "a record exists but no longer matches the file's current content — re-run the check," distinct from "no record at all," so a reader knows which situation they're in.Fixes #91
Test plan
lex checkon all three modified files, plus a full repo sweep (lex checkover every trackedsrc/file)lex fmt --check src/lex test(4/4 passing)lex doc-sync --checkwritetool (fresh, hash-backed record) → task spec reports SATISFIED; then edited the file out of band (bypassingwrite/edit, simulating a stale leftover record) → task spec now reports NOT SATISFIED with"a verified.type_check record exists for verify_target.lex but it no longer matches the file's current content — re-run the check", correctly distinguishing "stale" from "never checked"🤖 Generated with Claude Code