Repository navigation
feat(repo-builder): three-way merge modified managed paths on update - #330
Merged
Merged
Conversation
added 3 commits
November 19, 2026 10:52
A template update stopped for a hand merge whenever a managed file carried both the template's change and the destination's own edits, though the two usually touched different lines. apply now runs git merge-file over the old payload, the destination's file and the new payload. A clean merge lands staged at the payload's mode as action merge, overlapping edits stay left as conflicted, and a merge that cannot run (binary) stays left as modified. pr-body Decisions and the report's Preserved/Merged/Conflicted line name merged paths from the records instead of leaving a slot. Generated-By: claude-sonnet-5-5
…ed managed path into possiblyneal/update-eligible-repos Generated-By: claude-opus-5-5
A symlink on either side of a modified managed path was read through and replaced by a regular file holding the merged target text. The merge now returns modified, writing nothing, when the destination path is a symlink or the payload's mode at the recorded or target commit is a symlink. Also names the merge outcome separately from the left reason in apply_update, and computes each change's path once. Generated-By: claude-opus-5-5
Owner
Author
|
Code review: standard scan, clean. Axes: Standards+Spec, Correctness/Logic Reviewed-Head: c6e17b9 |
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.
Intent
Closes #329
Closes #328
A template update stopped each destination for a hand merge whenever a managed file carried both the template's change and the destination's own edits. The root
CLAUDE.mdalways does, so the carry to83ece89stopped 20 of 21 repositories atreconcile.update.py applynow three-way merges such a path (old payload at the recorded commit, the destination's file, the new payload at the target). A clean merge lands staged at the payload's mode as actionmerge. Overlapping edits stay underleftasconflicted, with nothing written. The pull-request body and the several-destinations report name merged paths from the records instead of leaving a slot.Read first
apps/repo-builder/src/scripts/update.py:105:merge_payload, which refuses symlinks and handles the exit codes (0 clean, 1–127 conflicts, anything else unmergeable)apps/repo-builder/src/scripts/update.py:456: whereapplytries the merge, limited tomodifiedpaths with statusMapps/repo-builder/src/scripts/update.py:729and:1257: Decisions and Preserved/Merged/Conflicted renderingwrite_payloadsplit intowrite_content, so the merge reuses its mode, symlink and stage handling; prose updates inreferences/update.md,references/reporting.mdandapps/repo-builder/CLAUDE.mdDecisions
CLAUDE.md, because one mechanism covers both. On this update's 22 hand merges,git merge-filereproduced 21 byte for byte, both.pre-commit-config.yamlmerges among them. The one conflict,possiblyneal/template's ownCLAUDE.md, needed a decision anyway.git merge-file) over a section-aware Markdown or YAML merge, because the stdlib and git already cover it, and a conflict stays the Operator's.git merge-filecannot run (binary) staysmodified, notconflicted, so a tool failure never reads as a content conflict.120000at either commit) staysmodifiedwith nothing written, becausegit merge-filereads through a link and would replace it with a regular file. Found in review.Out of scope
.github/, which is still replaced whole.Verified
uv run pytest apps/repo-builder/src/scripts/tests/test_update.py→ 95 passed (clean merge, conflicted, binary, symlink, mode, ignored path, pr-body, report andrun→readycases); the symlink case fails without its guardscripts/checkatc6e17b9→exited 0: 0 FAIL, 0 unavailable, 5 not-applicable, 26 passgit merge-fileover the 22 left paths of the83ece89carry → 21 identical to the committed hand merge, 1 conflicted (2 hunks)Not verified
update.py runagainst real destinations since this change: none is behind the template, so the next template commit's update is the first real run.Merge danger
Door: two-way: a revert restores everything
Blast radius:
update.py apply,run,pr-bodyandreport, and the/repo-builderupdate flow that reads their output. TheapplyJSON gains actionmergeand reasonconflicted.generate.pyimports onlyupdate.py's copy proof and slot marker, both unchanged.