* test(dolt): red — defer auto-wake must run for classified-read-only server-mode opens (be-vbhpf) TestServerModeDeferAutoWake exercises the same defer/wake contract as the embedded and proxied-server variants, against a real dolt sql-server. Today the sweep (DoltStore.wakeExpiredDefers) unconditionally skips whenever the store is opened read-only — including when that read-only-ness comes purely from command classification (bd ready/bd list are read-only for the CURRENT project), which is indistinguishable, before the fix, from a strict --readonly or foreign-project open that must never sweep. RED: expired_dated_defer_wakes_on_ready and expired_dated_defer_wakes_on_list_ready fail (issue never returns to open). dateless_defer_never_wakes and future_dated_defer_stays_hidden pass today too, trivially (no sweep runs at all pre-fix) — kept as regression guards for the GREEN step, which is where a unit test proving classifiedRead=false still does NOT sweep belongs, since that distinction doesn't exist yet at RED. * feat: green — defer auto-wake runs for classified-read-only server-mode opens (refs be-vbhpf) bd ready/bd list on a dolt-sql-server-backed store open with the store classified read-only for command purposes; the lazy defer-wake sweep silently early-returned before ever running, so expired defers never woke unless something else opened the store writable first. Threads a new ClassifiedRead flag through dolt.Config -> DoltStore, set at the call site to exactly "read-only because of command classification, not strict --readonly/preview/foreign-project" (policy.readOnly && !readonlyMode && !previewMode in main.go). wakeExpiredDefers's guard now delegates to a small extracted predicate, deferWakeSweepEligible(readOnly, classifiedRead), so the truth table can be unit-tested without a live store. * chore: release gate PASS for be-6iglh-gate * docs(release-gates): record the be-5fjqh rebase onto current main origin/main advanced 6 commits past this branch's base and PR #6082 went CONFLICTING; hourly pr-audit filed be-5fjqh. The branch is now rebased onto0efe0adf5. The only conflict was cmd/bd/main.go: this branch ande05000d64(wy-sbgucn) each append a field to the same dolt.Config literal at the same anchor line. Resolved keep-both -- PoolReadTimeoutFallback and ClassifiedRead drive disjoint code paths. The addendum records the new base and SHAs, patch-id equivalence for the five files that did not conflict, what was re-verified at the new base (build plus the diff-owned tests, container-backed), and what was NOT re-run (the full-suite and ci-pr-policy lanes still refer to the old base). Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of Jim Wordelman * docs(release-gates): record the be-qjern re-propose rebase and full re-gate PR #6082 was closed and its branch deleted 2026-09-01 by an unknown actor under the shared quad341 identity. Operator ruling 2026-09-08: accidental, not a rejection — re-proposing. This addendum records a second self-rebase onto current origin/main (zero conflicts this time), the full-suite and ci-pr-policy re-gate the 09-01 addendum left outstanding (0 FAIL, policy FAIL attributed to pre-existing be-mrl6j), and re-verification of both diff-owned container-backed tests at the new HEAD. refs be-qjern * test(feat): red — add strict --readonly server-mode subtest to TestServerModeDeferAutoWake (refs be-acsyx) * docs(release-gates): green — reword container-backed evidence claims, add nit-3 comment (refs be-acsyx) bee-ghosttrack nit 2: TestDeferWakeSweepEligibleHonorsClassifiedRead is a pure-function table test, not container-backed like TestServerModeDeferAutoWake — reworded release-gates/be-6iglh-gate.md criteria 2(4) and 3 accordingly, and attributed the preview/foreign-project claim to code structure at cmd/bd/main.go:1485 rather than to that test. PR #6424 body reworded to match (not part of this commit; edited via gh pr edit). bee-ghosttrack nit 3 (optional): one-line comment on the unreachable "classifiedRead without readOnly" table case explaining it documents totality, not a reachable state. Full suite: 0 FAIL. Targeted re-verification (TESTCONTAINERS_RYUK_DISABLED=true to dodge host-load reaper flakiness): TestServerModeDeferAutoWake 5/5 subtests PASS (12.427s), TestDeferWakeSweepEligibleHonorsClassifiedRead 4/4 subtests PASS (5.957s). * chore: remove leaked internal release-gate doc from PR branch release-gates/be-6iglh-gate.md Tracked our internal gc-management/beads-rig release-gate checklist and should never have been committed to this upstream branch -- it's process residue from our deploy tooling, not part of the change itself. Per maintainer bee-ghosttrack's request during review of PR #6571. The root cause (our deploy tooling auto-committing this file) is already fixed as of gm-qatxl1; this branch predates that fix, so this commit is cleanup only -- no other content on this branch is touched. Ref: be-lk7o3 * ci(proxied-shard): discover TestServerMode* entry points Review finding (major, Test Evidence Quality): TestServerModeDeferAutoWake — this PR's only end-to-end guard for the classified-read defer-wake fix — was selected by no CI lane. The two lanes that set BEADS_TEST_PROXIED_SERVER=1 both shard through proxied-test-shard.sh, whose discovery grep matched only `^func TestProxiedServer`, so the wiring lines at cmd/bd/main.go:1675 and internal/storage/dolt/store.go:2136 had zero CI-executed coverage: the one CI-reachable new test pins the pure predicate and cannot catch a mis-wired flag. Widen discovery to `^func Test(ProxiedServer|ServerMode)` in the shard script and in scripts/ci/gen_proxied_shard_manifest.py so the two discovery patterns stay in step, and widen the shard script's manifest-name validation to match. That last part is load-bearing, not cosmetic: without it a regenerated manifest containing a TestServerMode* row is rejected outright ("Invalid shard manifest line") and the whole lane exits 1. This also rescues the two pre-existing TestServerModeServe* suites, which share the identical requireSharedProxiedServer gate and the same shared dolt sql-server harness and were equally invisible — the unclosed class this PR was following. Verified: discovery goes 151 -> 154; a 15-shard BEADS_TEST_SHARD_LIST_ONLY=1 dry run assigns each of the 154 to exactly one shard with no pre-existing test moved (the three land on shards 4/13/15 via hash fallback); the pre-change script selects none of the three. Also clarifies the reviewers' nit: the "foreign-project" exclusion named in the new comments is not tested at the guard or in the policy expression — those opens build their own dolt.Config and leave ClassifiedRead false, so the guarantee is fail-closed by default. Iteration-2 review (two minors, both non-gating): the fixup's own new prose asserted two universals that measurement falsifies — the same class as the nit above, reintroduced in the CI files this fixup added. * proxied-test-shard.sh claimed "Both families gate on requireSharedProxiedServer", contradicted two lines earlier by its own mention of the TestProxiedServerPathHelpers unit test. Transitive gate census over the 154 discovered entry points: 143 reach requireSharedProxiedServer, 10 reach the different helper requireProxiedServerEnv, and TestProxiedServerPathHelpers (cmd/bd/proxied_server_test.go, bare `package main`, three assert.Equal calls on path helpers) has no gate and no build tag, so it also runs in every ordinary `go test ./cmd/bd/` lane. Now scoped to the TestServerMode* family, which does gate uniformly (3/3), and the TestProxiedServer* side is described as mixed rather than generalized over. * main.yml claimed TestServerMode* discovery means "neither family can be silently left out of CI". Discovery is a non-recursive cmd/bd/*_test.go glob: 154 top-level matches versus 156 recursive, the difference being cmd/bd/doctor/database_test.go:60 and cmd/bd/doctor/dolt_test.go:126. Now scoped to the top-level entry points, and the comment names the residual hazard (a container-gated suite added under cmd/bd/<subpkg>/ is still never selected here) instead of implying it cannot happen. Both edits are comment-only and behaviorally inert: non-comment lines are byte-identical in both files, and the 15-shard BEADS_TEST_SHARD_LIST_ONLY=1 sweep is byte-identical before and after (154 assignments, 0 duplicates, assigned set == discovered set, the three TestServerMode* still at 4/13/15). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * ci(bazel): add defer_wake_server_test.go to cmd/bd go_test srcs Maintainer CI repair, generated by `make bazel-sync` (gazelle). `cmd/bd/BUILD.bazel`'s `go_test` srcs is an explicit list, not a glob, so the new `cmd/bd/defer_wake_server_test.go` was never compiled or run by the Bazel lane. `Bazel / test` failed two required steps on the pushed head `0a3f5e0047`: Go test equivalence: go test: 105 packages, 8988 top-level tests bazel: 107 go_test targets, 106 tested; 8987 top-level tests seen tests go test runs that Bazel did not (1): cmd/bd TestServerModeDeferAutoWake EQUIVALENCE: FAIL BUILD files in sync (gazelle, go_srcs, MODULE.bazel): out of sync `BAZEL_TEST` is listed in `CI_GATE_REQUIRED` for `CI Gate / Required` (.github/workflows/pr.yml), so this is a required-lane red, not advisory. That the missing test is this PR's own headline guard makes the repair squarely in scope: the PR exists to close exactly this "no CI lane runs it" gap, and its review fixup closed it for the proxied shard lane. The Bazel lane had the same gap for a different reason. Attribution: main's Bazel run at this PR's exact base43a526b828concluded success, so the red is this branch's, not inherited. Validation: - `make bazel-sync` produces exactly this one line; a second run is a no-op (gazelle idempotent, md5 7d1d0549fcd466159451c02181661c78). - Byte-identical to CI's own `bazel-sync-patch` artifact for this head (blob pair efec974..6dd76e3). - srcs-only change: gazelle added no deps entry, so every import the new file needs was already declared. - `bazel build //cmd/bd:bd_test` succeeds, and the generated `bd_test_/testmain.go` now enumerates TestServerModeDeferAutoWake, which is the row the equivalence check reported missing. - `tools/bazel/go_srcs.py --check` was already clean, and `bazel mod tidy` produced no MODULE.bazel drift, so this single line is the whole repair. No contributor commit is modified and no Go source changes. --------- Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
118 lines
4.2 KiB
Go
118 lines
4.2 KiB
Go
//go:build cgo
|
|
|
|
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
// TestServerModeDeferAutoWake documents the same defer/wake contract as
|
|
// TestEmbeddedDeferAutoWake (defer_wake_embedded_test.go) and
|
|
// TestProxiedServerDeferAutoWake (defer_wake_proxied_integration_test.go), but
|
|
// against a real dolt sql-server (be-vbhpf): a DATED defer is a snooze, and
|
|
// once defer_until passes, the next ready-front read on `bd ready` or
|
|
// `bd list --ready` must return the issue to open. In server mode this sweep
|
|
// (DoltStore.wakeExpiredDefers) is silently skipped today because the store is
|
|
// opened read-only purely from command classification (bd ready/bd list are
|
|
// on the read-only allowlist for the CURRENT project, GH#804) — indistinguishable,
|
|
// before this fix, from a strict --readonly or foreign-project open that must
|
|
// never sweep.
|
|
func TestServerModeDeferAutoWake(t *testing.T) {
|
|
requireSharedProxiedServer(t)
|
|
t.Parallel()
|
|
|
|
bd := buildEmbeddedBD(t)
|
|
p := newServerModeProject(t, bd, "dws")
|
|
|
|
t.Run("expired_dated_defer_wakes_on_ready", func(t *testing.T) {
|
|
issue := bdCreate(t, bd, p.dir, "Expired snooze (server mode)", "--type", "task")
|
|
bdDefer(t, bd, p.dir, issue.ID, "--until", "2020-01-01")
|
|
status, _ := showDeferState(t, bd, p.dir, issue.ID)
|
|
if status != "deferred" {
|
|
t.Fatalf("precondition: expected status=deferred, got %q", status)
|
|
}
|
|
|
|
ids := wakeReadyIDs(t, bd, p.dir)
|
|
if !ids[issue.ID] {
|
|
t.Errorf("expected %s in bd ready after its defer date passed (server mode)", issue.ID)
|
|
}
|
|
status, deferUntil := showDeferState(t, bd, p.dir, issue.ID)
|
|
if status != "open" {
|
|
t.Errorf("expected status=open after wake, got %q", status)
|
|
}
|
|
if deferUntil != nil {
|
|
t.Errorf("expected defer_until cleared after wake (undefer's shape), got %v", deferUntil)
|
|
}
|
|
})
|
|
|
|
t.Run("expired_dated_defer_wakes_on_list_ready", func(t *testing.T) {
|
|
issue := bdCreate(t, bd, p.dir, "Expired snooze via list (server mode)", "--type", "task")
|
|
bdDefer(t, bd, p.dir, issue.ID, "--until", "2020-01-01")
|
|
|
|
issues := bdListJSON(t, bd, p.dir, "--ready")
|
|
var found *types.IssueWithCounts
|
|
for _, iss := range issues {
|
|
if iss.ID == issue.ID {
|
|
found = iss
|
|
break
|
|
}
|
|
}
|
|
if found == nil {
|
|
t.Fatalf("expected %s in bd list --ready after its defer date passed (server mode)", issue.ID)
|
|
}
|
|
if found.Status != types.StatusOpen {
|
|
t.Errorf("expected status=open in bd list --ready, got %q", found.Status)
|
|
}
|
|
if found.DeferUntil != nil {
|
|
t.Errorf("expected defer_until cleared after wake, got %v", found.DeferUntil)
|
|
}
|
|
})
|
|
|
|
t.Run("dateless_defer_never_wakes", func(t *testing.T) {
|
|
issue := bdCreate(t, bd, p.dir, "Indefinite icebox (server mode)", "--type", "task")
|
|
bdDefer(t, bd, p.dir, issue.ID)
|
|
|
|
ids := wakeReadyIDs(t, bd, p.dir)
|
|
if ids[issue.ID] {
|
|
t.Errorf("dateless defer %s must not appear in bd ready", issue.ID)
|
|
}
|
|
status, _ := showDeferState(t, bd, p.dir, issue.ID)
|
|
if status != "deferred" {
|
|
t.Errorf("dateless defer must stay deferred, got %q", status)
|
|
}
|
|
})
|
|
|
|
t.Run("future_dated_defer_stays_hidden", func(t *testing.T) {
|
|
issue := bdCreate(t, bd, p.dir, "Future snooze (server mode)", "--type", "task")
|
|
bdDefer(t, bd, p.dir, issue.ID, "--until", "+8760h")
|
|
|
|
ids := wakeReadyIDs(t, bd, p.dir)
|
|
if ids[issue.ID] {
|
|
t.Errorf("future defer %s must not appear in bd ready", issue.ID)
|
|
}
|
|
status, _ := showDeferState(t, bd, p.dir, issue.ID)
|
|
if status != "deferred" {
|
|
t.Errorf("future defer must stay deferred, got %q", status)
|
|
}
|
|
})
|
|
|
|
t.Run("expired_dated_defer_stays_hidden_under_strict_readonly", func(t *testing.T) {
|
|
issue := bdCreate(t, bd, p.dir, "Expired snooze under strict --readonly (server mode)", "--type", "task")
|
|
bdDefer(t, bd, p.dir, issue.ID, "--until", "2020-01-01")
|
|
status, _ := showDeferState(t, bd, p.dir, issue.ID)
|
|
if status != "deferred" {
|
|
t.Fatalf("precondition: expected status=deferred, got %q", status)
|
|
}
|
|
|
|
ids := wakeReadyIDs(t, bd, p.dir, "--readonly")
|
|
if ids[issue.ID] {
|
|
t.Errorf("expired defer %s must not appear in bd --readonly ready — strict --readonly must never sweep", issue.ID)
|
|
}
|
|
status, _ = showDeferState(t, bd, p.dir, issue.ID)
|
|
if status != "deferred" {
|
|
t.Errorf("expired defer must stay deferred under strict --readonly, got %q", status)
|
|
}
|
|
})
|
|
}
|