Repository navigation
shape-doctor.py: the members row asks the origin question too, so a fork beside the holder is no longer called the member's working clone (#146) - #147
Conversation
…ork beside the holder is no longer called the member's working clone (#146) `is_this_member` decided that the directory at `../<Project>` WAS this member on the strength of `project.yaml` alone -- a git repository, a `project-manifest`, an `id` matching the row -- and never looked at where the clone came from. The family's own verifier asks two questions, not one: `templates/family-root/scripts/siblings.py::verify_sibling` refuses a clone whose `origin` is not the row's remote as `WRONG ORIGIN` BEFORE it compares an id, and refuses a matching origin with a different id as `WRONG PROJECT`. So a fork, a stale clone of a repository that has since been renamed, or any second copy of the same project from another remote was reported as the working clone by `shape-doctor.py` and skipped by `make siblings`, about one directory on one disk -- the one thing a report whose every row is somebody else's check must not do. `working_clone` now puts the two halves back together in the doctor's own read-only way: `git remote get-url origin` in the sibling (which reads `.git/config` and talks to nothing), compared against the url the holder MOUNTS the member from -- `.gitmodules` first and `family.yaml`'s `repository:` second, which is `siblings.py::clone_url`'s order and therefore the remote an estate mounted from a mirror, an SSH host or a bare repository on disk actually names -- with either spelling accepted, exactly as `verify_sibling` accepts either. IT STAYS A REPORT AND NEVER BECOMES A REFUSAL. The verdict for a member with no working clone beside the holder is unchanged: where somebody keeps their checkouts is the workstation's layout, not a compliance fact about the repository. What changes is that the row now SAYS which origin it found -- "`IRRS`: <path> is a clone of <origin>, not of <the url the holder mounts it from>" -- because "no working clone beside the holder for IRRS", said about a directory named `IRRS` that is sitting right there, is the sentence that sends a person looking for a bug in this command. The `--json` member entry gains `mounted_from` and `other_origin` beside `working_clone`. THE COMPARISON IS `same_repository`'S, IN A NON-PINNED HOME. Nobody's own clone has to spell a remote the way a manifest does -- `[email protected]:Org/Repo.git`, `https://github.com/Org/Repo` and `ssh://[email protected]/Org/Repo.git` are one repository -- so a comparison on the text would have turned a false positive into a false negative. `scripts/shape_materialize.py` gains `remote_key` and `same_repository`: `shape-doctor.py` imports nothing out of `templates/`, and `scripts/repo_shape.py`, where one shared definition belongs, is digest-pinned into every project, so a line there would leave every estate `upstream-changed` until it re-pins. That module is already the doctor's one non-pinned import for exactly this reason (the lane trailer, #111) and `scripts/family.py` imports it too, which is where the second caller is expected to come from; consolidating both copies into `repo_shape.py` is the better long-term home and can ride the next change that has to move the pin anyway. WHAT KEEPS THE TWO COPIES HONEST is a parity test: one table of remote spellings -- scp against https, with and without `.git`, a trailing `/`, a host's case, `file://` against a bare path, a manifest's bare `Org/Repo`, a genuinely different repository and a fork under another owner -- run through BOTH definitions and asserted equal on every pair, with the table itself asserted not to be all one answer. The regression tests sit beside the existing members-row ones: a sibling with this member's id and another origin is reported rather than counted (verdict unchanged, `COMPLIANT`); a real clone still counts, and is compared against the `.gitmodules` url rather than a derived `https://github.com/...`; a clone at the right origin carrying another id is still not the member; an origin spelled scp where the row is `Org/Repo` still matches. `test_a_real_working_clone_ beside_the_holder_is_counted` now CLONES instead of copying the submodule checkout: the `.git` file git leaves in a submodule working tree carries a relative `gitdir:` into the holder's `.git/modules/`, so the old copy was a directory git itself refuses to answer about, and it passed only because nothing asked about origin. That state is now its own test, reported with `siblings.py`'s own `(no origin)` wording. Suite: 1141 passed, 1 skipped. No `--help` text changed, so `docs/cli.md` is untouched; `tests/test_cli_reference.py` was run anyway and is green. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 2 days and 1 hour by commenting @sourcery-ai review. Upgrade to get a review now.
|
@codex review |
Reviewer's GuideThe doctor now agrees with make siblings about whether a directory beside a family holder is the member's working clone: it requires both the expected project ID and an origin matching the holder's mounted repository, normalizes common remote spellings, and reports mismatches without turning them into compliance failures. Sequence diagram for working-clone verificationsequenceDiagram
participant Doctor as shape-doctor.py
participant Holder as Family holder
participant Sibling as Member directory
participant Git as Git config
Doctor->>Holder: mounted_from(root, rel, repository)
Holder-->>Doctor: mounted repository URL
Doctor->>Sibling: is_this_member(sibling, row)
Sibling-->>Doctor: project identity matches
Doctor->>Git: sibling_origin(sibling)
Git-->>Doctor: origin URL or no origin
Doctor->>Doctor: same_repository(origin, mounted repository)
alt origin and project identity match
Doctor-->>Doctor: working_clone = sibling
else wrong origin or no origin
Doctor-->>Doctor: working_clone = none, other_origin = found origin
end
Flow diagram for member-origin reportingflowchart TD
A[Inspect member directory beside holder] --> B{Project identity matches row?}
B -- No --> C[Not a member clone]
B -- Yes --> D[Read origin with sibling_origin]
D --> E{"same_repository(origin, mounted_from)"}
E -- Yes --> F[Count as working_clone]
E -- No --> G[Report other_origin and WRONG ORIGIN context]
E -- No --> H[Keep compliance verdict unchanged]
D --> I[No origin]
I --> G
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
🟡 Changes recommended
Resolve relative .gitmodules URLs against the holder origin before comparison and reporting.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Aligns member working-clone detection with sibling verification by matching repository origins.
Changes:
- Adds remote normalization and comparison helpers.
- Reports clone origins in human-readable and JSON output.
- Adds regression and parity tests.
File summaries
| File | Summary |
|---|---|
tests/test_shape_doctor.py |
Adds origin-matching, normalization, and parity coverage. |
shape-doctor.py |
Adds origin-aware working-clone detection; relative .gitmodules URLs need holder-origin resolution. |
scripts/shape_materialize.py |
Provides remote normalization and repository comparison helpers. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef0e206986
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "detached": loose, "mounted_from": remote, | ||
| "working_clone": clone, "other_origin": elsewhere} |
There was a problem hiding this comment.
Redact credentials from reported remote URLs
When either .gitmodules or the sibling's origin embeds credentials (for example, https://TOKEN@host/...), these raw URLs are stored in detail, which --json serializes verbatim; a mismatched origin is also interpolated into the human-readable row. A doctor run can therefore disclose PATs in terminal output or CI artifacts. Keep the raw values only for comparison and redact URL userinfo before storing or formatting them.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Lane: openreposhape-2 (openRepoShape-2)
Taken, in 8db73d6. redacted lives in scripts/shape_materialize.py beside same_repository: it replaces the userinfo of a scheme-bearing url with *** (https://x-access-token:<pat>@github.com/Org/Repo.git -> https://***@github.com/Org/Repo.git). The RAW value is still what same_repository compares; redaction happens on the way OUT, so both mounted_from and other_origin are redacted before they are stored in detail (which --json serializes) or interpolated into the row's reason. The host and the path survive, which is the whole of what a person needs in order to see which repository it is. The scp spelling git@host:Org/Repo.git carries a user name and no secret — ssh takes no password in a url — and is left legible.
Regression test: test_a_credential_in_an_origin_is_not_printed_or_put_in_the_json — a sibling whose origin is https://x-access-token:[email protected]/Someone/Fork.git is reported as https://***@github.com/Someone/Fork.git, and the token appears nowhere in either --json or the printed report.
| strangers = [f"{entry['project']}: {ctx.root.parent / entry['project']} " | ||
| f"is a clone of {entry['other_origin']}, not of " | ||
| f"{entry['mounted_from']}, so it is not counted as its " | ||
| "working clone (`make siblings` calls the same directory " | ||
| "WRONG ORIGIN and leaves it exactly as it is)" | ||
| for entry in rows if entry["other_origin"]] |
There was a problem hiding this comment.
Report wrong origins when a mounted copy also fails
When any pinned member copy has a problem, such as an uninitialized submodule after a non-recursive clone, members_verdict returns before this new strangers list is constructed. The default report therefore omits the detected wrong-origin sibling and only reveals it after the user bootstraps and reruns the doctor, despite the family workflow requiring a clone of a different repository to be reported and skipped. Append the alternate-origin information to the finding path as well.
AGENTS.md reference: AGENTS.md:L370-L374
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Lane: openreposhape-2 (openRepoShape-2)
Taken, in 8db73d6. strangers is now built before the if problems: return and appended to the FINDING row's reason as well, after the words "and, though it is not what fails this row" — the pinned copies are still the whole of what makes the row red, and the sentence says so rather than letting a layout fact look like a compliance failure. You are right about the sequence it produced: the person would bootstrap the mount, re-run, and only then hear about a clone that had been the wrong one all along.
Regression test: test_a_stranger_is_reported_even_when_a_pinned_copy_also_fails — a member moved off its pin (so the row is FINDING) with a wrong-origin sibling beside the holder, asserting the finding, the disclaimer and the stranger sentence all appear.
…e urls with their separators folded, because git escapes a backslash on the way into a config file (#146) `tests-windows` failed on the first of them and on nothing else. The value under test was RIGHT -- `mounted_from` was `D:\a\_temp\t\family1\remotes\IRRS.git`, exactly the url the holder mounts the member from -- but the assertion looked for that string inside the RAW BYTES of `.gitmodules`, and git escapes a backslash when it writes a config value: the file holds `D:\\a\\_temp\\...` and hands `D:\a\_temp\...` back to whoever reads it through `git config`. Two spellings of one url, and a substring test between them can only fail. So both assertions now compare the value against the path the fixture built, with `\` folded to `/` on both sides -- which is what `same_repository` itself does before it compares two remotes, and the reason this is a test-only defect. The row's reason is asserted to quote whatever origin the doctor FOUND rather than a second spelling of it composed here. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
One critical credential-leak risk and two moderate correctness/reporting issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
shape-doctor.py:2297
- The new
strangersdiagnostic is only appended on the OK path:members_verdictreturns earlier whenever any member has a pin/population problem. A holder with both an invalid mount and a wrong-origin sibling therefore loses the origin explanation from the normal report, even though this change says the row should identify the origin it found. Build this context before the early return and include it with the existing finding reason without changing the verdict semantics.
if strangers:
note += "; " + "; ".join(strangers)
shape-doctor.py:2150
- When
.gitmodulescontains a relative URL such as../IRRS.git,siblings.py::clone_urlresolves it against the holder's origin before verifying the sibling. Returning the raw relative string here makesworking_clonereject a valid clone from a local, mirror, or SSH holder origin because its actual origin matches neither../IRRS.gitnor the barerepository:value. Resolve the relative URL againstrootbefore comparing so the doctor preserves the supported layout and agrees withmake siblings.
return f"https://github.com/{repository}.git"
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
…ved, redacts any credential in one, and says a wrong-origin sibling on the red path too (#146) Three findings from the first review round on PR #147, all of them real. RELATIVE `.gitmodules` URLS (Copilot). `../Repo.git` is not a remote: it is arithmetic against the SUPERPROJECT'S remote, one path component dropped per `..`, and `mounted_from` handed the literal string back. For a family whose holder is not on github.com -- a mirror, an enterprise host -- the sibling's origin then matched neither `../Repo.git` nor the manifest's `Org/Repo`, and a perfectly good working clone was reported as a clone of something else. The fix is not to re-derive the arithmetic. Git HAS already resolved it, into the holder's own `.git/config`, at the moment it initialized the submodule, and that copy is read first: it is the url the mount actually uses, for the mount that actually exists, and a second implementation of git's rule beside it is precisely how a report and `make siblings` come to hold two opinions about one url. `scripts/siblings.py::resolve_relative` does the arithmetic because it is about to CLONE, with no initialized mount to read from; this row has one. `submodule_config` is the shared reader for the two sources -- git's own parser, never a `.gitmodules` text parser, since config syntax escapes a backslash and a Windows path is stored `D:\\a\\...`. A relative url git has NEVER resolved -- a member mounted by hand and never initialized -- is still handed back as it is, and `working_clone` now declines to accuse anybody on the strength of it: the answer falls back to the one this row gave before the origin question existed. Telling somebody their clone is a stranger, on a url the report admits it could not resolve, is worse than the silence it used to keep. CREDENTIALS IN A REPORTED URL (Codex P1, Copilot). Git permits `https://x-access-token:<pat>@host/Org/Repo.git` as a remote and people do use one; `--json` from this command is pasted into issues and kept as a CI artifact. `redacted` (in `scripts/shape_materialize.py`, beside `same_repository`) replaces the userinfo of a scheme-bearing url with `***` before anything is stored in `detail` or printed -- the raw value is still what `same_repository` compares, and the host and path a person needs in order to see which repository it is both survive. The scp spelling `git@host:Org/Repo` carries a user name and no secret, and is left legible. A STRANGER ON THE RED PATH (Codex P2). `members_verdict` returns the finding row before the green wording is composed, so a holder with one unbootstrapped or off-pin mount said nothing at all about the directory beside it: the person would fix the mount, re-run, and only then hear about a clone that had been the wrong one all along. The sentence is now appended to the finding as well, after the words "and, though it is not what fails this row" -- the pinned copies are still the whole of what makes it red. Tests, all beside the existing members-row ones: a credentialed origin is redacted to `***` and the token appears nowhere in `--json` or the printed report; a `../Repo.git` mount on a holder whose remote is a mirror, spelled https in one parametrization and scp in the other and with the sibling spelled the other way each time, is resolved through `git submodule sync` and counted (the assertion on `mounted_from` is what fails without the fix); a relative url with no resolved copy in the holder's config accuses nobody; and a wrong-origin sibling beside a member that is off its pin is reported inside the FINDING row. Suite: 1146 passed, 1 skipped (992 + 154, run in two chunks). No `--help` text changed, so `docs/cli.md` is untouched; `tests/test_cli_reference.py` is green. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
One critical and two moderate origin-matching issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
shape-doctor.py:2167
resolvedis preferred over the URL declared in.gitmodules, butsiblings.py::clone_urluses the declaration first (and only resolves relative entries from it). If a holder's.gitmodulesis updated withoutgit submodule sync, its untracked.git/configcan still contain the old URL; the doctor will then report a sibling cloned from the current declaration asother_origin, whilemake siblingswould accept it. Please make the current.gitmodulesentry authoritative, or otherwise verify the cached config still corresponds to it, and cover the stale-config case.
declared = submodule_config(root, ["-f", str(root / ".gitmodules")])
resolved = submodule_config(root, [])
for name, mount in declared.items():
# A submodule's NAME is its path unless somebody mounted it by hand
# under another one, which git allows and this reads rather than
# assumes.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
…metic against the holder's tracked remote, and a clone with no origin is never counted (#146) The second review round on PR #147, and the first of the two findings undoes a choice the first round made. THE TRACKED DECLARATION IS AUTHORITATIVE, NOT THE CACHE. The previous commit read the url git had already resolved into the holder's `.git/config`, to avoid a second implementation of git's arithmetic sitting beside `siblings.py::resolve_relative`. Copilot pointed out what that costs: the cache is exactly that -- a `.gitmodules` edited without `git submodule sync` leaves the old url in it -- and `make siblings` reads the DECLARATION. A report that read the cache would come to accept a clone the tool refuses, or refuse one it accepts, which is the disagreement this whole issue exists to remove. So the arithmetic is written down instead, in the module that already holds `same_repository` and under the same law: `join_remote`, `remote_is_a_path`, `_up_one` and `resolved_remote` in `scripts/shape_materialize.py`, mirroring `join_relative`, `base_is_a_path`, `_one_level_up` and `resolve_relative` -- one component dropped per `..`, one appended per name, a `..` too many consuming nothing rather than eating a scheme or an scp host, and the separator handed back in the base's own spelling so a Windows remote (which has no `/` in it at all) is walked rather than appended to. The parity test grows a second table: ten `(base, relative url)` pairs run through BOTH implementations and asserted EQUAL AS STRINGS, because a url a person reads off a report and a url a tool fetches from should not even be spelled differently. `mounted_from` is now `.gitmodules` first and `family.yaml`'s `repository:` second -- `clone_url`'s order exactly -- with the declaration resolved against the holder's own `origin`. AND AN UNANSWERABLE REFERENCE IS NOT AN UNANSWERABLE CLONE. The fallback that declines to accuse anybody when the row's url cannot be resolved was accepting a directory with NO readable origin as the working clone -- a dangling `.git` file left by a copied submodule would have counted the moment a family mounted a member with a relative url. It now requires an origin before it excuses one: `verify_sibling` refuses that state too, and the row still calls it `(no origin)`. `sibling_origin` becomes `origin_url` and carries the `.git` guard itself: the holder is asked the same question now -- its remote is what a relative url is resolved against -- and `git remote get-url` in a directory with no repository of its own walks UP to the nearest ancestor, which for `../<Project>` is often the family's own workspace. Tests: the relative-mount test (parametrized over a mirror remote spelled https and spelled scp, sibling spelled the other way each time) now DELIBERATELY does not run `git submodule sync`, so the holder's cached url stays stale and a row reading it would fail the assertion; the no-remote case keeps its silence; and a new test puts an origin-less directory beside a holder whose mount url is relative and asserts it is still reported rather than counted. Suite: 1147 passed, 1 skipped (992 + 155, in two chunks). Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openreposhape-2 (openRepoShape-2) Round 2 answered in 107cce0, including the SUPPRESSED comment on That one was right and it undoes a choice round 1 made. Reading git's cached resolution avoided a second implementation of git's arithmetic — but the cache is exactly that: a So the arithmetic is written down instead, in the module that already holds The other two: the origin-less fallback is fixed (reply on the thread), and the case-folding of path remotes is declined here and filed as #149 — it must change in BOTH copies of the rule at once, and Suite: 1147 passed, 1 skipped. |
…g from the origin question, so the row answers exactly what `verify_sibling` answers (#146) The third review round, and the finding is in a branch this PR invented rather than in anything it inherited. `working_clone` had a fallback: when the member's mount url was a relative `../Repo.git` that could not be resolved -- a holder with no `origin` of its own -- any non-empty sibling origin was accepted, on the reasoning that a row should not accuse anybody on the strength of a url it admits it could not resolve. That skipped the `repository:` comparison sitting immediately above it, so a directory carrying the member's manifest and cloned from `.../SomethingElse.git` was COUNTED as the working clone, while `scripts/siblings.py::verify_sibling` reports that same directory as `WRONG ORIGIN` whether or not the mount url resolved. Which is the whole defect this issue is about, re-created one commit after it was removed. So the branch is gone. An unresolved reference matches nothing, `family.yaml`'s `repository:` -- the other reference `verify_sibling` accepts -- is then the whole of the question, and that is exactly the state `siblings.py` is in for the same holder. The row and the tool cannot disagree about a directory again by this route. The test that asserted the fallback now asserts the parity instead, in both directions: with the mount url unresolvable, a clone from the repository the row NAMES is counted on the manifest's spelling alone, and a clone from somewhere else is reported. Its second half names a host this suite has never used, because a developer's own `url.<base>.insteadOf` rewrites `https://github.com/` on the way into `.git/config` -- the row would then quote a spelling the test never wrote -- and it compares against the url git itself reports rather than the string that was handed to `set-url`. Suite: 1147 passed, 1 skipped (992 + 155, in two chunks). Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
…out of the ONE definition now, and the parity test that held two copies together is an identity assertion (#155) `templates/family-root/scripts/siblings.py` keeps `resolve_relative` — the half that reads the holder's own `origin`, which is the only part of this that touches a machine — and imports the arithmetic from `repo_shape`, which `family.py init` copies in beside it and `contracts/shape-pin.yaml` carries with it. `shape-doctor.py` takes `same_repository`, `resolved_remote` and `redacted` out of its EXISTING guarded `repo_shape` import and keeps `lane_trailer_argument` in the `shape_materialize` one. `scripts/shape_materialize.py` never called any of them — it held them for the doctor while the pin could not move — so what is left there is a pointer to where they went, for the next reader of #146 or #147, and no code. Every message `make siblings` prints is byte-identical and so is every row `shape-doctor.py` reports: the functions moved unchanged except for #149's case rule, which the previous commit argues. THE PARITY TEST WAS THE RIGHT INSTRUMENT FOR TWO COPIES AND THE WRONG ONE FOR A RULE THAT SHOULD HAVE ONE. It ran 14 url pairs and 10 relative-url pairs through both implementations and asserted they answered the same, which can only ever say the two have not drifted YET — never that either is right. It now asserts the doctor's name, the holder's name and `repo_shape`'s are the SAME OBJECT, and then runs both tables against that one function with the answer each row must get, including the rows #149 asks for: a host folds case through every spelling, a filesystem path does not, and a path still matches itself however it is spelled. `tests/test_windows_paths.py` asks the holder's `join_remote` the Windows questions it used to ask `join_relative` — so a holder that stopped importing the shared rule fails there rather than quietly answering out of a second copy — and asks `repo_shape.remote_is_a_path` the path-versus-scp-url question directly. PINNED FILES: `scripts/repo_shape.py` (previous commit) and `templates/family-root/scripts/siblings.py`. Every project and every holder reads `upstream-changed` for them in `update-shape.py check` until its estate re-pins, which is the price #147 named and deferred and this change was told to ride. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
… in scripts/repo_shape.py, and #149's case rule lands with the move (#155) (#156) * scripts/repo_shape.py holds the ONE definition of "do these two remote spellings name the same repository", and #149's case rule lands in it (#155) The rule was written TWICE: `templates/family-root/scripts/siblings.py` is what `make siblings` REFUSES a working clone by (`WRONG ORIGIN`) and `scripts/shape_materialize.py` is what `shape-doctor.py`'s `members` row REPORTS by (#146, #147). The second copy's own section comment says why it was written and what ends it — `repo_shape.py` is the home a rule shared by every tool belongs in, and the price is that it is digest-pinned, so every estate reads `upstream-changed` for it until it re-pins. That price is owed either way now, and #155 is the change that was told to ride it. This commit only ADDS the section; the callers move onto it next, and the two copies go with them. It is placed beside the other shared vocabulary this module owns, because `checked_value` and `SAFE_PATH_RE` already draw the same drive-letter-versus-scp-colon distinction for a value on a git command line. ONE BEHAVIOUR CHANGES WITH THE MOVE, AND ONLY ONE (#149). `same_repository` lowercased the WHOLE normalised remote. For a remote that names a HOST that is right — GitHub treats an owner and a name case-insensitively, and a report that called `https://GitHub.com/Org/Repo` and `https://github.com/org/repo` two repositories would send somebody to delete a good clone over a capitalisation. For a FILESYSTEM PATH it is wrong: `/srv/mirrors/IRRS.git` and `/srv/mirrors/irrs.git` are two different bare repositories on a case-sensitive host, and the estates that mount members from bare repositories on disk are exactly the ones where a remote is a path. So `_remote_names_a_host` asks that question once, and the case is folded only for a host — `<scheme>://host/…`, git's scp `[user@]host:path`, and the bare `Org/Repo` a `family.yaml` row is written as. Strict on every platform, deliberately: Windows and macOS filesystems are case-INsensitive by default, and a report that changed its answer with the machine it ran on would be worse than one that is strict everywhere. Proven against both copies over a corpus of 38 remote spellings and every one of the 1444 ordered pairs: 12 pairs change answer, every one of them two filesystem paths differing only in case, and `join_remote`, `resolved_remote`, `remote_is_a_path` and `redacted` answer identically for every input. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> * siblings.py and shape-doctor.py answer "is this the same repository" out of the ONE definition now, and the parity test that held two copies together is an identity assertion (#155) `templates/family-root/scripts/siblings.py` keeps `resolve_relative` — the half that reads the holder's own `origin`, which is the only part of this that touches a machine — and imports the arithmetic from `repo_shape`, which `family.py init` copies in beside it and `contracts/shape-pin.yaml` carries with it. `shape-doctor.py` takes `same_repository`, `resolved_remote` and `redacted` out of its EXISTING guarded `repo_shape` import and keeps `lane_trailer_argument` in the `shape_materialize` one. `scripts/shape_materialize.py` never called any of them — it held them for the doctor while the pin could not move — so what is left there is a pointer to where they went, for the next reader of #146 or #147, and no code. Every message `make siblings` prints is byte-identical and so is every row `shape-doctor.py` reports: the functions moved unchanged except for #149's case rule, which the previous commit argues. THE PARITY TEST WAS THE RIGHT INSTRUMENT FOR TWO COPIES AND THE WRONG ONE FOR A RULE THAT SHOULD HAVE ONE. It ran 14 url pairs and 10 relative-url pairs through both implementations and asserted they answered the same, which can only ever say the two have not drifted YET — never that either is right. It now asserts the doctor's name, the holder's name and `repo_shape`'s are the SAME OBJECT, and then runs both tables against that one function with the answer each row must get, including the rows #149 asks for: a host folds case through every spelling, a filesystem path does not, and a path still matches itself however it is spelled. `tests/test_windows_paths.py` asks the holder's `join_remote` the Windows questions it used to ask `join_relative` — so a holder that stopped importing the shared rule fails there rather than quietly answering out of a second copy — and asks `repo_shape.remote_is_a_path` the path-versus-scp-url question directly. PINNED FILES: `scripts/repo_shape.py` (previous commit) and `templates/family-root/scripts/siblings.py`. Every project and every holder reads `upstream-changed` for them in `update-shape.py check` until its estate re-pins, which is the price #147 named and deferred and this change was told to ride. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> * A RELATIVE remote is a filesystem path too, and the trailing `owner/repo` fallback is a forge question, so a mirror clone is no longer called WRONG ORIGIN over a capitalisation (#155) Both halves came out of the review on PR #156 (Copilot twice, Codex the first one as a P1), and both are places where #149's rule as first written either did not reach or reached too far. A RELATIVE PATH IS A PATH. `_remote_names_a_host` called anything that was not absolute and not a Windows drive a host, so `../mirrors/Fam.git` — which is what `git remote get-url origin` answers in a holder cloned from a relative local remote — was lowercased, and `../IRRS.git` and `../irrs.git` were one repository again on a case-sensitive disk. That is the exact false positive #149 is about, so `./` and `../` join the absolute path, the `file://` url with an empty authority and the Windows drive in the path branch, and `remote_is_a_path` — the separator half of the rule — has always called them paths, so the two halves now agree about every spelling. THE BARE TWO-SEGMENT FORM STAYS A FORGE NAME, deliberately and as the one thing here that cannot be decided from the string: `mirrors/Fam.git` might be a directory under wherever the process is standing, but `Org/Repo` is what every manifest in this standard writes, and git requires the `./` of anybody who means a path from somewhere. The docstring says so where the decision is. THE TAIL IS A FORGE QUESTION UNLESS BOTH SIDES ARE PATHS. `same_repository` falls back to the trailing `owner/repo` of the reference, and preserving the case of a path broke that for a normal mirror layout: a clone whose origin is `/srv/mirrors/InkRouter/IRRS.git` was matched against the row's bare `InkRouter/IRRS`, which folds — so the suffix check failed and `make siblings` would have reported the InkRouter estate's own layout as `WRONG ORIGIN`. The tail now compares case-insensitively whenever either side names a host or a forge repository, and strictly when both sides are paths, where the filesystem is the only authority there is. The rows for all three findings are in the table: `../IRRS.git` != `../irrs.git`, `../mirrors/Repo.git` != `../mirrors/repo.git`, `/srv/mirrors/InkRouter/IRRS.git` == `InkRouter/IRRS` (and with the case swapped, and in either argument order, and from a relative mirror), `/srv/mirrors/InkRouter/Other.git` != `InkRouter/IRRS` so the fold cannot make everything match, and `/srv/mirrors/InkRouter/IRRS.git` != `/srv/mirrors/inkrouter/irrs.git` because two paths compare strictly through the tail as well. Re-proven against the copy on `main` over 45 remote spellings and all 2025 ordered pairs: 29 pairs differ, every one of them main=True head=False with TWO FILESYSTEM PATHS on it, and every one of them answers True again when both sides are lowercased — the case fold and nothing else. No pair gained a True, and `join_remote`, `resolved_remote`, `remote_is_a_path` and `redacted` answer identically to main for every input. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>



Lane: openreposhape-2 (openRepoShape-2)
Claim: #146 (comment)
Closes #146.
What was wrong
shape-doctor.py'sis_this_memberdecided that the directory beside a familyholder IS that member on the strength of
project.yamlalone — a gitrepository, a
project-manifest, anidmatching the row — and never lookedat where the clone came from.
The family's OWN verifier asks two questions, not one.
templates/family-root/scripts/siblings.py::verify_siblingrefuses a clonewhose
originis not the row's remote asWRONG ORIGINbefore it comparesan id, and refuses a matching origin with a different id as
WRONG PROJECT. Soa fork, a stale clone of a repository that has since been renamed, or any
second copy of the same project from another remote was reported as
working_cloneby the doctor and calledWRONG ORIGINbymake siblings—the report and the tool disagreeing about one directory on one disk, which is
the one thing a command whose every row is somebody else's check must not do.
is_this_member's own docstring already claimed the two asked the samequestion; it was half true.
Found by Copilot on PR #142 and left alone there under that PR's
"behaviour byte-identical" law.
What landed
No digest-pinned file is touched. An estate re-pin is in flight, and a line
in
scripts/repo_shape.pyor undertemplates/would put every projectupstream-changedagain the moment it landed.scripts/shape_materialize.pygainsremote_keyandsame_repository— thedoctor's half of the "is this the same repository" definition, mirroring
siblings.py::same_repository's semantics (scheme, credential prefix, scpcolon, trailing
/,.gitsuffix and host case all folded; a manifest'sbare
Org/Repomatched by its tail).shape-doctor.pyimports nothing outof
templates/, andscripts/repo_shape.py— where ONE shared definitionbelongs — is digest-pinned; this module is already the doctor's one
non-pinned import for exactly that reason (the lane trailer, update-shape.py apply --branch and family.py bump write commits with no Lane:/Co-Authored-By trailers; add a repeatable --trailer #111) and
scripts/family.pyimports it too, which is where the second caller isexpected to come from. Consolidating both copies into
repo_shape.pyisthe better long-term home and can ride the next change that has to move the
pin anyway — the section comment in
shape_materialize.pysays so outloud, so a later PR does not have to re-derive the reasoning.
shape-doctor.py:sibling_origin(git remote get-url origin, which reads.git/configand talks to nothing),mounted_from(the url the holderMOUNTS the member from —
.gitmodulesfirst andfamily.yaml'srepository:second, which isclone_url's order and therefore the remotean estate mounted from a mirror, an SSH host or a bare repository on disk
actually names), and
working_clone, which asks both ofverify_sibling'squestions and accepts either spelling of the remote exactly as it does.
member_statecalls it; theLABEL_*constants,member_problemand the#134split are untouched.with no working clone beside the holder is unchanged — where somebody keeps
their checkouts is the workstation's layout, not a compliance fact about the
repository. What changes is that the row now SAYS which origin it found
(
IRRS: <path> is a clone of <origin>, not of <the url the holder mounts it from>), because "no working clone beside the holder for IRRS", said about adirectory named
IRRSsitting right there, is the sentence that sends aperson looking for a bug in this command. The
--jsonmember entry gainsmounted_fromandother_originbesideworking_clone.How it was proven
tests/test_shape_doctor.py, beside the existing members-row tests:test_a_sibling_with_this_members_id_but_another_origin_is_not_counted— thedefect itself: this member's manifest, another origin; not counted, the
origin named in the row, verdict still
ok/COMPLIANT.test_a_real_working_clone_beside_the_holder_is_counted— the otherdirection, and it now CLONES instead of copying the submodule checkout: the
.gitFILE git leaves in a submodule working tree carries a relativegitdir:into the holder's.git/modules/, so the old copy was a directorygit itself refuses to answer about (
fatal: not a git repository) and itpassed only because nothing asked about origin. It also asserts the url
compared against came out of
.gitmodulesrather than fromhttps://github.com/<repository>.git.test_a_sibling_at_the_right_origin_with_another_id_is_not_the_member— theWRONG PROJECThalf, still asked.test_an_origin_spelled_scp_where_the_row_is_https_is_the_same_clone— thenormalisation, end to end: without it this fix would have turned a false
positive into a false negative on every clone spelled
[email protected]:....test_a_directory_that_is_not_a_clone_at_all_is_not_called_a_stranger— thecopied-submodule state, reported with
siblings.py's own(no origin)wording.
test_the_doctor_and_siblings_agree_on_what_one_repository_is— the paritytest: one table of remote spellings (scp vs https, with and without
.git,a trailing
/, host case,file://vs a bare path, a manifest's bareOrg/Repo, a genuinely different repository, a fork under another owner) runthrough BOTH definitions and asserted equal on every pair, with the table
itself asserted not to be all one answer. The two copies cannot drift in
silence.
Every one of the six fails against the unfixed
shape-doctor.pyandshape_materialize.py(checked by reverting both files and re-running).Whole suite from the worktree, foreground: 1141 passed, 1 skipped (1136 + 5
new). No
--helptext changed, sodocs/cli.mdis untouched;tests/test_cli_reference.pywas run anyway — 13 passed.🤖 Generated with Claude Code
Summary by Sourcery
Align shape-doctor member detection with sibling verification by requiring the correct repository origin and reporting mismatches without turning them into compliance failures.
New Features:
Bug Fixes:
Enhancements:
Tests: