beads/internal/httpapi
Julian Knutsen 06b0dffb22
Make the next serve role a compile error, and check the one role with a positional result (#5539)
* refactor(serve): make the next role a compile error in the serve stubs

serveIssueRoles took a whole storage.DoltStorage, so the test stubs that
stand in for a store satisfied it the only affordable way: embed the
interface and leave it nil. Every accessor a stub had not declared then
arrived as a promoted method on a nil interface — a segfault inside role
extraction, not a compile error.

It has landed twice in one PR cycle, both on GraphCounter. First in
serve_source_test.go, then in serve_store_identity_test.go, where no local
-run pattern names the test and only a full cmd/bd shard found it.

So the function now asks for serveRoleSource: the accessor subset it
actually reaches, which a whole store still satisfies. Both stubs declare
that subset and assert it, and the store they must still BE — the
decorator chain takes one, and backends.Backend.Open returns one — comes
from an embed one level deeper that their own accessors shadow. Adding a
role to the loop is now:

    cannot use (*serveRolesStore)(nil) ... does not implement
    serveRoleSource (missing method GraphCounter)

ADDING_AN_ISSUEOPS_ROLE.md's "step with no number" listed these two stubs
among the surfaces to grep for by hand; it now says this pair is taken
care of and the rest still are not.

Swept the embed pattern across cmd/bd for a third instance reaching this
path: none.

Bead: ga-c3g45

* fix(httpapi): check the batch closer, the one role with a positional result

internal/httpapi has checked wrappers for Reader, BatchCreator, Lifecycle,
Claimer and Releaser, but the batch closer went out unwrapped — on the
reasoning that CloseBatchResult is a value and its issue pointer is
forwarded rather than dereferenced. True, and it is why there is no panic
here to prevent. What it left unguarded is the thing this role owns that
none of the others do: an array the client reads POSITIONALLY.

Two shapes reached the wire as answers rather than faults, and they fold
at different scopes:

  - An outcome count that does not match the request cannot be walked
    against the caller's items at all. Projected anyway it reports one
    item's answer under another item's id for the rest of the array,
    silently, inside a 200. Whole-batch 500, never a partial projection —
    checkedBatchCreator's refusal exactly.

  - An outcome carrying neither a row nor a refusal has no honest wire
    shape: `code`'s absence promises `issue`, so it projects as a success
    with no row, which is the shape closeOutcome's `default` branch
    already refuses to produce. Folded into THAT item, because this batch
    is not all-or-nothing — the survivors have committed, and failing the
    request would hide durable closes.

The fold corrects a copy: the outcomes slice is the role's, and one that
answers from a prepared result would otherwise carry this server's
correction into everything it hands back afterwards.

No wire shape changes and no spec changes; make api-check is a no-op, and
the error classification order in failBatchClose is untouched.

Bead: ga-39tl5

---------

Co-authored-by: Julian Knutsen <ci@beads.test>
2026-08-10 04:34:15 -07:00
..
apigen Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
spec Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
auth.go feat(serve): optional bearer auth and a Host allowlist for bd serve (#5516) 2026-08-09 18:05:56 -07:00
auth_test.go feat(serve): optional bearer auth and a Host allowlist for bd serve (#5516) 2026-08-09 18:05:56 -07:00
batch_apply.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
batch_apply_test.go Add issueops.BatchApplier: one plan, one transaction (#5480) 2026-08-09 06:59:34 -07:00
batch_close.go claimNext + batchClose + incremental labels: the three role-backed ops with no wire (ga-g3gg8) (#5510) 2026-08-09 16:02:52 -07:00
batch_close_test.go Make the next serve role a compile error, and check the one role with a positional result (#5539) 2026-08-10 04:34:15 -07:00
batch_create.go feat(httpapi): serve closeIssue over v0 2026-08-07 22:25:38 +00:00
batch_create_test.go feat(httpapi): serve closeIssue over v0 2026-08-07 22:25:38 +00:00
blocking.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
blocking_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
claim.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
claim_next.go claimNext + batchClose + incremental labels: the three role-backed ops with no wire (ga-g3gg8) (#5510) 2026-08-09 16:02:52 -07:00
claim_next_test.go claimNext + batchClose + incremental labels: the three role-backed ops with no wire (ga-g3gg8) (#5510) 2026-08-09 16:02:52 -07:00
claim_test.go Publish POST /v0/beads/issues/{id}:release: give a claim back (ga-lzcuv) (#5507) 2026-08-09 14:41:28 -07:00
close.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
close_test.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
context_test.go feat(serve): bd serve skeleton — lifecycle, mode gate, /healthz, /v0/beads/context (bd-60z) 2026-07-31 10:07:14 +00:00
count_test.go Publish GET /v0/beads/issues:count, with the role's whole filter surface (#5508) 2026-08-09 19:39:13 -07:00
create.go Publish POST /v0/beads/issues: the single create, with the whole vocabulary (#5483) 2026-08-09 09:21:56 -07:00
create_test.go Publish POST /v0/beads/issues: the single create, with the whole vocabulary (#5483) 2026-08-09 09:21:56 -07:00
cursor.go feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
cycles.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
cycles_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
delete.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
delete_test.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
dependency_edit.go feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +00:00
dependency_edit_test.go feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +00:00
doc.go docs(httpapi): stop the orientation prose enumerating a surface it no longer has 2026-08-08 01:34:33 +00:00
edge_counts_test.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
edges.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
edges_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
events.go feat(httpapi): stream the events journal over SSE (bd-opisf) 2026-08-09 07:55:23 +00:00
events_test.go feat(httpapi): publish the events journal on the v0 surface (bd-opisf) 2026-08-09 06:01:23 +00:00
events_watch.go feat(httpapi): stream the events journal over SSE (bd-opisf) 2026-08-09 07:55:23 +00:00
events_watch_test.go feat(httpapi): stream the events journal over SSE (bd-opisf) 2026-08-09 07:55:23 +00:00
get_issue_test.go Publish revision on the detail read: the token a guarded write is composed from (#5535) 2026-08-10 00:27:49 -07:00
handlers.go refactor(context): one snapshot-to-fields projection for both context surfaces 2026-07-31 22:35:09 +00:00
memories.go Put the memory plane behind memoryops, conformance-tested at three backends (#5387) 2026-08-07 03:57:04 -07:00
memories_test.go feat(httpapi): serve closeIssue over v0 2026-08-07 22:25:38 +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
pinning.go feat(httpapi): publish the events journal on the v0 surface (bd-opisf) 2026-08-09 06:01:23 +00:00
problem.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
problem_test.go feat(httpapi): OpenAPI v0 spec, types-only codegen, and the drift gates (bd-ilb) 2026-07-31 08:37:34 +00:00
project_stamp_test.go feat(httpapi): per-request project-id enforcement (Bd-Project-Id header) 2026-08-10 01:26:42 -07:00
query.go feat(httpapi): publish the events journal on the v0 surface (bd-opisf) 2026-08-09 06:01:23 +00:00
reads.go Publish GET /v0/beads/issues:count, with the role's whole filter surface (#5508) 2026-08-09 19:39:13 -07:00
reads_test.go feat(serve): optional bearer auth and a Host allowlist for bd serve (#5516) 2026-08-09 18:05:56 -07:00
ready_count_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
release.go Publish POST /v0/beads/issues/{id}:release: give a claim back (ga-lzcuv) (#5507) 2026-08-09 14:41:28 -07:00
release_test.go Publish POST /v0/beads/issues/{id}:release: give a claim back (ga-lzcuv) (#5507) 2026-08-09 14:41:28 -07:00
reopen.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
reopen_test.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
roles.go Make the next serve role a compile error, and check the one role with a positional result (#5539) 2026-08-10 04:34:15 -07:00
roles_test.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
routes.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
server.go Make the next serve role a compile error, and check the one role with a positional result (#5539) 2026-08-10 04:34:15 -07:00
server_test.go feat(httpapi): per-request project-id enforcement (Bd-Project-Id header) 2026-08-10 01:26:42 -07:00
settings.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
spec_parity_test.go Publish GET /v0/beads/dependencies:count, the wire half of issueops.GraphCounter (#5536) 2026-08-10 02:06:57 -07:00
stats.go Merge branch 'facade/wave-3' into facade/wave-4 2026-08-06 21:39:05 +00:00
stats_test.go Merge branch 'facade/wave-3' into facade/wave-4 2026-08-06 21:39:05 +00:00
sweep.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
sweep_test.go feat(httpapi): serve closeIssue over v0 2026-08-07 22:25:38 +00:00
timed_provider_binding_test.go feat(httpapi): publish removeDependency on the v0 surface 2026-08-08 00:19:48 +00:00
tree.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
tree_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
update.go Publish the row-version guard on close, reopen and delete (#5506) 2026-08-09 17:02:53 -07:00
update_test.go claimNext + batchClose + incremental labels: the three role-backed ops with no wire (ga-g3gg8) (#5510) 2026-08-09 16:02:52 -07:00
wire_bijection_test.go feat(httpapi): publish the events journal on the v0 surface (bd-opisf) 2026-08-09 06:01:23 +00:00