Skip to content

Two copies of "is this the same repository" — siblings.py's and shape_materialize.py's — become one in scripts/repo_shape.py, and #149's case rule lands with the move #155

Closed

Description

@brettheap

Lane: openreposhape-2 (openRepoShape-2)

What is wrong. ONE rule — "do these two remote spellings name the same
repository?" — is written TWICE, and the second copy was written on purpose as
a stopgap three commits ago.

The second copy's own section comment says why it is there and what ends it:
"scripts/repo_shape.py, where a rule shared by every tool otherwise belongs,
is digest-pinned into every project, so a line added to it leaves every estate
upstream-changed until it re-pins — a price this defect does not justify on
its own… 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."
The InkRouter re-pin that was in flight while #147 was open has landed (estate
at shape cd57c4b), and one more re-pin is owed after this, so the pinned
change is welcome now.

What holds the two copies together today is a PARITY TEST —
tests/test_shape_doctor.py::test_the_doctor_and_siblings_agree_on_what_one_repository_is
— which runs 14 url pairs and 10 relative-url pairs through BOTH and asserts
they answer the same. A parity test is the right instrument for two copies and
the wrong one for a rule that should have one: it can only ever say the two
have not drifted YET, and every fix to the rule has to be written twice or it
re-creates the disagreement #147 removed.

#149 IS THAT FIX, and it is why this is worth doing now. same_repository
lowercases the WHOLE normalised remote. For a remote with 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 on a case-sensitive host it is wrong:
/srv/mirrors/IRRS.git and /srv/mirrors/irrs.git are two different bare
repositories on Linux, and both copies answer that they are one. With one
copy that is a one-place change; with two it is the same edit made twice and
a parity table that cannot tell whether either is right.

What would fix it.

  1. MOVE the rule into scripts/repo_shape.py, in a section of its own beside
    the other shared vocabulary (checked_value, SAFE_PATH_RE, which draws
    the same drive-letter-versus-scp-colon distinction). repo_shape.py is
    stdlib-only and Python 3.9-safe and already ships into every assembly root
    AND every family holder (COPIED_FROM_SHAPE and FAMILY_COPIED_FROM_SHAPE
    both name it), which is exactly why siblings.py can import it: the
    holder's copy sits beside siblings.py in scripts/, and siblings.py
    already reaches it with the same sys.path line bootstrap.py and
    validate-family.py use.
  2. templates/family-root/scripts/siblings.py imports it and keeps only
    resolve_relative (the wrapper that reads the holder's own origin) and
    clone_url. shape-doctor.py reaches it through its EXISTING guarded
    repo_shape import and drops the three names from the shape_materialize
    one. scripts/shape_materialize.py keeps a pointer where the block was and
    no code: it never called any of these itself.
  3. The parity test becomes an IDENTITY assertion — siblings.same_repository is repo_shape.same_repository, and the same for the resolver — after which
    the two tables run against the one function, with an expected answer per
    row rather than a comparison between two implementations that could both
    be wrong.
  4. 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's rule lands in the moved code: fold case only for a remote that
    names a HOST, preserve it for a filesystem path, with the table rows 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
    asks for.

The pinned-copy consequence. scripts/repo_shape.py and
templates/family-root/scripts/siblings.py are both digest-pinned, so every
project and every holder reads upstream-changed for them in
update-shape.py check until its estate re-pins. That is the price named
above and it is owed either way: this is the change that was told to ride it.

Activity

  1. brettheap commented on Sep 12, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-12T18:42Z) CLAIMED — session 9c6378ea, on Brett Heap's word 'do all 4'. Branch refactor/remote-rule-in-repo-shape, worktree ~/projects/openRepoShape--consolidate-remote-rule on Eagle, from origin/main 5c63116. Scope: the remote-url rule moves into scripts/repo_shape.py as one copy, siblings.py and shape-doctor.py import it, the parity test becomes an identity assertion over one function, and #149's case rule lands with the move (the one deliberate behaviour change).

  2. brettheap commented on Sep 12, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-12T19:25Z) PULL REQUEST OPEN: #156 (head 7038429).

  3. brettheap commented on Sep 12, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-12T22:40Z) REVIEW ROUND TAKEN: PR #156 is at head 0cc60d9 — Copilot (twice) and Codex (P1) found two places where #149's rule as first written either did not reach or reached too far, both fixed and answered on their threads; a third finding is older than this change and is filed unclaimed as #157. CI green on ubuntu, windows and macos; SonarCloud gate OK with 0 open issues on the PR; suite 1154 passed / 1 skipped.

  4. brettheap commented on Sep 12, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-12T22:42:11Z) MERGED — #156 → 313c57c (squash), on Brett Heap's word 'land 152 and 156 when they report, then re-pin'. the two copies of 'is this the same repository' — siblings.py's and shape_materialize.py's — become ONE definition in the pinned scripts/repo_shape.py; siblings.py keeps only resolve_relative + clone_url, the doctor imports from repo_shape, the parity test is an identity assertion with an expected answer per row; #149's rule lands once: a filesystem path (absolute, file:// with empty authority, Windows drive, ./ or ../) keeps its case, a host or bare Org/Repo folds it; 2 Copilot rounds + Codex P1 taken, #157 filed for a path/path tail question out of scope; 1154 passed / 1 skipped; Sonar 0; 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