Skip to content

adopt-project.py: check recomputes each pin's digest at the plan's commit in the clone plan read it from, where that clone is still on the machine and is no partial clone, so a commit or a digest edited into the plan no longer checks ok and reaches the root as adoption verified over a red validate-pins.py (#449) - #589

Merged
brettheap merged 3 commits into
mainfrom
fix/449-adopt-pin-digest-recheck
Oct 15, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openreposhape-1 (openRepoShape-1)
Claim: #449 (comment)

What

adopt-project.py check now recomputes each pin's digest where it can, with no network: a partial clone (git clone --filter), whose git fetches what it lacks, is not asked. It does this at the plan's commit, in the clone plan read the digest from, where that clone is still on this machine. execute asks the same question through _entry_findings, the one list both commands read, so it refuses what check finds before any leg exists. This is option (b) of #449, which the lane's coordinator chose.

For each pin execute would write:

  • The clone is still at its path. digest_source: is local-clone (<path>) and something is at <path>. check recomputes the digest there with plan's own reader, pin_digest_from_source, so the same clone is asked the same question in the same words.
    • A digest that differs is the FINDING plan-pin-digest-mismatch.
    • Anything at the path that cannot answer for the commit is the FINDING plan-pin-source-unreadable: a clone without the commit, a directory that is no clone, or a file. The finding names the directory it read and both causes: the commit was edited after plan read it, or the path no longer holds the clone plan read it in. It offers each way out.
    • A digest that recomputes gets one NOTE saying so.
  • Nothing is at the path any more, the clone is a partial clone, gh api read the digest, or digest_source: names no clone. One NOTE says the digest was not rechecked here, and that the root's own validate-pins.py recomputes it wherever it can read the product.
    • Whether a clone is partial is read from its own config (extensions.partialclone, or a remote.<name>.promisor), which reads no network.
    • gh is never run, and execute --local-remote-dir still needs no gh.
  • A relative path is named with the directory it was read from. plan records --pin-source as typed, and check and execute read it from the directory they run in, as plan read it from the one it ran in. Every NOTE and finding naming such a path adds (read from this directory as <absolute path>).
FINDING plan-pin-digest-mismatch: `pins:` entry 1 ('openGlass') records `commit: <B>` and `tree_sha256: <A's digest>`, and the clone `plan` read the digest from, <dir>/openGlass, recomputes <B's digest> at that commit: one of the two was edited after `plan` read them, and the root's own `validate-pins.py` would refuse the pin file `execute` writes from them (`neutral-pin-digest-mismatch`): re-run `plan` with `--pin opensoft/openGlass@<40 hex commit>`, which reads the digest there (from `--pin-source <clone>` with no network, or `gh api`) and records both, as `scaffold-project.py --pin` takes it.

NOTE `pins:` entry 1 ('openGlass'): digest recomputes at <A, 12 hex> in the clone `plan` read it from, <dir>/openGlass.

FINDING plan-pin-source-unreadable: `pins:` entry 1 ('openGlass') records `commit: <C>`, and the clone its `digest_source:` names (read from this directory as <ws>/openGlass) cannot answer for it: openGlass could not answer for opensoft/openGlass @ <C>: `git ls-tree -r -z <C>` in openGlass exited 128: fatal: not a tree object. Either the commit was edited after `plan` read it, or that path no longer holds the clone `plan` read it in: run `check` where `plan` ran, or `git fetch` in that clone, or re-run `plan` with `--pin opensoft/openGlass@<40 hex commit>`, which reads the digest there (from `--pin-source <clone>` with no network, or `gh api`) and records both, as `scaffold-project.py --pin` takes it.

NOTE `pins:` entry 1 ('openGlass'): digest NOT rechecked here: the clone `plan` read it from is not at openGlass (read from this directory as <ws>/Thing/openGlass). The root's own `validate-pins.py` recomputes it wherever it can read the product.

NOTE `pins:` entry 1 ('openGlass'): digest NOT rechecked here: the clone at <ws>/partial is a partial clone (`git clone --filter`), whose `git` fetches what it lacks over the network, and `check` reads no network. The root's own `validate-pins.py` recomputes it wherever it can read the product.

The samples are this branch's own output. The first finding and the first NOTE are for a clone named by its absolute path. The second finding is for a commit edited to one the clone lacks, read through plan --pin-source openGlass from <ws>; the second NOTE is the same plan checked from <ws>/Thing; and the last NOTE is for a git clone --filter=blob:none clone.

The comment plan writes above pins: is unchanged. It already says "a commit or a digest edited here is one nobody read (#273)", and this makes that true wherever the clone is still there. check's report no longer prints "each pin as plan read it, not read again here", which would now be false where the clone answered; the per-pin NOTE replaces it.

Why (repro on main 2247dbf)

#449's own repro, run on main 2247dbf and on this branch at d158a21, and again at the fix round's head 006caf4 with the same branch results. The setup: git 2.43.0, Python 3.12.3, git filter-repo on PATH, every repository local, and a stub gh first on PATH that exits 97. The stand-in openGlass has two commits, A and B. plan --pin openGlass@<A> --pin-source <its clone> then has one value of the pin edited.

Re-run at review on main f6eaab7 (the main this branch merges cleanly onto), with the same results. The fix round's head 006caf4 merges cleanly onto main a2243f1 too (git merge-tree --write-tree, exit 0, 2026-10-15T13:44Z).

edit step main 2247dbf this branch
commit: A to B, digest left at A's plan exit 0 exit 0
check exit 0, plan ok exit 1, FINDING plan-pin-digest-mismatch
execute --yes --local-remote-dir exit 0, adoption verified exit 2, REFUSED plan-pin-digest-mismatch, no remote made
the root's validate-pins.py, SHAPE_PIN_SOURCE_OPENGLASS set exit 1, FINDING neutral-pin-digest-mismatch not reached
tree_sha256: A's to B's, commit left at A plan exit 0 exit 0
check exit 0, plan ok exit 1, FINDING plan-pin-digest-mismatch
execute --yes --local-remote-dir exit 0, adoption verified exit 2, REFUSED plan-pin-digest-mismatch, no remote made
the root's validate-pins.py exit 1, FINDING neutral-pin-digest-mismatch not reached

On main, execute called the adoption verified, and the root's own gate failed on its first run, after both leg repositories existed. That is #273's symptom, reached by a hand edit.

How

  • _pin_digest_findings(plan) reads the pins _read_pins accepts. It runs only on a pin whose form is already right; a pin plan never writes is still plan-pin-unrecorded or plan-pin-malformed, as before. For each pin:
    • _why_not_rechecked(how) says why the digest cannot be recomputed here, or None. Only a path with nothing at it is gone: FileNotFoundError or NotADirectoryError from stat(), which is what plan's reader calls "no such directory". Anything else at the path, such as a file or a directory that cannot be entered, is asked, and the reader names why it cannot answer.
    • A partial clone is not asked. _a_partial_clone(clone) runs git config --local --get-regexp '^(extensions\.partialclone|remote\..*\.promisor)$' in it, which reads the clone's own config and no network. Any such key gives the NOTE, even a promisor set to false: a wrong guess costs a recheck not made, never a fetch.
    • _recomputed_pin_finding(said, values) calls pin_digest_from_source(Path(<path>), commit, repository), the function plan read the digest with. A Refusal is plan-pin-source-unreadable, carrying the reader's own sentence. A different digest is plan-pin-digest-mismatch.
    • _read_from_here(clone) gives (read from this directory as <absolute path>) for a relative path and nothing for an absolute one. Both findings, the gone-clone and partial-clone NOTEs, and the NOTE that the digest recomputes all carry it.
  • _entry_findings adds these findings right after _leg_findings, whose last findings are the pins' others. It returns the pin NOTEs ahead of its other notes, and check prints them. execute's _refuse_what_check_finds reads the same list, so the two commands answer the same question of the same plan.
  • LOCAL_CLONE_RE (local-clone \((?P<path>.+)\)) and GH_DIGEST_SOURCE (gh-api-tree-recursive) read what declared_pin_values records. test_plan_records_the_pin_whole and test_the_issues_edit_is_found_until_the_clone_is_gone hold the first to it through a real plan --pin-source, and test_with_no_pin_source_plan_reads_the_digest_from_gh holds the second through a real plan that reads a stub gh (POSIX only: it is @WINDOWS_SKIP).
  • The digest is a function of the commit. So a clone that holds the commit recomputes the digest plan read, whichever clone it is, and a recheck can never invent a mismatch. A commit and a digest both moved to another commit the clone holds are a pin of that commit: they check ok, and that pin is what execute writes. An upper-cased pin is the same pin, as before.
  • Of the tools, only adopt-project.py changes; the tests are in tests/test_adopt_pins.py. scripts/shape_materialize.py is imported from (pin_digest_from_source), not edited, and no template, generated document or --help text changes.

Tests

tests/test_adopt_pins.py, beside test_a_plan_whose_pin_execute_cannot_write_is_found_and_refused, as #449's "How to test" asks. The file goes from 107 tests to 120: thirteen new cases in seven new functions, and two existing tests edited. Every hand-written pin that names a clone names a copy of the stand-in (recorded_clone), so a test can delete it. The module's stub_gh and the session gh guard stay on, and every test asserts that gh was not called.

  • test_a_pin_edited_after_plan_is_found_and_refused, 4 cases: the commit edited, the digest edited, an upper-cased edited commit (plan-pin-digest-mismatch), and a commit the clone lacks (plan-pin-source-unreadable, its text asserted with both causes and each way out). check exits 1 with that one finding, and execute refuses it with check's own finding before any leg remote exists (conftest.refused_before_any_leg).
  • test_a_pin_the_clone_recomputes_checks_ok, 2 cases: the commit and the digest both moved to the stand-in's other commit, and an upper-cased pin. Each checks ok with the NOTE that the digest recomputes, _recorded_pins gives the lower-cased pin execute writes, and the old "not read again here" sentence is gone.
  • test_a_pin_whose_clone_is_gone_is_said_not_rechecked: the commit edited, then the clone deleted. This is what (b) cannot see, so check exits 0 with the NOT-rechecked NOTE.
  • test_a_pin_read_from_no_clone_is_said_not_rechecked, 2 cases: a gh-api-tree-recursive source and a source naming no clone. Each gives the NOTE, and there is no gh call.
  • test_a_pin_read_from_a_partial_clone_is_said_not_rechecked: the copy is marked partial by its config alone (extensions.partialClone, remote.origin.promisor), so nothing can be fetched, and its commit is edited. check exits 0 with the partial-clone NOTE. With the check disabled it exits 1 with the mismatch.
  • test_a_relative_clone_is_read_from_where_check_runs, 2 cases: digest_source: names the copy by a relative path, and check runs from the directory holding it. The recomputes NOTE, and with the commit edited the mismatch finding, name it with (read from this directory as <absolute path>).
  • test_the_issues_edit_is_found_until_the_clone_is_gone: adopt-project.py check and execute write a neutral pin's commit: and tree_sha256: exactly as the adoption plan records them and read neither again, so a hand edit that makes the two disagree is plan ok and adoption verified, and the adopted root's own validate-pins.py then exits 1 with neutral-pin-digest-mismatch on its first run #449's own path through a real plan --pin openGlass@<A> --pin-source <clone>, then commit: edited to B. findings(plan) names plan-pin-digest-mismatch and execute refuses it. Once the clone is deleted, check passes.
  • Edited: test_a_plan_with_a_whole_pin_checks_ok now asserts the NOT-rechecked NOTE where it asserted the old S3 sentence. Its pin names the relative openGlass, which is not in the directory the tests run from, so the NOTE says is not at openGlass (read from this directory as <cwd>/openGlass). test_a_plan_with_no_pin_says_nothing_of_pins asserts that no pin NOTE is printed.

Revert table. Each change was reverted alone in a plain clone at 006caf4, never in the working tree. The fifteen tests above were run each time: the thirteen new cases, the edited control and the no-pin guard. The file was then restored by sha256.

reverted alone fails
the whole change (adopt-project.py at 2247dbf) 14 of 15: every new case and the edited control. The no-pin guard holds both ways by design.
the digest findings not added to _entry_findings 6: the 4 edited-pin cases, the relative mismatch, and the issue's path
the pin NOTEs not returned for check to print 8: both recompute cases, the clone gone, both no-clone sources, the partial clone, the relative recompute, and the control
the old "not read again here" sentence printed again 2: both recompute cases
a recomputed digest that differs not found 5: commit, digest, commit-upper, the relative mismatch, and the issue's path
a clone that cannot answer not found 1: commit-absent
a path with nothing at it asked anyway 3: the clone gone, the issue's path (after its deletion), and the control
a gh api source said as "names no clone" 1: the gh-api case
a partial clone asked (_a_partial_clone disabled) 1: the partial-clone test
_read_from_here silent 3: both relative cases and the control
the unreadable finding's first-round text 1: commit-absent
the gone-clone NOTE's first-round text 2: the clone gone, and the control
the mismatch finding without _read_from_here 1: the relative mismatch
the recomputes NOTE without _read_from_here 1: the relative recompute

Runs at 006caf4, dirty 0, /usr/bin/python3 -m pytest (Python 3.12.3). Each run has a stub gh first on PATH, a bogus GH_TOKEN and an empty GH_CONFIG_DIR. It covers every test file grep -l -E 'adopt-project|adopt_project|\bADOPT\b' tests/*.py finds, conftest.py excepted: 70 files, tests/test_shape_doctor.py and tests/test_scaffold_leg_path_collisions.py among them. Each mode ran in six shards, and each shard's log ends EXIT=0, with dirty 0 before and after.

mode passed skipped failed
git-filter-repo on PATH 5714 13 0
git-filter-repo hidden (PATH=<stub>:/usr/local/bin:/usr/bin:/bin) 5401 326 0

Both modes ran the same 5727 tests.

Windows

The new tests ran under a Windows newline emulation: a pytest plugin kept outside the repository that makes text-mode Path.write_text and text-mode stdin write \r\n.

  • Result. The whole of tests/test_adopt_pins.py at 006caf4, dirty 0, git-filter-repo on PATH: 119 passed, 1 deselected, EXIT=0. The plugin translated 3586 write_text line ends.
  • The one deselected test is test_with_no_pin_source_plan_reads_the_digest_from_gh, which is @WINDOWS_SKIP and never runs on Windows. Under the emulation, stub_gh writes its #!/usr/bin/env python3 line with \r\n, so env looks for python3\r. Run without the deselect at d158a21, it was the only failure (1 failed, 116 passed); r449's own two emulations, a different implementation, fail exactly it too.
  • No newline counting. Every plan the new tests edit is read and written as bytes (with_pins, planned, and resolve, which writes LF). Nothing counts "…\n" in bytes a write_text wrote.
  • Paths. A hand-written digest_source: is quoted with the plan's own double_quoted, so a Windows drive's backslashes stay the path's. check prints a printable path as it is (_shown), and the assertions compare it with str(recorded_clone). The relative-path test compares only (read from this directory as and <os.sep>openGlass-clone), so a macOS /private prefix or a Windows drive cannot break it. Every path a test makes (openGlass-clone, Thing, plan/) is legal on NTFS.

Not in this PR

Known limits

Closes #449

🤖 Generated with Claude Code

Summary by Sourcery

Make adoption verify recorded pin digests locally when possible and refuse plans whose pin metadata no longer matches the source.

New Features:

  • Recompute pin digests from their recorded local clone during adopt-project.py check and reject mismatches before adoption proceeds.
  • Report whether each pin was verified, skipped because its source is unavailable or partial, or could not be read.

Bug Fixes:

  • Prevent edited pin commits or digests from passing adoption verification and creating invalid leg repositories.
  • Avoid network access when validating pin sources, including for partial clones and forge-derived digests.

Enhancements:

  • Share pin digest findings between check and execute so both commands enforce the same validation results.
  • Clarify relative pin-source paths and identify the directory used during rechecking.

Documentation:

  • Update adopt-project output and tests to describe per-pin digest verification and recheck limitations.

Tests:

  • Add coverage for edited commits and digests, unreadable and missing clones, partial clones, forge-sourced digests, relative paths, and refusal before any leg exists.

Brett Heap and others added 2 commits October 15, 2026 11:01
…commit in the clone `plan` read it from, where that clone is still on the machine, so a commit or a digest edited into the plan no longer checks ok and reaches the root as `adoption verified` over a red `validate-pins.py` (#449)

Since #273, `plan --pin <product>@<40 hex>` reads the pin's digest (from
`--pin-source <clone>`, or `gh api`) and records the product, the
repository, the commit, the digest and `digest_source:` in the plan.
`check` held each value to the form `plan` writes it in and to nothing
else, so a commit or a digest edited into the plan after `plan` read them
checked ok, `execute` wrote `contracts/<product>-pin.yaml` from them and
said `adoption verified`, and the root's own `validate-pins.py` then
found `neutral-pin-digest-mismatch` on its first run, after both legs
existed. The comment `plan` writes above `pins:` already says such an
edit is one nobody read; this makes it true where it can be, with no
network (option (b) of #449).

- Where `digest_source:` is `local-clone (<path>)` and something is
  still at that path, `check` recomputes the digest there at the plan's
  commit with `plan`'s own reader, `pin_digest_from_source`. A digest
  that differs is the FINDING `plan-pin-digest-mismatch`; a clone that
  cannot answer for the commit (it does not hold it, or the path is no
  clone any more) is the FINDING `plan-pin-source-unreadable`. Both are
  in `_entry_findings`, the one list, so `execute` refuses them before
  any leg exists. Where the digest recomputes, a NOTE says so.
- Where nothing is at the path any more, where `gh api` read the digest,
  or where `digest_source:` names no clone, one NOTE per pin says the
  digest was NOT rechecked here and that the root's own
  `validate-pins.py` recomputes it wherever it can read the product.
  `gh` is never run; `execute --local-remote-dir` still needs no `gh`.
- The digest is a function of the commit, so a commit and a digest both
  moved to another commit the clone holds are a pin of that commit and
  check ok, and an upper-cased pin is the same pin. A relative path is
  read from the current directory, as `plan` read it.
- `check`'s report no longer prints "each pin as `plan` read it, not
  read again here", which is now false where the clone answered; the
  per-pin NOTE replaces it. The comment above `pins:` is unchanged.

Tests (tests/test_adopt_pins.py, beside
`test_a_plan_whose_pin_execute_cannot_write_is_found_and_refused`): the
commit edited, the digest edited, an upper-cased edited commit and a
commit the clone lacks are each found by `check` and refused by
`execute` before any leg remote exists; a commit and a digest both moved
to the other commit, and an upper-cased pin, check ok with the NOTE that
the digest recomputes; the clone deleted, a `gh api` source and a source
naming no clone each check ok with the NOT-rechecked NOTE and no `gh`
call; and #449's own path through a real `plan --pin-source`. The
control test's S3 sentence assertion becomes the NOTE.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd names the directory a relative `--pin-source` is read from and both causes of `plan-pin-source-unreadable`, so a `git clone --filter` clone no longer makes `check` fetch over the network and the finding no longer states one cause as the only one (#449)

The fix round of #449 (review r449, F1 to F3 and F5).

- A partial clone is not asked (F2). `git` in a `git clone --filter`
  clone fetches an object it lacks from its promisor remote, so the
  recheck could reach the network, measured by r449 against a `tree:0`
  and a `blob:none` clone. `_a_partial_clone` reads the clone's own
  `--local` config (`extensions.partialclone` or a
  `remote.<name>.promisor`), which reads no network, and such a pin gets
  the NOTE that its digest was not rechecked. The cost: a `blob:none`
  clone that holds the commit is not rechecked either.
- `plan-pin-source-unreadable` names both causes and each way out (F1).
  It stays a FINDING wherever something at the recorded path cannot
  answer (a missing commit, a directory that is no clone, a file), as
  `validate-pins.py` finds a source it reads that cannot answer. The
  text says the commit was edited, or the path no longer holds the clone
  `plan` read, and offers running `check` where `plan` ran, `git fetch`
  in that clone, or re-running `plan`.
- A relative `--pin-source` is named with the directory it was read from
  (`_read_from_here`, F1 and F3): in the gone-clone NOTE ("is not at
  openGlass (read from this directory as <absolute>)"), the partial-clone
  NOTE, both findings, and the NOTE that the digest recomputes.
- The comments and docstrings that say "no network" now say how that is
  true.

Tests (tests/test_adopt_pins.py): a clone marked partial by its config
alone gives the NOTE, with nothing fetched; a relative clone read from
the directory `check` runs in is named with it, in the NOTE and in the
finding; the `commit-absent` case asserts the new text; the gone-clone
and control tests take the new NOTE. `adoption-plan.yaml` is the module
constant `PLAN_NAME`, and the recompute test is parametrized by a bool
(F5).

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 8 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

adopt-project.py check now locally verifies pin digests at their recorded commits when a usable, non-partial source clone remains available, while safely reporting unverified cases without network access; execute consumes the same findings and refuses mismatches before creating adoption legs, with extensive tests covering source and path edge cases.

Sequence diagram for local pin digest verification

sequenceDiagram
    participant User
    participant Adopt as adopt-project.py
    participant Plan as Plan data
    participant Clone as Source clone
    participant Git as Local git

    User->>Adopt: check or execute
    Adopt->>Plan: _entry_findings
    Adopt->>Plan: _pin_digest_findings
    Adopt->>Plan: _why_not_rechecked
    alt local clone exists and is non-partial
        Adopt->>Clone: _a_partial_clone
        Clone->>Git: git config --local --get-regexp
        Git-->>Clone: clone configuration
        Adopt->>Clone: pin_digest_from_source(commit, repository)
        Clone->>Git: git ls-tree -r -z commit
        Git-->>Clone: recomputed digest
        alt digest differs
            Adopt-->>User: FINDING plan-pin-digest-mismatch
        else digest matches
            Adopt-->>User: NOTE digest recomputes
        end
    else clone unavailable, partial, or gh-api source
        Adopt-->>User: NOTE digest NOT rechecked here
    end
    alt execute and findings exist
        Adopt-->>User: REFUSED before adoption legs
    end
Loading

Flow diagram for plan pin validation outcomes

flowchart TD
    A[Read recorded pin] --> B{digest_source names local clone?}
    B -- No --> C[NOTE not rechecked; no network]
    B -- Yes --> D{Clone path exists?}
    D -- No --> C
    D -- Yes --> E{Partial clone?}
    E -- Yes --> C
    E -- No --> F[Recompute digest at recorded commit]
    F --> G{Digest matches?}
    G -- Yes --> H[NOTE digest recomputes]
    G -- No --> I[FINDING plan-pin-digest-mismatch]
    F --> J{Clone can answer for commit?}
    J -- No --> K[FINDING plan-pin-source-unreadable]
    I --> L[check reports finding]
    K --> L
    L --> M[execute refuses before creating legs]
Loading

File-Level Changes

Change Details Files
Recompute recorded pin digests locally during plan validation when the original clone is available and non-partial.
  • Parse local-clone and forge-based digest sources from recorded pin metadata.
  • Use plan's pin digest reader at the recorded commit to detect digest mismatches or unreadable sources.
  • Skip missing, forge-only, and partial clones without network access and emit explanatory notes.
  • Annotate relative clone paths with the directory used to resolve them.
adopt-project.py
Ensure digest validation is shared by check and execute and update reporting behavior.
  • Add digest findings and per-pin recheck notes to the common entry findings flow.
  • Make execute refuse the same digest findings reported by check before creating legs.
  • Replace the old blanket not-rechecked message with per-pin status notes.
adopt-project.py
Add comprehensive coverage for edited pins, source availability, path resolution, and network avoidance.
  • Test mismatched and unreadable pins, normalized casing, successful recomputation, and execute refusal.
  • Test deleted, forge-sourced, unnamed, partial, and relative-path sources.
  • Verify gh is never invoked and update existing control/no-pin assertions.
tests/test_adopt_pins.py

Assessment against linked issues

Issue Objective Addressed Explanation
#449 Detect a hand-edited pin commit or tree digest that no longer matches when the digest-source clone is still available, and prevent check from reporting the plan as valid. ✅
#449 Ensure execute refuses the same mismatched or unreadable pin before creating adoption legs, while both commands use the same findings. ✅
#449 Make the limits of rechecking explicit when no usable local clone is available, without introducing network access for pin verification. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-15T14:26:05.107421Z 006caf4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit a61cf47 into main Oct 15, 2026
5 checks passed
@brettheap
brettheap deleted the fix/449-adopt-pin-digest-recheck branch October 15, 2026 18:04
brettheap pushed a commit that referenced this pull request Oct 15, 2026
Main moved while this merge was being made: a61cf47 (#589) at the
coordinator's request, then 70331aa (#586, shape-doctor.py only) and
2989b4c (#573: family.py, scaffold-project.py, docs/cli.md's scaffold and
family sections, their tests). This merges 2989b4c, the tip at merge
time. 10 commits since 2e6c6fa: 8890f57, fb786c1 (#581), 26c1600,
2bf8fd4, 654c476 (#597), 3f768a6, 024ea55, a61cf47 (#589),
70331aa (#586), 2989b4c (#573).

One conflict, adopt-project.py, the end of `_entry_findings`' return:

  HEAD (#520) added `names_remediation` to the remediation list, so a
  misnamed `adopt_branch:` or `tracking_branch:` prints its remedy;
  main (#589, #449) added `pin_notes` to the notes, so a pin whose digest
  `check` could not recompute is said once at the end.

  Resolved by keeping both, each where its side put it:

            + names_remediation + tracking_remediation + moved_remediation
            + field_remediation,
            pin_notes + notes)

  The two edits touch different elements of the returned tuple, so
  neither changes what the other means: #589's
  `digest_findings, pin_notes = _pin_digest_findings(plan)` and its
  docstring paragraph auto-merged beside #520's `_branch_name_findings`
  call and paragraph.

docs/cli.md auto-merged (#573 changed the scaffold and family sections,
this branch the adopt section); `scripts/render-cli-reference.py --check`
passes on the merge.

Against the new main, each of this branch's six files (adopt-project.py,
docs/cli.md, tests/test_adopt_branch_names.py,
tests/test_adopt_plan_yaml_quoting.py, tests/test_adopt_split_branch.py,
tests/test_adopt_template_values.py) differs by exactly the +/- lines it
did against 2e6c6fa at c598ec3 (adopt-project.py: 399).

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-2, 2026-10-15T19:50:30Z) For lane openRepoShape-1: #570 (#540) meets this PR's recompute when it merges main. Its plan keeps #589 whole: the plan records local-clone (<path>) again, check accepts that spelling, and only the committed pin file and check's write line drop the path. Details, and a place to object: #570 (comment)

brettheap added a commit that referenced this pull request Oct 15, 2026
…eck`'s finding for a link kept above a path the shape writes says the clone holds it as a file, so `scripts -> tools/deep` no longer says where the scripts land and sends the person to change where it points, on to `adopt-symlinks-off` (#531) (#584)

Some disks check a symlink out as a plain file: under `core.symlinks=false`, which is Git for Windows' default and what `git init` writes on a filesystem that cannot hold a symlink. On such a disk, a symlink the plan keeps in the root ABOVE a path the shape writes is a plain file in the assembly's clone, and nothing can be written beneath it.

When `check` reports such a link as `plan-root-symlink`, its finding now says that, in `adopt-symlinks-off`'s words, and gives a fix that works on that disk: send the link to a leg or `drop` it in the plan, and run `check` again. `execute` refuses with the same line, word for word, before any leg exists, as it refused the old line. Only the text of a finding `check` already made changes. A link above that the walk follows cleanly (`scripts -> ci`) stays `execute`'s `adopt-symlinks-off` before any leg, as #504 designed. With symlinks on, the output is byte-identical to `main`'s.

`_a_file_above(walk, probe)` runs only for a walk that is about to be reported, so a plan with no such finding makes no new probe, and no network or gh call is added.

Tests: tests/test_adopt_root_symlinks.py holds 149 tests on `main` and 156 here. `test_with_symlinks_off_a_link_above_a_path_is_named_as_a_file` (6 cases) and `test_with_symlinks_off_the_fix_the_finding_gives_works_there` (`code`, `drop`) are new. Three existing tests of a followed link gain `links_as_links`, so they keep asserting the symlinks-on line wherever the runner's checkout writes a plain file, which a Windows runner's may (Git for Windows' default). Main's test of the old reason is now the D6 row.

Review: the adversarial review found the change PR-READY at 0a178e4, with five text corrections, all in the PR body. The edge cases it found outside #531 are left for #457's checklist.

`main` was merged in five times, and the branch was never rebased.
- **The first merge** was GitHub's update-branch, at 348f8a8 (main 2e6c6fa). 348f8a8 is green on Linux, macOS, Windows and SonarCloud.
- **The second merge was by hand,** at cae5a98 (main 654c476), after #581 (#524) changed `adopt-project.py`. Its one conflict was a comment in `_SymlinkProbe`, about a work directory no repository can be made in. The resolution keeps both #531's sentence and #524's.
- **cae5a98c** passed 71 adopt test files in both modes: 5,796 passed and 5,482 passed, with 0 failed.
- **The third merge** was GitHub's update-branch, at 7f439a5 (main a61cf47), after #589 changed `adopt-project.py`. It was a clean merge.
- **The fourth and fifth merges** were also GitHub's update-branch, both clean, after #566 and #582 changed `adopt-project.py`: 250b070 (main 1d809ea) and c43cde1 (main 526cd2c).
- **Since #597, CI is Linux only.** The head is green on Linux and SonarCloud (ruling 27).

Closes #531

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 15, 2026
…n-source-unread

Merges origin/main 66267f0 so the PR's CI merge ref and the fix that follows
run on current main. The fourteen landings since 2bf8fd4: #597, #578, #593,
#589 (#449), #586, #573 (#537), #575 (#539), #566 (#528), #571, #588, #569
(#538), #582 (#523), #616 and #576 (#441, #442).

Those that touch this PR's files:
- adopt-project.py: #589 (`check` recomputes each pin's digest in the clone
  `plan` read it from: LOCAL_CLONE_RE, _recorded_clone, _why_not_rechecked,
  _recomputed_pin_finding, _pin_digest_findings), #582 (what `plan`,
  `execute` and AGENTS.md say around a run) and #566 (a source's own
  `single-repository.yaml`).
- scaffold-project.py and docs/cli.md: #573, #569 and #576 (the
  `_declaration` docstring: `--pin-source` verifies the first chain link
  alone, which this PR's N3 wording already says).
- tests/test_adopt_pins.py: #589's thirteen cases.
- tests/test_scaffold_leg_path_collisions.py: #573.

This commit holds the textual resolution only. One hunk conflicted, the
`from shape_materialize import (...)` list at adopt-project.py:261. It is
resolved as the union of both sides' changes to the list: main's added
`pin_digest_from_source` (#589), and this PR's added `DIGEST_FROM_CLONE`,
`DIGEST_FROM_GH`, `pin_source_path` and `refuse_an_unread_pin_source` and
its removal of `one_printable_line`, whose last caller this PR deleted and
to which main added none (keeping it is pyflakes' "imported but unused").
pyflakes adopt-project.py is clean on the merge. Every other file merged
without a marker, and `scripts/render-cli-reference.py --check` is ok.

The merge alone does not keep #589 working: this PR's `plan` records a bare
`local-clone`, which names no clone for #589's `check` to read, and `check`
refuses `local-clone (<path>)` as `plan-pin-malformed`. The next commit
reconciles the two.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 15, 2026
…gain and `execute` writes `local-clone`, so #449's `check` recomputes each pin in its clone and still no committed pin file holds the path (#540)

#589 (#449, on main since a61cf47) makes `check` recompute each pin's
digest in the clone `plan` read it from, which it finds in the plan's
`digest_source: local-clone (<path>)`. This PR made `plan` record a bare
`local-clone` and `check` refuse any other spelling (F1), so on the merge
with main #449's code never ran: 13 of its tests failed. Both are kept:

- The plan records the path again, `local-clone (<the --pin-source path
  as typed>)`, as main does (`_as_planned`). The plan is a file on the
  machine that planned: `execute` builds the root and both legs from
  fresh clones at the source's commit and writes no plan value but the
  pin file's into any of them.
- Every committed or printed value is bare. `declared_pin_values` keeps
  writing `local-clone` for both tools, so the scaffold's pin file is
  unchanged by this commit; `execute` writes the pin file from
  `_recorded_pins`, which turns both clone spellings into `local-clone`
  (`_digest_source_written`); `check`'s `write` line prints those values
  and `plan`'s `pin` line says the same.
- F1 takes a closed set of three spellings (`_a_digest_source`):
  `gh-api-tree-recursive`, `local-clone`, and `local-clone (<path>)` as
  `LOCAL_CLONE_RE` fullmatches it, on one printable line. Every other
  value is `plan-pin-malformed` with "re-run `plan`", and `execute`
  refuses it as before. The rewrite is safe where F1's first version
  refused instead: the set is closed, so nothing but the two words can
  reach the committed file. The one-printable-line condition is main's
  own rule for the field; without it a hand-edited `local-clone
  (/x\x00y)`, which the plan's reader makes a NUL of, reaches #449's
  `Path(clone).stat()` and raises `ValueError`, a traceback.
- `_refuse_an_unrecordable_pin_source` is back (`adopt-unwritable-value`,
  as on main), for a `--pin-source` `plan` cannot record on one plan line:
  a line break, an ESC, a byte that is not UTF-8, a zero-width joiner.
  Its sentence now says the path goes into the plan for `check`, not into
  the pin file. The scaffold records no path, so it still scaffolds from
  such a clone (#450).
- `--pin-source`'s help says the plan records the path and the pin file
  does not; `docs/cli.md` is regenerated.

#589 is kept whole: its code, findings, NOTEs and tests are unchanged, but
for one test value. `test_a_pin_read_from_no_clone_is_said_not_rechecked
[no-clone-named]` wrote `digest_source: "read by hand"`, which F1's closed
set now refuses as `plan-pin-malformed`; the row now writes bare
`local-clone`, the one accepted spelling that names no clone, and asserts
the same NOTE through the same branch. `read by hand` joins the
malformed table.

Tests: main's `adopt-unwritable-value` tests are restored, with the new
sentence, and the answering-clone one gains a line-break and a
not-UTF-8 row (EILSEQ skip); `tests/test_adopt_execute_refusals.py` and
`tests/test_adopt_root_symlinks.py` are main's again. The plan-records
assertions expect `local-clone (<path>)`; the `pin` and `write` lines
expect `(local-clone)`; a new end-to-end test greps `git log -p --all` of
the root, both legs and the scaffold's three repositories for the path;
the scaffold's test greps its three. F1's table gains a bare path,
`local-clone(<path>)` with no space, `read by hand` and a NUL clone, and
loses `source-old-plan`, which passes now.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 15, 2026
…his PR's head carries the newest main before rv540c's fix round (#540, #451, #450)

#591 is the only commit main gained since d62a03c (GitHub's update-branch
merge of main 77bb5f0, #574, #584, #587, #615): adopt-project.py and
shape-doctor.py read `origin` one way (#521, #427). It touches this PR's
adopt-project.py, in the `_checked_plan_inputs` neighbourhood and elsewhere,
and no other file this PR changes: git merge-tree --write-tree says the merge
is clean, so this commit holds the textual resolution only (none was needed)
and every change of behaviour comes after it. #589 (#449) and #582 stay as
f540n merged them.

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 15, 2026
…e: local-clone` and never the `--pin-source` path, so no committed pin file holds a local directory, and a `--pin-source` nothing reads is `pin-source-unused` (#540) (#570)

#540: `declared_pin_values` (scripts/shape_materialize.py), which both
tools call, wrote `digest_source: local-clone (<the path as typed>)` into
the committed pin file. An absolute `--pin-source` therefore committed the
directory a clone sat in on the machine that ran the tool. The field exists
to say which of the two ways the digest was read, so the pin file now says
`local-clone` or `gh-api-tree-recursive` and nothing more. A refusal for a
source that cannot answer still names the path.

Adopt's plan still records the path, `local-clone (<path>)`, because
`check` recomputes each pin's digest in that clone (#449, #589). The plan
is a local file nothing commits: `execute` builds the root and both legs
from fresh clones at the plan's commit, and the one plan value it commits
is the pin file's `digest_source:`, which it writes as `local-clone` for
both clone spellings. `plan`'s `pin` line and `check`'s `write` line say
the same. `check` holds the field to a closed set: `gh-api-tree-recursive`,
`local-clone`, and `local-clone (<path>)` as `LOCAL_CLONE_RE` reads it, on
one printable line. Any other value, a bare path or free text among them,
is `plan-pin-malformed`, and `execute` refuses it before any leg exists, so
nothing but the two words can reach the committed file. The one-printable-
line condition is main's rule for the field; without it a hand-edited
`local-clone (/x\x00y)` reached #449's `Path.stat()` as a NUL and raised
`ValueError`.

#450, the same field: the path was written bare. One holding a line break
wrote a line of its own into the pin file, exit 0. One holding a byte that
is not UTF-8 died in `write_lf` after all three repositories existed. The
scaffold records no path, so it makes a project from such a clone like any
other. Adopt's `plan` must record the path for #449, and `check` holds the
field to one printable line, so its `_refuse_an_unrecordable_pin_source`
(#273's review, N2) stays: such a path is `adopt-unwritable-value`, in a
sentence that now says the path goes into the plan for `check`. `cmd_plan`
asks it straight after `pin-source-unused`, before the work directory, git
in the source or `gh repo clone`, as it needs the flags alone. A malformed
`--pin` given with such a path therefore gets this refusal first.

#449's code, findings and NOTEs are unchanged. One of its test rows,
`no-clone-named`, wrote `digest_source: "read by hand"`, which the closed
set now refuses; it writes bare `local-clone`, which names no clone, and
asserts the same NOTE. `read by hand` is a malformed row.

#451: with no `--pin`, and in the scaffold no `--referent-chain` (whose
first link reads the bare `--pin-source`, and no later link, as #576 makes
it), nothing read `--pin-source`. Even a
path that did not exist was accepted, with exit 0 and no word about the
flag, so a forgotten `--pin` made a project that declares no descent.
`refuse_an_unread_pin_source`, beside `declared_pin_values`, refuses it for
both tools as `pin-source-unused`:
- exit 2;
- from the flags alone, before any process starts and before anything
  exists, the scaffold's `--dry-run` alike; adopt's `plan` asks it first,
  after `pin-source-no-path`, and `adopt-unwritable-value` follows, before
  its work directory, git in the source, or `gh repo clone`;
- two remedies: add the `--pin`, or drop the flag.

The refusal says the flag names the clone each `--pin`'s digest is read
from and the first `--referent-chain` link's declaration, the one link a
bare path is the tree of (#441).

An empty `--pin-source ''` was `Path("")`, the directory the tool ran in,
so it pinned whatever clone the command stood in. `pin_source_path`,
beside it, now refuses it for both tools as `pin-source-no-path`, in the
words #442 gives the root's `validate-pins.py`. Both tools take the flag as
text for this, and a typed `.` still means this directory.

Both tools' `--help` for `--pin-source` says what the pin file and, for
adopt, the plan record, and adopt's names the `adopt-unwritable-value`
refusal; `docs/cli.md` is regenerated. The neutral pin
template says no path is recorded in it, and its header names
`adopt-project.py execute` as a renderer too (L2-16 on #459).

Closes #540
Closes #451
Closes #450

Lane: openreposhape-2 (openRepoShape-2)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 15, 2026
…, the branch names `execute` failed on, so `adopt_branch: a..b`, a source branch `Adopt` or one hidden by `hideRefs` no longer pass `check` and fail after both legs exist (#520, #420) (#583)

`adopt-project.py check` now finds the branch names `execute` used to fail on after both legs existed, and `execute` refuses each one before it creates a leg. On main, `adopt_branch: a..b` checked ok and died at `git checkout -B` with both leg repositories left behind, and a source branch `adopt` hidden by `hideRefs` died at the push of the split with both legs pushed.
- **A split branch in git's way once case is ignored** (A4, #520) is `plan-split-branch-taken`: `Adopt`, `ADOPT/THREE-REPO-SHAPE` or `Adopt/Three-Repo-Shape/old` beside `adopt/three-repo-shape`. It holds in the source and on GitHub, on every system, as ruled on 2026-10-12, and the finding says so.
- **A branch the source hides** with `uploadpack.hideRefs` or `transfer.hideRefs` is seen, because a local repository's branches are read from its own refs with `git for-each-ref`. A clone never gets such a branch, so the finding is about the push into the source (`execute --local-remote-dir`) alone.
- **A name git will not create** (#420): `check` asks git about the plan's `adopt_branch:` and `tracking_branch:` and finds `plan-bad-adopt-branch` and `plan-bad-tracking-branch`. `plan --tracking-branch` refuses such a name as `adopt-bad-tracking-branch` and writes no plan.
- **A name outside `checked_value`'s alphabet** (L2-1, from #457) is now `check`'s `unsafe-value`, in `execute`'s own words.

Tests: tests/test_adopt_branch_names.py is new, with 22 tests, and tests/test_adopt_split_branch.py gains cases. That is 32 new test ids, all failing before the change, each failing under at least one revert of its part. Two existing tests that pinned the old behaviour now pin the new one. At a3690c9, 74 test files passed in both modes: 5,884 passed and 13 skipped with `git-filter-repo` on PATH, 5,568 passed and 329 skipped with it hidden, exit 0 in every chunk.

Review: the adversarial review found the change PR-READY at aee12f2, with three text corrections, all in the PR body. It then checked the first merge, c598ec3: the resolution is correct, #567's behaviour is unchanged, and its 13-file runs passed. The second merge's resolution, a3690c9, was read from its remerge diff: the two sides' additions to the returned tuple, side by side. The edge cases the review found outside #520 and #420 are left for #457's checklist.

The branch holds ten merges of main, of which two were by hand, and it was never rebased. The others were GitHub's update-branch, each a clean merge.
- **The first by hand** was at c598ec3 (main 2e6c6fa). Its one conflict was the label `--tracking-branch` is named by in `_checked_plan_inputs`. #567's hoisted `_flag_named` and this branch's `tracking` binding are both kept, with the text unchanged.
- **The second by hand** was at a3690c9 (main 2989b4c). Its one conflict was the returned tuple of `_entry_findings`. #520's `names_remediation` and #589's `pin_notes` are both kept, and they change different parts of the tuple. The merge differs from main in this PR's six files only.
- The head f8a7c47 is green on Linux and SonarCloud (ruling 27; CI is Linux only since #597).

Closes #520
Closes #420

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 16, 2026
…ests, 57 of 82 milestone issues closed), with #583, #596, #614, #619, #594, #617 and #618 in their areas, #596's Git Bash facts for its placeholders, release.yml's step 1 whole, and every pull request cited beside its issue (RV630 SHOULD 3, 5, 6, nits 7, 8)

- SHOULD 5: step 1 matches release.yml's header: "always on a
  `release/v<X.Y>` branch, which no push run tests", "A `release/v<X.Y>`
  branch serves while it is still at that commit", and that a tag's
  dispatch running at the tag's commit is GitHub's documented behaviour,
  not yet seen here.
- SHOULD 6: #598 beside #595, #592 beside #593, #460 on #557's line, and
  #589's line says "where that clone is still on the machine and is no
  partial clone" again. The counts and the open-issue list are re-derived
  from `git log --first-parent bfed143..origin/main` (49) and the
  milestone (25 open, 57 closed: #342, #392, #393, #421, #423, #426,
  #432, #433, #434, #443, #444, #454, #455 and #629 joined it). New lines
  under adopt-project.py for #583 (#520, #420), #619 (#530), #618 (#418),
  #614 (#527), #594 (#526) and #617 (#525); #596 (#585) under the one-line
  install, CI, native Windows, the docs and the known limits, where the
  two placeholders for it were.
- SHOULD 3: the known limit about "the installed doctor's temporary
  clone" is gone; the README, the handbook and AGENTS.md no longer say it.
- SHOULD 1: the filter-repo line says install.sh's order, apt and dnf
  included.
- nit 7: the release process's preconditions are said as the process
  this release follows; the workflow checks the environments, and nothing
  checks the rehearsal.
- nit 8: the known limits are wrapped.
- "the first on native Windows, where the one line cannot run" says
  PowerShell cannot run it, since Git Bash does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 16, 2026
…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) (#725)

`git rev-parse v1.2` prints a release tag's own object id, and a person can pass it as `--pin openGlass@<id>`. Both adopt-project.py and scaffold-project.py wrote that tag's id as the pin's `commit:`, under the pin file's "A COMMIT, NEVER A TAG". This is #651.

Now `declared_pin_values` (scripts/shape_materialize.py) asks what the id names before it reads the digest. With `--pin-source` it runs `git cat-file -t` in that clone. Without it, it asks the forge through a read-only `gh api graphql` query (`repository.object(oid:)`).
- **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. Every value after it is the commit's, as `bump-leg.py --to`, `family.py add --at` and `family.py bump --to` already peel one.
- **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.
- **An id the forge holds no object for** is `pin-unreadable`.
- **`check` asks the recorded clone the same question** (#589's recheck). A plan whose `commit:` is a tag, a tree or a blob gets a new finding, `plan-pin-not-a-commit`, which `execute` refuses before any leg.

The same block fixes four of #457's lines:
- L1-06: each pin file is named once;
- L1-07: a kept shape pin and its copy give one finding;
- L1-05: `_a_partial_clone` uses the `GIT_CONFIG` constant;
- L1-63: a test docstring is corrected.

L1-04 stays open.

Tests: tests/test_pin_annotated_tag.py (21 tests) and tests/test_adopt_shape_pin_and_work_dir.py (3 tests) are new, and all 24 fail on main. Four existing tests now expect the forge's GraphQL question as the first `gh` call. Every new test fails with at least one change reverted; the revert table is in the PR.

Review: the adversarial review found it PR-READY with five text corrections, all applied; its non-blocking edge cases go to #457's checklist. The new GraphQL read is read-only and runs only where the old tree read ran. `check` reads no network.

GitHub's update-branch merged main into the branch once, a clean merge, and the branch was never rebased. It lands under the fast-refresh ruling of 2026-10-15T22:48:35Z.
- The earlier head bd5eead is green on Linux, Git Bash and SonarCloud.
- Every commit after it is a clean merge of main.
- The head 0ca1261 is green on SonarCloud and Git Bash.
- The full suite passed on its tree. Lane 1's gate ran it on that tree, predicted before main reached it, with 193 test files: 11,290 passed and 36 skipped.

Closes #651

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant