Fix #180: deterministic merge-gate tests #181

Merged
crueber merged 2 commits from fix/issue-180 into main 2026-09-06 18:13:12 +00:00
Owner

Test-only fix for #180. TestMergeConsultsReviewGate/deny pinned the transient running snapshot (StartMerge snapshots after spawning the worker; a descheduled test goroutine let the fast-denying fake gate run to terminal error first). fakeReviewGate/fakeChecksGate now block on test-owned entered/release channels: StartMerge -> deterministically running -> awaitGate -> release -> terminal assertions unchanged (error, narration, gate-once, no publish, not merged). Same treatment for the sister patterns: TestMergeConsultsChecksGate/deny and TestMergeStrategies (blocking allow review gate + gate-once pin). No production change. Verified: targeted -race -count=20 green, full internal/pulls -race green, coverage 97.7% (>=95%), gofmt/vet clean. Full ./internal/... -race green except pre-existing environmental e2e failure (fresh worktree lacks web/dist; unrelated).

Test-only fix for #180. TestMergeConsultsReviewGate/deny pinned the transient running snapshot (StartMerge snapshots after spawning the worker; a descheduled test goroutine let the fast-denying fake gate run to terminal error first). fakeReviewGate/fakeChecksGate now block on test-owned entered/release channels: StartMerge -> deterministically running -> awaitGate -> release -> terminal assertions unchanged (error, narration, gate-once, no publish, not merged). Same treatment for the sister patterns: TestMergeConsultsChecksGate/deny and TestMergeStrategies (blocking allow review gate + gate-once pin). No production change. Verified: targeted -race -count=20 green, full internal/pulls -race green, coverage 97.7% (>=95%), gofmt/vet clean. Full ./internal/... -race green except pre-existing environmental e2e failure (fresh worktree lacks web/dist; unrelated).
TestMergeConsultsReviewGate/deny pinned the transient running snapshot:
StartMerge returns entry.rec.snapshot() after spawning the worker, so a
descheduled test goroutine let the fast-denying fake gate run the worker
to terminal error before the snapshot. Same pattern in
TestMergeConsultsChecksGate/deny and TestMergeStrategies (merge_test.go:41).

fakeReviewGate/fakeChecksGate now block on test-owned channels (entered +
release): StartMerge -> deterministically running -> awaitGate proves the
worker reached the gate -> close(release) -> terminal assertions unchanged
(error, narration, gate-once, no publish, not merged). Test-only; no
production change. TestMergeStrategies uses a blocking allow review gate
plus a gate-once pin.
On any pre-release test failure the merge worker would block forever on
<-release: its ctx is context.WithoutCancel (merge.go), so the ctx.Done
arm can never fire. t.Cleanup with a sync.Once release unblocks the
worker on every path. Test-only; no production change.
Sign in to join this conversation.
No description provided.