Skip to content

update-shape.py apply refuses a both row before it reads --accept-local, so the documented exit for both cannot be taken; --branch cannot be pointed at an existing branch #84

Closed

Description

@brettheap

Lane: xfactory-2 (xFactory-2)

Governing record for a defect in update-shape.py: apply refuses a both row before it consults --accept-local, so the exit AGENTS.md documents for both — "merge by hand, commit, then re-run with --accept-local <path> on the file you merged" — cannot be taken. Found 2026-09-10 running S4 of #77 on the two adopted roots InkRouter/IRRS and InkRouter/IRSS (their #13s), on Brett Heap's word "apply the shape update to the holder and both roots".

Reproduction (both roots, identical)

update-shape.py check at target 3abeb8a: AGENTS-shape.md upstream-changed, Makefile BOTH — upstream changed the template in #80 (make park/make resume), and the root's copy "is not a verbatim copy of templates/assembly-root/Makefile at the pinned commit — an in-place adoption appends to it". The Makefile merge was made by hand exactly as AGENTS.md says (upstream delta applied, the adoption's CONTRACTS_DIR block preserved; diff <(merged minus the local block) <(template@3abeb8a) empty; make -n park parses; make park ARGS=--dry-run reaches the extension), committed on shape/update-3abeb8a4a27e, and then:

update-shape.py apply --root <root> --at 3abeb8a4a27e --yes --accept-local Makefile --branch shape/update-3abeb8a4a27e
REFUSED update-conflict: these files changed on BOTH sides, or cannot be compared, and a merge is a human's judgement rather than a byte copy:
    Makefile: edited here AND upstream since the pin
Remediation: merge each one by hand (...), commit it, then re-run this with --accept-local on that path so the row is recomputed from what you merged.

The remediation the refusal prints is the command that was just refused.

Cause (read in the source)

cmd_apply (:1049) computes conflicts = [row for row in rows if row.is_conflict] and refuses unconditionally when it is non-empty; --accept-local is consulted only by the later LOCALLY_MODIFIED check. classify() (:430) marks a row BOTH whenever the upstream template changed between the pinned and target commits AND the root's copy is not verbatim at the pinned commit. For an adopted root that appended to the Makefile, "not verbatim at the pinned commit" is PERMANENT, so BOTH fires on every future upstream touch of that file regardless of the working bytes or the pin row's recorded digest. Verified two ways in a scratch clone: (1) merged Makefile, pin row untouched → refused ("edited here AND upstream since the pin"); (2) merged Makefile AND the pin row hand-patched to its digest → still refused ("not a verbatim copy … appends to it"). This is the first time it could surface: the two earlier re-syncs (122d729 → 99b3774 → 6fe09a4) never touched the Makefile upstream.

Secondary: commit_on_branch() (~:996) runs git checkout -q -b <name> itself, so apply --branch <name> fails when the branch already exists — which the documented both flow requires (the hand merge is committed on that branch first). Moot today because the conflict refusal fires earlier; not moot once it does not.

The fix

  1. --accept-local <path> on a both row means what AGENTS.md says it means: the person merged that file and is re-pinning it FROM THE PROJECT'S OWN BYTES. cmd_apply excludes accepted paths from the conflict refusal, does not copy upstream bytes over them, and recomputes their pin row from the working file (exactly what --accept-local already does for locally-modified). An unaccepted both row still refuses, with the same wording. check's verdict text for both gains one sentence naming --accept-local as the exit.
  2. --branch <name>: if <name> is the CURRENT branch and it is not the tracking branch, commit onto it; if it exists and is not current, refuse by name; else create it as today. The tracking-branch refusal stays.
  3. Tests in tests/test_update_shape.py: a root with an appended Makefile (mirror an adoption), upstream touches the template → check says both; apply --accept-local Makefile after a hand merge re-pins from the merged bytes, copies AGENTS-shape.md, moves contracts/shape-pin.yaml and the manifest's shape: block, and the root's own validate-pins.py is green; apply WITHOUT --accept-local still refuses with the existing wording; --accept-local on a path that is both but whose bytes were NOT merged is still accepted (it is the person's word — say so in the test's docstring); --branch onto the current non-tracking branch commits there; onto an existing non-current branch refuses.
  4. AGENTS.md "Updating a project's shape" point 4 stays true; add that the merge commit goes on the branch apply is then pointed at with --branch.

Reach: update-shape.py, tests/test_update_shape.py, AGENTS.md (a clause). Then the two roots' updates (IRRS#13, IRSS#13) rerun apply at the new main and land.

🤖 Generated with Claude Code

Activity

  1. brettheap commented on Sep 10, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane xfactory-2 (xFactory-2), session harness 47c80b53-25d0-407b-8e19-432e9316bf61, 2026-09-10T02:56Z, for the fix above, branch fix/update-shape-accept-local-both. It unblocks S4 of #77 on InkRouter/IRRS#13 and IRSS#13, where the hand-merged Makefiles sit committed on their shape branches. Brett Heap's word for the update these roots need: "apply the shape update to the holder and both roots" (2026-09-10).

    Reads before claiming: 1. comments here: none. 2. open PRs: #83 (this lane's, #82) only; --search 'accept-local both' issues: none prior. 3. branches: none matching accept-local|update-shape.

  2. brettheap commented on Sep 10, 2026

    @brettheap
    ContributorAuthor

    (lane xfactory-2 (xFactory-2), 2026-09-10T03:24Z) PULL REQUEST OPEN: #85 (fix/update-shape-accept-local-both, head 1f8d573). Proven on a clone of InkRouter/IRRS's shape branch before opening.

  3. brettheap commented on Sep 10, 2026

    @brettheap
    ContributorAuthor

    (lane xfactory-2 (xFactory-2), 2026-09-10T03:47Z) MERGED — #85 → 8702373 (squash), on Brett Heap's word "merge 85 when green and rerun apply on both roots". Object complete; the roots' reruns follow under InkRouter/IRRS#13 and IRSS#13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions