"version": 2,
"timestamp": "2026-04-26T21:50:17Z",
"hash": "sha256:0a9e5b26f85cf2d179a17e99b8b0b9dfadb794a7dbc72a0e5b1e55c6c0faeb77",
"changes_summary": "No critique flags were raised; gate recommended a light iteration pass. Refinements: (1) elevated the marked@15 placeholder-survival check from a question/test-time concern into Step 1 so the load-bearing assumption is locked before Step 3 commits to a placeholder format, with an explicit fallback (<div data-carousel=\"N\">); (2) added a note in Step 3 that the splitter must tolerate marked wrapping the placeholder in <p> tags; (3) clarified the migration column set in Step 7 to match the post-migration-0006 schema; (4) added a corresponding must success criterion that the placeholder round-trips through marked + sanitizer. No scope changes.",
"flags_addressed": [],
"questions": [
"Should clickable links be allowed inside carousel items, or only on standalone :::media images? Plan assumes carousel items are not clickable to keep scope tight.",
"What is the canonical hosting source for media (Supabase Storage public URLs vs. arbitrary external URLs)? The plan emits arbitrary src URLs from the directive; the seed migration uses placeholder URLs that the owner should swap.",
"Default video behavior \u2014 controls vs. muted+autoplay+loop? Plan defaults to controls only, with autoplay/loop/muted opt-in via directive attrs (matches :::media{type=video autoplay=true loop=true muted=true}).",
"Should the carousel auto-advance, expose dot indicators, or support keyboard nav globally? Plan: prev/next buttons + n/total indicator + ArrowLeft/Right on focused wrapper only. No auto-advance, no dots.",
"On the mobile breakpoint, should floats become block (current plan) or stay floated at 100% width? Plan drops floats below 640px because .media-half/.media-third are unreadable when floated on phones."
],
"success_criteria": [
{
"criterion": "npm test passes, including the new Recommendations test file covering directive-free regression, image/video/link directive output, carousel rendering + prev/next navigation + boundary disable, and sanitizer stripping of /on*= handlers",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "npm run build succeeds (SSR bundle + client bundle compile cleanly with no TypeScript errors)",
"priority": "must",
"requires": [
"run_shell",
"read_build_output"
]
},
{
"criterion": "Existing recommendations (those without any :::media or :::carousel directives) render identically to before the change \u2014 sanitizer + marked output unchanged for directive-free bodies",
"priority": "must",
"requires": [
"run_tests",
"read_files"
]
},
{
"criterion": "The new Supabase migration 20260330000007_seed_media_demo_recommendation.sql is syntactically valid SQL, follows the existing migration style, includes a column set consistent with the post-migration-0006 schema, and inserts exactly one row with body_markdown that exercises all three element types (linkable image, sized text-wrapped image-or-video, carousel mixing images and a video)",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "Sanitizer continues to strip <script> tags and on*= event handlers from any author-typed HTML in body_markdown, even when interleaved with directives",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "New CSS classes (media, media-full/half/third, media-wrap-block/left/right, media-carousel*) are added adjacent to .recommendation-image in src/styles/global.css and use a distinct namespace that does not override existing rules",
"priority": "must",
"requires": [
"read_files",
"parse_diff"
]
},
{
"criterion": "Render pipeline emits the carousel as a React component (not raw HTML) so prev/next buttons advance the visible item \u2014 verified by a click-handler test that asserts the active item changes",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "The carousel placeholder format chosen in Step 1 round-trips through marked.parse + sanitizer without being escaped or destroyed, and the splitter recovers the carousel positions even when marked wraps the placeholder in a <p> element",
"priority": "must",
"requires": [
"run_tests"
]
},
{
"criterion": "Recommendations.tsx remains under ~350 lines after the change (currently 138). Beyond that, the parser, Carousel, and sanitizer should be split into helper modules",
"priority": "should",
"requires": [
"read_files"
]
},
{
"criterion": "Each new helper (attribute parser, block parser, sanitizer, Carousel) has a single responsibility and is independently testable",
"priority": "should",
"requires": [
"subjective_judgment",
"read_files"
]
},
{
"criterion": "Mobile breakpoint (\u2264640px) drops floats and forces half/third widths to 100% so floated media does not break narrow layouts",
"priority": "should",
"requires": [
"read_files"
]
},
{
"criterion": "Manual browser check of the seeded Media Demo recommendation in npm run dev: linkable image opens in a new tab, half-width text-wrap reflows correctly, carousel prev/next works and disables at boundaries, mobile breakpoint drops floats",
"priority": "info",
"requires": [
"drive_browser",
"inspect_runtime_ui"
]
},
{
"criterion": "Existing recommendations remain visually identical in npm run dev after the change",
"priority": "info",
"requires": [
"drive_browser",
"inspect_runtime_ui"
]
}
],
"assumptions": [
"body_markdown is author-controlled (only the site owner writes recommendations), so the regex sanitizer's permissive posture is acceptable; we will not introduce a full HTML allow-list.",
"Carousel state and arrow-key navigation are client-only; SSR renders item 0 and hydrates without warnings (page is already a client component using hooks).",
"The carousel React component is co-located inside src/pages/Recommendations.tsx rather than a new file under src/components/, to keep the change surface small per the brief.",
":::media body is empty (single self-closing element), and :::carousel body is a markdown-style list where each - key=value ... line declares one item. Closing fence is a bare ::: on its own line.",
"Width defaults to full and wrap defaults to block when those attrs are omitted on a directive.",
"Seed migration uses placeholder URLs (e.g., https://placehold.co/... and a public sample MP4). The owner is expected to replace them with real Supabase Storage URLs in a follow-up; this matches existing seed-migration style which does not gate on idempotency.",
"No changes to src/types/index.ts or src/lib/recommendations.ts \u2014 no schema column added; the directive system lives entirely in body_markdown.",
"Carousel items are not individually clickable (no per-item link); only standalone :::media{type=image link=...} images are linkable. This keeps the API surface and CSS narrow; can be lifted later if needed.",
"Step 1's placeholder-survival check determines the final placeholder format. If <!--CAROUSEL:N--> survives marked@15 it stays; otherwise we fall back to <div data-carousel=\"N\"></div>. The splitter is written to tolerate marked wrapping the placeholder in a <p> element either way."
],
"delta_from_previous_percent": 36.03,
"structure_warnings": []
}
{
"id": "FLAG-001",
"concern": "Recommendations rendering: The plan says directive-free bodies must render identically, but it also changes HTML segments to render through <span dangerouslySetInnerHTML />. Existing code renders one <div dangerouslySetInnerHTML> around the marked output, and marked emits block elements such as <p>. Putting those block elements inside a span is invalid HTML and can change DOM/layout behavior for every existing recommendation even when no directives are present.",
"evidence": "Current src/pages/Recommendations.tsx renders <div dangerouslySetInnerHTML={{ __html: renderBody(rec.body_markdown) }} /> at line 128, while the plan's Step 3 says to render HTML segments via <span dangerouslySetInnerHTML />. marked.parse('text') emits <p>text</p>, so directive-free output would become block markup nested in an inline span instead of the existing div wrapper.",
"status": "open",
"severity": "minor"
},
{
"id": "verifiability-0",
"concern": "Criterion 8: requires human verification (subjective_judgment).",
"evidence": "",
"status": "open",
"severity": "minor"
},
{
"id": "verifiability-1",
"concern": "Criterion 10: requires human verification (drive_browser, inspect_runtime_ui).",
"evidence": "",
"status": "open",
"severity": "minor"
},
{
"id": "verifiability-2",
"concern": "Criterion 11: requires human verification (drive_browser, inspect_runtime_ui).",
"evidence": "",
"status": "open",
"severity": "minor"
}
]