beads/internal/httpapi
Julian Knutsen 0a3ff99f34
Add issueops.Claimer and route the HTTP claim through it (#5334)
The claim was the one v0 operation not covered by the public facade: the
handler reached past it into the domain layer, driving
uw.IssueUseCase().ClaimIssue directly and carrying its own conflict type,
its own refusal shaping and its own transaction protocol. That is a
handler doing the library's job.

Claim is now a role of its own beside issueops.Lifecycle and
issueops.Reader, reached by its own accessor rather than appended as a
fifth verb:

- issueops.Claimer, with ClaimRequest, ClaimResult and the typed
  ClaimConflictError, which WRAPS the refusal rather than replacing it —
  errors.Is, the refusal's exact prose and beads.ParseClaimConflict's
  fragments all survive.
- storage.Storage.IssueClaimer(), implemented by both Dolt stores over a
  shared storageissueops.ExecuteClaim, and recursed through by the hook
  and telemetry decorators.
- uow.IssueClaimerSource / uow.NewIssueClaimer, where the HTTP path's
  semantics live, retry included.

handleClaim now does argument validation, asks the provider for the role
and returns the result. The wire is unchanged: no diff under
internal/httpapi/spec or internal/httpapi/apigen, and the existing claim,
spec-parity and bijection suites pass unmodified apart from the storage
commit message, which loses its "bd serve:" prefix now that the operation
is not the server's.

ClaimResult.Issue is deliberately the bare post-state row — no labels,
dependencies or comments, unlike UpdateResult. That is what the shipped
v0 response and `bd update --claim --json` both report today, verified
against an issue that does carry labels; hydrating it here would change
an already-published body.

Breaking for out-of-tree implementations of beads.Storage, which must add
IssueClaimer() to compile. Noted in CHANGELOG.md.

Agent-Signature: claude-opus-5

Co-authored-by: CI Bot <ci@beads.test>
2026-08-04 08:40:18 -07:00
..
apigen feat(httpapi): require Problem.request_id and declare RFC 9457 type 2026-08-01 15:38:01 +00:00
spec docs(httpapi): close the re-spell and value-narrowing gaps in the Profiles relation 2026-08-01 16:26:39 +00:00
claim.go Add issueops.Claimer and route the HTTP claim through it (#5334) 2026-08-04 08:40:18 -07:00
claim_test.go Add issueops.Claimer and route the HTTP claim through it (#5334) 2026-08-04 08:40:18 -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
cursor.go feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
doc.go docs: one claim paragraph, defensible sentence by sentence 2026-07-31 23:47:32 +00:00
handlers.go refactor(context): one snapshot-to-fields projection for both context surfaces 2026-07-31 22:35:09 +00:00
pinning.go feat(httpapi): OpenAPI v0 spec, types-only codegen, and the drift gates (bd-ilb) 2026-07-31 08:37:34 +00:00
problem.go feat(httpapi): require Problem.request_id and declare RFC 9457 type 2026-08-01 15:38:01 +00: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
query.go feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
reads.go docs(workapi): say where the shared epilogue stops, and what limit 0 does 2026-07-31 23:35:16 +00:00
reads_test.go test(httpapi): pin that a read route times the units of work its reader opens 2026-07-31 20:04:23 +00:00
routes.go feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
server.go Add issueops.Claimer and route the HTTP claim through it (#5334) 2026-08-04 08:40:18 -07:00
server_test.go docs(ci): stop calling a PR job required, because none of them is 2026-07-31 23:32:28 +00:00
spec_parity_test.go docs(ci): stop calling a PR job required, because none of them is 2026-07-31 23:32:28 +00:00
wire_bijection_test.go test(httpapi): guard every pinned schema, and untagged fields, in the bijection test (bd-ilb) 2026-07-31 08:56:58 +00:00