Skip to content
22 changes: 19 additions & 3 deletions docs/branch-cleanup-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,23 @@ Before deleting anything:
page, including the reconciliation preflight below:**

```bash
git rev-parse --is-shallow-repository # must print false
git fetch --unshallow --tags origin # if it printed true
git rev-parse --is-shallow-repository # must print false
git fetch --unshallow --tags origin # if it printed true

git config --get-all remote.origin.fetch # must map refs/heads/*
git remote set-branches origin '*' # if it names a single branch
git fetch --prune origin # then repopulate
```

**Complete history is not complete branch coverage — check both.** `git clone --depth 1` implies
`--single-branch`, which pins `remote.origin.fetch` to the one cloned branch. `git fetch --unshallow`
converts the history, so `--is-shallow-repository` flips to `false` and the first check passes, but
it does **not** widen the refspec: every other branch stays invisible locally. Measured in a fixture
with `main` and `feature`, `git ls-remote --heads origin` listed both while `refs/remotes/origin` held
only `origin/main`, and the sweep exited **0** reporting an empty branch list. An empty inventory is
not a safe failure — it reads as "nothing to clean up", and where `origin/main` itself is missing every
comparison fails into `0/0`, making every branch look like a deletion candidate.

Every signal in this guide — ahead/behind, `--cherry-pick` patch-uniqueness, `git diff main...BRANCH`
— is derived from a **merge-base**. A shallow clone has a grafted root, so those results are wrong
_without erroring_: nothing fails, the numbers are simply fiction. Remote Claude Code sessions clone
Expand All @@ -39,7 +52,10 @@ recommending deletion of an active branch.
Both `npm run sweep:branch-ledger` and `node scripts/reconciliation-preflight.mjs` now refuse
outright unless the history is verified complete (`shallowCloneRefusal`, guarded in
`tests/repo-hygiene.test.ts`) — the preflight is included because it reports its own
merge-base-derived ahead/behind values. For the preflight the refusal lives in the exported
merge-base-derived ahead/behind values. The sweep additionally refuses on a narrow refspec
(`branchCoverageRefusal`) and fetches an explicit `+refs/heads/*:refs/remotes/origin/*`, so an
ordinary run repairs its own coverage rather than reporting a partial inventory; with `--no-fetch`,
offline, or a failed fetch, it refuses instead. For the preflight the refusal lives in the exported
`collectReconciliationState`, not in its CLI, so `scripts/reconciliation-evidence-pack.mjs` cannot
write a `status: "complete"` pack around shallow numbers by calling the collector directly. The raw
`git` commands below have no such protection, so verify the precondition yourself before trusting
Expand Down
2 changes: 2 additions & 0 deletions docs/branch-review-ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -1308,5 +1308,7 @@ Records before 2026-07-28 were written by hand and had drifted: 146 lines carrie
| 2026-07-30 | claude/top-search-design-mockups-w53znc | 7577a1ea60ab5f0918885f90e849bbac754234b1 | PR #1394 search-results-band-adoption + #096/#115 | No P0/P1. Disposition1 partial: isAlwaysStandaloneShellPath fixes services/etc; /tools still layout-false-positive (P2). Disposition2 verified: import-as-rendered deferred as #115 (P3). #096 closure text accurate for root-path; row still open with stale Still-live clause. | vitest tests/search-results-band-adoption.test.ts 6/6; offline gutting repro tools vs services; static read search-route-ownership + outstanding-issues |
| 2026-07-30 | PR #1394 / `claude/top-search-design-mockups-w53znc` | `8c39158d99876338613d5bb3195847fd253ef5ff` | CI/review closeout: /tools page-only roots + thread disposition | FIXED. Layout false-positive for `/tools` closed via `isStandaloneModeHomePath` in reachabilityRoots. Import-as-rendered finding left as `#115` (pre-existing; lint catches the plausible slip). Both Codex threads dispositioned. Merge clean vs main. | vitest adoption 6/6; full unit 4451 passed / 4 skipped; typecheck; prettier; Bugbot pr-bugbot |
| 2026-07-30 | PR #1394 / `claude/top-search-design-mockups-w53znc` | `d658f120253ac0a2dbfe1c9b1a14c6a0744af14d` | CI/review closeout tip (supersedes 8c39158d row) | FIXED layout `/tools` false-positive; `#115` deferred with human disposition; threads resolved; merge-tree clean; CI settling | vitest adoption 6/6; full unit 4451/4; typecheck; Bugbot |
| 2026-07-30 | claude/test-coverage-analysis-2vcd8a | 4f498b66a56b2a7eddde6c841a79621f23b59cc7 | PR #1398 babysit | BLOCKER CLEARED: CONFLICTING due to docs/outstanding-issues.md vs main (#115 band-adoption follow-up). Kept main #115 + next-id=116; preserved PR #109 single-branch/refspec update. Prior tip had no GitHub CI suite (only PR Policy/CircleCI) — push retriggered full CI. 0 review threads; 0 Bugbot findings. | verify:cheap PASS (432 files, 4467 passed \| 4 skipped); repo-hygiene 38/38; sweep:branch-ledger --no-fetch exit 0; format:changed PASS; Bugbot none; hosted CI re-triggered on tip |
| 2026-07-30 | PR #1394 / `claude/top-search-design-mockups-w53znc` | `0d47141fc030684299dcb265e3d853c93b9e2a91` | CI/review closeout — merged | MERGED as squash `0d47141f`. Prior tip `4a001efa` had required CI green after prettier fix `61314887` (Static PR/CircleCI red on `#096` padding) and main sync. Layout/`/tools` false-positive fixed; `#115` deferred; review threads resolved. Post-merge ledger-only follow-up. | hosted Static/Unit/PR-required/CircleCI pass on pre-merge tip; vitest adoption 6/6; typecheck; Bugbot no open P0/P1; merge-tree clean |
| 2026-07-30 | cursor/pr-1394-ledger-closeout-c2bf | f734dc4d4c8b19d5fec43bbd388c2a421e47668a | PR #1399 babysit / CI+Bugbot closeout | MERGE-READY. No failing CI, no unresolved review threads, merge-tree clean vs origin/main, Bugbot no bugs. Docs-only ledger append for merged #1394; no code fix required. | hosted PR required SUCCESS; Static PR SUCCESS (lint/typecheck/format/ledger); CircleCI verify SUCCESS; local check:branch-review-ledger PASS; prettier PASS; lint PASS; Bugbot pr-bugbot no findings |
| 2026-07-30 | claude/test-coverage-analysis-2vcd8a | d5842e62238237ff5c47da0b32ef8d9f12819714 | PR #1398 babysit | COMPLETE for tip: cleared main conflict; fixed Codex P2 (reject refs/*→origin/* nesting); prior Codex P2 (destination check) already fixed in de594186 and resolved; 0 unresolved threads; merge-tree clean. Hosted CI re-running. | repo-hygiene 40/40; verify:cheap earlier PASS on pre-tip; format:changed PASS; Bugbot none; Codex P2 resolved |
Loading