beads/internal/httpapi
CI Bot ea9ad2c5f4 fix(uow): fire script hooks on the unit-of-work plumbing (bd-opisf)
bd has two write plumbings and only one of them ran the workspace's hook
scripts. The DoltStorage decorator chain fires on_create/on_update/on_close
after every mutation it lands; the unit-of-work plumbing — the one
proxied-server mode writes through — fired nothing from the plumbing, so an
integration wired to .beads/hooks/ silently missed every mutation that went
through it. Four proxied commands had grown hand-wired RunSync calls of their
own to paper over the gap (update, close, reopen, gate); every other write —
create, batch create and close, claim, comment, label, dependency edits — ran
no hook at all.

NotifyingProvider closes the gap at the plumbing. Mutations are buffered as
they flow through the unit of work's use cases and the buffer drains to the
runner only after Commit succeeds: nothing fires mid-transaction, a rolled-back
or retried attempt fires nothing, and firing is fire-and-forget so a hook can
never fail a committed write. With no sinks the provider comes back unwrapped.
The per-command shims are gone — one firing site per plumbing — which drops the
two events proxied mode fired and the embedded path never did: the on_update
ahead of every close, and the on_close on a status-crossing update. It also
starts honoring `no-hooks`, which those shims ignored. CHANGELOG carries the
full list of what a proxied workspace sees change.

EVERY FIRING RULE IS MATCHED 1:1 against the decorator that implements it, and
each override cites its twin — including the ones that read backwards, like the
close that fires for an idempotent re-close because HookFiringStore.CloseIssueChecked
does. The payload matches too: a script is handed the issue with its LABELS, and
for an edge change its dependency records, because that is what the other
plumbing's re-read hands it. A create — and a whole graph apply, whose edges
are written beneath this seam entirely — reports every issue whose graph it
wrote: the created rows, whose on_create carries no records, and the far end of
any edge that leaves a row the plan did not create, each resolved across both
planes since an edge may name a wisp. Five deliberate divergences
remain and are listed in one place, the file header, with reasons.

Fire-and-forget is a promise about the MUTATION, not about the hook: a bd
command fires its hooks after the commit and returns, and the exit takes an
unstarted goroutine with it. hooks.Runner now tracks what it started and offers
a bounded Wait, called from two places because one is not enough — after the
store closes in PersistentPostRunE (an embedded workspace's Dolt lock has to be
released before a hook script's own bd can open it, and under -C the wait has to
precede the directory restore), and again in main() after ExecuteC, since cobra
skips PostRunE entirely when RunE returns an error. That second call is what
delivers the hook for the issue a partial batch DID commit. Both plumbings share
the runner, so both are covered.

The blocker on the first attempt was that it overrode a HAND-PICKED list of use
case methods, a coverage claim that decays the first time someone adds a verb.
notifying_parity_test.go replaces the claim with a PARTITION: reflection
enumerates every method of every surface the wrapper stands in front of, and
each is either recorded or carries a written reason for firing nothing — no
overlap, and no exemption for a method that no longer exists. Two AST guards
cover what reflection cannot, both scanning the whole package because a role
lives in its own file here: an accessor that delegates to the inner provider
(the edit that compiles, keeps every type assertion working and stops every
hook), and any code that reaches the unit of work beneath the recording layer.
There is exactly one of the latter — the import role, which runs the shared
batch-upsert engine on the raw statement runner and fires no hooks on either
plumbing. It now unwraps to reach it, where before it asserted the concrete type
and failed every import in a workspace that had hooks. The unwrap is unexported
so that guard stays complete.

`bd serve` still runs no hooks: it serves from uow.UnwrapProvider, and httpapi
refuses a hook-firing provider the way it already refuses a hook-firing role.

update_close_hook_test.go is retired. Its firing half observed
hooks.Runner.runHook, which internal/hooks tests directly (TestRunSync_Success,
TestRunSync_Timeout, TestRun_Async); its condition half asserted arithmetic on
local literals encoding the proxied-only predicate this change removes. The
contract it named — update fires on_update, close fires on_close, neither twice
— is pinned by TestNotifyingUOWOpToHookEventMapping and by the proxied
integration subtests.

Co-authored-by: CI Bot <ci@beads.test>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Agent-Signature: claude-code-claude-opus-5[1m]-unknown-reasoning on behalf of julianknutsen
2026-08-08 07:49:57 +00:00
..
apigen feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +00:00
spec feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +00: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 docs(httpapi): stop the orientation prose enumerating a surface it no longer has 2026-08-08 01:34:33 +00:00
claim_test.go docs(httpapi): stop the orientation prose enumerating a surface it no longer has 2026-08-08 01:34:33 +00:00
close.go feat(httpapi): serve closeIssue over v0 2026-08-07 22:25:38 +00:00
close_test.go feat(httpapi): serve updateIssue over v0 2026-08-07 22:25:47 +00: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
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 Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
delete_test.go feat(httpapi): serve closeIssue over v0 2026-08-07 22:25:38 +00: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
edges.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
edges_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
get_issue_test.go test(httpapi): assert what the getIssue include legs actually carry 2026-08-08 01:29:45 +00: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
pinning.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
problem.go feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +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(httpapi): stop the orientation prose enumerating a surface it no longer has 2026-08-08 01:34:33 +00:00
reads_test.go fix(defer): auto-wake expired dated defers on ready-front reads and claims (bd-i8qx8) (#5386) 2026-08-07 04:34:38 -07:00
ready_count_test.go Trim this series' comments toward the repo's own density 2026-08-06 08:06:59 +00:00
reopen.go feat(httpapi): serve reopenIssue over v0 2026-08-07 22:25:42 +00:00
reopen_test.go feat(httpapi): serve reopenIssue over v0 2026-08-07 22:25:42 +00:00
roles.go feat(httpapi): serve updateIssue over v0 2026-08-07 22:25:47 +00:00
roles_test.go fix(uow): fire script hooks on the unit-of-work plumbing (bd-opisf) 2026-08-08 07:49:57 +00:00
routes.go feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +00:00
server.go fix(uow): fire script hooks on the unit-of-work plumbing (bd-opisf) 2026-08-08 07:49:57 +00:00
server_test.go feat(httpapi): publish addDependencies on the v0 surface 2026-08-08 00:19:48 +00: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 test(httpapi): gate the four request member lists the wave left ungated 2026-08-08 01:37:11 +00: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 feat(httpapi): serve updateIssue over v0 2026-08-07 22:25:47 +00:00
update_test.go docs(httpapi): stop the orientation prose enumerating a surface it no longer has 2026-08-08 01:34:33 +00:00
wire_bijection_test.go chore(facade): reconcile wave 4's four slices and close the programme 2026-08-06 03:36:58 +00:00