test(agents): port runAgentTask import-boundary test from closed #530 #535

Closed
opened 2026-04-28 14:13:25 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a maintainer, I want a CI-running test that asserts runAgentTask is only imported from infrastructure/agents/, so that the @internal marker is enforced and accidental re-leaks fail fast on every push.

Why

Issue #519 closed via #533 (route dispatch through AgentDispatchPort). The parallel PR #530 (closed as duplicate on 2026-04-28) carried a novel run-agent-task-boundary.test.ts that did not land in main. The closing comment promised a follow-up — this is it.

Without this test, a future refactor can re-import runAgentTask from any module without anyone noticing.

Acceptance criteria

  • New file apps/server/src/infrastructure/agents/run-agent-task-boundary.test.ts (port verbatim from dev/519 commit 3ede225)
  • Test walks every *.ts file under apps/server/src/ (excluding *.test.ts and node_modules)
  • Asserts no file outside infrastructure/agents/ matches import\s*\{[^}]*\brunAgentTask\b[^}]*\}\s*from\s*['"][^'"]*agent-runner['"]
  • bun test apps/server/src/infrastructure/agents/run-agent-task-boundary.test.ts passes (1 test)
  • just qa clean

Out of scope

  • Generalising the boundary check to other @internal symbols
  • CI configuration changes — the test is a regular bun test invocation

References

## User story As a maintainer, I want a CI-running test that asserts `runAgentTask` is only imported from `infrastructure/agents/`, so that the `@internal` marker is enforced and accidental re-leaks fail fast on every push. ## Why Issue #519 closed via #533 (route dispatch through `AgentDispatchPort`). The parallel PR #530 (closed as duplicate on 2026-04-28) carried a novel `run-agent-task-boundary.test.ts` that did not land in main. The closing comment promised a follow-up — this is it. Without this test, a future refactor can re-import `runAgentTask` from any module without anyone noticing. ## Acceptance criteria - [ ] New file `apps/server/src/infrastructure/agents/run-agent-task-boundary.test.ts` (port verbatim from `dev/519` commit `3ede225`) - [ ] Test walks every `*.ts` file under `apps/server/src/` (excluding `*.test.ts` and `node_modules`) - [ ] Asserts no file outside `infrastructure/agents/` matches `import\s*\{[^}]*\brunAgentTask\b[^}]*\}\s*from\s*['"][^'"]*agent-runner['"]` - [ ] `bun test apps/server/src/infrastructure/agents/run-agent-task-boundary.test.ts` passes (1 test) - [ ] `just qa` clean ## Out of scope - Generalising the boundary check to other `@internal` symbols - CI configuration changes — the test is a regular `bun test` invocation ## References - Closed PR #530 (`dev/519`, commit `3ede225`) - Closed issue #519 (closed via #533, `8cd16f0`) - Test source: https://forge.jacquin.app/charles/claude-hooks/src/commit/3ede225/apps/server/src/infrastructure/agents/run-agent-task-boundary.test.ts
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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#535
No description provided.