fix(close): verify bead gates on the proxied-server route (#5861 item 1) (#6962)

* fix(close): verify bead gates on the proxied-server route (wy-j48b3y)

The close pre-check built its bead-gate lookup on the local store, which
the proxied-server route never opens (the root pre-run short-circuits to
uowProvider). So `bd close <gate>` on a bead gate refused with
"no local store available" there even after the awaited bead had closed,
while `bd gate check` resolved the same gate through its fresh-read
getter. Item 1 of #5861.

The pre-check now picks the getter by route: proxied-server reads through
the same proxiedFreshReadGetter gate check uses (local read, then prefix
routes); direct and embedded keep the store-backed routed getter.

Tests: a proxied integration test covers the open-target refusal (which
now names the target's status), the closed-target close, and --force;
against the old code it fails with the exact upstream refusal. A unit
test pins the route selection. Docs and CHANGELOG drop the limitation.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* ci(shards): list TestProxiedServerCloseBeadGate in the proxied 30-shard manifest

#7129 turned the Bazel 30-shard block of
.github/scripts/proxied-cmd-test-shards.txt into an exact-once coverage
gate (TestProxiedShardManifestGeneratorNotStale in scripts/). This PR's
merge-base predates that gate, so after the rebase onto current main the
gate fails with "missing (1): TestProxiedServerCloseBeadGate", the
proxied integration test this PR adds.

Generated with the gate's own fix command,
`python3 scripts/ci/gen_proxied_shard_manifest.py 30 --weights=duration --write`.
The write is incremental: it puts the one name on the lightest shard (2)
and moves no existing assignment. The frozen 15-shard block is untouched.

Agent-Signature: claude-code-unknown-model-max on behalf of Eddie the Engineer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
This commit is contained in:
Bee 2026-10-08 06:01:18 +00:00 • committed by GitHub
commit 8bb99b49d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 112 additions and 28 deletions

View file

@ -256,6 +256,7 @@
30 1 TestProxiedServerSQLStatementRouting
30 1 TestProxiedServerServeLifecycle
30 2 TestProxiedServerCloseBeadGate
30 2 TestProxiedServerDelete
30 2 TestProxiedServerDeleteForceOrphans
30 2 TestProxiedServerIfRevisionGuardAssign

View file

@ -462,6 +462,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
installed/missing check still only tests for file existence and is tracked
separately.
- **`bd close` verifies a bead gate in proxied-server mode.** The close
pre-check built its bead-gate lookup on the local store, which the
proxied-server route never opens, so closing a bead gate there refused with
`no local store available` even after the awaited bead had closed, while
`bd gate check` resolved the same gate. The close pre-check now reads the
awaited bead through the same fresh-read path `bd gate check` uses on that
route; the direct and embedded routes are unchanged
([#5861](https://github.com/gastownhall/beads/issues/5861) item 1).
- **`bd doctor` no longer flags a `.local_version` that starts with `v`.** The
canonical spelling of a Go module version — and the string a build stamped
from a Go pseudo-version reports and writes into `.local_version` itself —

View file

@ -695,7 +695,7 @@ func checkGateSatisfaction(issue *types.Issue) error {
case issue.AwaitType == "timer":
resolved, escalated, reason, err = checkTimer(issue, time.Now())
case issue.AwaitType == "bead":
resolved, reason, err = checkBeadGate(rootCtx, routedBeadGateGetter{localStore: store}, issue.AwaitID)
resolved, reason, err = checkBeadGate(rootCtx, closeBeadGateGetter(), issue.AwaitID)
if err != nil {
// Unlike the gh:* and timer arms above, a bead gate whose store
// cannot be read stays closed: the close would need that same
@ -725,6 +725,20 @@ func checkGateSatisfaction(issue *types.Issue) error {
return fmt.Errorf("gate condition not satisfied: %s (use --force to override)", reason)
}
// closeBeadGateGetter picks the bead-gate lookup the current route can serve.
// The proxied-server route never opens the local store (the root pre-run
// short-circuits to uowProvider), so a store-backed getter there refused every
// bead gate with "no local store available" even when the awaited bead was
// closed (#5861); that route now reads through the same fresh-read getter
// `bd gate check` uses. The direct and embedded routes keep the store-backed
// local -> prefix-route lookup.
func closeBeadGateGetter() issueGetter {
if usesProxiedServer() {
return proxiedFreshReadGetter{}
}
return routedBeadGateGetter{localStore: store}
}
// autoCloseCompletedMolecule checks if closing a step completed an auto-closing
// parent molecule, and if so, closes the molecule root. Ordinary epics remain
// open when all children finish so they can become explicitly close-eligible

View file

@ -241,3 +241,21 @@ func TestCheckGateSatisfaction_BeadGateUnreadableStoreRefuses(t *testing.T) {
}
}
}
// The close pre-check reads a bead gate's target through the route that can
// serve it: the proxied route has no local store, so it must not build a
// store-backed getter there (#5861).
func TestCloseBeadGateGetter_RouteSelection(t *testing.T) {
oldMode := proxiedServerMode
t.Cleanup(func() { proxiedServerMode = oldMode })
proxiedServerMode = true
if _, ok := closeBeadGateGetter().(proxiedFreshReadGetter); !ok {
t.Errorf("proxied-server mode: got %T, want proxiedFreshReadGetter", closeBeadGateGetter())
}
proxiedServerMode = false
if _, ok := closeBeadGateGetter().(routedBeadGateGetter); !ok {
t.Errorf("direct mode: got %T, want routedBeadGateGetter", closeBeadGateGetter())
}
}

View file

@ -987,3 +987,71 @@ func TestProxiedServerCloseConcurrent(t *testing.T) {
t.Errorf("open issues remain after concurrent close: %d", openCount)
}
}
// bd close on a bead gate evaluates the awaited bead through the proxied read
// path. Before #5861 item 1 was fixed this route refused every bead gate with
// "no local store available", closed target or not, while bd gate check
// resolved the same gate.
func TestProxiedServerCloseBeadGate(t *testing.T) {
requireSharedProxiedServer(t)
t.Parallel()
bd := buildEmbeddedBD(t)
createBeadGate := func(t *testing.T, p proxiedProject) (gateID string, awaited *types.Issue) {
t.Helper()
parked := bdProxiedCreate(t, bd, p.dir, "Parked bead")
awaited = bdProxiedCreate(t, bd, p.dir, "Awaited bead")
out, stderr, err := bdProxiedRunBuffers(t, bd, p.dir,
"gate", "create", "--type=bead", "--blocks", parked.ID, "--await-id", awaited.ID, "--reason", "waiting on "+awaited.ID)
if err != nil {
t.Fatalf("bead gate create failed: %v\nstderr:\n%s", err, stderr)
}
return parseCreatedGateID(t, out), awaited
}
t.Run("awaited_open_refuses_with_its_status", func(t *testing.T) {
t.Parallel()
p := newSharedProxiedProject(t, bd, "cbgo")
gateID, awaited := createBeadGate(t, p)
out := bdProxiedCloseFail(t, bd, p.dir, gateID)
if strings.Contains(out, "no local store available") {
t.Errorf("close read the gate through a store-less getter:\n%s", out)
}
if !strings.Contains(out, "gate condition not satisfied") || !strings.Contains(out, "bead "+awaited.ID+" is open") {
t.Errorf("expected the awaited bead's status in the refusal, got:\n%s", out)
}
db := openProxiedDB(t, p)
if got := readStatus(t, db, gateID); got != types.StatusOpen {
t.Errorf("refused gate should stay open, got %q", got)
}
})
t.Run("awaited_closed_closes", func(t *testing.T) {
t.Parallel()
p := newSharedProxiedProject(t, bd, "cbgc")
gateID, awaited := createBeadGate(t, p)
bdProxiedClose(t, bd, p.dir, awaited.ID)
bdProxiedClose(t, bd, p.dir, gateID, "-r", "awaited bead closed")
db := openProxiedDB(t, p)
if got := readStatus(t, db, gateID); got != types.StatusClosed {
t.Errorf("gate should close once its awaited bead is closed, got %q", got)
}
if got := readCloseReason(t, db, gateID); got != "awaited bead closed" {
t.Errorf("close_reason: got %q, want %q", got, "awaited bead closed")
}
})
t.Run("force_skips_the_check", func(t *testing.T) {
t.Parallel()
p := newSharedProxiedProject(t, bd, "cbgf")
gateID, _ := createBeadGate(t, p)
bdProxiedClose(t, bd, p.dir, gateID, "--force")
db := openProxiedDB(t, p)
if got := readStatus(t, db, gateID); got != types.StatusClosed {
t.Errorf("--force should close the gate regardless, got %q", got)
}
})
}

View file

@ -423,27 +423,6 @@ don't know", not "this is definitely broken". A genuinely missing or
broken `dolt` binary (not found, not executable, or the probe itself
fails/times out) is a hard error, not a warning.
### Proxied-server mode: closing a bead gate fails with "no local store available"
```
gate condition not satisfied: bead gate "bd-a1b2": no local store available (use --force to override)
```
`bd close` on a bead gate refuses this way in proxied-server mode even when
the awaited bead is closed. Proxied-server commands run against a shared
`dolt sql-server` and never open a local store, so the close path has
nothing to read the awaited bead's status from.
`bd gate check` does evaluate bead gates in proxied-server mode, and closes
the ones whose target has closed:
```bash
bd gate check --type=bead # closes bead gates whose awaited bead is closed
bd close <gate-id> --force # or close without verifying the condition
```
Tracked in [#5861](https://github.com/gastownhall/beads/issues/5861).
### Prefix routing: "proxy server store needs to be uow provider"
A lookup routed through the orchestrator's `routes.jsonl` prefix routes

View file

@ -54,18 +54,13 @@ repository.
### Known limitations: multi-rig and proxied-server topologies
Bead gates and prefix routing (`routes.jsonl`) do not work in every
topology. Three limitations to expect, all tracked in
topology. Two limitations to expect, both tracked in
[#5861](https://github.com/gastownhall/beads/issues/5861):
- **Cross-rig bead gates never resolve on their own.** A `<rig>:<bead-id>`
await value reports `cannot be checked (multi-rig routing removed)` and
stays pending regardless of the awaited bead's status. Close it with
`bd gate resolve`.
- **`bd close` cannot verify a bead gate in the experimental proxied-server
mode.** Proxied-server commands never open a local store, so closing the
gate refuses with `no local store available` even when the awaited bead is
closed. Run `bd gate check`, which evaluates bead gates in proxied-server
mode and closes the satisfied ones, or `bd close --force`.
- **Prefix routing cannot open a proxied-server target rig.** A routed
lookup into a rig that is itself in proxied-server mode fails with
`proxy server store needs to be uow provider`, so an all-proxied