From 77c4c03afe382e012515906bc01c2eddce4d2c31 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 22:04:33 +0000 Subject: [PATCH 1/3] Add ancestry commands and the carried-work caveat for shallow clones Follow-up to #449 that adopts S1 and S2 from its nonauthor review: a local git fetch --unshallow route (seconds for main here) beside the compare API, how to read merge_base_commit, and a caveat that ancestry only shows a commit landed. main#330's head is not in main, yet its PROOF.md blob is, so an ancestry-only already-landed check would misreport carried work. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SHCrxvZuVwzVNC7SDC9TAj --- AGENTS.md | 5 ++++- docs/WORKSPACE.md | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 8c31d1553..769585a78 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,7 +30,10 @@ repository state from a freshly fetched `origin/main`, not the checkout: the December 2025 branches have no `governance/` at all. When `git rev-parse --is-shallow-repository` prints `true`, `git merge-base` and `--is-ancestor` can miss shared history, so take ancestry, including for the -already-landed check, from GitHub's compare API (`merge_base_commit`). +already-landed check, from GitHub's compare API (`merge_base_commit`) or after +`git fetch --unshallow`. Ancestry shows only that a commit landed: work carried +onto `main` in a new commit needs a content comparison. The commands are in +[Workspace and tools](docs/WORKSPACE.md). ## Choose the right entry diff --git a/docs/WORKSPACE.md b/docs/WORKSPACE.md index 8338c0ff1..0e9422a84 100644 --- a/docs/WORKSPACE.md +++ b/docs/WORKSPACE.md @@ -117,6 +117,30 @@ Tools do not need to be installed merely to demonstrate that permission exists. Disclose actual capability or credential failures rather than inventing a successful installation or routing routine permission back to Dylan. +A session's preset checkout may be shallow. If +`git rev-parse --is-shallow-repository` prints `true`, `git merge-base` and +`--is-ancestor` can fail or report no shared history. Deepen the clone, or ask +GitHub, which needs no local history: + +```sh +git fetch --unshallow origin main # about 3 s and 38 MB on 19 October 2026 +git merge-base --is-ancestor origin/main && echo " is in main" +gh api repos/d6g8k5htny-coder/main/compare/...main --jq .merge_base_commit.sha +``` + +The commit is in `main` exactly when that merge base equals `` (status +`ahead` or `identical`); a 404 "No common ancestor" means unrelated history. +Ancestry shows only that a commit landed. Work carried onto `main` in a new +commit, such as a refresh, has a new SHA, so compare its blobs instead: + +```sh +git fetch origin +git rev-parse : origin/main: # two equal lines: same bytes +``` + +On 19 October 2026, main#330's head `88ff9223` was not in `main`, but its +`PROOF.md` blob was. + ## Local navigation check The landing workflow's `landing-checks` job first requires that the same run's From 5eb0d1e6e541f345c9bd3b7cb8b31c92aeed7588 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 22:08:19 +0000 Subject: [PATCH 2/3] State only the measured time for the unshallow fetch The 38 MB figure was the resulting .git size of a depth-1 clone, not the download, so the comment could overstate the fetch cost. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SHCrxvZuVwzVNC7SDC9TAj --- docs/WORKSPACE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/WORKSPACE.md b/docs/WORKSPACE.md index 0e9422a84..adf05a896 100644 --- a/docs/WORKSPACE.md +++ b/docs/WORKSPACE.md @@ -123,7 +123,7 @@ A session's preset checkout may be shallow. If GitHub, which needs no local history: ```sh -git fetch --unshallow origin main # about 3 s and 38 MB on 19 October 2026 +git fetch --unshallow origin main # about 3 s here on 19 October 2026 git merge-base --is-ancestor origin/main && echo " is in main" gh api repos/d6g8k5htny-coder/main/compare/...main --jq .merge_base_commit.sha ``` From 63cf47667f06f78644c0f1276f602c24d2c300d2 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 22:39:45 +0000 Subject: [PATCH 3/3] Treat a 404 as inconclusive and cover refused fetches A 404 from the compare API does not by itself show unrelated history: GitHub also returns 404 for a mistyped SHA, a missing branch or a repository the caller cannot see. Establish unrelated history in a complete clone instead. Also covers refused unshallow fetches (deepen in steps; in a shallow clone only a yes is reliable) and refused fetch-by-SHA (fetch a containing ref). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SHCrxvZuVwzVNC7SDC9TAj --- docs/WORKSPACE.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/WORKSPACE.md b/docs/WORKSPACE.md index adf05a896..86e9cad8a 100644 --- a/docs/WORKSPACE.md +++ b/docs/WORKSPACE.md @@ -128,13 +128,23 @@ git merge-base --is-ancestor origin/main && echo " is in main" gh api repos/d6g8k5htny-coder/main/compare/...main --jq .merge_base_commit.sha ``` +Where `--unshallow` is refused, deepen in steps with +`git fetch --deepen=500 origin main`. Until +`git rev-parse --is-shallow-repository` prints `false`, a "yes" from +`--is-ancestor` is reliable but a "no" is not. + The commit is in `main` exactly when that merge base equals `` (status -`ahead` or `identical`); a 404 "No common ancestor" means unrelated history. +`ahead` or `identical`). A 404 alone proves nothing: GitHub also answers 404 for +a mistyped SHA, a missing branch or a repository the caller cannot see. Treat an +unexplained 404 as inconclusive. To establish unrelated history, use a complete +clone in which both commits resolve (`git cat-file -e ^{commit}`) and +`git merge-base origin/main` prints nothing. + Ancestry shows only that a commit landed. Work carried onto `main` in a new commit, such as a refresh, has a new SHA, so compare its blobs instead: ```sh -git fetch origin +git fetch origin # if refused, fetch a ref that contains it: pull//head git rev-parse : origin/main: # two equal lines: same bytes ```