Commit graph

31 commits

Author SHA1 Message Date
Julian Knutsen
a34048b0fe
Retire embeddeddolt seam tests the contracts answer for, keep what they do not (#5399)
Slice 1 of a test-deduplication pass against the conformance contracts. Net
-295 LOC: 8 test functions deleted, 4 files removed, 3 cases ported into
contracts, and — after adversarial review — one residue kept that the deletion
should not have taken.

Every deletion is backed by an assertion-targeted mutation showing the
contract goes red on the same break: blocker refusal, open-children refusal,
CheckVersionInTx on close and update, assignee guard, status guard, LabelPatch
ordering, ParentID replace-all, configured-done resolution, priority-range
validation. update_guards_test.go was additionally found partly cannot-fail —
its only ptr("") leg runs against a fresh unassigned issue and asserts
success, so it could not fail if ptr("") degraded to no guard.

Three cases ported to three legs. The first is the find of the slice: the
Lifecycle contract was green on three backends while EVERY case seeded a
DIRECT blocker, so a guard reading the denormalized is_blocked column instead
of the live blocker list passed all of them. That is 903cbe031, the Deleter
defect, verbatim in another contract.

An adversarial review council then found three things no gate could see — go
build, go vet, go test and golangci-lint were green over all of them:

  The deletion orphaned five entries in the CI shard manifest, and the shard
  script hard-fails on any entry that no longer matches a discovered test.
  All five embedded-storage shard jobs would have exited 1 at startup.

  The deletion removed the only observers of a public-API wrapper route.
  EmbeddedDoltStore.{Update,Close}IssueChecked are a separate composition of
  the shared bodies; disabling the wrapper's CAS branch failed the deleted
  test and passed all 136 contract cases. A narrow wrapper-routing residue is
  restored, verified red against that mutant.

  The metadata port did not pin the Merge<Set order its own name leads with.
  Its only Merge/Set collision was also in Unset, so a reordered body produced
  an identical document and passed all 74 Update cases. Fixed with one key
  written by both stages and removed by neither.

Kept deliberately: comments_page (live seam with no role — a uow provider is
not a DoltStorage), counts_wisp (Counter asks a different question),
reopen_category (seeds the wisp plane and the normalized custom_statuses
table), create_issue (defines newTestEnv/skipUnlessEmbeddedDolt for 58
siblings including all 26 conformance runners), and
issue_operations_persistence (the only file with no skipUnlessEmbeddedDolt
gate).
2026-08-07 10:00:25 -07:00
Steve Yegge
311bc4d353
fix(prime): route proxied memory read through the server plane (bd-mm8wf) (#5367)
From lion's #5361 review: formatMemoriesForPrime called
ensureStoreActiveForPrime with no proxied gate — the bd-m7zzd direct-store
seam class, in a read-only limb. prime sits in noDbCommands, so no UOW
provider was ever opened; the lazy direct open then hit the store factory's
proxied refusal and the silent-skip contract swallowed it, meaning proxied
prime never carried memories at all.

The memory read now routes through the proxied plane (routing chosen over
skipping — the surface exists: ConfigUseCase().GetAllConfig on one
read-only UOW, same verb as the bd memories proxied dual), via a provider
opened scoped to the read and closed after. Prime's contracts are
preserved: silent skip when the plane is unavailable, the timeout banner on
a deadline, and memories rendered through a tail now shared with the
classic path (renderPrimeMemoriesFromAllConfig) so the two cannot drift.

Tests: TestProxiedServerPrime journey suite on the shared testcontainers
harness — memories-only and full prime carry the remembered key/content
(red before this fix: proxied prime printed 'No memories stored'), the read
lands zero Dolt commits, no embedded store dir materializes, and a corrupt
sidecar degrades to exit-0 silent skip. Shard manifest entry added at the
hash-fallback shard (6).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 12:12:03 -07:00
Steve Yegge
4b1d9c875f
feat(unclaim,batch): port --if-assignee CAS and bd batch to proxied-server mode (bd-tb0yi) (#5364)
* feat(unclaim): port --if-assignee to proxied-server mode (bd-tb0yi)

`bd unclaim --if-assignee` was refused outright under
BEADS_DOLT_PROXIED_SERVER ("not supported in proxied-server mode"); it now
runs the compare-and-swap release, and runs the SAME one the embedded
backend runs.

No new SQL is written for this port, and that is what holds the bar. The
conditional release reaches the classic implementation exactly as the
unconditional one already does: domain.IssueUseCase.UnclaimIfAssignee ->
IssueSQLRepository.UnclaimIssueIfAssignee ->
issueops.UnclaimIssueIfAssigneeInTx, the twin of the Unclaim ->
UnclaimIssue -> UnclaimIssueInTx chain beside it. So a conditional release
applies the same transition (assignee cleared, status reopened, started_at
cleared, lease row dropped, row_lock rewritten), records the same
"unclaimed" event, routes a wisp's claim to the wisp tables the same way,
and refuses with the same storage.ErrAssigneeMismatch naming the current
holder. Routing it instead through Lifecycle.Update + ExpectedAssignee
would have written the row correctly but recorded a generic update event
in place of the release, and diverged from the unconditional path inside
the same command.

The CLI passes the expectation as a plain string because the flag has only
two states here: `--if-assignee ""` is rejected in unclaim.go before any
issue is touched (an unset shell variable must never silently downgrade a
CAS to an unconditional release), so empty unambiguously means
unconditional.

EXIT CONTRACT, unchanged and deliberately not "improved": a mismatched
holder writes nothing and exits 1 on BOTH paths. `bd unclaim` has never had
`bd update`'s ExitGuardMismatch (13) verdict — its help says so outright
("1 when any release failed (including an --if-assignee mismatch)") — and
minting one on the proxied path only would be the exact divergence this
lane exists to prevent. If unclaim should adopt 13, it adopts it in both
modes, as its own change.

TestProxiedServerUnclaimIfAssigneeParity is the cross-mode oracle: six
steps (stale guard, matching guard, repeat release, `--if-assignee ""`
rejection, --force/--if-assignee rejection) run against an embedded
workspace and a proxied one, and every observable — exit code, post-step
row state, whether the refusal names the holder — must match, with each
mode also checked against the contract itself so parity with a shared bug
still fails. It rides a new cross-mode harness
(cross_mode_parity_harness_test.go): one initialized workspace per backend,
the same argv against both, outcomes compared field by field and never by
id.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014zUQg5iF119KbGeYuhXQ5Y

* feat(batch): port bd batch to proxied-server mode (bd-tb0yi)

`bd batch` was refused outright under BEADS_DOLT_PROXIED_SERVER; it now
runs, with the property that is its entire reason to exist intact: N
operations, ONE transaction, ONE commit, and whole-batch rollback on the
first failing line.

The split between the modes is exactly the command's own seam. The
grammar, the tokenizer, the arity checks, the dry-run echo, the
empty-input no-op, the default commit message and every byte of output
stay shared in batch.go — a batch script means the same thing whichever
backend runs it, and a script the parser rejects is rejected before either
backend is reached. What is per-mode is the transaction primitive and the
verbs the ops dispatch against: uow.RunTxResult + the unit of work's use
cases here, `transact` + storage.Transaction there. runBatchOpUOW mirrors
runBatchOp op for op, including its error strings.

RunTxResult, not RunTxEphemeral: a batch writes versioned tables, and the
ephemeral form commits with no Dolt commit (its whole point for the leases
table), which would persist these writes while bypassing Dolt history. The
retry it brings redoes the WHOLE batch in a fresh unit of work on a
serialization failure — re-executed against the winner's committed rows,
never re-committed on a session the server already rolled back — and the
per-attempt result slice means a retried batch reports the attempt that
actually committed.

Plane routing is explicit because it has to be: the classic transaction
methods route an id to the issues or wisps tables themselves, while the
domain exposes the planes as separate verbs. close/update resolve through
workapi.GetIssueOrWisp inside the transaction and call the matching verb;
dep add/remove use the source-routed AddDependencies /
RemoveDependencyBySource, which land each edge in the plane its own source
lives in. `close` is deliberately the UNCHECKED close, matching the classic
batch: `close <id>` in a batch applies no close policy, while an `update`
that crosses into done does — an asymmetry the command's help documents.

TestProxiedServerBatchParity is the cross-mode oracle, on the F0-style
harness: the same script runs against an embedded workspace and a proxied
one, and exit codes, the summary line, the per-line report, and the rows
left behind must match — including the two transactional cases that are
the point (a failing last line undoing the successful lines before it, and
a grammar error writing nothing at all).

TWO KNOWN DIVERGENCES are named at their sites and left for their own
change, because neither changes the rows a batch lands and both are
classic-batch inconsistencies with the CLI verbs rather than artifacts of
the port: an out-of-range `priority=5` is written by the classic batch and
refused by the proxied one (the domain update funnel validates the range,
issueops' transaction path does not; `bd update --priority 5` is refused on
both), and a batched `dep add`/`dep remove` records a dependency history
event here and not there (every domain edge verb emits, the classic batch's
bare transaction method does not — and `bd dep add` at the CLI emits on
both backends, which is what makes the classic batch the outlier).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014zUQg5iF119KbGeYuhXQ5Y

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 12:11:56 -07:00
Steve Yegge
e68d9e5a0b
feat(recompute-blocked): port to proxied-server mode + cross-mode cascade parity suite (bd-04vav) (#5363)
* feat(recompute-blocked): port to proxied-server mode (bd-04vav)

`bd recompute-blocked` stops refusing proxied-server mode. It is the
mode-independent repair for a stale is_blocked column (bd-6dnrw.37) and
wh-bridge-sync's remedy after a cross-machine merge, so a constellation
running on the proxied plane without it has no way to repair the flag
`bd ready` trusts.

Parity is by construction rather than by assertion: the whole
in-transaction body (dirty-graph guard + fixpoint recompute), the commit
message, and the staging set now live in ONE place,
versioncontrolops.GuardedRecomputeAllBlockedInTx /
BlockedRecomputeCommitMsg / BlockedRecomputeStagedTables, which the
embedded store, the server store and the new proxied route all call. The
CLI's two rendered branches are likewise one function shared by both
routes. Nothing about the repair's semantics is restated per mode; what
differs is only how each mode gets its connection.

The proxied route runs on a PINNED non-transactional connection
(uow.MaintenanceProvider, as compact/gc already do) rather than through
uow.RunTx*, for two reasons specific to this command: the post-commit
DOLT_ADD/DOLT_COMMIT are stored procedures Dolt refuses inside an
explicit transaction, and the uow commit path stages with '-Am' while
this repair must stage `issues` ALONE — a commit whose entire content is
a derived flag has no business sweeping an unrelated dirty working set,
which is the very thing the read-side guard exists to prevent.
StageAndCommit grows an empty-author form for that call: proxied-mode
commits are unauthored by design (uow.Tx.Commit passes no --author), and
an empty '--author' argument would be malformed rather than
unattributed.

admin cleanup stays gated. The 2026-08-04 recon on bd-04vav found it has
no wheelhouse call sites, so porting it would be untested surface area
bought for nobody.

TestProxiedServerRecomputeBlocked is a cross-mode oracle: the same
corrupt-then-repair scenario is replayed against a classic embedded
workspace and a proxied one, and every observable — both rendered
branches and the corrected-row count — must match, with the shared
values additionally pinned so a symmetric regression in both modes still
fails. It also covers what wh-bridge-sync actually depends on
(idempotency, honest exit codes), that a no-op repair mints no Dolt
commit, and that the dirty-graph refusal survived the port.

Part of bd-vxavz (proxied-server capability parity).

* test(delete/prune/purge): cross-mode cascade parity, and a data-loss divergence (bd-04vav)

The verification half of F7. Proxied `bd delete` "always cascades"
(--cascade is refused outright) while classic cascades only when asked,
so the question the constellation needs answered before cutover is not
"is the flag there" but "does the cascade reach anything classic would
have left alone" — on the shapes the wheelhouse actually runs.

TestProxiedServerCascadeParity replays three of them against a classic
embedded workspace AND a proxied one and compares the outcomes, so a
difference is reported as a difference rather than as one mode's test
failing alone: wh-gate-sweep's delivery-ledger purge, the wisp-decay
close + `purge --pattern '*' --force` pair, and a reference-aware durable
`prune` sweep.

FINDING — proxied delete of a gate destroys the bead it gated.
`bd gate create --blocks <target>` records the edge as target
DEPENDS-ON gate, so the gated bead is a DEPENDENT of the gate row. On the
proxied plane wh-gate-sweep's `bd delete <gate> --force` therefore
deletes the target and everything downstream of it; classic leaves both
standing. Measured, not inferred: proxied {gateGone:true,
targetSurvives:false, siblingSurvives:false} vs classic {true, true,
true}. This is a shared-server cutover blocker, and the fix is a design
call on what --cascade should mean in proxied mode (three existing
proxied delete suites deliberately pin today's unconditional cascade), so
it is filed rather than smuggled in here.

The subtest CHARACTERIZES the defect: the classic half pins the correct
behavior, the proxied half pins exactly today's blast radius, and the
comparison is logged loudly. The suite stays green while the divergence
is open and fails the moment the damage changes in EITHER direction —
including when it is fixed, at which point the expectation is flipped to
match classic and the paragraph explaining it goes away.

Wisp decay and prune agree across modes with no divergence: the closed
wisp is reclaimed while a durable closed bead and an open wisp survive
(purge is ephemeral-only and closed-only), and prune protects a closed
bead an open bead still cites.

Part of bd-vxavz (proxied-server capability parity).
2026-08-05 12:11:53 -07:00
Steve Yegge
50763fcba7
fix(proxied): close relate.go + human.go direct-store seams (bd-m7zzd) (#5361)
Two P1-1 residual proxied-mode seams from the bd-6dnrw.44 re-verification,
both PORTED (each was genuinely small):

- bd dep relate/unrelate: no usesProxiedServer() branch meant an opaque
  "cannot resolve issue ID: storage is nil" death. Now routed through new
  runRelate/UnrelateProxiedServer duals: one RunTx with a real commit
  message per invocation (both directed relates-to edges in one Dolt
  commit for relate; both removals in one for unrelate, empty-message
  no-op when neither edge existed), classic "issue not found" /
  self-relate refusals preserved. Exact canonical ids only, like every
  other proxied dep verb.

- bd human list/respond/dismiss/stats: each called ensureStoreActive(),
  which in proxied mode lazily opened a DIRECT store, silently bypassing
  the proxy. Root cause: "human" sits in noDbCommands for its bare help
  screen, so its DB-backed subcommands skipped store init entirely and
  direct mode papered over it lazily. The subcommands now fall through to
  store init (needsStoreHumanSubcommands, dolt-subcommand pattern) and
  branch to proxied duals before the direct-store path: reads on one
  read-only UOW, respond/dismiss each ONE RunTxResult (existence +
  already-closed preflight, comment + close in the same transaction)
  under "bd: human respond/dismiss <id>" commit messages. human moves to
  the forbidigo proxied-twin family in .golangci.yml (same filter built
  on both routes).

Tests: TestProxiedServerRelate + TestProxiedServerHuman journey suites on
the shared testcontainers harness, incl. dolt_log assertions that each
write invocation lands exactly one commit with its own message, and that
the "storage is nil" death is gone; shard manifest entries added at the
hash-fallback shards (7, 11).


Claude-Session: https://claude.ai/code/session_01JtAkNTf8DGzP1AF3FMuGmm

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 09:05:29 -07:00
Steve Yegge
8ceaf9a3b5
feat(swarm): port bd swarm status + validate to proxied-server mode (bd-gen49) (#5360)
Both commands are pure computed reads (epic progress; ready fronts +
cycle detection), so they route through one read-only unit of work via
uow.RunTxRead — no commit message, no Dolt commit, no commandDidWrite —
with the existing uowMolReader adapter satisfying the SwarmStorage seam
(and utils.PartialIDResolverStore) over the UOW use-cases. All traversal
and rendering code is shared with the classic route unchanged.

swarm create and swarm list stay gated with their existing refusals
(no downstream consumer).

TestProxiedServerSwarm builds an identical explicit-ID epic DAG (one
closed, one in_progress+assignee, one ready, one blocked child) in a
proxied project and a classic embedded project, and asserts status +
validate human output byte-for-byte and --json deep-equal across modes,
a planted-cycle validate failure (proxied-only: classic embedded has no
bd sql and dep add cycle-gates, so there is no classic door to plant
one), the create/list refusals, and that the reads advance no Dolt HEAD.


Claude-Session: https://claude.ai/code/session_01JtAkNTf8DGzP1AF3FMuGmm

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 09:05:26 -07:00
Steve Yegge
9291864c8c
feat(export): port bd export to proxied-server mode (bd-o58fz) (#5351)
* feat(export): port bd export to proxied-server mode (bd-o58fz)

Remove the proxied-server gate from bd export and route the command's
storage reads through an exportSource seam:

- storeExportSource preserves the classic (embedded/direct/server) call
  pattern over the store global, verbatim.
- uowExportSource reads through the proxied unit of work's domain use
  cases, with the whole read set inside ONE uow.RunTxRead transaction
  (read-only, never committed) so the export is a consistent snapshot.
  Plane-pinned use cases are re-partitioned to match the classic bulk
  loaders: labels/comments partition by the row's own Ephemeral/NoHistory
  flags; dependency records already partition internally; dependency
  counts sum both planes for every id, as classic does.

Everything downstream of the reads (filtering, sanitizeZeroTime, record
shaping, marshal order, atomicfile, stderr summary) is shared code, which
is what holds the byte-identical cross-mode output bar. Ordering parity
holds because both stacks render ORDER BY from the same sqlbuild.SortDefs
(priority ASC, created_at DESC, id ASC; labels by issue_id,label;
comments by created_at,id; memories sort.Strings).

TestProxiedServerExport builds a rich fixture through the proxied CLI and
asserts flag semantics plus the acceptance oracle: proxied export,
imported into a fresh classic embedded workspace and re-exported, is
byte-identical (default shape and --include-memories shape).

buildOwnerExcludeSet's export_auto.go call site is adapted to the new
seam signature (classic source over the same store global); auto-export
behavior is unchanged and its proxied port stays a separate bead.
export_source.go joins the bulk-movement forbidigo family in
.golangci.yml (it carries export.go's filter, it does not build one).

The import half is NOT in this change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YmpYVCa5eN6JtG26dJLMs

* fix(export): classify relation planes by table membership, not row flags (bd-o58fz)

Review items on #5351:

1. LoadExportRelations queried the wisp plane for any row carrying
   Ephemeral or NoHistory — but a promoted no-history wisp is a durable
   issues-table row still flagged NoHistory (promote clears only
   Ephemeral), so its durable-plane labels/comments were silently
   dropped. Both planes are now queried with the full ID set and merged
   (ID-disjointness per the GH#4455 cross-table guard), matching what
   the dep-counts leg already did; wisp-plane reads tolerate
   IsTableNotExist like that leg too.

2. The byte-identity oracle is blind to symmetric omissions, so the
   suite now asserts seeded content directly (labels, comment texts,
   comment_count, dependencies, blocks-only dep counts) and adds a
   promoted no-history fixture row in its own project. That shape stays
   out of the round-trip fixture deliberately: classic IMPORT routes by
   the same flag heuristic (issueops.IsWisp) and re-planes the row into
   the wisps table, a pre-existing export/import infidelity filed as
   bd-r9uce.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvU6bUda8oQjvG3zoa4uyX

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 07:37:59 -07:00
Steve Yegge
0f4f8d29da
feat(promote): port bd promote to proxied-server mode (bd-27bfd) (#5359)
bd promote stops refusing proxied-server mode and routes through the UOW
plane via a new cross-plane domain verb: IssueUseCase.PromoteWisp ->
IssueSQLRepository.PromoteFromEphemeral -> the exact classic
issueops.PromoteFromEphemeralInTx body, widened from *sql.Tx to DBTX so
both modes share one implementation (same id preserved, wisp_type
retained, labels/deps/events/comments carried across, inbound
wisp-targeted edges retargeted, blocked state recomputed). The widening
replaces the NewBatchContext call (which needs *sql.Tx) with the same
two config reads it performed internally (ResolveCustomStatusesDetailedInTx
+ CustomStatusNames, ResolveCustomTypesInTx) — verified semantically
identical composition.

Commit semantics: exactly ONE Dolt commit per invocation ("bd: promote
<id>", the classic message), pinned by the journey test. The wisp-side
deletes touch dolt_ignored tables; the one transaction still makes the
wisp delete and issues insert atomic.

One deliberate tightening vs classic (documented divergence): the
promotion comment shares the promote's transaction, so a failed comment
write rolls the promote back instead of degrading to a stderr warning —
atomic beats warn-and-continue.

Success output (text + --json best-effort re-read) extracted into shared
printPromoteResult/promotionComment so the two routes cannot drift.

Journey test TestProxiedServerPromote (4 subtests, sharded 15/8):
row-rewritten-in-place with edges/comments preserved and dolt-commit
count == 1; --json shape vs classic; one-way (purge no longer reclaims,
prune does); non-wisp and missing-id error contracts.

Verification note: TestRecomputeAllBlocked_AllowsDirtyWisps
(internal/storage/dolt) fails identically on the unpatched origin/main
baseline on this machine (FAIL-set diff empty; filed bd-7xtsq) — not
attributable to this diff.


Claude-Session: https://claude.ai/code/session_01JtAkNTf8DGzP1AF3FMuGmm

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 07:36:53 -07:00
Steve Yegge
b5d9548325
feat(heartbeat): port bd heartbeat to proxied-server mode (bd-aq0ql) (#5357)
bd heartbeat stops refusing proxied-server mode and routes through the UOW
plane. The port preserves the two properties that define heartbeat:

- ZERO Dolt commits per invocation (bd-lrgn1). The lease write lands in the
  dolt_ignored leases table under a new uow.RunTxEphemeral helper, which
  commits the transaction with a plain SQL COMMIT (Tx.Commit with an empty
  message) instead of CALL DOLT_COMMIT — the proxied analog of the classic
  DoltStore.withRetryTx commit discipline. RunTx/RunTxResult semantics are
  unchanged (they never call Commit on an empty message); serialization
  losers (heartbeat vs reclaim/close on the same lease row) replay exactly
  like RunTxResult.

- Timestamp/classification parity with classic mode. The new repo verb
  IssueSQLRepository.HeartbeatIssue delegates to the identical classic body,
  issueops.HeartbeatIssueInTx — same clock (time.Now().UTC()), same TTL
  resolution (issueops.LeaseTTL), same only-current-owner classification
  (ErrAlreadyClaimed / ErrNotClaimable), same lease re-arm for hand-doled
  claims, same wisp refusal — so classic bd reclaim staleness semantics see
  proxied heartbeats identically.

Success output (text + the {"id","status":"heartbeat","owner"} --json shape)
is extracted into renderHeartbeatSuccess and shared by both routes, so the
worker-facing contract cannot drift between modes. Exit code remains the
contract: rc 0 = lease refreshed, nonzero = the lease is gone and the worker
should stop. --actor overrides the ownership-check source in both modes.

Journey test TestProxiedServerHeartbeat (shared testcontainers server,
database-per-test) covers: stale-lease rescue with lease_expires_at /
heartbeat_at advanced and dolt_log count unchanged; reclaim ignoring a
just-heartbeaten lease; --json shape; wrong-owner / unclaimed / closed /
missing refusals; and the lease re-arm INSERT path, also under the
zero-Dolt-commit assertion. Sharded at 15/7 in the proxied test manifest.

No behavioral divergences from classic mode. (Failure-message prefixes gain
the domain-layer wrapping other proxied ports carry; classification
sentinels and exit codes are identical.)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 07:36:46 -07:00
Steve Yegge
947f356d27
feat(gate): port create/add-waiter/resolve/show to proxied-server mode (bd-v50ru) (#5346)
* feat(gate): port create/add-waiter/resolve/show to proxied-server mode (bd-v50ru)

Four gate subcommands stop refusing proxied-server mode and route through
the UOW provider, following the conventions gate check/list already set in
cmd/bd/gate_proxied_server.go:

- gate create: ONE RunTxResult doing target lookup + CreateIssue +
  AddDependency under a single commit message ("bd: create gate <id>
  blocking <target>") — the direct route's create + add-dep + explicit
  store.Commit collapse into one Dolt commit per invocation.
- gate add-waiter: one transaction; an already-registered waiter returns an
  empty commit message (deliberate no-commit no-op). Fires the on_update
  hook post-commit.
- gate resolve: one transaction (type check + CloseIssue), then audit
  LogFieldChange + close hooks post-commit, mirroring gate check's closes.
- gate show: read-only UOW; not-found and read-failure exit nonzero with
  distinct messages (fail-closed: an unreachable server is not "no gate").

Output parity is enforced structurally: the direct route's renderers and
gate-create input/issue construction are extracted (renderGateShow,
renderGateCreated, renderGateResolved, renderGateWaiterAdded/Already,
gatherGateCreateInput, buildGateIssue) and both routes call the same code,
so the text downstream scripts parse cannot drift.

gate discover keeps its proxied-mode refusal: it interleaves GitHub CLI
queries with per-gate writes and incremental output, so it is not the pure
routing this port covers.

Also fixes the latent domain/db bug the new journey test caught: the
proxied repository's normalizeUpdateValue never serialized "waiters", so
any waiters update through the proxied backend failed at the SQL driver
("unsupported type []string"). It now JSON-marshals the value exactly as
the embedded path (issueops.updateIssueInTx) always has, with a unit test
pinning the behavior.

New journey test TestProxiedServerGateLifecycle covers the wheelhouse
consumer shapes (gate-id parsing from create output, wh-park bead-gate
create, show markers, list --all --json fields, rc-only resolve,
fail-closed error paths) and is listed in the proxied shard manifest.

Part of bd-vxavz (proxied-server capability parity).

* fix(ci): drop stray duplicate TestProxiedServerDelete shard line (bd-v50ru)

Review blocker on #5346: the duplicate tripped proxied-test-shard.sh's
duplicate check and failed all 15 Proxied Dolt Cmd shards, so
TestProxiedServerGateLifecycle never ran in CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NvU6bUda8oQjvG3zoa4uyX

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 04:47:52 -07:00
Steve Yegge
192fc48dda
feat(kv): port kv + memory surface to proxied-server mode (bd-dnzjy) (#5344)
Remove the "not supported in proxied-server mode" gates from bd kv
(set/get/clear/list) and the memory surface (remember/memories/forget/
recall). Both are thin prefix layers (kv.* / kv.memory.*) over the config
table, so the handlers mirror config_proxied_server.go: one RunTx per
write invocation with a real commit message ("bd: kv set <key>",
"bd: kv clear <key>", "bd: remember <key>", "bd: forget <key>"), reads
via RunTxRead. The proxied path never touches ensureDirectMode; the
classic path keeps it.

Presentation and namespace filtering are extracted into helpers shared
by both paths (printKV*, kvPairsFromConfig, printRemember*/printForget*/
printRecall*, memoriesFromConfig, rememberBareKeyPath), so output —
including the kv list --json shape that the wyvern wheelhouse mail
transport parses — cannot drift between modes. Key validation and the
remember desire-path/command-word guards run before dispatch and behave
identically in both modes. Storage errors pass through %v unmodified so
callers can keep retrying on the 'Merge conflict detected' /
'constraint violation, transaction rolled back' substrings.

Journey tests: TestProxiedServerKV (byte-preserving multi-line/JSON
envelope round-trip, list --json shape + classic-vs-proxied comparison,
idempotent clear, invalid-key refusal, one-Dolt-commit-per-write) and
TestProxiedServerMemory (remember → memories → recall → forget journey,
kv.memory.<key> storage-key check, bare-key desire path, command-word
guard, one-commit-per-remember). Manifest entries added at the shards
the hash fallback already assigns (13/14), so nothing reshuffles.

Refs bd-dnzjy, program bd-vxavz.
2026-08-05 04:23:26 -07:00
Julian Knutsen
1e0a7bdf59
ci: shadow PR Risk capability ownership (bd-8yjq8.1) (#5324)
Record fail-closed candidate lane selection without changing which PR Risk jobs execute. This creates replayable evidence for capability-owned admission while branch protection and historical validation are still pending.

Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of CI Bot

Co-authored-by: CI Bot <ci@beads.test>
2026-08-03 20:06:16 -07:00
CI Bot
6560ca064f ci(proxied): name the serve suites' shard instead of leaving it to the hash
The audit read TestProxiedServerServeReadParity as unenforced on PRs because it
does not appear in pr.yml. It is enforced, in the other PR-time workflow:
pr-risk.yml's test-proxied-cmd job runs `on: pull_request`, discovers every
`^func TestProxiedServer` in cmd/bd/*_test.go, and feeds TEST_PROXIED_CMD into
that workflow's "CI Gate / Required". Its concurrency group is keyed on the PR
number, so it is not the perpetually-cancelled Main workflow. Verified by running
the lane's own discovery across all fifteen shards: the oracle appears in exactly
one.

What was true is that it appeared there by HASH FALLBACK. The manifest header
asks for a regenerate after adding a TestProxiedServer* function, and neither
`bd serve` suite was ever added, so the assignment was incidental rather than
reviewed and nothing in the file said the parity oracle was in the lane at all.

Both suites are listed at the shard the hash was already choosing (8), which is
zero behaviour change and avoids reshuffling the other 100 entries — a full
regenerate rewrites 202 lines across tests this branch never touched. Verified:
shard 8 now reports `manifest: 8, fallback: 0`.

Two further tests remain unlisted (TestProxiedServerCleanDatabasesPurgeDropped,
TestProxiedServerReassignFence). They are not from this branch and still
distribute by hash, which is the supported path; a cost-rebalancing regenerate
is the change that should pick them up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 20:04:43 +00:00
CI Bot
87c64ec8f1 feat(serve): bd serve skeleton — lifecycle, mode gate, /healthz, /v0/beads/context (bd-60z)
The first slice that runs a server. Proxied-server workspaces go live; the
read and claim operations are registered as transitional 501 stubs so route
and spec parity can be proved all at once instead of growing a hole per slice.

`bd serve --addr 127.0.0.1:0 [--allow-non-loopback]`, and no other flags in
v0. The bound address is stdout's first line, because under the ephemeral
default it is the only way to find the port. Shutdown rides the signal context
the root command already installs. No lock file, pid file or discovery file:
serve is operator-invoked and the TCP bind IS the mutual exclusion — dbproxy
needs that machinery only because clients race to auto-spawn it.

The mode gate says two different things, deliberately. Embedded is a PERMANENT
typed storage.ErrUnsupported: there is no unit-of-work provider for that
backend. Dolt server mode is STAGED — the provider construction exists and is
tested, it just is not wired in yet — so the text names what works today and
says this does not, rather than reading as an architectural limit that would
send an operator off to change their topology for nothing.

One unit of work per request, closed through a DETACHED context. The
transaction layer poisons the pinned connection when a ROLLBACK send fails
(doltserver_tx.go), so closing with the request's own canceled context would
burn a session on every client disconnect.

Front-tier hardening lands here, not later, because without it a hung Dolt
becomes a silently growing black hole: slots fill with immortal queries,
/healthz stays green because it never touches the database, and recovery
produces a thundering herd. So: a Host-header allowlist (DNS-rebinding defense
for an unauthenticated, browser-reachable loopback service), a
netutil.LimitListener connection cap (Go spawns a goroutine per connection, so
the database semaphore alone does not bound what is accepted), a database
semaphore with a BOUNDED 10s wait mapping to the already-documented 503 busy,
a 60s per-request deadline, and explicit pool limits on the provider's *sql.DB
via a new uow.PoolTuner knob — openDB set none, and database/sql's default is
unlimited.

/v0/beads/context serializes an explicit ten-field allowlist and nothing else.
SyncRemote is hard-excluded in this and every future version: it is populated
unconditionally from config sync.remote, and remote URLs routinely embed
credentials. The database bind endpoint and the remaining absolute host paths
are excluded too. `capabilities` is derived from IMPLEMENTED handlers only, so
a release cut between this slice and the endpoint slices advertises only what
actually works.

The observability floor is an acceptance criterion, not a convention: one
structured stderr line per request (method, path, status, problem code,
duration, semaphore wait, unit-of-work acquire), startup and shutdown lines, a
semaphore-saturation event, and a request_id on every problem response. That
last one required documenting request_id on the spec's Problem schema — the
only spec edit here, additive, with types regenerated.

Decisions implemented as given: hooks do not fire (a user-controlled
subprocess per mutation is an unbounded latency multiplier and an orphaned
child at shutdown); the per-command auto-commit globals are never touched
(nothing to exclude — proxied PersistentPostRunE only closes the provider);
and actor on an HTTP request stays caller-asserted provenance, which the
context and capabilities wording does not contradict.

Tests: TestSpecRouteParity asserts set equality between the route table and
the document's paths, and builds the real mux so a pattern ServeMux would
refuse fails here rather than on the first request.
TestSpecStatusCodesMatchHandlerTable carries a commented, enumerated 501
exemption that is self-deleting — it fails if the route table and the list
disagree, and fails again if the list outlives the last stub. The context
allowlist is enforced from the handler out, over a body built from a snapshot
with every field populated and a credential-bearing sync remote.
TestWithUOWClosesWithADetachedContext records the close context's state AT
close time, which is the only moment it says anything.

Verified: build, vet and golangci-lint clean (the two gosec findings in
cmd/bd/main.go pre-date this change); internal/httpapi green under -race;
protocol corpus byte-identical with BEADS_PROTOCOL_REQUIRE_DOLT=1; and a real
server started against a proxied workspace, answered both endpoints, refused
a foreign Host, an unknown query key and a second bind, and drained to exit 0
on SIGTERM.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 10:07:14 +00:00
matt wilkie
65084057f2
ci: shard Embedded Dolt Storage into 5 manifest-driven shards (#5117)
Test (Embedded Dolt Storage) ran the ~84-function internal/storage/embeddeddolt
suite (minus TestConformance) as a single unsharded job, ~24.3min and the
longest pole in every Main/PR-Risk run per engdocs/CI_CLEANUP_PLAN.md and
mybd-t8l8; it timeout-red'd upstream main at its 30m suite budget twice on
2026-07-28 (mybd-jobt).

Extends the existing test-embedded-cmd manifest-driven scheme
(embedded-test-shard.sh + embedded-cmd-test-shards.txt, already 20-way) to the
storage job: new embedded-storage-test-shard.sh discovers top-level Test*
functions in internal/storage/embeddeddolt/*_test.go (excluding
TestConformance, which stays in its own job), consults a committed manifest
(embedded-storage-test-shards.txt) for balance, and hash-falls-back for
newly-added tests. No per-test timing data exists for this suite, so the
manifest assigns the 83 discovered tests round-robin over the alphabetically
sorted list for 5 shards (17/17/17/16/16), which spreads related families
(the 7 TestEmbeddedMergeAndSettle*, ~11 TestEmbeddedMigrat(e|ion)*, 4
TestSearchIssues_MaxRows_*) across shards instead of clustering them.

test-embedded-storage becomes a 5-way matrix job in both main.yml and
pr-risk.yml, per-shard timeout-minutes: 15 and -test.timeout=15m (half the
old 30m budget, matching that each shard carries roughly 1/5 of the tests and
~2-3 of the ~11 migration-chain tests that motivated the original 20m/30m
budget per bd-lrgn1). Job id test-embedded-storage and its BEADS_TEST_EMBEDDED_DOLT
env stay the same, so pr-risk.yml's ci-gate needs/CI_GATE_REQUIRED wiring
(TEST_EMBEDDED_STORAGE) is unaffected by the matrix split; only the job's
display name changes shape, from "Test (Embedded Dolt Storage)" to
"Test (Embedded Dolt Storage N/5)". Updated the two required-check-name
references to that in engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md and
engdocs/CI_TEST_SURFACE_AUDIT.md.

Conformance (core/audit, ~14min each, mybd-ae0n) is left alone: TestConformance
is sharded by sub-test path via -test.run '^TestConformance$/^Audit$', a
different mechanism from this manifest's exact top-level function-name
matching, so it does not extend naturally in this commit.

Agent-Signature: claude-fable-5-high on behalf of maphew
2026-07-28 22:16:48 -07:00
coffeegoddd☕️✨
2425194fa3 ci(proxied): regenerate shard manifest for new bd mol test functions
Adds the 14 new TestProxiedServer{MolShow,MolCurrent,MolProgress,
MolLastActivity,MolStale,MolReadyGated,MolDistill,Pour,MolBond,
MolSquash,MolBurn,WispCreate,WispList,WispGC} entry points to the
committed 15-shard manifest via scripts/ci/gen_proxied_shard_manifest.py,
so they run with pinned, cost-balanced shard assignments in the
test-proxied-cmd CI job (main.yml and pr-risk.yml) instead of falling
back to hash-based distribution. Verified via
`proxied-test-shard.sh <N> 15` with BEADS_TEST_SHARD_LIST_ONLY=1 across
all 15 shards: every test resolves via the manifest with zero fallback
and no validation errors.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-27 13:06:47 -07:00
coffeegoddd☕️✨
6389546c56 test(proxied): split the six heaviest suites so shards balance under the timeout
The proxied cmd lane is init-bound: each subtest's bd init runs the full
migration chain, so a shard's wall-time tracks its total init count. The six
heaviest suites (Update 56 inits, Show 47, Create/Close 41, Dep 36, Ready 34)
were each a single top-level function, and a function is the atomic unit of
sharding — so no shard split could pull the worst shard below Update's ~169s
(local), which is what kept brushing the 15m budget on CI.

Split each of the six into 2-3 top-level functions (Update/Show ->3, the rest
->2), balanced by init count, by inserting function boundaries between the
already-independent per-subtest blocks — no test logic moves, every t.Run set
is byte-identical to before. Regenerate the 15-shard manifest by greedily
bin-packing every TestProxiedServer* function by init count
(scripts/ci/gen_proxied_shard_manifest.py); the heaviest shard drops from ~56
to ~31 estimated inits, roughly halving the long pole.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 15:55:17 -07:00
coffeegoddd☕️✨
51bd6cf4ed ci(proxied): shard proxied-server cmd tests across 15 shards (was 8)
The proxied suites are init-bound (each per-subtest project runs the full
migration chain), so the heaviest shards were brushing the 15m budget and
occasionally timing out. Widen the matrix from 8 to 15 shards in both the
main and pr-risk workflows and rebalance the committed manifest, greedily
bin-packing by estimated cost so the six heaviest suites (Update, Show,
Create, Close, Dep, Ready) each own a shard and the rest pack evenly.
Estimated worst shard ~600s, comfortably under the 900s timeout.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 15:55:17 -07:00
coffeegoddd☕️✨
7caa8cd554 test(proxied): cut shard-4 timeout — revert per-subtest project splits, move Ready to shard 8
The per-subtest project split multiplied bd init calls (each runs the full
migration chain on a fresh DB): epic 2->8, set-state 1->4, unclaim 2->9,
defer 1->7. That is added, not saved, wall-clock on already-saturated
shards and pushed shard 4/8 over the 15m budget. Revert those five suites
to one shared project per test function (the read-suite pattern), and move
the pre-existing heaviest suite (Ready: 36 subtests / 34 inits) off the
overloaded shard 4 onto the near-idle shard 8.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 15:55:17 -07:00
coffeegoddd☕️✨
ea7b95ff49 ci 2026-07-20 14:41:07 -07:00
coffeegoddd☕️✨
e20691832c /.github/{scripts,workflows}: shard it 2026-07-15 18:19:36 -07:00
Chris Sells
789044b83e chore: purge deleted docs-pipeline references from release tooling, CI, and repo plumbing
- beads-release formula: drop the snapshot-docs step (ran the deleted
  scripts/snapshot-release-docs.sh on the critical needs-chain); stamp-
  changelog now needs update-vendorhash
- update-versions.sh: remove the mangled --skip-docs/docs-snapshot logic
  and garbled usage text left by mid-line deletions
- pre-push hook: drop the snapshot-script remediation hint
- release.yml: collapse the prerelease branch; BEADS_REQUIRE_RELEASE_DOCS
  has no consumer since check-docs-version.sh was deleted
- RELEASING.md / scripts/docs.md: describe the current pipeline (no
  --versioned, no website/ outputs, no check-docs-version.sh)
- docs-mintlify.yml: paths filter now includes engdocs/** and the curated
  root markdown files the docsync guard validates
- docs-render-check.sh: pin mint@4.2.687, fail closed when mint dies
  without producing a broken-links report, parse report lines only, drop
  dead extract_page_links(), fix the stale jq requirement; mint.sh pins
  the same version
- nightly.yml: remove the deleted website measurement suite option
- CODEOWNERS: init-safety ADR gate follows the file to engdocs/adr/
- beads-docs skill: align with settled decision 6 — no pointer stubs,
  moved pages get docs.json redirects; bd's printed paths are fixed at
  the source
- CHANGELOG (edited line), FEDERATION-SETUP, README, examples, oracle-a,
  .buildflags, gh-issue-to-pr formula: retarget moved-file references;
  anchor the build/ gitignore pattern
2026-07-12 11:07:26 -07:00
Chris Sells
3198395a32 docs(ci): add Mintlify preview, docsync guard, and broken-links workflow
- mint.sh + make docs-dev: local preview of the docs/ Mintlify site
  (Node 22 handling modeled on the Gas City wrapper).
- test/docsync: Go guard keeping docs/ and docs.json in exact
  correspondence — every nav entry has a file, every page is in the nav
  (tiny stub allowlist for paths released bd binaries print), published
  pages use root-relative extensionless links that resolve, and engdocs/
  plus curated root markdown keep exact GitHub-style paths. Wired into
  make check-docs.
- .github/workflows/docs-mintlify.yml: docsync + baseline-aware
  mint broken-links check on PRs touching docs/**.
- Retire scripts/sync-website-docs.sh and its mirror-drift gate: the six
  mirrored files now live once in the Mintlify site; the committed
  Docusaurus mirrors stay frozen so the parallel-run site keeps building.
- Repoint inbound links to moved docs across README, guides, examples,
  npm-package, plugin resources, and Go comments; add docs/SYNC_CONCEPTS.md
  pointer stub (bd's agent templates print that path). Runtime strings in
  cmd/bd (prime.go, store_factory_nocgo.go, init_git_hooks.go) still print
  old paths — covered by stubs, flagged in the PR.
2026-07-12 10:37:07 -07:00
Julian Knutsen
9e8d411f71
Add PR CI wrapper command surface (#4211)
* ci: add PR wrapper command surface

* ci: collect wrapper timing in PR checks

* docs: record initial CI wrapper measurements

* ci: add manual measurement workflow

* ci: allow branch measurement dispatch

* ci: keep measuring independent commands after failures

* docs: record branch-dispatched CI measurement

* ci: keep measuring package suites after failures

* docs: record CI measurement batch

* fix: repair CI-measured test failures

* test: make local Go gates hermetic

* ci: add sharded integration measurement lane

* test: fix internal beads integration TestMain

* docs: record fixed integration shard measurement

* ci: add hybrid integration sharding measurement

* ci: speed up cmd/bd test shard discovery

* ci: add 16-way integration sharding measurement

* ci: measure prebuilt cmd bd sharding

* docs: record prebuilt sharding measurement

* docs: design CI build artifact stage

* docs: record repeat prebuilt integration measurement

* ci: add build artifact stage

* ci: reuse build artifact in linux test lane

* ci: promote main linux integration shards

* ci: gate legacy platform tests to main

* ci: satisfy workflow shell lint

* ci: ignore archived migrations in duplicate check

* ci: add package gate wrappers

* test: clean up testing short boundaries

* ci: allow unreleased version docs lag

* ci: gate releases on package checks

* ci: split workflow by tier

* ci: add aggregate PR gates
2026-05-29 18:52:53 -07:00
matt wilkie
cc31c6046e
Rebalance embedded cmd CI shards (bd-8zg) (#3499) 2026-04-25 17:58:51 -07:00
matt wilkie
04ec3f52b9
Tier embedded Dolt CI for PRs (bd-0gz) (#3459) 2026-04-24 07:53:23 -07:00
matt wilkie
2ade22e84c
chore(build): codify the gms_pure_go build-tag policy (GH#3303)
Converges the sprinkle of -tags=gms_pure_go fixes into a single source plus a source-time CI guard. .buildflags is now canonical (exports GOFLAGS, CGO_ENABLED), scripts source it, scripts/check-build-tags.sh runs in CI to catch bare go commands. Fixes 5 latent bugs the guard caught (regression.yml, Makefile bench/test-regression, devcontainer, embedded-test-shard fallback, smoke-test scripts).
2026-04-16 12:28:11 -07:00
coffeegoddd☕️✨
a35edfd28e /{internal,cmd,.goreleaser,.github}: embedded mode by default 2026-03-28 13:47:20 -07:00
coffeegoddd☕️✨
7e41ced834 /.github/{scripts,workflows}: precompile test binary 2026-03-25 16:29:39 -07:00
coffeegoddd☕️✨
4789cf17f8 /.github: fix workflow 2026-03-25 13:14:57 -07:00
coffeegoddd☕️✨
a2f5639b14 /{.github,cmd,internal}: sync and data integration tests 2026-03-24 16:49:44 -07:00