Plan: Unit tests for BLOCKED:PERSISTENT → gated status transition#
Summary#
Add missing edge-case unit tests in internal-adapter.service.spec.ts and create a new phase-hooks.service.spec.ts to cover the BLOCKED:PERSISTENT → status=gated transition and the gated hook category side effect from commit #243.
Files#
| File | Action | Description |
|---|---|---|
src/internal-adapter/internal-adapter.service.spec.ts | modify | Add edge-case tests: already-gated task, transient block resolved before threshold |
src/hooks/phase-hooks.service.spec.ts | create | Unit tests for onPhaseBlocked with gated category |
Steps#
- Add "already gated" edge case to
internal-adapter.service.spec.ts: create a task withstatus=gated, fireBLOCKED:PERSISTENT, assert no error and status remainsgatedwith updatedgatePhase/gateReason. - Add "clears before threshold" edge case to
internal-adapter.service.spec.ts: fire oneBLOCKED:TRANSIENT(belowMAX_TRANSIENT_RETRIES), then fireCOMPLETE— assertstatusis NOTgatedand task advances normally. - Create
phase-hooks.service.spec.ts: testonPhaseBlockedwithcategory='gated'for a non-refine/review phase — assertaddLabel('agent-blocked')is called and comment body contains🚫 Phase persistently blocked. - Test gated category early return for refine/review: call
onPhaseBlockedwithcategory='gated'andphase='refine'orphase='review'— assert no label added and no comment posted.
Verification#
npm run testpasses with all new tests greennpm run lintpasses with zero warnings- No production code changes
Risks#
PhaseHooksServiceconstructor has four dependencies (GitHubService,ConfigService,CompoundService,EventService) — all must be mocked correctly in the new spec file.