# Journal --- ## 2026-05-18 Scaffolded Osteo Report MVP skeleton from approved design spec. Created 80+ files: schemas, stubs, routes, stores, PDF modules, Docker infra. Moved Horse.svg + Horse_head.svg to public/species/equine/. pnpm install + build + typecheck + tests passing. pnpm 11 used (corepack shim broken on host Node 20.20.0). - MVP scaffold+impl done. Editor flow works. PDF roundtrip green. Real SVG assets in repo. --- ## 2026-05-19 Fixed 3 zone-interaction bugs (b9da4fa). Detail-popup clicks now resolved via detailBones map. Spine zones (data-anno-special="vertebral-precision") auto-open VertebraPicker on click. ObservationCard hides "Vertèbres…" button on non-special zones. Parser reads data-anno-special; convention doc updated. - BLK-003 resolved. LRN-004, LRN-005 captured. 91 tests green, lint clean, build OK. - VertebraPicker preselects region tab inferred from zone label (b3bd75d). +5 tests. - Hotfix: detailBones now accumulate across popup opens; merged allBones passed to ObservationList so detail-popup zone labels survive after modal close. - PDF rendering bugfix: titles cleared the header rule, zone-line wrap respects following blocks, non-selected zones hidden + data-anno-* stripped before raster, main SVG skipped when every zone lives in details. BLK-004, LRN-006, LRN-007 captured. - PDF styling pass: eyebrow + Times 22 title + 2pt accent rule + uppercase accent section labels + color-coded severity pill (sage/amber/red). Eyebrow/title baseline gap raised to 27pt after first attempt still overlapped. BDR-008, LRN-008 captured. - Commits this session: b9da4fa..d7ea99e (10 commits — bugfix + feat + hotfix + PDF styling). --- ## 2026-05-19 (session 2) feat(editor): home-nav (back btn + clickable Brand link to "/") + "Modifier les infos" dialog reusing PractitionerForm/AnimalForm via draft-copy with save/cancel. 3 store setters (setPractitioner/setAnimal/setOwner), 4 setter tests. Cache re-synced on save. 100/100 tests, lint 0, typecheck clean. - hotfix(pdf): multi-SVG observation page packed into 2-col grid; pre-rasterize → measure aspect → reserve text-area height → cell budget per row; single-SVG keeps full width; floor prevents zero-cells. Text sections now always visible. LRN-009 captured. - hotfix(editor): zone-highlight scoped to active obs only (collapsed obs no longer leave faint 'linked'/'multi' tints). AnatomyCanvas re-paints highlights after async SVG mount so DetailModal popup zones color correctly. NewReportRoute header harmonized with editor — back btn + clickable Brand left-aligned. 3 files (hotfix cap +1, accepted). LRN-010 captured. - domain pivot decided: flat Pathology[] → hierarchical findings tree per zone, path+snapshot serialization, FR/EN bilingual site+PDF. ReportSchema bumps v1→v2 (no retro-compat, no prod PDFs). Sample 3-zone JSON v1.1 dropped at src/domain/species/equine/pathologies.json — inert (loader not migrated). TODO rewritten as B0..B5 + C ship gate, ~23h dev. - NEXT SESSION: run /ship-feature on B0 (findings Zod schema + JSON loader) + B1 (ReportSchema v2 + observation.findings) + B2 (FindingsTreePicker replacing flat PathologyPicker). I18N (B3) deferred to separate feature. Reconcile JSON species.id (currently "equin") vs registry species.id ("equine") before parse — pick one. --- ## 2026-05-20 Bundled B0+B1+B2 shipped on feat/findings-tree-v2. 3 atomic commits. - B0 (f80e161): findings.ts Zod schema (recursive z.lazy + explicit ZodType), SpeciesFindingsSchema.parse(JSON) at boot, manifest swaps pathologies→findings, JSON species.id "equin"→"equine", new species.equineFindings test (5). - B1 (d08d773): ObservationSchema.findings + freeTextFindings, ReportSchema.version 1→2, store emptyObservation+initReport updated, PDF import detects v1 via IncompatibleReportVersionError + ImportError wraps message (FR), pathology.ts schema + test deleted. - B2 (b67f4cd): FindingsTreePicker (breadcrumb, drill, leaf toggle, retour, vet-referral ⚠, description_fr), ObservationCard renders one picker per zone with catalog, FreeTextPathologyInput renamed FreeTextFindingInput, scope_disclaimer modal once/session via osteo:disclaimer-shown sessionStorage flag, PDF observationPage renders findings via labelFrSnapshot with ⚠ prefix on vet-referral. B5 folded in: Toast + ZoneTooltip stubs deleted, CLAUDE.md folder map refreshed. - 107/107 tests green, lint 0 warn, typecheck clean, vite build OK (882KB main + 15KB lazy pathologies chunk). - BDR-009 (snake_case JSON fields preserved in TS), LRN-011 (Zod recursive via z.lazy + explicit ZodType), LRN-012 (sessionStorage flag pattern for once-per-session UX modals) to capitalize. - NEXT: push branch + PR. After merge: B3 (i18n FR/EN) + B4 (PDF observationPage polish for vet-referral) + C (full horse.json + QA + deploy). --- ## 2026-05-20 (session 3 — B3 shipped) B3 (i18n FR/EN site + PDF) shipped on `feat/findings-tree-v2` via /ship-feature. 5 new commits: - 0a05c47 docs(plan): B3 i18n FR/EN implementation plan - a570475 feat(i18n): localeStore + persist - 359104c feat(i18n): fr/en dicts + useT hook (~90 keys each, parity-tested) - d602726 feat(i18n): migrate site + PDF to locale-aware (25 files, +390/-207) - fa3eb51 test(pdf): roundtrip per locale (3 cases) - (post-review fix) typed ImportError discriminant for localized PDF import errors - 154/154 tests pass, lint clean, typecheck clean, build OK. - description_fr + scope_disclaimer stay FR-only this iteration (vet-expert authoring needed). - BDR-014 (PDF locale = render preference), BDR-015 (typed ImportError discriminant), LRN-017 (dict parity test), LRN-018 (useT selector+closure), LRN-019 (exhaustive-deps closure trap), EVAL-002 (review caught FR leak in PDF import) captured. - NEXT: B4 (PDF observationPage vet-referral polish), C (full horse.json + QA + Scaleway deploy). description_fr/_en EN copy when vet expert provides. --- ## 2026-05-21 User dropped catalog v1.2→v2.0 in place. pathologies.json now schema_version "2.0", 26 zones (was 3), 792 nodes, 612 leaves, 41 vet-referral leaves. Generic vet description_fr purged on 25 leaves; 16 kept with clinical differential. - Zero code change needed: `findings.ts` Zod schema already optional description_fr + boolean requires_vet_referral since B0. FindingsTreePicker + PDF already read boolean (no textual fallback). 154/154 tests stay green, typecheck clean. - One case mismatch noted then fixed by user: SVG Horse_head.svg `data-anno-name-fr="hyoïde"`→`"Hyoïde"`. JSON ↔ SVG strict equality now holds for all 26 zones (diff empty). Fuzzy matcher (lib/zoneMatch.ts) no longer needed for this pair but kept as safety net. - BDR-016 (v2.0 catalog adoption), LRN-020 (forward-compat schema absorbed change), BLK-002 resolved capitalized. - TODO Phase C item 1 "Author full horse.json" → done. B4 still has scope_disclaimer footer decision open. - NEXT: B4 disclaimer footer call + C QA + Scaleway deploy. - hotfix(pdf): PDF export crashed `WinAnsi cannot encode "⚠"` on any obs carrying a requires_vet_referral leaf — StandardFonts.Helvetica is WinAnsi-only. Swapped `⚠ ` PDF marker → `(!) ` (UI keeps ⚠). Regression test added on `widthOfTextAtSize` + prefixed label. LRN-021, EVAL-003 captured. 155/155 green. Follow-up: migrate PDF body to embedded TTF (Inter/Fraunces per CLAUDE.md spec) so future non-Latin-1 glyphs work. --- ## 2026-05-20 (session 2) Iterated on the findings-tree branch — 11 more commits on top of B0+B1+B2. - 1731adf fix(editor): match findings tree to SVG zones via FR label (strict equality, dropped raw-boneId lookup). - 95d746b feat(editor): fuzzy zone matcher (src/lib/zoneMatch.ts) — normalize + Levenshtein, EN-first + FR fallback. 23 new tests. - 34acb0c feat(editor): count badges on intermediate FindingsTreePicker nodes (pathStartsWith + countSelectedUnder). - 93294a4 fix(pdf): buildZoneLabels per-source try/catch + parallel + warn + exported for tests. Fixes raw-boneId fallback when detail SVG fetch fails. - 1e12f22 fix(editor): EditorRoute eagerly preloads every species.details SVG so re-imported PDFs render their pickers immediately. - de40c5f feat(editor+pdf): per-zone PDF sections "CONSTATS — " + dedicated "CONSTATS LIBRES"; ObservationCard accordion (one zone picker open at a time). - add408e feat(pdf): single-SVG observations halved + centered; first halo glow on main-view selections. - 4f8ea9e fix(pdf): bumped halo with stacked feGaussianBlur (stdDeviation 18 + 8) to survive the SVG→canvas→PNG→pdf-lib alpha attenuation. - 700567f feat(pdf): inter-item separator rendered as accent-coloured bold "•" @14pt with per-segment layout instead of plain join (height-estimator updated). - 70b7f20 feat(species): auto-discover species via import.meta.glob default-export contract + `pnpm scaffold:species` Node script + docs refresh. - 70f21cc docs: PATHOLOGIES-FORMAT.md — canonical findings-JSON spec mirroring src/domain/schema/findings.ts. - BDR-012 (auto-discovery import.meta.glob), BDR-013 (fuzzy FR/EN label bridge), LRN-013 (glob+default plugin pattern), LRN-014 (normalize+Levenshtein cross-walk), LRN-015 (per-source try/catch), LRN-016 (pdf-lib subset-font bytes-grep caveat) captured. - Tests 139/139 green, lint 0, typecheck clean, vite build OK throughout. Branch feat/findings-tree-v2 = 15 commits ahead of main, no remote configured (push + PR still pending). - NEXT: push branch + PR; then B3 (i18n FR/EN), B4 (PDF observationPage vet-referral polish), C (full horse.json + QA + Scaleway deploy).