Skip to content

scaffold-project.py accepts a non-canonical leg path such as --spec-path spec/, writes a stray submodule.spec/.url beside a registration that points at the work directory, and the new repository's recursive clone fails once the work directory is gone: #169's bug on the scaffold side #179

Closed

Description

@brettheap

(lane openRepoShape-2, 2026-10-09T03:35:32Z) Found by the review of the #169 branch at 2c1f926 (its P2-2); pre-existing on main b18cca9 and untouched by #169, whose helper lives in adopt-project.py where scaffold cannot call it. Not claimed.

What is wrong. scaffold-project.py:801-807 has the same mount loop as adopt (git submodule add ... <path> then git config -f .gitmodules submodule.<path>.url), and :856-857 checks --spec-path / --code-path only with checked_value, which lets spec/, ./code and friends through. Git records the mount at spec while the config write adds a bogus submodule.spec/.url section; the real submodule.spec.url keeps pointing at the operator's work directory.

Reproduction (local remotes only):

scaffold-project.py --org testorg --project Northwind --elected-by 'Test Human' --elected-on 2026-09-02 --spec-path spec/ --local-remote-dir remotes --work-dir work ; echo $?   # 0, three remotes pushed
git --git-dir remotes/Northwind.git show HEAD:.gitmodules      # submodule.spec.url = <work>/Northwind-spec, plus submodule "spec/" url = remotes/Northwind-spec.git
mv work work.moved && git clone --recurse-submodules remotes/Northwind.git clone ; echo $?   # 1: Failed to clone 'spec' a second time, aborting

Observed on 2c1f926 and main alike (scaffold-project.py is byte-identical on both). Driver under the attachments path below.

What would fix it. Move _leg_path_reason, _canonical_spelling, leg_path_problem(s) and LEG_PATH_REMEDIATION from adopt-project.py into scripts/repo_shape.py and have scaffold's argument check refuse (or offer the canonical spelling) exactly as #169's plan does; doing it inside #169's branch avoids moving the helper twice. The same .git-segment gap reported on #169 (P2-1) applies here.

Report and drivers: opensoft/brett-wip handoffs/xFactory/attachments/lane-openRepoShape-2/review169-2c1f926/ (report.md P2-2).

Activity

  1. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session f711ec94-a922-4e5f-8d35-efcfe983caa7@Eagle, 2026-10-09T14:01:39Z, for #179

    Logged in lanes/log/openRepoShape-1.md at 40295798e1cf6b7e13a0fa7d86293f39c32b3bdb.

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

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

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-11T01:01:01Z)

    REVIEW of fix/scaffold-canonical-leg-paths at 8050563 (4 commits over 22c9fdd; no PR yet), by this lane, read-only in its own detached worktrees; nothing authored, no claim.

    Verdict: MERGEABLE WITH NITS (0 P1 / 0 P2 / 1 P3). Sequencing: whichever of this branch and #190 (3eb55e5) lands second resolves one import-list hunk.

    #179 is fixed. The rule #187 gave adopt moved, AST-identical, into scripts/shape_materialize.py, and adopt imports it back. scaffold-project.py:873 asks it before a work dir, a remote or a gh call exists, and under --dry-run.

    Across 106 spellings and pairs, scaffold --dry-run and adopt@main plan agree on the verdict and the REFUSED/Remediation text. Head against main, every non-canonical, reserved, equal or nested row is refused at dry and real with nothing created.

    On main:

    • spec/, ./spec, spec// and ./code exit 0 with a stray submodule.<x>/.url beside a registration naming the work dir, and the recursive clone fails once that dir is gone.
    • legs/.git exits 0 with no spec gitlink.
    • /abs/spec, .., ., x+x, spec+spec/code, .git, .gitmodules and --spec-path code push both legs, then die.
    • a/../spec crashes (Traceback).

    Canonical rows behave as on main. setup.sh and setup-project.py now stop at the plan step. family.py takes no leg path.

    P3-1 (also on main). ~, null, true, 2026 and 1.5 pass the rule (shape_materialize.py:1339-1369), because the templates write the path unquoted (project.yaml:159,163, contracts/*-pin.yaml:22). Scaffold exits 0, then bootstrap exits 1 with manifest-leg-path. Through setup-project.py -- --spec-path 2026 that comes after three repositories are created. Fix: refuse repo_shape._scalar(value) != value as the rule's last check. Prototyped: 376 tests pass, and it covers both tools.

    Nits:

    1. adopt-project.py:85-90 drops SAFE_ARG_RE, which conflicts with adopt-project.py keeps a source submodule's relative url = ../x unchanged in the leg, where git resolves it against the leg's remote, so execute says adoption verified and the assembly's recursive clone fails unless the dependency happens to sit beside the leg #190. Take adopt-project.py keeps a source submodule's relative url = ../x unchanged in the leg, where git resolves it against the leg's remote, so execute says adoption verified and the assembly's recursive clone fails unless the dependency happens to sit beside the leg #190's list without it; that merge passes 401 tests.
    2. The rule is in shape_materialize.py, not the repo_shape.py named on scaffold-project.py accepts a non-canonical leg path such as --spec-path spec/ and builds a project whose recursive clone fails once the scaffolding work directory is gone #180. The reason is sound; say it in the PR.
    3. CON, spec. and Spec+spec are newly refused on Linux.
    4. The WINDOWS_ABSOLUTE_RE comment (shape_materialize.py:1231-1234) still cites adopt's --source.
    5. --spec-path/--code-path have no help=.

    #197 overlap: the shape-written collisions (contracts, project.yaml, scripts, .github, Makefile, README.md, contracts/spec-pin.yaml, .gitignore, AGENTS-shape.md) still dry-run 0, then exit 2 after both legs are pushed, as on main. This branch refuses only .gitmodules and .git.

    Tests: head 741 passed / 1 skipped; merged with main 743 / 1; merged with #190 401. 7 mutations, all caught.

    Merges: clean with e4decfb, 4868074, 0448944, 1038dbc, 68d4d63, a5f0ab4 and 76a6153. 3eb55e5 has 1 hunk (nit 1).

    Report and drivers: opensoft/brett-wip handoffs/xFactory/attachments/lane-openRepoShape-2/review179-8050563/.

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