Repository navigation
same_repository compares two filesystem paths by EXACT equality, so /srv/a/IRRS.git and /other/a/IRRS.git stop being one repository, and the symlinked-prefix case moves to the two callers that own a disk (#157) - #160
Conversation
…srv/a/IRRS.git and /other/a/IRRS.git stop being one repository, and the symlinked-prefix case moves to the two callers that own a disk (#157) The trailing `owner/repo` fallback matched ANY two remotes whose last two path components agreed, whatever stood in front of them, so two bare repositories under different roots were one repository. It reached `templates/family-root/scripts/siblings.py::verify_sibling`, which FETCHES into a directory it accepts and dispatches `make park`/`make resume` inside it, and `shape-doctor.py`'s `members` row, which reported it as the member's working clone. Copilot raised it on PR #156 and it was declined there on purpose: #155's law was that behaviour is byte-identical apart from #149's case rule, and this answer was the same before and after it. THE RULING, recorded on the issue before this was written (#157 (comment)): shape 2, exact equality when both sides are paths. * The tail is a FORGE question and only a forge question. In a forge name the two trailing components ARE the whole identity -- `Org/Repo` is an owner and a repository with nothing in front of it to lose -- while in a path everything in front of the tail is part of the identity. So a host against a host, a path against a host, and a path against the bare `Org/Repo` a `family.yaml` row is written as all answer exactly what they answered before; two paths must now be the SAME path. * `/srv/mirrors/InkRouter/IRRS.git` is still matched against the row's bare `InkRouter/IRRS`, case-folded. Dropping that would call every clone in a mirror-based estate `WRONG ORIGIN` -- the InkRouter estate's own layout -- and it is safe for the same reason the path case is not: a forge name has no prefix to throw away. * ONE DIRECTORY REACHED THROUGH A SYMLINK is `/var/folders/...` through one path and `/private/var/folders/...` through the other on macOS, which is how this suite's own fixtures reach one, and the tail match is what made the doctor and `make siblings` agree about it. Only a machine can answer that, and `scripts/repo_shape.py` may not touch a disk -- the promise that lets `tests/test_windows_paths.py` ask the Windows questions from Linux. So the module gains the PURE half, `remote_local_path` (which spelling names a path, and what path it names, None for a host remote and None for a relative one that `realpath` would resolve against wherever the process is standing), and `siblings.py::local_spelling` and `shape-doctor.py::local_spelling` are the three lines of `os.path.realpath` on the side that has the disk. Proven against the copy on `main` at b83ba5c over every ordered pair of 54 remote spellings: 62 of 2916 differ, every one of them `main=True head=False` with TWO FILESYSTEM PATHS on it, none gained a True, and `remote_key`, `remote_is_a_path`, `redacted`, `join_remote` and `resolved_remote` answer identically to `main` for every input. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 1 day and 14 hours by commenting @sourcery-ai review. Upgrade to get a review now.
Reviewer's GuideChanges repository identity semantics so two filesystem remotes match only when their normalized paths are equal, while retaining forge-based fallback matching. Symlink equivalence is intentionally resolved only by shape-doctor and siblings, which own the relevant disk, with shared pure path classification and regression tests covering both behaviors. Sequence diagram for disk-aware symlink comparisonsequenceDiagram
participant Caller as ShapeDoctorOrSiblings
participant Pure as repo_shape
participant Disk as LocalFilesystem
participant Identity as same_repository
Caller->>Pure: remote_local_path(origin)
Caller->>Pure: remote_local_path(mount)
Pure-->>Caller: Absolute paths or None
Caller->>Disk: os.path.exists(path)
Disk-->>Caller: Path exists
Caller->>Disk: os.path.realpath(path)
Disk-->>Caller: Symlink-resolved spelling
Caller->>Identity: same_repository(resolved_origin, resolved_mount)
Identity-->>Caller: Compare normalized path keys
Flow diagram for repository identity comparisonflowchart TD
A["same_repository(one, two)"] --> B["remote_key(one) == remote_key(two)"]
B -->|yes| C["True"]
B -->|no| D{"Both remotes are filesystem paths?"}
D -->|yes| E["False"]
D -->|no| F["Compare trailing owner/repo case-insensitively"]
F --> G["Forge or path-to-forge match result"]
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
Three moderate findings and one test-coverage nit remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR prevents distinct filesystem paths from being treated as the same repository while preserving forge matching and handling symlinked local paths.
Changes:
- Restricts filesystem comparisons to exact normalized paths.
- Adds caller-side local path resolution for sibling and doctor checks.
- Expands path, URL, Windows, and symlink test coverage.
File summaries
| File | Changes | Findings |
|---|---|---|
tests/test_shape_doctor.py |
Adds repository identity and symlink tests. | Nit (3 votes): Does not exercise working_clone or verify_sibling end to end. |
templates/family-root/scripts/siblings.py |
Resolves local paths before sibling verification. | Moderate (1 vote): Gate inspection with os.path.isabs() to avoid treating Windows paths as relative on POSIX. |
shape-doctor.py |
Resolves local paths before working-clone comparison. | Moderate (1 vote): Gate inspection with os.path.isabs() to avoid treating Windows paths as relative on POSIX. |
scripts/repo_shape.py |
Adds pure local-path extraction and exact filesystem identity matching. | Moderate (2 votes): Normalize Windows file:///D:/... URLs and add regression coverage. |
Review details
Suppressed comments (2)
shape-doctor.py:2275
remote_local_pathdeliberately returns Windows drive spellings even when the pure rule is exercised on POSIX, but on POSIXos.path.exists('D:/...')treats that value as a relative path. If the current directory contains a matchingD:tree, this can resolve an unrelated local path and change the report; gate this withos.path.isabs(path)so only paths absolute for the running platform are inspected.
if path and os.path.exists(path):
templates/family-root/scripts/siblings.py:245
remote_local_pathdeliberately returns Windows drive spellings even when the pure rule is exercised on POSIX, but on POSIXos.path.exists('D:/...')treats that value as a relative path. If the current directory contains a matchingD:tree, this can resolve an unrelated local path and change the origin decision; gate this withos.path.isabs(path)so only paths absolute for the running platform are inspected.
if path and os.path.exists(path):
- Files reviewed: 4/4 changed files
- Comments generated: 2
- 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: db7323669b
ℹ️ 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".
| # `repository:` is a bare `Org/Repo` and names no directory to resolve. | ||
| here, mount = local_spelling(origin), local_spelling(url) | ||
| if not same_repository(here, mount) and not ( | ||
| repository and same_repository(here, repository)): |
There was a problem hiding this comment.
Preserve the original path for the repository fallback
When an existing member clone uses a symlinked mirror whose target has a different tail—for example, /mirrors/InkRouter/IRRS.git points to /storage/uuid-123.git—local_spelling(origin) removes the InkRouter/IRRS identity before this manifest fallback runs. The previous comparison accepted that clone through the row's repository: InkRouter/IRRS, but this now marks it WRONG ORIGIN; make siblings, park/resume dispatch, and the doctor consequently skip or omit a valid working clone. Use the canonicalized value only for the path-to-path comparison and retain the original origin for the repository-name fallback.
AGENTS.md reference: AGENTS.md:L383-L387
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Lane: openreposhape-2 (openRepoShape-2)
Taken in c3a0b4d — this was real, and it is the finding that changed the shape of the fix.
A mirror is allowed to BE a symlink onto a storage path whose own tail is a serial number, and the row's repository: InkRouter/IRRS is matched BY the origin's tail, so resolving the origin before that fallback threw the name away and called a good clone WRONG ORIGIN.
Rather than resolve one side and not the other, the two callers now hold ONE function, same_repository_here, which asks repo_shape.same_repository FIRST and the disk only when it has said no. Resolution can therefore only ADD an answer and never take one away, which is the property that makes it safe to apply at all. The repository: comparison beside it is asked of the origin exactly as git reported it — which is also the spelling the WRONG ORIGIN finding quotes back to the human.
tests/test_shape_doctor.py::test_working_clone_and_verify_sibling_ACCEPT_a_symlinked_mirror is your scenario, built: <tmp>/B/mirrors/InkRouter/IRRS.git is a symlink onto <tmp>/B/storage/uuid-123.git, the mount names a path that is not on the disk at all, and both working_clone and verify_sibling must still accept the clone through the row. Mutation-checked: asking that fallback with a resolved origin fails exactly that case.
…er that asks the STRING rule first, so resolving a symlink can add an answer and never take one away, and `file:///D:/mirrors/Fam.git` folds to the Windows path it names (#157) Three findings from the first review round, all taken. CODEX (P2, `siblings.py`): a mirror is allowed to BE a symlink onto a storage path whose own tail is a serial number -- `/mirrors/InkRouter/IRRS.git` -> `/storage/uuid-123.git` -- and the row's `repository: InkRouter/IRRS` is matched BY the origin's tail. Resolving the origin before that fallback threw the name away and called a good clone `WRONG ORIGIN`. The two callers now hold ONE function, `same_repository_here`, which asks `same_repository` first and the disk only when it has said no; the `repository:` comparison beside it is asked of the origin exactly as git reported it. Resolution can therefore only ADD an answer, which is the property that makes it safe to apply at all. COPILOT (moderate, both callers): on POSIX `os.path.exists("D:/mirrors/x.git")` asks about a directory named `D:` under whatever the process is standing in, so a `realpath` there could resolve an unrelated local path. Only a path that `os.path.isabs` calls absolute ON THIS PLATFORM is inspected now. COPILOT (moderate, `repo_shape.py`): `file:///D:/mirrors/Fam.git` is the file url RFC 8089 blesses and git accepts, and stripping `file://` left `/D:/mirrors/Fam.git` -- a leading `/` that belongs to the url, not to the path. It was the one spelling of a Windows remote that did not fold to `D:\mirrors\Fam.git`'s key. `_remote_body` drops it, so every question below it -- `_remote_names_a_host`, `remote_key`, `remote_local_path` -- answers about the same path, and `same_repository`'s answer for every pair is unchanged (`main` reached the same True through the tail). COPILOT (nit, tests): the regression test called the helper and never the callers. `test_working_clone_and_verify_sibling_ACCEPT_a_symlinked_mirror` drives `shape-doctor.py::working_clone` and `siblings.py::verify_sibling` over both shapes a symlink makes -- a mirror reached through a symlinked PREFIX, which only the disk can accept, and a mirror that IS a symlink onto a storage path, which only the unresolved `repository:` fallback can accept -- and asserts both callers refuse a stranger at the same path. Mutation-checked: with the disk half removed both cases fail, and with the `repository:` fallback asked of a resolved origin the second one fails. Differentially against `main` at b83ba5c over every ordered pair of 59 remote spellings: 66 of 3481 differ, every one `main=True head=False` with TWO FILESYSTEM PATHS on it, none gained a True. `remote_key` differs for exactly the four empty-authority-drive spellings and for nothing else; `remote_is_a_path`, `redacted`, `join_remote` and `resolved_remote` are identical for every input. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Drive-prefix normalization can conflate distinct filesystem paths, and the documented parity claim also needs correction.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
scripts/repo_shape.py:1804
- The PR description says the differential found only path/path answer changes and that
remote_keyis identical tomainfor every input. This hunk changes_remote_bodyforfile:///D:/..., soremote_keynow returnsD:/...instead of the old/D:/...for those spellings;same_repositorymay still return the same boolean via its fallback, but the claimed pure-function parity is not true. Please update the proof/description to account for this additional behavior change.
if text[:1] == "/" and REMOTE_DRIVE_RE.match(text[1:3]):
text = text[1:] # file:///D:/mirrors/Fam.git
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
…ows drive, so a POSIX directory called `D:` stays the path it is rather than folding into the drive of the same three characters (#157) Copilot, round 2: the normalisation `_remote_body` gained for `file:///D:/mirrors/Fam.git` was applied to EVERY body that began `/<drive>:`, not only to one a scheme had just been taken off. `/D:/mirrors/IRRS.git` written as a path is a directory called `D:` under a POSIX root -- absurd, and somebody's -- and folding it into the Windows drive `D:/mirrors/IRRS.git` would have reported two paths that no single machine could even both hold as one repository. The `/` that comes off is the URL's, so it comes off only when there was a scheme to leave it behind. Two rows say so: `/D:/mirrors/IRRS.git` is neither `D:/mirrors/IRRS.git` nor `file:///D:/mirrors/IRRS.git`. The differential against `main` at b83ba5c over every ordered pair of 59 spellings now reads: 74 of 3481 differ, every one `main=True head=False` with TWO FILESYSTEM PATHS on it, 72 of them a TAIL match `main` made over unequal keys and the other 2 the `/D:/` versus `file:///D:/` pair in both orders, which `main` called equal keys. No pair gained a True. `remote_key` differs for exactly the three `file:///<drive>:/` spellings and for nothing else; `remote_is_a_path`, `redacted`, `join_remote` and `resolved_remote` are identical for every input. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
… template) into fix/same-repository-path-tail CLEAN, AND BOTH SIDES OF THE TWO FILES THAT OVERLAP ARE KEPT. `#159` (ba14e1d) moved `shape-doctor.py`'s behind-pin clause into `what_a_re_pin_would_move` and appended a test to `tests/test_shape_doctor.py`; this branch adds `same_repository_here` beside `working_clone` in the same file and rows plus two tests to the same suite. The hunks do not touch each other, so git merged them and every test from both sides runs below. Merged rather than rebased: the branch is pushed and the repository ruleset refuses a force-push. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Correct the Windows drive-letter test to construct file:///C:/... and cover the intended normalization.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
…actually exercises the `file:///C:/...` fold it claims to, and `_remote_body` asks `startswith` rather than a slice (#157) Copilot, round 3, and it is right about what the assertion was worth on Windows: `"file://" + through_link` builds `file:///tmp/...` on POSIX and `file://C:/...` on Windows -- a url with `C:` for an AUTHORITY, which is not the empty-authority spelling 8a7c042's fold is about. That body reaches `_remote_body` with no leading slash at all, so it took the other road through the same function and the assertion passed on `windows-latest` without exercising the line it exists for. The url is built as `"file:///" + <path with any leading slash stripped>` now, which is `file:///tmp/...` on POSIX and `file:///C:/Users/...` on Windows -- both the empty-authority form -- and the test asserts the three slashes are there before it asks the question, so a future edit to that expression fails here rather than quietly stopping covering anything. And SonarCloud's python:S6659 on the PR (MINOR, `scripts/repo_shape.py`): the scheme guard asks `text.startswith("/")` rather than slicing one character off it. Same answer, one open issue fewer, and the PR-scoped query is clean again. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The two moderate findings require Windows directory symlink creation to pass target_is_directory=True.
Review details
Suppressed comments (2)
tests/test_shape_doctor.py:1851
- On Windows,
os.symlinkdefaultstarget_is_directory=False, but this source is a directory. The test can therefore create a file symlink (or fail when traversinglink/remotes) instead of exercising the path comparison; passtarget_is_directory=True(which is ignored on POSIX).
os.symlink(tmp_path / "private", link)
tests/test_shape_doctor.py:1934
- Both symlink targets here are directories, but Windows needs
target_is_directory=Truewhen creating directory symlinks. Without it, this end-to-end regression can fail on Windows after the symlink call or cannot traverse the created link, so it does not provide the claimed cross-platform coverage.
os.symlink(prefix, tmp_path / "A-link")
os.symlink(serial / "storage" / "uuid-123.git",
serial / "mirrors" / FAMILY_NAME / f"{FAMILY_MEMBER}.git")
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Lite
…s too, which is the only kind either fixture can be walked through (#157) Copilot, round 4 (two suppressed findings, both real). `os.symlink` defaults `target_is_directory=False`, and on Windows that writes a FILE symlink: a mirror tree reached as `link/remotes/IRRS.git` and a bare repository reached as `mirrors/InkRouter/IRRS.git` are then not reachable at all, so a runner that HAS the privilege would fail these tests rather than ask their question. The argument is ignored on POSIX, where a symlink is a symlink, so this costs the two legs that run today nothing. Today both tests SKIP on `windows-latest` -- creating one needs Developer Mode or an elevated shell, and the skip says so -- which is why this has never shown. It is still what the tests claim, and a claim that is only true on two of three platforms is the thing this repository's suite is not allowed to make. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openreposhape-2 (openRepoShape-2) Copilot's latest round raised two findings as SUPPRESSED comments (no inline threads to reply on), so the answer is here: both taken, in b731d96.
Worth recording what the state actually was: both tests SKIP on Suite on the merged tree after the change: 1191 passed, 1 skipped, 0 failed. |
|
| if text != stripped and text.startswith("/") and REMOTE_DRIVE_RE.match( | ||
| text[1:3]): | ||
| text = text[1:] # file:///D:/mirrors/Fam.git |
There was a problem hiding this comment.
Lane: openreposhape-2 (openRepoShape-2)
Declined — this one does not reproduce, and the row at tests/test_shape_doctor.py:1750 is green on all three platforms at b731d96.
The step the reading skips is remote_key's scp-colon replacement, which happens AFTER _remote_body and only when the first component carries a colon. Asked of the head of this branch:
_remote_body('/D:/mirrors/IRRS.git') = '/D:/mirrors/IRRS.git'
_remote_body('file:///D:/mirrors/IRRS.git') = 'D:/mirrors/IRRS.git'
remote_key('/D:/mirrors/IRRS.git') = 'D:/mirrors/IRRS'
remote_key('file:///D:/mirrors/IRRS.git') = 'D//mirrors/IRRS'
same_repository(one, two) = False
For the URL form the fold leaves D:/…, whose first component IS D:, so remote_key turns that one colon into a / — the same arithmetic that has always given D:\\mirrors\\IRRS.git the key D//mirrors/IRRS, which is exactly why the url and the backslash spelling are one repository. For the raw POSIX path the first component is EMPTY (the string starts with /), no colon is replaced, and .strip("/") leaves D:/mirrors/IRRS with its colon intact. Two different keys, and the discriminator you ask for is the colon itself.
tests/test_shape_doctor.py::test_the_doctor_and_siblings_run_ONE_definition_of_one_repository asserts both rows (/D:/mirrors/IRRS.git is neither D:/mirrors/IRRS.git nor file:///D:/mirrors/IRRS.git, while file:///D:/mirrors/IRRS.git is still D:\\mirrors\\IRRS.git) and passes; a False row that answered True would fail there rather than be believed. No code change.



Lane: openreposhape-2 (openRepoShape-2)
Claim: #157 (comment)
Closes #157.
The RULING this implements was recorded on the issue before a line of code was
written, because the choice #157 asks for is a ruling and not a refactor:
#157 (comment)
What was wrong
same_repository's trailingowner/repofallback matched ANY two remoteswhose last two path components agreed, whatever stood in front of them, so two
bare repositories under different roots were one repository:
It reached
templates/family-root/scripts/siblings.py::verify_sibling, whichFETCHES into a directory it accepts and dispatches
make park/make resumeinside it, and
shape-doctor.py'smembersrow, which reported it as themember's working clone. Copilot raised it on PR #156
(#156 (comment)) and
it was declined THERE on purpose: #155's law was that behaviour is
byte-identical apart from #149's case rule, and this answer was the same before
and after it.
What landed
1.
scripts/repo_shape.py(DIGEST-PINNED).same_repository's tailfallback is now a FORGE question and only a forge question: when BOTH sides are
filesystem paths the normalised keys must be EQUAL and no tail is tried.
The difference is not arbitrary. In a forge name the two trailing components
ARE the whole identity —
Org/Repois an owner and a repository, with nothingin front of it to lose — while in a path everything in front of the tail is
part of the identity, and a fallback that drops it calls two bare repositories
under two roots one repository. "A path" is the four-way question
_remote_names_a_hostalready answers for #149 (absolute,file://with anempty authority, a Windows drive, or a relative
./or../), so a path stillmatches its own
file://spelling, which is one key rather than a tail match.Everything else answers exactly what it answered on
main, deliberately:https://github.com/Org/Repo.gitversushttps://gitlab.example/Org/Repo— is what the fallback was written for;Org/Repoafamily.yamlrepository:row iswritten as, case-folded:
/srv/mirrors/InkRouter/IRRS.gitversusInkRouter/IRRSis the InkRouter estate's own layout, and dropping it wouldcall every clone in a mirror-based estate
WRONG ORIGIN. It is safe for thesame reason the path case is not — a forge name has no prefix to throw away
— and it stays case-insensitive because the row was typed by a human and is
case-insensitive at the forge, which is the fault same_repository folds the case of a filesystem path, so two bare repositories on a case-sensitive host that differ only in case are called one repository #149 is against and not
for.
2. The macOS prefix case moved to the CALLERS, which is where the disk is.
One directory reached through a symlink answers as
/private/var/folders/…through one path and
/var/folders/…through the other, this suite's ownfixtures reach one through both, and the tail match is what made the doctor and
make siblingsagree about it. Only a machine can say those are one directory,and nothing in
repo_shape.pymay touch a disk — the promise that letstests/test_windows_paths.pyask the Windows questions from Linux. So:repo_shape.pygains the PURE half,remote_local_path: which spellingnames a path and what path it names,
Nonefor a host remote andNonefora relative one, because
../mirrors/Fam.githanded torealpathwouldresolve against whatever directory the process is standing in — the trap
resolve_relativeexists to avoid;templates/family-root/scripts/siblings.py(DIGEST-PINNED) andshape-doctor.pyeach gainsame_repository_here, the same seven lines inboth: it asks
same_repositoryFIRST and the disk only when that has saidno, so resolving a symlink can ADD an answer and never take one away. Only a
path that
os.path.isabscalls absolute on THIS platform and that existshere is resolved.
verify_siblingandworking_cloneask it for the MOUNTcomparison; the row's
repository: Org/Repois asked of the origin exactlyas git reported it, because a mirror may be a symlink onto a storage path
whose own tail is a serial number and that row is matched BY its tail. The
findingand the--jsonrow still quoteoriginas git reported it too.3.
file:///D:/mirrors/Fam.gitfolds to the Windows path it names. Thatspelling is the file url RFC 8089 blesses and git accepts, and taking
file://off it left
/D:/mirrors/Fam.git— a leading/that belongs to the URL andnot to the path, and the one spelling of a Windows remote that did not fold to
D:\mirrors\Fam.git's key._remote_bodydrops it, so_remote_names_a_host,remote_keyandremote_local_pathall answer about the same path. Only aurl's own leading
/comes off, though (Copilot, round 2): a remote with noscheme never had one, and
/D:/mirrors/IRRS.gitwritten as a PATH is adirectory called
D:under a POSIX root, not the Windows drive of the samethree characters.
The pinned-copy consequence, named as the brief requires. The two pinned
files touched are
scripts/repo_shape.pyandtemplates/family-root/scripts/siblings.py. Every project and every familyholder reads
upstream-changedfor them inupdate-shape.py checkuntil itsestate re-pins; the re-pin is the orchestrator's and is owed after this lands.
One documented behaviour that was not true before and is now. A
.gitmodulesurl spelled../Repo.giton a holder with NO remote of its owncannot be resolved, and
mounted_from's docstring says it "then matchesnothing, and the row's answer rests on the
repository:comparison alone".Under the old fallback an unresolved relative url could still tail-match a path
originby accident (../a/IRRS.gitversus/srv/a/IRRS.gitwasTrue); itnow matches nothing, exactly as documented.
How it was proven
mainat b83ba5c, by the method PRThe two copies of "is this the same repository" become ONE definition in scripts/repo_shape.py, and #149's case rule lands with the move (#155) #156 used: both modules loaded side by side and asked every ordered pair of
59 remote spellings — 3481 pairs. 74 differ, every one of them
main=True head=Falsewith TWO FILESYSTEM PATHS on it, and no pair gaineda
True: 72 are a tail matchmainmade over unequal keys, and the other2 are
/D:/remotes/Fam.gitagainstfile:///D:/remotes/Fam.gitin bothorders, which
mainfolded to one key and this tells apart.remote_is_a_path,redacted,join_remoteandresolved_remoteansweridentically to
mainfor every input and every ordered pair;remote_keydiffers for exactly the three
file:///<drive>:/spellings and for nothingelse.
tests/test_shape_doctor.py::test_the_doctor_and_siblings_run_ONE_definition_of_one_repositorykeeps every row it had and gains: the two pairs same_repository's trailing owner/repo fallback calls any two remotes that share their last two components one repository, so /srv/a/IRRS.git and /other/a/IRRS.git are the same clone #157 names, plus their
file://, relative and Windows spellings (file:///srv/a/IRRS.gitvs/other/a/IRRS.git,../a/IRRS.gitvs../../other/a/IRRS.git,D:\a\IRRS.gitvsD:\other\a\IRRS.git), allFalse; and the rows same_repository's trailing owner/repo fallback calls any two remotes that share their last two components one repository, so /srv/a/IRRS.git and /other/a/IRRS.git are the same clone #157deliberately leaves alone —
https://github.com/Org/Repo.gitvshttps://gitlab.example/Org/Repoand[email protected]:Org/Repo.gitvshttps://forge.example/Org/Repo.git, bothTrue; and the Windows file url(
file:///D:/mirrors/IRRS.git==D:\mirrors\IRRS.git, ==D:/mirrors/IRRS.git, !=D:\mirrors\Other.git) with the raw POSIX pathbeside it (
/D:/mirrors/IRRS.gitis neither of those). The identityassertions now cover
remote_local_pathin both tools as well.tests/test_shape_doctor.py::test_a_symlinked_prefix_is_ONE_directory_to_both_callersis the prefix case, built from a REAL symlinked directory so it runs on every
platform that can make one rather than only on the macOS runner: the pure
rule answers
Falsefor the two spellings, both callers'same_repository_hereanswer
Truein either order and through thefile://spelling, and everypair that does not need a disk — a host remote, a relative one, a path that
is not here, two directories that really are two, the empty string — answers
exactly what
same_repositoryanswers.tests/test_shape_doctor.py::test_working_clone_and_verify_sibling_ACCEPT_a_symlinked_mirroris the END-TO-END test of the two callers themselves (Copilot, round 1), over
a real clone whose
originis spelled through a real symlink and over thetwo shapes a symlink makes: a mirror reached through a symlinked PREFIX,
which only the resolved comparison can accept, and a mirror that IS a symlink
onto a storage path, which only the unresolved
repository:fallback canaccept. Both callers must accept both and must still refuse a stranger's
clone at the same path. Mutation-checked: with the disk half removed both
cases fail, and with the
repository:fallback asked of a resolved originthe second fails.
fixtures mount members from bare repositories in a temporary directory, which
is exactly the
/private/var/folders/…versus/var/folders/…pair.1191 passed, 1 skipped, 0 failed (
tests/test_[a-m]*.py+tests/test_[n-r]*.py725 passed 1 skipped,tests/test_[s-z]*.py466passed). No tool's
--helpchanged, sodocs/cli.mdis untouched.origin/mainis MERGED in at 1f82b42, not rebased onto — the branch ispushed and the ruleset refuses a force-push. The doctor's behind-pin row,
apply's README phase order and the classifier's untested decode arm: PR #152's last three Copilot findings, taken (#158) #159 (ba14e1d) movedshape-doctor.py's behind-pin clause intowhat_a_re_pin_would_moveandappended a test to
tests/test_shape_doctor.py, where this branch addssame_repository_herebesideworking_cloneand rows plus two tests; thehunks do not touch each other, git merged them clean, and both sides' tests
run in the count above.
with SonarCloud's PR-scoped query returning 0 open issues.
The review
Round 1: Copilot twice (one moderate on
repo_shape.py, one moderatesuppressed on both callers, one test-coverage nit) and Codex once as a P2. All
four taken in c3a0b4d and answered on their threads; they are what produced
same_repository_here's "string rule first, disk only if it says no" shape,the
isabsguard, thefile:///D:/fold and the end-to-end test.Round 2: Copilot, one finding — the drive fold was applied to every body
beginning
/<drive>:rather than only to one a scheme had just come off.Taken in 8a7c042 with the two regression rows it asked for, and its suppressed
note about the proof is answered: the body was corrected with c3a0b4d and the
numbers above are the current ones.
🤖 Generated with Claude Code
Summary by Sourcery
Correct repository identity handling so filesystem paths require exact normalized equality while callers can recognize equivalent symlinked directories on the local machine.
Bug Fixes:
file:///D:/...URLs.Enhancements:
Tests: