AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-245
  5. plan
  6. plan.md
plan.md(2.3 KB)· Apr 2, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Integration Test — BLOCKED:PERSISTENT → gated → refine eligibility#

Summary#

Add an integration test that proves the end-to-end handoff between #243 (BLOCKED:PERSISTENT sets status=gated) and #237 (refine pre-validation rejects non-gated tasks). The test wires InternalAdapterService and DirectiveService against an in-memory SQLite database to verify the combined state-machine path without mocking the DB layer.

Files#

PathActionDescription
test/integration/blocked-persistent-to-refine.integration.spec.tscreateIntegration spec covering the full BLOCKED:PERSISTENT → gated → refine flow

Steps#

  1. Create integration test file at test/integration/blocked-persistent-to-refine.integration.spec.ts. Wire a NestJS testing module with real in-memory SQLite (TaskEntity, EventEntity, JobEntity), real InternalAdapterService, real DirectiveService, real TaskStateService, and mocked external dependencies (GitHub client, ConfigService, PhaseHooksService, ClaudeInvocationService, JobQueueService).
  2. Test: BLOCKED:PERSISTENT transitions task to status=gated. Create a task via TaskStateService.createTask(), call InternalAdapterService.handleSignal() with 'BLOCKED:PERSISTENT', assert task.status === 'gated', gatePhase and gateReason are set.
  3. Test: gated task is accepted by refine pre-validation. Using the gated task from step 2's setup, call DirectiveService.applyDirective() with directive 'refine'. Assert gate is cleared and InternalAdapterService.enqueuePhase() is called with 'refine'.
  4. Test: non-gated task is rejected by refine pre-validation. Create a fresh task (status=active), call DirectiveService.applyDirective() with directive 'refine'. Assert rejection comment is posted and no phase is enqueued.
  5. Add traceability references. Include describe block description and inline comments referencing #243 and #237 per acceptance criteria.

Verification#

  • npm run test -- --testPathPattern=blocked-persistent-to-refine passes all three test cases.
  • npm run lint reports zero warnings.

Risks#

  • DirectiveService.applyDirective() has many dependencies; mock surface may be large. Mitigate by mocking only external I/O (GitHub API, job queue) and keeping DB real.
ContextPrd