feat(flows): trigger-event union + webhook-normalize converter (NF-1) #341
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!341
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/322-nf1-trigger-union"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase-0 scaffolding for Node Flows (M21). Additive only — no existing handler is rewired, nothing subscribes to the union yet. Closes #322.
Summary
TriggerEventdiscriminated union inpackages/shared/src/trigger-event.ts, row-for-row with the catalog inspecs/node-flows.md§ Trigger catalog (v1).kindstrings are wire-frozen — adding a trigger is a new member + new converter, never a reshape.toTriggerEvent(event, firedAt?)converter inapps/server/src/http/webhook-normalize.ts— mapsForgeEvent→TriggerEvent | null. Handles:issues.{assigned,labeled,closed}→issue.{assigned,labeled,closed}(issue-labeled emitslabelsBefore: null+labelsAfter: issue.labelssince the wire format doesn't expose pre-change state).issue_comment.created→issue_comment.slash_commandwhen the body matches/<letter>..., else the plain arm.pull_request.{opened,synchronized,closed}+pull_request_review.{requested,submitted}.ci_run→check_suite.completedonly on terminal states (success/failure/error);pendingreturnsnull.unhandled/repo=null→null.ForgeEventunion:issueOpenedTrigger,issueUnassignedTrigger,issueUnlabeledTrigger,pullRequestOpenedTrigger,pullRequestReadyForReviewTrigger,cronTickTrigger,taskCompletedTrigger,taskFailedTrigger,taskCostCappedTrigger,manualTrigger.rawBody).Test plan
bun test apps/server/src/http/webhook-normalize.test.ts— 60/60 pass, 150 expects.bun x turbo run typecheck— 4/4 packages clean.bun x biome check— clean on touched files.packages/shared/src/{trigger-event,index}.ts,apps/server/src/http/webhook-normalize{,.test}.ts. No handler dispatch touched.Out of scope
issue.opened/issue.unassigned/issue.unlabeled/pull_request.ready_for_review— factory helpers stand in until the per-forge normalisers emit those arms.Closes #322.
🤖 Generated with Claude Code