Repository navigation
shape-doctor.py: a validator that crashed says it crashed instead of "reports a finding", and is CANNOT ANSWER when it is the standard's template, which a standard whose path holds the PYTHONPATH separator no longer runs at all; a neutral product's digest validate-pins.py skipped is a note naming the product, from a child that can no longer reach gh or a proxy; and a root whose manifest does not load and whose scripts/repo_shape.py is gone is told to restore that file before its gate (#278, #297, #298) - #357
Merged
Merged
Conversation
…"reports a finding", and is CANNOT ANSWER when it is the standard's template, which a standard whose path holds the `PYTHONPATH` separator no longer runs at all; a neutral product's digest `validate-pins.py` skipped is a `note` naming the product, from a child that can no longer reach `gh` or a proxy; and a root whose manifest does not load and whose `scripts/repo_shape.py` is gone is told to restore that file before its gate (#278, #297, #298) Three rows said more than the validator they ran had answered. #278. `validator_row` read a validator by its exit code alone, and an exception that reaches the top of a Python program exits 1, the code for findings. A root's own `validate-pins.py` reduced to `raise RuntimeError("boom")` read "reports a finding (exit 1)", and a standard checked out under a directory whose name holds `:` gave the template copy a `PYTHONPATH` that Python split in two, so the template died on `import repo_shape` and a valid manifest read INVALID (manifest). `crashed()`, beside `run_validator`, now tells a crash apart: a non-zero exit, no line starting FINDING or REFUSED, and a traceback header (R278-1). The root's own copy crashing stays a FINDING, since a gate that cannot run is a fact about the project; it says "crashed before reaching a verdict", keeps the quoted exception the #238 and #306 tests read, carries `detail.crashed`, and names a missing `scripts/repo_shape.py` when that is the cause. The template copy crashing is this checkout's failure: it also carries `detail.environment`, so the verdict is CANNOT ANSWER, exit 3. The NEXT stays the validator's own line, which shows the traceback. `pythonpath_unnamable()`, beside `validator_scripts`, says when the template's `scripts/` holds `os.pathsep` (R278-2, amended: no invented destination). `validator_row` must run the template to answer, so it runs nothing and is an environment row with no NEXT; `unloaded_manifest_row` already knows its answer, so its FINDING stands with no NEXT. Both say to run the doctor from a checkout of the standard whose path holds no separator, and no `PYTHONPATH=` value holding one is printed anywhere. It is `os.pathsep`, so Windows' `;` is claimed by the same helper, and a `;` directory on POSIX is an ordinary character and is not refused (R278-3). #297. A project that pins a neutral product, with no local checkout of it, has a `validate-pins.py` that asks `gh api`, prints a `skip` line when that fails, and exits 0. The doctor threw the output away and said "passes", under COMPLIANT, and the child had started a call to GitHub on the operator's login wherever there was one. Every validator child is now started `offline()` (R297-1 with its fallback, both walls): the four token variables `GH_TOKEN`, `GITHUB_TOKEN`, `GH_ENTERPRISE_TOKEN` and `GITHUB_ENTERPRISE_TOKEN` removed, `GH_CONFIG_DIR` the null device, `GH_NO_UPDATE_NOTIFIER=1`, and `HTTPS_PROXY`, `https_proxy`, `HTTP_PROXY` and `http_proxy` pointed at http://127.0.0.1:9 with `NO_PROXY` and `no_proxy` removed. On Windows, where a variable's case does not matter, only the upper-case proxy names are set. `check_machine` alone opts out, with `run_validator(..., reach_network=True)`: it is the documented exception. Exit 0 with ` skip ` lines is now a `note` (R297-2), "passes, but did not recheck: <skip text>", with `detail.skipped` and no NEXT, since the skip line names the three ways to give a source; a note moves no verdict. The validator's own exit-0-with-a-skip contract is unchanged (R297-3). #298. `unloaded_manifest_row` runs no gate, and promised that the gate "refuses it the same way until it loads" for a root that had also lost its `scripts/repo_shape.py`, where that gate dies on the import. The fact now lives in `imports_repo_shape()` beside `validator_scripts`, decided once for both rows and not as a fourth value of `validator_for`, whose arity three callers depend on (R298-1). When the root's own copy cannot import it, the NEXT is `git -C <root> checkout HEAD -- scripts/repo_shape.py`, the bytes the project committed, and its why names the gate to run after it (R298-2, R298-3: restore first, as DRIFTED (copy-missing) already outranks INVALID; the verdict is unchanged). A deletion already committed is not in HEAD, so there the row has no NEXT and its reason says the file comes back from the parent of the commit that deleted it. The "refuses it the same way" promise is printed only where the gate can keep it. Tests, in the new tests/test_doctor_validator_rows.py, on what each row and command does and never on a NEXT's tail: a crashing own copy for each of the three gates and a crashing template (FINDING with `detail.crashed`; the template's CANNOT ANSWER, exit 3), and both NEXTs pasted show the traceback; a standard under `dir:with-colon` gives the environment row with nothing run and no NEXT, and with an unloadable manifest a FINDING with no NEXT, with no `PYTHONPATH=` in either report (WINDOWS_SKIP); a standard under `semi;colon` is refused on Windows and is the control on POSIX, where its pasted NEXT prints the template's finding; a MedxGlass descendant run with this file's own logging `gh` stub first on PATH is COMPLIANT with a `pins` note naming openGlass, the stub saw the validator child with no token, `GH_CONFIG_DIR` the null device and the proxy set, and saw the machine row's probes with the operator's values; a `run_validator` probe both ways on every platform; and for a project and a holder whose manifest has a tab and whose `scripts/repo_shape.py` is gone, the restore NEXT run and pasted exits 0, after which the gate the doctor names refuses `yaml-unparsable` with exit 2, beside the control (the file kept) and a committed deletion (no NEXT). Mutants, each run against the new file: a crash read as a finding again, the token strip dropped, the proxy dropped, the skip read as ok, the restore NEXT replaced by the old promise, and the separator check dropped each turn the rows that hold them red. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
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 5 hours by commenting |
Reviewer's GuideUpdates validator-row execution semantics to distinguish crashes, skipped checks, and environment limitations; isolates validator children from network access; and provides safe remediation for missing repo_shape.py, with comprehensive regression tests covering issues #278, #297, and #298. Sequence diagram for offline validator execution and verdict classificationsequenceDiagram
participant Doctor
participant Validator
participant Network
Doctor->>Validator: run_validator(..., reach_network=false)
Doctor->>Validator: offline environment
Validator->>Network: gh api or proxy request
Network-->>Validator: blocked or unavailable
Validator-->>Doctor: exit 0 with skip lines
Doctor->>Doctor: skipped(output)
Doctor-->>Doctor: NOTE with detail.skipped
Doctor->>Validator: run_validator(..., reach_network=true)
Validator->>Network: check_machine preflight
Network-->>Validator: permitted operator environment
Flow diagram for validator crash and environment handlingflowchart TD
A[Run validator] --> B{Unnameable PYTHONPATH?}
B -->|Yes| C[Environment row; do not run]
B -->|No| D[Collect exit code and output]
D --> E{Crash signature?}
E -->|Yes| F[Crash finding with detail.crashed]
E -->|No| G{Exit 0 with skip lines?}
G -->|Yes| H[Note with detail.skipped]
G -->|No| I[Normal validator verdict]
F --> J{Template copy?}
J -->|Yes| K[CANNOT ANSWER with detail.environment]
J -->|No| L[FINDING]
Flow diagram for restoring missing repo_shape.py before the gateflowchart TD
A[Manifest does not load] --> B{Own repo_shape.py imports?}
B -->|Yes| C[Provide gate refusal NEXT]
B -->|No| D{HEAD holds repo_shape.py?}
D -->|Yes| E[Restore with git checkout HEAD -- scripts/repo_shape.py]
E --> F[Run the named gate]
D -->|No| G[No NEXT; restore from parent of deleting commit]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…or a row that has a NEXT, a skip keeps every line of `gh`'s stderr and the `--pin-source` advice after it, and a validator that printed a FINDING before it raised, and a crash for want of `scripts/repo_shape.py`, are held by tests: the fix round on the review of 2bf402d (#278, #297, #298) The review of 2bf402d was MERGEABLE WITH NITS, with three SHOULDs and the nits below; this is the one commit it asked for, on top of the head. S1 (#278). The separator environment row is a FINDING with no NEXT, by ruling, and `report` printed `Remediation: {next_command}` for it unconditionally, so the stderr block ended in a literal `Remediation: None`. The line is now printed only when the row has a NEXT; the reason already says what to do instead. The colon row asserts no `Remediation` at all, and the template-crash row, which has a NEXT, asserts the line is still there. S2 (#297). `skipped()` kept only the ` skip ` line, and `validate-pins.py`'s skip embeds `gh`'s stderr verbatim, which is two lines when `gh` is not logged in: the reason stopped at `gh auth login`, told the reader to do what the doctor's offline environment undoes, and lost the `--pin-source`, `SHAPE_PIN_SOURCE_<PRODUCT>` and `../<product>` ways to give a source that are why the row has no NEXT. It now keeps the whole block, the ` skip ` line and every line after it up to the next item (`REPORT_ITEM`: ` ok`, ` skip`, ` --`, `FINDING`, `REFUSED`, `WARNING` or the validator's summary line) or the end, joined by a space. Tested with a logging `gh` stub that prints the two-line help, and on a constructed output on every platform. S3 (#278). The clause of `crashed()` that says a validator which printed a `FINDING` or `REFUSED` line reached a verdict had no test: deleting it left every row green. A validator that prints a finding and then raises is now asserted to be a FINDING that is neither `crashed` nor an environment row, for the root's own copy and the template; with the clause gone the own copy would say it crashed and the template would be CANNOT ANSWER, hiding the finding it printed. N3 (#298). The crash reason's "`scripts/repo_shape.py`, which it imports from beside itself, is not there" had no test either. Tested for a project and a holder whose gate dies on the import. N5. The module docstring's "offline by their own contract", which #297 quoted as false, says the doctor runs the validators offline, which `run_validator` now makes true. Mutants, each against the new file, each turning the rows that hold it red: `crashed()`'s no-FINDING/REFUSED clause deleted (the 2 finding-then-crash rows), the "is not there" fact not appended (the 2 missing-`repo_shape.py` rows), `Remediation:` printed unconditionally again (the colon row), never printed (the template-crash row), only the first line of a skip kept and the summary folded into it (the two skip rows, each). 26 tests in the file; the unmutated file passes them all. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 12, 2026
Doctor A landed on main as 8325d05 (#276, #354) while this branch (doctor B, #278, #297, #298) was in review. The two share no function, so shape-doctor.py auto-merged with no conflict: A's changes sit in check_legs, members_verdict and the lockstep helper, B's in run_validator, crashed(), skipped() and unloaded_manifest_row. A merge commit, not a rebase, because the branch's earlier commits are on origin and the ruleset refuses a force-push. This commit only merges. The one place the two touch in behaviour, A's lockstep line printing a PYTHONPATH= value that B refuses to print where the standard's path holds the separator, is wired in the commit after it. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…here no `PYTHONPATH` can name the template's `scripts/`, as the doctor's other lines for that copy are, so a standard whose path holds the separator no longer gets a `PYTHONPATH=` line that splits when pasted beside a `pins` or `family` row that ran nothing and says why (#278) Doctor A (#276, #354) gave the `legs` and `members` rows one helper, `lockstep_next`, for what no checkout cures: the lockstep gate, spelled by `validator_command`. Doctor B (#278) made `pythonpath_unnamable` the one place that says when no `PYTHONPATH` can name the standard's `scripts/` -- its path holds `os.pathsep`, which `PYTHONPATH` splits on and nothing in it can quote -- and made `validator_row` refuse to run the template then, and `unloaded_manifest_row` withhold its line. The two were written in parallel, so A's helper still printed `PYTHONPATH=<standard>/scripts python3 <template> ...` for a root with no `validate-pins.py` (or `validate-family.py`) of its own, from a standard under `/srv/dir:with-colon/`: a line that splits when pasted, one row away from the `pins` or `family` row that says the template was not run (the 2bf402d review, FOCUS g). `lockstep_next` returns None too when `pythonpath_unnamable(ctx.shape, own_copy)` is not None, exactly as `unloaded_manifest_row` withholds its line: the gate's own row is then an environment row that says why, and the finding the `legs` or `members` row reports stands, with no NEXT. The root's own copy is never refused (it is given no `PYTHONPATH`), so a root that keeps its own gate is handed the same line as before. Every other `validator_command` call on the merged tree is already behind the helper: `validator_row`'s crash line and its finding line sit after the `pythonpath_unnamable` return, and `unloaded_manifest_row` asks it before it prints. `check_legs` and `members_verdict` reach the fourth, here, through `lockstep_next`, so one clause covers both. Two tests in tests/test_doctor_validator_rows.py, each from a standard under a directory whose name holds `:` (`WINDOWS_SKIP`, as the unloaded-manifest row's own separator test is): a leg whose gitlink is not its pin, and a member whose gitlink is not its pin, in a root with no gate of its own. Each has a control from a plain directory that still prints the line, and each asserts the `pins` or `family` row is the environment row, exit 3, and that no `PYTHONPATH=` is printed in either report. With the new clause dropped both fail; with it, both pass. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 12, 2026
|
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
…doctor-next-is-only-a-command, so this pull request stacks on doctor B and its CI tests main, A, B and C together: B's crash, unnamable and restore branches keep this PR's `why`, A's `legs` and `members` lines hand their sentence to `why`, `lockstep_next` returns `(command, why)`, and the CANNOT ANSWER block prints `Why:` whenever the row has one (#277) #357 (doctor B, #278/#297/#298) has not landed. Its head e44d860 is final and reviewed: 7158914 merged with main cd1fc79, which carries doctor A (#354, 8325d05, #276) and lane 3's cd1fc79 (#327). Stacking on it lets #402 land right after #357 without a second conflict round. Five conflicts, all in shape-doctor.py: - `validator_row`, the neither-readable branch: this PR's command and `why`, then B's `pythonpath_unnamable` early return and B's `code, quoted, whole =` reading, which `crashed()` and `skipped()` use. - `unloaded_manifest_row`, the neither-readable branch: `why=missing.why` kept, then B's `repo_shape.py` restore branch and B's unnamable branch. - `check_legs`: A's NEXT selection taken whole. The git line from `submodule_update_next` was already `(line, why)` and is passed as `next_command` and `why=` instead of `f"{line} # {why}"`. - `members_verdict`: A's block taken whole. Each of its three branches hands its sentence to `why`: the holder's bootstrap (main's sentence, verbatim), the plain git line, and the family gate. - `report`: B prints `Remediation:` only when the row has a NEXT; this PR printed `Why:` after it. The coordinator's ruling: `Why:` prints whenever the row has a `why`, whether or not a `Remediation:` line was printed for it. `lockstep_next` (A's helper, with B's `pythonpath_unnamable` guard) now returns `(command, why)`, and `(None, None)` where it returned None, and both callers unpack it. Its sentence moved verbatim. B's own new tails (the crash line in `validator_row`, the restore line in `unloaded_manifest_row`) are not in a conflict and are converted in the next commit, with the rest. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
#357's head: the one commit main has that #357 does not is #396 (#348, `tests/test_agents_md_codes.py`), and it merges with no conflict (#277) Main at 45e01f4 is #357's base cd1fc79 plus #396, which adds only `tests/test_agents_md_codes.py`. Merged after #357's head, in the order the coordinator set, so this branch holds main, doctor A, doctor B and this PR together. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
…ne hand their sentence to `why` too, so no NEXT the doctor prints after A and B ends in a ` # ` tail, and the guard now finds a tail spelled with two blanks or a tab, a second one in `report`, or one in a nested def that shares an allowed name (#277) Phase 2 of #277, after merging #357's head e44d860 and main 45e01f4. THE TAILS. By the AST scan of non-docstring string constants: - main 45e01f4 holds 18 tails outside the allow-list: main's 16 at 3ae0109, less `check_legs`' old bootstrap tail, plus A's (#276) `check_legs` git line, `lockstep_next` and `members_verdict` git line; - #357's head e44d860 holds 20: those 18 plus B's `validator_row` crash line and `unloaded_manifest_row` restore line; - the merge commits converted A's three in resolving their conflicts, and `lockstep_next` now returns `(command, why)`; - this commit converts B's two, VERBATIM, less the `#`. What is left is `placement_plan_leg`'s YAML comment line and `report`'s `placement plan written to ... # nothing moved` line, neither of them a NEXT. cd1fc79 (#327) added no tail: its `manifest kinds` NEXT is prose inside `check_manifest_kinds`, which lane 2's #291 owns. `submodule_update_next`'s docstring, which said its sentence "is a ` # ` tail today", now says it is the row's `why`. THE TESTS. - tests/test_doctor_validator_rows.py (B): the template crash test reads `next == validator_command(...)` and `why`, and its stderr check now expects `Why:` after `Remediation:`. The three bare `PYTHONPATH=` expectations read `env PYTHONPATH=` (R277-4). `command_of` is the whole NEXT. - tests/test_doctor_legs_members_next.py (A): `command_of` and `why_of` read `next` and `why` alone, the "one helper here" its module docstring said #277 would change. A tail put back now fails them instead of being cut off. - tests/test_doctor_next_is_a_command.py: - `CASES["check_legs"]` opens with A's sentence. New cases cover A's lockstep line for a leg and for a member, A's members git line, B's crash line and B's restore line. - The zsh legs paste's control half pastes `legs_line_before_277`, the line `check_legs` printed at 3ae0109, rebuilt for the root under test. A's tail has no backticks, so the PR's own line with its `why` put back could no longer show that the harness runs a backtick. - NIT-3: on POSIX the property also refuses `&`, `|`, `(` and `)` outside a quotation, read from `shlex` tokens so a quoted path holding one passes, and a `$(` outside single quotes, double-quoted included. `test_the_operator_readers_see_what_sh_runs_and_not_a_quoted_path` holds both readers. - NIT-1: the guard's tail is `(?:[ \t]{2,}|\t)#[ \t]`. Owners are named by their whole def path. `report` is allowed only its one `nothing moved` string. The self-test shows a two-space, a tab, a second `report` and a nested-`report` tail caught. On the tree it flags nothing new: the widened scan finds the same two allowed strings. - `test_a_cannot_answer_row_with_no_command_still_says_why` holds the coordinator's ruling: the CANNOT ANSWER block prints `Why:` whenever the row has a `why`, Remediation or not. - NIT-4: `standard_ahead` and `standard_of_another_history` are now helpers in tests/test_shape_doctor.py, built from the code its tests inlined. The fixture, the four README copies and the exit-three test use them. `laned_rows` is `behind_row`, and `walk_off_the_pin` is A's `commit_in`. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 12, 2026
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
#357 landed as the squash 5678f68: main and this branch both carry doctor B's text from base 45e01f4 under two histories, so `shape-doctor.py` and `tests/test_doctor_validator_rows.py` conflict, and both resolve to this branch's side (#277) #357 (doctor B) landed as a squash, a new commit, while this branch carries B as a merge of its head e44d860. Git sees one text added twice with different ancestry, so a merge of main conflicts in `shape-doctor.py` (content) and `tests/test_doctor_validator_rows.py` (add/add), and `gh pr update-branch` would refuse the pull request. Both files resolve with `git checkout --ours`, because this branch is e44d860 plus this pull request's change and the squash's bytes for both files are e44d860's. Proved before this commit: - `git show 5678f68:<file>` equals `git show e44d860:<file>` byte for byte for `shape-doctor.py` (sha256 c206264b...) and for `tests/test_doctor_validator_rows.py` (sha256 34075904...). Main has touched neither file since 5678f68. - `git diff --cached de09b7c -- shape-doctor.py tests/test_doctor_validator_rows.py` is empty, where de09b7c is the tree the phase-2 reviewer tested for main cb7063f with 36321c4: 488 passed, 3 skipped. Against main the tree differs only in this pull request's five files. Beyond de09b7c it differs only by main's later #352 (`scripts/bump-leg.py`, its test and `docs/handbook.html`). Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
…he tails as the phase-2 re-check proved them, twenty on the tree this lands into after sixteen at the start, not "five more", and says why `paste_into_zsh` reads `os.environ` itself instead of importing doctor A's `PASTE_ENV` (#277) The docstring said doctor A and doctor B "wrote five more tails while this was open", which makes 21. The count is 16 tails at 3ae0109, 18 on main before doctor B (A rewrote `check_legs`' bootstrap tail rather than adding one, and added `lockstep_next` and the `members` git line), 20 once #357 landed (B's crash line and its restore line), and 0 at this head. The docstring now says that, in the reviewer's words. `paste_into_zsh` keeps building its environment from `os.environ` at the call. Doctor A's `PASTE_ENV` looks like the same dict, but it is built when `tests/test_doctor_legs_members_next.py` is imported, at collection, and `tests/conftest.py`'s session fixture puts the `gh` guard first on `PATH` only after collection. A probe in the worktree's own tests directory showed the live `PATH` leading with `gh-guard0` and `PASTE_ENV["PATH"]` without it. A zsh pasted with that dict would reach whatever `gh` the machine has, which is the hole the guard exists to close, so the import is not clean and the docstring now says why. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
… into fix/adopt-record-submodule-placement Brings in f7f4b14 (#366), cb7063f (#390), 5678f68 (#357) and 53bee5b (#289) on top of 3ef059c, which 563ea16 had merged. Merged by sha, no rebase. One conflict, kept on both sides: - tests/test_manifest_validator.py, the import block. cb7063f adds `import os`, `import subprocess` and `import sys`; this branch had already added `import os` and `import sys`, so only `subprocess` was in conflict. The merge keeps all three, once each, as cb7063f's message says it would, with this branch's `from conftest import REPO, git, run_script` and `from repo_shape import parse_yaml, path_spelling_fault` after them. `git merge-tree --write-tree` of the two parents gives the same tree in every file but that one. Checked: - Every top-level definition of the eleven modules either side changed is the changing side's text, byte for byte. The only ones both sides changed are that import block and shape-doctor.py's module docstring, where the merged docstring differs from main's by exactly this branch's two hunks, and from this branch's by exactly 5678f68's one. - No name is bound twice by the merge. scripts/shape_materialize.py imports `YamlError` and `parse_yaml` twice, but main 3ef059c does that too. - Each module's names are the base's plus what each side added. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
added a commit
that referenced
this pull request
Oct 12, 2026
…tor-manifest-kinds-unreadable-pin: `manifest kinds` keeps #291's restore beside #375's registered-elsewhere finding (#291, #327) #267's branch, this PR's base, now carries main up to 5678f68, #375 and #357 among it. Merged as text, shape-doctor.py conflicts only in `check_manifest_kinds`: the four regions main's #205 and #211 already caused, now with #375's `ungated` in them. #357 does not touch that function, and `pin_restore` and `pin_reads_at` merge clean, because main left them as #267 has them. The resolution keeps every side. In the loop, #205's skip of the root's own manifest comes first, then #291's `load_yaml` and `refusals`, then #211's `beside`, then #375's split of a registered kind by `ManifestKind.runs_in` into `validated` and `ungated`. `registered_elsewhere` joins `detail` only when there is one. The reason names every fault. The NEXT is `"; ".join(fixes)` as on main, with the unregistered kind's sentence for an unregistered kind only, never for a file that does not load. A row with a file that does not load prints the restore alone: joined by `;` to #375's "take ... out of this root" or to #211's sentence, it would be a second command in a pasted line (#277). The next run names the rest. The #291 docstring paragraph now names those faults. Two compose-only tests, each beside a conflicted shape pin: a `family.yaml` beside `project.yaml` (#211), kept from the earlier composition, and a `contracts/family.yaml` in an assembly root (#327), new. Each NEXT is the restore alone and equals the `shape currency` row's. Run, the row is the other fault's alone, and #327's own `git rm`, run in turn, leaves the root COMPLIANT. On the merged tree: tests/test_shape_doctor.py 312 passed, 3 skipped (the Windows-only PowerShell cases); tests/test_doctor_validator_rows.py 28 passed; tests/test_cli_reference.py and tests/test_repo_hygiene.py 63 passed; tests/test_windows_paths.py and tests/test_shape_advisory.py 79 passed; scripts/render-cli-reference.py --check ok. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
…plan-manifest-invalid` joins `_entry_findings` after #255's values, and this branch's `plan-root-symlink` stays after the source's own submodules origin/main moved 92e29d9 -> dd8d0ea (twelve commits), merged by sha: - f0a8bf6 (#330 via #381), scripts/family.py; - 87d2eb7 (#333 via #379), update-shape.py; - cd1fc79 (#327 via #375), shape-doctor.py; - 45e01f4 (#348 via #396), tests/test_agents_md_codes.py: every code-shaped name AGENTS.md spells is a code a tool prints; - 3ef059c (#258 and #261 via #314), adopt-project.py, scaffold-project.py and scripts/shape_materialize.py: the project's YAML reader and its `validate-manifest.py` are asked about the manifest's values before anything exists; `check` reports `plan-manifest-invalid` through `_manifest_findings` in `_entry_findings`; `_repository_urls` refuses `adopt-name-too-long`; - f7f4b14 (#366 via #399), scripts/family.py; - cb7063f (#301 and #280 via #390), scripts/repo_shape.py and the template's validate-manifest.py: a bracket or brace in a plain flow scalar is refused; - 5678f68 (#278, #297 and #298 via #357), shape-doctor.py; - 53bee5b (#289 via #352), scripts/bump-leg.py; - f5cb616 (#369 via #398), scripts/shape_materialize.py: the docstrings of `force_stage` and `stage_written`; - a92e60b (#326 via #400), scripts/family.py; - dd8d0ea (#292 via #353), adopt-project.py: `_elector` keeps a `user.name` byte that is not UTF-8, `_remote_repository` reads an origin URL that is not UTF-8 as none, and `adopt-no-org` is asked before `checked_value`. scripts/shape_materialize.py, scripts/repo_shape.py and every other file merge with no conflict. adopt-project.py conflicts in two hunks of `_entry_findings`, each resolved by keeping both sides: 1. The docstring. Main's order, with #261's manifest findings after #255's values and before #190's relative urls; this branch's symlinks stay after the source's own submodules. 2. The return. Main's `_manifest_findings(plan)` call, and the findings in main's order: each entry's path (#196), coverage, the legs and what the root keeps where the shape writes, the source's own submodules (#166), this branch's `_root_symlink_findings`, #255's values, #261's manifest findings, and #190's relative urls last. The remediation and the NOTEs are main's. How each of main's commits that reach this branch's code meets it: - 3ef059c: `_manifest_findings` asks the validator the template ships about the values `execute` writes; it reads no symlink and no path the shape writes. Its materializer half adds the validator's helpers, `refuse_unstorable_names` and `MANIFEST_VALIDATOR`, and holds `election_date` to the validator's `DATE_RE`; it leaves `place`, `_materialize`, `copy_tree`, `template_files` and `_refuse_unwritable` as they were. In `execute`, its `adopt-name-too-long` (in `_repository_urls`) comes before #255's clone-URL refusal, `_refuse_what_check_finds` and this branch's `core.symlinks` probe, all before any leg. Its new paragraph of the module docstring follows the one 6b53a6d corrected; both merge with no conflict. - f5cb616: docstrings only. - dd8d0ea: `_remote_repository`, `_checked_plan_inputs`' organisation and `_elector`, none of them this branch's. - cb7063f: the plans `check` and `execute` read go through this reader. The plans `plan` writes for this branch's tests hold their entries as block mappings, each path `double_quoted` where it needs to be, and the rehearsal below read every one of them. Checked on the merged tree: - AST (fin183g/names.py, base 92e29d9): no top-level name is bound twice in adopt-project.py, scaffold-project.py or scripts/repo_shape.py, and none is loaded but bound nowhere. scripts/shape_materialize.py binds `YamlError` and `parse_yaml` twice, as main dd8d0ea does (1f90a0f's import and 3ef059c's, the same objects); the merge adds none. - Both sides intact (fin183g/sides_intact.py): the only lines that differ from either side's own change are those of the two hunks. - A rehearsal of this merge (tree d21f8b4, the same as this one) passed tests/test_adopt_root_symlinks.py with main's test_adopt_{manifest_values,git_reads,relative_submodule_url}.py, test_scaffold_manifest_values.py, test_agents_md_codes.py and test_yaml_flow_brackets.py: `440 passed`. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 12, 2026
…t: `check_pin` takes the root its `update-pin-row` remediation reads, so #290's refusal survives #267's split instead of a NameError (#290) Main 580d7df carries #267 (decff87), which split update-shape.py's `read_pin(root)` into the read and `check_pin(pin, pin_path)`, so that shape-doctor.py can check the pins in a root's history in memory. The `update-pin-row` raises moved into `check_pin`, and on this branch they call `pin_rows_remediation(root)`, #290's `git -C <root> log` advice, where `root` is not a name. The textual merge is clean and the tree dies at run time: `NameError: name 'root' is not defined` for a `files:` of `5`, `true` or `1.5` in `check`, `apply` and shape-doctor.py, which then prints no report at all. This commit takes the planned #267 composition, the PR's two attachments fix1-compose-267-resolution-v2.patch and root-pin-faults-after-267.patch, applied unchanged; main moved their hunks by offset only (shape-doctor.py 526 lines, tests/test_shape_doctor.py 521, update-shape.py 1): - update-shape.py: `check_pin(pin, pin_path, root)`, `read_pin` passes its root, and the docstring says `root` is the repository whose history a refusal's `git log` reads. - shape-doctor.py `pin_reads_at` passes `ctx.root`. Its docstring says `check_pin` refuses `files: 5` as `update-pin-row`, and `TypeError` leaves its `except` tuple: no pin's bytes raise one now, so one means a caller out of step with `check_pin`, and the doctor fails loudly rather than answer that no commit holds a pin to put back. - tests/test_shape_doctor.py: #267's ROOT_PIN_FAULTS gains `files: 5`, `true` and `1.5`, each `update-pin-row`, so each is INVALID, exit 1, with `checkout HEAD` as its NEXT, which run as printed leaves the root COMPLIANT. Main's other changes to this PR's files merge as text away from these lines: #446 (245d775) in validate-pins.py, #406 (ec8e09a) in validate-family.py, #379 (87d2eb7) in update-shape.py, and #375 (cd1fc79) and #357 (5678f68) in shape-doctor.py. Neither module has changed on main since decff87. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 13, 2026
brettheap
added a commit
that referenced
this pull request
Oct 13, 2026
…ate-shape.py say when a project's own gate reaches a network: `validate-pins.py` asks `gh api` for a neutral product's pin with the operator's `gh` credentials, and `make bootstrap`, `bump-leg.py` and `update-shape.py apply` run it in the operator's environment, so none of them says any more that a project runs its own gate offline or that `apply` is otherwise offline (#411) (#465) `templates/assembly-root/scripts/validate-pins.py` looks for a declared neutral product's tree in `--pin-source`, then `SHAPE_PIN_SOURCE_<PRODUCT>`, then a checkout beside the assembly root, and only then runs `gh api repos/<owner>/<product>/git/trees/<commit>?recursive=1`; with no `gh`, no login or no network that is a `skip` line and exit 0. A checkout beside the root that cannot answer (one that lacks the pinned commit) is not a skip but the finding `neutral-pin-source-unreadable`, exit 1, with no `gh` call. `make bootstrap`, `bump-leg.py` and `update-shape.py apply` start the validator with their own environment and none takes `--pin-source`, so for a project declaring `neutral_product_pins:` with no local checkout of the product each makes that call with whatever `gh` is logged in as. Re-measured on dd8d0ea with a `gh` stub first on PATH, GH_TOKEN=bogus and an empty GH_CONFIG_DIR: the same call, with GH_TOKEN, from all three; no call with a sibling checkout, with `SHAPE_PIN_SOURCE_OPENGLASS` exported, or for a project declaring no neutral product; and with a sibling that lacks the commit, `validate-pins.py` exit 1 and `bootstrap FAILED: pins (exit 1)`, no call. Nothing in the call is new. Only the words claimed otherwise. - README.md, in the paragraph that documents `validate-pins.py`'s referent recheck: the call is `gh api` with the operator's `gh` credentials; finding no source is a named skip, exit 0; a checkout that cannot answer is the finding `neutral-pin-source-unreadable`; the three tools run the validator in the operator's environment and so make the call too; none takes `--pin-source`. To stay at its line count the paragraph no longer says that a differing digest or a missing pin file is drift. - README.md, "Keeping a project's shape current": "a project runs its own gate offline" is "a project runs its own gate, which never consults this standard", naming "its validators' one possible network read" (not the gate's: `validate.yml` also reads the network, in the root checkout, the App-token mint and the legs' `git submodule update`). The paragraph's 2026-09-03 story loses its list of manual steps, which the `apply` paragraph below already gives. - README.md, the `make bootstrap` paragraph: "It adds no network call" is "That line adds no network call", said of the upstream-moved notice, with a clause that the pins gate bootstrap runs may ask `gh api`. - docs/handbook.html: the "offline" sentence in "Keeping a project's shape current" and the bootstrap sentence get the same words; the legs section gains the referent-recheck paragraph the page lacked, with the same skip and finding wording; the footer's history clause says "validators"; the footer's blob is the new README.md blob. - scripts/bump-leg.py: the `VALIDATORS` comment drops "offline" and says the child gets this process's environment and what that costs; `--local-remote-dir`'s help, "(the TEST path; no network)", is "(the TEST path; the leg needs no network, but the project's own validate-pins.py may still ask `gh api`)", and docs/cli.md is regenerated with `scripts/render-cli-reference.py` for that one hunk. - update-shape.py: `open_upstream`'s docstring says the bare clone is the one place the tool fetches the shape, not the only place `apply` touches a network, and names the other two; its refusal's remediation says "the one step that fetches the shape from a network" and "nothing after it fetches the shape again" where it said "needs a network" and "everything after it is offline"; `tracking_branch_of` no longer says `apply` is otherwise offline. - tests/test_update_shape_pr_base.py: its module docstring's "`apply` is otherwise offline" is "the base comes from the manifest". Unchanged: every tool's behaviour and exit codes; every printed line except the one remediation sentence and the one help line above; README.md's line count (1422, the cap); AGENTS.md; every file under `templates/`, so no digest a project records moves. `bootstrap.py`'s comment that "NO NETWORK CALL IS ADDED HERE" is about its upstream notice, which is true, so the pinned copy is left alone. Left out: a test that pins the callers' `gh api` call (it cannot fail on main); starting the three children offline as #357 did the doctor's; passing a known source to them; a sentence in AGENTS.md that the call exists (it is at its cap, and it makes no offline claim); the true half of the sentence the README paragraph dropped (a digest that recomputes differently is the finding `neutral-pin-digest-mismatch`, exit 1), which #460's checklist carries. Lane: openreposhape-3 (openRepoShape-3) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap
added a commit
that referenced
this pull request
Oct 13, 2026
… writes its pin file as the scaffold does, so an adopted root passes `validate-pins.py` (#273); a `--pin-source` that cannot answer is `pin-source-unreadable` (#339) (#508) **Brought up to date after #409 squash-landed** by merging origin/main (9736424, #409's squash) as f9ed46f. Its `scaffold-project.py` conflict was resolved to this branch's side once `git diff b70a07d 9736424 -- scaffold-project.py` (#409's final head against its squash) came out empty. So the file is the one tested on this branch plus main's own later changes to it, and holds nothing of #409's; details below. This branch carries #275's adopt half. It was built on `fix/pin-source-env-collisions`, PR #409 (#275's scaffold half and its fix round), merged at 6494714 as 583f647, over the earlier 5690235 (34dbd86). After 6494714, #409 only merged main, five times, up to its final head b70a07d, and none of those merges has a hand edit (`git show --remerge-diff` is empty for each). Adopt's refusal of two products that share a source variable goes through #409's function, so this branch lands after #409. It was never rebased. `git diff b70a07d 9736424` is empty for each file #409 touched: `scaffold-project.py`, `scripts/repo_shape.py`, `templates/assembly-root/scripts/validate-pins.py` and `tests/test_pin_source_env_collisions.py`. What f9ed46f resolves, four files with one hunk each: - **`scaffold-project.py`.** - The conflict hunk is main's block from `PIN_COLLISION_REMEDIATION` through `_pin_collision_remediation`, which #409's squash edits: it adds `PIN_VARIABLE_REMEDIATION`, `_colliding_pin_variables` and `_pin_collision_remediation` and changes `_refuse_colliding_pins`. This branch moved all of that to `scripts/shape_materialize.py`. The hunk takes this branch's side. (The merge commit's message says "re-adds"; this is the exact account.) - #409's auto-merged import of `PIN_SOURCE_ENV_PREFIX, pin_source_env_collisions` is dropped, because nothing in the file uses either name any more. - It is not `git checkout --ours` of the whole file. Main changed the file beyond #409 since this branch last merged it: #355's `--tracking-branch` check (6c2a371) and a73b4e9's `RULESET_HINT`. Those lines stay. - The result is the file `git merge-tree` gives for this branch with main before the squash (518010b). Its diff from the file tested here has the same patch-id as main's own 3ef059c..518010b change to it. - **`templates/assembly-root/scripts/validate-pins.py`.** Main's side, which is #409's final blob, with main's #359 workflow reader in it. This branch had no change of its own to the file beyond #409. - **`adopt-project.py`, `_commit_the_split`.** - Main: #445 wraps the function in its late-failure `try`, and #394 builds an `append` with the plan's submodule record. - This branch: its only edits there were a comment and `neutral_pins=_recorded_pins(plan)` on the materializer call. - Both now sit on main's call inside the `try`: `append=append, neutral_pins=_recorded_pins(plan)`. - **`docs/cli.md`.** It is regenerated with `scripts/render-cli-reference.py`, and `--check` is ok. It differs from main's only in the `--pin`, `--pin-owner` and `--pin-source` help of `adopt-project.py plan`. `scripts/repo_shape.py`, `templates/assembly-root/scripts/validate-pins.py` and `tests/test_pin_source_env_collisions.py` are main's blobs, which are #409's: this branch adds nothing to them. Nothing of #409 is lost. Its scaffold behaviour is `shape_materialize.refuse_colliding_pins` and `pin_variable_collisions`, keyed by #409's `pin_product_key`. **73d65c6, after the merge.** - **The change.** `_read_pins` reads `plan.get("pins")` where it read `plan.data.get("pins")`. - **Why.** #445's `tests/test_adopt_late_failure.py` hands `_commit_the_split` a `SplitPlan` as its plan, a `dict` that adds `entries`. On f9ed46f, three of its tests stopped at "committing the split" with `AttributeError: 'SplitPlan' object has no attribute 'data'` (3 failed, 83 passed in that file). - **Nothing else changes.** `Plan.get` with no default returns `plan.data.get(key)` exactly, so a loaded plan reads as before. `adopt-project.py plan --pin` took a NAME only (`--pin openGlass`) and refused a trailing `@<commit>`. `plan`, `check` and `execute` each exited 0, and `execute` printed `adoption verified`. The manifest then listed the name in `neutral_product_pins:` with no `contracts/<product>-pin.yaml` beside it, and on its first run the adopted root's own `validate-pins.py` refused it as `neutral-pin-missing`. #273's table, reproduced on c7c02fa with the issue's own commands (local bare remotes, and a stub `gh` that exits 97): | `--pin` | c7c02fa | this branch | |---|---|---| | `openGlass` | `execute` exit 0, `- openGlass`; clone's `validate-pins.py` exit 2 `neutral-pin-missing` | `plan` exit 2 `pin-malformed`, with the scaffold's remediation (`--pin openGlass@<40 hex>`); no plan is written | | `opensoft/openGlass` | exit 0, `- opensoft/openGlass`; exit 2 `neutral-pin-missing` for `contracts/opensoft/openglass-pin.yaml` | `plan` exit 2 `pin-malformed` | | `spec` | exit 0; `validate-pins.py` exit 0, reading the leg's `contracts/spec-pin.yaml` as the neutral pin | `spec@<sha>` is `adopt-pin-collides` at `plan` | | `shape` | exit 0; `contracts/shape-pin.yaml` read as the neutral pin | `shape@<sha>` is `adopt-pin-collides` at `plan` | | `openGlass@<sha>`, `opensoft/openGlass@<sha>` | `plan` exit 2 `adopt-pin-malformed` | `plan`, `check` and `execute` exit 0, and `gh` is called 0 times. `contracts/openglass-pin.yaml` is written and the manifest lists `- openGlass`. In the clone, `validate-manifest.py` exits 0, and `validate-pins.py` exits 0 with `openGlass: pin commit … digest recomputes` | Brett ruled for decision 1's first option ("go with your recommendation on #273"): adopt takes the scaffold's pin and writes the scaffold's pin file. That reverses the NAME-only `--pin` from #6, and the comment that described it is replaced with the new contract. - **One implementation.** The scaffold's pin code moved into `scripts/shape_materialize.py`, next to `neutral_pin_path` and the materializer that writes the file. What moved: - `PIN_ARG_RE`, `parse_pin`, `pin_digest_from_source` and `pin_digest_from_gh`; - `declared_pin_values`, `declared_pin_products` and `PIN_COLLISION_REMEDIATION` (in #309's wording); - from #275's branch, `PIN_VARIABLE_REMEDIATION` and the variable check; - `_refuse_colliding_pins`, split into the pure `pin_collisions` and `pin_variable_collisions`, and `refuse_colliding_pins(refusal=...)`, which raises one refusal for both. The code did not move verbatim. `_refuse_colliding_pins` became the three functions above; `pin_digest_from_source` was rewritten for #339 (below); and fix round 1 changed three of them (below): `pin_variable_collisions` keys each pin by #275's `pin_product_key`, `pin_digest_from_source` spells a path that is not printable, and `pin_digest_from_gh` refuses a missing `gh`. The scaffold's behaviour is otherwise unchanged. `scaffold-project.py` imports what it calls under its old names. Lane 5's review ran 34 scaffold cases (every pin refusal, the `gh` stub's four modes, dry and real successes) on 34dbd86 and on this branch at 7a94b6b. rc, stdout, stderr, the `gh` log and the files made were identical, apart from the shape's own commit and digest and #339's row. Its pin tests and #275's pass as they are. `tests/test_git_output_decoding.py`'s exemption for `pin_digest_from_gh` follows the function to its new file. - **`plan`.** `--pin`, `--pin-owner` and `--pin-source` mean what they mean for the scaffold. `plan` reads the digest from `--pin-source` or `gh api`, and records product, repository, commit, digest and `digest_source` in the plan, so `check` and `execute` read no network for a pin. `plan` refuses: - a name with no `@<commit>`, as `pin-malformed`. That includes an empty `--pin ''`, which adopt used to drop and now refuses, as the scaffold always has; - `spec`, `code` and `shape`, in any case, as `adopt-pin-collides` (#273 decision 4), in the scaffold's sentence and remediation (#241, #309); - one product given twice, the same way, whether it is a repeat or two names that share one file (decision 5); - two products that one `SHAPE_PIN_SOURCE_<PRODUCT>` names, such as `open-glass` and `open_glass`, the same way, through #275's check; - a leg path over a pin's file, as `adopt-leg-path-collides`; - a `--pin-source` path that `check` would refuse in `digest_source:` (fix round 1), as `adopt-unwritable-value`. It is asked only when a `--pin` records the path; - with no `gh` on PATH and no `--pin-source`, `gh-not-found` (fix round 1). - **`check` and `execute`.** These are new `check` findings, and `execute` refuses each one before any leg exists. They come from `_leg_findings`, the list `check` and `_refuse_what_check_finds` share: - `plan-pin-unrecorded`: a name alone (an old plan's `pins: [openGlass]`, or a hand edit), or an entry missing its commit or digest; - `plan-pin-malformed`; - `plan-pin-collides`, which covers two pins at one file, a pin at a file the shape writes, and two products that share one source variable; - `plan-root-holds-pin`: a source path kept in the root at the pin's file. The materializer would write the shape's pin beside it under `shape/`, and `validate-pins.py` would read the source's file instead. How each finding ends: - `plan-pin-unrecorded` and `plan-pin-malformed` end with the `plan --pin <product>@<40 hex commit>` that records the pin whole. - `plan-pin-collides` ends with re-running `plan` with each product once, or, for two products that share a source variable, with one product of each such group. - `plan-root-holds-pin` ends with the kept path's own remedy: send that entry to a leg, `drop` it, or rename it in the source and re-run `plan`. A leg moved over a pin's file in the plan is `plan-leg-path-collides`. - **Also part of #386: its `pins:` row.** A hand-edited `pins:` that is not a list (a name such as `pins: openGlass`, a number, a mapping, a quoted string) is now `plan-pin-malformed` in `check` (`` `pins:` is 'openGlass', not a list of pins ``), and `execute` refuses it before any leg exists. - Where: `_read_pins` in `adopt-project.py`; the test row is `plan-pin-malformed-not-a-list` in `tests/test_adopt_pins.py`. - Before: on main, `check` said `plan ok` for the name, the mapping and the string, and gave a traceback for the number (reproduced by lane 5's review on cb7063f). #386 records that `execute` then wrote the name as eight one-letter pins. - Not fixed here: #386's other keys, `allow_empty_legs:`, `paths:`, `legs:` and `source:`, so #386 stays open. Lane 2's #435 takes all of #386, `pins:` included, and its `pins:` rule keeps only text items where this branch writes mappings; whichever lands second reconciles them (#435 (comment), and "Where the meaning meets" below). - **`execute`.** It writes each pin through `materialize_assembly_root(neutral_pins=...)`. The manifest lists the product with the owner stripped (decision 3), so the entry and the file agree. - **Docs.** `--help` is updated and `docs/cli.md` regenerated (`render-cli-reference.py --check` ok). `pin_digest_from_source` caught only `Refusal`. A directory that is no clone is git's own failure, so it was always `pin-source-unreadable`, exit 2. A path `subprocess.run` cannot enter never reaches git: it is a `FileNotFoundError`, `NotADirectoryError` or `PermissionError` out of `cwd=`, and nothing caught it. `scaffold-project.py --pin ... --pin-source <that>` ended `--dry-run` and the real run alike in a traceback, exit 1. Since the move above, `adopt-project.py plan --pin` reads its digest through the same function and ended the same way. Both reach it through `declared_pin_values`, and `check` and `execute` read no source, so that call is the only reader. The issue's table, run on ab623dd for the scaffold and on d806e8f for `adopt-project.py plan` (adopt has no `--pin-source` on ab623dd), then on this head. `gh` is a stub that logs and exits 97, with `GH_TOKEN` bogus and an empty `GH_CONFIG_DIR`; it was called 0 times in every run: | `--pin-source` | before | this branch | |---|---|---| | a directory that is not a clone | `pin-source-unreadable`, exit 2 | unchanged | | a path that does not exist | `FileNotFoundError` traceback, exit 1 | `pin-source-unreadable`, exit 2: `<path> could not answer for opensoft/openGlass @ <40 hex>: no such directory` | | a file | `NotADirectoryError`, exit 1 | exit 2, `... it is a file, not a directory` | | under a parent this user cannot enter | `PermissionError`, exit 1 | exit 2, `... Permission denied` | | a symlink loop (not in the issue) | `RuntimeError` out of `Path.resolve()` on 3.12, exit 1 | exit 2, `... Too many levels of symbolic links` | The real run and `--dry-run` give the same stdout and stderr, and nothing exists afterwards (no remote directory, no work directory; for adopt, no plan file). What changed, in `scripts/shape_materialize.py` only: - `pin_digest_from_source` catches `OSError` as well as `Refusal` and raises the existing `pin-source-unreadable` with its remediation unchanged. The message names the path and the reason. - `stat()` judges the source inside the guard, as #312 does in `validate-pins.py`, and the sentences are that file's: a missing path, or one beneath a file, is "no such directory"; a file is "it is a file, not a directory"; any other `OSError`, from `stat()` or from git's `cwd=`, is the system's own reason (`strerror`). It is not `exists()`/`is_dir()`, which before 3.14 swallow only a missing path. A source `stat()` can read but `cwd=` cannot enter, a directory with no search bit, fails in `tree_digest` and the same guard answers it. - `declared_pin_values` resolves the path through a guarded `_resolved_pin_source`. `Path.resolve()` raises a `RuntimeError` on a symlink loop before 3.13 (an `OSError` since), before the digest was asked for. As typed, `stat()` meets the loop and says so. - A source that answers is read exactly as before: a relative path resolves against the working directory, a symlink to a clone is followed, `digest_source` reads `local-clone (<path as typed>)`, and the digest is `tree_digest`'s. `tests/test_pin_source_unreadable.py` (46 tests in the #339 commit; fix round 1 adds 17 for S1 and moves one, below) runs each case through `scaffold-project.py --dry-run`, its real run and `adopt-project.py plan`: missing, a file, beneath a file, relative and missing, a parent and a source with no search bit (skipped on Windows and as root, by a mark, so before any fixture builds a directory), a 300-character name, a symlink loop (skipped on Windows) and a directory that is no clone. Each asserts exit 2, the refusal naming the path and the reason, its remediation, no traceback and nothing created. It also holds `--dry-run` and the real run to the same stdout and stderr, checks the path is printed escaped under an ASCII stderr and as a surrogate when it is not UTF-8, and checks that a relative source and a symlink to a clone read as before. The session `gh` guard fails any test whose run called `gh`. origin/main ab623dd reached this branch through implQ's branch: 34dbd86 is a30091f merged with ab623dd. One file conflicted there, `templates/assembly-root/scripts/validate-pins.py`, in seven hunks, because #312 (8cdca5e) replaced `keyed_sources` and `default_source` with `PinSources` and #275 added `env_shared` and `shared`. #312's blob is the same at its PR head, at the squash and at ab623dd, so it landed the file implQ resolved against. The resolution keeps #312's side in all seven and adds #275's on top: | # | hunk | resolution | |---|---|---| | 1 | `resolve_neutral_pin_source` signature | #312's `sources: PinSources` and 3-tuple return, plus #275's `env_shared: bool = False` | | 2 | its docstring tail | #312's `Returns (path, how, typed)` text, plus #275's "Rule 2 is skipped when `env_shared`" paragraph | | 3 | `_recompute_neutral_pin_digest` signature | #312's `sources`, plus #275's `shared: frozenset[str]` after `report` | | 4 | the `resolve_neutral_pin_source(...)` call inside it | #312's 3-tuple unpack, plus `env_shared = product.casefold() in shared` and the extra argument | | 5 | `_check_one_neutral_product_pin` signature | #312's `sources`, plus #275's `shared` | | 6 | its call of `_recompute_neutral_pin_digest` | `sources, report, shared` | | 7 | `_check_neutral_product_pins` docstring and body | #312's `PinSources(...)` and `_note_unused_pin_sources`, plus #275's paragraph, `_report_pin_source_collisions(products, report)` and `shared = frozenset(pin_source_env_shared(products))` | This branch's own merge of 34dbd86 (5690235) had no conflict, and neither had its merge of #409's fix round, 6494714 (583f647). That fix round made `neutral-pin-source-collides` a note and keyed "one product" by `repo_shape.pin_product_key`. At 421e4e5, `templates/assembly-root/scripts/validate-pins.py`, `scripts/repo_shape.py` and `tests/test_pin_source_env_collisions.py` were byte-identical to the tree `git merge-tree` gives for 6494714 with origin/main 3ef059c (blobs 5604007, 091966b, 5220787), so this branch added nothing to those three files beyond #409. The 34dbd86 merge brought in #335, #312, #317, #270 (f795cf7), #344 and #349 with no conflict. Earlier merges of origin/main (87373a6, for #309's reworded constant, and e43fa95) are unchanged. Fix round 1 merged origin/main three more times: - **cd1fc79 (2bcfa69).** It brought #245, #351, #350, #345, #372, #371, #354, #380, #377 and the rest since ab623dd, with no conflict. - **45e01f4 (4098b61).** It brought #396's `tests/test_agents_md_codes.py`. That test finds `scaffold-pin-collides` as a string constant of `scripts/shape_materialize.py`, which `SHIPPED` lists. - **3ef059c (421e4e5), #314.** One conflict, one hunk in `adopt-project.py`. This branch's `_refuse_an_unrecordable_pin_source` and #314's section "The project must be able to hold what `execute` writes into it (#261)" were added at the same place; both are kept. Where the two meet, lane 5's earlier recipe applies: - `_flag_plan` builds each pin as the `PIN_FIELDS` mapping `plan` writes, not `list(pins)` of products. So the plan `plan` asks the validator about is the plan it writes. - #314's `test_plan_asks_what_check_asks_of_the_same_keys` plans `--pin openGlass@<commit> --pin-source <stand-in>` where it planned the name alone, which `plan` now refuses. Then f9ed46f, after #409 squash-landed, and 73d65c6 after it (top of this description). On the merged tree exactly one test failed: `tests/test_adopt_template_values.py::test_check_finds_and_execute_refuses_a_hand_edited_value[pins-surrogate]`. It plans, then hand-edits the plan to `pins: ["openX\ud800"]`, a name-only pin with a lone surrogate. Before this branch the refusal's headline was `REFUSED plan-unwritable-value`. A name-only pin in a plan is now `plan-pin-unrecorded` (#273), so `check` has a second, independent finding for that very plan, and the headline is the first finding's: ``` REFUSED plan-pin-unrecorded: 2 finding(s) ... FINDING plan-pin-unrecorded: `pins:` entry 1, 'openX\ud800', is a name with no commit and no digest ... FINDING plan-unwritable-value: a `pins:` item is 'openX\ud800', which `execute` writes into the assembly root's `project.yaml`, and it holds a lone surrogate ... ``` Nothing about #270's contract changed. The lone surrogate is still found as `plan-unwritable-value`, listed under the refusal, and `execute` still refuses before any leg exists. `check` builds `_leg_findings`, where `_pin_findings` sits, before it calls `_value_findings`, so the pin finding comes first. d806e8f changes one assertion for that row, `pins` only: the headline is `REFUSED plan-pin-unrecorded: ` where it was `PLAN_REFUSED`. The other 15 rows and the finding assertions, including the `plan-unwritable-value` line, are untouched. Lane 5's review of 7a94b6b found 3 should-fix and 5 nits. Each is answered here: - **#409's `pin_product_key` (review N1).** The merge of #409's fix round could not carry it, because this branch had moved the function that used it out of `scaffold-project.py`. `pin_variable_collisions` now keys each pin by that function, where it casefolded. `openß` and `openss` are two pin files and one `SHAPE_PIN_SOURCE_OPENSS`, and a casefold named each of the two pins twice. No `--pin` or recorded `pins:` entry `PIN_ARG_RE` admits can spell either, so the test asks the function directly. `refuse_colliding_pins`' docstring now says, in #409's words, that the root's `validate-pins.py` only notes such a pair. - **S1, a `--pin-source` path that is not printable.** `pin_digest_from_source` names the path as typed unless it is not printable (`str.isprintable`), and then as Python's `repr` spells it (`shown_source`). That covers the refusal's head and git's own reason, which names the directory it ran in. Printed raw, an ESC reached the terminal, and a line break or a carriage return began a line of the path's choosing, a forged `REFUSED` line among them, from the scaffold and from adopt. The traceback #339 replaced had shown a `repr`. A printable path is named byte for byte as before. - **S2, no `gh` on PATH.** `pin_digest_from_gh` refuses as `gh-not-found`, exit 2, as `repo_shape.tree_digest_from_gh` names it, and offers `--pin-source`. It was a `FileNotFoundError` traceback, exit 1, from the scaffold and, new with this branch, from `adopt-project.py plan --pin`. - **S3, a hand-edited `commit:` or `tree_sha256:`.** The lane's decision is to accept it and document it (option (c)); no behaviour changed. A pair that disagrees passes `check` and `execute` (`adoption verified`), because neither reads a network for a pin, by design. The adopted root's own `validate-pins.py` then exits 1 with `neutral-pin-digest-mismatch` wherever it can read the product. `check` now says so once, after the pins it will write: "each pin as `plan` read it, not read again here: the root's own `validate-pins.py` recomputes its digest wherever it can read the product". Options (a), `execute` recomputes before it creates the legs, and (b), `check` recomputes from a clone still on the machine, are filed as #449. - **N2, a `--pin-source` that `plan` cannot record.** `plan` asks `check`'s question (`one_printable_line`) of the path it records in each pin's `digest_source:`, before any digest is read. It refuses one that fails as `adopt-unwritable-value`, in #270's words (`unwritable_reason`), or as "an invisible formatting character" where those name nothing. Before, it was planned, exit 0, and printed raw in the report. `check` then refused it as `plan-pin-malformed` and said to re-run the same `plan`. The report's `pin` line and `check`'s `write` line now spell the digest's source with `_shown`. The scaffold half is pre-existing (a line break in the path is written into the pin file; a byte that is not UTF-8 dies after all three repositories exist) and is filed as #450. - **N3, six hunks no test guarded.** Each now has a test that fails when it alone is reverted: - the two name guards (a `pins:` name holding an ESC and a forged line); - the lower-casing of the commit and the digest (an upper-cased hand edit); - the `digest_source` printability check; - the not-text check (`commit: 1234567` unquoted); - the gitlink filter (a submodule kept where the pin is written is `plan-submodule-root` alone). - **N4.** This body. - **N5, #339's third decision.** A `--pin-source` that nothing reads is still silent, now in adopt too. This PR does not decide it. #451, filed, lays out refuse, note and leave, so closing #339 loses nothing. Lane 5's second review, of 421e4e5, found no blocking item, 2 should-fix items and 3 nits. The two should-fix items are this body: the landing after #409 (above) and #386 (above). The code needed no change for them. f63d1ed adds two tests and no code: - **n1. `plan` asks nothing of a `--pin-source` no `--pin` records.** With the `args.pin and` guard dropped, such a path holding an ESC or a zero-width joiner was refused in a sentence naming no file ("`execute` writes into , and ..."), and every test still passed. `test_a_pin_source_no_pin_records_is_not_asked_about` holds the plan to exit 0 and `pins: []`, with the path named nowhere in the plan or the report. The ESC row is POSIX-only by the file's `POSIX_NAMES` mark; the zero-width joiner row runs everywhere. It holds #451's answer today, silence, so a decision there changes this test on purpose. - **n2. A printable `--pin-source` is printed as it is.** With `_spelled` in place of `_shown` in `plan`'s `pin` line, every test still passed. `test_a_printable_pin_source_is_printed_as_it_is` holds `plan`'s `pin` line, and `check`'s `write` line for the plan `plan` wrote, to their exact text, ending `(local-clone (<path>))` with no backtick. - **n3** needs a code change and is left out (below). **Fix round 2, on f63d1ed.** Each run had a `gh` stub first on PATH (it logs and exits 97), `GH_TOKEN` bogus, an empty `GH_CONFIG_DIR`, `git-filter-repo` 2.47.0 next on PATH, and the identity blanked with `GIT_CONFIG_COUNT`; the session `gh` guard came first inside each run. - **The pin set: 812 passed, 2 skipped.** It covers adopt pins, adopt plan, #339's file, #275's tests, the pin and neutral-pin validators, git output decoding, adopt template values, CLI reference, scaffold pin and reuse, scaffold pin collisions, #314's two files and #396's file. The skips are `test_adopt_plan.py:403` (no MedxEHR clone) and `test_adopt_template_values.py:223` (this host reads `git config user.name` from the repository, not from `GIT_CONFIG_GLOBAL`). That is fix round 1's 809 passed, plus the three new rows. - **Shape doctor and scaffold leg-path collisions: 369 passed, 3 skipped** (the PowerShell line exists only on a Windows host). - **Mutation probes**, each one line changed in a throwaway worktree, over `tests/test_adopt_pins.py` and `tests/test_pin_source_unreadable.py` less the five end-to-end adoptions: - the `args.pin and` guard dropped: 2 failed, both n1 rows; - `plan`'s `pin` line `_spelled`: 1 failed, the n2 test; - `check`'s `write` line `_spelled`: 2 failed, the n2 test and `test_an_upper_cased_hand_edit_is_written_lower_cased`; - `plan`'s `pin` line raw: 1 failed, the no-break-space test that already guarded that hunk. **On the merged tree, 73d65c6** (the merge f9ed46f and the `_read_pins` commit), with the same harness: - **The pin set** above, with #445's `test_adopt_late_failure.py`, `test_adopt_git_reads.py` and `test_adopt_filter_repo_failure.py` and #387's `test_adopt_empty_symlinks.py` and `test_adopt_root_manifest.py`: **988 passed, 2 skipped**. The skips are the two above. - **Shape doctor, scaffold leg-path collisions and the adopt suites:** **967 passed, 3 skipped** (the PowerShell line). The adopt suites are e2e, execute refusals, verify, root shape paths (#387's too), leg-path collisions, clone template, ignored shape files and submodules. - **On the merge alone, f9ed46f** (the same tree as before the `_read_pins` commit): `tests/test_adopt_late_failure.py` gave 3 failed, 83 passed, the three `AttributeError` rows above. - `render-cli-reference.py --check` is ok on the merged tree. pyflakes reports the same four warnings on `adopt-project.py`, `scaffold-project.py` and `scripts/shape_materialize.py` as before the merge. **Fix round 1, on 421e4e5.** Each run had `git-filter-repo` 2.47.0 on PATH and the identity blanked with `GIT_CONFIG_COUNT`. A `gh` stub that logs and exits 97 was first on PATH, with `GH_TOKEN` bogus and an empty `GH_CONFIG_DIR`, and the session `gh` guard came first inside each run. - **The pin set:** 809 passed, 2 skipped (the same files and skips as above). - **Doctor and scaffold:** 782 passed, 3 skipped (the PowerShell line exists only on a Windows host). It covers shape doctor, scaffold leg-path collisions, scaffold e2e, referent chain links, naming policy, repo hygiene and #351's free-text values. - **The adopt suites:** 882 passed. It covers e2e, execute refusals, verify, spec-only, leg paths, root shape paths, plan escapes, leg-path collisions, clone template and submodules. - **Before the #314 merge,** on 74ce4d9's tree: the first two sets gave 577 passed, 2 skipped and 782 passed, 3 skipped. On 2bcfa69's tree (the merges alone, before the fix) they gave 542 passed, 2 skipped and 782 passed, 3 skipped. After the 45e01f4 merge, `tests/test_agents_md_codes.py`, repo hygiene and CLI reference: 110 passed. - **Lane 5's second review** also ran 421e4e5 merged with main cb7063f and with 53bee5b: the pin set, the manifest-value set, and the doctor set with #357's `tests/test_doctor_validator_rows.py`. All passed, with only the skips above. Proof that fix round 1's tests test something: - **On 2bcfa69's tree,** with this head's two test files laid over it, 31 of the new rows fail: - S1: 17; - N2 and its report spelling: 7; - S2: 3; - the `pin_product_key` port: 2; - `check`'s S3 line: 1; - the not-UTF-8 `adopt plan` row: 1. The N3 rows pass there, as they must: they guard hunks this branch already had. - **Mutation probes.** Each hunk was reverted alone, in a throwaway worktree, and both test files were run: 18 of 18 were caught. - **The port:** the casefold keying (2 fail); the casefold lookup alone (2). - **S1:** the path named raw (13); git's reason named raw (2); every path `repr`'d, printable or not (27). - **S2:** no `except` (3). - **N2:** no `plan` check (11); only #270's question asked (1); the formatting-character reason said otherwise (1); the report's `pin` line raw (1); `check`'s `write` line raw (1). - **S3:** the line dropped (1). - **N3:** the `_pin_fix` name guard (1); the `_read_pins` path guard (1); the lower-casing (1); the `digest_source` check (1); the not-text check (1); the gitlink filter (1). - **The issue rows reproduced.** S1, S2 and N2 were reproduced on 2bcfa69's tree and shown gone on the fix (a probe driving both tools; `gh` was called 0 times). **Before fix round 1.** Runs were on 7a94b6b, with `git-filter-repo` 2.47.0 first on PATH and the repository-local `user.name` blanked with `GIT_CONFIG_COUNT` (a workstation whose standard checkout sets one fails `test_the_scaffold_refuses_with_no_elector` on main itself; CI sets none). 7a94b6b differs from ffd1297 in `tests/test_pin_source_unreadable.py` only, so the three suites that do not read that file ran on ffd1297: - the new file: 46 passed; - adopt pins, adopt plan, git output decoding: 172 passed, 1 skipped (the MedxEHR clone is absent); - scaffold pin and reuse, pin collisions, e2e, referent chain links, neutral pin and pin validators, #275's tests, naming policy, repo hygiene, CLI reference, scaffold leg-path collisions: 571 passed; - shape doctor: 254 passed, 3 skipped (the PowerShell line exists only on a Windows host); - the new file with repo hygiene, git output decoding and CLI reference, once more after the last edit: 176 passed. Earlier on 5690235 and d806e8f, before the #339 commit: the adopt suites (e2e, execute refusals, verify, spec-only, leg paths, root shape paths, plan escapes, leg-path collisions, clone template) 740 passed, and `tests/test_adopt_template_values.py` with #273's other adopt tests 489 passed, 2 skipped. They were not re-run on 7a94b6b: the #339 diff touches `pin_digest_from_source` and the call in `declared_pin_values`, which those suites reach through `test_adopt_pins.py` only. Nothing was run on macOS or Windows. Proof the new tests test something: - **On d806e8f.** 38 of the 46 fail, each on the traceback and its exit 1. The 8 that pass are the unchanged behaviour: the not-a-clone refusal (4 rows) and the valid-source rows (4). - **Mutation probes.** Ten hunks reverted one at a time, each failing at least one new test: the `OSError` catch (16 fail), the catch narrowed to `OSError` only (21), the missing-path clause (9), the clause narrowed to `FileNotFoundError` (3), the `S_ISDIR` judgement (3), the loop guard (4), no resolve at all (3), the old `.resolve()` call (4), the reason as `str(exc)` (12), and the file sentence as the OS's (3). - #273's own 52 tests still fail on c7c02fa (51 fail or error; the one that passes checks the test's own table), and its 18 mutation probes were each caught. **Re-verified after the merge.** An independent re-verification of f9ed46f and 73d65c6 found the code correct: - #409 is carried whole. A 30,000-case fuzz of `--pin` lists through #409's final refusal and this branch's port differed in 0 cases. - `scaffold-project.py` equals the tested file plus main's own changes that are not #409's (same patch-id). - `_commit_the_split` keeps #445's `try` and #394's `append`. - `_read_pins` reads a loaded plan as before. Its findings were all in this description (the #506 bullet and three stale facts), now fixed. Runs on the head and on its merge with main 48585e6: 988 passed, 2 skipped; and 967 passed, 3 skipped. `git merge-tree --write-tree` was run at 01:48Z on 2026-10-13, comparing hunks per file. Each PR head, fetched from `refs/pull/<n>/head` with no `gh`, was merged with 73d65c6 and with origin/main 9736424 alone. Two sets were asked about: - every PR this description listed before that main does not now contain; - every PR numbered above #468 whose head main does not contain: #473, #474, #490, #491, #493, #494, #495, #496, #497, #503, #504 and #505. **Open state, read with `gh` by the coordinator at 02:00Z and refreshed at 02:25Z after a re-verification on main 48585e6.** Every pull request named below is open. #184, #94, #96, #98, #100 and #161 are closed, and #465 landed as 48585e6. `fix/adopt-plan-quote-yaml-keywords` has no pull request. #506 (`fix/scaffold-reuse-seeded-legs`) opened after this list was made, and the re-verification reads it. - **Landed since the last draft of this list:** #343, #346, #355, #358, #373, #378, #382, #387, #394, #397, #401, #404, #409, #419, #452, #456, #465, #466 and #484. #394's `_commit_the_split` conflict and #401's `docs/cli.md` conflict are both resolved in f9ed46f, above. - **Clean, 20:** #266, #347, #356, #374, #376, #384, #395, #453, #467, #468, #473, #474, #490, #491, #493, #494, #495, #497, #503 and #505. #453, #468 and #491 were updated onto main since the first read and now merge clean. #507 (lane 5's #486-#488) shares only the generated `docs/cli.md` with this branch and merges clean with it. - **Conflicting with main alone, and this branch adds no hunk:** - #402: `shape-doctor.py` 5; - #496: `shape-doctor.py` 10 and `tests/test_shape_doctor.py` 1. **Conflicts this branch adds:** - **#435** (3efcc7a, lane 2's `fix/adopt-plan-field-types`, for #386). - It adds 2 hunks in `adopt-project.py`: 5 here, against 3 with main alone. They are `render_plan`'s `pins:` line and `Plan.pins`. - Keep this branch's `_pin_lines` and `_pin_products`. The rest is under "Where the meaning meets". - **#504** (37ef29a, `fix/adopt-root-kept-symlinks`). - It adds 1 hunk in `adopt-project.py`: 2 here, against 1 with main alone. It is the materializer call in `_commit_the_split`. - Keep both arguments and both comments: `append=append, neutral_pins=_recorded_pins(plan), spell=_spelled`. - **#506** (119d8c4, `fix/scaffold-reuse-seeded-legs`). - It adds 1 hunk in `scaffold-project.py`. With main alone, #506 conflicts only in `docs/handbook.html`. - #506 inserts `LEG_TEMPLATES` right after `declared_pin_products`, which this branch moved out, and rewrites `_reusable_remotes` further down. Keeping both sides breaks the file with an unterminated string literal. - Keep only #506's `LEG_TEMPLATES` block. Drop #506's `declared_pin_values`/`declared_pin_products`, which moved here, and this branch's three-line `_reusable_remotes` opener, which #506 rewrites below. Resolved that way, pyflakes is clean and #506's scaffold tests pass (88). - **`fix/adopt-plan-quote-yaml-keywords`** (ed9968f; a branch with no pull request). - It adds 2 hunks in `adopt-project.py`: 3 here, against 1 with main alone. - One is `render_plan`'s `pins:` line. Keep `_pin_lines`, which already sends product, repository and `digest_source` through `y`. - The other is `_refuse_unholdable_values`' signature. Keep `pins: dict`, with that branch's `_validator_judged` and `_named_as_read` above it. - `fix/adopt-late-failure-notice` is no longer on origin. #445, the late-failure notice, is on main and merged here. **Where the meaning meets:** - **#435 and #386.** The coordinator has said this on #435: #435 (comment) - #435's `_plan_key_findings` (`plan-bad-pins`) keeps only text items in `pins:`, and its `PINS_REMEDIATION` tells a person to write `pins: [openGlass]`. - This branch writes each pin as a mapping, and it makes a name alone `plan-pin-unrecorded`. - Read from #435's code, not run: on a tree with both, the plan `plan --pin` writes is `plan-bad-pins` in `check`. - Whichever lands second reconciles them, with three changes: - `_plan_key_findings` takes this branch's mappings, or leaves `pins:` items to `_read_pins`; - a `pins:` that is not a list gives one finding, not both `plan-bad-pins` and `plan-pin-malformed`; - `PINS_REMEDIATION` says the mapping `plan` writes. - Until that is done, `tests/test_adopt_pins.py::test_a_plan_with_a_whole_pin_checks_ok` fails. - **#314.** It landed, and it is merged here (above). - **`fix/adopt-plan-quote-yaml-keywords`.** Its pin tests are written against the name-only `--pin`. They need the `name@commit` form, and their expected `pins: [...]` line becomes `_pin_lines`'s mapping. - **Two unwritable values are refused in two runs (lane 5's second review, n3).** `plan --elected-by 'A<LF>B' --pin openGlass@<sha> --pin-source <a path holding an ESC>` refuses the elector alone, exit 2. Re-run with the elector retyped, it refuses the source; #270's refusal names every unwritable value at once. Reproduced on 421e4e5, with `gh` called 0 times. One refusal would need a code change, not made here: - `_refuse_an_unrecordable_pin_source` would split into a function that returns the sentence; - `_checked_plan_inputs` would ask it before #270's `unwritable_values` raise, and raise one `adopt-unwritable-value` that names both, with both remediations; - a test would add the two-value row. N2's question is `one_printable_line`, not `unwritable_reason`, so it cannot simply join #270's list. - **Docs.** The README, AGENTS.md and `docs/handbook.html` are unchanged, because none of them calls adopt's `--pin` a name. A sentence saying adopt now takes the scaffold's `--pin` is a follow-up. It costs an AGENTS.md line-cap raise, and a README edit forces the handbook's README blob to change. - **A product spelled `null`, `true` or `false`.** The scaffold already accepts `--pin null@<sha>`: it exits 0 and builds a root whose `validate-pins.py` exits 1 `neutral-pin-entry-malformed`. Adopt's `plan` writes `product: null` through `y`, and `check` then finds `plan-pin-malformed` and refuses it before any leg exists. The one fix for both tools is in `parse_pin`, and it would change the scaffold's behaviour. - **Wording shared with the scaffold.** `digest_source` is written bare into the pin file, so a `--pin-source` path holding ` #` is cut short there. `templates/assembly-root/contracts/neutral-product-pin.yaml` and `validate-pins.py`'s `neutral-pin-missing` remediation name only the scaffold as the writer. Two comments in `scripts/repo_shape.py` still name the scaffold's `pin_digest_from_gh`, in a digest-pinned shipped copy. - **Filed as follow-ups:** - #449: S3, a hand-edited `commit:` or `tree_sha256:` that disagrees, with options (a) and (b); - #450: the scaffold half of N2, a `--pin-source` path no file can hold; - #451: #339's third decision (N5), a `--pin-source` that nothing reads. - **`validate-pins.py` prints a `--pin-source` path raw** in `neutral-pin-source-unreadable`, the twin of S1. It is a shipped template that #409 and other open PRs edit, so it is left for its own change. No issue is filed for it yet. - **Windows and macOS** were not run here; CI ran both (below). Two assertions that depend on what Windows answers for a path (a name past the filesystem's limit, a path beneath a file) check only the refusal and its remediation there. Fix round 1's rows that need a control character or a byte that is not UTF-8 in a path, or a symlink to `git`, are skipped on Windows by a mark, and so is fix round 2's ESC row. The rows for a no-break space and a zero-width joiner run everywhere, and so does the in-process `gh-not-found` test. Reviewed independently by lane 5 at 7a94b6b (3 should-fix, 5 nits: fix round 1) and at 421e4e5 (0 blockers, 2 should-fix, 3 nits: fix round 2). After #409's squash, the re-verification of f9ed46f and 73d65c6 found the code correct; its 1 should-fix and 3 nits were in this description and are fixed. GitHub's update-branch then merged main twice (33bae3f, 2170526), with no hand edit. CI's tests, tests-macos and tests-windows and SonarCloud all passed at 2170526 (main cac6bb2 merged in). On that head merged with main 57c85e9 (#490, #474 and #468, none of which touches this branch's files), the pin and adopt set with `tests/test_update_shape_landing.py` gave 1112 passed, 2 skipped, and the doctor, adopt end-to-end, unfinished-merge and bootstrap set gave 1056 passed, 3 skipped (the doctor's PowerShell line, which exists only on a Windows host). Closes #273 Closes #339 Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
added a commit
that referenced
this pull request
Oct 15, 2026
…USED` and any other non-zero exit is a crash, so a gate killed by a signal, ended by `os._exit(1)`, holding conflict markers or failing argparse no longer "reports a finding", a crash of the standard's own naming script is CANNOT ANSWER instead of `INVALID (naming)`, and a pass that printed `WARNING` or ` note ` lines is a `note` quoting them while a red row quotes its finding and never a warning (#410, #448) (#557) One rule for every child the doctor reads, from the v1.1.0 triage of #410 that Brett Heap approved at 14:31:28Z on 2026-10-14: a verdict is a printed `FINDING` or `REFUSED`, anything else non-zero is a crash, and a WARNING or note line on a pass is a `note`. `crashed()` no longer asks for a `Traceback (most recent call last):` line. Every finding and refusal the shipped validators and the naming script choose to report is a line starting `FINDING` or `REFUSED`, printed before the exit 1 or 2 that goes with it, so a non-zero exit with neither line is a child that stopped before it said anything. That brings in #447: a negative exit (SIGKILL -9, SIGTERM -15), `os._exit(1)` with nothing printed, a `SyntaxError` from merge-conflict markers (no traceback header), `can't open file` and an argparse `usage:` error, each of which read "reports a finding" or "refuses". The quoted line is the output's last, or, with no output, words saying so that name the signal. A FINDING printed before the child died still stands, as #357 ruled. Both `naming` rows now ask `crashed()` (#410). The naming script is always this checkout's, so a crash carries `detail.crashed` and `detail.environment`, like a crashed template validator: an assembly root is CANNOT ANSWER, exit 3, and a directory that is not a root stays NOT A SHAPE ROOT, exit 2, because `verdict_for` decides that first. The text report prints its `shape-doctor-cannot-answer` refusal only under a CANNOT ANSWER verdict, so none appears under NOT A SHAPE ROOT. `check_naming` keeps `--quiet`: the `manifest` row now carries the same chain WARNING. On exit 0, `validator_row` reads ` skip `, `WARNING ` and ` note ` blocks with one reader (`reported`), each into its own `detail` key (`skipped`, `warnings`, `notes`), quoted in the reason in the order printed. So validate-manifest.py's `WARNING naming-referent-chain` (#448) and validate-pins.py's ` note neutral-pin-source-collides` (#460's pins-note line, comment 6136245436) reach the report as a `note` that moves no verdict. `REPORT_ITEM` learns ` note ` and is the reader's one definition of an item, so a note after a skip is no longer read as that skip's text. A red row's quoted line is the first FINDING or REFUSED, else the first WARNING, else the last line, so a manifest row no longer quotes an earlier leg's WARNING as its reason (#448's decision 4). `with_gitlink_repairs` and `with_merged_away_rows` read the whole output and skip a crashed row, so the wider crash rule only keeps them off rows that printed no finding. Measured on 5ed3e5d: the stock naming script still raises `UnicodeEncodeError` printing a name that is not UTF-8 under the doctor's `PYTHONIOENCODING=utf-8`, so #410's case (1) is still there. The doctor's row now calls it a crash of this checkout's script; the script itself is unchanged, by the brief's ruling. Tests: tests/test_doctor_validator_verdicts.py, new, on #357's harness. tests/test_pin_source_env_collisions.py's colliding-pair test expected the `pins` row to be `ok` over that note; it now expects a `note`. Closes #410 Closes #448 Closes #447 Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Lane: openreposhape-4 (openRepoShape-4)
Claim: #278 (comment)
Claim: #297 (comment)
Claim: #298 (comment)
Doctor PR B of the lane's doctor cluster (#276, #277, #278, #297, #298). It changes
run_validator's env block,validator_row,unloaded_manifest_rowand the onecheck_machinecall, and adds helpers besidevalidator_scriptsandrun_validator. It does not touchcheck_legs,members_verdict,check_shape_currency,check_manifest_kinds,validator_commandorvalidator_for's arity. No--help, README, AGENTS.md ordocs/cli.mdchange.What and why
#278: a validator that crashed was read as one that reported a finding
validator_rowjudged a validator by its exit code alone, and an exception that reaches the top of a Python program exits 1, the code for findings. Two cases were affected:validate-pins.pyreduced toraise RuntimeError("boom")read "reports a finding (exit 1)";:gave the template copy aPYTHONPATHthat Python split in two, so the template died onimport repo_shapeand a valid manifest readINVALID (manifest).Now:
crashed()tells a crash apart: a non-zero exit, no line startingFINDINGorREFUSED, and aTraceback (most recent call last):line.detail.crashed, and names a missingscripts/repo_shape.pywhen that is the cause.detail.environment, so the verdict isCANNOT ANSWER, exit 3.pythonpath_unnamable()says when the template'sscripts/holdsos.pathsep:validator_rowthen runs nothing and gives an environment row with no NEXT;unloaded_manifest_rowkeeps its FINDING, with no NEXT;PYTHONPATH=value that holds a separator is printed anywhere.#297:
pinssaidok ... passesafter the validator skipped a digest, and the child calledghA project that pins a neutral product, with no local checkout of it, has a
validate-pins.pythat asksgh api. When that fails it prints askipline and exits 0. The doctor threw the output away and said "passes", underCOMPLIANT, and the child had started a call to GitHub on the operator's login wherever there was one.Now:
offline():GH_TOKEN,GITHUB_TOKEN,GH_ENTERPRISE_TOKENandGITHUB_ENTERPRISE_TOKENare removed;GH_CONFIG_DIRis set to the null device andGH_NO_UPDATE_NOTIFIERto1;HTTPS_PROXY,https_proxy,HTTP_PROXYandhttp_proxyare set tohttp://127.0.0.1:9, withNO_PROXYandno_proxyremoved;check_machinealone opts out, withrun_validator(..., reach_network=True).skiplines is anote: "passes, but did not recheck: ", withdetail.skippedand no NEXT. A note moves no verdict.#298: the unloaded-manifest NEXT promised a refusal its gate cannot print without
repo_shape.pyunloaded_manifest_rowruns no gate. It promised the gate "refuses it the same way until it loads" even for a root that had also lostscripts/repo_shape.py, where the gate dies on the import.Now:
imports_repo_shape(), besidevalidator_scripts, decides that fact once.repo_shape, the NEXT isgit -C <root> checkout HEAD -- scripts/repo_shape.py. Its why names the gate to run next.The rulings, as implemented
FINDING/REFUSEDline, and a traceback header.detail.crashed. The template's crash also carriesdetail.environment(CANNOT ANSWER, exit 3).validator_row: an environment row. Nothing is run, there is no NEXT and noPYTHONPATH=line.unloaded_manifest_row: the FINDING stands, with no NEXT, and the reason says what (i) says. The own-validator branch of (ii) is the row's ordinary own-copy path. In the separator case the root has no own copy, by construction, becausevalidator_fornames the own copy whenever it exists. So (ii) always has no NEXT.git clone <standard> <dest>fallback was not needed.os.pathsep, so a;directory is refused on Windows and is not refused on POSIX.check_machineopts out by keyword.notewithdetail.skippedand no NEXT.imports_repo_shape(shape, used, own_copy)sits besidevalidator_scripts.validator_forstill returns three values.Tests
New file
tests/test_doctor_validator_rows.py, with 20 tests at 2bf402d and 26 after the fix round below. They import the fixtures and helpers fromtests/test_shape_doctor.pyand assert on what each row and command does, never on a NEXT's tail.validator_rowreads a validator's exit 1 as "reports a finding" whatever caused it, so a validator that CRASHED (a:in the standard's path splits thePYTHONPATHthe template fallback runs under, andvalidate-manifest.pydies onimport repo_shape) is a FINDING row quotingModuleNotFoundError, and a root whose manifest is valid goes fromCOMPLIANT, SHAPE BEHINDtoINVALID (manifest)#278manifest,pinsandfamily, and a crashing template. Each row says it crashed and carriesdetail.crashed. The template's run is CANNOT ANSWER, exit 3.dir:with-colongives the environment row, with nothing run and no NEXT. With an unloadable manifest it gives a FINDING with no NEXT, exit 1. Neither report containsPYTHONPATH=. (WINDOWS_SKIP)semi;colonis refused on Windows. On POSIX it is the control: the template's real finding, whose pasted NEXT prints it.pinsrow says "ok ... the project's own scripts/validate-pins.py passes" for a project that pins a neutral product though that validator SKIPPED the product's digest after a realgh apicall, so the command documented to fetch nothing fetched from GitHub, and a digest nobody rechecked reads asokunder aCOMPLIANTverdict #297ghstub first on PATH.COMPLIANT, and thepinsrow is anotethat names openGlass.GH_CONFIG_DIRset to the null device, and the proxy set.WINDOWS_SKIP: the stub is a shebang script.)run_validatorenv probe runs both ways (default andreach_network=True) on every platform.project.yamldoes not load AND whosescripts/repo_shape.pyis gone, themanifestrow's NEXT promises its validator "refuses it the same way until it loads", but pasted it dies onModuleNotFoundError: No module named 'repo_shape', exit 1, so the person is sent to a command that cannot say what the row quoted #298, for a project and for a holder whose manifest has a tab and whosescripts/repo_shape.pyis gone:REFUSED yaml-unparsableand exits 2;project.yamldoes not load AND whosescripts/repo_shape.pyis gone, themanifestrow's NEXT promises its validator "refuses it the same way until it loads", but pasted it dies onModuleNotFoundError: No module named 'repo_shape', exit 1, so the person is sent to a command that cannot say what the row quoted #298, a committed deletion gets no NEXT. This test covers the project only, not the holder.#311's and #238's tests in
tests/test_shape_doctor.pyare unchanged and pass.Mutants
Each mutant was run against the new file at 2bf402d, where the unmutated file passed 20 of 20. The fix round's mutants are in its own section.
noterowWiring with PR A (#276), for whichever of A and B lands second
PR A builds the
legsandmembersrows' lockstep line withvalidator_commandand no separator guard, so on a standard under a:directory those two rows would still print aPYTHONPATH=line that splits when pasted. The wiring is TWO call sites, not one: thelegsrow (check_legs) and themembersrow (members_verdict). At A's c30bfb2 each had its ownvalidator_commandcall; A's fix round (4497def) moved the call into one shared helper,lockstep_next, which both rows call. Either way the guard has to reach both rows: askpythonpath_unnamable(ctx.shape, own_copy)before the line is built, and put its sentence in the row's reason or why instead of the line when it is not None.Known, for PR C
report's CANNOT ANSWER stderr block prints itsRemediation:line only when the row has a NEXT (fix round, S1). PR C rewrites that block for itsWHYline (R277-1) and should keep that guard.Fix round on the review of 2bf402d
Review: MERGEABLE WITH NITS, three SHOULDs. One commit on top of 2bf402d, no rewrite.
reportprintedRemediation: Noneafter its reason. It now prints theRemediation:line only when the row has a NEXT. Test: that row prints noRemediationat all; the template-crash row, which has a NEXT, still prints it.skipped()kept only theskipline, andvalidate-pins.py's skip embedsgh's stderr verbatim, which runs to two lines whenghis not logged in. The reason ended atgh auth login, losing the--pin-source,SHAPE_PIN_SOURCE_<PRODUCT>and../<product>ways to give a source.skipped()now keeps the whole block: theskipline and every line after it, up to the next item (ok,skip,--,FINDING,REFUSED,WARNING, or the validator's summary) or the end. Tests: the descendant run with a logging stub that printsgh's two-line "not logged in" text, andskippedon a constructed output on every platform.FINDINGline and then raises is a FINDING, notcrashedand not CANNOT ANSWER. Now tested, for the root's own copy and for the template.scripts/repo_shape.py, which it imports from beside itself, is not there" sentence of a crash reason is now tested, for a project and a holder.project.yamldoes not load AND whosescripts/repo_shape.pyis gone, themanifestrow's NEXT promises its validator "refuses it the same way until it loads", but pasted it dies onModuleNotFoundError: No module named 'repo_shape', exit 1, so the person is sent to a command that cannot say what the row quoted #298 claim for a committed deletion said holder too; the test covers the project only, and the body now says so. The A wiring is two call sites (above).New mutants, against the new file at the fix round's head:
crashed()'s no-FINDING/REFUSED-line clause deleted (S3)repo_shape.pycrash test (project and holder)Remediation:printed unconditionally again (S1)Remediation:never printedFollow-ups, not in this PR
Traceback (most recent call last)::os._exit(1)gives(exit 1)with nothing quoted, a SIGKILL gives(exit -9). A negative exit code (killed by a signal) is never a verdict and could joincrashed().WARNINGlines on exit 0 are still dropped. validate-manifest'sWARNING naming-referent-chainis "a note about what could not be CHECKED here", the same class as the skip, and the row still says "passes". No issue covers it.discard, Windows "Simple TCP/IP Services") a proxied request is accepted and never answered, and neither the validator'sghcall norrun_validatorhas a timeout. It needsghto find a token past the config strip (a keyring) AND such a listener. Port 0, or a closed high port, fails immediately everywhere.Closes #278
Closes #297
Closes #298
🤖 Generated with Claude Code
Summary by Sourcery
Make shape-doctor validator results accurately distinguish crashes, skipped checks, and unusable environments while providing safe and actionable remediation.
Bug Fixes:
Enhancements:
Tests: