Skip to content

Decision Testing Strategy

Reese Hodge edited this page Nov 19, 2026 · 4 revisions

Decision: Testing Strategy

Context

Max Height uses mandatory TDD for production code. The working rule is RED-GREEN-REFACTOR: write the failing test for the desired behavior, make it pass with the smallest production change, then refactor while keeping the related tests green. A checked task is not proof; tasks.md deviation C4 exists because a completed task later proved half-implemented.

research.md R5 defines the test stack. plan.md and tasks.md make testing a quality gate rather than a cleanup phase.

Decision

Use the following layered testing strategy:

Layer Tooling Source rationale
packages/frontend/ Vitest + React Testing Library Native Vite support, fast ESM-first component tests, jsdom environment
packages/agent/ Vitest + aws-sdk-client-mock Same Vitest pipeline, mocked Bedrock calls, pure handler tests
packages/infra/ Jest + aws-cdk-lib/assertions CDK has first-class Jest support and Template.fromStack() assertions
Browser E2E Playwright WebSocket interception, audio element testing, Web Speech API mocking, cross-browser coverage
Personality AgentCore Evaluations 50-case golden set, 6-dimension rubric, async batch scoring. Superseded in part: the set has 65 cases, and spec 003's S1 scores it with an offline judge script (Concept-Personality-Gate, Source-AgentCore-Evaluations)

The final repository quality gate is:

pnpm run validate

That command chains lint, format check, type-check, build, and test. Work is not complete until this gate passes, except for wiki-only edits where the relevant wiki gate is pnpm run wiki:lint.

Consequences

Tests are embedded in each implementation phase rather than deferred to the end. tasks.md records K1 as a previous correction: tests being deferred to Phase 8 violated the testing principle, so test tasks were moved into the relevant user-story phases.

The strategy directly covers earlier deviations:

Deviation Testing consequence
C1 Personality gate requires building and running the golden set: 65 cases, not the 50 spec 001 planned.
C2 Observability needs trace-span tests/verification for the five latency spans.
C3 WebSocket Lambda handler must exist as code, not only infrastructure intent.
C4 AgentCore Memory needs actual construct and client coverage before being trusted.
C5 AgentCore V2 snapshot-safety must be tested before runtime provisioning.

The wiki itself is intentionally outside pnpm run validate because the local wiki/ clone is optional and gitignored. Wiki pages still need linting through Guide-Wiki-Contributing and Guide-Validation-Gate.

No AWS integration layer — reviewed 2026-11-11

Every AWS call in the table above is mocked, so the suite asserts what we called, never that AWS would have accepted it. That gap was re-examined when AWS released Source-AWS-Emulator, a free local emulator of the AWS APIs, on 2026-11-11.

It was not adopted, and no test tooling changed. The reasons are recorded in full on that page; the short form is that the things we most need confidence in are the ones the emulator explicitly cannot give:

What we test Why the emulator does not help
The personality golden set Scores what the model says; an emulated Converse returns an API-shaped response, not Max Height's voice
Polly voice and pacing Turns on how a clip sounds and how long it runs, not on response shape
Least-privilege IAM and the budget hard stop AWS states the emulator does not evaluate IAM and never denies its own key
CDK stacks CloudFormation scored 795/4206 (19%) at release v1.0.322 — the worst of any service we use

For the existing infrastructure integration gap, any emulator spike remains control-plane-only, opt-in, and outside pnpm run validate, which cannot depend on a running daemon. The separate resilience-testing candidate is described below.

Tool-level resilience experiments - reviewed 2026-11-19

Source-AWS-AgentCore-Resilience-Testing demonstrates FIS-controlled faults inside a deployed AgentCore runtime and measures whether the agent refuses, recovers, or fabricates after a tool failure. This complements the existing mocked tool tests, but its Python chaos_plugins() implementation is not directly usable by Max Height's TypeScript agent. No FIS/SSM experiment lane is adopted.

AWS Emulator has individual fidelity tests for FIS experiment lifecycle, SSM Automation/Parameter Store, and a small invokable AgentCore runtime. The exact FIS -> SSM -> AgentCore workflow is not covered as one test, so the emulator is only a candidate for an opt-in spike, not a substitute for a dedicated AWS runtime test. See Source-AWS-Emulator for the release and score qualifications.

An adopted deployed experiment would add AWS service use and resources. Treat that as a new capability/cost decision requiring Spec Kit and a budget/constitution review before implementation, not as a test-only tooling change.

Alternatives considered

Alternative Rejected because
Jest for everything Slower and less natural for Vite/ESM packages.
Vitest for CDK Not the AWS-supported path for CDK assertions.
Cypress for E2E Weaker fit for native WebSocket interception.
Tests after implementation Violates the mandatory TDD workflow and previously caused drift.
AWS Emulator as a local integration layer Reviewed 2026-11-11 and held for existing infrastructure tests; a resilience-specific spike was reviewed 2026-11-19 and remains unadopted. See Source-AWS-Emulator and Source-AWS-AgentCore-Resilience-Testing.

Status/verification

Verified against research.md R5, plan.md, and tasks.md on 2026-09-26. See Concept-Testing-And-TDD for the principle and Guide-Validation-Gate for the command-level workflow.

Clone this wiki locally