Repository navigation
bump-leg: advance ONE leg of an assembly root in ONE lockstep commit - #35
Conversation
Advancing a leg is a lockstep commit — the gitlink, `commit:` and the
`sorted-ls-tree-r-v1` digest in `contracts/<role>-pin.yaml`, and every
`.github/workflows/*.y{a,}ml` `<owner>/<leg>/…@<sha>` reference — and
`validate-pins.py` refuses when they disagree. `scripts/family.py bump` did
this for a holder's member pins; nothing did it for a root's LEG pins, so every
project bumped by hand (the xFactory aggregation moved the gitlink alone seven
times in a row). `scripts/bump-leg.py --root <path> --leg spec|code --to <40 hex>`
is that, from a checkout of the standard.
It fetches the leg's remote refs and requires the target to be reachable from a
remote branch (a commit made inside the mount and never pushed is refused as
`bump-leg-commit-local-only`, because `git fetch <sha>` returns 0 for an object
that is already local), checks the leg out AT the commit (bootstrap re-places
it), rewrites only `commit:` and `digests.tree_sha256`, rewrites workflow
references to THIS leg only, stages by explicit pathspec BEFORE the validators
run (recorded_gitlink reads the index first), runs the root's own
`validate-pins.py` and `validate-manifest.py`, and rolls every byte — pin,
workflows, and the leg's previous placement — back if either goes red. It
refuses a short sha, a dirty root, a root standing on its tracking branch (the
NEXT step is a pull request, never a push to the default branch), a detached
root, a family holder (`family.py bump` is the tool), and a leg the manifest
does not declare. Exit 0 committed, 1 nothing to do, 2 refused.
Sixteen offline tests, including the rollback and the reference-regex identity
with the template validator. README 544 -> 573; AGENTS.md 235 -> 266.
Closes #33.
Lane: codex-intake-shape
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 11 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Reviewer's GuideIntroduces Sequence diagram for advancing an assembly-root legsequenceDiagram
participant User
participant BumpLeg as bump-leg.py
participant Root as AssemblyRoot
participant Leg as LegRepository
participant Validators as RootValidators
participant Git as Git
User->>BumpLeg: invoke --root --leg --to [--dry-run]
BumpLeg->>Root: check manifest, branch, cleanliness, gitlink, pin
BumpLeg->>Leg: fetch and verify remote reachability
BumpLeg->>Leg: checkout --detach target commit
BumpLeg->>Root: rewrite pin commit and tree_sha256
BumpLeg->>Root: rewrite workflow refs for this leg
BumpLeg->>Validators: validate-pins.py and validate-manifest.py
alt validator fails
BumpLeg->>Root: restore files and index
BumpLeg->>Leg: restore previous placement
BumpLeg-->>User: refusal, exit 2
else validation succeeds
BumpLeg->>Git: commit_once with explicit pathspecs
BumpLeg-->>User: committed, print push and pull-request step
end
Flow diagram for bump-leg safety and commit flowflowchart TD
Start([bump-leg.py]) --> Preconditions{Preconditions pass?}
Preconditions -- No --> Refuse[Refuse with exit 2]
Preconditions -- Yes --> Remote{Target reachable from leg remote?}
Remote -- No --> Refuse
Remote -- Yes --> Plan[Plan gitlink, pin, and targeted workflow changes]
Plan --> DryRun{--dry-run?}
DryRun -- Yes --> Preview[Print old to new and write nothing]
DryRun -- No --> Rewrite[Rewrite files and detach leg at target]
Rewrite --> Validate[Run validate-pins.py and validate-manifest.py]
Validate -- Fails --> Rollback[Rollback files, index, checkout, and placement]
Rollback --> Refuse
Validate -- Passes --> Commit[Create one explicit-pathspec commit]
Commit --> Next[Print push branch and open pull request]
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.
🔵 Needs a closer look
It introduces a substantial new git-manipulating automation tool (with rollback semantics) that is operationally safety-critical and warrants final human review despite strong test coverage.
Pull request overview
Adds a new standard-side maintenance tool, scripts/bump-leg.py, to advance exactly one assembly-root leg (spec/code) while keeping the lockstep invariant intact (gitlink, contracts/<role>-pin.yaml, and workflow @<sha> references), with rollback on validator failures and comprehensive offline test coverage.
Changes:
- Introduce
scripts/bump-leg.pyto perform a one-commit lockstep leg pin advance with reachability checks and rollback-on-red validation. - Add an offline integration-style test suite (
tests/test_bump_leg.py) covering the happy path, dry-run/no-op behavior, workflow rewrite scoping, refusals, and rollback semantics. - Document the new “advance a leg” procedure and update repo hygiene caps to reflect the added documentation.
File summaries
| File | Description |
|---|---|
| scripts/bump-leg.py | New CLI tool to advance one leg pin in a single lockstep commit with validations and rollback. |
| tests/test_bump_leg.py | New offline tests validating lockstep updates, refusal cases, and rollback correctness. |
| tests/test_repo_hygiene.py | Ensures the new script is treated as shipped code; updates README/AGENTS line-count caps. |
| README.md | Documents the new bump-leg workflow and tool listing entry. |
| AGENTS.md | Adds the “Advancing a leg” procedure block and updates the document header scope. |
Review details
- 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.



Lane: codex-intake-shape
Claim: #33 (comment)
What
Closes #33.
scripts/bump-leg.py --root <path> --leg spec|code --to <40 hex>, run from a checkout of the standard, moves a root's leg pin the way the lockstep invariant demands andfamily.py bumpalready does for members: gitlink,contracts/<role>-pin.yaml(commit:+digests.tree_sha256, nothing else), and every.github/workflows/*.y{a,}mlreference to THIS leg — in ONE commit, with the root's own validators run first and every byte rolled back (including the leg's previous placement) if one goes red. Prints the next step: push the branch, open a pull request.Refusals, each named: short sha; a commit no remote branch contains (
git fetch <sha>exits 0 for an object already local, so reachability is checked, not the fetch); a commit made in the mount and never pushed; a dirty root (tracked changes); a root on its tracking branch or detached; a family holder (family.py bump); an undeclared leg; a missing pin. Exit 0 committed · 1 nothing to do (no empty commit on re-run) · 2 refused.Evidence
python3 -m pytest tests -q: 413 passed. Sixteen new offline tests intests/test_bump_leg.py: the lockstep move, leg left AT the commit, message + NEXT, no-op bump, a ref to this leg moves and the other leg's does not, the regex is character-identical to the template validator's, dry-run changes nothing, each refusal, and a red validator rolling everything back.🤖 Generated with Claude Code
Summary by Sourcery
Add a safe command to advance one assembly-root leg while keeping its gitlink, pin metadata, digest, and workflow references synchronized in one validated commit.
New Features:
scripts/bump-leg.pyto advance a project'sspecorcodeleg pin in a single lockstep commit.Bug Fixes:
Enhancements:
Documentation:
Tests: