Repository navigation
adopt-project.py and scaffold-project.py: a --pin naming an annotated tag's own id pins the commit the tag names, and one naming a tree or a blob is refused, so a pin file no longer records a tag's id under "A COMMIT, NEVER A TAG" (#651) - #725
Merged
Merged
Conversation
…ed tag's own id pins the commit the tag names, and one naming a tree or a blob is refused, so a pin file no longer records a tag's id under "A COMMIT, NEVER A TAG" (#651) `declared_pin_values` (scripts/shape_materialize.py), which both tools read a `--pin` through, now asks what the id names before it reads the digest: `git cat-file -t` in the `--pin-source` clone, or, with none, the forge's GraphQL `object(oid:)`. An annotated tag's own id, or a tag of a tag, is peeled to the commit it names, as `bump-leg.py --to` (#534) and `family.py add --at` and `bump --to` (#541) peel one, and one line says so; a tree, a blob or a tag of either is refused `pin-not-a-commit`. `check` asks the clone `plan` read a digest from the same question, so a recorded id that is no commit is `plan-pin-not-a-commit`, and `execute` refuses it before any leg. Riders from #457: `_pin_files` names each pin file once (L1-06); a kept shape pin is one finding, not also `plan-root-blocks-shape-copy` for its copy (L1-07); `_a_partial_clone` uses `GIT_CONFIG` (L1-05); and a test docstring no longer says `place` finds a case twin on every disk (L1-63). Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ons.py and test_pin_source_env_collisions.py: each control that reaches `gh` after a refusal asserts its one call is the read-only GraphQL query #651 asks first, so the leg-path control no longer expects the tree read first (#651) The targeted runs at e731b66, in both modes, failed one test each, the same: `test_no_gh_command_runs_before_the_refusal` in tests/test_scaffold_leg_path_collisions.py, whose control asserted that the first stub-`gh` call starts `api repos/opensoft/openGlass`. Since #651 the first call is the forge's GraphQL `object(oid:)` question. Its refused run is unchanged: no `gh` at all before the refusal. Its control now asserts the stub's whole log is that one read-only query, which the stub refuses, so no other `gh` command runs. The two controls e731b66 changed (test_scaffold_pin_collisions.py, test_pin_source_env_collisions.py) assert the same, exactly, through `asked_what` (tests/test_adopt_pins.py), where they matched only the end of the first call. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe PR makes pin IDs resolve to immutable commits before digesting: annotated tag IDs are peeled through tag chains, non-commit objects are rejected, and legacy plans are diagnosed during check. It also deduplicates related pin-file collision findings and expands local/forge and scaffold/adoption test coverage. Sequence diagram for pin ID resolution and digestingsequenceDiagram
participant User
participant Tool as adopt-project_or_scaffold
participant Pins as declared_pin_values
participant Source as LocalClone_or_Forge
participant Digest as DigestReader
User->>Tool: --pin product@object_id
Tool->>Pins: _pinned_commit(args, raw, repository, typed)
Pins->>Source: Identify object kind
alt annotated tag
Source-->>Pins: Tag target commit
Pins-->>User: Print peeled commit message
else commit
Source-->>Pins: Commit ID
else tree, blob, or tag of non-commit
Source-->>Pins: Non-commit object
Pins-->>Tool: Refusal pin-not-a-commit
end
Pins->>Digest: Read digest for resolved commit
Digest-->>Tool: Digest and recorded commit
Sequence diagram for legacy plan validationsequenceDiagram
participant User
participant Check as adopt-project_check
participant Finding as _recomputed_pin_finding
participant Clone as RecordedClone
participant Execute as execute
User->>Check: check plan
Check->>Finding: Validate recorded commit ID
Finding->>Clone: commit_in_clone(commit)
alt annotated tag
Clone-->>Finding: Tag naming commit
Finding-->>Check: plan-pin-not-a-commit finding
else tree, blob, or tag of non-commit
Clone-->>Finding: Non-commit object
Finding-->>Check: plan-pin-not-a-commit finding
else commit
Clone-->>Finding: Commit ID
Finding->>Clone: Recompute pin digest
Clone-->>Finding: Digest
Finding-->>Check: Digest result
end
Check-->>Execute: Refuse execution when finding remains
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
brettheap
marked this pull request as ready for review
October 16, 2026 17:39
|
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 4 hours and 39 minutes by commenting |
|
This was referenced Oct 16, 2026
brettheap
pushed a commit
that referenced
this pull request
Oct 17, 2026
main gained 25 pull requests since de92614: #634, #699, #671, #719, #701, #717, #700, #702, #722, #720, #725, #721, #728, #705, #727, #718, #744, #743, #749, #740, #737, #734, #742, #751 and #736. No conflict: AGENTS.md, adopt-project.py and docs/cli.md merged as text, and README.md and docs/handbook.html are unchanged by the merge. README.md is 1473 lines, its cap; AGENTS.md 494, its cap; every handbook marker is current; `render-cli-reference.py --check` is ok. Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap
pushed a commit
that referenced
this pull request
Oct 17, 2026
…es every reason THIS checkout cannot answer, and the notes are current to main bf1f099 with the 25 pull requests since de92614 (#563, #683) - W683 and RV-f's N4 on #742: README's exit-3 list (Keeping a project's shape current, :1208-1220) and its handbook twin (`doctor`) named only a pin whose commit this checkout does not carry. They now say, as shape-doctor.py's EXIT CODES does: a pin's commit it lacks, a partial clone missing what is compared (#683), a read that fails (`update-upstream-unreadable`), a crashed validator of its own (#278, #410), or its own naming policy not loading (#678). +1 line, with tests/readme-cap.d/683.txt; README.md is 1474, its cap (1422 + 2 + 5 + 12 + 22 + 10 + 1). The two `Keeping a project's shape current` markers move: `doctor` text and marker, `current` marker only. - The notes, "What changed since v1.0.1", one entry per pull request from `git log --first-parent de92614..bf1f099`, each from its squash commit and the issues GitHub says it closes: - adopt-project.py: #699, #719, #749, #727, #717, #728 (with #621's hint), #743 + #720 + #718, #722, #721; - update-shape.py, bump-leg.py and a project's own scripts: #702 (with the pinned validators), #634; - scaffold, setup, family and the shared readers: #725, #671, #744; - shape-doctor.py: #742, #701, #737, #751, #736, #734, #700 + #705, #740; - install, CI and the docs: the exit-3 sentence above. - Counts (99 pull requests since bfed143; 109 of 135 milestone issues closed at 10:28Z), the "current to main" sha and the open list (26) are at main bf1f099, still placeholders for tag time. Left for round B: lane 5's eight lines (#630 issuecomment-6227129879), whose pull requests #726, #747, #682, #724, #746, #745 and #738 are open drafts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 17, 2026
brettheap
added a commit
that referenced
this pull request
Oct 17, 2026
…efusals and `family-operation-in-progress` name a path as `shown_source` names it, so an ESC or a line break in a path no longer reaches the terminal (#692) (#731) #622's folder refusals printed a path as it was. `family.py init --into <a file named wd-ESC[31mRED> --dry-run` gave `REFUSED family-folder-cannot-be-made: the family folder .../wd-^[[31mRED/Orbit cannot be made: ...` through `cat -v`. A name with a line break and then `WARNING forged-line: pwned` printed that line as a line of its own. R612's `family-operation-in-progress` printed the mark's path across two lines for a holder whose path holds a newline. Each path is now spelled as `shape_materialize.shown_source` spells a `--pin-source`: as it is, and as Python's `repr` spells it where a character in it is not printable. - `scripts/shape_materialize.py`: both answers of `folder_cannot_be_made` (a file or a bad stat in the way, and a folder this user cannot write in), the folder in `refuse_unmakeable_folder`, and the folder in `make_folder`. - `scaffold-project.py`: `scaffold-target-exists`. - `scripts/family.py`: `family-target-exists`, and the mark's path in `family-operation-in-progress` (`where.as_posix()`). A printable path is named byte for byte, so no existing row changes and `why.endswith(CANNOT_WRITE_IN)` in `refuse_unmakeable_folder` still holds. No help text changed, so `docs/cli.md` is untouched. No README, handbook or template sentence says how a refusal names a path (`git grep` of `shown_source`, `target-exists` and `folder-cannot-be-made` in AGENTS.md, README.md, `docs/handbook.html` and the templates found none), so no doc changes. - **`shown_source`, not `shown_path`.** Since #634, `shape_materialize.shown_source` returns `repo_shape.shown_path(source)` (`scripts/shape_materialize.py`: `return shown_path(source)`), so the seven call sites this change adds (four in `shape_materialize.py`, one in `scaffold-project.py` and two in `family.py`) spell a path as `shown_path` does. Renaming them to `shown_path` stays out of this PR: it would only move imports in `scaffold-project.py` and `family.py` and reword docstrings in `family.py`, `shape_materialize.py` and the test file, and the review's N1 left it optional. I did not take it. The predicted merge with main works with the alias: `family.py --help` and `scaffold-project.py --help` exit 0 on it, and `shown_source` and `shown_path` return the same string for an ESC name, a line-break name and a plain path. - **`shown_source` is imported by name into each file's existing `from shape_materialize import (...)` block.** The first commit put it on a line of its own after the block; lane 4's #660, #688 and #693 add an import at that same place, and `merge-tree` reported add/add conflicts in `scripts/family.py` and `scaffold-project.py`. The second commit moves the name into the block, and those conflicts are gone. - **"The holder in the other refusals of the same block" is one refusal.** The `# What the holder is in the middle of, and what its sparse checkout leaves out` block holds `family-operation-in-progress`, `family-sparse-excluded` and `member-path-unaddable`. Only the first prints a path of the holder's. `family-sparse-excluded` names `members/<Project>` and `.gitmodules`, and `member-path-unaddable` names `members/<Project>`. - **No scaffold row for `--local-remote-dir`.** A control character there is refused earlier as `scaffold-unwritable-value`, which already names the path with `repr`. The unit test covers `make_folder`, which only a race reaches by the command line. `tests/test_dry_run_parity.py`: - `SCAFFOLD_CASES` gains five rows: ESC and line break in the `--work-dir` name, ESC in a folder name above it, and ESC and line break in a work dir that holds a file named `Atlas` (`scaffold-target-exists`). - `FAMILY_CASES` gains five rows: ESC and line break in `--work-dir`, ESC in `--into` (`the family folder`), and ESC and line break in a work dir that holds a file named `Orbit` (`family-target-exists`). - Two rows join `UNWRITABLE_FOLDER_AT` (ESC in the scaffold's and in `init`'s `--work-dir`, a folder this user cannot write in). - Rows named `ESC-...` and `line-break-...` are skipped on Windows, whose file names cannot hold them (`POSIX_NAMES`, `case_params`). Every expectation spells the path with `repr`, and not with `shown_source`. - `assert_refused` now fails any stderr line that starts with `WARNING forged-line`. - Three unit tests: `test_each_folder_question_spells_a_name_that_is_not_printable` (ESC, line break; `folder_cannot_be_made`, `refuse_unmakeable_folder` and `make_folder` by themselves), `test_a_folder_this_user_cannot_write_in_is_spelled_safe_to_show`, and `test_a_printable_name_is_named_byte_for_byte` (a name with a space and an accented letter stays unquoted). `tests/test_family_refuse_up_front.py`: `test_a_holder_path_with_a_newline_still_shows_its_merge` asserted the raw newline in the refusal (`"Ink\nRouter/.git/worktrees/" in ran.stderr`). It is now `test_a_holder_path_with_a_control_character_still_shows_its_merge`, over a line break, an ESC and a forged line, and asserts the one-line `repr` form (`refusal()` fails unless the stderr is two lines). It is the one existing test this change had to edit. Results at head `ab55c29f` (Python 3.12.3, Linux): - `tests/test_dry_run_parity.py tests/test_dry_run_asks_remotes.py tests/test_family_dry_run.py tests/test_family_init_landing.py tests/test_repo_hygiene.py tests/test_pin_source_unreadable.py tests/test_scaffold_leg_path_collisions.py tests/test_scaffold_reuse_seeded_legs.py`: **494 passed**. - `tests/test_family.py tests/test_family_refuse_up_front.py tests/test_family_init_values.py tests/test_family_add_refusals.py`: **356 passed, 19 skipped** (the skips are `test_family_init_values.py:219` and `:291`, template-quoting premises). - Not run: the full suite (the coordinator's gate), and macOS and Windows (CI is Linux-only since #597). The new hostile-name rows are POSIX only by design. On the base code: the review overlaid this head's two test files on main `2fac9790` and ran `tests/test_dry_run_parity.py` and `tests/test_family_refuse_up_front.py` with `-k "dry_run_parity or control_character"`. The result is **20 failed, 87 passed** (76 deselected, 43.5 s). The 20 are exactly the new and edited tests: the 5 scaffold and 5 `init` rows, the 4 unwritable-folder rows, the 3 unit tests (`test_each_folder_question_spells_a_name_that_is_not_printable` in two cases, and `test_a_folder_this_user_cannot_write_in_is_spelled_safe_to_show`), and the 3 cases of the edited `test_a_holder_path_with_a_control_character_still_shows_its_merge`. The one new test that passes on main's code is `test_a_printable_name_is_named_byte_for_byte`, by design: a printable name is named byte for byte on both. An earlier draft of this body said 21 failed, 2 passed. That run was on `8062810d` with a wider selection, and it held a scaffold row for ESC in the local remote dir's name (`ESC-in-the-local-remote-dir-name`) that this head's tests no longer have; its second pass was the existing `test_the_refusal_quotes_gh_s_first_line_and_escapes_what_is_unprintable`, which also passes in the new run, one of the 87. `family.py init` and `scaffold-project.py --dry-run` against a file named `wd-ESC[31mRED`, a file named `wd-\nWARNING forged-line: pwned`, and a work dir with a file `Atlas` or `Orbit` in it, run with a stub `gh` and no real `gh`: - On main, through `cat -v`: `... the family folder /.../wd-^[[31mRED/Orbit cannot be made: /.../wd-^[[31mRED is a file, not a folder`, and a stderr line `WARNING forged-line: pwned cannot be made: ...` of its own. - On this head: `REFUSED family-folder-cannot-be-made: the family folder '.../wd-\x1b[31mRED/Orbit' cannot be made: '.../wd-\x1b[31mRED' is a file, not a folder`, and one line for the forged name: `--work-dir '.../wd-\nWARNING forged-line: pwned' cannot be made: '...' is a file, not a folder`. `scaffold-target-exists` and `family-target-exists` are one line each in the same form. Each spelled site reverted alone in a throwaway clone at `19d126cd` (the call sites are the same at `ab55c29f`); the new tests that fail for each: - `folder_cannot_be_made`, the `_not_a_folder` answer: 8 failed (six CLI rows and the two unit tests). - `folder_cannot_be_made`, the `CANNOT_WRITE_IN` answer: 5 failed (the four unwritable rows and the unit test). - `refuse_unmakeable_folder`: 12 failed. - `make_folder`: 2 failed (the unit test only). - `scaffold-target-exists`: 2 failed (its two rows). - `family-target-exists`: 2 failed (its two rows). - `family-operation-in-progress`: 3 failed (line break, ESC, forged line). `git merge-tree --write-tree` of this head `ab55c29f` against origin/main `20c8873b` and against every ref on origin that could meet it, fetched 2026-10-16: the 41 branches (`fix/*`, `l3-*`, `wip/*`, `docs/*` and `release/v1.0`) and the 55 PR heads from #630 up. That is 96 refs. (The same list was run for #730's head `7f2bb36b`.) - **origin/main `20c8873b`: clean** (the predicted tree `00b5b24c`, which differs from main in these five files only: 216 lines added, 25 removed). - **#630's head `6fd33a93`: clean.** It conflicted with main in `docs/handbook.html` when this body was first drafted, and no longer does, with or without this change. This change touches no README or handbook. - **The refs that edit one of this change's five files**, and so could meet it, all merge clean with this head: `fix/646`, `fix/651`, `fix/654`, `fix/660`, `fix/661`, `fix/684`, `fix/686`, `fix/688`, `fix/689` and `fix/693`, the heads of #670, #725, #728, #743 and #744, and the heads of the landed #634, #638, #639, #640, #643 and #671. #634 has landed (`30676c90`), so the `fix/660` note about a conflict with it is gone. - **Four refs conflict with origin/main on their own**, and so with this head: `docs/release-notes-v1.0.0` and `release/v1.0`, and the pre-squash heads of the landed #637 and #641. Their conflicts do not come from this change. Every other ref, 92 of the 96 in all, is clean with this head, including the refs that conflict with main in `templates/family-root/scripts/validate-family.py` (#682, #745, #747, `fix/648`, `fix/681`, `fix/704`) or in `shape-doctor.py` (#742, `l3-683`) on their own. So do the old heads of the landed #638 and #639, and lane 3's `l3-677-pins-hand-step-wip` branch, and each of them merges clean with this head too. - **Tests on the predicted merge**, run by the review on the merge with main `2fac9790`: `test_dry_run_parity`, `test_family_refuse_up_front`, `test_pinned_copy_text`, `test_pin_source_unreadable`, `test_dry_run_asks_remotes`, `test_family_dry_run` and `test_family_init_landing`: 445 passed in 215 s. `test_family`, `test_family_init_values`, `test_family_add_refusals`, `test_derived_id_refusals`, `test_repo_hygiene`, `test_naming_policy`, `test_scaffold_leg_path_collisions` and `test_scaffold_reuse_seeded_legs`: 758 passed, 19 skipped in 243 s. I did not re-run them on `20c8873b`; the merge is clean, and the two commits since `2fac9790` (#700 and #702) change only `shape-doctor.py`, `templates/assembly-root/scripts/validate-pins.py` and four test files, none of them a file of this change. - Before the second commit, `fix/660`, `fix/688` and `fix/693` each conflicted with this head in the import region of `scripts/family.py` or `scaffold-project.py` (a separate import line each side added at the same place). That is why the import joins the existing block. #634 is on main, and this change does not edit `shown_source` or its docstring in `scripts/shape_materialize.py`. The review approved with nits. Its S1, the stale base-run numbers and merge lines, is taken here, in this body: no code changed, and the head is still `ab55c29f`. Its N1, renaming the call sites to `shown_path`, is not taken (see "Decisions and their evidence"). It also re-ran 5 of the 7 mutation probes on `ab55c29f` and got the same failure counts as above (12, 2, 3, 2 and 2), and ran 144 hostile-name dry runs (16 names in 9 scenarios): on main 69 rows put a control character on stderr and 6 print a forged line of their own; on this head all 144 exit 2 with no traceback, no control character and no forged line. - `scripts/family.py` `init`'s plan prints `folder` and `landing` lines with the path raw (`print(f"landing {holder} ...")`, `print(f"folder {folder} ...")`). On a dry run or a refused run the plan is on stdout before the refusal, so `WARNING forged-line: pwned/Orbit (--work-dir: no family folder)` still appears there. It is the plan, not a refusal, and not one of the issue's lines. - Other refusals that name a holder or folder path raw, none of them in the issue's lines: `family-holder-detached` and `family-on-tracking-branch` (`{family.root}`), `family-index-locked` (`lock.as_posix()` in the detail), `family-landing-in-standard` (`{holder}`, `{checkout}`, `{beside / family / family}`), `family-holder-already-here` (`{into}`), and `family-remote-exists` and `scaffold-remote-exists` (`{target}`, a local remote path). 1. **family.py `init`'s plan prints the holder and folder paths raw.** `scripts/family.py` `landing` and `folder` rows (about :1756-1759) print `holder` and `folder` as they are, so a forged line or an ESC reaches stdout in a `--dry-run` and in a run refused after the plan. Direction: spell them with `shown_source`. 2. **The same raw spelling in the refusals listed above.** `family-holder-detached`, `family-on-tracking-branch`, `family-index-locked`, `family-landing-in-standard`, `family-holder-already-here`, `family-remote-exists` and `scaffold-remote-exists` each print a path the person supplied or git keeps. Direction: the spelling this change gives its sites. Review: rv692, lane 5's independent review, approved ab55c29 with nits, and its body fix (S1) is published. CI (Brett Heap's ruling 27 and his fast-refresh ruling of 2026-10-15T22:48:35Z): H0 ab55c29 passed tests, tests-git-bash and SonarCloud; the head 13f643d is a clean update-branch merge of main 431c8cf, with tests-git-bash and SonarCloud green; and the local gate passed on its predicted squash tree 4327947 over main 431c8cf: the dry_run_parity, family_refuse_up_front, repo_hygiene, agents_md_codes, cli_reference sets, 330 passed. Landed on Brett Heap's word of 2026-10-17T10:59:39Z, relayed by lane 3 on #473: "merge lane 5's approved v1.1.0 drafts". Closes #692 Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks done
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-1 (openRepoShape-1)
Claim: #651 (comment)
What
git rev-parse v1.2prints a release tag's own object id, 40 hex, and a person can pass it as--pin openGlass@<id>. Both tools read a--pinthroughdeclared_pin_values(scripts/shape_materialize.py). That function now asks what the id names before it reads the digest, in the same place it reads the digest:--pin-source,git cat-file -tin that clone;gh api graphqlandrepository.object(oid:), whose__typenamenames the same four kinds.Peeled, not refused. An annotated tag's own id, or a tag of a tag, is peeled to the commit it names, and one line on stdout says so, ahead of the plan either tool prints:
Every value after it is the commit's: the digest,
plan'spins:entry, thepinline, and the pin fileexecuteand the scaffold write. This followsbump-leg.py --to(#534),family.py add --at, andfamily.py bump --to(#541, on Brett Heap's ruling of 2026-10-14). A tag object's id fixes its content, so it names one commit for ever and, unlike a tag name, cannot be moved. That makes it as exact a pin as the commit is, so refusing it would only make the person look the commit up by hand.Refused: an id that names no commit. A tree's id, a blob's id, or an annotated tag of either is refused by both tools as
pin-not-a-commit, before any digest is read. The words arebump-leg.py's:On the forge path, the refusal says
in opensoft/openGlass on the forge. An id the forge holds no object for ispin-unreadable, with the same remediation that refusal always had:`gh api` could not read opensoft/openGlass @ <id>: the forge holds no object <id> in opensoft/openGlass.checkasks the recorded clone (#589's recheck). Where the cloneplanread a digest from is still on this machine, and is not a partial clone,checknow asks it the same question before it recomputes the digest. A recordedcommit:the clone holds as an annotated tag, a tree or a blob becomes a new finding,plan-pin-not-a-commit, andexecuterefuses it before any leg. Such a plan comes from aplanrun before this fix, or from a hand edit. For a tag, the finding names the commit the tag names:The riders in the same block (#457's lines):
_pin_filesnow names each pin file once, keyed by path. Before, two pins at one file listed it twice: a product namedShape, whose file is the shape's own pin, oropenGlasswithOpenGlass. Each is alreadyplan-pin-collides. A path the root keeps there was then named byplan-root-holds-pintwice, incheckand inexecute's refusal; now it is one line. Where the file is the shape's own pin, the line names the shape's pin, whichexecutewrites there whatever is declared.contracts/shape-pin.yamlandshape/contracts/shape-pin.yamlnow gives one finding,plan-root-holds-pin. Before, adopt-project.pycheckpasses a plan that keeps the source's ownshape/in the root, andplace()then writes the shape's collision copy onto it after both legs are pushed: a realshape/README.mdis overwritten whileexecuteprints "nothing was overwritten" and endsadopt-lost, and ashape/Makefile/directory or a file namedshapeis a traceback #262'splan-root-blocks-shape-copyalso named the copy's path. The copy is only a consequence: with the kept pin gone, the shape writes its pin at its own path and nothing undershape/. So_root_shape_findingsno longer asks about the copy of the shape's pin where_kept_pin_findingsnames the pin itself (_holds_a_pin). A submodule kept there is not one of those, and keeps its findings as before._a_partial_clonenow uses theGIT_CONFIGconstant, not the literal"config". The issue's other two nits were already true on main, so nothing changes for them here:--pin-sourcein scaffold-project.py and adopt-project.py: accepted without--pin, and committed intodigest_sourceas typed #540,check'swrite contracts/<product>-pin.yamlline printslocal-cloneand never a clone's path, so it names no relative clone;test_a_relative_clone_is_read_from_where_check_runsandtest_a_plan_with_a_whole_pin_checks_ok(tests/test_adopt_pins.py) both assert "read from this directory".test_a_path_kept_at_the_shapes_pin_is_found_and_refused_before_any_legno longer saysplacefinds the case twin on every disk. It says the twin is the same path only on a disk that ignores case, which is why the finding saysonce case is ignored.Why (repro on main a524542, and again on main de92614)
Measured on a524542, and again on main de92614 by the reviewer, with the same results; the reviewer also ran the scaffold's real run with a tag of a tag, which writes the outer tag's id the same way. Each probe ran with a stub
ghfirst on PATH,GH_TOKEN=bogus-w651, an emptyGH_CONFIG_DIR,GIT_CONFIG_GLOBAL=/dev/nullandGIT_ALLOW_PROTOCOL=file. The product was a local stand-in foropenGlasswhose commit was tagged withgit tag -a v1.2. The stub's log stayed empty: noghran.--pin openGlass@<id>, with--pin-sourceadopt-project.py planscaffold-project.py --dry-runscaffold-project.py(real)git rev-parse v1.2)commit: "<tag id>"pin … @ <tag id>commit: "<tag id>"underrevision_kind: commitand "A COMMIT, NEVER A TAG"commit:pin-source-unreadable, ingit ls-tree's wordsThe new tests reproduce every row above on the same main: through
planfor every row, through the scaffold for the tag, the tree and the blob, and on the forge path through the stub. They also show thatcheckpasses a plan recording a tag's id: the digest recomputes, becausegit ls-treepeels the tag.How
commit_in_cloneandcommit_on_forgeanswer(commit, "")or(id, why).not_a_commitwords the why, asbump-leg.pydoes._pinned_commit, called fromdeclared_pin_valuesbefore the digest is read, peels the id, prints the line, or raisespin-not-a-commit.pin_digest_from_gh's two refusals moved into_gh_not_on_pathand_gh_could_not_read, so the new GraphQL question refuses in the same words. Itssubprocess.runstays where it was, sotests/test_git_output_decoding.py's exemption still names it.errors="replace": its answer is a kind and an id, never a digest._recomputed_pin_findingaskscommit_in_clonefirst, givingplan-pin-not-a-commit._pin_filesis keyed by path (L1-06)._root_shape_findings(L1-07), andGIT_CONFIGin_a_partial_clone(L1-05).checkpasses a plan that keeps the source's ownshape/in the root, andplace()then writes the shape's collision copy onto it after both legs are pushed: a realshape/README.mdis overwritten whileexecuteprints "nothing was overwritten" and endsadopt-lost, and ashape/Makefile/directory or a file namedshapeis a traceback #262's_root_shape_findings: three lines and a docstring paragraph.COMMIT_REand the root's ownvalidate-pins.pyare unchanged too; see "Known limits".declared_pin_values, so it peels and refuses exactly asplandoes. Its dry run and its real run were both run.--helptext changed, so docs/cli.md is untouched.Tests
New, failing on main a524542 and passing here:
planwith a tag and with a tag of a tag;validate-pins.pyrecomputes;checkandexecuteon a recorded tag, tag of a tag, tree, blob and tag of a tree.Shapeand for two products at one file, and L1-07.Changed, because the first
ghcall is now the forge's GraphQL question:test_with_no_pin_source_plan_reads_the_digest_from_gh(tests/test_adopt_pins.py). Its stub now answersgh api graphqlfrom a file (GH_STUB_OBJECTS), and the test asserts that question and then the tree read.gh-before-the-refusal tests, in tests/test_scaffold_leg_path_collisions.py, tests/test_scaffold_pin_collisions.py and tests/test_pin_source_env_collisions.py.ghat all before the refusal.gh, asserted that its first call started withapi repos/opensoft/<product>, the tree read. It now asserts that the stub's whole log is one call: the read-only GraphQLqueryasking what the pin's id names (asked_what, tests/test_adopt_pins.py). The stub refuses that call, so no otherghcommand runs.Revert table. Each change was reverted alone in a scratch clone at 3723d493, then tests/test_pin_annotated_tag.py and tests/test_adopt_shape_pin_and_work_dir.py in full and the changed
test_adopt_pins.pytest were run, 42 in all, the 24 new tests among them. 3723d493's tree differs from the head's only in the three no-gh-before-the-refusal controls (tests/test_scaffold_leg_path_collisions.py, tests/test_scaffold_pin_collisions.py and tests/test_pin_source_env_collisions.py), which the table does not run. Every new test fails under at least one row.declared_pin_valuesasks nothing (_pinned_commitnot called)plan, scaffold and forge tests of tests/test_pin_annotated_tag.py, andtest_with_no_pin_source_plan_reads_the_digest_from_gh--pin-sourceclone is not askedplanwith a tag and with a tag of a tag, the scaffold's dry and real runs, and both tools' refusal of a tree, a blob and a tag of a treetest_with_no_pin_source_plan_reads_the_digest_from_ghcheckdoes not ask the recorded clonetest_check_finds_a_recorded_id_that_is_no_commit, for a tag, a tag of a tag, a tree, a blob and a tag of a tree_pin_filesis keyed by product again (L1-06)test_a_kept_file_two_pins_are_written_at_is_named_once, both casestest_the_shapes_pin_and_its_copy_kept_are_one_finding"config"again (L1-05)L1-63 is a docstring.
Targeted runs on head e731b66, dirty 0, with
/usr/bin/python3 -m pytestover 108 files:grep -l -E 'adopt-project|adopt_project|\bADOPT\b' tests/*.py, 88 with the new file);The results at e731b66. Each log names the head and dirty 0, before and after:
PATH=<stub gh>:/usr/local/bin:/usr/bin:/bin)The one failure in each mode was the same test,
tests/test_scaffold_leg_path_collisions.py::test_no_gh_command_runs_before_the_refusal. It was a fourth no-gh-before-the-refusal control whose first-call assertion I missed. It expectedapi repos/opensoft/openGlassand found the newapi graphql … -f oid=…question. No other test failed.bd5eead fixes it, a new commit with no amend, and changes nothing outside these three test files. It also makes the two controls e731b66 had changed assert the stub's whole log exactly, through the same helper.
To find any other assertion that #651 could move:
ghcalls (gh_calls(,log.read_text,calls[…],startswith("api…,api repos/,git/trees), in every file that passes--pinand logsgh. The rest assert thatghnever ran, or testvalidate-pins.py's ownghreads, which adopt-project.py and scaffold-project.py: a--pinnaming an annotated tag's object id is written as the pin'scommit:, under the pin file's "A COMMIT, NEVER A TAG" #651 does not touch.--pin.Re-runs at bd5eead, dirty 0 before and after, of 8 files:
ghfiles: tests/test_doctor_validator_rows.py, tests/test_neutral_pin_validator.py, tests/test_setup_project_py.py.The reviewer's runs on a local merge with main de92614 (merge-tree clean), of the six files above that this PR changes, tests/test_shape_doctor.py, tests/test_git_output_decoding.py and tests/test_neutral_pin_validator.py: 958 passed, 3 skipped with git-filter-repo on PATH, and 929 passed, 32 skipped with it hidden, EXIT=0 in both.
The full 108-file set was not re-run at bd5eead. Its tree differs from e731b66's only in the three test files above, and those were re-run in both modes.
Every run here had a stub
ghfirst on PATH,GH_TOKENset to a bogus value, an emptyGH_CONFIG_DIR, and noGIT_ALLOW_PROTOCOL.Windows
CI is Linux only (#597), so no Windows run applies. The new tests read files back with
read_text(). The tag names and paths they create (v1,v1-again,a-tree) are legal on NTFS. The forge-path tests carryWINDOWS_SKIP, like every test using the stubgh, which is a#!script.Not in this PR
L1-04. The issue's case is a directory that is not a clone, inside a partial clone. The proposed fix asks whether the recorded path is a clone's top level before reading its config, but
planreads a--pin-sourcethrough git's own repository discovery. Measured on a524542:plan --pin-source glass/sub, a directory inside a full clone, is accepted, andcheckthen recomputes the digest there:digest recomputes … in the clone … glass/sub.If the partial-clone question returned "not a clone" for a subdirectory,
checkwould recompute in the enclosing partial clone, whosegitcan fetch what it lacks over the network, and "checkreads no network" would no longer hold. Answering "unreadable" there instead would contradictplan, which read the same path, and a re-run ofplanwould accept it again. The NOTE is the safe side, as the line itself says. Making it exact means holding--pin-sourceto a clone's top level inplan, the scaffold andcheckalike. That changes what both tools accept, beyond this block.The root's own
validate-pins.pystill passes a pin file whosecommit:is a tag's id, becausels-treepeels it. That file andCOMMIT_RElive in scripts/repo_shape.py and the copied validator, which are pinned shape copies, and a project receives a change to them only throughupdate-shape.py. After this PR, neither tool writes such a pin. A hand-edited one is still the validator's to find.AGENTS.md still says a pin needs "a full 40-character commit — a tag can be moved and a commit cannot", and both tools'
--pinhelp asks foropenGlass@<40 hex>. Both stay true of a tag name. Saying that a tag object's own id is peeled, asbump-leg.py --to's help does, would change that help and regenerate docs/cli.md, and is left for a docs pass.Known limits
GH_OBJECT_QUERY):gh api graphql -f query=… -f owner=opensoft -f name=openRepoShape -f oid=cc96c67d2e04e4833043c2153b1d478078a82c6e, the annotated tagv1.0.0. It exited 0 and answered{"data":{"repository":{"object":{"__typename":"Tag","target":{"__typename":"Commit","oid":"bfed143e89f97d3480cf5373051cb1ace82db312"}}}}}, the commitgit rev-parse v1.0.0^{}names, and that answer, replayed through a stub, peels in both tools. Howghexits on a GraphQL error (a missing repository, a rate limit) is as documented, not measured here; replayed through a stub, each such exit, and each malformed answer, ispin-unreadablewith no traceback.checkasks nothing of a pin whose digestgh apiread. It reads no network, so a plan recording a tag's id withdigest_source: gh-api-tree-recursivegets the existing NOTE that its digest was not rechecked. The same holds where the recorded clone is gone or is a partial clone.ghcall per pin, two for a tag of a tag. Its failures are the existinggh-not-foundandpin-unreadable, in the same words.Closes #651
🤖 Generated with Claude Code
Summary by Sourcery
Resolve each pin ID to a commit before recording or validating it, while consolidating related pin-file findings.
New Features:
checkand report plans whose pins do not identify commits.Bug Fixes:
Enhancements:
Tests: