4.2 KiB
4.2 KiB
Tasks — Testing generics hardening
Every checkbox reflects work actually done in this change. Genesis-original package, no
enterprise/<pkg>.mdsource mapping.
1. Spec authoring
- 1.1 Read
openspec/specs/testing/spec.md - 1.2 Read
openspec/AGENTS.mdSections 13 and 14 (via CLAUDE.md mandate) - 1.3 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.4 Source mapping: N/A (genesis-original package)
- 1.5 Draft
specs/testing/spec.mddelta fromopenspec/templates/spec-delta.md - 1.6 Every requirement in the spec delta carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1 Make
TestRequestandTestResponsegeneric overTBody(defaultunknown) insrc/types/http.types.ts - 2.2 Make
RequestBuildergeneric overTBody;body(),stategetter, andbuild()return typed shapes - 2.3 Add
<TBody = unknown>to every request preset (get,post,put,patch,del,head,options) and the privatepresetBuilder - 2.4 Make
ResponseBuildergeneric overTBody;body(),stategetter, andbuild()return typed shapes - 2.5 Add
<TBody = unknown>to every response preset (ok,created,noContent,badRequest,unauthorized,notFound,serverError) and the privatepresetBuilder - 2.6 Add typed
get<T>(name)overload toFixtureManager; cast confined to impl - 2.7 Add
<TError extends Error = Error>toassertThrowsandassertThrowsAsync; cast at boundary - 2.8 Switch
package.jsonscripts.typecheckfrombunx tsc …totsc --project tsconfig.lib.json --noEmit - 2.9 Bump
openspec/specs/testing/spec.mdcoverage requirement from ≥ 95% to 100% across statements/branches/functions/lines; correct path driftpackages/universal/testing/→packages/dev/testing/ - 2.10 Extend
tests/spec-conformance.spec-conformance.test.tsALLOWED_NONDETERMINISMto includemeasureTime(helpers) and observability wrapper, with in-test justification comments
3. Tests
- 3.1
src/builders/request-builder/request-builder.spec-conformance.test.ts—expectTypeOfon every preset and the class - 3.2
src/builders/response-builder/response-builder.spec-conformance.test.ts—expectTypeOfon every preset and the class - 3.3
src/fixtures/fixture-manager/fixture-manager.spec-conformance.test.ts—expectTypeOfonget<T>overload - 3.4
src/helpers/test-helpers.spec-conformance.test.ts—expectTypeOfonassertThrows<TError>/assertThrowsAsync<TError> - 3.5 Every
it(...)carries{ timeout: 5000 }
4. Documentation
- 4.1
request-builder.mdupdated with generic preset signatures + generic example - 4.2
response-builder.mdupdated with generic preset signatures + generic example - 4.3
test-helpers.mdupdated withassertThrows<TError>signature + generic example - 4.4
fixture-manager.mdupdated withget<T>overload signature
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0/0/0 across the whole monorepo - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/testing— green (4/4 tasks) - 5.3
bunx turbo test:coverage --filter=@suaveplan/testing— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/testing— PASS (0 error, 0 warn, 0 info) - 5.5
bunx turbo build --filter=@suaveplan/testing— green
6. Pre-archive 7-row checklist (AGENTS.md Section 13)
- 6.1 Generics threaded;
expectTypeOfassertions on every literal-type claim - 6.2 Zod schemas already wired (existing requirement, untouched)
- 6.3 Every error code in
error-codes.tsthrown by at least one production path (existing requirement, untouched) - 6.4 Strict-mode behaviors tested both on and off (existing requirement, untouched)
- 6.5 OTel instruments emitted (existing requirement, untouched)
- 6.6 Lifecycle dedup tested (existing requirement, untouched)
- 6.7 No retroactive tick — every box above reflects work done in this change
7. Archive
- 7.1 Fold spec delta into
openspec/specs/testing/spec.md - 7.2 Move
openspec/changes/testing-generics-hardening/→openspec/archive/2026-04-27-testing-generics-hardening/