Commit graph

37 commits

Author SHA1 Message Date
Julian Knutsen
e1b2e79484
ci: gate PRs on the Bazel lanes, alongside the legacy jobs (D1) (#6941)
* ci(bazel): gate the Bazel lane alongside the legacy jobs (D1)

pr.yml now calls bazel.yml (workflow_call) as its `bazel` job, and its
CI Gate / Required requires the call's aggregate (BAZEL) plus each gated
lane's result (BAZEL_TEST, BAZEL_PURE, BAZEL_EMBEDDED, BAZEL_DOLTSERVER).
No legacy job is removed: PR Core, build-artifacts, the pure-Go/js-wasm
check, domain+uow, contract corpus and pr-risk.yml's embedded tier stay
required (D2 is separate).

- bazel.yml drops its own pull_request/merge_group triggers, so a PR runs
  the lane once; push to main, workflow_dispatch and workflow_call stay.
- Every lane records job.status in an always() last step and exports it
  as a workflow_call output named after the job, next to the rbe job's
  rbe-mode / rbe-enabled.
- .github/scripts/bazel-gate.sh reads the call's rbe-mode/rbe-enabled and
  never re-derives the variable/fork/secret condition: mode skip allows
  every Bazel id to skip, local only the remote-only BAZEL_EMBEDDED,
  remote none; a missing or inconsistent mode fails the gate.
- bazel-integration runs in the PR call but stays advisory (its legacy
  counterparts in main.yml run only on push to main): no gate id, and the
  gate script excuses the aggregate failure only when that lane reported
  failure or cancelled in remote mode; the gated lanes are still checked
  on their own ids.
- Callers (pr.yml, nightly.yml) pass exactly the four RBE secrets that
  bazel.yml now declares, never `secrets: inherit`.
- Inside pr.yml's run the Bazel bd artifact is bazel-ci-build-artifacts,
  so it cannot collide with build-artifacts' ci-build-artifacts upload.
- bazel-autofix.yml now triggers on workflow "PR": the bazel-sync-patch
  artifact is uploaded inside the PR run, and "Bazel" runs are no longer
  PR events. Its security model is unchanged (base-branch checkout only,
  artifact read from the triggering run id, data-only patch).
- Policy tests (review D1 F3/F4/F7):
  - TestBazelLaneIsGatedAlongsideLegacy: every bazel.yml job is the rbe
    job, a gated lane (bazelLaneGateIDs) or an advisory lane with a
    reason; gate ids, env expressions and outputs are derived from that
    map; no re-derivation in the gate step or script.
  - TestBazelGateSimulation runs pr.yml's actual gate step over mode in
    {remote, local, skip} (pull_request and merge_group): the script's
    skips equal the ids whose job `if:` is false, and for each lane that
    should run, it alone skipped, failed or cancelled turns the gate red
    whatever the aggregate says; advisory, aggregate and invalid-mode
    cases too.
  - TestBazelArtifactNamesUniqueInCallerRuns: no artifact name collides
    within a pr.yml or nightly.yml run, following local workflow calls.
  - Autofix: workflow_run on "PR", which must upload bazel-sync-patch
    itself or through an unconditional local call.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): keep integration out of the PR call; pin the call's inputs (D1 review v2)

- N1: bazel.yml gains a string workflow_call input `integration`
  (default "on"); bazel-integration runs only when remote and
  `inputs.integration != 'off'`. A string, not a boolean: on push and
  dispatch the input is null, and null == false would silently stop the
  lane on main. pr.yml passes integration: "off" (main.yml's integration
  jobs, its legacy counterpart, run only on push to main). The gate no
  longer reads bazel-integration and bazel-gate.sh no longer excuses an
  aggregate failure: BAZEL is the call's result, red on a missing or
  inconsistent rbe mode.
- N3: pr.yml's call passes exactly build-artifact-name and
  integration: "off" (no rbe or other override).
- N4: bazel.yml's concurrency group never uses github.workflow (the
  caller's name in a call) and differs from each caller's group for every
  event, so the call cannot deadlock against pr.yml.
- N5: no caller of bazel.yml (pr.yml, nightly.yml) may have a
  pull_request_target or workflow_run trigger.
- Simulation: lanes' run modes are evaluated with pr.yml's call inputs;
  advisory lanes must not run in the PR call, gated lanes must run when
  remote.
- engdocs: runbook for main BUILD drift, a farm outage or the RBE cert
  expiry (~2027-09-27): fix main / renew, or unset RBE_WEST_WORKERS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(ci): record the enforced required-gates ruleset and PR Risk's renamed gate

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(bazel): gate the proxied-server and server-Dolt storage lanes

bazel-proxied and bazel-server-storage (remote-only, #6940) join the
gated lanes like bazel-embedded: pr.yml's ci-gate requires
BAZEL_PROXIED and BAZEL_SERVER_STORAGE, each read from the lane's
job.status output (always() recorder step, workflow_call output named
after the job). Both run in pr.yml's call (no integration switch).

bazel-gate.sh allows them to skip in mode local (forks, Dependabot:
pr-risk.yml's legacy tiers cover those PRs) and in mode skip, never in
mode remote. The gate simulation derives this from the jobs' ifs, so
each lane skipped, failed or cancelled in remote mode turns the gate
red. Jobs are renamed "proxied-server tier" / "server-Dolt storage tier"
(shown as "Bazel / ..." under pr.yml's call).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 03:33:20 -07:00
ecuthiell
08fc8abb86
docs(ci): update shared cloud routing shard rationale (#6432)
* test(dolt): verify shared cloud auth fixture without a time limit (saa-cgh.107)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(dolt): require cloud routing server in the opted-in full suite (saa-cgh.107)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test(dolt): count successfully registered cloud auth cases (saa-cgh.107)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell

* test: describe current shared cloud-auth shard fixture (saa-cgh.119)

Agent-Signature: unknown-model/unknown-reasoning on behalf of Ewen Cuthiell
2026-09-27 01:57:07 -07:00
Jim Wordelman
6e36c3f19c
ci: raise proxied Dolt cmd test job timeout, add step timeout, refresh shard manifest (#6689)
* ci(proxied-cmd): green — give the proxied-shard job its own step timeout, refresh manifest (refs be-bruke)

The job-level timeout-minutes was the only backstop for the "Test
proxied-server cmd shard" step, and it counts the "Download binaries"
step too — so a slow download alone could exhaust the job budget and
kill an otherwise-healthy shard's test run with no way to tell the two
failure modes apart. Give the test step its own 16m timeout inside the
existing 30m job budget, and regenerate the bin-packed shard manifest
via scripts/ci/gen_proxied_shard_manifest.py so it stays in sync with
the current TestProxiedServer* set (0 drift, all 15 shards fallback:0).

* ci(proxied-cmd): mirror the shard timeouts onto the main lane, regen the manifest at the adoption base

Adoption review of #6689, iteration 1 — three minor findings, applied here
rather than deferred.

main.yml's `test-proxied-cmd` is the same job as pr-risk.yml's twin — same
proxied-test-shard.sh, same manifest, same total 15 — behind a
download/verify step inside a 20m budget with no step timeout, so the exact
ambiguous-timeout failure mode this PR removes from the PR lane survived on
the post-merge lane, which is where triage happens with nobody watching.
Mirror both edits (job 20m -> 30m, step 16m) and record the ordering at the
step, since it is not obvious from the site that 16m is deliberately below
the script's own -test.timeout=15m plus setup.

The manifest's only record of the cost proxy's two known blind spots lived
in a hand-written comment block the regeneration deleted:
TestProxiedServerListSortRetiresTheWalk seeds 1400 rows and walks the
listing three ways off a single init, and TestProxiedServerServeReadParity
is the CLI/HTTP read-parity oracle whose presence in this gate-required lane
is what makes the anti-drift claim enforced. Re-adding prose to a generated
file would just be deleted again, so it moves into the generator's emitted
header.

Base drift since authoring left the refreshed manifest one test stale —
#6584 added TestProxiedServerBackupRefusedOnExternalTopology, which
hash-distributed to shard 14 — so "0 drift, all 15 shards fallback:0" was
already false on the merge base. Benign (unlisted tests hash-distribute and
still run, and drift removed no name, so the strict parser's stale-entry
hard-fail was unreachable), but the stated deliverable did not hold.
Regenerated at the adoption base: 149 of 149 discovered tests listed,
fallback:0 on every shard, peak load unchanged at 39 estimated inits. That
figure is a point-in-time measurement, not an invariant: nothing in CI diffs
the committed manifest against a regeneration, so it re-drifts the moment
the next TestProxiedServer* lands. A freshness step
(`gen_proxied_shard_manifest.py 15 | diff - <manifest>`) on a lane already
triggered by .github/scripts/* would make it one; that is follow-up scope.

Verified: the generator reproduces the committed manifest byte-identically;
BEADS_TEST_SHARD_LIST_ONLY=1 across all 15 shards assigns all 149 discovered
TestProxiedServer* functions exactly once with no duplicates or orphans;
actionlint clean on both workflows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Julian Knutsen <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-26 07:17:03 -07:00
Julian Knutsen
8aaefe2d4f
feat(httpapi): serve bd list's order with sort on listIssues (#5666)
* feat(httpapi): serve `bd list`'s order with `sort` on listIssues

The issue listing served one order, `(created_at DESC, id ASC)`, because the
cursor is a keyset position in it. The spec stated the constraint in its own
words: "the sort order is welded to the cursor contract, and a new order needs
new surface." That welding put the cost on every client wanting `bd list`'s
ordering — the only way to get it was to page the whole result set and sort
locally, which is the one cost on this surface that grows with the project.

Measured against a real `bd serve` over 1400 rows at the 200-row page an HTTP
client actually uses: walk-and-sort is 7 requests plus a client-side
comparator, `?sort=priority` is 1. Both are checked against `bd list --json`
row for row, because the claim that matters is not "fewer requests" but "the
same order".

`sort` takes `created` and `priority` and nothing else. Each value is a keyset
contract — a position shape, a strictly-after predicate, an index — not a
display preference, and both keys are provably total (priority and created_at
are non-null, id is unique) so a page boundary inside a run of equal keys
resolves on id. The seven other orders `bd list --sort` takes have no such key:
`id` is natural-numeric and no database expresses it, `updated` moves on every
write, `closed` is nullable, and status/title/type/assignee are mutable and
unindexed. `priority` here is (priority ASC, created_at DESC, id ASC), which is
both `bd list`'s flagless order and what `--sort priority` produces — a stable
priority sort over the created order is the same sequence — so one served order
retires the walk for both.

Absent `sort` still means `created`, permanently: it is the compatibility
contract for every client written before the parameter existed.

THE CURSOR NOW CARRIES ITS ORDER. This is the half that makes the parameter
safe rather than merely useful, and the obvious implementation gets it wrong.
The token was base64 of `{t,i}` with no binding, so a created-order cursor
replayed under `sort=priority` decoded perfectly and was read as a position in
a different total order — a page that skips and duplicates rows, served with a
200, undetectable by the client. Tokens are now `v2` with an explicit order
member, and decode takes the wanted order as a parameter so a mismatch is
unrepresentable at the seam rather than merely detectable past it. Outstanding
`v1` tokens stay readable as the created-order positions they are, so no
traversal in flight has to restart. This does not contradict "the token carries
no filters": filters select the set, the order decides what the position means.

Storage grows one field. IssueFilter.AfterPriority extends the existing
position; the predicate nests the created one rather than restating it, because
the created/id comparison is only reachable at the cursor's own priority.
Flattening it the way the created predicate's leading-bound trick invites looks
equivalent and is not — it re-delivers rows at the cursor's priority created
after it, which the new conformance walk catches against real Dolt.

NO INDEX MIGRATION, by measurement rather than by omission. A composite
(priority, created_at, id) index was tried on Dolt 2.2.0 against the production
predicate, in both the plain ascending and the mixed-direction spelling Dolt's
DDL accepts: the plan is byte-identical in all three cases, keeping the
single-column priority seek and the TopN. It would have bought write
amplification on every insert and every priority update for no measured change.
The sargability guard pins what is achieved — an IndexedTableAccess range on
idx_issues_priority — and records the measurement to redo if Dolt learns to
stream the composite.

Agent-Signature: claude-opus-5
Co-authored-by: CI Bot <ci@beads.test>

* fix(changelog): drop leftover diff3 conflict marker in sort entry

The rebased adopt-PR head left a stray '|||||||' merge-base marker on the first line of the new `sort` CHANGELOG entry (CHANGELOG.md:381), which `git diff --check` flagged as a leftover conflict marker. Remove only the marker line; the resolved entry content is unchanged. Maintainer fixup for PR #5666 adoption review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: CI Bot <ci@beads.test>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-27 09:21:12 -07:00
Jim Wordelman
30f30ca95b
ci: PR-CI lane runs the full internal/storage/dolt suite against a live Dolt server (#5836)
* test(ci): red — gastownhall/beads: no PR-CI lane runs TestBenchDBPurgeDoesNotLeak against a live Dolt server (checkDolt SKIP) (refs be-aiy5)

* feat(ci): green — gastownhall/beads: no PR-CI lane runs TestBenchDBPurgeDoesNotLeak against a live Dolt server (checkDolt SKIP) (refs be-aiy5)

Add test-server-storage-full as a sibling job to test-server-storage in
pr-risk.yml. build-embedded already compiles every top-level test in
internal/storage/dolt into one binary (embedded-test-binaries); the
existing job only ever runs -test.run '^TestConformance$' against it.
The new job reuses that same artifact and live-server setup with no new
build step, and runs everything else via -test.skip '^TestConformance$'
so previously-stranded tests (TestCreateGuard_*, federation/concurrent
suites, and diff-owned tests such as TestBenchDBPurgeDoesNotLeak on PR
#5792) get a real PASS/FAIL instead of a silent SKIP. Sets
BEADS_TEST_ENV_RUN_DOLT=1 so federation_test.go's own live-server check
fails loudly rather than skipping if this job's setup ever regresses.
Wired into ci-gate: added to needs, CI_GATE_REQUIRED, and the
tier-gated skipped_ok fallback (mirrors test-server-storage's existing
treatment in each).

Also updates two pre-existing meta-tests over pr-risk.yml that pinned
exact snapshots of the file this job necessarily changes:
scripts/ci_capability_selector_test.go's ci-gate authority snapshot,
and scripts/pull_dolt_image_test.go's retry-helper call count
(pr-risk.yml: 2 -> 3, the new job's own Dolt-image-pull step).

* chore: release gate PASS for be-pp7e (PR-CI lane for TestBenchDBPurgeDoesNotLeak)

Deploy gate record for be-pp7e, gating be-aiy5's PR-CI lane addition
(runs TestBenchDBPurgeDoesNotLeak against a live Dolt server instead of
letting checkDolt SKIP it). Review: be-w90n, verdict pass. All 7 gate
criteria PASS; two pre-existing/unrelated failures encountered during
evaluation (be-jy56, be-vf95) were attributed and excluded from the
verdict.

* test(ci): red — shard test-server-storage-full across 16 matrix jobs (refs be-yy25)

TestPRRiskGateReachesFullServerDoltStorageSuite now asserts
pr-risk.yml's test-server-storage-full job is a fail-fast:false matrix
over shard 1..16, with the Test step invoking
server-storage-test-shard.sh, instead of pinning the old single-job
unsharded command. Fails against the current workflow, which still
runs all 1126 tests unsharded in one 15m job (be-extn).

* feat(ci): green — shard test-server-storage-full across 16 matrix jobs (refs be-yy25)

Adds .github/scripts/server-storage-test-shard.sh (mirrors
embedded-storage-test-shard.sh: discovers internal/storage/dolt/*_test.go,
excludes TestConformance, manifest-plus-hash-fallback shard assignment) and
its shard manifest .github/scripts/server-storage-test-shards.txt, pinning
TestCloudAuthCLIRouting (~9.5m) alone on shard 1 and spreading the other
known 10-20s-heavy tests across the rest.

pr-risk.yml's test-server-storage-full job becomes a fail-fast:false matrix
over shard 1..16, Test step now runs server-storage-test-shard.sh instead of
the old unsharded single-job command that died at 256/1126 tests after
15m28s with zero failures (job 95616282508).

Documents the new lane in engdocs/CI_REQUIRED_CHECK_TOPOLOGY.md alongside the
existing embedded matrix description.

TestPRRiskGateReachesFullServerDoltStorageSuite now passes. Offline shard
partition verified disjoint and complete across all 1125 discovered tests
(BEADS_TEST_SHARD_LIST_ONLY=1 for i=1..16). (be-extn)

* test(feat): red — Fix: sharded lane runs prebuilt test binary from repo root, breaking ../schema/migrations and ../issueops (6 tests) (refs be-gepv)

* feat: green — Fix: sharded lane runs prebuilt test binary from repo root, breaking ../schema/migrations and ../issueops (6 tests) (refs be-gepv)

* chore: release gate PASS for be-23f3

Extends deploy/be-pp7e-gate (PR gastownhall/beads#5836) with be-gepv's
fix rather than cutting a fresh isolated branch: be-gepv's own bead
text and be-extn's precedent both establish this fix belongs on the
already-open PR. All 7 gate criteria PASS; two repo-wide lint/policy
failures attributed to already-tracked pre-existing issues (be-vf95,
be-jy56), confirmed untouched by this PR lineage.

be-gepv, be-6yo1, be-23f3

* fix(dolt): federation test isolation + panic (be-3c78s)

TestFederationDatabaseIsolation and TestFederationVersionControlAPIs are
federation-prototype tests that predate the suite's shared-server,
branch-per-test isolation architecture (setupTestStore/StartTestBranch)
and were never updated to account for it.

- setupFederationStore hardcoded Database: "beads" for both towns. New()
  always connects in server mode against one shared Dolt server for the
  whole test binary (TestMain), so Path alone doesn't isolate two stores
  — Database does. Both towns silently shared one database, so Alpha
  could read Beta's issues and vice versa. Give each town its own
  database (beads_test_federation_<prefix>, matching the beads_test AD-01
  cleanup-firewall prefix).

- TestFederationDatabaseIsolation's not-found assertions assumed GetIssue
  returns (nil, nil) on a miss. It never does — issueops.GetIssueInTx
  always returns a wrapped storage.ErrNotFound. Switched to
  errors.Is(err, storage.ErrNotFound).

- TestFederationVersionControlAPIs hardcoded Checkout(ctx, "main") to
  return to its "starting" branch, but setupTestStore already checks out
  a private branch (test-<name>-<hex>) — "main" is a branch shared by
  every parallel test in the binary and never has vc-001. That mismatch
  is what produced the nil-pointer panic (GetIssue's error was discarded
  via `_`, and the resulting nil issue was dereferenced). Capture the
  real starting branch via CurrentBranch() right after setupTestStore()
  and check both previously-discarded GetIssue errors before
  dereferencing.

Neither bug is a production security issue: New(), Checkout(), and
GetIssue() all behave exactly as specified. Both bugs are confined to
this prototype test file's own setup/assertions, which hadn't caught up
to the isolation model the rest of the suite already uses correctly.

Verified via `go build`/`go vet`/`go test -c` (all clean) and running the
compiled binary, which now reaches and cleanly SKIPs both tests (no
Docker locally) instead of the previous isolation failure / panic
surfacing at compile-adjacent runtime. Full GREEN confirmation is via
CI, which has a working Dolt/Docker environment.

Refs be-3c78s

* chore: release gate PASS for be-42tlj
2026-08-19 20:39:38 -07:00
CI Bot
b9c6629188 test(storage): demote the duplicated keyset and max-rows backend tests
RunSearchPaging now owns these behaviors in the shared suite, and both
backends run it through their own TestConformance -> RunAll. Keeping the
backend-local copies would leave the same scenario asserted at two layers.
The deletions ride the same PR as the block that supersedes them, so no
window exists where a behavior has zero owning proofs.

The five retired embeddeddolt tests also leave the CI shard manifest
(.github/scripts/embedded-storage-test-shards.txt), which is why that file
moves in this commit rather than a follow-up: embedded-storage-test-shard.sh
validates every manifest entry against the discovered test set and exits 1
on a miss, and it does so for every shard, not only the shards owning the
stale names. Nothing is re-added — the script hash-distributes tests that
are not listed, and the manifest's own comment stops citing the retired
TestSearchIssues_MaxRows_* family as a spreading example.

Every retired assertion and its new owner, all under
backend/conformance RunSearchPaging:

internal/storage/dolt/keyset_search_test.go (partial; file kept)
  TestSearchIssuesKeysetSameSecondOverflow
    one-shot (created_at DESC, id ASC) order
      -> KeysetWalkLosesNothingAndRepeatsNothing, one-shot leg
    page-size-2 walk: nothing dropped, no id twice, page within Limit
      -> KeysetWalkLosesNothingAndRepeatsNothing, walk leg
    resume after k-a3 = [k-a4 k-a5 k-older]
      -> KeysetResumeAnswersTheStrictlyAfterRows, mid-group leg
    ksIDs / ksEqual helpers -> conformance orderedIDs + reflect.DeepEqual
  TestSearchIssuesKeysetPlanIsIndexed -> KEPT. EXPLAIN sargability is Dolt
    planner residue, outside the observable contract, and cannot move.

internal/storage/embeddeddolt/keyset_search_test.go (file deleted)
  TestSearchIssuesKeysetEmbedded — the same two assertions as the dolt
  twin above, same owners, reached on this backend through RunAll.

internal/storage/dolt/search_max_rows_test.go (file deleted)
  MaxRows_NotExceeded (rows under cap -> all rows, nil)
    -> MaxRowsAnswersTheTypedRefusal/UnderTheCapIsAnOrdinaryResult
  Exceeded/FlagSource (errors.As, Found>3, Cap=3, Source "--max-rows")
    -> .../OverTheCapAnswersTheTypedRefusal/cap3
  Exceeded/EnvSource (Cap=2, Source "BEADS_MAX_ROWS")
    -> .../OverTheCapAnswersTheTypedRefusal/cap2
  MaxRows_Zero_NoCap -> .../ZeroDisablesTheCap
  WithLimit/LimitUnderCap_NoError
    -> .../ALimitAtOrUnderTheCapCannotFireIt/limit3_cap100
  WithLimit/LimitEqualsCap_NoError
    -> .../ALimitAtOrUnderTheCapCannotFireIt/limit3_cap3
  WithLimit/LimitOverCap_FiresCap -> .../ALimitOverTheCapStillFiresIt
  WithLimit/OnlyCap_FiresOnOverage
    -> .../OverTheCapAnswersTheTypedRefusal/cap4

internal/storage/embeddeddolt/search_max_rows_test.go (file deleted)
  The same eight assertions as its dolt twin, same owners, reached on this
  backend through RunAll.

The shared cases are stronger than what they retire on three counts: the
retired cap tests asserted only len(results), where the new legs assert the
whole id set; the at-the-cap boundary (cap == matching rows) was never
covered; and the AfterID:"" group start and filter composition had no
backend-local copy at all.

Co-Authored-By: Claude Fable <noreply@anthropic.com>
2026-08-07 20:32:19 +00:00
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