Skip to content

scripts and templates: the SonarCloud maintainability tail outside PR #112 is fixed at each flagged line, two findings declined with reasons (#118) - #121

Merged
brettheap merged 1 commit into
mainfrom
chore/sonar-maintainability-tail-outside-112
Sep 11, 2026
Merged

brettheap merged 1 commit into
mainfrom
chore/sonar-maintainability-tail-outside-112

Conversation

@brettheap

@brettheap brettheap commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

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

Closes #118.

What was wrong

SonarCloud's MAINTAINABILITY tail on main (cd57c4b) carried fifteen small,
unrelated findings in files PR #112 (feat/shape-tool-commit-trailers) does
not touch — duplicated literals, unused parameters, ternaries nested inside
ternaries, f-strings with nothing to interpolate, a redundant except class,
a malformed noqa comment and two getAttribute reads that .dataset
already covers. Full evidence (file:line, rule id, the exact code read off
main) is in #118.

What landed

Each site as file:line rule → what changed (or declined: reason):

  • scripts/render-cli-reference.py:161,176 python:S1192 → "an assembly root" / "a family holder", each repeated three times in PROJECT_TOOLS,
    now INSTALLED_IN_ASSEMBLY_ROOT / INSTALLED_IN_FAMILY_HOLDER.
  • scripts/repo_shape.py:430 python:S1192 [PINNED] → the
    "\x00BLOCK\x00" sentinel, repeated three times in _tokenise /
    _parse_sequence / _parse_mapping, now the module constant
    _BLOCK_SENTINEL.
  • setup-project.py:1643 python:S1172 → dropped the unused shape_root
    parameter from clone_and_bootstrap and its one call site (:1856); no
    other caller exists repo-wide.
  • templates/assembly-root/scripts/bootstrap.py:228 python:S1172
    [PINNED] → dropped the unused manifest parameter from
    read_authority and its one call site (:340); no other caller exists
    repo-wide.
  • templates/family-root/scripts/validate-family.py:291 python:S1172
    [PINNED] → dropped the unused root parameter from
    _check_member_identity and its one call site (:288); no other caller
    exists repo-wide.
  • scripts/repo_shape.py:1111 python:S3358 [PINNED] → the nested
    pluralization ternary inside the reason= concatenation is now an
    independent if unverified: ... else: ... building unverified_note
    first.
  • scripts/validate-repository-naming.py:366 python:S3358 [PINNED] →
    the nested found[1] ternary inside the label = ternary is now an
    independent if not found: ... else: ... building role_suffix first.
  • templates/assembly-root/scripts/validate-manifest.py:216 python:S3358
    [PINNED] → the nested "how the referent is reached" ternary is now an
    independent if / elif / else building how_reached first.
  • scripts/bump-leg.py:513 python:S3457 → the Refusal(...) call's third
    argument is one string built by implicit concatenation across lines
    513-516; Sonar names the line where that literal starts, and the segment
    actually carrying the redundant f prefix (line 515, no {} anywhere in
    the merged literal) has it dropped.
  • templates/assembly-root/scripts/bootstrap.py:147 python:S3457
    [PINNED] → the same shape: one merged literal across lines 147-149,
    all three segments carried f and none has a {}; all three dropped.
  • scripts/repo_shape.py:653 python:S5713 [PINNED] → except (FileNotFoundError, OSError): → except OSError: (FileNotFoundError is
    already an OSError subclass), with a one-line comment saying so.
  • scripts/repo_shape.py:825 python:S1845 → declined: reached has
    exactly three callers repo-wide — this file, templates/assembly-root/ scripts/validate-manifest.py:203 (a second, unrelated line of a
    digest-pinned file this PR already touches only at its one flagged S3358
    line), and scripts/shape_materialize.py:495, a file this pass must not
    touch at all (PR 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) #112 rewrites it; its Sonar rows wait for that pass).
    repo_shape.py is also copied verbatim into every scaffolded project, so
    ReferentResolution is a shipped interface, not a name private to one
    file. Ripples into an excluded file and a second untouched pinned line —
    declined per the brief's own rule for exactly that shape of rename.
  • templates/family-root/scripts/siblings.py:157 python:S6353 [PINNED]
    → declined: MAKE_ASSIGNMENT_RE's [A-Za-z0-9_]* is not compiled with
    re.ASCII, and the string it validates (a --make-arg NAME=value typed on
    the family holder operator's own command line) is not provably ASCII-only.
    \w in Python 3 matches any Unicode word character without that flag — a
    semantic widening, not a simplification — and the comment immediately
    above the pattern says both regexes here are deliberately narrow ("a
    mistake worth refusing by name rather than a case worth carrying").
  • setup-project.py:1430 python:S7632 → the # noqa: BLE001 - advice, not a gate; see above comment's free-text explanation carried a comma, which
    reads as a second (invalid) rule code once split on ,. Reworded to
    # noqa: BLE001 (advice rather than a gate; see above) — parenthesized,
    no comma — the same shape already proven not to trip this rule two
    hundred-odd lines above it, at setup-project.py:1377.
  • docs/handbook.html:1749,1751 javascript:S7761 → tab.getAttribute ('data-platform') / el.getAttribute('data-platform') → tab.dataset .platform / el.dataset.platform. Every element either line reads is
    matched by a [data-platform] selector or is one of the four
    [role="tab"] buttons, all four carrying data-platform literally in the
    markup, so the attribute is always present.

Pinned files touched (digest-pinned copies, each touched only at its flagged
line plus the one same-file call-site update its own finding forced):
scripts/repo_shape.py, scripts/validate-repository-naming.py,
templates/assembly-root/scripts/bootstrap.py,
templates/assembly-root/scripts/validate-manifest.py,
templates/family-root/scripts/validate-family.py.
(templates/family-root/scripts/siblings.py is also pinned but the S6353
finding in it was declined, so it is untouched.)

How it was proven

python3 scripts/render-cli-reference.py --check: [ok] docs/cli.md is what the generator produces — none of these changes touch an argparse option or
any --help text.

timeout 1200 python3 -m pytest tests -q -p no:cacheprovider from this
worktree, on the clean tree after the commit below:
1 failed, 984 passed, 1 skipped in 467.90s (0:07:47). The one failure is
the pre-existing flake this fan-out's brief calls out,
tests/test_naming_policy.py::test_cli_reports_an_unread_link_as_a_warning_and_still_classifies
(machine-dependent; a sibling PR fixes it).

The SAME run on the uncommitted diff (before that commit) read
3 failed, 982 passed, 1 skipped in 446.99s — two extra failures,
tests/test_family.py::test_update_shape_reads_a_family_root_and_mirrors_into_family_yaml
and
tests/test_family.py::test_update_shape_with_no_shape_block_names_the_family_validator.
Neither is a defect in this change: upstream_clone
(tests/test_family.py:732) deliberately bakes the CURRENT WORKING TREE,
dirty or not, into a synthetic "upstream" clone, so any uncommitted edit to
the digest-pinned templates/family-root/scripts/validate-family.py makes
that one file's status both (locally-modified relative to the pin AND
further changed upstream by the test) instead of a clean single side, and
update-shape.py correctly refuses that as update-conflict — different
stdout/stderr than either test's assertion expects. Proven, not assumed: a
throwaway worktree at origin/main with a trivial no-op comment appended,
uncommitted, to that same file reproduces both failures verbatim (identical
assertion text); committing that same one-line change on the same worktree
makes both pass again, 2/2. This is a pre-existing fragility of testing an
uncommitted change to that one file, present on main today, independent of
what the change is — not something this PR introduces or should mask by
committing around it.

Each nested-ternary rewrite (findings 6-8) and each dropped parameter
(findings 3-5) was checked by hand against the original expression for
identical behaviour on every branch before being written; the diff for each
is a same-file, same-function change with exactly one call site apiece.

🤖 Generated with Claude Code

Summary by Sourcery

Address actionable SonarCloud maintainability findings while preserving behavior and documenting findings that should remain unchanged.

Bug Fixes:

  • Resolve SonarCloud maintainability findings across scripts, templates, and handbook JavaScript without changing behavior.
  • Correct the malformed noqa explanation and simplify exception handling and redundant string formatting.

Enhancements:

  • Replace nested conditional expressions with clearer independent condition handling.
  • Remove unused function parameters and centralize repeated literals.

Tests:

  • Validate the CLI reference and run the test suite, documenting the pre-existing machine-dependent failure and uncommitted pinned-template test fragility.

Chores:

  • Decline findings where the proposed changes would alter semantics or require touching excluded interfaces and files.

…112 is fixed at each flagged line, two findings declined with reasons (#118)

Fifteen small, unrelated SonarCloud MAINTAINABILITY findings sat on `main`
(cd57c4b) in files PR #112 (`feat/shape-tool-commit-trailers`) does not
touch: duplicated literals (python:S1192), unused parameters (python:S1172),
ternaries nested inside ternaries (python:S3358), f-strings with nothing to
interpolate (python:S3457), a redundant `except` class already covered by
its own parent (python:S5713), a same-name method/field pair (python:S1845),
a character class equivalent to `\w` (python:S6353), a malformed `noqa`
suppression comment (python:S7632), and two `getAttribute` reads `.dataset`
already covers (javascript:S7761). Full per-site evidence is in #118.

Thirteen sites are fixed, each at the exact line Sonar named, with a named
constant or an independent statement replacing the flagged construct and no
behaviour change. Two are declined and explained instead of taken:

- `scripts/repo_shape.py:825`'s `reached`/`REACHED` pair (python:S1845):
  renaming ripples into `scripts/shape_materialize.py:495`, a file this pass
  must not touch (PR #112 rewrites it), and into a second, unrelated line of
  a pinned file this change already touches only at its one flagged line.
  `repo_shape.py` is also copied verbatim into every scaffolded project, so
  the name is a shipped interface, not private to this file.
- `templates/family-root/scripts/siblings.py:157`'s `MAKE_ASSIGNMENT_RE`
  (python:S6353): it is not compiled with `re.ASCII`, and the string it
  guards (a `--make-arg NAME=value` typed on the family holder operator's
  own command line) is not provably ASCII-only, so swapping in `\w` would
  silently admit Unicode word characters the surrounding comment says this
  pattern is deliberately narrow against.

`python3 scripts/render-cli-reference.py --check`: `[ok] docs/cli.md is what
the generator produces` — none of these touch an argparse option or any
`--help` text.

`timeout 1200 python3 -m pytest tests -q -p no:cacheprovider` from this
worktree, run before this commit (so still against the uncommitted diff):
**3 failed, 982 passed, 1 skipped in 446.99s**. One is the known
machine-dependent flake this fan-out's brief calls out,
`tests/test_naming_policy.py::test_cli_reports_an_unread_link_as_a_warning_and_still_classifies`.
The other two, `tests/test_family.py::test_update_shape_reads_a_family_root_and_mirrors_into_family_yaml`
and `tests/test_family.py::test_update_shape_with_no_shape_block_names_the_family_validator`,
are an artifact of testing an UNCOMMITTED change to a digest-pinned file --
`upstream_clone` (test_family.py:732) bakes the CURRENT WORKING TREE, dirty
or not, into a synthetic "upstream" clone, so any uncommitted edit to
`templates/family-root/scripts/validate-family.py` makes that file's status
`both` (locally-modified AND upstream-changed) instead of a clean single
side, which `update-shape.py` correctly refuses as `update-conflict` --
different stdout/stderr than either test expects. Proven, not assumed: a
throwaway worktree at origin/main with a trivial no-op comment appended
(uncommitted) to that same file reproduces both failures verbatim; committing
that same one-line change on the same worktree makes both pass again. This
commit is exactly that second state.

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:44

@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

@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.

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR removes or refactors the SonarCloud maintainability findings outside PR #112 through localized constant extraction, signature cleanup, equivalent explicit branching, literal/exception/noqa cleanup, and safer DOM access; two findings are intentionally declined where remediation would create interface ripples or change regex semantics. CLI rendering passed, and the full test run passed 984 tests with one documented pre-existing failure.

Flow diagram for maintainability finding remediation

flowchart LR
    A[SonarCloud maintainability findings] --> B{Safe localized change?}
    B -->|Yes| C[Extract constants or simplify code]
    B -->|Yes| D[Remove unused parameters and clean syntax]
    B -->|Yes| E[Use dataset DOM access]
    B -->|No| F[Decline with documented reason]
    C --> G[Preserve behavior]
    D --> G
    E --> G
    F --> G
    G --> H[Render check and test suite]
Loading

File-Level Changes

Change Details Files
Centralize repeated literals while preserving generated CLI metadata and parser behavior.
  • Introduced named constants for repeated installation descriptions.
  • Introduced a module-level block-scalar sentinel and replaced all repeated uses.
scripts/render-cli-reference.py
scripts/repo_shape.py
Remove unused function parameters and update their sole call sites.
  • Dropped unused bootstrap/setup and template helper arguments.
  • Updated each same-file or direct caller without changing function behavior.
setup-project.py
templates/assembly-root/scripts/bootstrap.py
templates/family-root/scripts/validate-family.py
Rewrite flagged nested conditionals into explicit intermediate control flow with equivalent branch behavior.
  • Built pluralized unverified notes before composing the reason.
  • Built role suffix and referent-reach descriptions independently before assembling output.
scripts/repo_shape.py
scripts/validate-repository-naming.py
templates/assembly-root/scripts/validate-manifest.py
Clean up flagged Python diagnostics without altering user-visible behavior.
  • Removed redundant f-string prefixes from multiline literals.
  • Simplified the OSError handler because FileNotFoundError is an OSError subclass.
  • Reworded a noqa explanation so its comma-separated rule parsing remains valid.
scripts/bump-leg.py
templates/assembly-root/scripts/bootstrap.py
scripts/repo_shape.py
setup-project.py
Use dataset properties for guaranteed data attributes in the handbook UI.
  • Replaced two getAttribute reads with dataset.platform access.
docs/handbook.html
Document and preserve two intentionally declined findings rather than applying semantically risky renames or regex changes.
  • Declined the ReferentResolution rename because its shipped/copy interface and callers span excluded or separately pinned files.
  • Declined the regex simplification because removing the ASCII-restricted character class would widen accepted Unicode input.
scripts/repo_shape.py
templates/family-root/scripts/siblings.py

Assessment against linked issues

Issue Objective Addressed Explanation
#118 Fix the actionable SonarCloud findings: duplicated literals, unused parameters, nested ternaries, redundant f-string prefixes, the redundant exception class, the malformed noqa comment, and the two data-platform attribute reads. ✅
#118 Handle the two findings that the issue explicitly declines: the case-only member-name difference in repo_shape.py and the regex character-class suggestion, without making the prohibited cross-file or semantic changes. ✅
#118 Apply the changes consistently to the relevant pinned templates and same-file call sites while preserving existing behavior and repository interfaces. ✅

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

@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 reviewed changes address actionable findings while preserving behavior, with declined findings documented.

Pull request overview

This pull request resolves SonarCloud maintainability findings across scripts, templates, and handbook JavaScript while preserving behavior.

Changes:

  • Centralizes repeated literals and simplifies conditional, exception, and string handling.
  • Removes unused parameters and fixes noqa formatting.
  • Updates DOM attribute access and documents two intentionally declined findings.
File summaries
File Summary
templates/family-root/scripts/validate-family.py Removes an unused parameter.
templates/assembly-root/scripts/validate-manifest.py Replaces nested conditional logic.
templates/assembly-root/scripts/bootstrap.py Simplifies strings and removes an unused parameter.
setup-project.py Removes an unused parameter and fixes noqa syntax.
scripts/validate-repository-naming.py Simplifies nested conditional labeling.
scripts/repo_shape.py Refactors sentinel, exception, and conditional handling.
scripts/render-cli-reference.py Centralizes repeated installation labels.
scripts/bump-leg.py Removes a redundant f-string prefix.
docs/handbook.html Uses dataset for platform attributes.
Review details
  • Files reviewed: 9/9 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 e9fa826 into main Sep 11, 2026
6 checks passed
@brettheap
brettheap deleted the chore/sonar-maintainability-tail-outside-112 branch September 11, 2026 21:00
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.

scripts and templates: fifteen small SonarCloud maintainability findings outside PR #112 sit unfixed on main

2 participants