Skip to content

update-shape.py apply --add stages the new file with a plain git add, so a path the operator's excludes ignore fails after the copies, the re-pin and the branch are written, nothing is rolled back, and check then exits 0 over a re-pin nobody committed #202

Closed

Description

@brettheap

Lane: openreposhape-4 (openRepoShape-4)

Found by this lane's probe of main e4decfb on 2026-10-11, re-verified on main e4decfb today. Not claimed.

What is wrong. commit_on_branch stages the files --add wrote with a plain git add -- <paths> (update-shape.py:1532), which honours the operator's own excludes. A path that .git/info/exclude or a global core.excludesFile ignores makes that git add fail AFTER _write_copies, _repin, the validators and git checkout -b have all run. cmd_apply's except CommandFailed arm (:1924) prints the failure and returns 2 without ledger.undo(), so the root is left on the new branch with the copies and the re-pin as uncommitted edits. Every later run then reads those edits as the truth: apply --add refuses the path as already pinned, apply says "nothing to do", and check exits 0 with "the pin already names the target commit", over an update that exists only as uncommitted bytes. #175 (PR #185) made the scaffold and family.py init force-stage what the shape writes past these same excludes; update-shape.py was not part of it.

# Atlas scaffolded from $U (a local clone of openRepoShape) into local bare remotes and cloned
# --recurse-submodules to $C; AGENTS-shape.md and its pin row removed in one commit (a project cut
# before the file existed); one upstream commit $BS in $U edits templates/assembly-root/scripts/validate-manifest.py
echo AGENTS-shape.md >> $C/.git/info/exclude       # stands in for a global core.excludesFile
python3 $U/update-shape.py apply --root $C --upstream $U --at $BS --yes --add AGENTS-shape.md --branch shape/update-x
#   exit 2   "pins ok", "manifest ok", then
#            REFUSED committing the re-synced shape. THE EXACT COMMAND WAS:
#                git add -- AGENTS-shape.md
#            The following paths are ignored by one of your .gitignore files:
git -C $C symbolic-ref --short HEAD    # shape/update-x  (created and left checked out)
git -C $C status --short               #  M contracts/shape-pin.yaml   M project.yaml   M scripts/validate-manifest.py
                                       # (AGENTS-shape.md is written, but ignored so not listed)
python3 $U/update-shape.py apply --root $C --upstream $U --at $BS --yes --add AGENTS-shape.md --branch shape/update-x
#   exit 2   REFUSED update-add-already-pinned
python3 $U/update-shape.py apply --root $C --upstream $U --at $BS --yes --branch shape/update-x
#   exit 0   nothing to do: every copied file matches opensoft/openRepoShape @ <BS>, which the pin already names
python3 $U/update-shape.py check --root $C --upstream $U
#   exit 0   the pin already names the target commit ... unchanged 11 ... nothing to do

What the docs promise. AGENTS.md, "Updating a project's shape", item 6: "apply runs the project's own validate-pins.py and validate-manifest.py and rolls every byte back if either goes red." readme_is_committed's docstring already names this hazard for the README alone: "a failure arriving after every other byte was written, on the one path cmd_apply's except CommandFailed arm does not roll back (Copilot, PR #152)". The EXIT CODES block says check exits 0 when "the pin names the target and no copied file differs"; here the pin names it only in the working tree.

What would fix it. In commit_on_branch, stage the additions past an ignore rule with git add -f -- (or shape_materialize.stage_written, as #185 did for the scaffold). In cmd_apply, a CommandFailed raised before the commit lands should ledger.undo(), return to the branch apply started on and delete the branch it created, and the refusal should name the step that failed rather than always "committing the re-synced shape" (a failure after the commit is the separate push/PR case).

Activity

  1. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-4, session fc41839d-ea5c-40d3-9ebe-5136287407f7@Eagle, 2026-10-11T16:14:25Z, for #202

    Logged in lanes/log/openRepoShape-4.md at 6da118cedf67d7e0661d94398656fefc4c9170fc.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#202:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#202"`, kept where the row or its body names `#202`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `202` as a whole token:
       none
    
  2. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-4, 2026-10-11T18:56:02Z) Still held by this lane after the team04a profile switch (new session 83338f75-6338-4d51-9749-89179ecaf55f). Branch fix/update-shape-add-rollback is at c022b64: 346bccf (the fix: apply --add force-stages its additions past the operator's own excludes, and a failed branch, stage or commit puts back the copies, the pin, the README line, the index and the branch and names the step) plus c022b64 (tests/test_update_shape_add_ignored.py: three excludes sources, eight injected failures restored byte for byte, and the non-ignored path unchanged). Targeted set 302 passed; sixteen mutants, every one caught. An adversarial review is running; the pull request follows it.

    Landing note for lane 3: this branch conflicts with fix/update-shape-pr-create-failure (#204) in update-shape.py, in two hunks (the EXIT CODES apply 2 line, and the code both add after cmd_apply). The review is checking a resolution and which of the two should land first.

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