Repository navigation
fix(platform): clear stale mail stamps in the nightly stamp pass - #3668
Merged
Merged
Conversation
The stamp pass only stamped. A row that stopped being an emailed attachment kept its conversation stamp, and the corpus pre-filter keeps every stamped row out of every document door. The scope pass cleared such a stamp from an active document's ref, but it counted the clear as scope drift, which the reconcile logs as a failed per-edit sync. The stamp pass now owns the stamp in both directions. A second walk reads the corpus rows that carry a stamp, email bodies aside, and checks them against the attachment rows with the same statement the first walk reads. Every ref no attachment backs goes to the corpus-only release. A ref nothing keeps in the corpus is released; one something keeps loses its stamp, guarded on the stamp the walk read. A dead ref's stamp is never cleared, so it cannot become a clonable hub row. The scope pass is scope-only again, so its drift line stays true, and runCorpusReconcile reports cleared stamps on a line of their own. The reconcile test's liveness fake now answers a dead blob, so wiring the full release, which deletes bytes, fails it.
This was referenced Sep 28, 2026
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.
An attachment filed into a document can retain its conversation stamp without a re-index, hiding it from document retrieval. The scope reconcile also counted stamp removal as a failed scope sync. The nightly attachment pass now owns stamps in both directions, and reports cleared stamps separately from scope drift.
The second pass walks stamped corpus rows by ref, excluding email bodies, and checks backing attachments through the same tenant-scoped query as the first pass. It uses the existing corpus-only release: dead rows are removed; rows kept by another source lose their stale stamp. Failed releases retain the stamp. The clear compares the stamp originally read, leaves a different concurrent stamp alone, and preserves updated_at. The scope pass now changes scope columns only.
The release regression now models a dead blob, so accidentally wiring full release would delete bytes and fail the test. The developer migration note and manual automation register describe the new ownership.
Validation:
This is a filtered integration run, not full backend coverage. The existing case where a dead conversation attachment shares its ref with a separate non-mail file row still retains its stamp; this PR does not alter that multi-holder behavior. No schema migration or production mailbox/model run is involved.