Skip to content

verify: report notes whose integrity stamp was removed (stamp_removed) - #102

Merged
sagnik11 merged 3 commits into
mainfrom
autter/stamp-removed
Nov 13, 2026
Merged

sagnik11 merged 3 commits into
mainfrom
autter/stamp-removed

Conversation

@sagnik11

@sagnik11 sagnik11 commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

A tester reported that if you remove a note's integrity stamp and edit the note, autter verify reports it as legacy (exit 0, even with --strict). autter stats then used the edited note and showed 33% AI on a commit that was 83% AI.

A note with no integrity member 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 legacy only if it could have been written before stamping existed:

The note's autter_version says Commit comes after stamping began Otherwise
3.8.0 or later stamp_removed (exit 5) stamp_removed (exit 5)
no readable version stamp_removed (exit 5) legacy
older than 3.8.0 unstamped_by_older_autter (warning; exit 5 with --strict) legacy
  • 3.8.0 or later. Every release since 3.8.0 stamps every note it writes, including on the http backend (checked in v3.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.
  • "After stamping began" means the commit is a descendant of a commit whose note is stamped. This uses commit ancestry, not dates: whoever makes a commit can set its date, and a rebase changes it. Dates are only used to choose the order in which the floor is built, which never changes the result. The test includes a 3.7 note committed later on a branch that forked before stamping; it stays legacy.
  • Mixed-version teams. A teammate still on 3.7 who commits after you start stamping writes unstamped notes that say 3.7.x. Treating those as a failure would false-alarm the team, so they become unstamped_by_older_autter: a warning whose lines still count. --strict fails it, because anyone who removes a stamp can also edit the version. This matches how rebound_by_older_autter is already handled. I picked this instead of "accept the version claim as legacy" because a plain legacy pass under --strict would leave the hole open for anyone who also edits the version.

Paths that legitimately write unstamped notes are not flagged

  • autter notes backfill writes notes exactly as stored, so a pre-3.8.0 note keeps its old version and its old commit and stays legacy (tested, including after later stamped commits). A stamped note whose stamp was removed in the DB fails, and backfill lists it.
  • A note rebound by an older autter keeps its stamp, so these rules don't apply to it.
  • A teammate's fetched notes carry their own older version, so they never fail without --strict.
  • Every rewrite this autter does (rebase, amend, cherry-pick, autter ci squash/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_removed counts as a failure everywhere digest_mismatch does. autter stats, autter blame and range stats count its lines as unknown and print the one-line notice ("had its integrity stamp removed"). A rewrite that carries it writes carried_failure. autter status only 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.rs computes it and stores it in .git/ai/stamp_floor.json, keyed by the tree of refs/notes/ai, and also keeps it in memory for the life of the process:

  • When the notes ref moves, only the changed notes are read (one git diff-tree and one git cat-file).
  • A full recompute (one git grep over the notes tree) happens only when there's no cache or a floor commit's note changed.
  • Checking candidates takes one git rev-list --ancestry-path <candidates> --not <floor>. This is correct because no floor commit is an ancestor of another.
  • None of this runs unless a checked note has no stamp, so a repo whose notes are all stamped pays nothing.

Still not caught

  • A note whose stamp was removed and whose version was edited to a release before 3.8.0. After stamping began it's a warning, and fails only with --strict. Before stamping began, or in a repo with no stamped notes, it's legacy.
  • A stash note edited the same way (to 3.8.1 or earlier) still restores.
  • With the http notes 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:

  • the reported 83% → 33% case: 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 commit
  • the first stamped commit with its stamp removed
  • stamp and version both removed, after stamping began
  • a repo with only pre-3.8 notes stays legacy, exit 0 with --strict
  • an older-autter teammate gets the warning, --strict fails it, and a side branch forked before stamping stays legacy; also checks the floor is rebuilt when the stamped commit's own note changes
  • rebase, amend and cherry-pick after stamping began verify
  • backfill of an old note stays legacy; backfill of a stamp-removed note fails
  • both stash cases

Existing 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_restamped converts 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, the note_ 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

sagnik11 and others added 2 commits November 14, 2026 00:42
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>
@sagnik11 sagnik11 changed the title verify: report a note whose integrity stamp was removed verify: report notes whose integrity stamp was removed (stamp_removed) Nov 13, 2026
@sagnik11
sagnik11 merged commit 5ef830c into main Nov 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant