Skip to content

install.sh and openRepoShape --install: one line, curl -fsSL https://github.com/opensoft/openRepoShape/releases/latest/download/install.sh | bash, installs the newest release pinned to it, with git-filter-repo, and ends with the preflight, and the installed command stays on its release (#564) - #577

Merged
brettheap merged 5 commits into
release/v1.0from
l3-564-one-line-install
Oct 15, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openreposhape-3 (openRepoShape-3)
Claim: #564 (comment)

This PR's base is release/v1.0, the v1.0.0 release commit bfed143, and it ships as v1.0.1 (Brett Heap, 2026-10-14T22:54:54Z, "v1.0.1 soon (Recommended)"). The same change is carried into main afterwards, for v1.1.0.

Head: 868c9bf8 (fix rounds on top of d0cdbf4c: 319b005d code and tests, 322a305e docs, 868c9bf8 release notes).

What

  • install.sh at the repository root, attached to every release:
    curl -fsSL https://github.com/opensoft/openRepoShape/releases/latest/download/install.sh | bash

    • It installs the newest release, or the one named with | bash -s -- v1.0.1 or bash install.sh v1.0.1.
    • It reads the newest tag from github.com's releases/latest redirect, so it needs no gh and no login. gh api is only a fallback.
    • Every curl it runs is HTTPS only, redirects included, at TLS 1.2 or newer.
    • It fetches that release's openRepoShape, checks it, runs its --install with OPENREPOSHAPE_REF=<tag> OPENREPOSHAPE_RECORD_REF=1, and confirms the pin with --version.
    • It installs git-filter-repo 2.47.0 with pipx when pipx is present and the tool is missing. Otherwise it prints the one command that would install it (brew; sudo apt-get install -y pipx && pipx install … where apt-get is; pip otherwise), and never runs it.
    • It ends with openRepoShape --preflight. install.sh itself never runs sudo; the preflight it ends with offers what is missing, each behind a typed yes at your terminal.
    • Exit codes: 0 installed, pinned and ready; 1 installed, but the preflight or the pin needs attention; 2 nothing installed.
  • openRepoShape --install records a ref only when asked (OPENREPOSHAPE_RECORD_REF=1), in openRepoShape.ref beside the command, or keeps the command's own record when it re-installs itself. The command stays byte for byte the release's file. The installed command, or a symlink to it, then:

    • fetches setup.sh at that ref;
    • passes --shape-ref to setup.sh;
    • checks the doctor's clone out at that ref.

    $OPENREPOSHAPE_REF still overrides it for one run, and --version prints the ref in force. Any other install, including one with $OPENREPOSHAPE_REF exported and no opt-in, records nothing, removes a record already there, and follows main, as in v1.0.0.

  • Docs:

Fix round (RV577, FIX-ROUND)

  1. HTTPS only (SonarCloud shell:S6506). --proto '=https' --proto-redir '=https' --tlsv1.2 on each curl line: install.sh's redirect read and launcher fetch, and the launcher's raw-URL fallback. A test holds every curl that runs in both scripts to it.
  2. Recording is opt-in. workBenches exports OPENREPOSHAPE_REF=pinned-by-workBenches-no-fetch around --install; that is no longer recorded, so its re-vendor needs no change for this.
  3. The sudo claim is now "install.sh itself never runs sudo; the preflight it ends with offers what is missing, each behind a typed yes at your terminal", in README, handbook, notes and install.sh --help.
  4. Attaching install.sh: the notes' "Before tagging (remove at tag time)" section: gh release upload v1.0.1 install.sh, check the releases/latest/download/install.sh redirect, never attach it to v1.0.0, and use --latest=false for a later patch on an older line.
  5. apt-get machines are told the pipx route; Debian 12 and Ubuntu 23.04+ refuse pip install --user.
  6. A symlink to the command reads the record beside the file it points at (portable readlink loop, no -f, at most 40 links).
  7. AGENTS.md gains the rule, paid for by tightening the --allow-upstream-org paragraph; every rule kept.
  8. Git Bash: the notes say it is supported but its tests skip on the Windows job; no Git Bash job is added here.
  9. Nits:
    • a command that did not record its tag gets its preflight run with the tag named;
    • the notes on $OPENREPOSHAPE_REF speak of the shell profile and suggest v1.0.1 or newer;
    • the last line is { main ${1+"$@"}; };
    • --help answers past a broken record;
    • a record that is a directory is refused in the usual form;
    • README step 3 folds the pin into one paragraph, 6 lines shorter, so the cap is now 1444, not 1450;
    • "pinned to the release tag";
    • the failure wording tells a server error from no answer, and a not-ready preflight from one that did not run.
  10. Round 2 (868c9bf8, release notes only): the "Before tagging" steps now land, prove the squash tree (or dispatch the three-OS run on it), tag annotated, create the release with install.sh attached and --verify-tag, and check the asset by redirect and by bytes; Git Bash is "meant to work", untested until Git Bash on Windows: run the launcher and install.sh tests under Git Bash in the Windows job, so the one-line install is tested there (follow-up to #564) #585; only install.sh's own downloads are said to be HTTPS only.

Why

Brett Heap, 2026-10-14T22:50:40Z: "we need it to be more simple to install … now and after, we need a simple install process". The installed command defaulted to main on every run, so from v1.0.0 on it drifted off the release within hours.

Tests

  • tests/test_install_sh.py (45 tests). They run offline on a PATH the test owns, with fakes for curl, gh, pipx, git-filter-repo, git, brew and apt-get, and with GH_TOKEN=bogus and an empty GH_CONFIG_DIR. They cover:
    • the latest release from the redirect, in any header case and relative, and the gh fallback;
    • a named release, from a file and piped, and a non-default OPENREPOSHAPE_BIN_DIR;
    • invalid versions and repositories;
    • a fetch refused by the server and one with no answer, and a fetched page that is not the command;
    • every git-filter-repo branch, apt-get included;
    • the preflight running last, through the pin, and its two kinds of failure;
    • a release that cannot be pinned (exit 1, preflight still at the tag);
    • idempotent re-runs, and the upgrade;
    • three downloads cut off in the last line, which run nothing;
    • every curl that runs being HTTPS only.
  • tests/test_openreposhape_command.py (65 tests, 16 new): the record, the opt-in, --version and the override, links, bad and directory records, re-install, upgrade and removal, and the doctor's clone and setup.sh's --shape-ref receiving the recorded ref.
  • Targeted runs on 322a305e's tree, with a stub gh and curl first on PATH, GH_TOKEN=bogus and an empty GH_CONFIG_DIR:
    • test_install_sh, test_openreposhape_command, test_repo_hygiene, test_agents_md_codes and test_cli_reference: 239 passed;
    • test_setup_sh alone: 63 passed, no flake.
  • The tests bite: nine mutations, one per fix (no braces, a curl without --proto, no opt-in from install.sh, links not followed, recording without the opt-in, a lower-case-only header match, the unpinned preflight at main, no apt-get branch, and --help refused past a bad record), each caught.
  • render-cli-reference.py --check is ok; bash -n and /bin/bash -n (5.2 here) parse both scripts.

Known

Closes #564

🤖 Generated with Claude Code

Summary by Sourcery

Provide a secure one-line release installer and preserve the installed openRepoShape command on the release it came from.

New Features:

  • Add a one-line release installer that installs the latest or a specified openRepoShape release without requiring GitHub CLI authentication.
  • Keep installed commands pinned to their release tag and propagate that pin through setup and doctor operations.
  • Automatically install or recommend git-filter-repo and finish installation with a preflight check.

Bug Fixes:

  • Prevent installed commands from drifting to main after release installation.
  • Restrict installer and launcher downloads to HTTPS with redirects and TLS 1.2 or newer.

Enhancements:

  • Add opt-in release-reference recording, including support for upgrades, overrides, symlinks, and invalid records.
  • Improve installer validation, failure reporting, exit statuses, and compatibility with Bash 3.2.
  • Update macOS parsing checks and repository hygiene rules for the new installer.

CI:

  • Extend macOS workflow syntax checks to include install.sh.

Documentation:

  • Document the release installer, release pinning behavior, preflight flow, and release attachment procedure.
  • Add v1.0.1 release notes and regenerate the CLI reference.

Tests:

  • Add comprehensive offline coverage for installer behavior, release discovery, dependency handling, pinning, HTTPS enforcement, failure cases, upgrades, and truncated downloads.
  • Expand command tests for reference recording, symlink handling, overrides, setup propagation, and doctor checkout pinning.

Brett Heap and others added 2 commits October 14, 2026 23:34
…pe.ref` beside the command it places, and the installed command then fetches setup.sh at that ref, hands setup.sh `--shape-ref` for it and checks the doctor's clone out at it, so a command installed from a release stays on that release while `$OPENREPOSHAPE_REF` still overrides it for one run (#564)

An installed command read `$OPENREPOSHAPE_REF` at every run and fell back
to main, so from v1.0.0 on, with main carrying v1.1.0 work, a command
installed from a release drifted off it within hours. The ref is now NAMED
by the variable or by the record, and both places that honoured only the
exported variable (the doctor's checkout and setup.sh's `--shape-ref`)
honour either.

The record is a sidecar file, never an edit to the command: the placed
command stays byte for byte the file it was installed from, so the
installer's own `(unchanged)` verdict and any copy vendored and checked by
sha256 still compare bytes and never see the record. An install with no
ref records nothing and removes any record already there, which is the
command exactly as before. The ref is checked before anything is placed,
and the record is checked when it is read, naming the file and the two
ways out. `--version` prints the ref in force. docs/cli.md is regenerated
for the `--help` paragraph that says so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oShape/releases/latest/download/install.sh | bash`, installs the newest release's openRepoShape pinned to that release, installs git-filter-repo with pipx where pipx is and it is not or prints the one command that would, and ends with `openRepoShape --preflight`; README, the handbook and the v1.0.1 release notes lead with it (#564)

Brett Heap, 2026-10-14: "we need it to be more simple to install ... now
and after, we need a simple install process", and "v1.0.1 soon".

install.sh is attached to every release, so `releases/latest/download/`
is always the newest. It reads the newest tag from github.com's
`releases/latest` redirect with no gh and no login, asking `gh api` only
when the redirect names none; takes a named release as its one argument;
fetches that release's `openRepoShape`, checks it is the command, and runs
its `--install` with `$OPENREPOSHAPE_REF` set to the release, then asks the
installed command's `--version` that it stayed there. Every step says what
it did in one line. It never runs sudo. Exit 0 installed and ready, 1
installed but the preflight or the pin needs attention, 2 nothing
installed; git-filter-repo never moves it. Everything runs from a `main`
called on the last line, so a cut-off download runs nothing.

README.md: step 3 and the worked example lead with the one line, the gh
api and raw-URL lines stay as the by-hand way at main, and Layout gains
install.sh; the cap moves 1422 -> 1450, with the reason in
test_readme_is_short_enough_to_be_read. docs/handbook.html says the same,
names the new README blob and adds the (#564) clause. install.sh joins
SHIPPED_BASH and the macOS job's `/bin/bash -n` step, and one test holds
the one line byte for byte in every file that carries it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 4 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR introduces a root-level, bash 3.2-compatible release installer that installs and preflights the newest or named openRepoShape release, pins the installed command to that release through a sidecar ref record, and updates the launcher, tests, CI checks, documentation, and v1.0.1 release notes to support and verify the workflow.

Sequence diagram for the release installation and preflight flow

sequenceDiagram
    participant User
    participant Installer as install.sh
    participant GitHub
    participant ReleaseCommand as openRepoShape
    participant Pipx

    User->>Installer: Run install.sh [version]
    alt version omitted
        Installer->>GitHub: Read releases/latest redirect
        GitHub-->>Installer: Newest release tag
    else version named
        Installer->>Installer: checked_version
    end
    Installer->>GitHub: Fetch openRepoShape at release ref
    GitHub-->>Installer: Release command
    Installer->>Installer: looks_like_the_launcher
    Installer->>ReleaseCommand: --install with OPENREPOSHAPE_REF
    ReleaseCommand->>ReleaseCommand: Record openRepoShape.ref
    ReleaseCommand-->>Installer: Installed command
    opt git-filter-repo missing and pipx available
        Installer->>Pipx: Install git-filter-repo==2.47.0
        Pipx-->>Installer: Installation result
    end
    Installer->>ReleaseCommand: --version
    ReleaseCommand-->>Installer: Confirm release ref
    Installer->>ReleaseCommand: --preflight
    ReleaseCommand-->>User: Readiness verdict and exit status
Loading

Sequence diagram for running a release-pinned openRepoShape command

sequenceDiagram
    participant User
    participant Command as openRepoShape
    participant Setup as setup.sh
    participant Git as git
    participant Doctor as shape-doctor.py

    User->>Command: Run command
    Command->>Command: Resolve OPENREPOSHAPE_REF or openRepoShape.ref
    Command->>Setup: Fetch setup.sh at resolved ref
    Setup->>Setup: Pass --shape-ref resolved ref
    Setup->>Git: Clone standard at resolved ref
    Git-->>Setup: Ref-pinned clone
    Command->>Doctor: Run --doctor on ref-pinned clone
    Doctor-->>User: Verification result
Loading

File-Level Changes

Change Details Files
Add a release-aware one-line installer that fetches, validates, and installs the newest or explicitly named release without requiring GitHub CLI authentication.
  • Resolve the latest release via GitHub redirect with gh fallback, or validate an explicitly supplied ref.
  • Fetch the release-specific launcher, reject invalid or non-launcher content, and install it with the release ref recorded.
  • Handle git-filter-repo detection or optional pipx installation without sudo.
  • Run the installed command's preflight last and distinguish success, installed-but-needs-attention, and refused-install exit statuses.
  • Add extensive offline fake-based coverage for release lookup, validation, dependency branches, failures, upgrades, and piped/file invocation.
install.sh
tests/test_install_sh.py
Persist the launcher's installation ref so installed commands remain on their release while preserving byte-for-byte command contents and supporting per-run overrides.
  • Write and validate openRepoShape.ref beside the installed command, including record replacement and removal.
  • Make recorded refs the default for setup.sh fetching, standard cloning, doctor checks, and version reporting.
  • Preserve $OPENREPOSHAPE_REF as a one-run override and reject malformed recorded refs.
  • Add coverage for installation, reinstallation, upgrades, removal, overrides, setup forwarding, and doctor checkout behavior.
openRepoShape
tests/test_openreposhape_command.py
Make the release installer the documented primary installation path and keep documentation, release metadata, and repository guidance synchronized. README.md
docs/handbook.html
docs/cli.md
docs/release-notes/v1.0.1.md
tests/test_repo_hygiene.py
Extend bash compatibility checks and release-focused test expectations to include the new installer.
  • Parse install.sh with macOS-compatible /bin/bash in CI.
  • Treat the installer as a shipped executable subject to shebang, mode, syntax, and fail-fast hygiene checks.
  • Update documentation size and consistency assertions for the new installation flow.
.github/workflows/tests.yml
tests/test_repo_hygiene.py

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Brett Heap and others added 2 commits October 15, 2026 11:21
…rds a ref only with `OPENREPOSHAPE_RECORD_REF=1`, which install.sh sets, so a script that exports `$OPENREPOSHAPE_REF` around it gets v1.0.0's install; every curl that runs is HTTPS only, redirects included, at TLS 1.2 or newer; a link to the command reads its record; `--help` answers past a broken record; and install.sh says which failure it met (#564)

The review on #577 (RV577, FIX-ROUND) and SonarCloud shell:S6506.

openRepoShape:
- The ref is recorded only when asked, or when it came from the command's
  own record (a re-install of itself stays pinned). workBenches exports
  `OPENREPOSHAPE_REF=pinned-by-workBenches-no-fetch` around `--install`;
  that no longer becomes a record every later run would fail on. Any other
  install records nothing and removes a record already there.
- The raw-URL fallback curl carries `--proto '=https' --proto-redir
  '=https' --tlsv1.2`, written on the line.
- The record is found beside the FILE, symlinks followed with a portable
  `readlink` loop (no `-f`, at most 40 links).
- A broken record is kept as a fault and refused after the arguments are
  read, so `--help` still answers; `--version` and every run refuse. A
  record that is a directory is refused in the usual form, by a run and by
  an install, before anything is placed.

install.sh:
- Both curls HTTPS only, redirects included, TLS 1.2 or newer.
- Sets `OPENREPOSHAPE_RECORD_REF=1` for the install.
- A fetch the server refused (curl exit 22) asks whether the release
  exists; no answer at all points at the network instead. A preflight that
  exits 1 names what is missing; any other status says it did not run to
  the end.
- With no pipx, `apt-get` machines are told `sudo apt-get install -y pipx
  && pipx install git-filter-repo==2.47.0` (printed, never run), because
  Debian 12 and Ubuntu 23.04+ refuse `pip install --user`.
- A command that did not record the tag gets its preflight run with the tag
  named, not main's setup.sh; the shell-profile notes say so.
- The last line is `{ main ${1+"$@"}; }`: a download cut inside it runs
  nothing. install.sh itself never runs sudo; the wording now says the
  preflight's offers, some of them sudo, each wait for a typed yes.

Tests: HTTPS_ONLY in the call asserts and a guard on every curl that runs
in both scripts; the opt-in, links, a directory record and `--help` past a
bad record; an upper-case and a relative `location`; a non-default
OPENREPOSHAPE_BIN_DIR; the apt-get branch; the network failure; the
preflight's two failures; three truncated downloads; S9073 composite
asserts split. docs/cli.md regenerated for the `--help` change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, the fix round on #577: install.sh itself never runs sudo while the preflight it ends with offers what is missing behind a typed yes, the command is pinned to the release tag only when asked, step 3 folds the pin into one paragraph six lines shorter, AGENTS.md says the one-line install is the human's to run, and the notes gain the steps that attach install.sh to the release (#564)

- README.md: step 3's paragraph now carries what "pinned" means and the
  corrected sudo sentence, and leaves the exit statuses to `install.sh
  --help` and the release notes; the worked example's lead-in is one line.
  The cap moves to 1444 (from 1450 in d0cdbf4), with the reason updated in
  test_readme_is_short_enough_to_be_read.
- docs/handbook.html: the same paragraph, the same rule in "For AI
  assistants", the #564 footer clause updated, and the new README blob.
- AGENTS.md: "The one-line install (`install.sh`) is theirs to run: relay
  it, never run it." under "Never answer an install prompt", paid for by
  tightening the `--allow-upstream-org` paragraph's middle clause; still
  490 lines, every rule kept.
- docs/release-notes/v1.0.1.md: the corrected sudo sentence, the opt-in
  (`OPENREPOSHAPE_RECORD_REF=1`) and what a script that exports
  `$OPENREPOSHAPE_REF` now gets, HTTPS only, Git Bash supported but its
  tests skip on the Windows job (a known limit, followed up in v1.1.0), and
  a "Before tagging (remove at tag time)" section: upload install.sh to
  v1.0.1, check the `releases/latest/download/install.sh` redirect, never
  attach it to v1.0.0, and publish a later patch on an older line with
  `--latest=false`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…follow in order (land, prove the squash tree or dispatch the three-OS run on it, tag it annotated, create the release with install.sh attached and --verify-tag, check the asset by redirect and by bytes), Git Bash is said to be meant to work but untested until #585, and only install.sh's own downloads are said to be HTTPS only (#564)

The second fix round on #577 (RV577). The old checklist published before
attaching install.sh, could tag main through `gh release create` with no
tag, uploaded an unchecked working-tree file and never tested the release
commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit 8cda139 into release/v1.0 Oct 15, 2026
5 checks passed
@brettheap
brettheap deleted the l3-564-one-line-install branch October 15, 2026 14:20
brettheap added a commit that referenced this pull request Oct 15, 2026
…e `--link-source` is the first chain link's tree alone, and a source that names no path is refused (#441, #442) (#576)

**README change.** This PR edits one README paragraph. #551 is on main and this branch has merged it, so the handbook step follows #551's rule: the three page parts that read the README section "The three legs" record its new hash. No page text changes.

### #441: one bare tree answered for two links

`link_pins_from_trees` passed its `default_source` to every link of a recorded chain. That value is the naming gate's bare `--link-source PATH`, and the scaffold's `--pin-source`. In the chain `openXdox → openYdox → openInk`, with one bare tree that is `openXdox`'s, `openYdox` was read from the same `project.yaml`. That file declares `openYdox`, not `openInk`, so the gate said "openYdox declares openYdox, not openInk". For `codexInk`, which holds no direct pin on its referent, that was a FINDING, exit 1, for a chain that holds. The scaffold refused the same chain as `chain-not-declared`.

Now:

- **Which links read a bare value (for #540 and anyone else relying on it):** only the FIRST link of each chain, `links[0]`, the pin the project holds. That is true for a chain of any length, one link included: a chain of one link has only its first link, and that link reads the bare tree as before. A later link is never offered the bare value. It is read from its own `LINK=PATH`, its `SHAPE_PIN_SOURCE_<LINK>` or a checkout beside the project; otherwise it is declared-unverified (a warning, exit 0). For the first link the order is unchanged: keyed, variable, checkout beside the project, then the bare value.
- `link_pins_from_trees` and `resolve_link_source` keep their signatures and return shapes. The only code change in `repo_shape.py` is `None if index else default_source` in the loop.
- The two-link case (`openXdox → openDox` with a bare path) reads exactly as before and prints the same lines. The one difference is inside the returned mapping, and only for a chain of two or more links: the chain's END link no longer gets an entry read from the bare tree. Nothing reads that entry; only holders' declarations are read. In a chain of one link the only link is both the first and the end, and it still reads the bare tree, as before.
- In the naming gate, `LinkSources` finds the first link of every chain a name will READ before any chain is read. `_first_links_read` uses the same `reads_link_declarations` test the lookup uses, and counts a chain only if it has two or more links: a chain of one link has no holder, reads no declaration, and so has no first link to count. The bare value is offered only while there is at most one first link: with a lone one-link chain there are none, and the bare tree is still returned for that chain's link to read, as before (nothing reads what it finds, so the output is unchanged). If a run reads two chains that begin at different links (a name on the command line plus `--project`, or one project with two legs), the bare value is read for neither. Before, one tree answered both, and `used` counted it once.
- A bare value no link took is a NOTE saying why. In a two-link run the sentence is the one it always was. In a longer chain it reads "a bare PATH is the tree of a chain's first link alone, openXdox, which had a more specific source (...)". With two first links it reads "the chains read here begin at openXdox, openYdox: name the link it is, as --link-source <link>=PATH".

### #442: an empty path was the current directory

`--link-source openXdox=` and `--pin-source openXdox=` became `Path("")`, which is `.`. From a project root, the naming gate read the project's own manifest as `openXdox`'s and called the chain broken. `validate-pins.py` asked the project root for the pinned commit, and its finding blamed `.`.

Now both tools refuse, exit 2, naming the key:

```
REFUSED link-source-no-path: `--link-source openXdox=` names no path for openXdox. An empty path would be read as the directory this runs in. Give the tree's path (`--link-source <link>=<path>`), or `.` to mean this directory.
REFUSED pin-source-no-path: `--pin-source openXdox=` names no path for openXdox. An empty path would be read as the directory this runs in.
Remediation: give the checkout's path (`--pin-source <product>=<path>`), or `.` to mean this directory.
```

- An empty bare value (`--link-source ''`, `--pin-source ''`) is refused the same way.
- A typed `.` still means the current directory.
- A value whose key is NOT a chain link or a declared pin (`openZdox=`) is still the bare PATH `openZdox=`, as #338 and #295 decided. It is not empty, so it is not refused.
- **Behaviour change: an empty value is refused even when a later value replaces it.** `--link-source openXdox= --link-source openXdox=<tree>` was a NOTE ("the later `--link-source ...` replaced it"), exit 0. It is now `REFUSED link-source-no-path`, exit 2. `validate-pins.py` changes the same way: `--pin-source openXdox= --pin-source openXdox=<clone>` was `pins ok`, exit 0, and is now `REFUSED pin-source-no-path`, exit 2. A typo is a typo, and the refusal names it when it is typed; a script that passed an empty value first and the real one after must drop the empty one.
- The naming gate refuses in `main`, right after the values are read and before stdin is read or any name is classified, like its own `REFUSED naming-no-target`.
- `validate-pins.py` raises a `Refusal` from `PinSources`. It reaches `main`'s existing handler with its own remedy, not the lockstep one. **It is raised late:** `PinSources` is built inside `_check_neutral_product_pins`, which `_run_all_checks` calls after `_check_leg` and `_check_shape_pin`. So an earlier refusal wins: a damaged `contracts/spec-pin.yaml` plus `--pin-source openXdox=` prints `REFUSED pin-tag-only`, and the empty path is named on the run after that is fixed. The hunk stays inside `PinSources` on purpose, to stay clear of the lines #539 edits in `_run_all_checks`. The refusal also has to wait for the declared pins, because they decide whether `openXdox=` is keyed or a bare PATH. Nothing is printed before the refusal, and the exit is 2 as in every other refusal of that tool.

### Docs

- `--help` for `--link-source`, the naming validator's module docstring (exit code 2 included), `resolve_link_source`'s rule 4, `link_pins_from_trees`'s docstring and the scaffold's `_declaration` docstring say what a bare value means in a longer chain.
- The `--link-source` help also says that a bare PATH is read for neither link when the chains read begin at two different links, and that a later link is read from its own `PRODUCT=PATH`, its `SHAPE_PIN_SOURCE_<PRODUCT>` or a checkout beside the project (it said "needs its own `PRODUCT=PATH`").
- `docs/cli.md` is regenerated.
- README's lookup-order sentence now reads "then a bare `--link-source <path>`, for the first link's tree only: the order `validate-pins.py` uses below for the same checkout." The paragraph keeps its 12 lines, and README keeps its line count.
- The handbook names no `--link-source`. The three parts that read "The three legs" (the masthead, "Reading private legs in CI", "The three legs, and naming") move to that section's new hash, 6ebed796 → 39ec2c23. No other README section changed.
- `validate-pins.py`'s `--help` and EXIT CODES docstring do not name `pin-source-no-path`. Nothing in them is false: the exit-2 list gives examples. I left them, because the module docstring sits near lines #539 edits.

The review of 04c9d77 (APPROVE WITH NITS) found five nits. Each, and what this commit does:

1. **A chain of one link counted as a first link.** `--referent-chain openInk` beside a project whose leg records `openXdox → openQuill`, with a bare `openXdox` tree, gave two first links, so the bare tree went to neither. `codexQuill`, verified through it on bfed143, was declared-unverified, with a NOTE naming `openInk` as a first link. Both places now count `chain[0]` only when the chain has more than one link: `_first_links_read`, and the `firsts` update in `LinkSources.link_pins`. The run is verified again, with no WARNING and no NOTE, as on bfed143. New test `test_a_chain_of_one_link_is_no_first_link_read`.
2. **A test gap: the project half of `_first_links_read`.** Reverting `if data is not None:` to `if False:` (mutation M14) left all 20 tests passing, yet it changes the output for one project whose two legs begin at different links: the first classification pass counted the bare value used, and the NOTE went missing. New test `test_a_project_whose_legs_begin_at_two_links_reads_a_bare_tree_for_neither`: `openXdox → openInk` and `openYdox → openQuill` in one project, a bare `openXdox` tree, two WARNINGs and the two-first-links NOTE. M14 now fails it (see the mutation probes).
3. **`pin-source-no-path` is raised late in `validate-pins.py`.** No code change. The behaviour and the reason are written above, under #442.
4. **The `--link-source` help.** It now says a bare PATH is read for neither link when the chains read begin at two different links, and "needs its own `PRODUCT=PATH`" now names the variable and the checkout beside the project too. `docs/cli.md` is regenerated, and `render-cli-reference.py --check` is ok.
5. **This body.** It now says: #539 is on origin and merges clean (see the merge checks); an empty value is refused even when a later one replaces it; the END-link sentence holds for chains of two or more links; and the checklist candidate below.

The commit changes `scripts/validate-repository-naming.py`, `docs/cli.md` and `tests/test_link_source_chain_defaults.py` only.

The re-review of 31a6f21 (APPROVE WITH NITS) found that all five nits are fixed, and two new ones. This commit changes `tests/test_link_source_chain_defaults.py` only.

- **A test gap at the two-link boundary of `link_pins`.** Changing `if len(target.chain) > 1:` there to `> 2` passed the whole new file and `tests/test_naming_policy.py` (264 passed), yet it changes the output for a name read from stdin whose chain has two links: the first-link list is empty, and the NOTE for an unused bare value reads "a bare PATH is the tree of a chain's first link alone, , which had a more specific source". New test `test_a_two_link_chain_read_from_stdin_counts_its_first_link`: stdin `codexInk`, `--referent-chain openXdox,openInk`, `openXdox=<tree>` keyed and a second tree bare, asserting the whole stderr, the one NOTE "each link whose own declaration is read had a more specific source (...)". The `> 2` mutant fails it (see the mutation probes). The existing three-link stdin test and the new one share a helper, `stdin_naming`.
- **This body.** "exactly one first link" now reads "at most one", and the merge paragraph names the current main.

- **First link only, not a refusal.** The coordinator recommended this rule. Nothing documented or tested depended on a bare value answering a later link: no test passes `default_source` to `link_pins_from_trees`, and every scaffold test with a three-link chain sets `SHAPE_PIN_SOURCE_<LINK>` for each link. A refusal "when more than one link would take it" would depend on what is on the disk (checkouts beside the project, variables). #338 ruled that the reading is decided by the chains, never by the disk.
- **Refuse #442, not note it.** A note would still have to stop the value reading `.`. A refusal names the typo when it is typed, and both tools already exit 2 for a question they cannot ask.
- **The scaffold is fixed too.** It reads its `--pin-source` through the same function, so its three-link refusal goes away (see the reproduction). Its `--pin-source` is the pinned product's checkout, which is the first link's tree.

New file `tests/test_link_source_chain_defaults.py`: 23 tests (22 until round 3). On bfed143, 17 fail and 5 pass (the controls: the one-link rows and the rows that already worked). On 04c9d77, the one-link test fails and the other 21 pass.

Targeted runs (each `run9.sh`: `gh` stub, bogus token, empty `GH_CONFIG_DIR`, git-filter-repo 2.47.0), on the head 31a6f21 unless a row says otherwise. Round 3 (head a707d4b) changes the new test file only, and its own run is the last row:

| set | result |
|---|---|
| new file, naming policy, referent-chain links, pin-source env collisions, pin-source unreadable, CLI reference, repo hygiene, README sections, AGENTS.md codes, validate-pins without git, unreadable workflow | `774 passed in 117.48s` |
| manifest validator, scaffold pin and reuse, YAML flow quotes, neutral pin validator | `205 passed in 91.75s` |
| CLI reference alone | `22 passed in 26.08s` |
| template text placeholders, adopt plan leg-path help | `187 passed in 87.54s` |
| predicted merge with origin/main 7d9bec9 (tree 908b3214): repo hygiene, README sections, CLI reference, new file, naming policy | `415 passed in 53.10s` |
| round 3, head a707d4b: new file, naming policy, CLI reference | `287 passed in 95.29s` |

Round 1 (head 73c4c255, before the merge of #551 and this commit; `docs/handbook.html`, `README.md` and the validators are unchanged by this commit apart from `validate-repository-naming.py`):

| set | result |
|---|---|
| doctor, doctor validator rows, scaffold e2e, setup-project.py, setup.sh, adopt e2e, adopt pins, adopt spec-only, adopt submodules, adopt ignored shape files, adopt plan YAML quoting, adopt root symlinks, scaffold leg-path collisions, update-shape landing | `27 failed, 1796 passed, 3 skipped in 1433.51s`; every failure the same `UnicodeDecodeError` from a bytecode file my own `py_compile` probe had left in `templates/assembly-root/scripts/__pycache__`. With it removed, the two files that held all 27 (`test_adopt_root_symlinks.py`, `test_scaffold_leg_path_collisions.py`) gave `253 passed in 140.50s` |

The three skips are `test_shape_doctor.py:9119`, which runs only on a Windows host. None of those files passes `--link-source`, and the one-link change and the help text cannot change a run that gives no bare value.

**The 27 failures.** `template_values()` and its twin in `test_scaffold_leg_path_collisions.py` read every file under `templates/assembly-root` as UTF-8. A `validate-pins.cpython-312.pyc` had appeared there the second I ran `python3 -m py_compile` over the changed files. Its first byte is `0xcb`, the 3.12 bytecode magic, which is the byte every failure names. CI never runs `py_compile`.

| row | bfed143 | this head |
|---|---|---|
| #441: one bare `--link-source <openXdox tree>`, chain `openXdox → openYdox → openInk`, `codexInk` | `FINDING ... is broken (openYdox declares openYdox, not openInk)`, exit 1 | `domain-descendant/assembly`, one `declared-unverified` WARNING for openYdox naming `--link-source openYdox=<path>`, exit 0 |
| #441: each link keyed | exit 0 | exit 0, unchanged |
| #441: no `--link-source` | two WARNINGs, exit 0 | unchanged |
| #441, scaffold `--dry-run`, same chain, `--pin-source <openXdox clone>` | `REFUSED chain-not-declared`, exit 2 | WARNING declared-unverified for openYdox, plan printed, exit 0 |
| #441, one link: `--referent-chain openInk` beside a leg `openXdox → openQuill`, bare openXdox tree | no warnings, exit 0 | the same: no warnings, exit 0 (04c9d77 printed a WARNING and a NOTE) |
| #441, one project, legs `openXdox → openInk` and `openYdox → openQuill`, bare openXdox tree | `FINDING codexQuill: the declared chain openYdox → openQuill is broken (openYdox declares openInk, not openQuill)`, exit 1: the bare tree answered both first links | two WARNINGs and the two-first-links NOTE, exit 0 |
| #442: `--link-source openXdox=` from the project root | `FINDING ... (openXdox declares openXdox, not openInk)`, exit 1 | `REFUSED link-source-no-path`, exit 2 |
| #442: the same from another directory | WARNING about `.`, exit 0 | `REFUSED link-source-no-path`, exit 2 |
| #442: `--link-source ''` from the project root | FINDING, exit 1 | `REFUSED link-source-no-path`, exit 2 |
| #442: `--link-source openXdox= --link-source openXdox=<tree>` | NOTE "the later ... replaced it", exit 0 | `REFUSED link-source-no-path`, exit 2 (the behaviour change above) |
| #442: `--link-source openXdox=.` from the project root | FINDING (reads the project's own manifest, as typed) | unchanged: a typed `.` is read |
| #442: `--pin-source openXdox=` (scaffolded `codexDox`) | `FINDING neutral-pin-source-unreadable: ... . (--pin-source openXdox=...)`, exit 1 | `REFUSED pin-source-no-path`, exit 2 |
| #442: `--pin-source ''` | the same FINDING, exit 1 | `REFUSED pin-source-no-path`, exit 2 |
| #442: `--pin-source openXdox= --pin-source openXdox=<clone>` | `pins ok`, exit 0 | `REFUSED pin-source-no-path`, exit 2 |
| control: `--pin-source openXdox=<clone>` | `pins ok`, exit 0 | unchanged |

No row needs real GitHub. Round 1 ran every row except the two new ones and the two "a later value replaces it" rows. The one-link and two-legs rows are the new tests: on bfed143 the one-link test passes and the two-legs test fails; on 04c9d77 the one-link test fails and the two-legs test passes. The two "a later value replaces it" rows are the review's reproductions of bfed143 against 04c9d77; this commit does not change them.

Each hunk was reverted alone in a throwaway worktree, and the new file run against it.

Round 1 (20 tests), every hunk fails at least one test:

| hunk reverted | tests that fail |
|---|---|
| `repo_shape.py`: offer `default_source` to every link again | 6: the long-chain row, the later-link NOTE, the stdin NOTE, the lookup `[two]` and `[three]`, the scaffold |
| `LinkSources._bare_path`: drop the two-first-links gate | 1: two chains beginning at two links |
| `_not_asked_why`: drop the two-first-links sentence | 1: the same test |
| `_not_asked_why`: always the old two-link sentence | 2: the later-link NOTE and the stdin NOTE |
| `main`: drop the `link-source-no-path` refusal | 6: every `--link-source` no-path row |
| `PinSources`: drop the `pin-source-no-path` refusal | 3: every `--pin-source` no-path row |
| `link_pins`: drop `firsts.setdefault` (stdin names) | 1: the stdin NOTE |
| `_first_links_read`: return nothing | 1: two chains beginning at two links |
| naming `no_path`: keyed values only | 2: the two empty bare rows |
| pins `no_path`: keyed values only | 1: the empty bare row |

Round 2 (22 tests, head 31a6f21):

| hunk reverted | tests that fail |
|---|---|
| `_first_links_read`: `if data is not None:` → `if False:` (the project's legs; the review's M14, which survived 04c9d77) | 1: `test_a_project_whose_legs_begin_at_two_links_reads_a_bare_tree_for_neither`; stderr has the two WARNINGs and no NOTE |
| `LinkSources.link_pins`: count a one-link chain's first link again | 1: `test_a_chain_of_one_link_is_no_first_link_read` |
| `_first_links_read`: count a one-link chain again | 1: `test_a_chain_of_one_link_is_no_first_link_read` |

Round 3 (23 tests, head a707d4b):

| hunk changed | tests that fail |
|---|---|
| `LinkSources.link_pins`: `if len(target.chain) > 1:` → `> 2` (the re-review's boundary mutant, which survived 31a6f21) | 1: `test_a_two_link_chain_read_from_stdin_counts_its_first_link` (`1 failed, 22 passed in 10.59s`); stderr has "first link alone, , which had" where the test expects "each link whose own declaration is read had" |

The existing `test_a_link_source_no_link_used_is_a_note_and_changes_no_exit` in `tests/test_naming_policy.py` holds the two-link NOTE sentence byte for byte, and it passes.

- origin/main 9f80939 (it holds the README, handbook and `tests/readme-cap.d/550.txt` of f6eaab7): clean. The re-review found it clean at 31a6f21 (tree 71ea0d30), and `test_repo_hygiene.py`, `test_readme_sections.py` and `test_cli_reference.py` gave `151 passed in 58.81s` on that merged tree, with `render-cli-reference.py --check` ok. The README cap there is 1427 = 1422 + 5 from main's `tests/readme-cap.d/550.txt`, and this PR adds 0 README lines; its three handbook markers for "The three legs" are 39ec2c23 on the merged tree. a707d4b changes the test file only: merge-tree of it with 9f80939 is clean (tree dfc650f). Earlier mains were clean too: 7d9bec9 (after #552, #553, #554, #561 and #562; `415 passed` on the merged tree) and bbcfd34 (tree 10acc9c). The two `docs/cli.md` regenerations (this PR's `--link-source` help, #561's `bump-leg.py`) touch different tools' sections.
- Lane 2's `fix/539-validators-lockstep-remedies` (#575, 93b68f6), now on origin: clean. The reviewer ran the lockstep-lines test, the new file, `test_validate_pins_without_git.py` and `test_validate_pins_unreadable_workflow.py` on the merge with 04c9d77: `103 passed in 48.45s`. This commit does not touch `validate-pins.py` or any of those tests. The `validate-pins.py` hunk stays inside `PinSources`, away from #539's regions (`:99-544` and `:1109-1143`).
- Lane 2's `fix/540-pin-source-unread` (#570, 79dfd33): clean. On a merge with 04c9d77, the new file, `test_pin_source_unreadable.py`, `test_scaffold_referent_chain_links.py`, `test_scaffold_leg_path_collisions.py`, `test_cli_reference.py` and `test_adopt_pins.py` gave `371 passed`. #540 counts any `--referent-chain` as a reader of `--pin-source`; that stays true, because every chain's first link reads it. One sentence of #540 needs a word once both are in: `pin-source-unused` says the clone is read for "each --referent-chain link's declaration" (`scripts/shape_materialize.py:2706-2707` and the docstring at `:2681-2683`, and `tests/test_pin_source_unreadable.py:445`, the `UNUSED` text at `:455-457` and `:498`). After this PR it is the FIRST link's alone. Whichever lands second should change "each" to "the first".
- The other PR heads #556 to #582 that git still serves (23 heads; #561 is on main): all clean, except #577 (`install.sh`, d0cdbf4). #577 conflicts with main itself, in `docs/handbook.html` and `tests/test_repo_hygiene.py`; against this head the same two files conflict. This PR is not the cause. Both edit `README.md` and the handbook's hash markers, so they land one at a time. Only #575 touches a file this PR changes (`validate-pins.py`, clean).
- Lane 5's other branches: #568 `fix/family-bump-to-checks` 8024f9c, #571 `fix/family-remove-gitmodules-missing` b1120c3, #574 `fix/family-members-case-variants` 40eda84 and #578 `fix/family-siblings-tracking-branch` 43d32eb: clean.

- The scaffold's and `adopt-project.py`'s own `--pin-source ''` (see the checklist candidates).
- `validate-pins.py`'s `--help` and module docstring: nothing in them became false, and the module docstring sits near lines #539 edits.
- Making `validate-pins.py` refuse the empty path before its leg and shape-pin checks: it would put the hunk in `_run_all_checks`, where #539 edits.
- The v1.0.0 release notes keep #441 and #442 as known limits of 1.0.0, which they are.

- **`scaffold-project.py` and `adopt-project.py`: `--pin-source ''` is `Path("")`, so the current directory is read as the pinned product's clone.** Both take `--pin-source` as `type=Path`, and `shape_materialize.declared_pin_values` computes the digest from it. The scaffold also hands it to `link_pins_from_trees` as the first link's tree. Run from the product's own clone, `scaffold-project.py --pin openXdox@<sha> --pin-source '' --referent-chain openXdox,openDox --dry-run` plans with `local-clone (.)`, exit 0; run from anywhere else it reads whatever directory it stands in. This is #442's shape in the two tools that create a project, and neither was in #442. (The review confirmed it for the scaffold on the head; `adopt-project.py` was not re-run.)
- **The scaffold's `declared-unverified` warning names remedies the scaffold does not have.** It says "(a sibling checkout, SHAPE_PIN_SOURCE_<LINK>, or --link-source <link>=<path> would let it be read)". `scaffold-project.py` has no `--link-source` (none in its `--help`) and reads no sibling checkout: `link_pins_from_trees(chain, None, ...)` at `scaffold-project.py:799` passes no root. The text is `_chain_link_findings`' (`scripts/repo_shape.py:1419`). It was already printed on bfed143 for a two-link scaffold with no manifest. Since this PR, every chain of three or more links scaffolded with `--pin-source` alone prints it for the second link, where only `SHAPE_PIN_SOURCE_<LINK>` helps. The wording should name only the remedies the caller has.
- **`tests/test_cli_reference.py` alone writes `templates/family-root/scripts/__pycache__/bootstrap.cpython-312.pyc`** (proved on 04c9d77 and on two merged trees: `22 passed`, then the file is there). A `.pyc` under `templates/` breaks `template_values()` and its twin in `test_scaffold_leg_path_collisions.py` in any later adoption run in the same tree: round 1's 27 failures were the same kind of break, from a `.pyc` under `templates/assembly-root`. #554's `load_without_bytecode` does not cover it. It is outside #441 and #442, and is named here only.

Review: rv441 found 5 nits on 04c9d77 (APPROVE WITH NITS), fixed in 31a6f21; re-review rv441b found all five fixed or answered and 2 new nits (a test gap at the two-link boundary of `link_pins`, and this body), fixed in a707d4b. CI (Brett Heap's ruling 27): H0 a707d4b passed tests, tests-macos, tests-windows and SonarCloud; the head 8971ad5 is a clean update-branch merge of main bcfa364, with tests and SonarCloud green, and the local gate passed on its predicted squash: the scaffold, pins, naming, link-source, setup-by-hand and hygiene sets, 1174 passed, over bcfa364; then the hygiene, AGENTS.md-code, README-section, CLI-reference, link-source and naming sets, 468 passed, over 526cd2c; and 334 passed over b9f65be. Landed on Brett Heap's word of 2026-10-15T13:32:47Z, "All five, once green".

Closes #441
Closes #442

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 15, 2026
…#577): the one line `curl -fsSL https://github.com/opensoft/openRepoShape/releases/latest/download/install.sh | bash` installs the newest release's command pinned to that release, installs git-filter-repo with pipx where it can, and ends with the preflight (#564) (#587)

Carries v1.0.1's one-line install (#577, 8cda139 on release/v1.0, tag
v1.0.1) into main, so main's code and docs say what the release does.

- `install.sh`, attached to every release, installs the newest release
  (or the one it is given): it reads the tag from the `releases/latest`
  redirect, fetches that release's `openRepoShape`, runs its `--install`
  with `OPENREPOSHAPE_REF=<tag> OPENREPOSHAPE_RECORD_REF=1`, and confirms
  the pin with `--version`. Every curl is HTTPS only, redirects included,
  at TLS 1.2 or newer.
- It installs git-filter-repo 2.47.0 with pipx where pipx is and the tool
  is not, and otherwise prints the one command that would. It never runs
  sudo, and it ends with `openRepoShape --preflight`, which offers what is
  missing behind a typed `yes`.
- `openRepoShape --install` records the ref in `openRepoShape.ref` beside
  the command only with `OPENREPOSHAPE_RECORD_REF=1`, or keeps the
  command's own record when it re-installs itself. The installed command
  then fetches setup.sh, passes `--shape-ref` and checks the doctor's clone
  out at that ref; `$OPENREPOSHAPE_REF` still overrides it for one run.
  Any other install records nothing and follows main.
- README's step 3, the worked example, the handbook, AGENTS.md and
  docs/cli.md lead with the one line. `install.sh`,
  `tests/test_install_sh.py` and `docs/release-notes/v1.0.1.md` are
  byte-identical to v1.0.1's.
- Merged with #597 (Linux-only CI): the `/bin/bash -n install.sh` step
  went with the macOS job #597 removed, and README's macOS sentence names
  install.sh among the entry points written for bash 3.2, which no CI run
  checks. The handbook's markers read the merged README's sections.

Lane: openreposhape-3 (openRepoShape-3)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant