Skip to content

setup-project.py (behind setup.sh and openRepoShape <Project>) checks the clone path <into>/<Project> only after all three repositories exist, so a person who follows README's "Rehearse first" and then runs for real in the same folder, where the rehearsal left ./Atlas, gets three new GitHub repositories, a refusal, a printed hand clone that fails on the same ./Atlas, and a re-run that is refused scaffold-remote-exists #498

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 auS1-02), re-verified on main 437a360. Lane 4 claims it.

What is wrong. README's "Rehearse first, creating nothing" (README.md:285-313) runs openRepoShape Atlas --org <your-org> --local-remote-dir ./rehearsal, and says "What it leaves behind is ./Atlas and three bare repositories in ./rehearsal, both of which you can delete" (:306-308; the handbook's Linux panel says the same, docs/handbook.html:858-860). Deleting is optional in the text. A person who rehearses and then runs the real command in the same folder goes through the preflight, the naming check, the plan and the yes. Then gh repo create makes all three repositories and pushes them, and only after that does the run refuse:

REFUSED: <folder>/Atlas already exists, so there is nowhere to clone into. The three repositories WERE created. Finish by hand:
    git clone --recurse-submodules <url>
    cd Atlas && python3 scripts/bootstrap.py

The printed git clone fails on the same directory. The cd Atlas that follows it lands in the REHEARSAL project, whose origin is ./rehearsal/Atlas.git. A re-run after deleting ./Atlas is refused scaffold-remote-exists, because the three repositories now exist, and its remediation calls the new root "a live repository" and points at adopt-project.py plan. The plan the person said yes to never names the clone path: step (5) prints the three remotes, not <folder>/Atlas. So nothing on screen before the yes warns them.

Reproduction. Offline, on Linux. $U is a checkout of main 437a360 and $R is an empty directory. The repositories are local bare ones; a gh that exits 97 stands first on PATH (it was never called); GIT_ALLOW_PROTOCOL=file is set; git reads an empty global config; identities come from GIT_AUTHOR_*/GIT_COMMITTER_*. --yes stands in for the human typing yes; it changes nothing in the order of the steps. A second --local-remote-dir stands in for GitHub.

  1. Rehearse:
    cd $R && $U/setup.sh --org Northwind --project Atlas --visibility private \
        --elected-by 'Dana Okafor' --local-remote-dir $R/rehearsal --into $R --yes
    DONE, exit 0. $R now holds Atlas/ and rehearsal/.
  2. Run for real, in the same folder:
    $U/setup.sh --org Northwind --project Atlas --visibility private \
        --elected-by 'Dana Okafor' --local-remote-dir $R/real --into $R --yes
    (6) scaffold
    creating remotes
      bare  <R>/real/Atlas-spec.git
      bare  <R>/real/Atlas-code.git
      bare  <R>/real/Atlas.git
    REFUSED: <R>/Atlas already exists, so there is nowhere to clone into. The three repositories WERE created. Finish by hand:
        git clone --recurse-submodules <R>/real/Atlas.git
        cd Atlas && python3 scripts/bootstrap.py
    
    Exit 2. $R/real holds Atlas.git, Atlas-spec.git and Atlas-code.git.
  3. Run the hand clone as printed, from the same folder: fatal: destination path 'Atlas' already exists and is not an empty directory., exit 128. git -C Atlas remote get-url origin prints <R>/rehearsal/Atlas.git.
  4. Move the rehearsal's ./Atlas aside and run step 2 again: REFUSED scaffold-remote-exists: <R>/real/Atlas.git already exists and has commits, then Remediation: it HAS commits, so it is a live repository and this is not a scaffold. Use adopt-project.py plan …, exit 2.

Against GitHub, step 2 leaves <org>/Atlas, <org>/Atlas-spec and <org>/Atlas-code created and pushed, and nothing cloned. openRepoShape Atlas … passes the folder the person is standing in as --into (setup-project.py:688-693), so the README's own command lands exactly here.

Why. At 437a360, _main (setup-project.py:1848-1857) runs the steps in this order:

  • the preflight;
  • resolve_family (:1851), which decides the landing, <into>/<Project>, in step (3) (Landing.clone_path, :1461-1462);
  • the naming check;
  • plan_and_confirm (:1854);
  • scaffold (:1855), which runs scaffold-project.py; its _create_remotes creates spec, code and the assembly (gh repo create, scaffold-project.py:1126-1157) and pushes them;
  • only then clone_and_bootstrap (:1856), whose first act is the existence check (setup-project.py:1676-1682).

The path is known in step (3), and the comment at :1651-1654 already holds that a rehearsal that stops at the plan "must leave the disk exactly as it found it". Nothing reads the path before step (7). No test covers the refusal: grep -rn "nowhere to clone" tests/ finds nothing.

Proposed fix (for review on the PR).

How to test. In tests/test_setup_project_py.py and its setup.sh twin, through one helper in tests/conftest.py so that the new-code duplication gate holds:

  • With --local-remote-dir and --into <dir> where <dir>/Atlas already exists, the run exits 2 before step (5) with the new refusal, and the remote directory is ABSENT: nothing was created.
  • A rehearsal, then a real run into a second --local-remote-dir with the same --into: the second run is refused before anything exists.
  • An empty <dir>/Atlas behaves as the chosen option says.

Why v1.0.0. README tells every new user to rehearse first, then run for real, and lets them keep what the rehearsal leaves behind. Doing exactly that against GitHub creates three real repositories and leaves no project. The recovery line it prints fails, and the re-run is refused. Proposed P1.

Parent: #459 (setup/scaffold).

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:30:21Z, for #498

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

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

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