From KC's review — the canvas now draws the detail the spike detected:
- numbered sub-answer bands ('suggest two' → dashed dividers + 1/2 labels),
- per-option MC selection boxes (drawn from meta.boxes rel coords; filled tint
when detected marked),
- the final-answer line's expected quantity + unit pill.
Region meta (components/boxes/final_answer_line + figure name/desc) is carried
through load→shape props (metaJson)→render, and round-trips on save via
exam_response_areas.meta. tsc clean; 7/7 model tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GruxHXxfdp4kZCgAMVFgvV
Round-trip fix (item 5): serializeCanvasShapes no longer re-derives the question
tree from boundary pairs (which flattened 3-deep → 2-tier). The whole tree is now
carried as 'part' shapes that hold parentId + isContainer + depth; save preserves
the real parent_id chains (persisted parent wins; geometry is only a fallback for
manually-drawn shapes). Boundary-pair synthesis is kept but attaches to a covering
container box when one exists. New test locks a 3-deep Q→part→subpart round-trip.
Draw structure (item 4): shapesFromTemplate now draws containers too (were skipped),
each with nesting depth. examCanvasShapes renders container frames (transparent,
depth-hued border), PRINTS MARKS on part/container boxes (◆N pill; were never
drawn), and NAMES context figures (figure name as label + description tooltip +
'→ Q' tether pill; was an anonymous purple box). Context name/description round-trip
via exam_response_areas.meta.
Threads new shape props through the tldraw util + setup page + types. Adds meta to
ExamResponseArea + replace payload. tsc: no new errors; 7/7 model tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GruxHXxfdp4kZCgAMVFgvV
serializeCanvasShapes recomputed each region's owner purely from geometry,
ignoring the persisted question_id: a region with no enclosing part (or any
region when a template had no parts) was silently dropped, and one overflowing
its part by a pixel re-parented to parts[0].
Resolve the owner in order: geometric containment (a drag into a part re-attaches)
-> persisted question_id if it still points at a saved question (survives drift /
no-container) -> nearest part on the page -> first part -> first question of any
kind. exam_response_areas.question_id is NOT NULL, so a region is never dropped
while any question exists.
Tests: never drops a region with no enclosing part; persisted question wins over
geometric nearest. Full model.test.ts suite (6) passes; tsc clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>