Convert the website from its current 'working but duct-taped' state into a properly engineered React 19 app. Phase 1: Convert all dangerouslySetInnerHTML surfaces (HOME_BODY_HTML, assorted pages) into proper React JSX components. Phase 2: Replace the legacy script.ts (2000+ lines of imperative DOM manipulation) with idiomatic React hooks and components — card expansion, filter system, video player lifecycle, FLIP animations, scroll effects, POM border interactions, plant animation, weights chart. Phase 3: Add a proper data layer with React Query + Supabase client, replacing the split SSR/client fetch pattern. Phase 4: Re-enable React StrictMode. The existing visual design and all interactive behaviors must be preserved pixel-perfectly throughout.
User notes and answers:
Run autonomously through the full critique loop. User wants a well-engineered plan, not a quick fix. This is planning only — do not execute. Key context: the site was just migrated from vanilla JS to React 19 + Vite + TypeScript + Supabase. The migration preserved all content/style but left significant technical debt: raw HTML strings rendered via dangerouslySetInnerHTML, 2000+ lines of legacy imperative DOM JS running via useEffect, no React data layer, StrictMode disabled. The CSS/Tailwind megaplan (plan: design-a-sensible-well-20260323-0631) identified 48 frozen CSS classes coupled to legacy JS — those constraints apply here too. Posts and measurements are in Supabase. Assets are in Supabase Storage.
code
Plan:
React 19 Proper Engineering Plan — user_c042661f.com
{"flags":[{"id":"nondeterministic_visual_baseline","concern":"The screenshot-fixture plan is still incomplete for this SSR app. page.route() will only intercept browser-side requests, but /posts and /posts/:slug are populated by server-side fetches before the page ever reaches Playwright, so those baselines can still drift with live data.","category":"correctness","severity_hint":"likely-significant","evidence":" calls / during SSR, and fetches Supabase or falls back to local markdown on the server. The updated Step 1 only describes browser interception via , which will not freeze those SSR requests."},{"id":"missing_square_image_video_swap","concern":"The plan still misses one current home interaction: each of the three square portrait tiles can be clicked/tapped to swap from a still image into a local MP4. Step 14 only covers hover/mobile-active image behavior, and Step 15 only covers the YouTube card lifecycle, so this behavior would be lost.","category":"completeness","severity_hint":"likely-significant","evidence":" wires onto the first three nodes and binds them to , , and . Those containers are the three tiles in , but the updated plan does not assign that behavior to any migration step."},{"id":"scope_creep_icon_library_swap","concern":"Scope creep: the plan still introduces for icon replacement even though the repository only uses a handful of feather placeholders, and removing the CDN dependency does not require adopting a new icon library.","category":"other","severity_hint":"likely-minor","evidence":"The repo has four feather placeholders in , , , and , and the current runtime hookup is only in . Inline SVGs or vendored icons would remove the CDN script without adding another dependency and migration surface."}],"verified_flag_ids":["incomplete_dom_contract","home_first_sequencing","markdown_not_sanitized","phase3_bootstrap_contract"],"disputed_flag_ids":[]}
User
Assistant
{"flags":[{"id":"plan_structure_substeps","concern":"The plan still does not fully match the required structure. At least one numbered ## Step N: section lacks numbered substeps, so the plan would still fail the expected-format check.","category":"completeness","severity_hint":"likely-significant","evidence":"## Step 24: SSR Hydration Migration is written as bold 24a/24b/24c blocks with dash bullets instead of numbered substeps, and the validator is still emitting: Each ## Step N: section should include at least one numbered substep."},{"id":"scope_creep_icon_library_swap","concern":"Scope creep: the plan still introduces lucide-react for icon replacement even though the repository only uses a handful of feather placeholders, and removing the CDN dependency does not require adopting a new icon library.","category":"other","severity_hint":"likely-minor","evidence":"The repo has four feather placeholders in src/data/home.ts:25, src/data/home.ts:28, src/data/home.ts:32, and src/data/home.ts:83, and the current runtime hookup is only in . Inline SVGs or vendored icons would remove the CDN script without adding another dependency and migration surface."}],"verified_flag_ids":["nondeterministic_visual_baseline","missing_square_image_video_swap"],"disputed_flag_ids":[]}
useState
useEffect
StrictMode
SSR only; disabled on client
Dependencies
React 19.2, react-router-dom 6.30, Express 4.22, marked 15, Vite 7.2
Phase 0: Test Infrastructure (PREREQUISITE — blocks all other phases)
Step 0.1: Playwright Visual Regression Baseline
The CSS megaplan already specifies this (Step 0.1). It must be implemented first and shared across both plans.
Every frozen CSS class (.card, .dashboard, .loading-element, .video-card, .filter-btn, .square-image-container, etc.) MUST appear as className props — legacy JS queries these by class name
Every data-* attribute (data-category, data-position, data-filter, data-feather) MUST be preserved
Card HTML structure (.card > .image-container > img, .card > h3, .card > .text-content > p, .card > .link) must be identical — CSS selectors depend on this nesting
The <i data-feather="..."> elements must remain for feather-icons initialization (until Phase 2.11 replaces them)
Approach:
Extract each card from HOME_BODY_HTML into a typed component
Define a CardData type with: position, category, title, imageSrc, content (JSX), links, cardType
Home page data becomes a typed array of CardData objects (can live in src/data/home-cards.ts)
Dashboard component maps over card data, renders appropriate card component
Run test:visual — zero diff at all viewports
Per-component test: Render each card component, assert correct className and data attributes present.
Step 1B: Assorted Index to JSX
Convert ASSORTED_INDEX_HTML to a SortedDirectory component. Simple: just links with spans. No JS coupling.
Step 1C: Accountability to JSX
Convert ACCOUNTABILITY_HTML. Watch out for: inline onclick handlers for clipboard copy — replace with React onClick handlers.
Step 1D: Projects to JSX
Convert PROJECTS_HTML. Preserve .projects-list, .project-entry, .hover-trigger, data-img attributes — these are frozen (used by initProjectsHoverPopup()).
Step 1E: Crypto Conversations to JSX
Convert both the index page and the CONVERSATION_DETAILS object. The details object maps conversation IDs to HTML — convert each to a component or use a data-driven approach.
Step 1F: Mute List to JSX
Convert MUTE_LIST_HTML. Simple content page.
Step 1G: Post Content (DEFERRED)
Blog post content is markdown rendered to HTML by marked. Converting this to JSX would require either a markdown-to-React renderer (like react-markdown) or a custom marked renderer that outputs React elements.
Decision: Keep dangerouslySetInnerHTML for post content for now. The content is sanitized markdown, the attack surface is controlled, and the cost of conversion is high relative to benefit. Revisit after Phase 2.
Phase 1 Validation
dangerouslySetInnerHTML usage reduced from 3 patterns (7 routes) to 1 pattern (post content only)
All frozen CSS classes still present in rendered DOM (verify with Playwright locator assertions)
Phase 2: Replace Legacy Imperative JS with React
Goal: Delete src/legacy/ entirely. All behavior expressed as React hooks and components.
Ordering Strategy
Migrate features bottom-up by dependency: start with leaf behaviors (no dependencies on other features), then work up to features that coordinate multiple behaviors. Each step deletes imperative code and replaces it with a hook or component.
Step 2.0: Shared Infrastructure
Create foundational hooks used by multiple features:
src/hooks/useScrollPosition.ts — Single scroll listener (replaces 3+ separate scroll handlers), returns scrollY, scrollPercent, distanceFromBottom. Uses requestAnimationFrame throttling.
src/hooks/useMediaQuery.ts — Returns boolean for mobile detection (replaces window.innerWidth checks scattered throughout)
src/hooks/useDebounce.ts — Generic debounce hook
src/hooks/useFLIP.ts — FLIP animation hook: measures before/after positions on deps change, applies CSS transform animation. This is the hardest hook — it underpins both card expansion and filter reflow.
Step 2.1: Loading Animation (useLoadingStagger)
Replaces: Lines 19-25, 1350-1440 of script.ts (staggered .loaded class application)
src/hooks/useLoadingStagger.ts — On mount, observe images within ref, apply staggered loaded class with 100ms base delay
Preserves .loading-element and .loaded class names (frozen)
Apply in Dashboard and SquareImages components
Validation: Cards fade in with stagger on page load.
Chart.js: Ensure chart is destroyed on cleanup, re-created on mount
Event listeners: All must be added in useEffect and cleaned up in return function
Scroll observers: ResizeObserver, MutationObserver, IntersectionObserver — all must disconnect on cleanup
React Query: Already StrictMode-compatible by design
Approach: Enable StrictMode, run full Playwright suite in dev mode, fix any visual glitches or console warnings.
Phase 4 Validation
React.StrictMode wraps client hydration
No console warnings about missing cleanup
Dev mode: no visual glitches from double-mount
Prod mode: test:visual passes
Cross-Cutting Concerns
Feather Icons Replacement
The site uses <i data-feather="..."> which requires the feather-icons global script. Replace with react-feather or lucide-react throughout. Phase 1 (JSX conversion) is the natural time to do this. Remove feather.replace() call from legacy init and CDN script tag from index.html.
Bundle Size
Phase 2 adds Chart.js as a bundled dependency (currently CDN). Use dynamic import() to code-split and keep weights chart in its own chunk.
Risk Register
Risk
Likelihood
Impact
Mitigation
FLIP animation timing differs between imperative and React
High
Medium
Build useFLIP hook early, test with simple case before card system
Card expansion breaks on mobile
Medium
High
Playwright mobile viewport tests at 480px; manual iOS Safari testing
Weights chart double-init in StrictMode
High
Low
Proper cleanup in useEffect; Chart.js destroy() on unmount
SSR hydration mismatch after JSX conversion
Medium
Medium
suppressHydrationWarning as escape hatch; prefer matching server/client output
Frozen CSS class accidentally removed during refactor
Low
High
Playwright visual regression catches immediately
React Query SSR hydration adds complexity
Medium
Medium
Can fall back to current window.INITIAL_DATA pattern if hydration proves fragile
"version": 1,
"timestamp": "2026-03-23T06:30:39Z",
"hash": "sha256:44a20d9f73f61b3cb0cc481202dd6dce89bd622078a269df9e8daa6fb5b98b79",
"questions": [
"Local markdown fallback: Phase 3 proposes removing the local markdown fallback (local-posts.ts). Is Supabase now the permanent source of truth for posts, or do you want to keep the ability to run the site without Supabase (e.g., for offline dev)?",
"Post content HTML: Phase 1G defers converting markdown-rendered post content from dangerouslySetInnerHTML to JSX (e.g., via react-markdown). Is eliminating ALL dangerouslySetInnerHTML a hard requirement, or is keeping it for sanitized markdown content acceptable?",
"Assorted page content source: The CONVERSATION_DETAILS object in assorted.ts contains per-conversation HTML. Should these eventually move to Supabase (like posts did), or are they intentionally static/baked-in? This affects whether Phase 1E creates static components vs. a data-fetching pattern.",
"Home dashboard card data: The cards in HOME_BODY_HTML are currently hardcoded HTML. Should card data (titles, descriptions, images, links, categories) eventually come from Supabase or a CMS, or will they remain code-defined? This affects whether Phase 1A creates a simple data array or a fetching pattern.",
"Chart.js CDN vs bundle: The weights chart currently loads Chart.js (plus 2 plugins plus Supabase client) from CDN. Phase 2.9 proposes bundling via npm with dynamic import. Is there a reason CDN loading was chosen (e.g., bundle size concerns), or was it just expedient during the migration?"
],
"success_criteria": [
"Zero dangerouslySetInnerHTML on non-markdown surfaces: Home, Assorted, Accountability, Projects, Crypto Conversations, and Mute List pages render via JSX components, not raw HTML strings.",
"src/legacy/ directory deleted: All 3,077 lines of imperative DOM manipulation replaced with React hooks and components.",
"src/data/home.ts and src/data/assorted.ts deleted: No raw HTML template strings in the codebase (except markdown post content if deferred).",
"No CDN script tags for runtime libraries: feather-icons, Chart.js, chartjs plugins, and Supabase client loaded via npm/bundled, not script tags in index.html.",
"All 48 frozen CSS classes preserved: Legacy class names still present in rendered DOM \u2014 verified by automated Playwright assertions.",
"Playwright visual regression zero diff: All 9 routes x 4 viewports produce identical screenshots before and after each phase.",
"All interactive behaviors preserved: Card expansion, filter FLIP animation, video lazy-load/cleanup, POM letter name reveal, plant animation, weights chart zoom/pan, projects hover popup, scroll border effects \u2014 all verified via Playwright interaction tests.",
"React Query caching active: Navigation between /posts and /posts/:slug does not re-fetch; React Query DevTools shows cached entries.",
"SSR still produces full HTML: curl localhost:3000/posts returns complete post list HTML, not loading skeletons.",
"React StrictMode enabled on client: entry-client.tsx wraps hydration in React.StrictMode with no console warnings or visual glitches in dev mode.",
"No window.INITIAL_DATA pattern: Server-side data flows through React Query hydration, not global JSON injection.",
"Each phase independently deployable: The site works correctly after completing any phase \u2014 no phase leaves the site in a broken intermediate state."
],
"assumptions": [
"Supabase is the permanent data backend \u2014 the local markdown fallback was a migration safety net and can be removed once React Query is in place.",
"Post markdown content can keep dangerouslySetInnerHTML \u2014 the content is author-controlled and sanitized; converting to react-markdown is a separate, lower-priority effort.",
"Assorted page content (conversations, accountability, etc.) is intentionally static \u2014 it will be converted to JSX components with hardcoded data, not moved to Supabase.",
"Home dashboard card data will remain code-defined \u2014 no CMS or Supabase backing for card content. The JSX conversion creates a typed data array, not a fetch pattern.",
"Chart.js CDN loading was expedient, not deliberate \u2014 bundling via npm with code-splitting is acceptable.",
"The CSS megaplan (design-a-sensible-well-20260323-0631) will execute independently \u2014 this plan does not duplicate CSS/Tailwind migration work. The two plans share Phase 0 (Playwright setup) and the frozen class audit.",
"The 48 frozen CSS classes documented in the CSS megaplan are exhaustive \u2014 no additional JS-coupled classes exist beyond that audit.",
"feather-icons can be replaced with react-feather or lucide-react \u2014 the icon set used (github, youtube, mail, play-circle) is available in these libraries.",
"No SEO-critical content lives in the raw HTML strings \u2014 SSR rendering of JSX components will produce equivalent HTML for search engines.",
"TypeScript strict mode enablement is out of scope \u2014 noted as optional, not part of the core 4-phase plan."
]
}
code
Existing flags:
[]
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
{"flags":[{"id":"incomplete_dom_contract","concern":"The plan treats the 48 frozen CSS classes as the main preservation boundary, but the actual legacy layer depends on more than classes: specific IDs, DOM order, magic data-position values, and even placeholder text. If those contracts are not cataloged before Phase 1, the site can regress while legacy JS is still running.","category":"completeness","severity_hint":"likely-significant","evidence":"src/legacy/script.ts:1722-1880 hard-codes .card.project-tile[data-position=\"3\"]/[data-position=\"2\"], the first/second/third .square-image-container, and adds .has-video; src/legacy/weights-chart.ts:628-667 mutates #weights-title, #weights-chart-container, and replaces the literal BMI placeholder text inside the card; those dependencies come from src/data/home.ts:5-18, src/data/home.ts:165-175, and src/data/home.ts:204-217."},{"id":"home_first_sequencing","concern":"Starting Phase 1 with the home page is the highest-risk ordering, not the safest way to surface issues. Home is where almost all imperative behavior is concentrated, so changing it first while initLegacyExperience() still runs makes the plan's 'each phase independently deployable' goal much harder to satisfy.","category":"maintainability","severity_hint":"likely-significant","evidence":"The home markup in src/data/home.ts:1-219 contains the dashboard, filters, video card, square-image strip, weights chart, meme card, watering can, and bud; the legacy code touching those pieces spans src/legacy/script.ts:1510-1884 plus src/legacy/weights-chart.ts:628-667. By contrast, the assorted pages are mostly static RawSectionPage wrappers in src/pages/Assorted.tsx, src/pages/Projects.tsx, src/pages/Accountability.tsx, src/pages/CryptoConversations.tsx, and src/pages/MuteList.tsx."},{"id":"nondeterministic_visual_baseline","concern":"Phase 0's zero-diff visual baseline is underspecified for this repo. Without a deterministic fixture strategy for remote assets, live Supabase data, and autoplaying/animated surfaces, Playwright screenshot gating will be flaky enough to block the rest of the plan.","category":"correctness","severity_hint":"likely-significant","evidence":"Home and assorted embed many remote Supabase Storage URLs directly in the HTML strings (src/data/home.ts:5-199, src/data/assorted.ts:102-104), src/pages/Posts.tsx:14-40 fetches live post data on the client when SSR props are absent, and the weights chart fetches live measurements from Supabase in src/legacy/weights-chart.ts before rendering. The plan requires 'zero diff' screenshots across routes and interactive states but does not describe freezing those inputs."},{"id":"markdown_not_sanitized","concern":"Phase 1G's rationale says post content is 'sanitized markdown', but that is not true in the repository. Keeping dangerouslySetInnerHTML for posts may still be an acceptable tradeoff, but the current justification is factually wrong and hides a real security boundary.","category":"security","severity_hint":"likely-significant","evidence":"src/lib/markdown.ts:14-19 calls marked.parse() and then only rewrites asset/video tags; there is no sanitization step. src/pages/Post.tsx:42-43,81 also parses markdown client-side with marked and injects it via dangerouslySetInnerHTML."},{"id":"phase3_bootstrap_contract","concern":"Phase 3 treats removing window.__INITIAL_DATA__ as a data-layer cleanup, but in this repo it is also part of the SSR routing/bootstrap contract. Deleting it requires route-state refactors outside React Query, and the plan also assumes away the existing local-posts fallback that is still wired into production paths.","category":"correctness","severity_hint":"likely-significant","evidence":"src/App.tsx:34-42,79-82 passes SSR-provided initialData into posts, post, and crypto-conversation routes; src/entry-client.tsx:16-26 hydrates from window.__INITIAL_DATA__; src/server.ts:91-160 builds that payload per request; and src/pages/CryptoConversation.tsx:4-10 relies on a prop instead of useParams(). Separately, src/lib/posts.ts:69-92 falls back to local markdown when Supabase config/fetches fail, so deleting src/lib/local-posts.ts is not just dead-code cleanup."},{"id":"scope_creep_icon_library_swap","concern":"Scope creep: replacing feather-icons with react-feather or lucide-react is extra migration churn that is not required to achieve the stated React/SSR/data-layer cleanup goals.","category":"other","severity_hint":"likely-minor","evidence":"There are only four feather placeholders in the repo, all in src/data/home.ts:25, src/data/home.ts:28, src/data/home.ts:32, and src/data/home.ts:83, and the runtime integration is a single feather.replace() call in src/legacy/script.ts:6-8. An inline SVG pass or keeping the current icons until later would avoid unnecessary dependency and markup churn."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
You are an independent reviewer. Critique the plan against the actual repository.
Convert the website from its current 'working but duct-taped' state into a properly engineered React 19 app. Phase 1: Convert all dangerouslySetInnerHTML surfaces (HOME_BODY_HTML, assorted pages) into proper React JSX components. Phase 2: Replace the legacy script.ts (2000+ lines of imperative DOM manipulation) with idiomatic React hooks and components — card expansion, filter system, video player lifecycle, FLIP animations, scroll effects, POM border interactions, plant animation, weights chart. Phase 3: Add a proper data layer with React Query + Supabase client, replacing the split SSR/client fetch pattern. Phase 4: Re-enable React StrictMode. The existing visual design and all interactive behaviors must be preserved pixel-perfectly throughout.
User notes and answers:
Run autonomously through the full critique loop. User wants a well-engineered plan, not a quick fix. This is planning only — do not execute. Key context: the site was just migrated from vanilla JS to React 19 + Vite + TypeScript + Supabase. The migration preserved all content/style but left significant technical debt: raw HTML strings rendered via dangerouslySetInnerHTML, 2000+ lines of legacy imperative DOM JS running via useEffect, no React data layer, StrictMode disabled. The CSS/Tailwind megaplan (plan: design-a-sensible-well-20260323-0631) identified 48 frozen CSS classes coupled to legacy JS — those constraints apply here too. Posts and measurements are in Supabase. Assets are in Supabase Storage.
Convert the site from its "working but duct-taped" post-migration state into a properly engineered React 19 app across four phases: (1) convert dangerouslySetInnerHTML surfaces to JSX, (2) replace ~3,077 lines of legacy imperative DOM JS with React hooks/components, (3) add React Query + Supabase client data layer, (4) re-enable StrictMode.
Current state: React 19.2 + Vite 7.2 + TypeScript + Express SSR. Content/style preserved from vanilla JS migration but with raw HTML strings via dangerouslySetInnerHTML, legacy imperative JS running via useEffect on every route change, no React data layer, StrictMode disabled on client.
Key constraints:
48 frozen CSS classes coupled to legacy JS (documented in CSS megaplan Step 0.3)
Additional DOM contracts beyond classes: element IDs, data-position values, ordinal selectors, placeholder text (cataloged in Step 2 below)
The CSS/Tailwind megaplan (design-a-sensible-well-20260323-0631) executes independently; this plan shares Phase 0 test infrastructure
Pixel-perfect visual preservation verified by Playwright at every step
Repository shape:
src/data/home.ts (219 lines) — raw HTML string for home page
src/data/assorted.ts (~12K tokens) — raw HTML strings for 6 assorted routes
Add interactive state captures: card hover/expand, filter toggle, video overlay click, POM letter click sequence.
Implement deterministic fixture strategy to prevent flaky baselines:
Supabase REST API (/rest/v1/posts, /rest/v1/measurements): Intercept via page.route(), return frozen JSON from e2e/fixtures/. Capture once from live, then freeze.
Supabase Storage images (ddbobialzdjkzainyqgb.supabase.co/storage/v1/object/public/assets/*): Intercept, serve from e2e/fixtures/assets/. Download each referenced image once.
YouTube/Vimeo iframes: Block in screenshot tests (nondeterministic). Test video overlay separately via iframe src assertion.
Chart.js canvas: Mask #weights-chart-container in screenshot comparisons (subpixel nondeterminism). Test chart behavior functionally (zoom buttons, tooltip content).
Animations/transitions: Inject * { animation-duration: 0s !important; transition-duration: 0s !important; } via addStyleTag before capture.
Stagger loading: Wait for all .loading-element to have .loaded class before capture.
Createe2e/update-fixtures.ts — manual script to refresh fixtures from live data when content changes.
Commit baseline screenshots to e2e/__screenshots__/.
Addtest:visual and test:visual:update scripts to package.json.
Gate: All baseline screenshots pass with mocked network before any code changes.
Step 2: DOM Contract Audit (src/contracts/dom-contracts.ts, e2e/dom-contracts.spec.ts)
Scope: Small
The 48 frozen CSS classes are necessary but not sufficient. Legacy JS also depends on element IDs, data-* attribute values, ordinal selectors, and placeholder text. This step catalogs everything.
Scan all 4 files in src/legacy/ for every DOM query/mutation beyond class names:
Createsrc/contracts/dom-contracts.ts — typed manifest of all contracts.
Createe2e/dom-contracts.spec.ts — loads home page, asserts every contract. Catches regressions that screenshots miss (e.g., missing data-position doesn't change pixels but breaks JS).
Lifecycle: Consumed during Steps 4-9 (JSX must emit matching DOM). Retired incrementally during Steps 10-21 (each legacy feature replacement removes its contracts). Deleted in Step 22.
Step 7: Convert Crypto Conversations to JSX (src/pages/CryptoConversations.tsx, src/pages/CryptoConversation.tsx)
Scope: Small
Convert index page and CONVERSATION_DETAILS object to JSX components.
FixCryptoConversationPage to use useParams() for conversation ID instead of relying solely on conversationId prop — removes a bootstrap dependency for Phase 3.
Step 8: Convert Mute List to JSX (src/pages/MuteList.tsx)
Scope: Small
ConvertMUTE_LIST_HTML to JSX. Simple content page.
After this step: delete src/data/assorted.ts and RawSectionPage.tsx (all consumers converted).
Step 9: Convert Home Dashboard to JSX (src/pages/Home.tsx, src/components/home/)
Scope: Large — highest risk in Phase 1, done last
This is where all imperative behavior concentrates. The JSX must produce structurally identical DOM so initLegacyExperience() continues working.
Create components:
src/components/home/SquareImages.tsx — three hover images with text overlays
src/components/home/SocialLinks.tsx — social icon links + watering can + initial bud
Validation:e2e/dom-contracts.spec.ts passes (all contracts hold). test:visual zero diff. Per-component tests assert className and data attributes.
Step 9.5: Add DOMPurify to Markdown Rendering (src/lib/markdown.ts)
Scope: Small
Post content rendered by marked.parse() is not sanitized — src/lib/markdown.ts only does URL rewriting and video attribute injection. While post markdown is author-controlled (committed to repo or authored via Supabase dashboard with service-role access), the security boundary should be explicit.
Installisomorphic-dompurify (works in both Node SSR and browser).
Add sanitization to renderMarkdown():
typescript
import DOMPurify from 'isomorphic-dompurify';
// ...after marked.parse() and URL rewriting:
return DOMPurify.sanitize(html, {
ADD_TAGS: ['iframe'],
ADD_ATTR: ['allowfullscreen', 'playsinline', 'allow']
});
Update client-side marked() call in Post.tsx to also sanitize.
Post content retains dangerouslySetInnerHTML — acceptable tradeoff given author-controlled content and now-explicit sanitization. Converting to react-markdown is out of scope.
Validation: Existing post pages render identically. test:visual zero diff on /posts/:slug routes.
Step 10: Shared Hooks Infrastructure (src/hooks/)
Scope: Medium
Begin Phase 2: replacing legacy imperative JS with React.
Scope: Large — replaces weights-chart.ts (746 lines)
Create React wrapper around Chart.js.
Lazy-load Chart.js + plugins via dynamic import() (code-split into own chunk, replaces CDN).
Manage BMI calculation and title update in React state (replaces direct DOM mutation of #weights-title and {calculate based on last measurement} placeholder).
Fetch data via React Query (Step 25) or local fetch as interim.
Proper cleanup: chart.destroy(), disconnect observers on unmount.
Createsrc/lib/query-client.ts — QueryClient with staleTime: 5min, gcTime: 30min.
Wrap app in <QueryClientProvider> in both entry-client.tsx and entry-server.tsx.
Step 24: SSR Hydration Migration (src/server.ts, src/entry-client.tsx)
Scope: Large
window.__INITIAL_DATA__ is not just a data dump — it's part of the SSR routing contract: App.tsx passes it as props, entry-client.tsx reads it on hydration, server.ts builds it per request. Migration in three deployable sub-steps:
24a — Add React Query alongside existing pattern:
Server creates per-request QueryClient, prefetches route data via prefetchQuery().
dehydrate(queryClient) injected as window.__REACT_QUERY_STATE__ (NEW, alongside existing __INITIAL_DATA__).
Client wraps app in <HydrationBoundary>. Both patterns coexist. Deploy gate: site works identically.
24b — Migrate pages one at a time (Step 25):
Each page switches from initialData prop to React Query hook.
Deletesrc/lib/posts.ts (SSR fetch logic — replaced by React Query prefetch).
Deletesrc/lib/supabase.ts (raw REST helper — replaced by @supabase/supabase-js).
Retainsrc/lib/local-posts.ts — wire as fallback queryFn in usePosts/usePost (try Supabase, fall back to local markdown on error). Preserves offline dev capability.
RemoveInitialData type.
Validation: No raw fetch() for data in any component. SSR curl localhost:3000/posts returns full HTML. Client navigation between cached pages is instant.
Add<React.StrictMode> wrapper in entry-client.tsx around BrowserRouter + HydratedApp.
Fix double-mount issues surfaced by dev-mode remount:
PlantCanvas: cleanup tears down animation loop, clears canvas, resets arrays
WeightsChart: chart.destroy() on cleanup
All event listeners in useEffect with cleanup returns
All observers disconnect on cleanup
React Query: already StrictMode-compatible
Validation: No console warnings about missing cleanup. Dev mode: no visual glitches from double-mount. Prod mode: test:visual passes.
Execution Order
Phase 0 — Test Infrastructure (Steps 1-3): Must complete before any code changes. Step 2 (DOM contract audit) is the safety net for all subsequent work.
Phase 1 — JSX Conversion (Steps 4-9.5):
Steps 4-8 (assorted pages) — zero risk, can parallelize. Do first.
Step 9 (home dashboard) — highest risk, do last with full DOM contract verification.
Step 9.5 (DOMPurify) — small, independent, can slot anywhere in Phase 1.
Phase 2 — Legacy JS Replacement (Steps 10-22):
Step 10 (shared hooks) first — foundation for everything else.
Steps 11-14 (leaf behaviors) — no inter-dependencies.
"version": 2,
"timestamp": "2026-03-23T06:49:11Z",
"hash": "sha256:4e7453757fc77593a8444b7bcff2c7e70790161a0345e3c0bba89740a01abd2a",
"changes_summary": "v1 \u2192 v2 changes addressing all 5 significant flags:\n\n1. incomplete_dom_contract \u2192 Added Step 2: Complete DOM Contract Audit. Catalogs all legacy JS dependencies beyond the 48 CSS classes: element IDs (#weights-title, #plantCanvas, etc.), data-* attributes with exact values, ordinal selectors (querySelectorAll('.square-image-container')[0,1,2]), positional selectors (data-position="3"), text contracts ("{calculate based on last measurement}" placeholder), heading text matching ("Steerable Motion"), and DOM nesting structure. Produces typed manifest with automated Playwright verification. Each Phase 2 step explicitly retires its contracts from the manifest.\n\n2. home_first_sequencing \u2192 Reversed Phase 1 order. Steps 4-8 (assorted pages) now go first \u2014 they have zero JS coupling and are safe. Step 9 (home dashboard) moves to last in Phase 1, done only after simpler conversions build confidence, with full DOM contract verification gating the result.\n\n3. nondeterministic_visual_baseline \u2192 Added comprehensive deterministic fixture strategy to Step 1. Specifies Playwright page.route() network mocking for Supabase REST API (frozen JSON fixtures), Supabase Storage images (local copies), YouTube iframe blocking, Chart.js canvas masking, CSS animation/transition zeroing, and .loaded class wait conditions. Includes fixture maintenance script.\n\n4. markdown_not_sanitized \u2192 Corrected the false "sanitized markdown" claim. Added Step 9.5: install isomorphic-dompurify, add sanitization to renderMarkdown() and client-side marked() call. The acceptable-risk rationale is preserved but factually grounded (author-controlled content, read-only anon key, no UGC) with an explicit security boundary now enforced.\n\n5. phase3_bootstrap_contract \u2192 Rewrote Step 24 with explicit three-sub-step migration (24a: add React Query alongside existing, 24b: migrate pages individually, 24c: remove old pattern). Maps the full dependency chain (App.tsx props, entry-client.tsx hydration, server.ts injection). Step 7 fixes CryptoConversationPage to use useParams(). Local markdown fallback retained as queryFn fallback rather than deleted.\n\nScope creep addressed: Feather icons replacement scoped to exactly 6 icons and explicitly justified as required to remove CDN script tag (in scope per original idea). No other scope additions. Restructured to match required plan template with numbered Steps, Execution Order, and Validation Order sections.",
"flags_addressed": [
"incomplete_dom_contract",
"home_first_sequencing",
"nondeterministic_visual_baseline",
"markdown_not_sanitized",
"phase3_bootstrap_contract"
],
"questions": [
"Local markdown fallback: The plan retains local-posts.ts as a queryFn fallback for offline dev. Is this the right tradeoff, or should Supabase be required for all environments?",
"Home dashboard card data: Cards are hardcoded HTML today, converted to a typed code array. Should this eventually come from Supabase/CMS, or remain code-defined?",
"DOMPurify server-side: isomorphic-dompurify adds jsdom as transitive dependency (~2MB). Alternative: sanitize client-side only, trust server-rendered author-controlled content. Preference?"
],
"success_criteria": [
"Zero dangerouslySetInnerHTML on non-markdown surfaces: Home, Assorted, Accountability, Projects, Crypto Conversations, and Mute List render via JSX.",
"src/legacy/ directory deleted: All 3,077 lines of imperative DOM manipulation replaced with React hooks and components.",
"src/data/home.ts and src/data/assorted.ts deleted: No raw HTML template strings in the codebase.",
"No CDN script tags for runtime libraries: feather-icons, Chart.js, chartjs plugins, and Supabase client bundled via npm.",
"DOM contract manifest fully verified during Phase 1 (IDs, data-attributes, ordinal selectors, text contracts, CSS classes), retired incrementally during Phase 2.",
"Playwright visual regression zero diff: All 9 routes x 4 viewports with deterministic fixtures (mocked network, frozen data, masked canvas, disabled animations).",
"All interactive behaviors preserved: Card expansion, filter FLIP, video lazy-load, POM letters, plant animation, weights chart, projects popup, scroll borders \u2014 Playwright interaction tests.",
"React Query caching active: Navigation between /posts and /posts/:slug does not re-fetch.",
"SSR produces full HTML: curl localhost:3000/posts returns content, not skeletons.",
"React StrictMode enabled on client with no console warnings or visual glitches in dev mode.",
"No window. pattern: Data flows through React Query dehydrate/HydrationBoundary. window. retained.",
"Each step independently deployable: Site works correctly after any step completes.",
"Markdown rendering sanitized: renderMarkdown() applies DOMPurify before dangerouslySetInnerHTML.",
"All route pages use useParams() for URL parameters: No page depends solely on prop-passing for route state."
],
"assumptions": [
"Supabase is the permanent data backend, but local markdown fallback is retained for offline development via queryFn fallback.",
"Post markdown content keeps dangerouslySetInnerHTML with DOMPurify sanitization added. Author-controlled content; react-markdown conversion is out of scope.",
"Assorted page content is intentionally static \u2014 converted to JSX with hardcoded data, not moved to Supabase.",
"Home dashboard card data remains code-defined \u2014 typed data array, not a fetch pattern.",
"Chart.js CDN loading was expedient \u2014 bundling via npm with dynamic import code-splitting is acceptable.",
"The CSS megaplan executes independently. This plan shares Phase 0 test infrastructure.",
"The DOM contract audit in Step 2 will be exhaustive \u2014 IDs, data-position, ordinal selectors, placeholder text, heading text beyond the 48 CSS classes.",
"Feather icons replacement (6 icons via lucide-react) is in scope because removing the CDN script tag is part of proper engineering.",
"window. (Supabase URL + anon key) is configuration and stays. Only window. is replaced.",
"TypeScript strict mode enablement is out of scope."
],
"structure_warnings": [
"Each section should include at least one numbered substep."
],
"delta_from_previous_percent": 80.78
}
code
Plan structure warnings from validator:
[
"Each ## Step N: section should include at least one numbered substep."
]
code
Existing flags:
[
{
"id": "incomplete_dom_contract",
"concern": "The plan treats the 48 frozen CSS classes as the main preservation boundary, but the actual legacy layer depends on more than classes: specific IDs, DOM order, magic data-position values, and even placeholder text. If those contracts are not cataloged before Phase 1, the site can regress while legacy JS is still running.",
"status": "addressed",
"severity": "significant"
},
{
"id": "home_first_sequencing",
"concern": "Starting Phase 1 with the home page is the highest-risk ordering, not the safest way to surface issues. Home is where almost all imperative behavior is concentrated, so changing it first while initLegacyExperience() still runs makes the plan's 'each phase independently deployable' goal much harder to satisfy.",
"status": "addressed",
"severity": "significant"
},
{
"id": "nondeterministic_visual_baseline",
"concern": "Phase 0's zero-diff visual baseline is underspecified for this repo. Without a deterministic fixture strategy for remote assets, live Supabase data, and autoplaying/animated surfaces, Playwright screenshot gating will be flaky enough to block the rest of the plan.",
"status": "addressed",
"severity": "significant"
},
{
"id": "markdown_not_sanitized",
"concern": "Phase 1G's rationale says post content is 'sanitized markdown', but that is not true in the repository. Keeping dangerouslySetInnerHTML for posts may still be an acceptable tradeoff, but the current justification is factually wrong and hides a real security boundary.",
"status": "addressed",
"severity": "significant"
},
{
"id": "phase3_bootstrap_contract",
"concern": "Phase 3 treats removing window.__INITIAL_DATA__ as a data-layer cleanup, but in this repo it is also part of the SSR routing/bootstrap contract. Deleting it requires route-state refactors outside React Query, and the plan also assumes away the existing local-posts fallback that is still wired into production paths.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope_creep_icon_library_swap",
"concern": "Scope creep: replacing feather-icons with react-feather or lucide-react is extra migration churn that is not required to achieve the stated React/SSR/data-layer cleanup goals.",
"status": "open",
"severity": "minor"
}
]
code
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered `## Step N:` sections with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`. Missing structure should be flagged as category `completeness` with severity_hint `likely-significant`.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
src/server.ts:99-109
getPosts()
getPostPage()
src/lib/posts.ts:32-92
page.route()
src/legacy/script.ts:1760-1880
setupVideoSwap()
.square-image-container
assets/how-wife-sees-me.mp4
assets/how-i-see-me.mp4
assets/how-dog-sees-me.mp4
src/data/home.ts:5-15
lucide-react
src/data/home.ts:25
src/data/home.ts:28
src/data/home.ts:32
src/data/home.ts:83
feather.replace()
src/legacy/script.ts:6-8
You are an independent reviewer. Critique the plan against the actual repository.
Convert the website from its current 'working but duct-taped' state into a properly engineered React 19 app. Phase 1: Convert all dangerouslySetInnerHTML surfaces (HOME_BODY_HTML, assorted pages) into proper React JSX components. Phase 2: Replace the legacy script.ts (2000+ lines of imperative DOM manipulation) with idiomatic React hooks and components — card expansion, filter system, video player lifecycle, FLIP animations, scroll effects, POM border interactions, plant animation, weights chart. Phase 3: Add a proper data layer with React Query + Supabase client, replacing the split SSR/client fetch pattern. Phase 4: Re-enable React StrictMode. The existing visual design and all interactive behaviors must be preserved pixel-perfectly throughout.
User notes and answers:
Run autonomously through the full critique loop. User wants a well-engineered plan, not a quick fix. This is planning only — do not execute. Key context: the site was just migrated from vanilla JS to React 19 + Vite + TypeScript + Supabase. The migration preserved all content/style but left significant technical debt: raw HTML strings rendered via dangerouslySetInnerHTML, 2000+ lines of legacy imperative DOM JS running via useEffect, no React data layer, StrictMode disabled. The CSS/Tailwind megaplan (plan: design-a-sensible-well-20260323-0631) identified 48 frozen CSS classes coupled to legacy JS — those constraints apply here too. Posts and measurements are in Supabase. Assets are in Supabase Storage.
Convert the site from its "working but duct-taped" post-migration state into a properly engineered React 19 app across four phases: (1) convert dangerouslySetInnerHTML surfaces to JSX, (2) replace ~3,077 lines of legacy imperative DOM JS with React hooks/components, (3) add React Query + Supabase client data layer, (4) re-enable StrictMode.
Current state: React 19.2 + Vite 7.2 + TypeScript + Express SSR. Content/style preserved from vanilla JS migration but with raw HTML strings via dangerouslySetInnerHTML, legacy imperative JS running via useEffect on every route change, no React data layer, StrictMode disabled on client.
Key constraints:
48 frozen CSS classes coupled to legacy JS (documented in CSS megaplan Step 0.3)
Additional DOM contracts beyond classes: element IDs, data-position values, ordinal selectors, placeholder text (cataloged in Step 2 below)
The CSS/Tailwind megaplan (design-a-sensible-well-20260323-0631) executes independently; this plan shares Phase 0 test infrastructure
Pixel-perfect visual preservation verified by Playwright at every step
Repository shape:
src/data/home.ts (219 lines) — raw HTML string for home page
src/data/assorted.ts (~12K tokens) — raw HTML strings for 6 assorted routes
Add interactive state captures: card hover/expand, filter toggle, video overlay click, POM letter click sequence, square-image video swap click.
Implement deterministic fixture strategy — both server-side and browser-side:
Server-side data determinism:
The Playwright test server (npm run dev or a test-specific start command) must produce deterministic SSR HTML. Routes /posts and /posts/:slug are populated by server-side fetches in src/server.ts:99-109 calling getPosts()/getPostPage(), which hit Supabase or fall back to local markdown (src/lib/posts.ts:69-92).
Fix: Launch the Playwright test server with VITE_SUPABASE_URL= and VITE_SUPABASE_ANON_KEY= unset (empty strings). This triggers the existing local-posts fallback path in src/lib/posts.ts, making SSR render from the frozen posts/*.md files already committed to the repo. No Supabase calls during SSR = deterministic HTML.
Add a test:visual:server script or Playwright webServer config that starts the dev server with these env overrides.
Browser-side interception via page.route():
Supabase REST API (/rest/v1/posts, /rest/v1/measurements): Intercept client-side fetches, return frozen JSON from e2e/fixtures/. Capture once from live, then freeze.
Supabase Storage images (ddbobialzdjkzainyqgb.supabase.co/storage/v1/object/public/assets/*): Intercept, serve from e2e/fixtures/assets/. Download each referenced image once.
YouTube/Vimeo iframes: Block in screenshot tests (nondeterministic). Test video overlay separately via iframe src assertion.
Chart.js canvas: Mask #weights-chart-container in screenshot comparisons (subpixel nondeterminism). Test chart behavior functionally (zoom buttons, tooltip content).
Animations/transitions: Inject * { animation-duration: 0s !important; transition-duration: 0s !important; } via addStyleTag before capture.
Gate: All baseline screenshots pass with deterministic server + mocked browser network before any code changes.
Step 2: DOM Contract Audit (src/contracts/dom-contracts.ts, e2e/dom-contracts.spec.ts)
Scope: Small
The 48 frozen CSS classes are necessary but not sufficient. Legacy JS also depends on element IDs, data-* attribute values, ordinal selectors, and placeholder text. This step catalogs everything.
Scan all 4 files in src/legacy/ for every DOM query/mutation beyond class names:
Createsrc/contracts/dom-contracts.ts — typed manifest of all contracts.
Createe2e/dom-contracts.spec.ts — loads home page, asserts every contract. Catches regressions that screenshots miss (e.g., missing data-position doesn't change pixels but breaks JS).
Lifecycle: Consumed during Steps 4-9 (JSX must emit matching DOM). Retired incrementally during Steps 10-21 (each legacy feature replacement removes its contracts). Deleted in Step 22.
Step 7: Convert Crypto Conversations to JSX (src/pages/CryptoConversations.tsx, src/pages/CryptoConversation.tsx)
Scope: Small
Convert index page and CONVERSATION_DETAILS object to JSX components.
FixCryptoConversationPage to use useParams() for conversation ID instead of relying solely on conversationId prop — removes a bootstrap dependency for Phase 3.
Step 8: Convert Mute List to JSX (src/pages/MuteList.tsx)
Scope: Small
ConvertMUTE_LIST_HTML to JSX. Simple content page.
After this step: delete src/data/assorted.ts and RawSectionPage.tsx (all consumers converted).
Step 9: Convert Home Dashboard to JSX (src/pages/Home.tsx, src/components/home/)
Scope: Large — highest risk in Phase 1, done last
This is where all imperative behavior concentrates. The JSX must produce structurally identical DOM so initLegacyExperience() continues working.
Create components:
src/components/home/SquareImages.tsx — three hover images with text overlays
src/components/home/SocialLinks.tsx — social icon links + watering can + initial bud
Validation:e2e/dom-contracts.spec.ts passes (all contracts hold). test:visual zero diff. Per-component tests assert className and data attributes.
Step 9.5: Add DOMPurify to Markdown Rendering (src/lib/markdown.ts)
Scope: Small
Post content rendered by marked.parse() is not sanitized — src/lib/markdown.ts only does URL rewriting and video attribute injection. While post markdown is author-controlled (committed to repo or authored via Supabase dashboard with service-role access), the security boundary should be explicit.
Installisomorphic-dompurify (works in both Node SSR and browser).
Add sanitization to renderMarkdown():
typescript
import DOMPurify from 'isomorphic-dompurify';
// ...after marked.parse() and URL rewriting:
return DOMPurify.sanitize(html, {
ADD_TAGS: ['iframe'],
ADD_ATTR: ['allowfullscreen', 'playsinline', 'allow']
});
Update client-side marked() call in Post.tsx to also sanitize.
Post content retains dangerouslySetInnerHTML — acceptable tradeoff given author-controlled content and now-explicit sanitization. Converting to react-markdown is out of scope.
Validation: Existing post pages render identically. test:visual zero diff on /posts/:slug routes.
Step 10: Shared Hooks Infrastructure (src/hooks/)
Scope: Medium
Begin Phase 2: replacing legacy imperative JS with React.
Scope: Medium — replaces script.ts lines 272-360, 621-650, and 1758-1881
CreateuseImageHover hook for grayscale/scale transitions.
UpdateSquareImages.tsx with hover state, mobile-active toggling.
Add square-image video swap to SquareImages.tsx: each of the three portrait tiles supports click/tap to swap from still image to local MP4 video, then auto-revert on video end. This replaces setupVideoSwap() from script.ts:1760-1881.
Each SquareImage component receives a videoSrc prop and optional startTime (the three tiles map to assets/how-wife-sees-me.mp4 at 0.6s, assets/how-i-see-me.mp4 at 0.7s, assets/how-dog-sees-me.mp4 at 0.2s).
Local state: isVideoPlaying boolean. On click, hide <img>, show <video>, call play(). On ended event, revert to image.
Preload <video> element on mount (hidden, preload="auto"), seek to startTime on loadedmetadata.
The .has-video class is applied via React conditional className (no longer dynamically added by legacy JS).
Scope: Large — replaces weights-chart.ts (746 lines)
Create React wrapper around Chart.js.
Lazy-load Chart.js + plugins via dynamic import() (code-split into own chunk, replaces CDN).
Manage BMI calculation and title update in React state (replaces direct DOM mutation of #weights-title and {calculate based on last measurement} placeholder).
Fetch data via React Query (Step 25) or local fetch as interim.
Proper cleanup: chart.destroy(), disconnect observers on unmount.
Createsrc/lib/query-client.ts — QueryClient with staleTime: 5min, gcTime: 30min.
Wrap app in <QueryClientProvider> in both entry-client.tsx and entry-server.tsx.
Step 24: SSR Hydration Migration (src/server.ts, src/entry-client.tsx)
Scope: Large
window.__INITIAL_DATA__ is not just a data dump — it's part of the SSR routing contract: App.tsx passes it as props, entry-client.tsx reads it on hydration, server.ts builds it per request. Migration in three deployable sub-steps:
24a — Add React Query alongside existing pattern:
Server creates per-request QueryClient, prefetches route data via prefetchQuery().
dehydrate(queryClient) injected as window.__REACT_QUERY_STATE__ (NEW, alongside existing __INITIAL_DATA__).
Client wraps app in <HydrationBoundary>. Both patterns coexist. Deploy gate: site works identically.
24b — Migrate pages one at a time (Step 25):
Each page switches from initialData prop to React Query hook.
Deletesrc/lib/posts.ts (SSR fetch logic — replaced by React Query prefetch).
Deletesrc/lib/supabase.ts (raw REST helper — replaced by @supabase/supabase-js).
Retainsrc/lib/local-posts.ts — wire as fallback queryFn in usePosts/usePost (try Supabase, fall back to local markdown on error). Preserves offline dev capability.
RemoveInitialData type.
Validation: No raw fetch() for data in any component. SSR curl localhost:3000/posts returns full HTML. Client navigation between cached pages is instant.
Add<React.StrictMode> wrapper in entry-client.tsx around BrowserRouter + HydratedApp.
Fix double-mount issues surfaced by dev-mode remount:
PlantCanvas: cleanup tears down animation loop, clears canvas, resets arrays
WeightsChart: chart.destroy() on cleanup
SquareImages video elements: pause and reset on cleanup
All event listeners in useEffect with cleanup returns
All observers disconnect on cleanup
React Query: already StrictMode-compatible
Validation: No console warnings about missing cleanup. Dev mode: no visual glitches from double-mount. Prod mode: test:visual passes.
Execution Order
Phase 0 — Test Infrastructure (Steps 1-3): Must complete before any code changes. Step 2 (DOM contract audit) is the safety net for all subsequent work.
Phase 1 — JSX Conversion (Steps 4-9.5):
Steps 4-8 (assorted pages) — zero risk, can parallelize. Do first.
Step 9 (home dashboard) — highest risk, do last with full DOM contract verification.
Step 9.5 (DOMPurify) — small, independent, can slot anywhere in Phase 1.
Phase 2 — Legacy JS Replacement (Steps 10-22):
Step 10 (shared hooks) first — foundation for everything else.
Steps 11-14 (leaf behaviors) — no inter-dependencies. Step 14 includes the square-image video swap.
"version": 3,
"timestamp": "2026-03-23T06:55:15Z",
"hash": "sha256:03d3b0cb5f702d7f6d51619b4d5c67db0e4a4465a72887a68ae9d1807b34fd7f",
"changes_summary": "v2 \u2192 v3 changes addressing 2 remaining significant flags:\n\n1. nondeterministic_visual_baseline (SSR path) \u2192 Step 1 now has a two-layer determinism strategy: (a) Server-side: launch the Playwright test server with VITE_SUPABASE_URL= and VITE_SUPABASE_ANON_KEY= unset, which triggers the existing local-posts fallback in src/lib/posts.ts:69-92, making SSR render from frozen posts/*.md files committed to the repo. Added test:visual:server script or Playwright webServer config with these env overrides. (b) Browser-side: existing page.route() interception for client-side fetches (unchanged from v2). The risk register entry for flaky screenshots now explicitly calls out both layers.\n\n2. missing_square_image_video_swap \u2192 Step 14 expanded from "Image Hover Effects" to "Image Hover Effects + Square-Image Video Swap". Now explicitly covers setupVideoSwap() from script.ts:1760-1881: each SquareImage component receives videoSrc and startTime props mapping to the three MP4s (how-wife-sees-me.mp4 at 0.6s, how-i-see-me.mp4 at 0.7s, how-dog-sees-me.mp4 at 0.2s). Describes the click-to-swap interaction, video preload strategy, ended-event revert, and .has-video class management. Step 2 (DOM contract audit) now includes video swap assets. Step 27 (StrictMode) now includes video element cleanup. Added square-image video swap risk to the risk register.",
"flags_addressed": [
"nondeterministic_visual_baseline",
"missing_square_image_video_swap"
],
"questions": [
"Local markdown fallback: The plan retains local-posts.ts as a queryFn fallback for offline dev and also uses it for deterministic Playwright SSR. Is this the right tradeoff, or should Supabase be required for all environments?",
"Home dashboard card data: Cards are hardcoded HTML today, converted to a typed code array. Should this eventually come from Supabase/CMS, or remain code-defined?",
"DOMPurify server-side: isomorphic-dompurify adds jsdom as transitive dependency (~2MB). Alternative: sanitize client-side only, trust server-rendered author-controlled content. Preference?"
],
"success_criteria": [
"Zero dangerouslySetInnerHTML on non-markdown surfaces: Home, Assorted, Accountability, Projects, Crypto Conversations, and Mute List render via JSX.",
"src/legacy/ directory deleted: All 3,077 lines of imperative DOM manipulation replaced with React hooks and components.",
"src/data/home.ts and src/data/assorted.ts deleted: No raw HTML template strings in the codebase.",
"No CDN script tags for runtime libraries: feather-icons, Chart.js, chartjs plugins, and Supabase client bundled via npm.",
"DOM contract manifest fully verified during Phase 1 (IDs, data-attributes, ordinal selectors, text contracts, video swap assets, CSS classes), retired incrementally during Phase 2.",
"Playwright visual regression zero diff: All 9 routes x 4 viewports with deterministic fixtures (local-posts fallback for SSR, page.route() mocking for browser, masked canvas, disabled animations).",
"All interactive behaviors preserved: Card expansion, filter FLIP, video lazy-load, POM letters, plant animation, weights chart, projects popup, scroll borders, square-image MP4 video swap \u2014 Playwright interaction tests.",
"React Query caching active: Navigation between /posts and /posts/:slug does not re-fetch.",
"SSR produces full HTML: curl localhost:3000/posts returns content, not skeletons.",
"React StrictMode enabled on client with no console warnings or visual glitches in dev mode.",
"No window. pattern: Data flows through React Query dehydrate/HydrationBoundary. window. retained.",
"Each step independently deployable: Site works correctly after any step completes.",
"Markdown rendering sanitized: renderMarkdown() applies DOMPurify before dangerouslySetInnerHTML.",
"All route pages use useParams() for URL parameters: No page depends solely on prop-passing for route state."
],
"assumptions": [
"Supabase is the permanent data backend, but local markdown fallback is retained for offline development via queryFn fallback.",
"Post markdown content keeps dangerouslySetInnerHTML with DOMPurify sanitization added. Author-controlled content; react-markdown conversion is out of scope.",
"Assorted page content is intentionally static \u2014 converted to JSX with hardcoded data, not moved to Supabase.",
"Home dashboard card data remains code-defined \u2014 typed data array, not a fetch pattern.",
"Chart.js CDN loading was expedient \u2014 bundling via npm with dynamic import code-splitting is acceptable.",
"The CSS megaplan executes independently. This plan shares Phase 0 test infrastructure.",
"The DOM contract audit in Step 2 will be exhaustive \u2014 IDs, data-position, ordinal selectors, placeholder text, heading text, video swap assets beyond the 48 CSS classes.",
"Feather icons replacement (6 icons via lucide-react) is in scope because removing the CDN script tag is part of proper engineering.",
"window. (Supabase URL + anon key) is configuration and stays. Only window. is replaced.",
"TypeScript strict mode enablement is out of scope.",
"Running the Playwright test server without Supabase env vars triggers the local-posts fallback, producing deterministic SSR HTML from committed markdown files."
],
"structure_warnings": [
"Each section should include at least one numbered substep."
],
"delta_from_previous_percent": 5.79
}
code
Plan structure warnings from validator:
[
"Each ## Step N: section should include at least one numbered substep."
]
code
Existing flags:
[
{
"id": "nondeterministic_visual_baseline",
"concern": "The screenshot-fixture plan is still incomplete for this SSR app. page.route() will only intercept browser-side requests, but /posts and /posts/:slug are populated by server-side fetches before the page ever reaches Playwright, so those baselines can still drift with live data.",
"status": "addressed",
"severity": "significant"
},
{
"id": "scope_creep_icon_library_swap",
"concern": "Scope creep: the plan still introduces lucide-react for icon replacement even though the repository only uses a handful of feather placeholders, and removing the CDN dependency does not require adopting a new icon library.",
"status": "open",
"severity": "minor"
},
{
"id": "missing_square_image_video_swap",
"concern": "The plan still misses one current home interaction: each of the three square portrait tiles can be clicked/tapped to swap from a still image into a local MP4. Step 14 only covers hover/mobile-active image behavior, and Step 15 only covers the YouTube card lifecycle, so this behavior would be lost.",
"status": "addressed",
"severity": "significant"
}
]
code
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered `## Step N:` sections with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`. Missing structure should be flagged as category `completeness` with severity_hint `likely-significant`.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
feather.replace()
src/legacy/script.ts:6-8
Not yet included in a published release.
INITIAL_DATA
APP_CONFIG
APP_CONFIG
INITIAL_DATA
## Step N:
Stagger loading: Wait for all .loading-element to have .loaded class before capture.
Createe2e/update-fixtures.ts — manual script to refresh browser-side fixtures from live data when content changes.
Commit baseline screenshots to e2e/__screenshots__/.
Addtest:visual and test:visual:update scripts to package.json.