{
"meta": {
"agent": "planner",
"task_id": "247",
"title": "Integration test: BLOCKED:PERSISTENT → gated → refine eligibility",
"created_at": "2026-04-02T12:00:00Z"
},
"inputs": [
{
"name": "issue-247",
"type": "context",
"ref": "https://github.com/AgentSDE/agent-core/issues/247",
"notes": "Integration test for #243 + #237 state-machine handoff"
},
{
"name": "internal-adapter.service.ts",
"type": "file",
"ref": "src/internal-adapter/internal-adapter.service.ts",
"notes": "handlePersistentBlock sets status=gated (#243)"
},
{
"name": "directive.service.ts",
"type": "file",
"ref": "src/directive/directive.service.ts",
"notes": "applyDirective('refine') pre-validation rejects non-gated (#237)"
},
{
"name": "internal-adapter.service.spec.ts",
"type": "file",
"ref": "src/internal-adapter/internal-adapter.service.spec.ts",
"notes": "Existing unit test pattern with in-memory SQLite"
},
{
"name": "directive.service.spec.ts",
"type": "file",
"ref": "src/directive/directive.service.spec.ts",
"notes": "Existing mock patterns for DirectiveService dependencies"
}
],
"outputs": [
{
"name": "plan.md",
"type": "plan",
"format": "md",
"content": "Integration test plan for BLOCKED:PERSISTENT → gated → refine"
}
],
"files": [
{
"path": "test/integration/blocked-persistent-gated-refine.integration.spec.ts",
"action": "create",
"reason": "New integration test covering the end-to-end gated → refine flow"
}
],
"steps": [
{
"id": "S1",
"summary": "Create integration test file with NestJS test module wiring both InternalAdapterService and DirectiveService against in-memory SQLite",
"acceptance": [
"File exists at test/integration/blocked-persistent-gated-refine.integration.spec.ts",
"Test module uses real TypeORM with in-memory SQLite and real TaskEntity repository",
"External I/O (GitHub API, job queue, dispatch) is mocked"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Implement four test cases: gated transition, refine acceptance, refine rejection, and idempotent re-block",
"acceptance": [
"Test: BLOCKED:PERSISTENT sets status=gated, gatePhase, gateReason",
"Test: applyDirective('refine') on gated task succeeds (clears gate, enqueues refine)",
"Test: applyDirective('refine') on non-gated task is rejected",
"Test: re-firing BLOCKED:PERSISTENT on already-gated task is idempotent",
"All tests include inline comments referencing #243 and #237"
],
"depends_on": [
"S1"
]
},
{
"id": "S3",
"summary": "Run tests and lint to verify all pass",
"acceptance": [
"npm run test -- --testPathPattern=blocked-persistent-gated-refine passes",
"npm run lint reports zero warnings"
],
"depends_on": [
"S2"
]
}
],
"risks": [
{
"risk": "DirectiveService has many dependencies requiring careful mock setup",
"mitigation": "Reuse established mock patterns from directive.service.spec.ts"
}
],
"assumptions": [
"In-memory SQLite is sufficient to test the state transitions without a real database",
"Mocking GitHub API and job queue does not reduce the integration value of the state-machine handoff test"
],
"open_questions": []
}