5.2 KiB
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.mdend-to-end (especially §3, §6, §6.1) - 1.2 Read
openspec/AGENTS.mdSections 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, pluspackages/i18n/i18n/src/core/backend/backend.types.ts(interface contract that moves to@suaveplan/types/i18nin Wave 1) - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill
## Source mappingtable with verified line ranges from monolith - 1.6 Draft
specs/i18n-backend-memory/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement carries a
**Verified by:**line naming concreteit(...)titles - 1.8
openspec change validate i18n-backend-memoryexits 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.jsonextending@suaveplan/typescript-config/library.json - 2.4 Author
vite.config.tsandvitest.config.ts - 2.5 Author
README.md(≥200 words, includes Modules table linking to each.md) - 2.6 Add
package.jsonexportsmap with subpaths.,./backend,./factory,./schemas,./observability
3. Implementation
- 3.1 Author
src/backend.types.ts— portMemorySeedandMemoryBackendOptions - 3.2 Author
src/backend.schemas.ts— ZodMemoryBackendOptionsSchema - 3.3 Author
src/observability.ts— inlinerecordRead/recordWritewith per-backend metric prefixes - 3.4 Author
src/backend.ts— portMemoryBackendclass; rewire imports; emit metrics; add optionalsignal?: AbortSignalparameter onread/readMulti/saveand throwI18nError(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## Modulessection links every.md
6. Tests (Vitest, runner-neutral imports per CLAUDE.md §11)
- 6.1
src/backend.test.ts— runsrunBackendConformancefrom@suaveplan/i18n-shared/testingand addsMemoryBackendspecifics - 6.2 Spec-conformance assertions woven into
backend.test.ts(oneit(...)per spec scenario) - 6.3
src/factory.test.ts - 6.4
src/index.test.ts— every documented public export resolves through.,./backend,./factory,./schemas,./observabilitysubpaths - 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-ignoresuppressions - 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 —
MemoryBackendimplementsBackendfrom@suaveplan/types - 8.2 Zod schemas wired at the public boundary —
MemoryBackendOptionsSchemaparses 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-memoryentry to rootCLAUDE.mdpackage listing under the i18n cluster - 9.2 Run
bun scripts/folder-reorg/generate-manifest.tsto refreshMANIFEST.md - 9.3 Append
@suaveplan/i18n-backend-memorytoSTATUS.mdCompleted 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/