fix(dolt): pin recompute connections to the store's actual branch (#5848)

* test(dolt): red — branch-invariant regression test for recompute connections (refs be-b0am)

Adds TestPinStoreBranch_ReproducesStoreActiveBranch, asserting directly that
a fresh long-timeout connection must be pinned to the store's real
active_branch() rather than defaulting away from it. Fails to compile today:
pinStoreBranch does not exist yet. GREEN step will factor the branch
reproduction already performed by withReadTxLongTimeout into this shared
helper and wire it into recomputeAllBlocked and recomputeBlockedTx.

* fix(dolt): green — pin recompute connections to the store's real branch (refs be-b0am)

recomputeAllBlocked and recomputeBlockedTx each opened a fresh long-timeout
connection and began a transaction on it directly, with zero branch
reproduction. Dolt branch checkout is per-connection session state, so the
fresh connection silently defaulted to the database's default branch
instead of whatever branch the store's pooled session (s.db) was actually
checked out to — a full recompute or a post-merge recompute would then
repair the wrong branch and commit there, exit 0, while the branch the
caller actually cares about kept its stale is_blocked flags.

withReadTxLongTimeout already reproduced the branch correctly (query
active_branch() on s.db, CALL DOLT_CHECKOUT on the fresh connection, falling
back to s.branch only if the query fails). Factored that into a new
pinStoreBranch helper, shared by all three call sites, and gave the two
recompute functions the same single-physical-connection pinning federation.go's
filteredPushToPeer already uses (SetMaxIdleConns(0) + db.Conn(ctx)) so the
checkout and the BeginTx that follows it cannot land on different pooled
connections.

recomputeAllBlockedWithDB/recomputeBlockedTxWithDB now take a small
txBeginner interface (just BeginTx) instead of a concrete *sql.DB, satisfied
by both *sql.DB and *sql.Conn — settlement_commit_boundary_test.go's sqlmock
unit tests keep passing a *sql.DB unchanged.

Audited every other fresh-connection call site (execWithLongTimeout,
execWithLongTimeoutNoTx, pullWithAutoResolveUnchecked, federation.go's
filteredPushToPeer): three are safe by construction (target branch/ref
passed explicitly, not inherited from checkout). pullWithAutoResolveUnchecked
has the same latent hazard on its federation.go:126 peer-pull route (no
branch arg to CALL DOLT_PULL) — out of scope here (needs its own regression
test for a merge landing on the wrong branch), filed as be-5ybd.

Tests: TestRecomputeAllBlocked_{RefusesDirtyIssues,RefusesDirtyDependencies,
AllowsDirtyWisps,RepairsAndCommitsWhenClean}, TestMergeRecomputesIsBlocked,
TestPinStoreBranch_ReproducesStoreActiveBranch (new, be-b0am's direct
branch-invariant regression test) all pass against a real Dolt container.
gofmt and go vet clean.

* chore(deploy): release gate record for be-a8g61

* fix(dolt): correct the pull-path branch audit — all three callers share the hazard

The annotation on pullWithAutoResolveUnchecked claimed store.go's two callers
were safe because they pass s.branch to CALL DOLT_PULL(...). That is wrong:
DOLT_PULL's second positional arg names the remote ref to merge FROM
(doDoltPull binds it to remoteRefName), while the merge target is always the
session's current working branch (CWBHeadRef) — on this fresh
openLongTimeoutConn connection, the database's default branch.

So both store.go callers pin only the source and still merge into the default
branch, federation.go's single-arg route derives source and target from it, and
the GH#3144 DOLT_MERGE(trackingRef) fallback merges into it as well.

Widens the tracked follow-up (be-5ybd) from federation-only to all three call
sites, and records the correct fix (pinStoreBranch before BeginTx) — the bead's
previous suggestion of passing a branch argument would not have moved the merge
target.

Refs be-5ybd.

* docs(dolt): say why the fetch half of the exec audit is safe, not just that it is

The execWithLongTimeout annotation justified both callers with one reason --
"passes its target branch/ref explicitly as a query arg". That is true of
CALL DOLT_PUSH(?, ?), which names the refspec, but not of CALL DOLT_FETCH(?),
which passes only the remote and so has no ref argument to point at.

Fetch is still safe, for a different reason: with no refspec argument dolt
resolves the remote's configured fetch specs (ParseRefSpecs falls through to
GetRefSpecs, which reads remote.FetchSpecs), so the refs come from remote
config rather than session state, and the resulting RemoteRefSpecs write
remote-tracking refs only -- never the working branch.

Naming both reasons keeps the annotation checkable: a later reader can verify
each caller against the reason given for it instead of against a claim that
only holds for one of them.

* docs(dolt): record that pinStoreBranch's active_branch() read assumes a single-conn pool

pinStoreBranch reads the store's live branch with SELECT active_branch() on
s.db, but branch checkout is per-connection session state and s.db is a pool.
Checkout() leases one connection, runs DOLT_CHECKOUT on it and hands it back,
so only that physical connection carries the new branch. The pool defaults to
10 (BEADS_DOLT_MAX_CONNS / dolt.max-conns override it), so on a genuinely
multi-connection pool the read can be answered by a sibling connection still
sitting on the branch it was opened with.

That is not a live defect: the paths relying on this pin run effectively
single-connection, because server-mode stores are pinned to MaxOpenConns=1
for the same session-scoped-branch reason (iter_issues.go). But it is
reliable in practice, not by construction, and the s.branch fallback does not
cover it -- that only fires when the query errors, not when it succeeds with
another connection's answer.

Documented rather than fixed: making it true by construction means taking the
read on a connection the caller already holds, which changes the helper's
signature and its three call sites, and belongs with the pull-path work in
be-5ybd rather than in this bead's regression cycle.
This commit is contained in:
Jim Wordelman 2026-08-19 12:44:06 -07:00 • committed by GitHub
commit 537d00b265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 244 additions and 24 deletions

View file

@ -463,6 +463,13 @@ func (s *DoltStore) filteredPushToPeer(ctx context.Context, peer string, exclude
// Pin a single long-timeout connection for the session-scoped staging
// operation. RecomputeAllIsBlockedInTx can exceed the shared pool's
// 10-second I/O deadline, and branch state is connection-scoped.
//
// Audited for be-b0am's fresh-connection branch hazard: safe. Unlike
// recomputeAllBlocked/recomputeBlockedTx, this never depends on the
// fresh connection's default checkout — it explicitly creates
// stagingBranch FROM sourceBranch (CALL DOLT_BRANCH(stagingBranch,
// sourceBranch) in stageFilteredBranch) and checks that out by name, so
// the source ref is named, not inherited.
db, err := s.openLongTimeoutConn()
if err != nil {
return fmt.Errorf("federation filter: open long-timeout connection: %w", err)

View file

@ -1027,6 +1027,58 @@ func (s *DoltStore) withReadTx(ctx context.Context, fn func(tx *sql.Tx) error) e
})
}
// execer is satisfied by both *sql.DB and *sql.Conn, letting pinStoreBranch
// share one implementation between withReadTxLongTimeout's one-shot *sql.DB
// and a single pinned *sql.Conn (see recomputeAllBlocked/recomputeBlockedTx).
type execer interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
// pinStoreBranch reproduces the store's real active branch on conn. Branch
// checkout is Dolt session state, scoped to one physical connection — a
// fresh connection (from openLongTimeoutConn or db.Conn) defaults to the
// database's default branch rather than inheriting whatever branch the
// store's pooled session (s.db) is actually checked out to. Query s.db for
// its live active_branch() (preferred over the possibly-stale s.branch
// field, which is only ever set inside Checkout() and left behind by any
// checkout run directly against s.db, e.g. the test harness's
// per-test-branch isolation) and reproduce that checkout on conn before any
// read or write runs on it. Every caller that opens its own connection
// instead of using the shared pool (s.db) must call this before issuing any
// branch-sensitive query — see openLongTimeoutConn's callers.
//
// Caveat: the SELECT active_branch() read below is only well-defined when the
// pool behind s.db is effectively single-connection. Checkout() leases one
// connection from that pool (s.db.Conn), runs DOLT_CHECKOUT on it and returns
// it — the branch stays with that physical connection, because checkout is
// per-connection session state. The pool defaults to defaultMaxOpenConns (10,
// overridable by BEADS_DOLT_MAX_CONNS or dolt.max-conns), so on a genuinely
// multi-connection pool this read may be served by a sibling connection that
// never saw that checkout and still reports the branch it was opened with.
// The paths that rely on this pin run effectively single-connection —
// server-mode stores are pinned to MaxOpenConns=1 precisely because branch
// isolation is session-level (see iter_issues.go) — so the read is reliable
// in practice rather than by construction. The s.branch fallback does not
// close the gap either: it fires only when the query errors, not when it
// succeeds with another connection's answer.
func (s *DoltStore) pinStoreBranch(ctx context.Context, conn execer) error {
var branch string
if scanErr := s.db.QueryRowContext(ctx, "SELECT active_branch()").Scan(&branch); scanErr == nil {
if branch != "" {
if _, err := conn.ExecContext(ctx, "CALL DOLT_CHECKOUT(?)", branch); err != nil {
return fmt.Errorf("checkout active branch %q: %w", branch, err)
}
}
} else if s.branch != "" {
// Fall back to the store's recorded branch rather than failing the
// whole call outright.
if _, err := conn.ExecContext(ctx, "CALL DOLT_CHECKOUT(?)", s.branch); err != nil {
return fmt.Errorf("checkout fallback branch %q: %w", s.branch, err)
}
}
return nil
}
// withReadTxLongTimeout is like withReadTx but runs fn against a dedicated
// one-shot connection with a 5-minute read timeout (see openLongTimeoutConn)
// instead of the shared pool's 10s ReadTimeout (see buildServerDSN). Use for
@ -1053,26 +1105,9 @@ func (s *DoltStore) withReadTxLongTimeout(ctx context.Context, fn func(tx *sql.T
defer db.Close()
// The fresh one-shot connection defaults to the default branch, not
// whatever branch the store's pooled session (s.db) is actually
// checked out to. The pool is branch-isolated (MaxOpenConns(1)
// semantics — see the comment on MaxOpenConns above), so ask it for
// its real active branch and reproduce that checkout here before
// starting the read tx; otherwise a query like dolt_history_* would
// silently read the wrong branch after any in-process checkout,
// including a test-harness CALL DOLT_CHECKOUT run directly against
// s.db, which bypasses Store.Checkout and leaves s.branch stale.
var branch string
if scanErr := s.db.QueryRowContext(ctx, "SELECT active_branch()").Scan(&branch); scanErr == nil {
if branch != "" {
if _, err := db.ExecContext(ctx, "CALL DOLT_CHECKOUT(?)", branch); err != nil {
return fmt.Errorf("checkout active branch %q on long-timeout connection: %w", branch, err)
}
}
} else if s.branch != "" {
// Fall back to the store's recorded branch rather than failing
// the whole call outright.
if _, err := db.ExecContext(ctx, "CALL DOLT_CHECKOUT(?)", s.branch); err != nil {
return fmt.Errorf("checkout fallback branch %q on long-timeout connection: %w", s.branch, err)
}
// checked out to — reproduce it before starting the read tx.
if err := s.pinStoreBranch(ctx, db); err != nil {
return err
}
tx, err := db.BeginTx(ctx, nil)
if err != nil {
@ -2164,6 +2199,15 @@ func buildServerDSN(cfg *Config, database string) string {
// DOLT_PULL merge operations succeed even when the server runs with
// autocommit=1. Without this, Dolt rejects merges under autocommit because
// it cannot expose conflict-resolution tables to the caller.
//
// Audited for be-b0am's fresh-connection branch hazard: safe — but the two
// callers are safe for different reasons, so the annotation names both.
// federation.go's CALL DOLT_PUSH(?, ?) names the refspec explicitly. Its
// CALL DOLT_FETCH(?) passes only the remote: with no refspec argument dolt
// falls back to the remote's configured refspecs (ParseRefSpecs ->
// GetRefSpecs), which are remote config rather than session state, and a
// fetch writes only remote-tracking refs, never the working branch. Neither
// depends on this fresh connection's default checkout.
func (s *DoltStore) execWithLongTimeout(ctx context.Context, query string, args ...any) error {
cfg, err := mysql.ParseDSN(s.connStr)
if err != nil {
@ -2191,6 +2235,10 @@ func (s *DoltStore) execWithLongTimeout(ctx context.Context, query string, args
// an explicit transaction. Push operations do not need the pull/merge conflict
// handling above, and DOLT_PUSH has diverged from direct `dolt push` behavior
// when wrapped in a SQL transaction.
//
// Audited for be-b0am's fresh-connection branch hazard: safe. Every caller
// passes s.branch explicitly as a CALL DOLT_PUSH(...) arg, so this fresh
// connection's default checkout never matters.
func (s *DoltStore) execWithLongTimeoutNoTx(ctx context.Context, query string, args ...any) error {
db, err := s.oneShotConn(5 * time.Minute)
if err != nil {
@ -3955,6 +4003,27 @@ func (s *DoltStore) pullWithAutoResolve(ctx context.Context, remote string, quer
}
func (s *DoltStore) pullWithAutoResolveUnchecked(ctx context.Context, remote string, query string, args ...any) error {
// Audited for be-b0am's fresh-connection branch hazard: NOT safe, and all
// three callers share it. Passing a branch argument does not avoid it.
//
// DOLT_PULL's second positional arg names the remote ref to merge FROM
// (dolt's doDoltPull binds it to remoteRefName); the merge TARGET is
// always the session's current working branch (CWBHeadRef), which on this
// fresh openLongTimeoutConn connection is the database's default branch,
// never s.branch. So store.go's two callers, which pass s.branch to
// CALL DOLT_PULL(...), pin only the source and still merge into the
// default branch; federation.go's peer-pull route (CALL DOLT_PULL(?),
// remote only) derives both source and target from that same default
// branch. The GH#3144 fallback below has the same shape — DOLT_FETCH
// names the remote ref, but CALL DOLT_MERGE(trackingRef) merges into the
// current branch too.
//
// Left unfixed here deliberately: this is be-b0am's root cause on a
// pull/merge path, and a merge landing on the wrong branch has a much
// larger blast radius than a stale is_blocked flag, so it needs its own
// regression test asserting the merge target rather than riding an
// unrelated TDD cycle. Tracked as be-5ybd, which covers all three call
// sites. The fix is s.pinStoreBranch(ctx, db) before BeginTx below.
db, err := s.openLongTimeoutConn()
if err != nil {
return err
@ -4137,10 +4206,34 @@ func (s *DoltStore) recomputeAllBlocked(ctx context.Context) (int, error) {
return 0, err
}
defer db.Close()
return s.recomputeAllBlockedWithDB(ctx, db)
// Pin a single physical connection for the whole operation (same
// pattern as federation.go's filteredPushToPeer — branch state is
// connection-scoped, so BeginTx must run on the exact connection that
// was just checked out, not whatever the pool hands out next) and
// reproduce the store's real active branch on it before the recompute
// reads or writes anything; otherwise this fresh connection defaults to
// Dolt's default branch instead of whatever the store is actually
// checked out to (be-b0am).
db.SetMaxIdleConns(0)
conn, err := db.Conn(ctx)
if err != nil {
return 0, fmt.Errorf("acquire long-timeout connection: %w", err)
}
defer conn.Close()
if err := s.pinStoreBranch(ctx, conn); err != nil {
return 0, err
}
return s.recomputeAllBlockedWithDB(ctx, conn)
}
func (s *DoltStore) recomputeAllBlockedWithDB(ctx context.Context, db *sql.DB) (int, error) {
// txBeginner is satisfied by both *sql.DB and *sql.Conn, letting
// recomputeAllBlockedWithDB run either against a caller-owned pinned
// *sql.Conn (recomputeAllBlocked) or directly against a *sql.DB (tests).
type txBeginner interface {
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}
func (s *DoltStore) recomputeAllBlockedWithDB(ctx context.Context, db txBeginner) (int, error) {
tx, err := db.BeginTx(ctx, nil)
if err != nil {
return 0, fmt.Errorf("begin is_blocked recompute: %w", err)
@ -4192,10 +4285,22 @@ func (s *DoltStore) recomputeBlockedTx(ctx context.Context, fromCommit string) e
return err
}
defer db.Close()
return s.recomputeBlockedTxWithDB(ctx, db, fromCommit)
// See recomputeAllBlocked: pin a single physical connection and
// reproduce the store's real active branch on it before the recompute
// runs (be-b0am).
db.SetMaxIdleConns(0)
conn, err := db.Conn(ctx)
if err != nil {
return fmt.Errorf("acquire long-timeout connection: %w", err)
}
defer conn.Close()
if err := s.pinStoreBranch(ctx, conn); err != nil {
return err
}
return s.recomputeBlockedTxWithDB(ctx, conn, fromCommit)
}
func (s *DoltStore) recomputeBlockedTxWithDB(ctx context.Context, db *sql.DB, fromCommit string) error {
func (s *DoltStore) recomputeBlockedTxWithDB(ctx context.Context, db txBeginner, fromCommit string) error {
tx, err := db.BeginTx(ctx, nil)
if err != nil {
return fmt.Errorf("begin is_blocked recompute: %w", err)

View file

@ -0,0 +1,60 @@
package dolt
import (
"testing"
)
// TestPinStoreBranch_ReproducesStoreActiveBranch is the be-b0am regression
// test: pinStoreBranch is the single implementation withReadTxLongTimeout,
// recomputeAllBlocked, and recomputeBlockedTx all depend on to avoid running
// on a fresh connection's default branch instead of the store's real branch.
// Branch checkout is connection-scoped session state in Dolt, so a fresh
// *sql.DB from openLongTimeoutConn defaults away from whatever the pooled
// store connection (s.db) is actually checked out to — this is exactly the
// production bug reported against recomputeAllBlocked/recomputeBlockedTx.
//
// This asserts the invariant directly on the connection's active_branch(),
// not on a downstream symptom (row counts, commit contents). A symptom-only
// test would pass again the moment someone reintroduces the split with
// different pool timing — see federation.go's SetMaxIdleConns(0)+Conn(ctx)
// pattern for why that hazard is not hypothetical.
func TestPinStoreBranch_ReproducesStoreActiveBranch(t *testing.T) {
store, cleanup := setupTestStore(t)
defer cleanup()
ctx, cancel := testContext(t)
defer cancel()
var storeBranch string
if err := store.db.QueryRowContext(ctx, "SELECT active_branch()").Scan(&storeBranch); err != nil {
t.Fatalf("query store active_branch: %v", err)
}
if storeBranch == "" || storeBranch == "main" {
t.Fatalf("precondition: setupTestStore must isolate the pooled connection onto a non-default branch, got %q", storeBranch)
}
db, err := store.openLongTimeoutConn()
if err != nil {
t.Fatalf("openLongTimeoutConn: %v", err)
}
defer db.Close()
var freshBranch string
if err := db.QueryRowContext(ctx, "SELECT active_branch()").Scan(&freshBranch); err != nil {
t.Fatalf("query fresh connection active_branch: %v", err)
}
if freshBranch == storeBranch {
t.Fatalf("precondition: a brand-new connection must NOT already report the store's branch (got %q) — otherwise this test cannot distinguish a pinned connection from an accidentally-matching default", storeBranch)
}
if err := store.pinStoreBranch(ctx, db); err != nil {
t.Fatalf("pinStoreBranch: %v", err)
}
var pinnedBranch string
if err := db.QueryRowContext(ctx, "SELECT active_branch()").Scan(&pinnedBranch); err != nil {
t.Fatalf("query pinned connection active_branch: %v", err)
}
if pinnedBranch != storeBranch {
t.Fatalf("connection must report the store's active branch %q after pinStoreBranch, got %q", storeBranch, pinnedBranch)
}
}

View file

@ -0,0 +1,48 @@
# Release Gate: be-a8g61 — recomputeAllBlocked/recomputeBlockedTx repaired the wrong branch on a fresh connection
- **Deploy bead:** be-a8g61
- **Review bead:** be-ahog (closed, verdict: pass)
- **Build bead:** be-b0am
- **Repo:** gastownhall/beads
- **Deploy commit:** `929a5c347e2a730835bfb790e00f151f2a81b0dd`
- **Deploy branch:** `deploy/be-a8g61-gate` (cut from the commit above, pushed to `headfork` = quad341/beads-sec003-contrib)
- **Base:** origin/main @ `ed382cbdb89cf7ba42b020e4927575dbf27e102e`
## Pre-flight: already-merged check
`gh api repos/gastownhall/beads/commits/929a5c347.../pulls` — no PR references this commit. Clean.
## Ancestry scope (assert_deploy_ancestry_scope)
Base→deploy range: 2 commits, both cite be-b0am, neither touches `.claude/**`. rc=0.
## Gate criteria
1. **Review PASS present** — PASS. be-ahog status=closed, close_reason=pass, verdict:pass in notes; deploy_bead/deploy_commit metadata match be-a8g61 exactly.
2. **Acceptance criteria met** — PASS. All 6 of be-b0am's Done-when items individually cross-checked by the reviewer against the diff; no uncovered criteria recorded.
3. **Tests pass** — PASS. Reviewer's documented command, independently re-run by me on a detached checkout of the reviewed SHA (fresh testcontainers lifecycle, distinct container/session id from the reviewer's run):
```
DOCKER_HOST=unix:///run/user/1000/podman/podman.sock TESTCONTAINERS_RYUK_DISABLED=true \
go test -tags=integration,gms_pure_go -run '^(TestMergeRecomputesIsBlocked|TestRecomputeAllBlocked_RefusesDirtyIssues|TestRecomputeAllBlocked_RefusesDirtyDependencies|TestRecomputeAllBlocked_AllowsDirtyWisps|TestRecomputeAllBlocked_RepairsAndCommitsWhenClean|TestPinStoreBranch_ReproducesStoreActiveBranch)$' \
-v ./internal/storage/dolt/...
```
Result: 6 PASS, 0 FAIL, 0 SKIP in 18.919s. Diff-owned test (`TestPinStoreBranch_ReproducesStoreActiveBranch`, the only test file touched by this diff) confirmed genuinely red pre-fix (compile-red) by the reviewer. `waiver_ref: none`.
3a. **Pre-existing-failure attribution** — N/A for the test lane (no failures to attribute); used for 3b below.
3b. **Policy/lint lane** — PASS, with one attributed pre-existing failure.
- `make ci-pr-policy` on the reviewed SHA as checked out initially failed:
`.githooks/commit-msg: no 'BEGIN/END BEADS INTEGRATION' marker found` + a resulting version-mismatch report from `scripts/check-versions.sh`.
- Attribution, all 4 clauses of `non-diff-owned-gate-failure`:
- *Not diff-owned*: `git diff --name-only origin/main...929a5c347e2a730835bfb790e00f151f2a81b0dd -- .githooks/` is empty — the diff never touches this path.
- *No path overlap*: `.githooks/` vs. the diff's `internal/storage/dolt/**` — disjoint.
- *Tracked bead id*: be-jygq (closed) root-caused this: `.githooks/commit-msg` is not tracked in git anywhere (`git log --all -- .githooks/commit-msg` and `git ls-tree origin/main -- .githooks/commit-msg` both empty) and is listed in this worktree's `.git/info/exclude`. It is a local gc-rig session shim rewritten by `worktree-setup.sh` on every session start; `scripts/check-versions.sh` globs `.githooks/*` on the raw filesystem rather than via `git ls-tree`, so it only surfaces inside a gc-managed worktree. Independently re-confirmed this round (`git log --all` / `git ls-tree` / `.git/info/exclude` all checked directly, not just cited from the bead). be-2q84 (open) and be-jy56 (open) are later duplicate filings of the same symptom that predate/don't incorporate be-jygq's correction.
- *Proven pre-existing at BASE_REF*: stronger than the usual case — this artifact isn't part of any commit's tree at all, so it reproduces identically regardless of which SHA is checked out in a gc-managed worktree. Verified directly: moved the untracked shim aside (reversible; git-ignored, so this is not a working-tree mutation of anything tracked) and re-ran `make ci-pr-policy` end-to-end — exit 0, every one of the 10 sub-checks (build-tag policy, go-install guidance, version consistency, docs binary build, doc-flags, doc-freshness, testing.Short boundaries, workapi frontend boundary, no-beads-jsonl-changes, openapi spec gate) passed cleanly. Shim restored immediately after.
- `BD_LINT_NEW_FROM_MERGE_BASE=origin/main make ci-pr-lint`: gofmt clean, golangci-lint 0 issues, golangci-lint (windows) 0 issues.
4. **No open HIGH findings** — PASS. be-ahog's security_findings and style_findings are both "none" — zero findings of any severity, not just zero HIGH.
5. **Clean working tree** — PASS. `git status --porcelain=v1` on the deploy branch shows only pre-existing, already-triaged harmless untracked leftovers from unrelated closed beads (release-gates/be-hi97, be-k9js, be-uoat gate files; scripts/rebase-resolve-lib.sh — see memory `deployer-worktree-stray-rebase-lib-copy`), none of which this deploy branch's commits touch.
6. **Clean divergence from base** (checked first) — PASS. `git log origin/main..929a5c347e2a730835bfb790e00f151f2a81b0dd --oneline`: exactly 2 commits. `git log 929a5c347e2a730835bfb790e00f151f2a81b0dd..origin/main --oneline`: 0 commits. origin/main is a direct ancestor; clean fast-forward extension, no rebase needed.
7. **Single-feature theme** — PASS. Two commits (red test, green fix), two files (`internal/storage/dolt/federation.go` +7, `internal/storage/dolt/store.go` +104/-24), one coherent fix: a `pinStoreBranch` helper shared by `recomputeAllBlocked`/`recomputeBlockedTx`/the original caller, so all three reproduce the store's actual branch checkout instead of silently repairing whichever branch a fresh connection happens to default to. The build bead audited other fresh-connection call sites, found one further latent hazard (`pullWithAutoResolveUnchecked`, federation.go:126), and correctly deferred it to its own bead (be-5ybd) rather than bundling it in.
## Result: PASS
Merge authority: gastownhall/beads is a contributor-only repo (we do not maintain it). Deployer's job ends at the opened PR; no merge-request routed to mayor. Upstream maintainers own the merge.