docs(08.1-02): complete MockAgentManager schema alignment plan

Tasks completed: 3/3
- Update MockAgentManager to use schema-aligned scenarios
- Update TestHarness setAgentScenario helper
- Update MockAgentManager tests

SUMMARY: .planning/phases/08.1-agent-output-schema/08.1-02-SUMMARY.md
This commit is contained in:
Lukas May
2026-01-31 15:33:12 +01:00
parent 565f9fdae9
commit e318a92413
3 changed files with 114 additions and 9 deletions

View File

@@ -146,10 +146,11 @@ Plans:
**Goal**: Define structured agent output schema (done/question/error discriminated union) and update ClaudeAgentManager to use `--json-schema` flag for validated output parsing
**Depends on**: Phase 8
**Research**: Unlikely (Zod schemas, Claude CLI flags documented)
**Plans**: 1 plan
**Plans**: 2 plans
Plans:
- [x] 08.1-01: Agent Output Schema & ClaudeAgentManager
- [x] 08.1-02: MockAgentManager Schema Alignment
#### Phase 9: Extended Scenarios
@@ -178,7 +179,7 @@ Phases execute in numeric order: 1 → 1.1 → 2 → 3 → 4 → 5 → 6 → 7
| 6. Coordination | v1.0 | 3/3 | Complete | 2026-01-30 |
| 7. Mock Agent & Test Harness | v1.1 | 2/2 | Complete | 2026-01-31 |
| 8. E2E Scenario Tests | v1.1 | 2/2 | Complete | 2026-01-31 |
| 8.1. Agent Output Schema | v1.1 | 1/1 | Complete | 2026-01-31 |
| 8.1. Agent Output Schema | v1.1 | 2/2 | Complete | 2026-01-31 |
| 9. Extended Scenarios | v1.1 | 0/2 | Not started | - |
---

View File

@@ -10,18 +10,18 @@ See: .planning/PROJECT.md (updated 2026-01-30)
## Current Position
Phase: 8.1 of 9 (Agent Output Schema)
Plan: 1 of 1 in current phase
Plan: 2 of 2 in current phase
Status: Phase complete
Last activity: 2026-01-31 — Completed 08.1-01-PLAN.md
Last activity: 2026-01-31 — Completed 08.1-02-PLAN.md
Progress: █████████░ 85%
Progress: █████████░ 87%
## Performance Metrics
**Velocity:**
- Total plans completed: 32
- Total plans completed: 33
- Average duration: 3 min
- Total execution time: 101 min
- Total execution time: 105 min
**By Phase (v1.0):**
@@ -36,7 +36,7 @@ Progress: █████████░ 85%
| 6 | 3/3 | 9 min | 3 min |
**Recent Trend:**
- Last 5 plans: 08.1-01 (5 min), 08-02 (3 min), 08-01 (3 min), 07-02 (4 min), 07-01 (2 min)
- Last 5 plans: 08.1-02 (4 min), 08.1-01 (5 min), 08-02 (3 min), 08-01 (3 min), 07-02 (4 min)
- Trend: Steady
## Accumulated Context
@@ -113,6 +113,9 @@ Recent decisions affecting current work:
- 08.1-01: Discriminated union with done/question/unrecoverable_error for agent output
- 08.1-01: JSON schema passed to Claude CLI for validated output
- 08.1-01: Options and multiSelect fields for structured question choices
- 08.1-02: MockAgentScenario aligned with agent output schema (status-based discriminated union)
- 08.1-02: TestHarness convenience methods for scenario setup (setAgentDone/Question/Error)
- 08.1-02: getPendingQuestion exposed through TestHarness interface
### Pending Todos
@@ -132,5 +135,5 @@ None yet.
## Session Continuity
Last session: 2026-01-31
Stopped at: Completed 08.1-01-PLAN.md (Phase 8.1 complete)
Stopped at: Completed 08.1-02-PLAN.md (Phase 8.1 complete)
Resume file: None

View File

@@ -0,0 +1,101 @@
---
phase: 08.1-agent-output-schema
plan: 02
subsystem: testing
tags: [mock-manager, test-harness, discriminated-union, vitest]
# Dependency graph
requires:
- phase: 08.1-01
provides: [Agent output schema, PendingQuestion type, structured question data]
provides:
- MockAgentManager with schema-aligned scenarios
- TestHarness convenience methods for scenario setup
- Updated E2E tests using new scenario format
affects: [phase-9-e2e-tests]
# Tech tracking
tech-stack:
added: []
patterns: [status-based-discriminated-union-for-mock-scenarios]
key-files:
created: []
modified: [src/agent/mock-manager.ts, src/test/harness.ts, src/agent/mock-manager.test.ts, src/test/e2e/edge-cases.test.ts, src/test/harness.test.ts]
key-decisions:
- "Align MockAgentScenario with agent output schema (done/question/unrecoverable_error)"
- "Add convenience helpers to TestHarness (setAgentDone, setAgentQuestion, setAgentError)"
- "Add getPendingQuestion to TestHarness for question retrieval"
patterns-established:
- "Mock scenarios use same discriminated union pattern as real agent output"
- "TestHarness provides typed helpers for common scenario types"
# Metrics
duration: 4min
completed: 2026-01-31
---
# Phase 08.1 Plan 02: MockAgentManager Schema Alignment Summary
**MockAgentManager updated to use schema-aligned discriminated union scenarios (done/question/unrecoverable_error) with TestHarness convenience helpers**
## Performance
- **Duration:** 4 min
- **Started:** 2026-01-31T14:28:00Z
- **Completed:** 2026-01-31T14:32:00Z
- **Tasks:** 3
- **Files modified:** 5
## Accomplishments
- MockAgentManager scenarios now align with agent output schema (status-based discriminated union)
- TestHarness provides setAgentDone/setAgentQuestion/setAgentError convenience methods
- All existing E2E tests updated to use new scenario format
- Added tests for structured question data, getPendingQuestion, and resume clearing pending question
## Task Commits
Each task was committed atomically:
1. **Task 1: Update MockAgentManager to use schema-aligned scenarios** - `ead4614` (feat)
2. **Task 2: Update TestHarness setAgentScenario helper** - `8e38bd2` (feat)
3. **Task 3: Update MockAgentManager tests** - `565f9fd` (test)
## Files Created/Modified
- `src/agent/mock-manager.ts` - MockAgentScenario now uses status-based discriminated union
- `src/test/harness.ts` - Added convenience methods and getPendingQuestion
- `src/agent/mock-manager.test.ts` - Updated all scenarios to new format, added structured question tests
- `src/test/e2e/edge-cases.test.ts` - Updated crash/waiting scenarios to new format
- `src/test/harness.test.ts` - Updated crash scenario to new format
## Decisions Made
1. **Align with output schema** - MockAgentScenario uses same pattern as AgentOutput (done/question/unrecoverable_error)
2. **Convenience methods** - TestHarness provides typed helpers to reduce boilerplate in tests
3. **getPendingQuestion in harness** - Allows tests to verify question data without accessing agentManager directly
## Deviations from Plan
None - plan executed exactly as written.
## Issues Encountered
None.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- MockAgentManager fully aligned with ClaudeAgentManager output schema
- TestHarness provides convenient scenario helpers for Phase 9 E2E tests
- All 367 tests pass
---
*Phase: 08.1-agent-output-schema*
*Completed: 2026-01-31*