Skip to content

adopt-project.py check passes a plan that keeps a plain file at a directory the shape writes into (.github, contracts, scripts), and execute dies in a NotADirectoryError or FileExistsError traceback after both legs are pushed #263

Closed

Description

@brettheap

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

Found by this lane's adversarial review of the #183 branch (fix/adopt-root-kept-symlinks at 04792d2), its N2. That branch handles symlinks, and this is a plain file. Pre-existing on main 39ac59c.

What is wrong. The shape writes files into three directories of the assembly root: .github/workflows/validate.yml, contracts/*.yaml and scripts/*.py. A source can hold a plain FILE at one of those directory names, and a plan can keep it in the root:

  • plan asks about a file named .github (leg: null).
  • plan sends a file named contracts to spec and a file named scripts to code, and a person can answer root.

check says plan ok. execute creates and pushes both legs, and then the materializer dies in a Python traceback: NotADirectoryError for .github, FileExistsError for contracts and scripts.

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' ' ')"
}
run_case 'a plain file .github (plan asks), answered root' 'printf "a plain file\n" > .github' '.github'
run_case 'a plain file contracts (plan says spec), answered root' 'printf "a plain file\n" > contracts' 'contracts'
run_case 'a plain file scripts (plan says code), answered root' 'printf "a plain file\n" > scripts' 'scripts'

Observed on main 39ac59c:

== a plain file .github (plan asks), answered root
plan ok
execute exit 1:
NotADirectoryError: [Errno 20] Not a directory: '<T>/work/Northwind/.github/workflows'
leg repositories: Northwind-code.git Northwind-spec.git
== a plain file contracts (plan says spec), answered root
plan ok
execute exit 1:
FileExistsError: [Errno 17] File exists: '<T>/work/Northwind/contracts'
leg repositories: Northwind-code.git Northwind-spec.git
== a plain file scripts (plan says code), answered root
plan ok
execute exit 1:
FileExistsError: [Errno 17] File exists: '<T>/work/Northwind/scripts'
leg repositories: Northwind-code.git Northwind-spec.git

On the #183 branch's pushed head (04792d2), each case ends in a clear refusal instead of a traceback, but still after both legs: execute exit 2 with, for example, REFUSED materialize-blocked: .github/workflows/validate.yml cannot be written: .github is a file, not a directory.

Why it matters.

Where (main 39ac59c):

What would fix it.

Related. #183 and #178: the symlink half; that branch's refusal is the after-the-legs half of this. #172 (PR #198): assembly_root_paths(). #168: execute refuses what check finds. The companion issue on the collision directory shape/, 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:53Z, for #263

    Logged in lanes/log/openRepoShape-5.md at 754009998e30cf74e6b87836b1ebea6cc852197a.

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

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