test(server): unit-test registry dispatch-by-type + worker lifecycle (#273 follow-up) #284
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!284
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "test/s11-registry"
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?
PR #273 reviewer flagged that the 7 extracted s11 modules had no dedicated tests. This fills the gap for
registry.ts.Coverage (12 tests)
registerWorker/getWorker/unregisterWorkerlifecycle, incl. unknown-name no-opgetWorkersread-only view reflects insertions + deletions livegetWorkersByTypefilter + sort-by-name, unknown-type →[]findWorkerByUserhit/missgetForemanWorkernull-on-empty, found-with-host-mode, requires BOTHhost_mode=trueANDtype="foreman"listRunningTasksForIssuefilters by bothrepoandissue_numbersetAgentDeleteRunner/resetAgentDeleteRunner/getAgentDeleteRunnerseamCoverage gap (documented)
dispatchByTypeis not unit-tested throughregistry.ts. Six sibling suites (webhook-ci.test.ts,webhook-handlers.test.ts,webhook-post-merge.test.ts,webhook-assign-dedup.test.ts,breakdown.test.ts,force-merge.integration.test.ts) usemock.module("../domain/dispatch/registry", …), and Bun'smock.moduleis process-global and survives across files, so any in-file test would be shadowed under full-suite runs. The selection logic is fully covered bypool.test.ts; the registry'sdispatchByTypeis a one-line pass-through topoolDispatchByType. If the wrapper is ever thickened, the sibling stubs should move to a janitor-styleimplseam first.Checks
bunx tsc --noEmit -p apps/server/tsconfig.json— EXIT=0bun test apps/server/src/domain/dispatch/registry.test.ts— 12/12 pass