Repository navigation
verify: report notes whose integrity stamp was removed (stamp_removed) - #102
Merged
Merged
Conversation
A note without an integrity stamp read as legacy and passed, even with --strict, so stripping the stamp from an edited note hid the edit. On a commit made after the repository's first stamped note, an unstamped note can't have been written by an autter before 3.8.0, so it is reported as stamp_removed instead of legacy. Pushed for CI without the full local test run (owner's request). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unstamped note is legacy only when it can have been written before stamping. Its metadata naming autter 3.8.0 or later (every such release stamps every note) is stamp_removed; so is a note with no autter version on a commit that descends from a commit whose note is stamped. A note that names a release before 3.8.0 on such a commit is the warning unstamped_by_older_autter (a teammate who has not upgraded), which --strict fails, like rebound_by_older_autter. Stash notes get the same rule against 3.8.2, the first release that stamps them. Adds integration tests for the reported 83% -> 33% case, pre-3.8-only repositories, an older-autter teammate, backfill, rewrites after stamping began and stash notes; existing tests that simulated legacy notes now write a pre-3.8 version as real legacy notes have. Documents the rule in docs/scripting.md, the module doc and CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
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.
A tester reported that if you remove a note's integrity stamp and edit the note,
autter verifyreports it aslegacy(exit 0, even with--strict).autter statsthen used the edited note and showed 33% AI on a commit that was 83% AI.A note with no
integritymember reads as legacy so that notes written before 3.8.0 keep working. Anyone can delete that member. In local-only mode, nothing else catches it.The rule
An unstamped note counts as
legacyonly if it could have been written before stamping existed:autter_versionsaysstamp_removed(exit 5)stamp_removed(exit 5)stamp_removed(exit 5)legacyunstamped_by_older_autter(warning; exit 5 with--strict)legacyv3.8.0). A note that claims one of those versions but has no stamp had its stamp removed. This also covers the first stamped commit in a repo, which the topology rule below can't reach because no stamped commit comes before it.legacy.unstamped_by_older_autter: a warning whose lines still count.--strictfails it, because anyone who removes a stamp can also edit the version. This matches howrebound_by_older_autteris already handled. I picked this instead of "accept the version claim as legacy" because a plain legacy pass under--strictwould leave the hole open for anyone who also edits the version.Paths that legitimately write unstamped notes are not flagged
autter notes backfillwrites notes exactly as stored, so a pre-3.8.0 note keeps its old version and its old commit and stayslegacy(tested, including after later stamped commits). A stamped note whose stamp was removed in the DB fails, and backfill lists it.--strict.autter cisquash/rebase merges) stamps the note it writes. A rebased branch of 3.7 notes on top of stamped commits verifies (tested).Readers and rewrites
stamp_removedcounts as a failure everywheredigest_mismatchdoes.autter stats,autter blameand range stats count its lines as unknown and print the one-line notice ("had its integrity stamp removed"). A rewrite that carries it writescarried_failure.autter statusonly looks at the working tree and doesn't read notes, so nothing changes there.Stash notes
Stash notes follow the same rule, but compared against 3.8.2, the first release that stamps stash notes. A stash note is not restored if it claims 3.8.2 or later, or if it has no version and was made on a commit at or after the first stamped commit. A note that claims 3.8.1 or earlier still restores, because 3.8.0 and 3.8.1 stamped commit notes but not stash notes.
Performance
The floor is the set of stamped commits that have no stamped ancestor.
src/authorship/note_stamp_floor.rscomputes it and stores it in.git/ai/stamp_floor.json, keyed by the tree ofrefs/notes/ai, and also keeps it in memory for the life of the process:git diff-treeand onegit cat-file).git grepover the notes tree) happens only when there's no cache or a floor commit's note changed.git rev-list --ancestry-path <candidates> --not <floor>. This is correct because no floor commit is an ancestor of another.Still not caught
--strict. Before stamping began, or in a repo with no stamped notes, it'slegacy.httpnotes backend there is no local notes ref, so only the version column applies. The server record covers those notes.Tests
tests/integration/note_integrity_check.rs:stamp_removed, exit 5 with and without--strict; stats show 0 AI and 6 unknown, not 2 AI; blame doesn't trust the note; a range fails only the tampered commitlegacy, exit 0 with--strict--strictfails it, and a side branch forked before stamping stayslegacy; also checks the floor is rebuilt when the stamped commit's own note changeslegacy; backfill of a stamp-removed note failsExisting tests that built "legacy" notes by stripping a stamp from a note written by the current build now also set a pre-3.8 version (or, for the stash test, 3.8.1), which is what real legacy notes look like.
verify_server_record::test_legacy_notes_on_unchanged_commits_are_not_restampedconverts every note in its repo the same way. There are new unit tests for version parsing and the floor helpers.Run locally:
cargo clippy --all-targets -- -D warnings, thenote_lib tests, and every new or changed integration test, filtered. All pass. At the owner's request the full suite was left to CI.🤖 Generated with Claude Code