Repository navigation
status: the fourth layer — the shape pin: copies re-hashed against contracts/shape-pin.yaml, the mirror checked, the pin read against the standard's main; and the fork layer's review fixes - #12
Conversation
…contracts/shape-pin.yaml, the mirror checked, the pin read against the standard's main; and the fork layer's review fixes Brett Heap's RULING of 2026-09-11, verbatim: "next layer: shape-pin drift". Every assembly root and family holder carries contracts/shape-pin.yaml, a COPY PIN in the standard's own words: the openRepoShape commit its copied shape files were cut from and a sha256 per copy. Three things are read against it, for holder and root rows: 1. THE COPIES. Every `files:` row is re-hashed (sha256sum, the shasum a Mac ships, or openssl — chosen once). A digest that differs is DRIFT, and the finding names the standard's exit: carry the change upstream, never re-digest. A missing copy is named. A note line says what is pinned and how many copies matched. 2. THE MIRROR. project.yaml's (or family.yaml's) `shape:` block naming a commit other than the pin's is out of step; update-shape.py moves both. 3. THE PIN AGAINST THE STANDARD'S MAIN. From a clone of openRepoShape under the projects directory when there is one — found by its origin's slug, the way --repo finds an estate — read from local refs as of its last fetch; else, under --fetch, from GitHub's compare endpoint. Behind names `update-shape.py check --root <root>`; a pin main never contained is a finding too, because the standard squash-merges and orphans a branch commit. With neither the note says currency was not read. THE FORK LAYER'S REVIEW (of #11, which had merged) lands here too. Two mattered: the origin host was matched as the SUBSTRING github.com, so a GitHub Enterprise or lookalike host would have been asked about on github.com with the person's token (now `is_github_origin` parses the host, and the one gh call pins `--hostname github.com`); and one repository's 404 set GH_STATE=failed for the whole run, so forks nobody asked about read as clean (now only gh exit 4 — not logged in — or three consecutive failures settle the run; a single failure is said on its row and the others are still asked). Every gh call now goes through `gh_api_line`, which also clears GH_DEBUG and parses the LAST line, so a stray stderr line cannot read as the payload; GitHub's counts are checked as numbers; a ref that never existed is "there is no <remote>/<branch>", not "nothing new"; after a failed upstream fetch the row no longer says "never fetched (--fetch asks it)"; the docs say the write covers refs/remotes/<remote>/* for both remotes and that the two GitHub questions are the estate commands' only use of gh. Tests 202 -> 211: a pinned root with matching copies and the "currency not read" note; an edited and a missing copy; a mirror out of step; the pin read against a fake standard cloned under projects (behind, at the tip, on a branch main never had); GitHub asked once under --fetch with no clone, the exact call held; a root without a pin says nothing. For the fork fixes: a 404 on one repository leaves the leg asked; seven origin spellings, four that merely contain github.com never asked and three real ones asked; a github origin WITH an upstream remote read locally, gh not asked. The hygiene rule now holds gh to gh_api_line and gh_ready's `command -v gh`. README 221 -> 230, AGENTS.md 122 -> 131, caps raised in dated entries. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
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 hour and 44 minutes by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's GuideThe PR adds the fourth status layer: estate-wide validation of copied openRepoShape files, their mirrored commit pin, and currency against the standard’s main, while consolidating and hardening GitHub access and documenting the behavior with comprehensive tests. Flow diagram for shape-pin drift validationflowchart TD
A["Estate root or family holder"] --> B{"contracts/shape-pin.yaml exists?"}
B -- "No" --> Z["No shape finding"]
B -- "Yes" --> C["Hash each listed shape copy"]
C --> D{"Copy missing or digest differs?"}
D -- "Yes" --> E["Report drift; carry change upstream"]
D -- "No" --> F["Compare project shape mirror"]
E --> F
F --> G{"Mirror commit differs from pin?"}
G -- "Yes" --> H["Report mirror out of step"]
G -- "No" --> I["Read standard main when clone or --fetch source exists"]
H --> I
I --> J{"Pin behind main?"}
J -- "Yes" --> K["Report update-shape.py check --root <root>"]
J -- "No or unavailable" --> L["Report current or currency not read"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved validation and error-handling issues remain in status.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds shape-pin drift detection to status and hardens GitHub fork checks.
Changes:
- Validate copied files, mirrors, and pin currency.
- Centralize GitHub API handling and failure behavior.
- Expand tests and update documentation.
File summaries
| File | Description |
|---|---|
tests/test_status_command.py |
Tests shape-pin and GitHub behavior. |
tests/test_repo_hygiene.py |
Updates hygiene checks. |
status |
Implements shape-pin and GitHub logic. |
README.md |
Documents the shape-pin layer. |
AGENTS.md |
Adds shape-pin guidance. |
Review details
Suppressed comments (3)
status:1326
- The new dispatch has separate holder/
family.yamland root/project.yamlpaths, but the added shape tests cover only a standalone root; the existing family test never creates a holder or member shape pin. A regression in either family path would pass unnoticed. Add a family fixture with matching and drifted pins and assert both holder and member output.
if [ "$label" = holder ]; then
read_shape "$path" family.yaml
else
read_shape "$path" project.yaml
status:1270
- With
--fetch, this calls GitHub before checking for the localopenRepoShapeclone. That violates the documented precedence (use the clone's local refs when one exists, and use GitHub only when there is no clone), causing unnecessary authenticated network calls and potentially reporting GitHub's answer instead of the clone's last-fetch view. Checkshape_currency_from_clonefirst and fall back to GitHub only when it cannot answer.
if [ "$FETCH" -eq 1 ] && ask_github_shape_pin "$root" "$commit" "$source"; then
currency="; against $source main per GitHub"
elif shape_currency_from_clone "$root" "$commit" "$source"; then
currency="; against $source main per a clone under the projects directory"
else
currency="; currency not read (no clone of $source under the projects directory; --fetch asks GitHub)"
status:1239
source_repositoryis required by the shape-pin manifest, but an absent value is silently rendered asan unnamed sourceand can still produce exit 0 after the copy checks. That leaves a pin whose upstream identity cannot be checked looking clean/current; record missingsource_repositoryas a finding while continuing to check the listed files.
commit=""; yaml_scalar "$pin" commit && commit="$YAML_VALUE"
source=""; yaml_scalar "$pin" source_repository && source="$YAML_VALUE"
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| while IFS=$'\t' read -r path digest; do | ||
| [ -n "$path" ] || continue | ||
| total=$((total + 1)) | ||
| if [ ! -f "$root/$path" ]; then | ||
| finding "shape copy $path is missing; contracts/shape-pin.yaml names it (update-shape.py check --root $root)" | ||
| continue | ||
| fi | ||
| actual="$(file_sha256 "$root/$path")" |
| IFS=$'\037' read -r behind ahead <<<"$GH_LINE" | ||
| if ! is_count "$behind" || ! is_count "$ahead"; then | ||
| finding "shape: GitHub's compare of pin $(short "$commit") with $source main was not two counts; not read" | ||
| return 0 |
…ion per pin, the source's default branch read, and the note made truthful
The independent review of this layer found the order inverted under
--fetch: GitHub was asked before a clone of the standard under the projects
directory was consulted, the reverse of what the header, usage, README and
AGENTS.md all say — and, since a family's holder and members carry the same
pin, the identical question was asked once per root, spending gh_api_line's
three-failure budget on one pin and then silencing the fork check for every
remaining repository with no line on its row. Now the clone is read first,
GitHub only under --fetch when no clone answered, and the answer about one
pin (and the source's default branch, once per source) serves every root
that carries it, each still naming its own --root.
Also from the review: the source's default branch is read (the clone's
origin/HEAD, or GitHub's default_branch) rather than assumed to be main,
because source_repository is whatever a fork of the standard was named; the
"currency not read" note no longer advises --fetch when --fetch was on and
GitHub failed, and no longer claims there is no clone when there is one that
never fetched its default branch; a manifest with no `shape:` block beside a
pin is out of step, as update-shape.py itself refuses it; the sha256 tool is
chosen once, outside the subshell that ran it per file; a copy the tool could
not read is distinguished from no tool at all; the `\` prefix sha256sum puts
before an escaped file name is dropped; a trailing comment on a hand-edited
path row is not part of the path; and fake_gh can 404 a whole prefix.
Tests 211 -> 218: the clone read before GitHub under --fetch (gh never
called); one pin on two roots is one compare; a 404 on the shape question
leaves the leg's fork check asked and the note says why currency was not
read; a manifest without a mirror; the family holder's family.yaml mirror
(the arm no test had run); a tracking branch no remote has, after the fetch
("there is no origin/develop", "after the fetch: upstream has no branch");
a failed upstream fetch not blamed on the person. README 230 -> 232,
AGENTS.md 131 -> 133.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved moderate and critical findings remain in shape-pin handling, failure caching, path validation, documentation, and the hygiene line-count check.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (10)
AGENTS.md:80
- Rule 4 still says at lines 70–72 that
status --fetchrunsgit fetch --prune originonly, while this addition says upstream is fetched too. Because this is the operator guidance an assistant is instructed to follow, reconcile the earlier sentence so it does not understate the remotes refreshed by--fetch.
named `upstream` from local refs (`--fetch` fetches it too), and, with no
such remote and only under `--fetch`, an origin whose host is github.com
is asked about with `gh api` (his RULING of the same day, "next layer:
fork against upstream") — read-only, and with the shape check below the
README.md:45
- The README still describes
status --fetchas fetching onlyoriginat lines 32–34 and in the usage example, but this new paragraph says forks also fetchupstream. Resolve the conflicting descriptions so users do not mistake an upstream comparison for a last-fetch-local answer.
here. THE SHAPE PIN is read too (his RULING of the same day, "next layer:
shape-pin drift"): every root and holder carries `contracts/shape-pin.yaml`,
README.md:44
- This says every root and holder carries a shape pin, but the implementation explicitly treats a root without
contracts/shape-pin.yamlas valid and silent (read_shapereturns immediately). Please state that the check applies to roots/holders that carry the pin, otherwise the documented estate model contradicts the supported pinless-root behavior.
here. THE SHAPE PIN is read too (his RULING of the same day, "next layer:
status:1319
pathcomes directly fromshape-pin.yamland is concatenated without containment validation, so a../entry or a symlink can makestatushash files outside the estate. Reject absolute/traversal paths (and ensure the resolved target remains under the root) before testing or hashing the copy; otherwise a malformed or untrusted pin can inspect private files or trigger unexpectedly expensive reads.
actual="$(file_sha256 "$root/$path")"
status:36
- The new behavior fetches
upstreamas well asorigin, but the preceding header still saysgit fetch --prune originonly (and the duplicated comments near the argument parser repeat that wording). This leaves the command's operational documentation contradictory about which remote-tracking refs become current; update all copies to describe both remotes.
# this command ever makes — remote-tracking refs (`refs/remotes/<remote>/*`:
# origin, and upstream where a fork has one),
status:61
- The command header says every assembly root and family holder carries a shape pin, but
read_shapedeliberately returns without a finding when the pin is absent. Clarify this as an optional check for roots/holders that have the pin so the header does not contradict the implemented pinless-root behavior.
# holder carries `contracts/shape-pin.yaml`: the openRepoShape commit its
# copied shape files were cut from, and a sha256 per copy. The copies are
status:1162
- Malformed
files:rows are silently discarded by this parser. If the block is empty or all rows have unexpected indentation/order,read_shapereports0/0 copies matchand can otherwise report the root clean, hiding a corrupt pin instead of flagging that its copy list could not be read. Preserve/report malformed rows (and the no-files case) as a finding rather than treating them as an empty valid set.
# `path<TAB>sha256` per row of the pin's `files:` block — the rows
# `update-shape.py` writes as ` - path: <p>` / ` sha256: "<hex>"`, in
# that order; a hand-edited row the other way round is dropped, which is one
# reason the note counts rows. A trailing comment on a path is not part of
# it. A new top-level key ends the block.
status:1269
- This lookup also lacks a failure cache. When GitHub cannot answer the source repository's
default_branch,SHAPE_DEFAULT_SOURCEremains empty, so every later pinned root repeats the identical repository request instead of honoring the documented once-per-source query and the shared failure policy. Record the failed source lookup for the run and reuse that unanswered state.
if [ "$SHAPE_DEFAULT_SOURCE" = "$source" ] && [ -n "$SHAPE_DEFAULT_BRANCH" ]; then
default="$SHAPE_DEFAULT_BRANCH"
else
gh_api_line "shape check" "repos/$source" '.default_branch // "main"' || return 1
default="$GH_LINE"
[ -n "$default" ] || default=main
SHAPE_DEFAULT_SOURCE="$source"
SHAPE_DEFAULT_BRANCH="$default"
status:1284
- When GitHub returns a successful response that does not contain two numeric counts, this branch records that the comparison was not read but returns success.
read_shapetherefore appendsagainst ... per GitHub, falsely claiming currency was answered; propagate failure here so it emits the existingcurrency NOT readstate instead.
if ! is_count "$behind" || ! is_count "$ahead"; then
finding "shape: GitHub's compare of pin $(short "$commit") with $source $default was not two counts; not read"
return 0
status:1302
- A pin without
source_repositoryis currently allowed through as a clean result: the output saysof an unnamed source, omits currency status, and returns no finding, even though there is no source against which the pin can be checked. Record the missing required source as a finding while retaining the copy and mirror checks; otherwise a malformed pin is reported as in sync.
commit=""; yaml_scalar "$pin" commit && commit="$YAML_VALUE"
source=""; yaml_scalar "$pin" source_repository && source="$YAML_VALUE"
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
| """ | ||
| lines = (REPO / "AGENTS.md").read_text().splitlines() | ||
| assert len(lines) <= 122, f"AGENTS.md is {len(lines)} lines; the cap is 122" | ||
| assert len(lines) <= 133, f"AGENTS.md is {len(lines)} lines; the cap is 133" |
| if ! g "$clone" cat-file -e "$commit^{commit}" 2>/dev/null; then | ||
| finding "shape pin $(short "$commit") is not in the clone of $source at $clone, as of its last fetch: fetch it, or the pin is on a commit that was squash-merged away" | ||
| return 0 | ||
| fi |
| else | ||
| gh_api_line "shape check" "repos/$source/compare/$commit...$default?per_page=1" \ | ||
| '[(.behind_by|tostring), (.ahead_by|tostring)] | join("\u001f")' || return 1 | ||
| IFS=$'\037' read -r behind ahead <<<"$GH_LINE" | ||
| SHAPE_ASKED="$source $commit" | ||
| SHAPE_ASKED_BEHIND="$behind" |



Ruling: Brett Heap, 2026-09-11, verbatim: "next layer: shape-pin drift" — the fourth of the layers named when
statuslanded (#9), after the local one (#9),--fetch(#10) and the fork (#11). Againstmain; the stack is flat again.What it reads
Every assembly root and family holder carries
contracts/shape-pin.yaml— a COPY PIN, in the standard's own words: the scaffold copied a small set of files out of openRepoShape (the Makefile, the validators, the bootstrap, the workflow) so a project runs its own gate with no upstream mounted, and the pin records the commit they came from plus a sha256 per copy. Three things can be out of sync with it, and each is read, for holder and root rows:files:row is re-hashed with whatever sha256 the machine has (GNUsha256sum, theshasuma Mac ships, oropenssl). A digest that differs is DRIFT and the finding names the standard's exit — carry the change upstream, never re-digest. A missing copy is named. This is the same check the root's ownscripts/validate-pins.pymakes on every pull request, read here across the estate without running the validator, which also asks lockstep questions a report about the shape does not.project.yaml(orfamily.yaml) carries ashape:block mirroring the pin's commit;update-shape.pymoves both together, so two different commits is a half-done update.main. From a clone of openRepoShape under the projects directory when there is one — found by its origin's slug, the way--repofinds an estate — read from local refs, as of that clone's last fetch; else, under--fetch, from GitHub's compare endpoint, once. Behind namesupdate-shape.py check --root <root>. A pinmainnever contained is a finding too: the standard squash-merges, and a branch commit is orphaned the moment its pull request lands. With neither source, the note says currency was not read, so silence is never mistaken for current.A root with no
contracts/shape-pin.yamlsays nothing here. Legs carry no pin and are not asked.The fork layer's review, folded in
The independent review of #11 finished after #11 had merged; its findings are fixed here rather than in a separate PR, because this layer builds on the same
ghmachinery. The two that mattered:*github.com*admittedgithub.company.com(GitHub Enterprise),notgithub.com,github.com.evil.example— and the question went to github.com regardless, with the person's token, about a repository that was never there; a 404 then silenced the run (below). Nowis_github_originparses the host out of every spelling git accepts and compares it togithub.com, and the oneghcall pins--hostname github.comso aGH_HOSTin somebody's environment cannot redirect it.GH_STATE=failed, and every later row printedin sync … cleanwith the one trace under a different row, possibly a whole estate earlier in a sweep. Now onlyghexit 4 (not logged in, true of every repository) or three consecutive failures settle the run; a single failure is said on its row as…; the other repositories are still asked, and they are.Everything
statusasks GitHub now goes through one function,gh_api_line: host pinned,GH_DEBUGcleared and the LAST line parsed (a stray stderr trace read as the payload had turned a fork into "clean"), counts checked as numbers before they are printed, the failure policy in one place. The hygiene rule now holdsghto that function andgh_ready'scommand -v gh. Smaller items from the same review: a ref that never existed isthere is no <remote>/<branch>, notnothing new; after a failed upstream fetch the row no longer advises--fetch; the header, usage and both documents say the write coversrefs/remotes/<remote>/*for both remotes and that the two GitHub questions are the estate commands' only use ofgh(the installer has its own).Docs
README.md 221 -> 230, AGENTS.md 122 -> 131, caps raised in dated entries. AGENTS.md rule 4 says what an assistant must never do about a drift finding — re-digest the copy, or edit the pin — and that "currency not read" means neither source was there, not that the pin is current.
Tests
202 -> 211. Shape pin: a fake standard (a bare repository three commits deep, plus a branch commit
mainnever had), a pin file with real digests and a mirror block; a pinned root with matching copies and the "not read" note; an edited and a missing copy, both dirty paths too; a mirror out of step; the pin read against a clone of the standard underprojects/— two behind, at the tip (nothing to say), on the branch commit (not on main); GitHub asked once under--fetchwith no clone, the exact call asserted; a root without a pin says nothing. Fork fixes: a 404 on one repository leaves the leg asked and says so; seven origin spellings — four that merely containgithub.comnever asked,[email protected]:,ssh://[email protected]:22/andhttps://[email protected]/asked; a github origin WITH anupstreamremote read locally,ghnever called.bash -n statuspasses;shellcheck statusreports only SC2317.python3 -m pytest tests -q: 211 passed locally with the submodule initialised.Not merged
Opened for review. An independent review of the shape layer was still running when this was opened; anything it finds lands as a follow-up commit here before the merge. workBenches re-vendors all four after this lands.
🤖 Generated with Claude Code
Summary by Sourcery
Add the shape-pin layer to status and harden GitHub-backed fork checks while documenting and testing the expanded estate reporting.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Tests: