Skip to content

shape-doctor.py: scaffold_command(…, platform) quotes for the HOST while it spells the interpreter and entry point for the REQUESTED platform — thread platform through its quote_arg calls #103

Closed

Description

@brettheap

Lane: openreposhape-2 (openRepoShape-2)

Recorded, not claimed. Found while fixing the Windows CI failure on PR #102 (commit 1f513c5's test comment says why the fixture path had to stay POSIX).

What is inconsistent. scaffold_command(shape, project, platform) (shape-doctor.py:1979) takes a platform so the Windows and POSIX spellings can each be asserted from either host. Since #102 it threads that argument to the entry-point choice (setup-project.py vs setup.sh) and to python_command(platform) (:1955), but NOT to its own quote_arg(...) calls at :2003-2006, which fall back to quote_arg's default and read the real host's os.name. So with an explicit platform, half the line follows the requested platform and half follows the host: scaffold_command(PureWindowsPath(r"C:\srv\openRepoShape"), "Atlas", "nt") renders python C:\srv\openRepoShape\setup-project.py … bare on a Windows host and python 'C:\srv\openRepoShape\setup-project.py' … quoted on Linux or macOS, for the same arguments.

Why it is only a nit today. Every real run passes platform=None, so the doctor's report and --json next lines are consistent for the machine they are produced on. The override exists for the tests, and the tests avoid the seam by using a POSIX fixture path for both rows (/ is in both alphabets). Nothing a user sees is wrong.

Why it is worth closing anyway. The parameter's whole reason to exist is "spell this line for the OTHER platform", and a helper that honours that for the interpreter and the entry point but not for the quoting is a trap for the next caller (a report rendered on Linux for a Windows reader, or a --json consumer that asks for one platform's spelling). The way-in row at :2026 has the same shape.

The fix. Thread platform through every quote_arg inside scaffold_command (and any helper that takes platform and quotes), and add the test that could not be written on #102: a PureWindowsPath fixture that renders bare on nt and single-quoted on posix from ANY host, asserted byte for byte on both. render-cli-reference.py --check should be unaffected (no --help text changes).

Activity

  1. brettheap commented on Sep 11, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openreposhape-2 (openRepoShape-2), session 8706b0f5, 2026-09-11T13:10Z, for the whole of this issue, branch fix/doctor-scaffold-command-platform-quoting.

    The three reads Rule 1 asks for, and what they returned:

    1. Claims and comments on the governing record — this issue carries no
      comment but its own opening text; nobody has claimed it. gh issue list --repo opensoft/openRepoShape --state all --search "quote OR quoting OR platform OR scaffold" returns shape-doctor.py: the next-command lines interpolate paths without shell quoting, on every row since #96 — needs a platform-aware quoter (shlex.quote is POSIX-only; the file runs on Windows by contract) #101 (CLOSED, the quoter this finding came
      out of), No native Windows path: setup.sh and the openRepoShape command are bash; a Python entry point, Windows CI, and the README path #49/One definition for the two entry points: setup.sh becomes a shim over setup-project.py (follow-up of #49) #50 (CLOSED, the native Windows entry point and the one
      definition behind the two) and docs/cli.md: a flag-level CLI reference for an agent, GENERATED from every shipped tool's --help, with a hygiene test that fails when the committed file drifts from what the generator produces #97 (CLOSED, docs/cli.md) — none is about
      scaffold_command's own quoting.
    2. gh pr list --repo opensoft/openRepoShape --state open — no open pull
      request on this repository at all
      , so nothing in flight can conflict at
      the file level. Two SIBLING issues are being worked in parallel from
      separate worktrees on the same file: shape-doctor.py: the naming row hands repository names to argparse as bare positionals — a directory named --help is read as an option in both the validator call and the emitted --explain line; put -- before the names #104 (the naming row's bare
      positionals) and shape-doctor.py: the drifted-file remediation says cp on Windows, where cp is Copy-Item and -Path reads [old] as a wildcard even when quoted — emit Copy-Item -LiteralPath on nt #105 (the drifted-file cp remediation on Windows).
      Neither touches scaffold_command, python_command, quote_arg or the
      way-in row, and this lane stays inside those; the new tests go NEXT TO
      the existing scaffold_command/quoter tests in
      tests/test_shape_doctor.py rather than at the end of the file, so the
      later rebase of all three is clean.
    3. git ls-remote --heads origin — 37 heads, none of them
      fix/doctor-scaffold-command-platform-quoting and none matching
      scaffold|quot|platform. The branch is free.

    Working in a linked worktree cut from origin/main at 32450eb; the shared
    checkout belongs to another session and is not touched. Read in full before
    authoring: quote_arg and its two alphabets (UNQUOTED_POSIX,
    UNQUOTED_NT), python_command, scaffold_command, check_the_way_in,
    Row.__init__'s second ascii_text pass, PR #102's body and its commit
    1f513c5 (why the fixture path had to stay POSIX), the quoter and scaffold
    tests in tests/test_shape_doctor.py, and scripts/render-cli-reference.py
    against docs/cli.md.

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