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

+18
View File
@@ -107,3 +107,21 @@ SVG data-anno-id values stay opaque generator strings (point-mpb..., zone-...).
Alt rejected: rename SVG data-anno-id to JSON keys — couples opaque SVG generator output to human-meaningful catalog, brittle across SVG re-exports.
Alt rejected: add new `data-anno-finding-zone` attribute on every hitbox — forces SVG edit per species, double-source for the same info already in name_fr/en.
Status: closed.
---
## BDR-014 | 2026-05-20 | PDF locale = render preference, not Report schema field
exportReportToPdf takes explicit `{ locale }` option read from localeStore at call site. Locale lives outside Report — never persisted in schema. Rationale: Finding snapshots already carry labelFrSnapshot+labelEnSnapshot (per BDR-010), so render-time locale picks the correct snapshot; no schema bump needed; re-imported PDF can be re-exported in either locale without data migration; embedded JSON byte-identical between locale variants of the same Report.
Alt rejected: store `locale` field on Report schema — would force v3 bump, complicate re-export ergonomics, duplicate state already in store.
Alt rejected: default locale to 'fr' in export — caller is route layer, has store, easy to pass; explicit arg makes tests + API surface clean.
Status: closed.
---
## BDR-015 | 2026-05-20 | Typed ImportError discriminant (kind + foundVersion) over localized messages
ImportError carries `kind: 'invalid_pdf' | 'incompatible_version' | 'no_attachment'` + optional `foundVersion`. Message field collapses to internal sentinel. UI layer (HomeRoute) resolves user-facing string via i18n dict using err.kind, with `{version}` template substitution. Rationale: review caught hardcoded FR in pdf/import.ts + pdf/attachment.ts leaking to EN UI; original "throw with localized message" coupled domain layer to one locale; typed discriminant moves message authoring to the UI layer where i18n lives.
Alt rejected: keep FR messages, translate via err.message string match — brittle (any rewording breaks the lookup), spreads i18n knowledge into the catch site.
Alt rejected: pass `t()` into domain layer — wrong direction; domain should not know about React hooks or current locale.
Status: closed.