Repository navigation
scripts/bump-leg.py's commit takes a repeatable --trailer, closing the gap #111 left in the third pin-moving tool (#150) - #151
Conversation
…the gap #111 left in the third pin-moving tool (#150) #111 -> PR #112 gave `update-shape.py apply --branch` and `scripts/family.py bump` a repeatable `--trailer "<Key>: <value>"`, so a lane's commit lands with its `Lane:` line instead of being amended afterwards. `bump-leg.py` — the third pin-moving tool, which writes ONE commit moving the leg gitlink, `contracts/<role>-pin.yaml` and every workflow `@<sha>` — was not in #111's scope: `commit_once` took no trailers and `build_parser` had no `--trailer` at all. Today's four leg bumps in the InkRouter estate (IRRS#26, IRSS#26, 2026-09-12) each needed a `git commit --amend --trailer` by hand before the push, exactly the step #111 existed to delete for the other two tools. `commit_once` gains a `trailers` parameter, reusing `shape_materialize.trailer_line` as the argparse `type=` and `shape_materialize.commit_trailers` for the write — the same helpers #112 already gave the other two tools, no second implementation. Passed none, `commit_trailers` hands the message and the `git commit` argv back unchanged, which keeps a plain bump byte-identical to every one before it. `--dry-run` now prints the trailers a real run would end the commit with, after the `old -> new` line it already prints, through a new `_print_trailers` helper called once `cmd_bump` knows there is something to do (after the `nothing to do` exit, before the `--dry-run` return) — so a real run shows the same thing right before it writes them. `AGENTS.md`'s "Advancing a leg" section gains one numbered point saying so, mirroring the wording #112 added under "Updating a project's shape"; the line cap in `tests/test_repo_hygiene.py` moves 433 -> 439 with the reason in the test's own docstring, as every previous move did. `docs/cli.md` is regenerated for the new `--help` line. Five new tests in `tests/test_bump_leg.py`: two trailers end the commit message in the order given, and the run without the flag carries none — one assertion comparing a trailed bump against a plain one made from the same starting clone, so there is no pasted copy of today's wording to go stale. The `git commit` argv `commit_once` builds with no trailers is asserted byte-identical to the one it always built, against a real commit, by loading `bump-leg.py` in-process (`importlib.util.spec_from_file_location`, the same technique `test_update_shape.py`'s `update_shape` fixture already uses for a hyphenated filename) and spying on `subprocess.run`. `--dry-run` prints the trailers after the `old -> new` line (and says `none` when there are none). A malformed trailer is refused at the argparse boundary before `cmd_bump` ever runs — HEAD does not move and the working tree stays clean — even though `--to` and the project are both otherwise valid. `python3 -m pytest tests -q -p no:cacheprovider`: 1143 passed, 1 skipped (1136 on `origin/main`, +7 for the five new tests, one of them parametrized three ways). The one skip, unrelated to this change, is `test_adopt_plan.py::test_plan_on_medxehr_matches_the_rulings` (`SHAPE_MEDXEHR_CLONE` is unset on this machine). `python3 scripts/render- cli-reference.py` regenerated `docs/cli.md`, and `tests/test_cli_reference.py` (13 passed) confirms it matches. `tests/test_repo_hygiene.py` (48 passed) confirms the new AGENTS.md cap. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
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 1 day and 23 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's GuideThe PR closes the trailer-support gap in Sequence diagram for bump-leg commit trailerssequenceDiagram
participant User
participant BumpLeg as bump-leg.py
participant Helpers as shape_materialize
participant Git
User->>BumpLeg: invoke --trailer "Key: value" repeatedly
BumpLeg->>Helpers: trailer_line(value)
Helpers-->>BumpLeg: validated trailer list
BumpLeg->>BumpLeg: cmd_bump(args)
BumpLeg->>Helpers: commit_trailers(message, trailers)
Helpers-->>BumpLeg: message and trailer_args
BumpLeg->>Git: git commit -q -F - trailer_args -- paths
Git-->>BumpLeg: commit hash
Flow diagram for bump-leg dry-run trailer reportingflowchart TD
A["cmd_bump(args)"] --> B{Changes to apply?}
B -->|No| C[Return without trailer output]
B -->|Yes| D["_print_trailers(args.trailer)"]
D --> E{--dry-run?}
E -->|Yes| F[Print old to new and trailers]
E -->|No| G[commit_once with args.trailer]
G --> H[Commit ends with trailers in given order]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified; the remaining documentation note is minor.
Pull request overview
Adds repeatable, validated commit trailers to scripts/bump-leg.py, with dry-run visibility and supporting documentation/tests.
Changes:
- Reuses shared trailer validation and commit handling.
- Preserves existing behavior when no trailer is supplied.
- Updates CLI and agent guidance and adds focused tests.
File summaries
| File | Summary |
|---|---|
tests/test_repo_hygiene.py |
Updates the documentation line-count cap. |
tests/test_bump_leg.py |
Adds coverage for trailers, ordering, validation, and dry-run output. |
scripts/bump-leg.py |
Implements repeatable --trailer support. |
docs/cli.md |
Regenerates the CLI reference. |
AGENTS.md |
Documents trailer usage for leg advancement. |
Review details
Suppressed comments (1)
AGENTS.md:326
- This documents the new behavior only in the standard checkout's
AGENTS.md, but project agents are directed to read the verbatim, digest-pinnedtemplates/assembly-root/AGENTS-shape.mdfirst. That template's advancing-a-leg procedure still omits--trailerand the dry-run trailer output, so existing projects will not receive this guidance through their pinned shape update. Please update the assembly-root shape template and its corresponding pin/update tests as well.
6. **`--trailer "<Key>: <value>"` puts a line on the commit this writes.**
Repeatable, kept in the order given — the same flag `update-shape.py
apply` and `family.py bump` already take. `--dry-run` prints the
trailers it would write, after the `old -> new` line, so the human reads
them before they land rather than after. A lane passes its `Lane:` line
- Files reviewed: 5/5 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.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df536f28f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| message, trailer_args = commit_trailers(message, trailers) | ||
| args = ["git", "commit", "-q", "-F", "-", *trailer_args, "--", *paths] |
There was a problem hiding this comment.
Isolate trailer order from user Git configuration
When the host has trailer.<token>.where or trailer.<token>.ifExists configured, forwarding these values through native git commit --trailer can reorder or discard them even though the dry run prints the supplied order. For example, with trailer.Co-Authored-By.where=before, two Co-Authored-By arguments are committed in reverse order, while ifExists=replace keeps only the last; these behaviors follow Git's documented trailer configuration. Construct the validated trailer block independently of host Git configuration so the commit matches the plan and the documented repeatable, ordered contract.
AGENTS.md reference: AGENTS.md:L322-L327
Useful? React with 👍 / 👎.
…rites-readme-shape-line (#148) ONE CONFLICT, IN THE AGENTS.md CAP, and it is two rules landing on one day rather than a disagreement: #150 raised it 433 -> 439 for `bump-leg.py`'s own `--trailer` point, this branch raises it for the README's `Shape:` line point. Both paragraphs stay, in the order the caps moved, and the assertion is the sum: 446 lines, which is what the merged file has. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>



Lane: openreposhape-2 (openRepoShape-2)
Claim: #150 (comment)
Closes #150.
What was wrong
scripts/bump-leg.pyis the third of the three pin-moving tools thisstandard ships —
update-shape.py apply,scripts/family.py bump, and thisone — and it was the only one of the three whose commit could not carry a
Lane:/Co-Authored-By:trailer. #111 → PR #112 (merged3d3c155) gaveupdate-shape.py apply --branchandscripts/family.py bumpa repeatable--trailer "<Key>: <value>", validated at the argparse boundary byscripts/shape_materialize.trailer_lineand written throughscripts/shape_materialize.commit_trailers, so a lane's commit lands withits
Lane:line instead of being amended afterwards.bump-leg.pywas notin #111's scope:
commit_once(scripts/bump-leg.py:395, before thischange) took
(root, message, paths)and builtargs = ["git", "commit", "-q", "-F", "-", "--", *paths]with no way to passa trailer, and
build_parser(:767) defined--root,--leg,--to,--local-remote-dirand--dry-run— no--trailer.Today's four leg bumps in the InkRouter estate (IRRS#26, IRSS#26,
2026-09-12) each needed a
git commit --amend --trailer …by hand beforethe push, because
bump-leg.py's ownNEXTline has nothing to add atrailer to — precisely the amend-after-the-fact step #111 existed to delete
for the other two tools.
What landed
commit_oncegains atrailersparameter (default()), appended tothe one commit it writes, in the order given, reusing
shape_materialize.trailer_lineas the argparsetype=andshape_materialize.commit_trailersfor the write — the same helpers #112already gave the other two tools, no second implementation. Passed none,
commit_trailershands the message and the extragit commitargumentsback unchanged (
[]), which is what keeps a plain bump's message and argvbyte-identical to every one before it.
--trailer "<Key>: <value>", repeatable, onbuild_parser, wiredstraight through to
commit_oncefromcmd_bump.--dry-runprints the trailers a real run would end the commit with,after the
old -> newline it already prints, through a new_print_trailershelper. It is called oncecmd_bumpalready knows thereis something to do — after the
nothing to doearly return, before the--dry-runreturn — so a real run reports the same thing right before itwrites them, and a bump that has nothing to do never claims it will add
trailers it will not.
AGENTS.md's "Advancing a leg" section gains one numbered point (item6) saying so, mirroring the wording #112 added under "Updating a project's
shape". The line cap in
tests/test_repo_hygiene.pymoves 433 -> 439, withthe reason in the test's own docstring, as every previous move did.
docs/cli.mdis regenerated (python3 scripts/render-cli-reference.py)for the new
--helpline; no other tool's--helpmoved.No digest-pinned file is touched.
scripts/bump-leg.pyis standard-sidetooling (it runs from a checkout of this standard, pointed at a project) and
is not in
contracts/shape-pin.yaml's copied-file list — confirmed againstthe pinned-file list in this fan-out's own brief.
How it was proven
Five new tests in
tests/test_bump_leg.py(16 -> 21 functions, 23collected cases):
test_bump_with_two_trailers_ends_the_commit_message_in_the_order_given—two independent copies of the same starting clone, one bumped with
--trailertwice and one without;message_of(trailed) == message_of(plain) + "\n" + "\n".join(TRAILERS) + "\n",trailers_of(trailed) == list(TRAILERS),trailers_of(plain) == [], andboth commits touch the same paths (
committed(trailed) == committed(plain)) — the ordering claim and the "no flag changes nothing"claim in one assertion, with no pasted copy of today's wording to go
stale.
test_no_trailers_leaves_the_commit_argv_byte_identical— loadsbump-leg.pyin-process (importlib.util.spec_from_file_location, thesame technique
test_update_shape.py'supdate_shapefixture alreadyuses for a hyphenated filename), spies on
subprocess.run, and assertsthe captured
git commitargv is exactly["git", "commit", "-q", "-F", "-", "--", "a.txt"]against a real commit in a real temporaryrepository — the literal argv claim
--dry-runcannot show, since itmakes no commit at all.
test_dry_run_prints_the_trailers_after_the_old_to_new_line— bothtrailers appear in
--dry-run's stdout at a higher string index than theold -> newline.test_dry_run_with_no_trailer_says_so—"trailers none"whennothing was passed.
test_a_malformed_trailer_is_refused_before_the_project_is_read,parametrized over
"Lane xfactory-1","Lane:xfactory-1","Lane: "—exit 2,
--trailerandusage:in stderr, and HEAD and the working treeare untouched, even though
--toand the project are both otherwisevalid — argparse's own error path refuses before
cmd_bumpever runs.python3 -m pytest tests -q -p no:cacheprovider: 1143 passed, 1 skipped(1136 on
origin/mainat the branch point, +7 for the five new tests, oneparametrized three ways). The one skip is
test_adopt_plan.py::test_plan_on_medxehr_matches_the_rulings(
SHAPE_MEDXEHR_CLONEis unset on this machine) — a workstation-specificreal-clone dependency, unrelated to this change.
python3 scripts/render-cli-reference.pyregenerateddocs/cli.md, andpython3 -m pytest -q tests/test_cli_reference.py(13 passed) confirms itmatches the generator's own output.
python3 -m pytest -q tests/test_repo_hygiene.py(48 passed) confirms the new 439-lineAGENTS.mdcap.🤖 Generated with Claude Code
Summary by Sourcery
Allow leg-bump commits to include repeatable validated trailers and preview them during dry runs.
New Features:
--trailer "<Key>: <value>"support tobump-leg.pycommits.--dry-runexecution.Bug Fixes:
Enhancements:
Documentation:
Tests: