Skip to content

adopt-project.py check passes a plan that keeps the source's own shape/ in the root, and place() then writes the shape's collision copy onto it after both legs are pushed: a real shape/README.md is overwritten while execute prints "nothing was overwritten" and ends adopt-lost, and a shape/Makefile/ directory or a file named shape is a traceback #262

Closed

Description

@brettheap

(lane openRepoShape-1, 2026-10-11T21:44:09Z)

Found by this lane's adversarial review of the #183 branch (fix/adopt-root-kept-symlinks at 04792d2): the no-symlink half of its B2, out of that branch's scope. Pre-existing on main 39ac59c, and identical on 04792d2 but for the third case below.

What is wrong. When the source already holds a path the shape writes (README.md, Makefile, .gitignore, ...), the materializer writes the shape's copy beside it under shape/. place() never asks whether that collision path is itself taken. A source can keep its own shape/ in the root: plan sends a shape/ directory to a leg by extension majority, and the person answers root. check then says plan ok, both legs are created and pushed, and then:

  • A real shape/README.md is overwritten by the shape's README. execute prints beside shape/README.md (... nothing was overwritten), pushes the split branch with the overwritten file, and its verification ends adopt-lost.
  • A Makefile beside a real directory shape/Makefile/: the copy lands on the directory, and execute dies in an IsADirectoryError traceback.
  • A plain file named shape: execute dies in a FileExistsError traceback. (On 04792d2 this case is REFUSED materialize-blocked, still after both legs.)
SHAPE=<openRepoShape checkout>
export GIT_AUTHOR_NAME=T [email protected] GIT_COMMITTER_NAME=T [email protected]
run_case() {   # $1 = a label; $2 = what the source adds beside README.md, src/ and docs/; $3 = the plan entry kept in the root
  TMP=$(mktemp -d)
  git init -q -b main "$TMP/Thing" && cd "$TMP/Thing" || exit 1
  mkdir src docs && printf 'print(1)\n' > src/app.py && printf '# Spec\n' > docs/spec.md
  printf '# Thing\n' > README.md && sh -c "$2" && git add -A && git commit -qm init
  echo "== $1"
  python3 "$SHAPE/adopt-project.py" plan --source "$TMP/Thing" --project Northwind --org testorg \
      --elected-by 'T H' --elected-on 2026-09-02 --out "$TMP/plan.yaml" >/dev/null
  python3 - "$TMP/plan.yaml" "$3" <<'EOF'
import re, sys
plan, path = sys.argv[1], sys.argv[2]
text = open(plan).read()
text = re.sub(rf"(?m)^(  - path: {re.escape(path)}\n    leg: )\S+$",
              r'\1root\n    resolution: "the source keeps it in the root"', text)
open(plan, "w").write(text)
EOF
  python3 "$SHAPE/adopt-project.py" check --plan "$TMP/plan.yaml" | tail -1
  python3 "$SHAPE/adopt-project.py" execute --plan "$TMP/plan.yaml" --yes \
      --local-remote-dir "$TMP/remotes" --work-dir "$TMP/work" > "$TMP/out" 2> "$TMP/err"
  echo "execute exit $?:"
  grep -E '^  beside' "$TMP/out"; grep -E '^REFUSED|^FINDING|^[A-Za-z]*Error' "$TMP/err" | sed "s#$TMP#<T>#g"
  echo "leg repositories: $(ls "$TMP/remotes" | tr '\n' ' ')"
  if git rev-parse -q --verify adopt/three-repo-shape >/dev/null; then
    echo "the split branch's shape/README.md starts: $(git show adopt/three-repo-shape:shape/README.md | head -1)"
  fi
}
run_case 'a real shape/README.md, shape/ answered root' 'mkdir shape && printf "# Our shape notes\n" > shape/README.md' 'shape/'
run_case 'a Makefile and a real directory shape/Makefile/, shape/ answered root' 'printf "all:\n\techo hi\n" > Makefile && mkdir -p shape/Makefile && printf "x\n" > shape/Makefile/notes.md' 'shape/'
run_case 'a plain file named shape, answered root' 'printf "a file named shape\n" > shape' 'shape'

Observed on main 39ac59c:

== a real shape/README.md, shape/ answered root
plan ok
execute exit 1:
  beside  shape/README.md (the source already has README.md; nothing was overwritten)
FINDING adopt-lost: shape/README.md (16d42eb05931) is in no leg, not in the root tree, and not listed as drop
leg repositories: Northwind-code.git Northwind-spec.git
the split branch's shape/README.md starts: # Northwind
== a Makefile and a real directory shape/Makefile/, shape/ answered root
plan ok
execute exit 1:
IsADirectoryError: [Errno 21] Is a directory: '<T>/work/Northwind/shape/Makefile'
leg repositories: Northwind-code.git Northwind-spec.git
== a plain file named shape, answered root
plan ok
execute exit 1:
FileExistsError: [Errno 17] File exists: '<T>/work/Northwind/shape'
leg repositories: Northwind-code.git Northwind-spec.git

In the first case the source's own shape/README.md (# Our shape notes) is gone from the split: the pushed branch carries the shape's README in its place. In every case both leg repositories exist and are pushed on main.

Why it matters.

  • The first case overwrites a file of the source's own in the split commit and says, on the line before, that nothing was overwritten. The plan's own follow-up says it too: "merge shape/README.md into README.md: ... the shape's copy was written beside it and NOTHING was overwritten". Only the verification notices.
  • The other two end in a Python traceback that names no plan entry.
  • In all three, both leg repositories exist and are pushed when the run stops. Against GitHub those are two real repositories, and a corrected re-run meets them as leg-remote-exists.
  • The README promises the opposite: "Ambiguous is an answer, and nothing is overwritten" (README.md:766), and a colliding shape file "is written under shape/ and the collision becomes a follow-up for a human to merge" (README.md:775-777).

Where (main 39ac59c):

  • scripts/shape_materialize.py:1304-1322, place(). When target/rel exists, it writes collision_dir/rel without asking whether that path exists, is a directory, or lies under a file. path.parent.mkdir(parents=True, exist_ok=True) then raises for a file named shape.
  • scripts/shape_materialize.py:17-25: the module docstring's promise that a collision is written beside the original and never overwrites.
  • adopt-project.py:169 (COLLISION_DIR = "shape"), and :2741-2746, which materializes with it and prints the beside ... nothing was overwritten line for every collision.
  • adopt-project.py:1404-1427, _predict_collisions: plan already predicts each collision copy's path, shape/<path>, from assembly_root_paths() (scripts/shape_materialize.py:1144), to write the follow-ups. It never asks whether the root keeps that path, and check predicts nothing.

What would fix it.

Related. #183 and #178: the symlink half of this. On the #183 branch's pushed head (04792d2) the first two cases above are unchanged, and the third is REFUSED materialize-blocked after both legs; that branch's check follows the collision copies only for symlinks. #172 (PR #198): assembly_root_paths(). The companion issue on a plain file kept at a directory the shape writes, filed beside this one.

Not claimed.

🤖 Generated with Claude Code

Activity

  1. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-5, session e62c2fd7-176d-429d-89fb-0653dd08ad5f@Eagle, 2026-10-11T23:22:36Z, for #262

    Logged in lanes/log/openRepoShape-5.md at ff5d260f35b3a1e64a478ee0f0bb6cf26e9cdcee.

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

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions