---
phase: 14-parallel-phase-execution
plan: 08
type: execute
wave: 5
depends_on: ["14-06"]
files_modified:
  - src/__tests__/e2e/phase-dispatch.test.ts
autonomous: true
---

<objective>
Add E2E tests for parallel phase execution scenarios.

Purpose: Verify end-to-end phase dispatch with dependencies works correctly.
Output: E2E tests covering parallel execution scenarios.
</objective>

<execution_context>
@~/.claude/get-shit-done/workflows/execute-plan.md
@~/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/14-parallel-phase-execution/14-06-SUMMARY.md

# Reference implementations:
@src/__tests__/e2e/happy-path.test.ts
@src/__tests__/e2e/parallel-conflict.test.ts
</context>

<tasks>

<task type="auto">
  <name>Task 1: Create phase dispatch E2E tests</name>
  <files>src/__tests__/e2e/phase-dispatch.test.ts</files>
  <action>
Create E2E test file for phase dispatch scenarios:

describe('Phase Parallel Execution'):

Test 1: Independent phases dispatch in parallel
- Create initiative with 2 independent phases (no dependencies)
- Queue both phases
- Both should be ready for dispatch immediately
- Dispatch both and verify parallel execution

Test 2: Dependent phase waits for prerequisite
- Create phases: A, B (depends on A)
- Queue both
- Only A should be ready
- Complete A
- B should become ready

Test 3: Diamond dependency pattern
- Create phases: A, B (depends on A), C (depends on A), D (depends on B, C)
- Queue all
- A ready first
- After A completes: B and C ready (parallel)
- After B and C complete: D ready

Test 4: Blocked phase doesn't dispatch
- Create phases: A, B (depends on A)
- Block A
- B should never become ready

Use TestHarness with database fixtures.
Follow existing E2E test patterns.
  </action>
  <verify>npm test -- src/__tests__/e2e/phase-dispatch.test.ts passes</verify>
  <done>Phase dispatch E2E tests cover parallel execution scenarios</done>
</task>

<task type="auto">
  <name>Task 2: Add phase dispatch to TestHarness</name>
  <files>src/__tests__/harness.ts</files>
  <action>
Extend TestHarness to support phase dispatch testing:
- Add phaseDispatchManager property (DefaultPhaseDispatchManager instance)
- Wire up with phaseRepository and eventBus
- Add helper methods if needed: queuePhase(), dispatchPhase()

Follow patterns from existing harness setup.
  </action>
  <verify>npm test -- src/__tests__/e2e/phase-dispatch.test.ts passes</verify>
  <done>TestHarness supports phase dispatch scenarios</done>
</task>

</tasks>

<verification>
Before declaring plan complete:
- [ ] `npm run build` succeeds without errors
- [ ] `npm test` passes all tests
- [ ] E2E tests verify actual parallel behavior
</verification>

<success_criteria>

- All tasks completed
- All verification checks pass
- Tests verify dependency ordering is enforced
- Tests verify parallel phases dispatch together
</success_criteria>

<output>
After completion, create `.planning/phases/14-parallel-phase-execution/14-08-SUMMARY.md`
</output>
