chore(memory+docs): /ship-feature B3 capitalize — BDR-014/015 + LRN-017..019 + EVAL-002 + journal + TODO

Memory registry capitalization after B3 i18n FR/EN ship.

- decisions.md  +BDR-014 (PDF locale = render preference, store-driven, not Report schema field — dual label snapshot already carried).
- decisions.md  +BDR-015 (typed ImportError discriminant kind + foundVersion; UI resolves message via dict; review caught hardcoded FR in domain layer).
- learnings.md  +LRN-017 (i18n dict parity test: Object.keys().sort() equality + non-empty value assertion — cheapest drift guard).
- learnings.md  +LRN-018 (useT hook pattern: selector subscribe + dict closure-per-render, no prop drilling, missing-key dev-warn + key-literal fallback).
- learnings.md  +LRN-019 (exhaustive-deps trap when closures over store values appear inside useMemo deps — inline or useCallback).
- evals.md      +EVAL-002 (B3 review caught critical FR leak in pdf/import.ts + attachment.ts that grep+analyzer both missed — i18n migrations must enumerate ALL string-emitting files including error paths).
- journal.md    session 3 entry under 2026-05-20.
- TODO.md       B3 subsection rewritten as DONE with checked checkboxes + cross-refs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.7 committed 2026-05-20 07:43:11 +02:00
1 parent 9916c42484
commit 31bd82de58
7 files changed
+111 -21

No files matched your search

+26 -7
View File
@@ -126,8 +126,14 @@ osteo/
│ │ ├─ types.ts ← SpeciesManifest interface
│ │ ├─ registry.ts ← getSpecies(), getAllSpecies()
│ │ └─ equine/{index,vertebrae,pathologies}.{ts,json}
│ ├─ i18n/
│ │ ├─ types.ts ← Locale type + Dict type
│ │ ├─ fr.ts + en.ts ← translation dicts (flat key → string)
│ │ ├─ index.ts ← getDict(locale)
│ │ └─ useT.ts ← useT() hook (reads localeStore)
│ ├─ state/
│ │ ├─ reportStore.ts ← Zustand store
│ │ ├─ localeStore.ts ← locale Zustand store (persisted to localStorage)
│ │ └─ practitionerCache.ts ← localStorage prefill
│ ├─ anatomy/
│ │ ├─ types.ts ← Bone, BoneCategory, BoneState
@@ -141,7 +147,7 @@ osteo/
│ │ │ FreeTextFindingInput}.tsx
│ │ ├─ report/{ReportHeader,PractitionerForm,AnimalForm,
│ │ │ ConclusionPanel,NextAppointmentPicker}.tsx
│ │ └─ brand/Brand.tsx
│ │ └─ brand/{Brand,LanguageSwitcher}.tsx
│ ├─ pdf/
│ │ ├─ export.ts + import.ts + attachment.ts + fonts.ts
│ │ └─ render/{header,footer,observationPage,conclusionPage,svgToPng}.ts
@@ -158,8 +164,12 @@ osteo/
│ ├─ ANATOMY-SVG-CONVENTION.md ← SVG data-* contract
│ ├─ ADDING-A-SPECIES.md
│ ├─ PDF-FORMAT.md
│ └─ superpowers/specs/
│ └─ 2026-05-18-osteo-report-mvp-design.md
│ ├─ superpowers/specs/
│ │ ├─ 2026-05-18-osteo-report-mvp-design.md
│ │ └─ 2026-05-20-b3-i18n-fr-en-design.md
│ └─ superpowers/plans/
│ ├─ 2026-05-18-osteo-report-mvp.md
│ └─ 2026-05-20-b3-i18n-fr-en.md
├─ .claude/{tasks/TODO.md,memory/,audits/}
├─ Dockerfile, docker-compose.yml
├─ .env.example, .editorconfig, .nvmrc, .prettierrc.json
@@ -188,7 +198,7 @@ SVG interaction
→ else → updateObservation() in store
PDF export
→ exportReportToPdf(report)
→ exportReportToPdf(report, { locale })
→ pdf-lib PDFDocument
→ embedFonts (Inter body + Fraunces heading)
→ for each observation: addObservationPage (rasterize SVG → PNG)
@@ -213,9 +223,18 @@ Runtime config
## Project conventions
### Language split
- UI strings: French (labels, placeholders, error messages, toasts)
- UI strings: bilingual FR/EN — all user-facing text goes through the i18n system (see below)
- Code: English (variable names, function names, comments, docs)
- Never mix: no French variable names, no English labels in JSX
- Never mix: no French variable names, no raw French/English string literals in JSX — use `useT()`
### i18n
- All user-facing strings live in `src/i18n/fr.ts` and `src/i18n/en.ts` (flat `Record<string, string>`)
- Key convention: `<area>.<key>` — e.g. `common.cancel`, `home.new_report.title`, `pdf.subject`
- Both dicts must share the exact same key set; a key missing in one dict logs a warning in DEV
- Get the translate function in any component: `const t = useT()` then `t('common.cancel')`
- `src/state/localeStore.ts` holds current `Locale` (`'fr' | 'en'`), persisted to `localStorage` key `osteo:locale`; default `'fr'`
- Finding leaf labels (zone names shown in PDF) are resolved at export time via SVG `data-anno-name-fr` / `data-anno-name-en` attributes — not from the dict
- PDF static labels (section headings, metadata) come from the dict via `getDict(locale)` in `exportReportToPdf`
### Identity strings
- NEVER hardcode APP_SITE_NAME, APP_BRAND_NAME, APP_FOOTER_NAME, APP_TAGLINE
@@ -305,7 +324,7 @@ Runtime config
## Commit message convention
Conventional Commits format. Subject ≤72 chars, imperative mood, no trailing period.
Allowed scopes: `schema`, `store`, `anatomy`, `pdf`, `editor`, `home`, `new`, `ui`, `config`, `species`, `docker`, `docs`, `tests`, `chore`.
Allowed scopes: `schema`, `store`, `anatomy`, `pdf`, `editor`, `home`, `new`, `ui`, `config`, `species`, `i18n`, `docker`, `docs`, `tests`, `chore`.
Examples:
- `test(schema): cover Report version literal`