Files
2026-05-27 23:29:53 +01:00

84 lines
5.2 KiB
Markdown

# 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
- [x] 1.1 Read `openspec/cross-cutting-designs/2026-05-05-i18n-modular-split.md` end-to-end (especially §3, §6, §6.1)
- [x] 1.2 Read `openspec/AGENTS.md` Sections 0, 0a, 6a, 7, 9, 13
- [x] 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)
- [x] 1.4 Draft `proposal.md` from `openspec/templates/proposal.md`
- [x] 1.5 Fill `## Source mapping` table with verified line ranges from monolith
- [x] 1.6 Draft `specs/i18n-backend-memory/spec.md` from `openspec/templates/spec-delta.md`
- [x] 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
- [x] 2.1 `mkdir -p packages/i18n/i18n-backend-memory/src`
- [x] 2.2 Author `package.json`
- [x] 2.3 Author `tsconfig.lib.json` extending `@suaveplan/typescript-config/library.json`
- [x] 2.4 Author `vite.config.ts` and `vitest.config.ts`
- [x] 2.5 Author `README.md` (≥200 words, includes Modules table linking to each `.md`)
- [x] 2.6 Add `package.json` `exports` map with subpaths `.`, `./backend`, `./factory`, `./schemas`, `./observability`
## 3. Implementation
- [x] 3.1 Author `src/backend.types.ts` — port `MemorySeed` and `MemoryBackendOptions`
- [x] 3.2 Author `src/backend.schemas.ts` — Zod `MemoryBackendOptionsSchema`
- [x] 3.3 Author `src/observability.ts` — inline `recordRead` / `recordWrite` with per-backend metric prefixes
- [x] 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
- [x] 4.1 Author `src/factory.ts` — `memoryBackend(options?): MemoryBackend`
## 5. Documentation (sibling `.md` per implementation file)
- [x] 5.1 `src/backend.md`
- [x] 5.2 `src/factory.md`
- [x] 5.3 `src/observability.md`
- [x] 5.4 N/A — no `backend.types.md` (per CLAUDE.md, types files inside a feature dir need no `.md`)
- [x] 5.5 `README.md` `## Modules` section links every `.md`
## 6. Tests (Vitest, runner-neutral imports per CLAUDE.md §11)
- [x] 6.1 `src/backend.test.ts` — runs `runBackendConformance` from `@suaveplan/i18n-shared/testing` and adds `MemoryBackend` specifics
- [x] 6.2 Spec-conformance assertions woven into `backend.test.ts` (one `it(...)` per spec scenario)
- [x] 6.3 `src/factory.test.ts`
- [x] 6.4 `src/index.test.ts` — every documented public export resolves through `.`, `./backend`, `./factory`, `./schemas`, `./observability` subpaths
- [x] 6.5 AbortSignal cancellation tests for `read`, `readMulti`, `save`
- [x] 6.6 Every `it(...)` carries `{ timeout: 5000 }`
- [x] 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
- [x] 6.8 No `// biome-ignore` suppressions
- [x] 6.9 No `export *` in any non-root barrel
## 7. Pre-archive verification (5-gate triple)
- [x] 7.1 `bun run check` — Biome 0/0/0 across the monorepo
- [x] 7.2 `bunx turbo lint typecheck test --filter=@suaveplan/i18n-backend-memory` — green
- [x] 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
- [x] 7.5 `bunx turbo build --filter=@suaveplan/i18n-backend-memory` — green
## 8. Pre-archive 7-row checklist (AGENTS.md Section 13)
- [x] 8.1 Generics threaded — `MemoryBackend` implements `Backend` from `@suaveplan/types`
- [x] 8.2 Zod schemas wired at the public boundary — `MemoryBackendOptionsSchema` parses constructor input
- [x] 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)
- [x] 8.4 Strict-mode tested — capability matrix exact-shape match via `toEqual`
- [x] 8.5 OTel histograms emitted from production paths
- [x] 8.6 Lifecycle dedup — N/A (in-memory backend has no async init/dispose)
- [x] 8.7 No retroactive tick — every box reflects work done in this change
## 9. Manifest + ecosystem awareness
- [x] 9.1 Add `@suaveplan/i18n-backend-memory` entry to root `CLAUDE.md` package listing under the i18n cluster
- [x] 9.2 Run `bun scripts/folder-reorg/generate-manifest.ts` to refresh `MANIFEST.md`
- [x] 9.3 Append `@suaveplan/i18n-backend-memory` to `STATUS.md` Completed list
## 10. Archive
- [x] 10.1 Fold spec delta into `openspec/specs/i18n-backend-memory/spec.md` (NEW capability spec — first delta becomes canonical)
- [x] 10.2 Move `openspec/changes/i18n-backend-memory/` → `openspec/archive/2026-05-09-i18n-backend-memory/`