Repository navigation
Index passes write onto the newest record and never drop each other's entries - #984
Merged
Merged
Conversation
… entries Each repository's record carries a version, and every write is conditioned on it. A pass that loses the race to another reads the newer record, merges its own files onto it and tries again, at most a few times (contracts::write_pass, over the versioned-write loop the app map's status already uses, now shared). A pass that keeps losing writes nothing, leaves the other pass's record intact and logs a warning.
…rote Each file's entries in a repository's record carry the time of the commit they were read from, and so does a file a pass found gone. A pass merges file by file in that order: it replaces or removes a file's entries only when they came from a commit no newer than its own, and the record's commit moves only forward. A full pass that read an older tree and overlaps a push from a newer one keeps the push's new and rewritten files.
coderhelm
Bot
dismissed
their stale review
December 5, 2026 12:29
Superseded by CoderHelm's latest review
…commit times A pass writes only at the branch's current head. Before each write it reads the head again; a pass whose commit isn't it never writes its view, but reads the files that changed between the two, either way, and writes at the head, whether the branch moved forward or was reset back. A comparison too large to tell queues a full read instead. The version condition still guards writers at the same head. Each file's entries record the head they were read at, and only files with entries are kept, within the record's bound. Turning the graph off empties the record with no commit, so the first read once it is on again writes every file. Commit times are no longer used.
coderhelm
Bot
dismissed
their stale review
December 5, 2026 13:06
Superseded by CoderHelm's latest review
What changed between a pass's commit and the head is read from GitHub's comparison, both ways. A file renamed or copied names the path it came from as well (previous_filename), so a rename is its old path removed and its new one added, and no entries stay under the old path. A comparison that may be cut still queues a full read.
coderhelm
Bot
dismissed
their stale review
December 5, 2026 13:38
Superseded by CoderHelm's latest review
Contributor
|
💚 Post-merge health check passed: the deploy of
|
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
Two index passes on the same repository could overlap: each read the stored contract record, replaced its own files' entries, and wrote the whole record back unconditioned, so the later write silently dropped the earlier pass's entries. Every write of a repository's record is now conditioned on its version. A pass that loses the race reads the newer record, merges its own files onto it, and tries again, a bounded number of times, so neither pass's entries are lost. Follow-up to #979.
Changes
common::contracts:v.write_passwrites aPass(the files it read, their fresh entries and, for a full pass, its tree) onto the newest stored record, conditioned on that version, over aRecordStore(DynamoRecordsin production).WRITE_TRIES(5) lost races it returnsWrote::Conflict. Nothing is written in that case, and the other pass's record stays intact.save_recordis gone.common::app_map: the versioned-write loop the map's build status already used is now one shared, generic loop (write_versioned). The status update calls it and behaves as before.worker::passes::code_graph:refresh_contractsand the contracts-only pass write throughwrite_pass.xt(case and page): source checks that every pass writes through the versioned path and warns on a conflict, and that no unconditioned write is left.Verification
cargo fmt --all --checkandrustfmt --checkon the incidents: clean.cargo clippy -p common -p worker -p gateway --all-targets -- -D warnings: clean.cargo test -p common -p worker -p gateway: common 3,345 passed, gateway 1,363 passed, worker 2,967 passed, none failed.interleaved_passes_keep_both_passes_entries: another pass writes between this pass's read and its write. The write is retried, and the stored record holds the base entries and both passes' entries at the next version. A later full pass drops only the files missing from its tree.a_conflict_past_the_tries_leaves_the_stored_record_intact: every write loses. The result isConflict, and the stored record and its version are unchanged.brand_spelling.pyanddomain_examples.py: clean.