Recheck current file preimages before direct Git Trees merge - #31478
Merged
woahwhattheheck merged 2 commits intoOct 5, 2026
Merged
woahwhattheheck merged 2 commits into
woahwhattheheck merged 2 commits into
Conversation
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.
Problem and change
The direct publishGitHubChange merge path checked target preimages before creating its tree, commit and PR, then merged without rechecking a base that may have moved. The existing merge continuation and Contents publisher already perform this current-base check.
Before the direct expected-head merge, read the current base commit/tree. An unchanged immutable base reuses its completed preimage check. A moved base uses the established baseFileReader and exact previous blob/mode/type comparison for every prepared path; changed targets stop with the existing branch and PR retained. Verified retained-tree bytes are re-bound to the current native parent with separate consumed markers. A mismatching parent stops without accepting stale tree bytes.
The expected PR head remains guarded by the same native merge call. This does not provide an atomic expected-base CAS: the base can move after observation. Existing uncertain-write stopping and no automatic retry are unchanged.
Batching and evidence
The existing Git Trees route already creates one tree/commit for a regular-file batch. The guide documents pinned versus inline UTF-8 behavior and the source-modeled call cost; it preserves source pins and full immutable readbacks. The measured 17-file Razer carrier #31476 used 110 Contents-publisher calls, plus 21 separate full-main reads. It was not republished or benchmarked.
Only these existing paths change:
Removing the 24-line insertion reconstructs the complete source preimage. The entire continuation, contribution, observation and Contents implementations remain byte-identical. The guide change is additive.
Validation is static source reasoning and guarded publication/full-text readback through the existing Contents implementation. The new direct-merge branch is not executed by this publication. No tests, fixtures, native process, workflow, historical packet replay or performance run was performed.
Operation: CONNECTED-GITHUB-ATOMIC-PREMERGE-PREIMAGE-20261005-7CA6.
Exact-path coordination: https://tokenjunkielabs.slack.com/archives/C0BTB4SUCP9/p1791166502773229 .
The adjacent large-directory activity is preserved; its traversal/fallback implementation is unchanged.