Three issues from manual QA:
1. UX restructure — observations are now an accordion list. Each card has
a header that's always visible (title + chips + chevron + action
buttons) and a body that expands inline showing zones / pathologies /
severity / comment. Click the header (or the chevron) to toggle.
ObservationEditor has been merged into ObservationCard so each card
owns its own details. Only one observation is expanded at a time; the
chevron on the active card collapses everything. EditorRoute uses
activeObservationIndex === -1 to represent "all collapsed".
2. App used to start with 2 observations instead of 1. Root cause:
EditorRoute had a "seed first observation" useEffect that fired twice
under React 19 StrictMode in dev, both invocations seeing length=0 and
queueing addObservation(). Fixed by moving the seed into the store's
initReport (synchronous, one-shot) and removing the useEffect entirely.
Store tests updated to assert the seed behaviour (90/90 pass).
3. PDF export still failed with "The input is not a PNG file!" — canvg
was returning bytes that pdf-lib rejected at embedPng(). Switched
rasterizeSvg to the browser-native pipeline: serialize the SVG into a
Blob URL, load it with an Image element, drawImage onto a 2D canvas,
then toBlob → PNG bytes (with a toDataURL fallback). Validates the
PNG signature before returning. Tree-shaking dropped canvg from the
bundle (979 kB → 874 kB JS).
Tests updated for the new initReport behaviour and the new svgToPng
pipeline (Image mock + dataURL fallback case). lint + typecheck + build
all clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three impactful fixes from the post-impl code review:
1. EditorRoute.onExport now catches PDF generation failures, logs to
console, and alerts the praticien in French — previously errors were
swallowed by try/finally with only `setExporting(false)`.
2. VertebraPicker onConfirm reads the active observation from the store
at confirm time instead of closing over the render-scope `activeObs`.
Prevents mutating a stale observation if the praticien switches active
observation while the picker is open.
3. readPersistedDraft validates the parsed JSON with ReportSchema instead
of a raw `as Report` cast. Corrupted drafts now return null cleanly
rather than poisoning the store.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>