Repository navigation
status: the third layer — a fork against what it was forked from, via a remote named upstream or, under --fetch, one read-only gh api question - #11
Conversation
… `park --all` / `-a` is the sweep unasked Brett Heap's RULING of 2026-09-10, verbatim: "lets change that so it parks the current repo. if not in a repo, then asks if want to park all. and park all should be park -a or park --all." It supersedes his openRepoShape #91 ruling of the same day, under which bare `park` with no estate around the cwd parked every estate unasked. - The walk-up is unchanged: inside an estate, bare `park` parks that one. - Outside every estate, at a terminal: list, then `park every estate above? [y/N]` on stderr. Only y/yes runs #91's sweep; anything else exits 2 with "nothing was parked". - Outside every estate, with no terminal on stdin: refuse, list, and name `--all`. Never hang on a question nobody can see. - `park --all` / `park -a`: the sweep from anywhere, unasked. Refused alongside <Name> or --repo, and when no estate exists at all. - `resume --all` / `-a` refuses by name and says why `resume` has no sweep, instead of the generic "put it after `--`". - The sweep itself (name order, continue past a refusal, skip roots without the overlay, one summary) is untouched; it now takes its rows from the caller that listed them. Tests 147 -> 160: the question under a real pseudo-terminal (y/Y/yes/YES, Enter/n/no/other), the no-terminal refusal, --all and -a, --all from inside an estate, the flag conflicts, and the sweep tests now driven by --all. README 178 -> 182 and AGENTS.md 95 -> 99, caps raised in dated docstring entries. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…f sync across an estate, read-only, as of the last fetch Brett Heap's RULING of 2026-09-10, verbatim: "lets go with a fourth file. start with the local status layer." `status [<Name>] | --all` finds the estate exactly as `park` and `resume` do — the shared resolver block is now carried byte for byte by three files — and then only READS: for the holder or root, each member's working clone and every mounted leg, whether the tracking branch is ahead of or behind its origin, what is dirty or stashed, a root off its tracking branch or detached, feature branches never pushed or whose remote branch is gone, dirty feature worktrees, a leg checked out away from its pin or pinned behind its origin or on an unpushed leg commit, a leg on a feature branch, a leg declared and not mounted, and a member with no working clone. It fetches nothing, says "as of the last fetch" on every run, and takes no lock (`git --no-optional-locks`). Exit 0 in sync, 1 findings printed, 2 refused. Bare `status` inside an estate reads that one; outside every estate it reads them all WITHOUT asking, because nothing writes; `--fetch` refuses by name as the next layer. - `openRepoTools --install` places FOUR files; the count line says `4 of 4`. - README and AGENTS.md (new rule 4) document it; caps raised in dated entries. - CI parses the fourth file with /bin/bash -n. - `park` and `resume` change only in comments: the shared block now says three copies. An independent review of the first draft (14 synthetic estates, a full-tree snapshot proving nothing is written) found six things, all fixed here: a git that cannot run is refused rather than reported as an empty estate; the one unguarded pipeline; 0x1F rather than TAB between for-each-ref fields so an empty field cannot shift; "0 commit(s) never pushed" reworded; a missing flag value exits 2 in the command's own words, not bash's exit 1; a valueless .gitmodules key no longer invents a leg. Plus the gap it flagged: a leg on a feature branch at its pin is a finding, as AGENTS.md rule 1 already names it. Tests 160 -> 187: a new tests/test_status_command.py (22, real bare remotes and a leg submodule, one scenario each), the installer and hygiene suites taught the fourth file, and the resolver identity held three ways. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
…rite bounded to remote-tracking refs by a pinned refspec Brett Heap's RULING of 2026-09-11, verbatim: "next layer: --fetch". With the flag, `git fetch --quiet --prune --recurse-submodules=no origin '+refs/heads/*:refs/remotes/origin/*'` runs in every repository before it is read — holder or root, each member's working clone, every mounted leg — so the ahead/behind answers are current and a remote branch deleted under a feature reads as gone. One line under each row says what the fetch did: which ref moved and from where, nothing new, or that the tracking branch is GONE from origin. A fetch that fails is a finding on that row and the row is read as of the last fetch that worked; a repository whose gitfile points at a deleted git dir is reported as unreadable, not as "no remote". The footer names the one write. Without the flag nothing changes. THE REFSPEC IS PINNED ON THE COMMAND LINE, and that is what bounds the write. The review of this layer deleted a local branch through the configured form: a leg whose `remote.origin.fetch` maps heads onto local branches, plus `--prune`, loses a branch origin no longer has, and `fetch.pruneTags` set globally prunes local tags the same way — while the report calls the repository clean. Naming `+refs/heads/*:refs/remotes/origin/*` means the only refs that can move or go are under `refs/remotes/origin/`, whatever the config says; a test holds that with both misconfigurations set. `GIT_TERMINAL_PROMPT=0` makes an https credential prompt fail and be reported; an ssh host-key or passphrase prompt is ssh's own and still blocks, which the header, usage, README and AGENTS.md now say. The docs say exactly what a fetch writes: remote-tracking refs, the objects behind them and FETCH_HEAD — never a local branch, tag, HEAD, index or working tree. Tests 187 -> 197: behind is seen in one run and the fetch persists; local branches, HEAD, index, working tree and stash are untouched while origin/main moves; a branch deleted from another clone reads as gone after the prune; a dead URL is a finding and the leg is still fetched; the leg is fetched on its own row; no origin is a finding; `--all --fetch` fetches every estate; the pinned refspec keeps a local branch and tags under a mirror refspec and pruneTags; a renamed default branch reads as GONE; a dangling gitfile is named as such. One assertion that could never fail is now real. README 203 -> 214, AGENTS.md 111 -> 117 (rule 4: `status --fetch` is the one way it reaches the network), caps raised in dated entries. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
… a local branch through the pinned fetch A refspec on the command line bounds what is fetched and pruned, but git still maps every ref it fetched through the CONFIGURED refspecs as well — "opportunistic remote-tracking updates". Under a mirror-style `remote.origin.fetch` the pinned fetch alone moved a detached leg's local `main` (proved: 6fb2a82 -> 49184cc with the pinned refspec, unchanged with `--refmap`), and in a checked-out root it refused outright. `--refmap` (git 2.1) with the same refspec replaces the configured mapping for this one fetch, so nothing outside `refs/remotes/origin/` is written by either route. The test that should have caught it now asserts the leg's local `main` did not move. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ia a remote named `upstream` or, under `--fetch`, one read-only `gh api` question
Brett Heap's RULING of 2026-09-11, verbatim: "next layer: fork against
upstream".
When origin is a FORK, the one question a clone cannot answer about itself
is whether the fork has kept up with what it was forked from. Two ways to
know, in order:
1. A remote named `upstream` — the convention every fork guide teaches — is
read from LOCAL refs: `origin/<branch>` against `upstream/<branch>`, as
of the last fetch. Behind is a finding ("sync the fork"); ahead is a
finding (commits on the fork's main the parent does not have). With
`--fetch` the upstream remote is fetched too, on its own line, under the
same pinned refspec. Never fetched: a finding that names `--fetch`.
2. With no such remote, and only under `--fetch` — the one flag that
reaches the network — an origin whose configured URL is on github.com is
asked about with `gh api repos/<owner>/<name>`, read-only. A fork is a
finding naming the parent and the `git remote add upstream …` that makes
the drift readable locally from then on, and GitHub's compare endpoint
gives the counts once. `gh` absent or failing is said ONCE per run, not
per row. Not a fork: nothing to say. Not github.com: never asked.
`fetch_origin` becomes `fetch_remote <repo> <branch> <remote>`, printing the
remote's name in every line.
--refmap, and a hole in #10's bound. A refspec on the command line bounds
what is fetched and pruned, but git still maps every fetched ref through the
CONFIGURED refspecs as well ("opportunistic remote-tracking updates"): under
a mirror-style `remote.<name>.fetch` the pinned fetch alone moved a detached
leg's local `main`, and refused outright in a checked-out root. `--refmap`
(git 2.1) with the same refspec replaces the configured mapping for the one
fetch, so nothing outside `refs/remotes/<remote>/` is written by either
route. The test that should have caught it now asserts the leg's local
`main` did not move.
The hygiene rule "no `gh api` in an estate command" now allows exactly one:
inside `ask_github_fork`, and nowhere else in `status`; the verbs still
call no API. Tests 197 -> 202: a fork behind its upstream remote from local
refs, before and after the remote is fetched; `--fetch` fetching upstream
under the pinned refspec with a mirror config; a fork pushed ahead of its
parent; a github.com origin asked only under `--fetch`, with a fake `gh`
answering the two calls and a `url.<base>.insteadOf` rewrite so the fetch
still comes from a bare on disk; a failing `gh` said once, and a local-path
origin never asked. README 214 -> 221, AGENTS.md 117 -> 122, caps raised in
dated entries.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Reviewer's Guide
Sequence diagram for fork status resolutionsequenceDiagram
participant Status
participant GitRefs
participant GitHub
participant Gh
Status->>GitRefs: Read origin/<branch> and upstream/<branch>
alt upstream refs available
GitRefs-->>Status: Compare local fork and parent refs
else --fetch and no upstream remote
Status->>GitHub: Read origin URL config
alt github.com origin
Status->>Gh: gh api repos/<owner>/<name>
Gh-->>Status: Parent repository and compare totals
else non-GitHub origin
GitHub-->>Status: No API request
end
end
Status-->>Status: Report fork drift or missing upstream guidance
Sequence diagram for safe upstream fetchingsequenceDiagram
participant Status
participant Git
participant Refs as RemoteTrackingRefs
Status->>Git: fetch_remote <repo> <branch> upstream
Git->>Refs: Fetch with pinned refspec and --refmap
Git-->>Status: upstream/<branch> updated
Status-->>Status: Compare origin/<branch> with upstream/<branch>
Flow diagram for fork status source selectionflowchart TD
A[Origin is a fork] --> B{Remote named upstream?}
B -->|Yes| C[Read origin/<branch> and upstream/<branch> locally]
B -->|No| D{--fetch enabled?}
D -->|No| E[Report missing upstream ref]
D -->|Yes| F{Origin URL is github.com?}
F -->|No| G[Do not ask GitHub]
F -->|Yes| H[Call gh api once]
C --> I[Report behind or ahead drift]
H --> I
E --> J[Name git remote add upstream guidance]
G --> J
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Co-Authored-By: Claude Fable 5.1 <[email protected]>
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. With --fetch, the command now contacts GitHub through gh and writes upstream remote-tracking refs and fetched objects, so a wrong comparison or fetch can leave bounded repository state behind after a revert. Those refs and objects can be removed or the fetch rerun, and the change does not move money, alter access, delete records, or make irreversible production changes.
There was a problem hiding this comment.
🟡 Changes recommended
Address the critical GitHub host-validation issue and the remaining fetch-state/reporting inconsistencies.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Extends status with fork-drift checks against local upstream refs or GitHub under --fetch.
Changes:
- Adds safe upstream fetching and ahead/behind reporting.
- Adds GitHub fork detection and comparison.
- Expands tests, hygiene checks, and documentation.
File summaries
| File | Reviewed changes |
|---|---|
tests/test_status_command.py |
Covers upstream refs, safe fetching, GitHub fallback, failures, and URL rewriting. |
tests/test_repo_hygiene.py |
Updates hygiene and documentation assertions. |
status |
Implements upstream and GitHub checks. Findings: critical (3 votes) GitHub host validation; moderate (2 votes) failed-fetch state; moderate (1 vote) repeated GitHub failures; nit (3 votes) safety comment; nit (1 vote) ambiguous fetch error. |
README.md |
Documents fork-status behavior and upstream guidance. |
AGENTS.md |
Updates operational guidance for fork checks and read-only GitHub usage. |
Review details
Suppressed comments (2)
status:990
- If the first repository is identified as a fork but its compare request fails (for example because the parent is private), this branch reports the failure but leaves
GH_STATE=ok. Every later GitHub fork will invokeghagain and repeat the failure, contrary to the documented once-per-run handling; mark the GitHub state failed here so subsequent rows are suppressed.
else
cmp="${cmp%%$'\n'*}"
finding "fork: could not compare origin/$branch with $parent's $parent_default: ${cmp:-no message}"
status:854
- Since this function now handles both origin and upstream, this early failure message still says only
fetch:and omits$remote; it violates the function's own contract that every fetch line names the remote and becomes ambiguous when diagnosing upstream fetches. Include the remote name here and update the corresponding assertion.
finding "fetch: not a readable git repository (a gitfile whose gitdir is gone?), so nothing could be fetched"
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| local repo="$1" branch="$2" url slug owner info is_fork parent parent_default cmp behind ahead | ||
| url="$(g "$repo" config --get remote.origin.url 2>/dev/null || true)" | ||
| case "$url" in | ||
| *github.com*) ;; |
| if [ "$UPSTREAM_FETCHED_OK" -eq 1 ]; then | ||
| finding "fork: no upstream/$branch after the fetch: upstream has no branch $branch" | ||
| else | ||
| finding "fork: no upstream/$branch here: the upstream remote was never fetched (\`--fetch\` asks it)" |
| # the objects behind them and `FETCH_HEAD`, and nothing else: no branch, no | ||
| # tag, no HEAD, no index, no working tree, because the refspec is pinned on | ||
| # the command line rather than trusted from config (see `fetch_origin`). | ||
| # the command line rather than trusted from config (see `fetch_remote`). |
…am, so this PR's diff is its own change Co-Authored-By: Claude Fable 5.1 <[email protected]>
|



Ruling: Brett Heap, 2026-09-11, verbatim: "next layer: fork against upstream" — the third of the layers named when
statuslanded (#9), after the local one and--fetch(#10).Stacked on #10 (
feat/status-fetch), on #9, on #8; the base is #10's branch and this carries only the fork layer on top.What it reads
When origin is a FORK, the one question a clone cannot answer about itself is whether the fork has kept up with what it was forked from: a fork's
mainfalls behind quietly, and a feature cut from it is a feature cut from stale ground. Two ways to know, in order:1. A remote named
upstream— the convention every fork guide teaches — read from LOCAL refs,origin/<branch>againstupstream/<branch>, as of the last fetch. No network.Ahead is a finding too (
origin/main has N commit(s) upstream/main does not: somebody pushed to the fork's main instead of opening a pull request). Never fetched:fork: no upstream/main here: the upstream remote was never fetched (--fetch asks it). With--fetchthe upstream remote is fetched as well, on its own line (fetched upstream: upstream/main is here now, at …), under the same pinned refspec, so the write stays underrefs/remotes/.2. With no such remote, and only under
--fetch— the one flag that reaches the network — an origin whose configured URL is on github.com is asked about withgh api repos/<owner>/<name>, read-only:GitHub's compare endpoint gives the counts once (
per_page=1, the totals are totals regardless). Thegit remote add upstream …is named, never run: from then on the drift reads from local refs.ghabsent, or failing (not logged in, a private parent), is said ONCE per run under the first row that asked, not repeated per repository. Not a fork: nothing to say — most estates are the organisation's own repositories. Not github.com: never asked. The origin URL is read from config, notremote get-url, so aurl.<base>.insteadOfrewrite cannot hide whose repository it is.fetch_originbecomesfetch_remote <repo> <branch> <remote>, with the remote's name in every line it prints and in its refspec.--refmap, and a hole in #10's boundFound while building the upstream fetch: a refspec on the command line bounds what is fetched and pruned, but git still maps every ref it fetched through the CONFIGURED refspecs as well — "opportunistic remote-tracking updates". Under a mirror-style
remote.<name>.fetch, the pinned fetch alone moved a detached leg's localmain(proved:6fb2a82 -> 49184ccwith the pinned refspec; unchanged with--refmap), and in a checked-out root it refused outright (refusing to fetch into branch 'refs/heads/main' checked out at …).--refmap(git 2.1) with the same refspec replaces the configured mapping for the one fetch, so nothing outsiderefs/remotes/<remote>/is written by either route.The fix is landed at its source, on #10's branch (commit
b01a16a, with the test that should have caught it now asserting the leg's localmaindid not move), and this branch is rebased on top; here it applies to the upstream fetch as well.Hygiene
The rule "no
gh apiin an estate command" now allows exactly one: insideask_github_fork, and nowhere else instatus(the usage prose that names it is set aside as prose).parkandresumestill call no API. The document test additionally holds "upstream" and "gh api" in README, AGENTS.md and the command's header.Docs
README.md 214 -> 221, AGENTS.md 117 -> 122, caps raised in dated entries. AGENTS.md rule 4 now says how a fork is read, that this is the ONE use of
ghin these commands and it is read-only, and that thegit remote add upstream …a finding names is the person's to run.Tests
197 -> 202. New: a fork behind its
upstreamremote from local refs, before and after the remote is fetched;--fetchfetching upstream under the pinned refspec with a mirror config, the localmainunmoved; a fork pushed ahead of its parent; a github.com origin asked only under--fetch, with a FAKEghfirst on PATH answering the two calls the command makes (fields joined by 0x1F, every call logged) and aurl.<base>.insteadOfrewrite so an origin that looks like github.com still fetches from a bare on disk — the three calls and their order are asserted; a failingghsaid once across two github rows, and a local-path origin never asked. Nothing reaches the network.bash -n statuspasses;shellcheck statusreports only SC2317.python3 -m pytest tests -q: 202 passed locally with the submodule initialised, on the tree rebased onto #10 after the--refmapfix.Not merged
Opened for review, stacked on #10 on #9 on #8. A review of this layer was still running when it was opened; anything it finds lands as a follow-up commit here.
🤖 Generated with Claude Code
Summary by Sourcery
Add the fork layer to status by reporting divergence from an upstream remote or, when fetching GitHub repositories, their configured parent.
New Features:
upstream.--fetch, identify GitHub fork relationships and report parent-branch divergence through read-only GitHub CLI queries when no upstream remote exists.Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: