Skip to content

update-shape.py, validate-pins.py and shape-doctor.py: once an adopted root does its own follow-up "merge shape/.gitignore into .gitignore" and removes the merged copy, the copy's pin row is copy-missing, so the project's bootstrap.py and its validate check go red, apply refuses with a remedy (--accept-local) that is refused in the same words, and no tool removes the row, which leaves only undoing the merge or the hand edit of the pin that AGENTS.md forbids #502

Closed

Description

@brettheap

Lane: openreposhape-4 (openRepoShape-4)

(lane openRepoShape-4, 2026-10-12T23:17Z) Found by lane 4's v1.0.0 README/AGENTS.md audit (finding auU-03), re-verified on main 437a360. Lane 4 claims it.

What is wrong. An in-place adoption keeps the source's own .gitignore, Makefile and .gitattributes. It writes the shape's copies of them beside the originals under shape/, and PINS those copies: contracts/shape-pin.yaml gets a row shape/.gitignore. The plan's follow-up then says "merge shape/.gitignore into .gitignore: the source repository already has that name, so the shape's copy was written beside it and NOTHING was overwritten".

The docs pull in two directions:

  • README says "a human merges them and usually drops the rows" (README.md:1065-1070).
  • AGENTS.md says a file with no row is "none of your business — an adopted project merged some of them away on purpose" (AGENTS.md:278-280), and forbids editing "a pinned file, a digest or a manifest to make a row go green" (:229-231).
  • The project's own AGENTS-shape.md says "Never update a digest in place." (templates/assembly-root/AGENTS-shape.md:37-48).

After the merge, the natural last act is to remove the merged-away shape/.gitignore. Then:

  • The project's own gate goes red. validate-pins.py, which bootstrap.py and CI's validate workflow both run, reports FINDING shape-copy-missing: contracts/shape-pin.yaml: shape/.gitignore is pinned but absent.
  • The update tool has no exit. update-shape.py check says copy-missing and REFUSAL AHEAD. apply refuses update-conflict with "re-run this with --accept-local on that path". With --accept-local shape/.gitignore, the refusal is identical.
  • The doctor sends the reader back to that tool. It says DRIFTED (1 copy-missing) and names that same check/apply.

No tool removes the row. Two things turn the project green: restoring the merged-away copy, which undoes the follow-up, or deleting the row by hand, which is the edit AGENTS.md forbids and the one README's "drops the rows" describes.

(check also has four verdicts the docs never list: already-at-target, upstream-removed, unmapped and copy-missing (update-shape.py:239-256). Listing them is #483's text. This issue is the missing remedy.)

Reproduction. Offline, on Linux. $U is a checkout of main 437a360; git-filter-repo is on PATH; the remotes are local bare repositories; a gh that exits 97 stands first on PATH; GIT_ALLOW_PROTOCOL=file is set; git reads an empty global config; identities come from env. --yes stands in for the human's yes.

  1. A source $R/Medx holding specs/a.md, src/a.py, README.md, and its own .gitignore (build/, *.log), in one commit.
  2. Adopt it:
    • adopt-project.py plan --source $R/Medx --project Medx --org acme exits 0. Its follow-ups include merge shape/.gitignore into .gitignore: ….
    • check exits 0.
    • execute --yes --local-remote-dir $R/remotes --work-dir $R/work exits 0 and verifies: spec 1 of 4, code 1 of 4, root 2 of 4 source paths.
  3. Merge the split branch into the source's main (the pull request, merged). Clone the assembly with --recurse-submodules and run python3 scripts/bootstrap.py: exit 0. Line 51 of contracts/shape-pin.yaml is - path: shape/.gitignore, and validate-pins.py exits 0.
  4. Do the follow-up: cat shape/.gitignore >> .gitignore; git rm shape/.gitignore; git commit -am "merge shape/.gitignore into .gitignore".
  5. python3 scripts/validate-pins.py exits 1 with FINDING shape-copy-missing: contracts/shape-pin.yaml: shape/.gitignore is pinned but absent. python3 scripts/bootstrap.py exits 1 with the same finding and bootstrap FAILED: pins (exit 1).
  6. update-shape.py check --root $R/MedxRoot --upstream $U, exit 1:
      copy-missing       shape/.gitignore
                         (pinned but absent from the root; a human decides whether it was deleted on purpose)
    REFUSAL AHEAD: `apply` will refuse while these are unresolved — shape/.gitignore
    NEXT  python3 update-shape.py apply --root <R>/MedxRoot --upstream <U> --at 437a360a45da26f0e9da0f023a0504cd336aa91e --yes --branch shape/update-437a360a45da
    
  7. That apply, exit 2:
    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:
        shape/.gitignore: pinned but absent from the root; a human decides whether it was deleted on purpose
    Remediation: merge each one by hand (the upstream bytes are `git show <target>:<source path>` in a shape clone), commit it, then re-run this with --accept-local on that path so the row is recomputed from what you merged.
    
  8. The same apply with --accept-local shape/.gitignore: identical output, exit 2.
  9. shape-doctor.py --root $R/MedxRoot, exit 1. It reports FINDING pins … shape-copy-missing and FINDING shape currency … shape/.gitignore, whose NEXT is step 6's check, and the verdict is DRIFTED (1 copy-missing).
  10. In throwaway copies of the root:
    • git checkout HEAD~1 -- shape/.gitignore (restoring the copy): validate-pins.py exits 0;
    • deleting the shape/.gitignore row from contracts/shape-pin.yaml by hand: pins ok, exit 0.

Why. At 437a360:

  • Adoption pins the collision copy where it landed. place writes a colliding copy under shape/ (scripts/shape_materialize.py:1961-1995). The verbatim copies, among them Makefile, .gitignore and .gitattributes (:411-436), are pinned at the path they landed on. collision_follow_up says "merge {actual} into {intended}" and nothing about the row (:646-665).
  • A pinned path with no file is a conflict. classify marks any pinned path the root has no file at as copy-missing (update-shape.py:551-556), which is one of CONFLICTS (:254).
  • The refusal names an exit it does not honour. _refuse_conflicts exempts only both under --accept-local. Its docstring says the other conflict states, copy-missing among them, "have no such exit", yet the remediation it prints for all four says to re-run with --accept-local (:2510-2534).
  • The project's own gate runs the check. validate-pins.py reports the row (templates/assembly-root/scripts/validate-pins.py:391-394). bootstrap.py runs it (templates/assembly-root/scripts/bootstrap.py:80), and so does CI (templates/assembly-root/.github/workflows/validate.yml:200).
  • Nothing removes a row. apply re-pins rows, or adds them with --add, and no other tool edits contracts/shape-pin.yaml.

Proposed fix (for review on the PR). Brett Heap ruled, 2026-10-12T23:16:24Z: "for auU-03, the pin row goes" (auU-03 is this issue's audit finding). When a shape/ collision copy has been merged away, its pin row is removed, not repointed at the merged file. What remains open is the MECHANISM: which tool, and which step, removes the row. Options for Brett:

  1. check names it, apply drops it. check reports a merged-away shape/ copy as a verdict of its own, separate from copy-missing: for example, a pinned path under the collision directory whose original path (shape/X → X) the root holds. apply then removes that row in its re-pin commit behind the usual --yes, the same yes that covers every other row it moves.
  2. An explicit per-path flag on apply (a name like --drop <path>). It is accepted only for such a row, and refused for any other row with the reason. check's NEXT does not pre-fill it, and the row's detail names it.
  3. adopt-project.py, the tool that made the copy and its follow-up, removes the row. For example, a step run after the follow-ups are merged, which removes the rows of merged-away shape/ copies in one commit on a branch.

In each option:

  • the doctor's shape currency and pins rows name that step as their NEXT;
  • update-conflict's remediation for copy-missing stops naming --accept-local;
  • the plan's follow-up says what happens to the row.

A pinned copy deleted anywhere else (not a merged-away shape/ copy) is outside the ruling and stays copy-missing as it is today. README's "drops the rows" and AGENTS.md:278-280 then follow the mechanism (#483's text).

How to test.

  • An adoption test (local remotes) whose source keeps .gitignore and Makefile: do both follow-ups, remove the copies, and drive the chosen mechanism end to end. Afterwards bootstrap.py, validate-pins.py and the doctor are green, the copies' rows are gone, and nothing else in the pin has moved.
  • A copy-missing row outside shape/ is still refused.
  • apply --accept-local on a copy-missing row gets that state's own remediation, not the one written for both.
  • If adopt-project.py changes, run tests/test_shape_doctor.py and tests/test_scaffold_leg_path_collisions.py too.

Why v1.0.0. Nearly every repository has a .gitignore. Adopting one and doing the follow-up the plan prints breaks the project's make bootstrap and its validate check on every pull request, and the only exits are undoing the follow-up or the hand edit the standard forbids. Proposed P1.

Parent: #458 (update-shape and bump-leg).

Related: #480 (a kept Makefile and make bootstrap), #501 (a NEXT that pre-fills a consent flag), #483 (the docs pass).

Activity

  1. added this to the v1.0.0 milestone on Oct 12, 2026
  2. brettheap commented on Oct 12, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-4, session bf1c72df-1c56-4ac9-aace-3ddd139d7ea3@Eagle, 2026-10-12T23:34:19Z, for #502

    Logged in lanes/log/openRepoShape-4.md at c0b1d3e4b9518ad9839f842051888d1acaca9dfd.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#502:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#502"`, kept where the row or its body names `#502`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `502` as a whole token:
       none
    
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions