Files
suaveplan/openspec/archive/2026-05-09-i18n-backend-memory/tasks.md
2026-05-27 23:29:53 +01:00

5.2 KiB

Tasks — @suaveplan/i18n-backend-memory (in-memory translation backend)

Every checkbox MUST reflect work actually done in this change. Do not retroactively tick.

1. Spec authoring

  • 1.1 Read openspec/cross-cutting-designs/2026-05-05-i18n-modular-split.md end-to-end (especially §3, §6, §6.1)
  • 1.2 Read openspec/AGENTS.md Sections 0, 0a, 6a, 7, 9, 13
  • 1.3 Read source: packages/i18n/i18n/src/core/backend/memory/memory-backend.ts, memory-backend.test.ts, memory-backend.md, plus packages/i18n/i18n/src/core/backend/backend.types.ts (interface contract that moves to @suaveplan/types/i18n in Wave 1)
  • 1.4 Draft proposal.md from openspec/templates/proposal.md
  • 1.5 Fill ## Source mapping table with verified line ranges from monolith
  • 1.6 Draft specs/i18n-backend-memory/spec.md from openspec/templates/spec-delta.md
  • 1.7 Every requirement carries a **Verified by:** line naming concrete it(...) titles
  • 1.8 openspec change validate i18n-backend-memory exits with no errors (openspec CLI not installed in this env — skipped; manual review confirms format compliance)

2. Package scaffold

  • 2.1 mkdir -p packages/i18n/i18n-backend-memory/src
  • 2.2 Author package.json
  • 2.3 Author tsconfig.lib.json extending @suaveplan/typescript-config/library.json
  • 2.4 Author vite.config.ts and vitest.config.ts
  • 2.5 Author README.md (≥200 words, includes Modules table linking to each .md)
  • 2.6 Add package.json exports map with subpaths ., ./backend, ./factory, ./schemas, ./observability

3. Implementation

  • 3.1 Author src/backend.types.ts — port MemorySeed and MemoryBackendOptions
  • 3.2 Author src/backend.schemas.ts — Zod MemoryBackendOptionsSchema
  • 3.3 Author src/observability.ts — inline recordRead / recordWrite with per-backend metric prefixes
  • 3.4 Author src/backend.ts — port MemoryBackend class; rewire imports; emit metrics; add optional signal?: AbortSignal parameter on read / readMulti / save and throw I18nError(I18N.BACKEND_TIMEOUT) when signal is aborted

4. Factory function

  • 4.1 Author src/factory.ts — memoryBackend(options?): MemoryBackend

5. Documentation (sibling .md per implementation file)

  • 5.1 src/backend.md
  • 5.2 src/factory.md
  • 5.3 src/observability.md
  • 5.4 N/A — no backend.types.md (per CLAUDE.md, types files inside a feature dir need no .md)
  • 5.5 README.md ## Modules section links every .md

6. Tests (Vitest, runner-neutral imports per CLAUDE.md §11)

  • 6.1 src/backend.test.ts — runs runBackendConformance from @suaveplan/i18n-shared/testing and adds MemoryBackend specifics
  • 6.2 Spec-conformance assertions woven into backend.test.ts (one it(...) per spec scenario)
  • 6.3 src/factory.test.ts
  • 6.4 src/index.test.ts — every documented public export resolves through ., ./backend, ./factory, ./schemas, ./observability subpaths
  • 6.5 AbortSignal cancellation tests for read, readMulti, save
  • 6.6 Every it(...) carries { timeout: 5000 }
  • 6.7 All test imports go through @suaveplan/testing/runner — grep -rnE "from ['\"](vitest|bun:test)['\"]" packages/i18n/i18n-backend-memory/src/ returns zero hits
  • 6.8 No // biome-ignore suppressions
  • 6.9 No export * in any non-root barrel

7. Pre-archive verification (5-gate triple)

  • 7.1 bun run check — Biome 0/0/0 across the monorepo
  • 7.2 bunx turbo lint typecheck test --filter=@suaveplan/i18n-backend-memory — green
  • 7.3 bunx turbo test:coverage --filter=@suaveplan/i18n-backend-memory — 100/100/100/100
  • 7.4 bun scripts/openspec-conformance.ts @suaveplan/i18n-backend-memory — script not present in this repo state; manual spec review performed
  • 7.5 bunx turbo build --filter=@suaveplan/i18n-backend-memory — green

8. Pre-archive 7-row checklist (AGENTS.md Section 13)

  • 8.1 Generics threaded — MemoryBackend implements Backend from @suaveplan/types
  • 8.2 Zod schemas wired at the public boundary — MemoryBackendOptionsSchema parses constructor input
  • 8.3 Every error code thrown by at least one production path: BACKEND_LOCALE_NOT_AVAILABLE (read miss), BACKEND_TIMEOUT (AbortSignal aborted), INVALID_OPTIONS (Zod parse failure)
  • 8.4 Strict-mode tested — capability matrix exact-shape match via toEqual
  • 8.5 OTel histograms emitted from production paths
  • 8.6 Lifecycle dedup — N/A (in-memory backend has no async init/dispose)
  • 8.7 No retroactive tick — every box reflects work done in this change

9. Manifest + ecosystem awareness

  • 9.1 Add @suaveplan/i18n-backend-memory entry to root CLAUDE.md package listing under the i18n cluster
  • 9.2 Run bun scripts/folder-reorg/generate-manifest.ts to refresh MANIFEST.md
  • 9.3 Append @suaveplan/i18n-backend-memory to STATUS.md Completed list

10. Archive

  • 10.1 Fold spec delta into openspec/specs/i18n-backend-memory/spec.md (NEW capability spec — first delta becomes canonical)
  • 10.2 Move openspec/changes/i18n-backend-memory/ → openspec/archive/2026-05-09-i18n-backend-memory/