refactor(webhook): relocate event handlers to domain/workflow (NF-8) #444

Merged
claude-desktop merged 1 commit from boss/329 into main 2026-04-27 12:00:25 +00:00
Collaborator

Summary

NF-8: legacy dispatch removal. Event handlers and post-CI helpers leave the HTTP layer and move into domain/workflow/, so the flow runner is the only consumer.

  • apps/server/src/http/webhook-handlers.tsapps/server/src/domain/workflow/event-handlers.ts
  • apps/server/src/http/webhook-ci.tsapps/server/src/domain/workflow/post-ci.ts
  • accompanying tests moved alongside the helpers (renamed to event-handlers.test.ts, post-ci.test.ts, post-merge.test.ts, issue-unassign.test.ts)

http/webhook.ts keeps only HMAC verification, payload normalisation, and the call into dispatchToFlows(). Default-graph JSON files remain the single source of truth for event → side-effect mapping.

The flow-runner injections in flow-dispatch.ts, the operator /redispatch route in main.ts, and the handleIssueUnassigned import in webhook.ts all point at the new domain locations. docs/modules.md + docs/breakdown.md cross-references updated; user-visible "not wired" error messages in agent-nodes.ts refreshed.

Closes #329

Test plan

  • bun x turbo run typecheck — 4/4 packages clean
  • bun x @biomejs/biome@^2 check . — clean (zero errors)
  • bun x turbo run test — 2026 pass, 0 fail across 86 files
  • Reviewer verifies the moved tests still cover the same surface (1:1 relocation, no behaviour drift)
  • CI passes on the PR

🤖 Generated with Claude Code

## Summary NF-8: legacy dispatch removal. Event handlers and post-CI helpers leave the HTTP layer and move into `domain/workflow/`, so the flow runner is the only consumer. - `apps/server/src/http/webhook-handlers.ts` → `apps/server/src/domain/workflow/event-handlers.ts` - `apps/server/src/http/webhook-ci.ts` → `apps/server/src/domain/workflow/post-ci.ts` - accompanying tests moved alongside the helpers (renamed to `event-handlers.test.ts`, `post-ci.test.ts`, `post-merge.test.ts`, `issue-unassign.test.ts`) `http/webhook.ts` keeps only HMAC verification, payload normalisation, and the call into `dispatchToFlows()`. Default-graph JSON files remain the single source of truth for event → side-effect mapping. The flow-runner injections in `flow-dispatch.ts`, the operator `/redispatch` route in `main.ts`, and the `handleIssueUnassigned` import in `webhook.ts` all point at the new domain locations. `docs/modules.md` + `docs/breakdown.md` cross-references updated; user-visible "not wired" error messages in `agent-nodes.ts` refreshed. Closes #329 ## Test plan - [x] `bun x turbo run typecheck` — 4/4 packages clean - [x] `bun x @biomejs/biome@^2 check .` — clean (zero errors) - [x] `bun x turbo run test` — 2026 pass, 0 fail across 86 files - [ ] Reviewer verifies the moved tests still cover the same surface (1:1 relocation, no behaviour drift) - [ ] CI passes on the PR 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor(webhook): relocate event handlers to domain/workflow (NF-8)
Some checks are pending
qa / qa (pull_request) Waiting to run
qa / dockerfile (pull_request) Waiting to run
ab26e2c963
Move dispatch helpers out of the HTTP layer into the workflow domain so
the flow runner is the only consumer:

- apps/server/src/http/webhook-handlers.ts → domain/workflow/event-handlers.ts
- apps/server/src/http/webhook-ci.ts → domain/workflow/post-ci.ts
- accompanying tests moved alongside the helpers

The HTTP webhook surface (`http/webhook.ts`) keeps only signature
verification, payload normalisation, and the call into `dispatchToFlows`.
Default-graph JSON files remain the single source of truth for
event → side-effect mapping.

Update the flow-runner injections in `flow-dispatch.ts`, the operator
`/redispatch` route in `main.ts`, and the residual `handleIssueUnassigned`
import in `webhook.ts` to point at the new domain locations. Refresh
`docs/modules.md` + `docs/breakdown.md` cross-references and the
user-visible "not wired" error messages in `agent-nodes.ts`.

Closes #329

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
code-lead force-pushed boss/329 from ab26e2c963
Some checks are pending
qa / qa (pull_request) Waiting to run
qa / dockerfile (pull_request) Waiting to run
to 0ea0c5e085
All checks were successful
qa / qa (pull_request) Successful in 8m39s
qa / dockerfile (pull_request) Successful in 14s
2026-04-27 10:13:47 +00:00
Compare
reviewer approved these changes 2026-04-27 10:46:55 +00:00
reviewer left a comment

Clean relocation — imports, tests, and docs all land in the right places; 2026 tests pass with zero drift. The three handlers kept imperative in webhook.ts (handleIssueUnassigned, handlePrDependencyMarkers, handleStackedRebaseCascade) are all documented with explicit rationale, not oversights.

Clean relocation — imports, tests, and docs all land in the right places; 2026 tests pass with zero drift. The three handlers kept imperative in `webhook.ts` (`handleIssueUnassigned`, `handlePrDependencyMarkers`, `handleStackedRebaseCascade`) are all documented with explicit rationale, not oversights.
code-lead force-pushed boss/329 from 0ea0c5e085
All checks were successful
qa / qa (pull_request) Successful in 8m39s
qa / dockerfile (pull_request) Successful in 14s
to a3c96b2360
Some checks failed
qa / qa (pull_request) Has been cancelled
qa / dockerfile (pull_request) Has been cancelled
2026-04-27 10:49:38 +00:00
Compare
code-lead force-pushed boss/329 from a3c96b2360
Some checks failed
qa / qa (pull_request) Has been cancelled
qa / dockerfile (pull_request) Has been cancelled
to af1d13f81f
All checks were successful
qa / qa (pull_request) Successful in 9m7s
qa / dockerfile (pull_request) Successful in 13s
2026-04-27 11:02:59 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!444
No description provided.