Skip to content

docs: test taxonomy + final ARCHITECTURE/AGENTS/README refresh — v1 prep 3/3#3

Merged
Changsik00 merged 2 commits into
mainfrom
docs/test-taxonomy-and-final
May 17, 2026
Merged

docs: test taxonomy + final ARCHITECTURE/AGENTS/README refresh — v1 prep 3/3#3
Changsik00 merged 2 commits into
mainfrom
docs/test-taxonomy-and-final

Conversation

@Changsik00
Copy link
Copy Markdown
Owner

Summary

Final of three stacked PRs. Documentation + test-script categorisation — no source-code changes beyond the new pnpm test:* scripts.

Test categories made explicit

Tests already split along the standard unit / contract / integration / e2e taxonomy in practice (cli-e2e.test.ts was e2e; vite/next/esbuild plugin tests were integration; types.test.ts was a TS contract; everything else was unit) but nothing labelled the split. Adds four scripts that reuse the existing vitest.config.ts and filter by path:

Script Runs Speed
pnpm test:unit 213 unit tests ~1s
pnpm test:integ 27 integration tests (real vite/next/esbuild) ~2s
pnpm test:e2e 37 CLI e2e tests ~5s
pnpm test:contract 17 type-level assertions (expectTypeOf) <1s
pnpm test All four in one pass ~6s
pnpm test:coverage Full run + istanbul coverage thresholds ~7s

CI keeps using pnpm test:coverage so coverage floors are enforced on every PR.

Documentation

  • New docs/TESTING.md — dedicated test-strategy reference. Covers the taxonomy, the 9-layer verify chain, coverage philosophy, mutation testing, decision tree for new tests, "when tests don't catch a bug" triage flow.
  • docs/ARCHITECTURE.md refresh — Testing section now defers to docs/TESTING.md; in its place, two new pattern entries: dispatch registry (🧊 Object.freeze() only freezes the top level — nested config is still mutable #8, cli/generate.ts) and shared workspace runner (😵 Confusing runtime error when envKey field uses .transform() #9, cli/workspace-runner.ts). Error-throwing section reworked around ERROR_CATALOG. New "Single-source-of-truth as a recurring discipline" section catalogues the four places the package applies the pattern.
  • AGENTS.md sync — import map adds ERROR_CATALOG, reportError, ErrorSeverity, ErrorReport. Error-handling section leads with severity buckets and reportError(err) instead of duplicating the ERRORS.md table. File map regenerated with report-error.ts, presets.ts, todo.ts, cli/workspace-runner.ts, every generator, all build-tool adapters. Verification layers table updated 7 → 9.
  • README.md refresh — the part users see first:
    • New "Design principles" section foregrounds the four cross-cutting patterns (single source of truth, fail-at-the-earliest-moment, stable contract / evolving messages, frozen + layered).
    • New "Error handling" section: severity-bucket table, reportError() example, sample ErrorReport payload.
    • "Why use this" bullets sharpened; the schema-first claim now lists all seven downstream artifacts.
    • Comparison table gains rows for the severity-aware error catalog and the CI-enforced contract checks.
    • Documentation section reorganised into users / contributors / meta; ARCHITECTURE.md and TESTING.md surfaced prominently.
    • Test count badge 292 → 294, coverage 87% → 89%.

Commits

# Commit Phase
1 test: explicit unit / integ / e2e / contract categorisation 10
2 docs: final pass — TESTING.md + ARCHITECTURE refresh + AGENTS sync + README appeal 11

Stacked PR

This is 3/3, stacked on feat/error-catalog-v1 (PR #2), which is stacked on refactor/internal-patterns (PR #1).

Merge order: #1#2#3. After #1 and #2 merge, GitHub will auto-update this PR's base to main.

Test plan

  • pnpm test:unit / :integ / :e2e / :contract — each runs the expected subset.
  • pnpm test — 294 passing.
  • pnpm verify — full 9-layer chain.
  • Read docs/TESTING.md end-to-end — does the decision tree match your intuition for "where does this test go?"
  • Read README.md "Design principles" — does it accurately sell what we've built?

Tests were already split along the standard taxonomy in practice
(cli-e2e.test.ts is e2e; vite/next/esbuild plugin tests are
integration; types.test.ts is a TS contract check; everything else
is unit) but nothing labelled the split, so 'I only changed the
vite plugin, do I need to wait for cli-e2e?' had no clear answer.

Adds the four scripts (all reuse the existing vitest.config.ts;
they just filter by --include / --exclude):

  pnpm test:unit       213 unit tests   (~1s)
  pnpm test:integ       27 integ tests  (~2s)
  pnpm test:e2e         37 e2e tests    (~5s)
  pnpm test:contract    17 type tests   (<1s)

pnpm test (all categories) and pnpm test:coverage (with thresholds)
behave exactly as before — CI keeps using test:coverage so coverage
floors are still enforced on every PR.

Documents the taxonomy in docs/ARCHITECTURE.md ('Testing strategy'
section reworked: category table + decision tree + conventions)
and surfaces the new scripts from CONTRIBUTING.md's 'Dev loop'.

vitest.config.ts coverage exclude list trimmed: src/utils/index.ts
and src/loaders/vite-env.ts no longer exist (removed in 28284d3),
so referencing them was stale.
…README appeal

Brings the documentation set in sync with the refactored codebase and
foregrounds the patterns that distinguish this library.

New docs/TESTING.md (dedicated test-strategy reference):
- unit / contract / integration / e2e taxonomy with file counts
  and per-category pnpm scripts
- the nine-layer verify chain laid out as a single table
- decision tree for placing new tests
- coverage philosophy (why the floor sits just below current %)
- mutation testing setup and exclusions
- 'When tests don't catch a bug' triage flow

docs/ARCHITECTURE.md refresh:
- Error-throwing section reworked around ERROR_CATALOG: explains
  what flows from a single catalog entry (type union, severity
  getter, docsUrl, reportError output, doc table, verify pass).
- New 'Single-source-of-truth as a recurring discipline' section
  catalogues the four places the package applies the pattern.
- Two new code patterns documented: dispatch registry (#8) for
  cli/generate.ts and shared workspace runner (#9) for the three
  --workspace-capable subcommands.
- Testing strategy section trimmed to a summary that defers to
  docs/TESTING.md.

AGENTS.md sync:
- Import map adds ERROR_CATALOG, reportError, ErrorSeverity,
  ErrorReport, esbuild plugin.
- Error-handling section leads with severity buckets and the
  reportError() recipe instead of duplicating the catalog table.
- File map regenerated: adds report-error.ts, presets.ts, todo.ts,
  cli/workspace-runner.ts, every generator, both build-tool adapters.
- Verification layers table updated from seven entries to nine
  (verify:docs and verify:errors are now first-class).

README.md refresh — the part users see first:
- New 'Design principles' section foregrounds the four cross-cutting
  patterns (single source of truth, fail-at-the-earliest-moment,
  stable contract / evolving messages, frozen + layered).
- New 'Error handling' section: severity-bucket table, reportError()
  example, sample ErrorReport payload. Replaces the previous bullet
  in 'Why use this'.
- 'Why use this' bullets sharpened; the schema-first claim now lists
  all seven downstream artifacts.
- Comparison table gains rows for the severity-aware error catalog
  and the CI-enforced contract checks.
- Documentation section reorganised into users / contributors / meta
  groups; surfaces ARCHITECTURE.md and TESTING.md prominently.
- Test count 292 -> 294, coverage 87% -> 89% in badges.
Base automatically changed from feat/error-catalog-v1 to main May 17, 2026 01:41
@Changsik00 Changsik00 merged commit a61fe61 into main May 17, 2026
@Changsik00 Changsik00 deleted the docs/test-taxonomy-and-final branch May 17, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant