beads/internal/storage
Julian Knutsen dbaa4631ca
feat(roles): BatchGetter role and POST issues:batchGet (#7248)
* feat(roles): BatchGetter role and issues:batchGet route (S7)

Adds BatchGetter.GetMany(ids) -> {Issues, Missing}, a one-snapshot,
order-preserving, deduped, 1000-id-capped batch read, wired through all
three library legs (dolt, embedded dolt, uow) behind the existing
hook/telemetry decorator chain, plus the POST /v0/beads/issues:batchGet
HTTP route (spec, apigen, wire-shape golden, issues.batchGet capability
token). Conformance contract (RunBatchGetter*, 12 cases) passes on all
three legs against real backends. No HTTP client leg yet (waits on the
generator / PR #7247); left as a documented seam on BatchGetter's doc
comment.

CLI GetIssuesByIDs call sites are left unmigrated this slice and marked
with TODO(batchgetter) comments: every call site reads an unbounded id
list today, and GetMany's 1000-id cap has no chunking/fallback in any
caller yet, so swapping them in now would add a new, unhandled failure
mode to already-shipped CLI paths (export, import, molecule port,
ready-explain, wisp sweep).

Verified via three live-mutate guards against
internal/storage/issueops/batchget.go (disabling the cap check, dropping
the Missing append, and replacing ordered iteration with map iteration):
each turns the embedded-dolt contract red, confirming the cap, Missing
reporting, and order-preservation assertions actually catch a break.

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

* fix(roles): close S7 review gaps — revision on wire, BUILD sync, handler tests

Addresses the S7 Opus review's FIX-FIRST items on BatchGetter/issues:batchGet:

HIGH
- batchGetResponse now projects apigen.BatchGetIssue (types.BatchGetIssue +
  NewBatchGetIssue), carrying `revision` per issue the way IssueDetails does;
  spec, apigen and the wire-shape golden regenerated (additive, no
  wire_revision bump).
- make bazel-sync: the 12 files missing from BUILD.bazel srcs are back in
  sync across 9 BUILD.bazel files.
- New internal/httpapi/batch_get_test.go: success incl. revision, missing
  ids, empty arrays not null, unknown member refused, missing/null ids
  refused, query parameter refused, 1001 ids refused with the full request
  reaching the role, 1000 ids accepted.

MED
- RunBatchGetterAcceptsExactlyTheCap pins the cap boundary (> vs >=).
- RunBatchGetterHydratesLabels pins Labels survive projection.
- RunBatchGetterReadsOneSnapshot renamed to
  RunBatchGetterSharesOneReadStructurally with a doc that no longer
  overclaims atomicity; a real interleaving test needs a hook on the frozen
  roleFixtureKit, out of scope here.
- Doc comments across ExecuteGetMany, GetManyResult.Issues and the
  BatchGetter interface now say hydration is labels only.

LOW
- failBatchGetErr's doc no longer claims blank entries are "already caught".
- PR #7247 references kept.

Re-ran build/vet/gofmt/lint, make api-check, make bazel-sync(-check), the
full internal/httpapi suite, and all three conformance legs (dolt via the
pinned local server, embeddeddolt, uow) plus targeted cmd/bd serve tests —
all green. Live-mutate-guard reverified: cap >=, dropping Missing from the
response, and clearing Labels each now fail the relevant test.

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

* fix(roles): sync client vocabulary and repo gates with issues:batchGet

The S7 route landed on the server without the sibling tables that hold
the rest of the tree set-equal with the server's surface, so five
tests and two manifest gates went red on the PR head:

- httpclient/wire: mirror batchGetIssues into the client vocabulary,
  CLASSIFIED, not wired, the way the wire wave and #7250's
  issues.count.scope landed: OpBatchGetIssues, its issues.batchGet
  token on opCapability, its identity row, and the first-slice skew
  dimension 35 -> 36 (TestCapabilityTableMatchesTheServerRouteTable).
- httpclient/wire: BatchGetIssue is the first golden.json schema with
  a `revision` member that needs no legacy-integer tolerance — the
  route postdates #6053 and types.BatchGetIssue declares Revision a
  string, and a pre-#6053 server never advertises issues.batchGet, so
  Preflight refuses before any body is decoded. Exempt it with that
  reason in a new revisionSchemaExempt table rather than adding an
  issues[] rewrite no legacy server can reach; the gate refuses an
  entry that is both covered and exempt, a stale exemption, and an
  empty reason.
- httpclient/encode: give the oracle's role set a BatchGetter stub —
  httpapi.Listen requires the whole set, so all three oracle tests
  failed to bind.
- storage/uow: exempt IssueUseCase.GetMany from the notifying-parity
  partition as a read, the reason hook_batch_getter.go gives.
- shard manifest: place TestBatchGetterContract in the 15-shard
  embedded storage block (generator --write, incremental).

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

* test(roles): pin the BatchGetter pure tier and the spec ids caps

Review fixes, iteration 1. The review approved with no blocker or major
finding and three minors, and this commit takes all three. It changes
tests and one comment only, and every new assertion was mutation-probed
with go test -overlay.

- storage/issueops: add batchget_test.go, the database-free tier that
  FinishGetMany's doc already claimed ("pinned without a database") but
  that no test supplied. It pins:
  - the cap is checked before the blank scan (an over-cap request with
    a blank at position 0 answers *TooManyIDsError);
  - the bound is inclusive;
  - dedupe keeps the first mention, does not trim, and never writes
    through the caller's slice;
  - Issues and Missing both follow request order;
  - both slices are never nil;
  - ExecuteGetMany refuses one id repeated past the cap before any
    query (a sqlmock with no expectations).
  Ten mutants were each killed by exactly their intended test, with the
  rest of the package green: last-mention, sort, trim, in-place dedupe,
  blank-before-cap, >=, nil Missing, nil Issues, dedupe-before-validate
  and validate-after-query.
- httpapi: TestSpecDefaultsMatchSharedConstants now checks ids.maxItems
  against the enforced bound on the two request bodies that carry an
  `ids` list: batchGetIssues against issueops.MaxGetManyIDs, and
  deleteIssues against maxDeleteIDs. Each body is reached through its
  operation's own requestBody $ref. Setting either constant to 999 turns
  only this test red. The spec's other list caps (batch
  create/close/apply items, dependency edge lists) stay ungated, as
  before.
- cmd/bd/serve.go: the batchGetter field comment said its accessor
  "does NOT recurse through the hook decorator". HookFiringStore.
  BatchGetter does recurse to the inner getter; it just doesn't wrap
  the result. The comment now says that.

Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-05 12:09:18 -07:00
..
backendnames test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
backends feat(backends): registry Remote + OpenWith options; beads.OpenBestAvailableWith for embedders (#7188) 2026-10-04 09:34:36 -07:00
batchbench perf(issueops): indexed dep-add cycle/hierarchy walks; pin blocked-state lookup plans; split waits-for spawner checks (#7224) 2026-10-04 23:43:32 -07:00
batchfixtures perf(issueops): indexed dep-add cycle/hierarchy walks; pin blocked-state lookup plans; split waits-for spawner checks (#7224) 2026-10-04 23:43:32 -07:00
contextinfo test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
createbatchequiv perf(issueops): indexed dep-add cycle/hierarchy walks; pin blocked-state lookup plans; split waits-for spawner checks (#7224) 2026-10-04 23:43:32 -07:00
dberrors test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
dbproxy fix(dbproxy): wait out a live starter's spawn marker instead of a fixed 5s (#7249) 2026-10-05 08:53:11 -07:00
depid test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
dolt feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
doltutil perf(dolt): pin MaxAllowedPacket in the server DSN to drop a per-connection round trip (#5273 item 4) (#5316) 2026-10-01 01:10:37 -07:00
domain feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
embeddeddolt feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
externaldeps feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
fs test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
git test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
issueops feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
journalscan test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
kvkeys test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
memoryops test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
rowid test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
schema docs(agents): contributor-only agent instructions and documented-issue intake (#7223) 2026-10-05 08:43:53 +00:00
sqlbuild perf(storage): SearchIssueSummaries narrow-projection foundation (be-nu4.3) (#3458) 2026-10-01 01:19:24 -07:00
sqlclass fix(sql): classify bd sql statements with the SQL parser; never drop result sets (#6932) 2026-09-29 01:08:10 -07:00
sqlcount feat(httpapi): opt-in large issues:batchApply envelope (≤1000 items, one transaction) (#7051) 2026-10-01 08:32:56 -07:00
storagecontract test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
uow feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
versioncontrolops feat(backup): proxied auto-backup on managed-local, serialized with bd backup sync (#6879) 2026-09-28 02:45:58 -07:00
advanced_queries.go /internal/storage: add interfaces for methods not covered by Storage 2026-03-06 15:30:10 -08:00
annotation_queries.go Update internal/storage/annotation_queries.go 2026-03-06 15:40:56 -08:00
batch.go refactor: delete the dead orphan-handling capability (bd-gwryr) (#5497) 2026-08-09 12:03:18 -07:00
batch_apply.go Add issueops.BatchApplier: one plan, one transaction (#5480) 2026-08-09 06:59:34 -07:00
batch_apply_test.go feat(httpapi): opt-in large issues:batchApply envelope (≤1000 items, one transaction) (#7051) 2026-10-01 08:32:56 -07:00
batch_close_policy.go fix(externaldeps): guard explicit claims and batch closes (#6738) 2026-10-01 01:35:54 -07:00
batch_close_policy_test.go fix(externaldeps): guard explicit claims and batch closes (#6738) 2026-10-01 01:35:54 -07:00
BUILD.bazel feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
bulk_issues.go feat(reclaim): scope filters --label/--label-any/--exclude-label/--assignee/--id (wy-jpd3.3) 2026-07-24 05:31:23 -07:00
child_counter_reservation.go fix(create): commit labels during initial issue creation (#4149) 2026-05-24 19:23:46 -07:00
compaction.go fix(compact): archive content before destructive compaction; make restore work (#4464) 2026-06-20 14:12:07 -07:00
config_metadata.go feat: custom status categories (active/wip/done/frozen) 2026-03-21 12:35:03 -07:00
contract_leg_registry_test.go test(storage): register the contract legs instead of discovering them (#5499) 2026-08-09 13:08:26 -07:00
dependency_queries.go feat(storage): events + dependents reads, batched blocked, public claim surface (#4926) 2026-07-22 07:41:47 -07:00
diff_store.go perf(export): incremental auto-export via dolt_diff (#5806) 2026-08-22 06:49:19 -07:00
directory_size.go fix(backup): report embedded database size (#4920) (#4928) 2026-07-25 16:14:07 -07:00
directory_size_test.go fix(backup): report embedded database size (#4920) (#4928) 2026-07-25 16:14:07 -07:00
errors_unsupported.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
event_queries.go feat(storage): events + dependents reads, batched blocked, public claim surface (#4926) 2026-07-22 07:41:47 -07:00
federation.go /internal/storage: add interfaces for methods not covered by Storage 2026-03-06 15:30:10 -08:00
history_presence.go fix(export): heal the delete wedge — prove deletions via store history instead of refusing forever (#5896) (#6059) 2026-08-29 21:24:29 -07:00
history_viewer.go feat(storage): add ExternalRefHistoryQuerier capability for external-ref history (#4733) 2026-07-12 13:43:27 -07:00
hook_batch_applier.go fix: a re-close that runs on_close, a silent cycle-gate walker, and a leaf that contradicts the wire (#5537) 2026-08-10 02:37:34 -07:00
hook_batch_applier_test.go fix: a re-close that runs on_close, a silent cycle-gate walker, and a leaf that contradicts the wire (#5537) 2026-08-10 02:37:34 -07:00
hook_batch_closer.go fix(externaldeps): guard explicit claims and batch closes (#6738) 2026-10-01 01:35:54 -07:00
hook_batch_closer_test.go fix(externaldeps): guard explicit claims and batch closes (#6738) 2026-10-01 01:35:54 -07:00
hook_batch_creator.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
hook_batch_getter.go feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
hook_blockingannotator.go feat(list): put bd list behind Reader.List and the new BlockingAnnotator role (bd-5k21g) 2026-08-06 02:56:57 +00:00
hook_bootstrapper.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
hook_commenter.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_commenter_test.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_counter.go feat(issueops): put bd count behind the Counter role (bd-m8hn7) 2026-08-05 05:27:39 +00:00
hook_cycle_detector.go feat(issueops): put bd dep cycles behind the CycleDetector role (bd-wfkbv) 2026-08-05 09:36:14 +00:00
hook_decorator.go cmd/bd: bd label rename <old> <new> (stacked on #6007) (#6009) 2026-09-29 17:02:35 -07:00
hook_decorator_internal_test.go fix(export): promoted no-history wisps survive import round-trip (bd-r9uce) (#5368) 2026-08-05 12:48:44 -07:00
hook_decorator_test.go fix(telemetry): wire WrapStorage decorator into bd storage chain (#3858) 2026-07-06 22:27:32 -07:00
hook_deleter.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
hook_dependency_editor.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_dependency_editor_test.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_edgereader.go feat(issueops): put multi-id bd dep list behind the EdgeReader role (bd-nhsno) 2026-08-05 09:42:06 +00:00
hook_graph_counter.go Add issueops.GraphCounter: how many edges, in one named direction (ga-itny5) (#5485) 2026-08-09 11:29:32 -07:00
hook_init_verifier.go feat(init): put bd init's identity seam behind Bootstrapper and InitVerifier (bd-zl3u8) 2026-08-06 03:01:33 +00:00
hook_issue_claimer.go Add issueops.Claimer and route the HTTP claim through it (#5334) 2026-08-04 08:40:18 -07:00
hook_issue_claimer_test.go Add issueops.Claimer and route the HTTP claim through it (#5334) 2026-08-04 08:40:18 -07:00
hook_issue_operations.go fix: a re-close that runs on_close, a silent cycle-gate walker, and a leaf that contradicts the wire (#5537) 2026-08-10 02:37:34 -07:00
hook_issue_operations_test.go Add issueops.Releaser: give a claim back, optionally only a named holder's (#5482) 2026-08-09 07:48:56 -07:00
hook_issue_reader.go feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
hook_issue_reader_test.go test(telemetry,storage): pin the Reader decorators the way Lifecycle is pinned 2026-07-31 18:37:26 +00:00
hook_memories.go Put the memory plane behind memoryops, conformance-tested at three backends (#5387) 2026-08-07 03:57:04 -07:00
hook_metadata_cas.go Add issueops.MetadataCAS: compare-and-set over one metadata key (#5473) 2026-08-09 04:15:34 -07:00
hook_metadata_cas_test.go Add issueops.MetadataCAS: compare-and-set over one metadata key (#5473) 2026-08-09 04:15:34 -07:00
hook_querier.go feat(query): put bd query behind the Querier role and stop it dropping matches (bd-pohmh) 2026-08-05 16:36:05 +00:00
hook_ready_claimer.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_ready_claimer_test.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_ready_counter.go feat(ready): put bd ready's published total behind the ReadyCounter role (bd-s10oa) 2026-08-05 09:47:24 +00:00
hook_relations.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_relations_test.go feat(issueops): put every issue capability behind one library surface 2026-08-04 12:27:56 -07:00
hook_releaser.go Add issueops.Releaser: give a claim back, optionally only a named holder's (#5482) 2026-08-09 07:48:56 -07:00
hook_releaser_test.go Add issueops.Releaser: give a claim back, optionally only a named holder's (#5482) 2026-08-09 07:48:56 -07:00
hook_role_census_test.go Publish POST /v0/beads/issues/{id}/comments, the wire half of issueops.Commenter (ga-rslox) (#5594) 2026-08-10 18:59:57 -07:00
hook_stats_reporter.go feat(issueops): put bd status behind the StatsReporter role (bd-4ze25) 2026-08-05 09:27:16 +00:00
hook_sweeper.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
hook_tree_walker.go feat(issueops): put bd dep tree behind the TreeWalker role (bd-lx5iu) 2026-08-06 03:09:18 +00:00
hook_version_reconciler.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
hook_workspace_config.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
issue_create_dependencies.go feat(storage): one guarded issue-lifecycle surface for the CLI and linked consumers (#5191) 2026-07-31 11:26:38 -07:00
iter.go Reapply "Simplify the supported backends: roll back the direct PostgreSQL and MySQL adapters" (#4857) 2026-07-18 02:43:56 +00:00
journal_facade_test.go feat(journalops): the mutation journal becomes the third facade namespace (#5552) 2026-08-10 10:58:05 -07:00
leg_contract_wiring_test.go test(bazel): runfiles helpers + declared inputs for scan-guard tests (#6828) 2026-09-27 08:24:08 -07:00
merge_slot.go feat: add MergeSlot methods to Storage interface (fix-merge PR #2787) 2026-03-26 19:34:21 -07:00
metadata.go fix(contracts): JSON contract fixes before 1.3.0 freezes them — string revision tokens, --set-metadata scalar typing, create --json nano timestamps (#6053) 2026-08-29 05:20:27 +00:00
metadata_cas.go Add issueops.MetadataCAS: compare-and-set over one metadata key (#5473) 2026-08-09 04:15:34 -07:00
metadata_cas_test.go Add issueops.MetadataCAS: compare-and-set over one metadata key (#5473) 2026-08-09 04:15:34 -07:00
metadata_edit_value_test.go fix(contracts): JSON contract fixes before 1.3.0 freezes them — string revision tokens, --set-metadata scalar typing, create --json nano timestamps (#6053) 2026-08-29 05:20:27 +00:00
metadata_jsonpath_test.go fix(query): make slash and mixed-case metadata keys queryable (#4896) 2026-07-24 17:52:22 -07:00
metadata_schema_test.go feat: config-driven metadata schema enforcement (GH#1416 Phase 2) (#2027) 2026-02-24 22:24:56 -08:00
metadata_test.go feat: allow UpdateIssue metadata updates via json.RawMessage/[]byte (#1417) 2026-02-03 17:55:23 -08:00
remote.go feat(storage): carry the git data ref of a git-backed Dolt remote (#6521) 2026-09-27 15:56:18 -07:00
remote_ref.go feat(storage): carry the git data ref of a git-backed Dolt remote (#6521) 2026-09-27 15:56:18 -07:00
remote_ref_test.go feat(storage): carry the git data ref of a git-backed Dolt remote (#6521) 2026-09-27 15:56:18 -07:00
role_accessor_decorator_test.go feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
storage.go feat(roles): BatchGetter role and POST issues:batchGet (#7248) 2026-10-05 12:09:18 -07:00
sync.go /internal/storage: add interfaces for methods not covered by Storage 2026-03-06 15:30:10 -08:00
version_control.go fix(compact): replay cherry-picks in commit_order, not commit date (#6644) 2026-09-27 02:06:57 -07:00
versioned.go feat(storage): carry the git data ref of a git-backed Dolt remote (#6521) 2026-09-27 15:56:18 -07:00
wake_defers.go fix(deps): enforce external capability blockers across ready/claim/close (#4769) (#4753) 2026-09-02 16:56:23 -07:00