diff --git a/cmd/bd/cli_coverage_show_test.go b/cmd/bd/cli_coverage_show_test.go index e4419044f..04aec43db 100644 --- a/cmd/bd/cli_coverage_show_test.go +++ b/cmd/bd/cli_coverage_show_test.go @@ -39,6 +39,10 @@ func runBDForCoverage(t *testing.T, dir string, args ...string) (stdout string, rErr, wErr, _ := os.Pipe() os.Stdout = wOut os.Stderr = wErr + defer func() { + os.Stdout = oldStdout + os.Stderr = oldStderr + }() // Mark tests explicitly. oldTestMode, testModeWasSet := os.LookupEnv("BEADS_TEST_MODE") @@ -126,8 +130,6 @@ func runBDForCoverage(t *testing.T, dir string, args ...string) (stdout string, _ = wOut.Close() _ = wErr.Close() - os.Stdout = oldStdout - os.Stderr = oldStderr _ = os.Chdir(oldDir) os.Args = oldArgs rootCmd.SetArgs(nil) diff --git a/cmd/bd/cli_fast_test.go b/cmd/bd/cli_fast_test.go index dd8863eed..c5897d06b 100644 --- a/cmd/bd/cli_fast_test.go +++ b/cmd/bd/cli_fast_test.go @@ -167,6 +167,10 @@ func runBDInProcess(t *testing.T, dir string, args ...string) string { rErr, wErr, _ := os.Pipe() os.Stdout = wOut os.Stderr = wErr + defer func() { + os.Stdout = oldStdout + os.Stderr = oldStderr + }() // Set args for rootCmd rootCmd.SetArgs(args) @@ -195,8 +199,6 @@ func runBDInProcess(t *testing.T, dir string, args ...string) string { // Close writers and restore wOut.Close() wErr.Close() - os.Stdout = oldStdout - os.Stderr = oldStderr os.Chdir(oldDir) os.Args = oldArgs rootCmd.SetArgs(nil) @@ -1217,6 +1219,10 @@ func runBDInProcessAllowError(t *testing.T, dir string, args ...string) (string, rErr, wErr, _ := os.Pipe() os.Stdout = wOut os.Stderr = wErr + defer func() { + os.Stdout = oldStdout + os.Stderr = oldStderr + }() rootCmd.SetArgs(args) os.Args = append([]string{"bd"}, args...) @@ -1239,8 +1245,6 @@ func runBDInProcessAllowError(t *testing.T, dir string, args ...string) (string, wOut.Close() wErr.Close() - os.Stdout = oldStdout - os.Stderr = oldStderr os.Chdir(oldDir) os.Args = oldArgs rootCmd.SetArgs(nil) diff --git a/cmd/bd/conflicts_conclude_integration_test.go b/cmd/bd/conflicts_conclude_integration_test.go index 2d27abe7e..a85964d20 100644 --- a/cmd/bd/conflicts_conclude_integration_test.go +++ b/cmd/bd/conflicts_conclude_integration_test.go @@ -135,6 +135,7 @@ func runConcludeCommand(t *testing.T, commandStore storage.DoltStorage, asJSON b t.Fatal(err) } os.Stdout, os.Stderr = wOut, wErr + defer func() { os.Stdout, os.Stderr = oldStdout, oldStderr }() store, rootCtx, jsonOutput = commandStore, context.Background(), asJSON conflictsConclude = true @@ -142,7 +143,6 @@ func runConcludeCommand(t *testing.T, commandStore storage.DoltStorage, asJSON b _ = wOut.Close() _ = wErr.Close() - os.Stdout, os.Stderr = oldStdout, oldStderr store, rootCtx, jsonOutput = oldStore, oldRootCtx, oldJSON conflictsConclude = oldConclude diff --git a/cmd/bd/dep_cycles_test.go b/cmd/bd/dep_cycles_test.go index b8df20525..8a978a09d 100644 --- a/cmd/bd/dep_cycles_test.go +++ b/cmd/bd/dep_cycles_test.go @@ -5,6 +5,7 @@ import ( "context" "io" "os" + "runtime" "strings" "testing" @@ -71,6 +72,7 @@ func TestCycleWarningSpellsTheWholePathIncludingUndescribableMembers(t *testing. t.Fatal(err) } os.Stderr = w + defer func() { os.Stderr = origStderr }() printCycleWarnings([]issueops.Cycle{{Partial: true, Members: []issueops.CycleMember{ {ID: "bd-a", Issue: &types.Issue{ID: "bd-a"}}, @@ -79,7 +81,6 @@ func TestCycleWarningSpellsTheWholePathIncludingUndescribableMembers(t *testing. }}}) _ = w.Close() - os.Stderr = origStderr var buf bytes.Buffer if _, err := io.Copy(&buf, r); err != nil { t.Fatal(err) @@ -106,11 +107,11 @@ func TestCycleWarningIsSilentWithoutCycles(t *testing.T) { t.Fatal(err) } os.Stderr = w + defer func() { os.Stderr = origStderr }() printCycleWarnings(nil) _ = w.Close() - os.Stderr = origStderr var buf bytes.Buffer if _, err := io.Copy(&buf, r); err != nil { t.Fatal(err) @@ -168,16 +169,62 @@ func captureCycleStdout(t *testing.T, run func()) string { if err != nil { t.Fatal(err) } + + // Drain concurrently: a synchronous drain deadlocks once the command + // writes more than the 64KiB pipe buffer, and it cannot run at all when + // run() exits via Goexit. + done := make(chan string, 1) + go func() { + var b bytes.Buffer + _, _ = io.Copy(&b, r) + done <- b.String() + }() + os.Stdout = w + restored := false + restore := func() string { + if restored { + return "" + } + restored = true + _ = w.Close() // unblocks the drain goroutine + os.Stdout = origStdout // ALWAYS runs, including on Goexit/panic + out := <-done + _ = r.Close() + return out + } + defer restore() run() - _ = w.Close() - os.Stdout = origStdout - var buf bytes.Buffer - if _, err := io.Copy(&buf, r); err != nil { - t.Fatal(err) + return restore() +} + +// TestCaptureCycleStdoutRestoresOnFatal pins be-gh02: a callback that Goexits +// must still leave os.Stdout restored. Before the fix this left os.Stdout as an +// orphaned pipe whose read end the GC finalizer later closed, making every +// subsequent write in the binary fail with "write |1: broken pipe". +// +// The leaking callback runs on a manually created goroutine that calls +// runtime.Goexit() directly rather than a t.Run subtest calling t.Fatal: the +// unwind-and-run-deferred-calls mechanism is identical, but this keeps the test +// itself green instead of always reporting a deliberately-failed subtest. +func TestCaptureCycleStdoutRestoresOnFatal(t *testing.T) { + real := os.Stdout + done := make(chan struct{}) + go func() { + defer close(done) + _ = captureCycleStdout(t, func() { + runtime.Goexit() + }) + }() + <-done + + if os.Stdout != real { + os.Stdout = real + t.Fatalf("captureCycleStdout leaked os.Stdout after a Goexit") } - _ = r.Close() - return buf.String() + if _, err := os.Stdout.Write(nil); err != nil { + t.Fatalf("os.Stdout unusable after capture: %v", err) + } } diff --git a/cmd/bd/dep_test.go b/cmd/bd/dep_test.go index 0e75ff7d4..77963d696 100644 --- a/cmd/bd/dep_test.go +++ b/cmd/bd/dep_test.go @@ -614,11 +614,11 @@ func TestOutputMermaidTree(t *testing.T) { old := os.Stdout r, w, _ := os.Pipe() os.Stdout = w + defer func() { os.Stdout = old }() outputMermaidTree(tt.tree, tt.rootID) w.Close() - os.Stdout = old var buf bytes.Buffer io.Copy(&buf, r) @@ -674,11 +674,11 @@ func TestOutputMermaidTree_Siblings(t *testing.T) { old := os.Stdout r, w, _ := os.Pipe() os.Stdout = w + defer func() { os.Stdout = old }() outputMermaidTree(tree, "BD-1") w.Close() - os.Stdout = old var buf bytes.Buffer io.Copy(&buf, r) @@ -913,11 +913,11 @@ func TestRenderTreeOutput(t *testing.T) { old := os.Stdout r, w, _ := os.Pipe() os.Stdout = w + defer func() { os.Stdout = old }() renderTree(tree, 50, "down") w.Close() - os.Stdout = old var buf bytes.Buffer io.Copy(&buf, r) @@ -968,11 +968,11 @@ func TestRenderTreeOutputShowsDependencyTypeLabelsInMixedGraph(t *testing.T) { old := os.Stdout r, w, _ := os.Pipe() os.Stdout = w + defer func() { os.Stdout = old }() renderTree(tree, 3, "both") w.Close() - os.Stdout = old var buf bytes.Buffer io.Copy(&buf, r) diff --git a/cmd/bd/dolt_test.go b/cmd/bd/dolt_test.go index 155c4759a..66153a2fd 100644 --- a/cmd/bd/dolt_test.go +++ b/cmd/bd/dolt_test.go @@ -1349,11 +1349,11 @@ func TestPrintNoRemoteGuidance(t *testing.T) { oldStdout := os.Stdout r, w, _ := os.Pipe() os.Stdout = w + defer func() { os.Stdout = oldStdout }() printNoRemoteGuidance() w.Close() - os.Stdout = oldStdout var buf bytes.Buffer _, _ = io.Copy(&buf, r) @@ -1375,11 +1375,11 @@ func TestPrintDivergedHistoryGuidance(t *testing.T) { oldStderr := os.Stderr r, w, _ := os.Pipe() os.Stderr = w + defer func() { os.Stderr = oldStderr }() printDivergedHistoryGuidance("push") w.Close() - os.Stderr = oldStderr var buf bytes.Buffer _, _ = io.Copy(&buf, r) @@ -1405,11 +1405,11 @@ func TestPrintAncestorPKMismatchGuidance(t *testing.T) { oldStderr := os.Stderr r, w, _ := os.Pipe() os.Stderr = w + defer func() { os.Stderr = oldStderr }() printAncestorPKMismatchGuidance(fmt.Errorf("error: cannot merge because table dependencies has different primary keys in its common ancestor")) w.Close() - os.Stderr = oldStderr var buf bytes.Buffer _, _ = io.Copy(&buf, r) diff --git a/cmd/bd/export_test.go b/cmd/bd/export_test.go index 1610d6eef..00f1a9f9e 100644 --- a/cmd/bd/export_test.go +++ b/cmd/bd/export_test.go @@ -178,6 +178,7 @@ func TestExportToStdout(t *testing.T) { oldStdout := os.Stdout r, w, _ := os.Pipe() os.Stdout = w + defer func() { os.Stdout = oldStdout }() exportOutput = "" exportAll = false @@ -187,7 +188,6 @@ func TestExportToStdout(t *testing.T) { err := runExport(nil, nil) w.Close() - os.Stdout = oldStdout if err != nil { t.Fatalf("runExport: %v", err) diff --git a/cmd/bd/init_test.go b/cmd/bd/init_test.go index b56467100..1ec32dd6e 100644 --- a/cmd/bd/init_test.go +++ b/cmd/bd/init_test.go @@ -275,12 +275,12 @@ func TestInitIfMissing(t *testing.T) { oldStderr := os.Stderr r, w, _ := os.Pipe() os.Stderr = w + defer func() { os.Stderr = oldStderr }() rootCmd.SetArgs([]string{"init", "--prefix", "test", "--init-if-missing"}) execErr := rootCmd.Execute() w.Close() - os.Stderr = oldStderr var buf bytes.Buffer buf.ReadFrom(r) stderr := buf.String() @@ -365,13 +365,13 @@ func TestInitIfMissingMatchingPrefixSkips(t *testing.T) { oldStderr := os.Stderr r, w, _ := os.Pipe() os.Stderr = w + defer func() { os.Stderr = oldStderr }() // Same prefix as the existing workspace: must skip, not abort. rootCmd.SetArgs([]string{"init", "--prefix", "test", "--init-if-missing"}) execErr := rootCmd.Execute() w.Close() - os.Stderr = oldStderr var buf bytes.Buffer buf.ReadFrom(r) stderr := buf.String() diff --git a/cmd/bd/main_errors_test.go b/cmd/bd/main_errors_test.go index 096629884..3c0b36d38 100644 --- a/cmd/bd/main_errors_test.go +++ b/cmd/bd/main_errors_test.go @@ -18,10 +18,10 @@ func TestHandleFreshCloneError_UsesBootstrapFirstGuidance(t *testing.T) { t.Fatal(pipeErr) } os.Stderr = w + defer func() { os.Stderr = origStderr }() handled := handleFreshCloneError(err) _ = w.Close() - os.Stderr = origStderr var buf bytes.Buffer if _, copyErr := io.Copy(&buf, r); copyErr != nil { diff --git a/cmd/bd/prompt_test.go b/cmd/bd/prompt_test.go index d94328b8f..d8a9cd387 100644 --- a/cmd/bd/prompt_test.go +++ b/cmd/bd/prompt_test.go @@ -151,6 +151,7 @@ func runPromptAutoExport(t *testing.T, input string) (bool, string, error) { setRootContext(ctx, cancel) os.Stdin = stdinFile os.Stdout = w + defer func() { os.Stdout = oldStdout }() got, promptErr := promptAutoExport() @@ -159,7 +160,6 @@ func runPromptAutoExport(t *testing.T, input string) (bool, string, error) { _, _ = io.Copy(&b, r) _ = r.Close() os.Stdin = oldStdin - os.Stdout = oldStdout cancel() rootCtx = oldRootCtx rootCancel = oldRootCancel diff --git a/cmd/bd/remote_migrate_gate_test.go b/cmd/bd/remote_migrate_gate_test.go index 4828cc98a..bd92b9865 100644 --- a/cmd/bd/remote_migrate_gate_test.go +++ b/cmd/bd/remote_migrate_gate_test.go @@ -23,11 +23,11 @@ func TestHandleRemoteMigrateGateJSON_Shape(t *testing.T) { t.Fatal(pipeErr) } os.Stderr = w + defer func() { os.Stderr = origStderr }() handleRemoteMigrateGateJSON(gate) _ = w.Close() - os.Stderr = origStderr var buf bytes.Buffer if _, err := io.Copy(&buf, r); err != nil { @@ -120,9 +120,9 @@ func TestHandleRemoteMigrateGateJSON_FallbackReason(t *testing.T) { t.Fatal(pipeErr) } os.Stderr = w + defer func() { os.Stderr = origStderr }() handleRemoteMigrateGateJSON(gate) _ = w.Close() - os.Stderr = origStderr var buf bytes.Buffer if _, err := io.Copy(&buf, r); err != nil { diff --git a/cmd/bd/schema_skew_test.go b/cmd/bd/schema_skew_test.go index a322aa8d3..104594733 100644 --- a/cmd/bd/schema_skew_test.go +++ b/cmd/bd/schema_skew_test.go @@ -23,11 +23,11 @@ func TestHandleSchemaSkewJSON_Shape(t *testing.T) { t.Fatal(pipeErr) } os.Stderr = w + defer func() { os.Stderr = origStderr }() handleSchemaSkewJSON(skew) _ = w.Close() - os.Stderr = origStderr var buf bytes.Buffer if _, err := io.Copy(&buf, r); err != nil { diff --git a/cmd/bd/test_helpers_pure_test.go b/cmd/bd/test_helpers_pure_test.go index 03c2a6f05..8c7acf479 100644 --- a/cmd/bd/test_helpers_pure_test.go +++ b/cmd/bd/test_helpers_pure_test.go @@ -223,7 +223,6 @@ func captureStdout(t *testing.T, fn func() error) string { oldStdout := os.Stdout r, w, _ := os.Pipe() - os.Stdout = w done := make(chan string, 1) go func() { @@ -232,13 +231,24 @@ func captureStdout(t *testing.T, fn func() error) string { done <- buf.String() }() + os.Stdout = w + restored := false + restore := func() string { + if restored { + return "" + } + restored = true + w.Close() + os.Stdout = oldStdout + out := <-done + _ = r.Close() + return out + } + defer restore() + err := fn() - w.Close() - os.Stdout = oldStdout - out := <-done - _ = r.Close() - + out := restore() if err != nil { t.Errorf("unexpected error: %v", err) } @@ -258,7 +268,6 @@ func captureStderr(t *testing.T, fn func()) string { if err != nil { t.Fatalf("os.Pipe: %v", err) } - os.Stderr = w var buf bytes.Buffer done := make(chan struct{}) @@ -267,11 +276,22 @@ func captureStderr(t *testing.T, fn func()) string { close(done) }() + os.Stderr = w + restored := false + restore := func() { + if restored { + return + } + restored = true + _ = w.Close() + os.Stderr = old + <-done + _ = r.Close() + } + defer restore() + fn() - _ = w.Close() - os.Stderr = old - <-done - _ = r.Close() + restore() return buf.String() } diff --git a/cmd/bd/zz_stdio_leak_guard_test.go b/cmd/bd/zz_stdio_leak_guard_test.go new file mode 100644 index 000000000..8a1432aec --- /dev/null +++ b/cmd/bd/zz_stdio_leak_guard_test.go @@ -0,0 +1,32 @@ +package main + +import ( + "os" + "testing" +) + +// realStdout/realStderr are captured at package-variable initialization, before +// any test runs, so they are the process's genuine streams. +var ( + realStdout = os.Stdout + realStderr = os.Stderr +) + +// TestZZStdioNotLeaked fails if any test in this package reassigned os.Stdout or +// os.Stderr and did not restore it. A capture helper that restores in a defer +// cannot trip this; one that restores on the happy path only will trip it as soon +// as its callback calls t.Fatal. See be-gh02. +func TestZZStdioNotLeaked(t *testing.T) { + if os.Stdout != realStdout { + t.Errorf("os.Stdout was leaked by an earlier test (now fd=%d name=%q); "+ + "a capture helper restored it on the happy path only - move the restore into a defer", + os.Stdout.Fd(), os.Stdout.Name()) + os.Stdout = realStdout + } + if os.Stderr != realStderr { + t.Errorf("os.Stderr was leaked by an earlier test (now fd=%d name=%q); "+ + "a capture helper restored it on the happy path only - move the restore into a defer", + os.Stderr.Fd(), os.Stderr.Name()) + os.Stderr = realStderr + } +} diff --git a/release-gates/be-sr7a-gate.md b/release-gates/be-sr7a-gate.md new file mode 100644 index 000000000..5d85b143b --- /dev/null +++ b/release-gates/be-sr7a-gate.md @@ -0,0 +1,122 @@ +# Release Gate: be-sr7a — cmd/bd capture helpers leak os.Stdout on t.Fatal, poisoning later tests with EPIPE + +- **Deploy bead:** be-sr7a +- **Review bead:** be-1kxq (verdict: pass) +- **Builder bead / branch (provenance only):** be-leuf / `builder/be-leuf` +- **Repo:** gastownhall/beads +- **Deploy commit:** `c0b7f865b28dbbcc658f85c9e8b1219c7fcef725` +- **Deploy branch:** `deploy/be-sr7a-gate` (cut from the commit above) +- **Base:** origin/main @ merge-base of the deploy commit (zero divergence — see criterion 6) +- **Evaluated:** 2026-08-15 by beads/deployer + +## Scope + +`cmd/bd`'s stdout-capture test helpers leaked the real `os.Stdout` when a +captured subtest called `t.Fatal`: the helper's deferred restore never ran +because `t.Fatal` unwinds via `runtime.Goexit`, not a normal return, so the +process-level `os.Stdout` stayed pointed at the (now-closed) capture pipe. +Later tests in the same process then wrote to a closed pipe and failed with +EPIPE ("broken pipe"), a flaky-looking failure with no relation to the test +that actually broke. + +Diff, confirmed via `git diff --stat origin/main..c0b7f865b` (14 files, all +`cmd/bd/*_test.go` — test-only, no production code changed): + +- `bca2d94e0` (red): adds a regression test that reproduces the leak. +- `c0b7f865b` (green): fixes the capture helper to restore `os.Stdout` via + `t.Cleanup` instead of a plain `defer`, so restoration runs even when + `t.Fatal` calls `runtime.Goexit` — plus the associated helper/assertion + test-file updates. + +## Gate criteria + +| # | Criterion | Verdict | Evidence | +|---|-----------|---------|----------| +| 6 | Clean divergence from `origin/main` (checked first) | **PASS** | `origin/main` is literally the merge-base of `c0b7f865b` — zero commits of divergence, no self-rebase needed. | +| 1 | Review PASS present | **PASS** | be-1kxq verdict: pass; reviewed commit matches `c0b7f865b28dbbcc658f85c9e8b1219c7fcef725` exactly. | +| 2 | Acceptance criteria met | **PASS** | All 8 "Done-when" items from be-leuf cross-referenced against the diff and this gate's own independent test run (see below); reviewer's `diff_review` independently reported 100% match, no deviations, no scope creep. | +| 3 | Tests pass | **PASS** | See "Tests run" below. | +| 3b | Policy/lint lane (`make ci-pr-policy`) | **PASS** | See "Policy lane" below. | +| 4 | No unresolved HIGH findings | **PASS** | be-1kxq reports no security findings, no HIGH findings. Diff is test-only (capture-helper lifecycle fix), consistent with that assessment. | +| 5 | Clean branch | **PASS** | `git status --porcelain=v1` on `deploy/be-sr7a-gate` is empty aside from 3 pre-existing untracked files belonging to *other* sessions' work (`release-gates/be-hi97-no-workspace-tests-gate.md`, `release-gates/be-uoat-dolt-diff-export-gate.md`, `scripts/rebase-resolve-lib.sh` — a known-crippled duplicate of the canonical library used to evaluate this gate) — not staged, not part of this branch's history, deliberately left untouched for their owning sessions. | +| 7 | Single feature theme | **PASS** | 14 files, all `cmd/bd/*_test.go` — one bug (stdout-leak-on-Fatal), one fix, test-file-only. `assert_deploy_ancestry_scope origin/main c0b7f865b be-sr7a be-leuf` → rc=0 (both commits cite `be-leuf`, the builder bead this deploy bead's own description names as source). | + +## Tests run + +Independently re-verified rather than trusted from be-1kxq's report, with +diff-owned tests resolved **by name**. + +Command (matching the builder/reviewer's own documented, justified +invocation for this package — a real Dolt server isn't available in this +sandbox): + +``` +DOCKER_HOST=... TESTCONTAINERS_RYUK_DISABLED=true BEADS_TEST_SKIP=dolt \ + scripts/test.sh -v -count=1 ./cmd/bd/... +``` + +Result: **2389 PASS, 0 FAIL, 844 SKIP, 0 panics.** All 844 skips are +Dolt-backend tests skipped via `BEADS_TEST_SKIP=dolt` (no Dolt server in +this sandbox) — environmental, not diff-owned; none are silent, all are +explicit `--- SKIP:` lines tied to the same documented, justified cause. All +5 packages under `./cmd/bd/...` report `ok`: `cmd/bd` (137.0s), +`cmd/bd/doctor` (1.7s), `cmd/bd/doctor/fix` (0.4s), `cmd/bd/protocol` +(9.5s), `cmd/bd/setup` (0.1s). + +**Diff-owned tests** (the actual regression coverage for this fix), each +confirmed **PASS** by name: + +- `TestCaptureCycleStdoutRestoresOnFatal` — PASS +- `TestZZStdioNotLeaked` — PASS +- `TestRunSyncCommandExitCodeMapping` — PASS, all 3 subtests: `ok`, + `conflict`, `retries-exhausted` — PASS + +**Direct proof the leak is fixed** (done-when item 8): `grep -ci "broken +pipe"` and `grep -ci "EPIPE"` on the full verbose log both return **0** — +no downstream test observed a closed-pipe write anywhere in the run. + +**Out-of-scope, informational only** (not part of this fix's acceptance +criteria, explicitly not gating): `TestDepCyclesNamesTheMembersItCannotDescribe` +and `TestDepCyclesSaysNothingIsWrongForACleanWorkspace` — both also PASS, +noted for completeness only. + +## Policy lane (`make ci-pr-policy`) + +Initial run failed on "check version consistency": +`.githooks/commit-msg: no 'BEGIN/END BEADS INTEGRATION' marker found` — +the exact same failure signature already root-caused during the be-3b4e +gate (see `release-gates/be-3b4e-gate.md`, "Policy lane"). Re-confirmed +rather than assumed from that precedent: `.githooks/commit-msg` is not +tracked on `origin/main` or anywhere in `git log --all`, is listed in +`.git/info/exclude`, and its own header identifies it as a gc-rig session +shim ("installed by worktree-setup.sh ... rewritten on every session +start"). `scripts/check-versions.sh` globs `.githooks/*` on the raw +filesystem rather than via `git ls-tree`, so it picks up this local +untracked shim when run inside a gc-managed worktree — unrelated to this +diff and unrelated to `origin/main`'s actual tracked content. Real +GitHub Actions CI checks out a clean tree without this shim, so the +upstream required check is unaffected. + +Remediated reversibly, same method as the be-3b4e precedent: moved the +shim to scratch, re-ran the full policy lane (clean, rc=0), restored the +shim immediately after, confirmed restoration (executable, correct +content, `git status --porcelain=v1` empty before and after). Full `make +ci-pr-policy` (check-build-tags, check-go-install-guidance, +check-versions, build-docs-binary, doc-flags, doc-freshness, +check-testing-short, workapi frontend boundary, no-beads-jsonl-changes, +`make api-check`): clean, exit 0. + +## Result: PASS + +All 7 criteria plus the 3b policy/lint lane pass, independently +re-verified rather than trusted from be-1kxq's report. The one policy-lane +hiccup encountered (`.githooks/commit-msg`) was root-caused (a local +gc-rig worktree artifact unrelated to this diff or to `origin/main`, and +already characterized identically by the be-3b4e precedent) and remediated +reversibly rather than waived or worked around silently. + +Merge authority: gastownhall/beads is a contributor-only repo (we do not +maintain it — `origin` remote push is disabled, +`DISABLED-upstream-is-fetch-only-push-to-fork-and-PR`). Deployer's job ends +at the opened PR; no `release-gate/deploy-clearance` status posted, no +merge-request routed to mayor. Upstream maintainers own the merge.