diff --git a/aidlc-docs/features/prerendering/aidlc-state.md b/aidlc-docs/features/prerendering/aidlc-state.md index dca25fa..0e430d1 100644 --- a/aidlc-docs/features/prerendering/aidlc-state.md +++ b/aidlc-docs/features/prerendering/aidlc-state.md @@ -5,7 +5,7 @@ - **Feature Slug**: prerendering - **Project Type**: Brownfield - **Start Date**: 2026-10-31T14:15:01Z -- **Current Stage**: CONSTRUCTION - Code Generation (unit 2: display-fallbacks): plan approved; batch B0 running +- **Current Stage**: CONSTRUCTION - Code Generation (unit 2: display-fallbacks): B0 and B1 done; B2, B3 and B4 running - **Branch**: feature/prerendering (from master c4c2f83); commits and pushes allowed for this feature (owner, 2026-10-31) - **Worktree**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-prerendering diff --git a/aidlc-docs/features/prerendering/construction/display-fallbacks/code/baseline-checks.md b/aidlc-docs/features/prerendering/construction/display-fallbacks/code/baseline-checks.md new file mode 100644 index 0000000..216bb62 --- /dev/null +++ b/aidlc-docs/features/prerendering/construction/display-fallbacks/code/baseline-checks.md @@ -0,0 +1,23 @@ +# Baseline checks: display fallbacks (unit 2), Step 1 + +- Commit: `4139c8f732f3861be48469b6b0bfe700c44389be` +- Branch: `feature/prerendering` (checked, matches) +- Date: 2026-10-31 (test run started 22:44, e2e started 22:45) +- Node: v24.16.0; pnpm: 12.11.2 +- `git status --short` before the run: empty output (clean tree) + +## Results + +| Command | Result | +|---|---| +| `pnpm lint` | ESLint: No issues found (exit 0) | +| `pnpm format:check` | All matched files use Prettier code style (exit 0) | +| `pnpm test` | 123 test files passed (123), 1179 tests passed (1179); coverage: statements 96.04 %, branches 94.14 %, functions 97.38 %, lines 96.53 % (exit 0) | +| `pnpm build && pnpm e2e` | Build: 12 pages prerendered, 16 inline scripts moved, 28 files written (exit 0). e2e: 4 test files passed (4), 77 tests passed (77) | + +fast-check seed of the baseline `pnpm test` run: `915664407` +(`FC_SEED=915664407 pnpm test` replays it). + +Logs (outside the repository): `%TEMP%\prerendering-b0-test.log`, `%TEMP%\prerendering-b0-build.log`, `%TEMP%\prerendering-b0-build2.log`, `%TEMP%\prerendering-b0-e2e.log`. + +e2e files: `e2e/hydration.e2e.ts`, `e2e/interaction.e2e.ts`, `e2e/rawHtml.e2e.ts`, `e2e/smoke.e2e.ts`. diff --git a/aidlc-docs/features/prerendering/construction/display-fallbacks/code/proof-report.md b/aidlc-docs/features/prerendering/construction/display-fallbacks/code/proof-report.md new file mode 100644 index 0000000..a320013 --- /dev/null +++ b/aidlc-docs/features/prerendering/construction/display-fallbacks/code/proof-report.md @@ -0,0 +1,25 @@ +# Proof report: display fallbacks, early proofs + +Details and evidence per point: [verification-log.md](verification-log.md). + +## Outcomes + +- **V-D1 OK.** `Reveal` with a layout effect hydrates cleanly under StrictMode (unit test) and in Chrome: elements in view stay at opacity 1 in every frame, elements below the fold go to 0 after hydration without an intermediate value, reduced motion hides nothing. The `/portfolio` grid on a phone is now visible. +- **V-D2 OK.** With JavaScript on the noscript twin is never requested: requested URLs equal the displayed photos, each once; Emotion writes the shared class once. +- **V-D3 OK for head and twin.** The `noscript` with the CSS stays in the head, the browser holds the same number of `noscript` elements as the HTML, no hydration error. Header and panel are settled with the menu links. Without JavaScript every shown image has loaded and every empty deferred image is `display: none`. +- **V-D13 OK.** The `` tiles keep their box to the pixel at six widths, hover zoom and focus ring work, 1, 2 and 3 grid photos load before `load` at phone, tablet and desktop, each photo once, no hydration error. Router link types accept `media` and `fetchPriority`. + +## Files changed so far + +New: `web/src/lib/revealPhase.ts`, `web/src/lib/firstRow.ts`, `web/src/components/NoScript/noScriptCss.ts`, `web/src/components/NoScript/NoScriptStyles.tsx`, `web/src/displayHydration.test.tsx`. +Changed: `web/src/hooks/useReveal.ts`, `web/src/components/Reveal/Reveal.tsx`, `web/src/components/DeferredImage/DeferredImage.tsx`, `web/src/routes/__root.tsx`, `web/src/seo.ts`, `web/src/components/PortfolioGrid/PortfolioGrid.tsx`, `web/src/components/portfolio/PortfolioGallery/PortfolioGallery.tsx`, `web/src/routes/portfolio.tsx`, `web/src/components/PortfolioGrid/PortfolioGrid.test.tsx` (one line, see below). + +## Deviations from the design + +- `PortfolioGrid.test.tsx`: `eagerCount={3}` became `eagerFirstRow`, only so `tsc` and `pnpm build` compile (the build runs `tsc` over the tests). Its assertions are untouched and still pass; Step 14 rewrites the test. +- `firstRow.ts` imports `preloadImage` from `../seo.ts` (relative with `.ts`, like the other files in `src/lib`) instead of `@/seo`. +- `PortfolioGrid` keeps its literal `gridTemplateColumns` (as the step says); `GRID_COLUMNS` is a parallel constant with the same values. + +## Checks + +`tsc --noEmit`, `pnpm lint`, `pnpm format:check` (src), `pnpm build` green. `pnpm test`: 124 files, 1180 tests, 5 failures, all in tests named in the plan: four `useReveal.test.tsx` cases and `PortfolioGallery.test.tsx` ("none eager"). diff --git a/aidlc-docs/features/prerendering/construction/display-fallbacks/code/verification-log.md b/aidlc-docs/features/prerendering/construction/display-fallbacks/code/verification-log.md new file mode 100644 index 0000000..381eb8e1 --- /dev/null +++ b/aidlc-docs/features/prerendering/construction/display-fallbacks/code/verification-log.md @@ -0,0 +1,21 @@ +# Verification log: display fallbacks (unit 2) + +Status values: `open` (not yet settled), `OK`, `BLOCKED`, `DEVIATION`. + +| V-D# | Point | Step | Outcome | Evidence | Status | +|---|---|---|---|---|---| +| V-D1 | `useLayoutEffect` in `Reveal` during `renderToString`, `hydrateRoot` and StrictMode (double effect): no warning, no mismatch, the hide step runs once visibly. | 2 | No warning, no mismatch, hide step visible once. | Unit test src/displayHydration.test.tsx (hydrate() under StrictMode, rectangles stubbed): no recoverable error, in-view Reveal stays visible, below-the-fold becomes hidden after hydration and visible after the fake observer fires; no console warning in the run. Browser probe on the built site (rAF sampling of getComputedStyle opacity from the first frame, 2.5 s; /over-mij, /soorten-fotoshoots, /portfolio at 412x823; /, /over-mij at 1350x940; / at 412x823): elements in view at the first sample (2, 2, 1, 0, 2, 0 of 5, 11, 3, 14, 5, 14) were 1 in every frame; elements below the fold (3, 9, 2, 14, 3, 14) ended hidden with opacity values only 0 or 1, never an intermediate value; no console error or warning. /soorten-fotoshoots: first frame with a 0 is frame 16 of 456 (the hide happens after hydration, no transition). reducedMotion reduce (/ and /over-mij at 412x823, /soorten-fotoshoots): every sample 1, nothing hidden. /portfolio grid wrapper at 412x823 now stays visible (the BR-RVL-13 defect). | OK | +| V-D2 | With JavaScript on, the twin image is never requested (request log on `/soorten-fotoshoots` and `/portfolio` before any scroll), and the preload scanner does not read inside `noscript`. Also that Emotion writes the shared class once (one ` + + ); +} diff --git a/web/src/components/NoScript/noScriptCss.ts b/web/src/components/NoScript/noScriptCss.ts new file mode 100644 index 0000000..2377480 --- /dev/null +++ b/web/src/components/NoScript/noScriptCss.ts @@ -0,0 +1,10 @@ +// The CSS of every fallback for a visitor without JavaScript. It sits in a +//