Skip to content

setup.sh: SonarCloud's [[ and case-default reliability findings, semantics unchanged (#113) - #117

Merged
brettheap merged 1 commit into
mainfrom
fix/setup-sh-double-bracket-and-case-defaults
Sep 11, 2026
Merged

brettheap merged 1 commit into
mainfrom
fix/setup-sh-double-bracket-and-case-defaults

Conversation

@brettheap

@brettheap brettheap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openreposhape-2 (openRepoShape-2)
Claim: #113 (comment)

Closes #113.

What was wrong

SonarCloud's reliability gate carried 15 findings against setup.sh, all in
the argument-scanning and self-bootstrap code added for #39/#50/#63:

  • shelldre:S7688 ("Use [[ instead of [ for conditional tests"), 7
    occurrences — two on one line: main line 88
    ([ -n "$toplevel" ], [ -f "$toplevel/scaffold-project.py" ]), then one
    each at line 89 ([ -f "$toplevel/contracts/repository-naming.yaml" ]),
    163 ([ "${#SHAPE_REF}" -gt 255 ]), 179
    ([ "$KEEP_SHAPE_CHECKOUT" -eq 1 ]), 193 ([ -n "$SHAPE_REF" ], inside the
    --depth 1 case) and 198 ([ -n "$SHAPE_REF" ]).
  • shelldre:S131 ("Add a default case (*) to handle unexpected values"),
    8 occurrences, one per case with no *) arm: lines 51 (uname -s
    dispatch for $MAC_TOOLS), 125 ($SHAPE_REPO bad-value guard), 142, 143
    and 144 (the three one-line cases scanning $@ for --,
    --shape-ref's value and --keep-shape-checkout), 166 ($SHAPE_REF
    control-character guard), 169 ($SHAPE_REF charset guard) and 192
    ($SHAPE_REPO scheme check for --depth 1).

Confirmed before converting anything, per the concern that [[ is a
bash/ksh extension absent from /bin/sh (dash/ash): setup.sh's shebang is
#!/usr/bin/env bash; the one-liner pipes into bash -s --;
tests/test_setup_sh.py always invokes it as ["bash", str(SETUP), ...];
.github/workflows/tests.yml's macOS job parses it with /bin/bash -n setup.sh specifically; README.md's "What setup.sh does" and the same CI
step both frame the portability constraint as bash-3.2 syntax, never
/bin/sh; and the file already uses bash-only syntax before this change —
arrays (CLONE_SHAPE_CMD=(git clone --quiet), +=, [@], [*]) and
BASH_SOURCE. The phrase "POSIX shell script" in tests/test_setup_sh.py
and tests/conftest.py (and "needs a POSIX shell" in
tests/test_park_resume_targets.py) is contrasting a Unix shell/shebang
execution model against Windows' CreateProcess, which cannot run a
shebang at all — not claiming /bin/sh compatibility. [[ is available
everywhere this script is ever run.

What landed

The 7 [[ conversions are direct substitutions with no semantic change:
every one of the seven is a unary test (-n, -f, -eq, -gt) — none use
=/==/!= string comparison (which would need the RHS quoted inside
[[, since it is otherwise read as a glob pattern there) or -a/-o
(which [[ does not support and which would need translating to
&&/||). Existing quoting is left exactly as it was: nothing in this
file used unquoted variables inside [ ], so there is no now-redundant
quoting to strip, and no established "drop the redundant quotes in [["
style elsewhere in the file to match.

The 8 *) ;; defaults, one per site, each with a short comment saying
why nothing happens — every site is a guard or a scan where "no match" is
already the correct, common outcome, not a programming error:

  • uname -s (line 51): Linux, another OS, or a failed uname all leave
    $MAC_TOOLS empty, exactly as before.
  • The $SHAPE_REPO bad-value guard (line 125) and the $SHAPE_REF
    control-character and charset guards (lines 166, 169): each dies on the
    one bad pattern it matches; a well-formed value was always meant to fall
    through untouched.
  • The three one-line scanning cases inside the for arg loop (lines 142-144):
    the comment immediately above the loop already said "every argument is
    passed on to Python unchanged whatever this scan concludes" — I extended
    that comment by one sentence to say the *) ;; arms are the same rule,
    rather than repeating it three times inline.
  • The $SHAPE_REPO scheme check (line 192): a local path was always meant
    to skip --depth 1 silently (the comment immediately above it already
    explains why); the *) ;; makes that the explicit default instead of an
    implicit fall-through.

No existing branch's behavior changes — every die, every assignment and
every break fires under exactly the same condition as before.

Touched only setup.sh. No test changes: the suite already exercises every
branch touched here through tests/test_setup_sh.py's end-to-end runs
against real bare-repository fixtures (proving behavior, not just syntax),
and .github/workflows/tests.yml's macOS job already parses this file with
/bin/bash -n on every push — a second, redundant syntax-only check inside
pytest would test a copy of a check this repository already runs
elsewhere. No digest-pinned file was touched.

How it was proven

  • bash -n setup.sh: parses clean.
  • shellcheck setup.sh (not on this machine's PATH; installed into a
    throwaway venv via the shellcheck-py PyPI wheel, version 0.11.0, purely
    for my own local verification — it is not part of this repository's CI or
    test suite, so I added nothing to either): one pre-existing SC2329 info
    note on self_bootstrap_cleanup (a false positive — it runs via trap … EXIT — present before this change and unrelated to it), and nothing else,
    before and after.
  • python3 scripts/render-cli-reference.py --check: [ok] docs/cli.md is what the generator produces — setup.sh --help (which is
    setup-project.py's own help, per docs/cli.md) is unchanged.
  • python3 -m pytest -q tests/test_setup_sh.py: 38 passed.
  • Full suite, foreground, from this worktree: timeout 1200 python3 -m pytest tests -q -p no:cacheprovider → 984 passed, 1 skipped, 1 failed
    in 495.58s. The one failure is the known pre-existing flake called out in
    the brief, confirmed to be exactly that one:
    tests/test_naming_policy.py::test_cli_reports_an_unread_link_as_a_warning_and_still_classifies
    (machine-dependent; a sibling PR fixes it). Nothing else is red.

🤖 Generated with Claude Code

Summary by Sourcery

Enhancements:

  • Modernize setup.sh conditional tests for Bash compatibility and make all case statements explicitly handle unmatched values without changing behavior.

…ntics unchanged (#113)

The reliability gate carried 15 findings against setup.sh: 7 shelldre:S7688
("use [[ instead of [") and 8 shelldre:S131 ("add a default case (*)"). All
15 sites are the argument-scanning and self-bootstrap code, and none of them
change behavior — setup.sh's own shebang is bash, every entry point that runs
it does so with bash explicitly, and the file already uses bash-only syntax
(arrays, BASH_SOURCE), so [[ is available everywhere this script runs; the
"POSIX shell script" phrasing elsewhere in the test suite contrasts a Unix
shell/shebang execution model against Windows, not a claim of /bin/sh (dash)
compatibility.

Each of the 7 [ tests is a unary -n/-f/-eq/-gt test with no =/==/!=
comparison and no -a/-o, so the [[ swap is a direct, semantics-preserving
substitution. Each of the 8 case statements gets *) ;; rather than a die:
every one is a guard or a scan where "no match" is already the correct,
common outcome (an unenumerated uname -s, an argument that is not the flag
being scanned for, a value that is already well-formed) and not a
programming error. No existing branch's behavior changes.

Lane: openreposhape-2 (openRepoShape-2)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 11, 2026 20:24

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates only setup.sh to address SonarCloud’s Bash conditional and missing-default-case findings: seven [ ] tests become equivalent [[ ]] tests, and eight case statements gain explicit no-op defaults. The implementation preserves existing behavior and was validated with syntax checks, targeted tests, documentation generation checks, and the full suite aside from one known pre-existing flaky failure.

File-Level Changes

Change Details Files
Replace portable conditional tests with Bash-native [[ ... ]] tests.
  • Converted seven unary [ ... ] checks covering file/string/numeric predicates to [[ ... ]] without changing operands or control flow.
  • Retained existing quoting and boolean composition; no string-pattern or -a/-o semantics were introduced.
setup.sh
Make all previously implicit case fall-through behavior explicit with no-op defaults.
  • Added commented *) ;; arms to platform detection, input validation, argument scanning, ref validation, and clone-mode dispatch.
  • Documented that unmatched scan and guard values intentionally fall through so Python or later logic handles them unchanged.
setup.sh

Assessment against linked issues

Issue Objective Addressed Explanation
#113 Convert all seven flagged [ conditional tests in setup.sh to Bash [[ ... ]] tests without changing their semantics. ✅
#113 Add a *) default branch to all eight flagged case statements, preserving the existing no-op behavior for unrecognized or valid non-error values. ✅
#113 Ensure the reliability-gate findings are resolved without breaking supported Bash execution or existing behavior. ✅

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes address the reported findings with no unresolved review comments.

Pull request overview

Updates setup.sh to address SonarCloud reliability findings without changing behavior.

Changes:

  • Replaces unary tests with Bash [[ ... ]].
  • Adds explicit no-op defaults to eight case statements.
  • Preserves bootstrap and argument-handling semantics.
File summaries
File Description
setup.sh Applies Bash-compatible conditional and case syntax updates.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brettheap
brettheap merged commit 9923fea into main Sep 11, 2026
6 checks passed
@brettheap
brettheap deleted the fix/setup-sh-double-bracket-and-case-defaults branch September 11, 2026 20:39
brettheap added a commit that referenced this pull request Sep 11, 2026
… `AGENTS-shape.md`, and `LANES_LANE` is promised to carry a `Lane:` argument only for a name that survives a paste (#111)

BOTH OF COPILOT'S FOURTH ROUND ON PR #112 — two suppressed documentation
findings on the same two lines of `AGENTS.md`, and neither is about what the
tools do. They are about who is told, and about a promise wider than the code
behind it.

A PROJECT READS ITS OWN `AGENTS-shape.md`, NOT THIS CHECKOUT'S `AGENTS.md`.
`scripts/shape_materialize.py` copies `templates/assembly-root/AGENTS-shape.md`
verbatim into every scaffolded assembly root and digest-pins it, and that file
is where an agent standing in such a project learns the shape's mechanics —
including how a re-pin is run. Its "never edit a pinned file" section named the
exit (upstream, then `update-shape.py` from a checkout of the standard, landed
as a pull request) and stopped there, so the one thing the previous commits
added to that procedure reached the standard's own readers and no project's.
The section now carries the two-command block and a paragraph in the file's own
voice: `apply` takes a repeatable `--trailer`, appended in the order given, and
only alongside `--branch` because without one there is no commit to put a line
on; `apply` composes that message itself, so a `Lane:` line or a
`Co-Authored-By:` reaches the re-pin commit this way and no other rather than
by amending it afterwards; `check` writes nothing and takes none. This is the
same fix round 3 took in `templates/family-root/AGENTS-shape.md` for
`family.py bump`, applied to the other holder of the same kind of doc.

Both are pinned copies, so this moves the digest of
`templates/assembly-root/AGENTS-shape.md` and every scaffolded project will
report `upstream-changed` for it until its estate re-pins — the ordinary cost
of changing a copy, and the reason the change is one section rather than a
rewrite. `tests/test_scaffold_e2e.py` and `tests/test_family.py` recompute
those digests from the bytes on disk, so nothing is hard-coded to move with
them; each now also asserts `--trailer` is IN the file it checks, because a
procedure that reached only the standard once can do so again.

"WHERE `LANES_LANE` IS SET" PROMISED MORE THAN `lane_trailer` DELIVERS. That
function deliberately offers nothing for a lane name that would not survive
being pasted — a quote, a `$`, a backtick, a backslash, a newline, surrounding
whitespace — because a printed next command is there to be copied, and one that
breaks or expands when it is copied is worse than no line at all. A reader with
such a name, told the `NEXT` line "already carries the `Lane:` argument", would
go looking for a bug. The sentence now says what is true on both sides: where
`LANES_LANE` holds a name that survives being pasted the two printed lines
carry the argument already, and one that would not is offered on neither. Seven
lines to seven, so the 433-line cap in `tests/test_repo_hygiene.py` is
untouched.

THE THIRD ITEM THIS ROUND RAISED WAS ALREADY TAKEN. `unicodedata.category` of a
lone surrogate is `Cs`, and `UNPRINTABLE_CATEGORIES` has listed `Cs` since the
previous commit, with the grammar cases in `tests/test_commit_trailers.py`
(`NOT_TEXT`) to prove it. Verified again here rather than assumed:
`subprocess.run(["true", "Lane: a\ud800b"])` raises `UnicodeEncodeError`
instead of mangling the value, which is exactly the failure `--trailer` must
refuse at the boundary rather than let reach `git commit`.

PROVEN ON A TREE REBASED ONTO `origin/main` AT e9fa826 (#116, #117 and #121
landed under this branch while it was open) — the rebase was conflict-free,
because #121 touched `scripts/repo_shape.py`,
`scripts/render-cli-reference.py`, `setup-project.py` and the leg-template
validators and this branch edits none of them. The commit itself sits on
c19a595 unrebased: the branch ruleset refuses a force-push, which is the
correct answer, and GitHub tests the merge with `main` regardless. 1131
passed, 1 skipped on the rebased tree; the one red is the machine-dependent
`test_cli_reports_an_unread_link_as_a_warning_and_still_classifies` in
`tests/test_naming_policy.py`, pre-existing and not this branch's.
`docs/cli.md` regenerates byte-identical on both trees — through the old
`render-cli-reference.py` and through #121's new one — so no `--help` text
moved.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
brettheap added a commit that referenced this pull request Sep 11, 2026
…le `--trailer`, and the printed `apply` already carries the lane, so the commit they write ends with its `Lane:` line instead of being amended afterwards (#111) (#112)

* `update-shape.py apply --branch` and `family.py bump` take a repeatable `--trailer`, and the printed `apply` already carries the lane, so the commit they write ends with its `Lane:` line instead of being amended afterwards (#111)

Both tools compose their own commit message — "Re-sync the shape copies to
<repo> @ <sha12>", "Bump <Member> to <sha12> in the <Family> family" — so the
`Lane: <name>` line the lane-collision protocol wants on every artifact a lane
produces, and the `Co-Authored-By:` this estate adds beside it, reached those
commits through nothing at all. Four InkRouter re-pins landed on 2026-09-11
carrying neither, each one run exactly as a printed `NEXT` line said.

`--trailer "<Key>: <value>"` is repeatable, kept in the order given, and
validated at the argparse boundary, so a line that is not a trailer is refused
with the usage beside it and before a repository is opened. On `apply` it needs
`--branch`, refused under the same `update-branch-required` id as `--push` and
`--pr` and now naming whichever of the three was passed: a trailer is a line on
a commit, and without `--branch` there is no commit to put one on.

The write is `git commit --trailer` where the host git is 2.32 or newer, probed
once from `git --version` and parsed conservatively, and an append to the
message text where it is not — the same commit either way, which
`tests/test_commit_trailers.py` writes both of and compares. Passed no trailer,
the message and the `git commit` argv are the ones these tools always built.

`update-shape.py check`'s `NEXT` line and the doctor's `shape currency` row now
end with `--trailer "Lane: <$LANES_LANE>"` when the environment names a lane,
quoted through the doctor's own platform-aware `quote_arg` on its rows, so the
line survives being pasted; with no lane set nothing is added and both are
byte-identical to what they printed before. Only the lane is derived — a
co-author names a person or a model no environment variable knows.

What a trailer is, which git takes the option, and which variable names the
lane live in `scripts/shape_materialize.py`, imported by both tools already and
in no copy list; `scripts/repo_shape.py` would have put an `upstream-changed`
row in front of every project in the estate for a helper none of their copies
would call, which is the argument `shape-doctor.py` makes about its quoter.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>

* A trailer is matched with `fullmatch` and the lane is read RAW, so a newline in either is refused instead of reaching the commit message and argv (#111)

TWO HOLES OF ONE SHAPE, both found by Copilot on PR #112, and both about
"one line" being asserted by something that does not assert it.

`trailer_line` matched with `re.match` against a pattern ending in `$`, and
`$` stops just before a FINAL newline — so `--trailer "Lane: x\n"` was
accepted whole and the newline went into the message `git commit -F -` reads
and into the `--trailer` argument beside it. `.fullmatch` is what requires the
value whole, which is the lesson `shape-doctor.py`'s `quote_arg` took on PR
#102 against `"Atlas\n"`; this is the same defect one file along. And the
middle of the pattern was `[^\n]`, which is not "one line" either: `\r`, `\v`,
`\f` and a bare `\t` all went through, each a line break or a column jump to
some reader of the commit. Both classes now admit no control character at all,
and the refusal says so.

`lane_trailer` asked the alphabet about a `.strip()`ed name, so
`LANES_LANE="xfactory-1\n"` — the shape `$(cat …)` and a CRLF file produce —
was offered on the printed next command as `Lane: xfactory-1`: a name the
contract says is not offered, trimmed into one that is, with nothing said. The
raw bytes are what `LANE_NAME_RE` is now asked about, and a value with
whitespace around it is NOT a lane name, decided that way because `TRAILER_RE`
refuses a value starting or ending in whitespace — a printed line offering a
trailer this tool's own `--trailer` would then refuse is worse than one
offering none. Stripping decides exactly one thing now: that an all-whitespace
variable means no lane, which is `LANES_LANE=` spelled with a space in it.

Fourteen cases, including the trailing newline that got through, each control
character the interior class admitted, every whitespace-around-the-name shape,
and the invariant the two rules exist to keep: a lane the printer offers is a
trailer `--trailer` would accept.

The review's third finding — `AGENTS.md` at 434 lines against a cap of 433 —
does not reproduce: `wc -l AGENTS.md` is 433, the file carries 433 newlines
and 433 `splitlines()` entries and ends with one, and
`test_agents_md_is_short_enough_to_be_read` passes. The cap is untouched.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>

* A trailer is ONE line because `splitlines()` and `unicodedata` say so, not because an ASCII class does, and the holder's own instructions show `bump`'s trailers (#111)

THREE FINDINGS FROM COPILOT'S THIRD ROUND ON PR #112, one of them a hole in
the grammar the previous round opened and two of them about what a reader —
a person or a test — is told.

`[^\x00-\x1f\x7f]` READS AS "NO CONTROL CHARACTER" AND IS NOT ONE. It names
C0 and DEL and stops there, so the C1 block `\x80`-`\x9f`, U+0085 NEXT LINE,
U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR all went through a
pattern whose whole job was "one line" — and Python's own `str.splitlines()`
treats every one of them as a line boundary, so a value the tool called one
line arrived as two in anything that read the commit message back that way.
The `Cf` characters got through the same gap without even being breaks: two
trailers differing by a zero-width joiner look identical to a reader and are
not, which is the confusion a trailer exists to avoid.

A CHARACTER CLASS LARGE ENOUGH TO NAME THEM ALL WOULD BE A SECOND, WORSE COPY
OF THE UNICODE TABLES, so `one_printable_line` asks the two questions in
their own words instead: `value.splitlines() != [value]` is this
interpreter's own definition of a line boundary, and moves by itself the day
a future Python adds one; `unicodedata.category` then refuses `Cc`, `Cf`,
`Zl`, `Zp` and `Cs`. `Cs` is there because a byte the locale could not decode
reaches `sys.argv` as a lone surrogate, which is not text at all — git is
handed that undecodable byte straight back, or, on the pre-2.32 path that
appends trailers to the MESSAGE, `subprocess` raises `UnicodeEncodeError` on
a value `--trailer` had already accepted.

`is_trailer` IS THE WHOLE RULE AND BOTH CALLERS USE IT, so the invariant the
last round established — what `--trailer` refuses, no printed next command
offers — holds by construction rather than by two checks that agree today.
`LANE_NAME_RE` needs no second guard bolted on: it is a positive alphabet of
printable ASCII, so nothing `one_printable_line` refuses can be in a lane
name, and there is now a test saying that out loud for the day somebody
widens it.

`templates/family-root/AGENTS-shape.md` IS THE PINNED, AGENT-FACING MECHANICS
DOC copied into every holder, and its `family.py bump` example still showed a
bare bump. A procedure an agent reads in the holder it is standing in is the
one it follows, so the example carries `--trailer` and a paragraph says what
it is for: `bump` composes its own message, so a `Lane:` line reaches that
commit this way and no other, and `add` and `remove` do not take it. This
repository's `AGENTS.md` said it already; the copy every holder carries did
not.

THE BASELINE HALF OF A WITH/WITHOUT COMPARISON INHERITED THE RUNNER'S LANE.
`tests/conftest.py::run_script` now blanks `LANES_LANE` for every tool under
test unless the CALLER names it — which is how a test asks for a lane — so a
suite run inside a lane asserts the same lines as one run outside it. The
baseline of the test that compares the two pins it explicitly as well: the
assertion there is "the lane run is the plain one PLUS the trailer", and a
baseline that had quietly been a second lane run would have compared two
identical lines and passed.

Sixty-five new cases in `tests/test_commit_trailers.py`, 60 to 125: every
line boundary, every invisible and every lone surrogate in the middle of a
value and at the end of one, each of the two checks proved to be the one that
catches its own half, the lane alphabet proved to exclude all of them, and
`is_trailer` proved to be the single predicate both callers use. `docs/cli.md`
regenerates byte-identical — no `--help` text moved. 1131 passed, 1 skipped;
the one red is the machine-dependent
`test_cli_reports_an_unread_link_as_a_warning_and_still_classifies` in
`tests/test_naming_policy.py`, which is pre-existing and not this branch's.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>

* The re-pin trailers reach a scaffolded project through its OWN pinned `AGENTS-shape.md`, and `LANES_LANE` is promised to carry a `Lane:` argument only for a name that survives a paste (#111)

BOTH OF COPILOT'S FOURTH ROUND ON PR #112 — two suppressed documentation
findings on the same two lines of `AGENTS.md`, and neither is about what the
tools do. They are about who is told, and about a promise wider than the code
behind it.

A PROJECT READS ITS OWN `AGENTS-shape.md`, NOT THIS CHECKOUT'S `AGENTS.md`.
`scripts/shape_materialize.py` copies `templates/assembly-root/AGENTS-shape.md`
verbatim into every scaffolded assembly root and digest-pins it, and that file
is where an agent standing in such a project learns the shape's mechanics —
including how a re-pin is run. Its "never edit a pinned file" section named the
exit (upstream, then `update-shape.py` from a checkout of the standard, landed
as a pull request) and stopped there, so the one thing the previous commits
added to that procedure reached the standard's own readers and no project's.
The section now carries the two-command block and a paragraph in the file's own
voice: `apply` takes a repeatable `--trailer`, appended in the order given, and
only alongside `--branch` because without one there is no commit to put a line
on; `apply` composes that message itself, so a `Lane:` line or a
`Co-Authored-By:` reaches the re-pin commit this way and no other rather than
by amending it afterwards; `check` writes nothing and takes none. This is the
same fix round 3 took in `templates/family-root/AGENTS-shape.md` for
`family.py bump`, applied to the other holder of the same kind of doc.

Both are pinned copies, so this moves the digest of
`templates/assembly-root/AGENTS-shape.md` and every scaffolded project will
report `upstream-changed` for it until its estate re-pins — the ordinary cost
of changing a copy, and the reason the change is one section rather than a
rewrite. `tests/test_scaffold_e2e.py` and `tests/test_family.py` recompute
those digests from the bytes on disk, so nothing is hard-coded to move with
them; each now also asserts `--trailer` is IN the file it checks, because a
procedure that reached only the standard once can do so again.

"WHERE `LANES_LANE` IS SET" PROMISED MORE THAN `lane_trailer` DELIVERS. That
function deliberately offers nothing for a lane name that would not survive
being pasted — a quote, a `$`, a backtick, a backslash, a newline, surrounding
whitespace — because a printed next command is there to be copied, and one that
breaks or expands when it is copied is worse than no line at all. A reader with
such a name, told the `NEXT` line "already carries the `Lane:` argument", would
go looking for a bug. The sentence now says what is true on both sides: where
`LANES_LANE` holds a name that survives being pasted the two printed lines
carry the argument already, and one that would not is offered on neither. Seven
lines to seven, so the 433-line cap in `tests/test_repo_hygiene.py` is
untouched.

THE THIRD ITEM THIS ROUND RAISED WAS ALREADY TAKEN. `unicodedata.category` of a
lone surrogate is `Cs`, and `UNPRINTABLE_CATEGORIES` has listed `Cs` since the
previous commit, with the grammar cases in `tests/test_commit_trailers.py`
(`NOT_TEXT`) to prove it. Verified again here rather than assumed:
`subprocess.run(["true", "Lane: a\ud800b"])` raises `UnicodeEncodeError`
instead of mangling the value, which is exactly the failure `--trailer` must
refuse at the boundary rather than let reach `git commit`.

PROVEN ON A TREE REBASED ONTO `origin/main` AT e9fa826 (#116, #117 and #121
landed under this branch while it was open) — the rebase was conflict-free,
because #121 touched `scripts/repo_shape.py`,
`scripts/render-cli-reference.py`, `setup-project.py` and the leg-template
validators and this branch edits none of them. The commit itself sits on
c19a595 unrebased: the branch ruleset refuses a force-push, which is the
correct answer, and GitHub tests the merge with `main` regardless. 1131
passed, 1 skipped on the rebased tree; the one red is the machine-dependent
`test_cli_reports_an_unread_link_as_a_warning_and_still_classifies` in
`tests/test_naming_policy.py`, pre-existing and not this branch's.
`docs/cli.md` regenerates byte-identical on both trees — through the old
`render-cli-reference.py` and through #121's new one — so no `--help` text
moved.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Fable 5.1 <[email protected]>

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
brettheap added a commit that referenced this pull request Sep 11, 2026
…uash landing is tested instead of only the pull request it squashed (#122) (#124)

`.github/workflows/tests.yml` ran on `pull_request` and `workflow_dispatch`
only, so `main` itself was never tested by CI: a squash of several disjoint
pull requests landing in one evening (tonight's #116, #117 and #121) is a
tree no run had ever exercised, even though each one was green on its own
run. SonarCloud already analyses every push to `main`; the test record
stopped at each pull request's last run instead of following it there too.

Brett Heap ruled "do option 1 on 122": `on:` gains `push: { branches:
[main] }`, and `tests-windows` / `tests-macos` each gain `if:
github.event_name != 'push'` so they keep running on `pull_request` and a
manual `workflow_dispatch` but skip on the main push — a squash-interaction
regression is not OS-specific, so the ubuntu job on `main` is the gate for
that, and the two jobs GitHub bills at 2x (Windows) and 10x (macOS) stay the
pull-request-only gate they already were. A top-level `concurrency:` group
keyed on the PR number (falling back to `github.ref`) cancels a superseded
run of the same PR or the same branch, without touching an unrelated PR's
in-flight run. The header comment gets one paragraph saying so, for the next
reader.

Nothing under `templates/` changes; the assembly-root `validate.yml` is a
project's own gate and stays digest-pinned.

Lane: openreposhape-2 (openRepoShape-2)

Co-authored-by: Claude Fable 5.1 <[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.

setup.sh: SonarCloud's 7 S7688 ([ vs [[) and 8 S131 (case default) reliability findings

2 participants