diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 3e142d69..a150d3b6 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -161,3 +161,13 @@ Fuzzy matching logic (normalizeLabel, levenshtein, scorePair, matchZone) duplica **Why:** standalone HTML cannot import TS modules. Keeping identical algorithm ensures matching consistency between main app and editor. Alt rejected: extract to shared .js file — adds dependency management for a tool that should be zero-dep. Status: closed. + +--- + +## BDR-018 | 2026-05-27 | Vertebra picker confirm — target region replaces, other regions union + +VertebraPicker anchored on clicked spine zone but lets user switch region tabs. On confirm, `distributeVertebraeToZones` spreads picks across one spine zone per region. Target region (clicked zone) = REPLACE (picker seeded with its full set → unchecking deselects). Other regions = UNION with any pre-existing zone (picker didn't display them → side-tab pick must be purely additive, never wipe). Region with no SVG spine zone → fold verts back onto target (nothing lost). +**Why:** picking verts in a non-target tab must behave as if that zone was also clicked — highlight + findings picker both flow from observation.zones. Replace-everywhere would silently wipe a cervical zone selected earlier when reopening lumbar picker. +Alt rejected: seed picker with full-spine union of all zones → forces handling deselection-to-zero per region (remove zone + orphan its findings); bigger scope, destructive. Additive-only matches user request. +Alt rejected: keep dumping all verts on clicked zone (old bug) — other zones never highlight, no findings picker. +Status: closed. diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 8404ae6f..4246490c 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -131,3 +131,13 @@ Iterated on the findings-tree branch — 11 more commits on top of B0+B1+B2. - 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). + +--- + +## 2026-05-27 + +feat(editor) 9544924 — cross-region vertebra picks spawn their spine zone. +- New src/lib/spineZones.ts: regionFromLabel (moved from VertebraPicker, re-exported for back-compat), findSpineZoneId (region→zone via vertebral-precision + label heuristic), distributeVertebraeToZones (pure, target=replace / others=union / unmapped→target). +- EditorRoute onConfirm now distributes instead of dumping all verts on clicked zone. +7 tests (lib.spineZones). +- BDR-018 (replace-target/union-others), LRN-028 (drive derived UI via source-of-truth row) captured. +- 171/171 green, lint 0, typecheck clean. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index f55de78c..d84259e8 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -216,3 +216,11 @@ When standalone .html tools (no build step) need logic from TS modules (zoneMatc `height: 100%` (Tailwind `h-full`) resolves to `auto` when parent has `flex-1` but no explicit `height`. Caused 3 failed centering attempts on route containers inside App.tsx flex layout. Fix: use `flex-1` (flex-grow) on child instead — works because parent IS a flex container, no explicit height needed. **Why:** nested flex layout: App wrapper (min-h-screen flex-col) → main (flex-1) → route (h-full broke here) → section (flex-1 grid place-items-center). The section's `place-items-center` needs actual height to center within. **How to apply:** any flex-nested layout where child needs to fill parent — use `flex-1`, not `h-full`, unless parent has explicit `height` or is viewport-sized (`h-screen`). + +--- + +## LRN-028 | 2026-05-27 | Drive derived UI by spawning the source-of-truth row, not patching each consumer + +SVG highlight (boneStates) AND findings picker both derive from observation.zones. So making a cross-region vertebra pick "highlight + add zone + add findings" = ONE lever: spawn the spine zone in observation.zones. No separate highlight call, no separate findings wiring — both consumers already react to zones. Keep distribution logic pure (`distributeVertebraeToZones(zones, targetIndex, verts, bones)` → new zones[]) so it unit-tests without React; component handler stays a one-liner. +Inverse-map region→zone via reusing the same label heuristic (`regionFromLabel`) that maps zone→region — store the function once, scan bones for `special==='vertebral-precision'` whose label matches. +Apply: any feature where "select X in modal → reflect in N places". Find the single derived-from state; mutate that; let existing selectors fan out. Avoids drift between the highlight path and the data path. diff --git a/CLAUDE.md b/CLAUDE.md index ed84cf81..313b0063 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -152,7 +152,7 @@ osteo/ │ ├─ pdf/ │ │ ├─ export.ts + import.ts + attachment.ts + fonts.ts │ │ └─ render/{header,footer,observationPage,conclusionPage,svgToPng}.ts -│ ├─ lib/{dates,id,assert,zoneMatch}.ts +│ ├─ lib/{dates,id,assert,zoneMatch,spineZones}.ts │ ├─ styles/{index,tokens,svg-editor}.css ← Tailwind v4 CSS-first + SVG editor styles │ └─ main.tsx ├─ tests/