Repository navigation
shape-doctor.py: origin_org and repo_local_origin_name read only a remote named origin, so for a source whose only remote has another name the doctor's NEXT (--project WorkUpstream --org <your-org>) no longer matches what plan asks once #1280 lands (RV1280 S4 on #1280; follows #1276) #1292
Description
(lane openRepoShape-3, 2026-11-09T22:05:03Z)
Found by: RV1280, lane 3's independent review of PR #1280 (for #1276) at 8700d2fee, finding S4 (#1280 issuecomment-6745942768). RV1280b, lane 3's delta review of #1280's fix round, found S4's line numbers right at main 4552efa6a. It is filed on Brett Heap's word "file follow-ups 5, 10 and 15" (2026-11-09). It is on v1.2.2, the patch after v1.2.1, which adds no command and no flag.
It builds after #1280 lands. #1280 (for #1276) is lane 3's, on v1.2.2, and is not on main at filing (open, head 890976c92). Its code is cited here from that head (git show of refs/pull/1280/head), so its line numbers move when it is squashed. Lines for shape-doctor.py are at main 8cf6477fe, read and not run; they are the lines RV1280b named at 4552efa6a. The measurement is RV1280's, on git 2.43.0 and Python 3.12. This body is ASCII.
What is missing
A person can see it: the doctor offers a command plan refuses. Once #1280 lands, plan reads a source's only remote when it has no origin (a source cloned under clone.defaultRemoteName). The doctor still reads origin alone, so for such a source it builds its adoption NEXT from a repository and an organisation it did not read.
RV1280 measured it (S4, quoted exactly; "the merge" is RV1280's local merge 611e10026 of #1280 8700d2fee with main ebb87168a):
S4 SHOULD, as a follow-up and not this PR:
shape-doctor.pyno longer asks whatplanasks.I took a repository whose only remote is
upstream(testorg/Thing), in a folder namedwork-upstream, on the ebb8716 merge.
- The doctor's adoption NEXT is
adopt-project.py plan --source .../work-upstream --project WorkUpstream --org <your-org>.- For the same repository with
origin, the NEXT is--project Thingwith no--org.Pasting the
upstreamline with--org testorg:
- On main: exit 0. Main cannot read the source's name, so it plans
testorg/WorkUpstream, which is not the source's repository (adopt-project.pycheck: a plan in a name the policy refuses gets no rename-first remedy, and a source that names no repository is never compared with the plan's recordedsource.repository#716 cannot see it).- On the merge: exit 2,
REFUSED adopt-not-the-source: --org testorg and --project WorkUpstream name testorg/WorkUpstream, and the source is testorg/Thing. The remediation gives the right command.Plan's new refusal is correct. But the doctor's
origin_organdrepo_local_origin_name(shape-doctor.pyaround line 11423, whose docstring says it "asks the questionplanasks") readoriginonly. File a v1.2.2 follow-up to read the only remote there asplannow does, and name it under the body's Out of scope.
So the doctor's line, filled in as it asks, ends in plan's correct refusal, where the same repository with origin gets a line that works. #1280's body at 890976c92 names the doctor only in a test-count row (grep -i doctor finds no other line); recheck at filing.
Why (the code, read and not run)
At main 8cf6477fe, shape-doctor.py:
origin_name(:11346) readsgit remote get-url originat:11410.repo_local_origin_name(:11446) returnsorigin_name(root) if carries_git(root) else None(:11465).origin_org(:11468) readsgit remote get-url originat:11502, thenurl_repository(url), and returns the part before/. Its docstring says it is "The organisationadopt-project.py planwould read offroot's ownorigin" and "THE SAME READING, NOT A COPY OF IT (adopt-project.py: read<org>/<repo>from everyorigingit accepts (a local path, a Windows backslash path, a trailing/or.git/) #521)": the pairurl_repositoryis shared throughrepo_shape, but which remote it is read from is not.- The callers.
origin_orgis asked at:12081and:12085by the way-in row, for the NEXT's--org.repo_local_origin_nameis asked at:11530by thenamingrow and at:12168(identity = repo_local_origin_name(ctx.root) or ctx.root.name) for the way in's project token. With nooriginthat is the folder's name, so the NEXT says--project WorkUpstream, notThing. - What
planreads after adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280, at its head890976c92:_remotes_of(adopt-project.py:3043) and_source_remote(:3087), "the remote the source's facts are read from (adopt-project.py: a source cloned underclone.defaultRemoteNamehas no remote namedorigin, soplanreads no organisation from it (adopt-no-org) and its reads ofrefs/remotes/origin/*find nothing (RV1268 N5 on #1268; follows #1261) #1276):originwhere it has one, else its only remote, elseorigin";_origin_url(:3136) readsgit remote get-url <that remote>. With several remotes and nooriginit reads none and names them (_passed_over); a remote whose name is not printable ASCII, or starts with-, is passed over too. The rule lives inadopt-project.py; the doctor has no copy of it. - Other readers of
origin, the same fact, not measured:scripts/shape_advisory.py:540(repository_names, which its docstring says agrees withorigin_nameand_remote_repository) andshape-doctor.py:10458(a sibling clone's url, read asmake siblingsreads it).
The fix (as RV1280 framed it: "read the only remote there as plan now does"; the writer settles the open choices)
- To settle: how the doctor and
plancome to ask one question. A copy drifts:origin_org's docstring records that this file once kept a copy ofplan's regex, which broke whenplanchanged (adopt-project.py: read<org>/<repo>from everyorigingit accepts (a local path, a Windows backslash path, a trailing/or.git/) #521), and now sharesurl_repository. Choices: move the choice of remote to where both read it (scripts/repo_shape.pybesideurl_repository); or keep a copy in the doctor, held toplan's by a parity row. Say which, and what it costs the shape copies. - To settle: which reads move.
origin_organdrepo_local_origin_nameare named by RV1280. Whetherrepository_names(shape_advisory.py:540) and thenamingrow (:11530) move with them is for the writer to measure. - A source with an
originreads exactly as today, whatever other remotes it has (every doctor row, byte for byte), as adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280 holds it forplan. - A source with several remotes and no
originis not guessed among: the NEXT keeps--org <your-org>, andplan's refusal names the remotes. - A remote whose name is not printable ASCII or starts with
-is read as adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280 reads it, so the doctor andplanpass the same remotes over. (RV1280's N1 on adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280 measured a remote named-x, whichplanrefused as naming no organisation because git readget-url -xas an option; adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280's head passes such a name over.) - No new command or flag (v1.2.2 is a patch).
Rows (they must fail before the change)
- A source whose only remote is
upstream, urlhttps://github.com/testorg/Thing.git, in a folderwork-upstream: the doctor's adoption NEXT is--project Thingwith no--org, as for the same source withorigin. On main plus adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280 it is--project WorkUpstream --org <your-org>. - A parity row: the arguments of the doctor's NEXT, given to
plan, are not refusedadopt-not-the-source. - The
namingrow of that source classifies the remote's repository name as well as the folder's, as it does fororigin. - A source with
originandforkkeeps today's NEXT, held by a row. - A source with two remotes and no
originkeeps--org <your-org>. - A mutant: the doctor reading
originalone again. The first row must fail on it.
Not here
- adopt-project.py: a source whose only remote is not named
origin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280's own reads inadopt-project.pyare adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280's. clone.defaultRemoteNameitself. adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280 reads no such setting (its docstring says why: git reads it ingit clonealone, and it is this machine's setting now, not the source's), and nor should the doctor.- RV1280's S5 (with
clone.defaultRemoteNamein the global config, adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280 alone moves the stop to after both legs are pushed; it lands after adopt-project.py: each cloneexecutemakes names its remoteorigin, whateverclone.defaultRemoteNamesays, soexecuteno longer ends inREFUSED mounting the legs("No such remote 'origin'") after both legs are pushed (#1261) #1268) and its other NITs are adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280's.
Done when
- For a source whose only remote is not
origin, the doctor's adoption NEXT is the lineplanaccepts, and a row fails on main plus adopt-project.py: a source whose only remote is not namedorigin, asclone.defaultRemoteNamenames it, is read from that remote, soplanreads its organisation, default branch and branches where it refusedadopt-no-org, took HEAD's branch as the default and asked--tracking-branchof the source's own branches, and one with several remotes and nooriginnames them and guesses none (#1276) #1280. - A source with an
originreads as before, by the rows above. - The choice between one shared reading and a held copy is written where the next writer will read it.
See #1276, #1280, #521 and #545.
Lane: openreposhape-3 (openRepoShape-3)
Activity
brettheap commentedon Nov 9, 2026
CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-11-09T22:08:49Z, for #1292
Logged in
lanes/log/openRepoShape-3.mdat92278b8f35cb66da7c992b70bace1e91ef93d83b.The three reads (lane-collision-protocol Rule 1):