Skip to content

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

Closed

Description

@brettheap

Lane: openreposhape-2 (openRepoShape-2)

What is wrong. same_repository's trailing owner/repo fallback matches
ANY two remotes whose last two path components agree, whatever stands in front
of them. Two bare repositories under different roots are therefore one
repository:

/srv/a/IRRS.git                  vs  /other/a/IRRS.git                 -> True
/srv/mirrors/InkRouter/IRRS.git  vs  /elsewhere/InkRouter/IRRS.git     -> True

It reaches 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 reports it as the
member's working clone.

It is PRE-EXISTING and deliberate as far as it goes. The same two pairs
answer True against scripts/shape_materialize.py on main at 5c63116 and
against templates/family-root/scripts/siblings.py before it, and the
docstring says what the loose match is for: "a manifest records Org/Repo
with no host in it at all, and a mirror or an enterprise host spells the same
repository under a different one" — https://github.com/Org/Repo.git and
https://gitlab.example/Org/Repo.git are True for exactly that reason.

Raised by Copilot on PR #156
(#156 (comment))
and declined THERE on purpose: #155 is a consolidation whose law is that
behaviour is byte-identical apart from #149's case rule, and this answer is
the same before and after it. Filed here so the question has a home rather
than a review thread.

What would fix it, if it should be fixed. Two shapes, and the choice is a
ruling rather than a refactor:

  1. Tail only for a reference that is a bare forge name. The fallback
    exists for family.yaml's repository: Org/Repo, which carries no host
    and no directory; requiring the reference side to BE that two-segment form
    would keep the case it was written for and drop path-against-path and
    host-against-host tail matching.
  2. Exact equality when both sides are paths. Narrower still, and it is the
    shape Copilot asked for.

What must not break either way: a clone whose origin is spelled under a
different PREFIX from the mount. On macOS a temporary directory answers as
/private/var/folders/… through one path and /var/folders/… through the
other, and the tail match is what makes the doctor and make siblings agree
about that directory today. Whichever shape is chosen needs the three-platform
run to prove it, and this suite's own fixtures are the estate that would
notice.

Unclaimed.

Activity

  1. brettheap commented on Sep 13, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-13T02:40Z) CLAIMED — session b92f33f0, on Brett Heap's word 'pick up 157 and 158, fan out'. Branch fix/same-repository-path-tail, worktree ~/projects/openRepoShape--i157-path-tail on Eagle, from origin/main b83ba5c. Scope: shape 2 — same_repository answers by EXACT equality when both sides are filesystem paths, the forge tail match is kept for every other pair, and the macOS prefix case moves to the two callers that own a disk.

  2. brettheap commented on Sep 13, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-13T02:42Z) RULING — made by
    the orchestrator (session b92f33f0) under Brett Heap's word 'pick up 157 and
    158, fan out' (2026-09-13T02:3xZ). Recorded here before a line of code is
    edited, because the choice this issue asks for is a ruling and not a
    refactor: shape 2, exact equality when both sides are paths, with the
    macOS prefix case moved to the callers.

    1. same_repository keeps its documented HOST semantics, unchanged.
    https://github.com/Org/Repo.git and https://gitlab.example/Org/Repo.git
    stay one repository — that is the mirror and the enterprise-host case the
    trailing owner/repo fallback was written for — and a bare Org/Repo, which
    is the form family.yaml's repository: row is written in, still matches any
    remote whose tail is org/repo, case-folded as #149 landed it.

    2. When BOTH sides are filesystem PATHS the answer is EXACT equality of the
    normalised keys, with no tail match at all.
    /srv/a/IRRS.git versus
    /other/a/IRRS.git is False, and so is
    /srv/mirrors/InkRouter/IRRS.git versus /elsewhere/InkRouter/IRRS.git.
    "A path" is the four-way question _remote_names_a_host already answers for
    #149 — absolute, file:// with an empty authority, a Windows drive, or a
    relative ./ or ../ — so a path still matches its own file:// spelling,
    which is one key and not a tail match.

    Why the distinction is not arbitrary. For a FORGE reference the two
    trailing components ARE the whole identity: Org/Repo names an owner and a
    repository and carries no prefix that could distinguish it from anything. For
    a PATH everything in front of the tail is part of the identity, and throwing
    it away is precisely the fault this issue reports — two bare repositories
    under different roots are not one repository however alike their last two
    components look.

    3. A path against a host remote, and a path against a bare Org/Repo, keep
    today's answer.
    The tail match is retained there, deliberately, because it
    is what both callers actually need: a member mounted from a mirror has an
    origin that is a path, while the reference it is matched against is either
    the bare InkRouter/IRRS of the manifest or the
    https://github.com/InkRouter/IRRS.git that siblings.py::clone_url derives
    from it. Dropping that match would call every clone in a mirror-based estate
    WRONG ORIGIN and would report it as not the member's working clone — the
    InkRouter estate's own layout, and the fault #149 is against rather than for.

    4. The macOS prefix case is handled by the CALLERS that own the disk, not
    by repo_shape.py.
    /private/var/folders/… versus /var/folders/… is one
    directory reached through a symlink, and only the machine that has that
    symlink can say so; the section comment in repo_shape.py promises that
    nothing in it fetches, asks git anything or touches a disk, and that promise
    is what lets tests/test_windows_paths.py ask the Windows questions from
    Linux. So templates/family-root/scripts/siblings.py::verify_sibling and
    shape-doctor.py's members-row comparison resolve a path side with
    os.path.realpath before they call same_repository — only when the string
    names an absolute path on this machine and that path exists, and never for a
    host remote or a relative one (../mirrors/Fam.git resolves against whatever
    directory the process is standing in, which is the trap resolve_relative
    exists to avoid). repo_shape.py gains only the PURE half: which spelling
    names a path, and what path it names.

    5. The behaviour change is limited to path-versus-path. Everything else
    must answer identically to main at b83ba5c, proven by the differential run
    PR #156 used — all ordered pairs of the same 45 remote spellings, through
    both copies.

    Claimed and being implemented on fix/same-repository-path-tail
    (#157 (comment)).

  3. brettheap commented on Sep 13, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-13T03:04Z) PULL REQUEST OPEN: #160 (head db73236).

  4. brettheap commented on Sep 13, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-13T07:32:08Z) MERGED — #160 → 71cf5de (squash), on Brett Heap's word 'land 157 and 158 when they report, then re-pin'. same_repository's trailing owner/repo fallback is a forge question only (#157): two filesystem paths must have EQUAL normalised keys, so /srv/a/IRRS.git and /other/a/IRRS.git stop being one repository; host semantics unchanged (mirrors and enterprise hosts still tail-match, a path still matches a bare Org/Repo row case-folded); the macOS /private/var prefix case moves to the callers — same_repository_here in siblings.py and the doctor asks the string rule first and os.path.realpath only for an absolute path that exists here, so the disk can add an answer and never take one away; file:///D:/ drive urls fold to the same key as D:/; 5 review rounds, all findings taken bar one declined with evidence; differential proof over 59 spellings — 74 pairs differ, every one main=True head=False with two paths, none gained a True; 1191 passed / 1 skipped; PINNED repo_shape.py + siblings.py → estate re-pin follows. Object complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions