Applies the owner's Lighthouse targets

Three pages no longer need an exception and the homepage target rises to its
measured score, so the gain cannot slip away unnoticed. Also adds the third
unit's code summary and updates the shared docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 20:07:24 +01:00
co-authored by Claude Opus 5.5
parent 498be43020
commit b6d5a85e41
12 changed files with 181 additions and 44 deletions
@@ -123,7 +123,7 @@ Text alternative: client.tsx starts Sentry and hydrates the prerendered page (pr
### config/ (build-time, Node)
- **Purpose**: Server configuration as code
- **Responsibilities**: `securityHeaders.ts` (CSP + headers for dev/preview/prod), `serverConfig.ts` (generates `deploy/iis/web.config` and nginx confs; a test checks they are in sync), sitemap plugin, test seed; prerendering adds `pageFiles.ts`, `inlineScripts.ts`, `externalizeInlineScripts.ts` (post-build step: moves inline scripts to `/assets/inline-<hash>.js` so the CSP stays) and `previewServer.ts` (serves `dist/client` with the real server rules, 404 for unknown paths)
- **Responsibilities**: `securityHeaders.ts` (CSP + headers for dev/preview/prod), `serverConfig.ts` (generates `deploy/iis/web.config` and nginx confs; a test checks they are in sync), sitemap plugin, test seed; prerendering adds `pageFiles.ts`, `inlineScripts.ts`, `externalizeInlineScripts.ts` (post-build step: moves inline scripts to `/assets/inline-<hash>.js` so the CSP stays) and `previewServer.ts` (serves `dist/client` with the real server rules, 404 for unknown paths; unit 3 of prerendering: also the 301 redirects of `canonicalUrls.ts` and the opt-in `--audit-route`, which serves the 404 page with 200 at `/__audit/404` for Lighthouse only); unit 3 adds `canonicalUrls.ts` (one page list for the URL contract) and `compressibleTypes.ts` (one type list for gzip and the IIS MIME pins)
- **Type**: Infrastructure-as-code (small)
### theme.ts / recipes/
@@ -159,6 +159,6 @@ Text alternative: a visitor navigates, the router renders the root layout (AppSh
## Infrastructure Components
- **IaC**: None beyond generated web server configs in `web/deploy/`
- **Deployment Model**: Static prerendered build (prerendering: `dist/client` holds one HTML file per page plus `404.html`; `dist/server` is not deployed; server rules still to be changed in unit 3 of prerendering). Test: scp to nginx on a Raspberry Pi (auto on push to master). Production: FTPS to an IIS webhost (manual, `release/*` only, after Lighthouse)
- **Deployment Model**: Static prerendered build (prerendering: `dist/client` holds one HTML file per page plus `404.html`; `dist/server` is not deployed; unit 3 of prerendering: one URL contract on nginx, IIS and the preview server: `/x` serves `x.html` with 200, variants of a known page get one 301 to the canonical path with the query kept, unknown URLs and `/404`, `/404.html` give a real 404; the generated nginx block has its own gzip configuration; production upload in three passes (assets, then all HTML and `web.config`, then deletion of stale files, `deploy/upload-production.sh`) after `deploy/check-artifact.sh`; `deploy/verify-deployment.sh` checks the result after a deploy; the IIS rules are generated as text and are unverified until a host exists). Test: scp to nginx on a Raspberry Pi (auto on push to master). Production: FTPS to an IIS webhost (manual, `release/*` only, after Lighthouse)
- **Security headers**: Strict CSP — `script-src 'self'` + Umami, `connect-src 'self'` + Umami + Sentry, **`form-action 'self'`**, `frame-ancestors 'none'`. Any third-party form or script endpoint must be added here (and regenerated into the server configs)
- **Networking**: N/A
@@ -5,7 +5,7 @@
- **Unit Tests**: Pure helpers, SEO, sitemap, monitoring config, security headers, server config (incl. drift check against `deploy/`)
- **Component Tests**: AppShell, NavigationBar, Footer, Hero (+ slider hook), BackToTop, PageIntro, StatusPage, Umami, all home sections, PageSection, MediaText, Eyebrow, SectionHeading, FramedImage, DeferredImage, Reveal, NoScript CSS and menu links, first-row grid (display fallbacks; also `displayHydration`, `displayPrerender` and the e2e files `displayHtml`, `noJs`, `noJsMenu`, `reveal`, `images`), ContactForm(+Gate) — with axe accessibility checks; `app.test.tsx` renders whole routes
- **Property-based Tests**: fast-check, shared arbitraries in `src/test/arbitraries.ts`, seed logged in CI
- **Integration / E2E**: No browser E2E; Lighthouse CI covers built pages (accessibility, best practices, SEO, performance)
- **Integration / E2E**: Browser tests on `dist/client` (`pnpm e2e`); unit 3 of prerendering adds a real nginx test in CI (the generated block against the preview server, the `lighthouse` job installs nginx and lftp and fails when nginx is missing); Lighthouse CI covers built pages (accessibility, best practices, SEO, performance), the not-found page through `/__audit/404`
## Code Quality Indicators
- **Linting**: ESLint (typescript-eslint, react-hooks, jsx-a11y), enforced in CI
@@ -13,7 +13,8 @@
- **Documentation**: Short Dutch comments explaining *why*, often referencing requirement IDs (FR-xx, BR-xx, NFR-xx, Mx) from earlier AI-DLC features
## Technical Debt
- Homepage mobile Lighthouse performance target is lowered to 0.8 (images not responsive, title after JavaScript); back to 0.9 is planned with responsive images from the API and prerendering
- Mobile Lighthouse performance exceptions (owner decision 2026-11-01, after the final measurement of prerendering): floor 0.85 for `/` (measured 0.85, raised from 0.8), gezin (0.89) and loveshoot (0.88) until responsive photos exist, and for zwangerschap and portret (both ~0.90, unreliable as a target with one run); all other pages must reach 0.9. Desktop is 0.9 everywhere
- IIS rules are generated but unverified until a host exists; the nginx proof runs on nginx 1.24 in CI, the Pi runs 1.30
- Four routes are placeholders (`noindex`); `lighthouserc.cjs` keeps its own list of indexed/noindex paths, guarded by a test against `sitePages.ts`
- No responsive image pipeline (srcset/sizes); photos are single JPEGs
- Comment language is mixed: older code is commented in Dutch, homepage-sections code in English
@@ -8,7 +8,7 @@
- `web/tsconfig.json` — bundler mode, `@/*` → `src/*`
- `web/eslint.config.js` — JS + typescript-eslint + react-hooks + jsx-a11y recommended
- `web/.prettierrc` — 4 spaces, single quotes, semicolons
- `web/lighthouserc.cjs` / `.desktop.cjs` — Lighthouse CI against `pnpm preview` (accessibility and best practices 1.0, performance 0.9; home mobile 0.8)
- `web/lighthouserc.cjs` / `.desktop.cjs` — Lighthouse CI against `pnpm preview` (accessibility and best practices 1.0, performance 0.9; mobile exceptions in a table with a recorded decision per page, 0.85 for `/`, zwangerschap, gezin, loveshoot and portret; the not-found page is audited through `/__audit/404`)
- `.gitea/workflows/continuous_integration.yaml` — jobs `check`, `deploy-test`, `lighthouse`, `deploy-production`
## Key Classes/Modules
@@ -106,15 +106,16 @@ Candidates for modification are marked with ★ for the over-mij-page feature.
- `web/src/monitoring/*` — Sentry/Umami config and loader
- `web/src/navigation.ts` — `RoutePath`, `NavItem` (with `children`, one level), `hasChildren`, `mainNav` (the shoot submenu comes from `shootTypes` via `shootNavItems`), `footerNav`
- ★ `web/src/seo.ts` (+ `preloadImage`), `web/src/lib/{revealPhase,firstRow}.ts`, `sitePages.ts`, `sitemap.ts` — SEO (`/over-mij` is `indexed: false` today)
- ★ `web/lighthouserc.cjs` / `.desktop.cjs` — own list of indexed/noindex paths, guarded by a test
- ★ `web/lighthouserc.cjs` / `.desktop.cjs` — own list of indexed/noindex paths, guarded by a test; data-driven exception table (`mobileExceptions`) tested in `config/lighthouserc.test.ts`
- `web/src/theme.ts`, `web/src/recipes/*.ts` — design system
- `web/src/test/*` — `renderWithProviders`, axe matcher, fast-check arbitraries, `fakeIntersectionObserver`, setup
- `web/src/test/navArbitraries.ts` — navigation generators (menu events, menu states, pathnames; unit 3, not in `lib/` so the 100 % threshold does not apply); `web/src/test/navViewport.ts` — viewport helper (`matchMedia` stub and the `lg` display rules, because jsdom ignores `@media`)
- `web/src/assets/*` — hero photos (8), `home/` (intro 1–4, andrea, deco 1–2, two review photos), light/dark logos
- `web/config/securityHeaders.ts` — CSP
- `web/config/serverConfig.ts`, `writeServerConfig.ts`, `sitemapPlugin.ts`, `testSeed.ts`
- `web/config/{pageFiles,inlineScripts,externalizeInlineScripts,previewServer}.ts` — prerendering: page file names, moving inline scripts to files after the build, preview server with the real server rules; `web/e2e/` and `web/vitest.e2e.config.ts` — browser tests on `dist/client`
- `web/deploy/iis/web.config`, `web/deploy/nginx/*.conf` — generated server configs
- `web/config/{pageFiles,inlineScripts,externalizeInlineScripts,previewServer,canonicalUrls,compressibleTypes}.ts` — prerendering: page file names, moving inline scripts to files after the build, preview server with the real server rules; `web/e2e/` and `web/vitest.e2e.config.ts` — browser tests on `dist/client`
- `web/deploy/iis/web.config`, `web/deploy/nginx/*.conf` — generated server configs (unit 3: URL contract, gzip block); `web/deploy/{check-artifact,verify-deployment,upload-production}.sh` — artifact guard, post-deploy check, three-pass FTPS upload (unit 3)
- `web/e2e/{serverRules,deployScripts,urls}.e2e.ts`, `web/e2e/support/{fixtureSite,nginx}.ts`, `web/src/test/urlArbitraries.ts` — real-nginx tests and parity with the preview server, deploy script tests, URL behaviour in Chrome, URL generators (unit 3)
- `web/public/*` — favicon, logo, og-image, robots.txt, icons.svg; `og-{newborn,zwangerschap,gezin,loveshoot,portret}.jpg` (unit 2: 1200 × 630, the shoot pages' `ogImage`)
## Design Patterns
@@ -5,7 +5,7 @@
- **Feature Slug**: prerendering
- **Project Type**: Brownfield
- **Start Date**: 2026-10-31T14:15:01Z
- **Current Stage**: CONSTRUCTION - Code Generation (unit 3: hosting-and-targets): final measurement done; awaiting owner decisions per page
- **Current Stage**: CONSTRUCTION - Code Generation (unit 3: hosting-and-targets): all steps done; awaiting the nginx config on the Pi and a green CI run
- **Branch**: feature/prerendering (from master c4c2f83); commits and pushes allowed for this feature (owner, 2026-10-31); workflow dispatch without deploy allowed; deploy to test after all units (owner, 2026-11-01), after the nginx config is placed
- **Worktree**: K:\Development\SlpSoftware\Projects\AndreaSlopFotografie-prerendering
+12
View File
@@ -419,3 +419,15 @@
**Context**: Code Generation unit 3, step 6.
---
## Code Generation - Unit 3 Owner Decisions on Lighthouse Targets
**Timestamp**: 2026-11-01T19:30:00Z
**User Input**: (answers through the chat dialog: first question "Uitzondering 0,85 houden"; second question "Bij huidige score vastleggen")
**AI Response**: "Applied: /over-mij, /soorten-fotoshoots and newborn have no exception (0.9); zwangerschap and portret keep 0.85; / goes to 0.85; gezin and loveshoot stay 0.85. All 12 URLs pass lhci assert against the final measurement. The nginx config is final and goes to the Pi-Main session for a server-ops draft; the owner places it. Runs 595 and 596 failed on the PC runner: image pull fails with no policy.json. Not a code failure; the owner decides what to do with that runner."
**Context**: Code Generation unit 3.
---
@@ -0,0 +1,103 @@
# Code Summary - Unit 3: Hosting and targets
Plan: [hosting-and-targets-code-generation-plan.md](../../plans/hosting-and-targets-code-generation-plan.md). Worktree `AndreaSlopFotografie-prerendering`, branch `feature/prerendering`, on top of unit 2 (`88cc6ba`). File list from `git diff --name-status 88cc6ba HEAD -- web .gitea` plus the uncommitted Step 26 edits (see "Lighthouse targets").
## Status
- Steps 1 to 27 done (checked in the plan). Local verification after the owner's decisions: `pnpm lint`, `pnpm format:check`, `tsc --noEmit` clean; `pnpm test` green (counts below).
- Final measurement: [measurement-final.md](measurement-final.md) (3 runs, mobile and desktop, all 12 URLs); owner decisions are recorded at its end and applied in `web/lighthouserc.cjs`.
- **CI is not claimed here.** The last proofs quoted below come from older commits (runs 593 and 594). Run 595 was cut by a failure of the PC runner and a new run is in progress; the main session records the result for the latest commit.
## Commits
`4f32042` plan; `33334b8` nginx rules; `5ae1c5e`, `8cb9185`, `95e3c61`, `7166928` CI cycles and defects found by real nginx; `e4e7f8c` URL rules in preview, IIS config and deploy; `38708b8` preview against real nginx; `afd9923`, `6d4d012` upload and deploy hardening; `498be43` final measurement. The Step 26 and 27 changes (Lighthouse targets, documents) are to be filled by the main session.
## Files
### URL modules (BR-HST-01 to 08, 11; FR-PR-14, 16, 23)
- Created: `web/config/canonicalUrls.ts` (+ test), `web/config/compressibleTypes.ts`, `web/src/test/urlArbitraries.ts`.
### nginx generator (BR-HST-01 to 13; FR-PR-14, 16, 23)
- Modified: `web/config/serverConfig.ts` (+ test), generated `web/deploy/nginx/andreaslop-test.conf`: map-based rules, real 404 and no SPA fallback, own gzip block, header comment that fits the Pi.
### IIS generator (BR-HST-04, 07, 10, 19)
- Modified: `web/config/serverConfig.ts`, generated `web/deploy/iis/web.config`: rule order www, HTTPS, index, canonical page, trailing slash, `/404`, page file, directory without page; MIME pins from `compressibleTypes.ts`. Text only: unverified until a host exists.
### Preview server (BR-HST-01 to 08, 22; FR-PR-14, 16)
- Modified: `web/config/previewServer.ts` (+ test): `resolveRequest` returns a file or a 301 redirect, opt-in `--audit-route`; `web/e2e/support/server.ts` (`startServer({ auditRoute })`).
### Lighthouse (BR-HST-21 to 23; NFR-PR-P-01, P-02, S-01)
- Created: `web/config/lighthouserc.test.ts`.
- Modified: `web/lighthouserc.cjs` (data-driven exception table with a recorded decision, `buildIndexedEntries`, `validateExceptions`, not-found page through `/__audit/404`), `web/lighthouserc.d.cts`, `web/src/app.test.tsx` (the Lighthouse list test).
- `lighthouserc.desktop.cjs` is unchanged (performance 0.9 everywhere).
### Deploy scripts (BR-HST-14 to 18; FR-PR-17, 18)
- Created: `web/deploy/check-artifact.sh`, `verify-deployment.sh`, `upload-production.sh`.
### Workflow
- Modified: `.gitea/workflows/continuous_integration.yaml`: nginx and lftp install in the `lighthouse` job (with `CI=true` for Browsertests, so a missing nginx fails), artifact check before the test upload, `verify-deployment.sh --test` after it, `deploy-production` calls `upload-production.sh` and `verify-deployment.sh`. `deploy-production` stays dispatch-only (no host).
### Tests
- Created: `web/e2e/serverRules.e2e.ts` (nginx against the fixture site and `dist/client`, parity with the preview server, P-HST-09), `web/e2e/deployScripts.e2e.ts`, `web/e2e/urls.e2e.ts`, `web/e2e/support/{fixtureSite,nginx}.ts`.
- Modified: `web/e2e/{displayHtml,hydration,images,rawHtml}.e2e.ts`, `web/vitest.e2e.config.ts` (seed file), `web/src/hydration.test.tsx`, `web/src/test/navViewport.ts` (comment only).
### Documents
- `construction/hosting-and-targets/code/`: `baseline-checks.md`, `verification-log.md`, `measurement-final.md`, this file. Shared: `_shared/reverse-engineering/{architecture,code-structure,code-quality-assessment}.md` (line-level edits).
- Pointer for the human tasks: [pi-install-instructions.md](../infrastructure-design/pi-install-instructions.md) (unchanged by this unit).
### The `/404.html` fallback note
The temporary statement that Lighthouse audits `/404.html` (served with 200 by the preview) is gone from the live code and shared documents: the preview serves the 404 page with 200 only at `/__audit/404` and only with `--audit-route`; `/404.html` is a real 404. The shared documents held no such sentence (grep of `_shared`, `web/config`, `lighthouserc.cjs`, `src/app.test.tsx`: no remaining claim). The unit 1 and unit 2 documents keep their text as historical records.
## Lighthouse targets (NFR-PR-P-01; owner decisions of 2026-11-01)
Source: the final measurement (`measurement-final.md`, median of 3 runs, mobile). Effective targets in `lighthouserc.cjs` after the decisions, checked per URL (each URL matches exactly one assertion entry):
| URL | Mobile score (final) | Mobile target | Change |
|---|---|---|---|
| `/` | 0.85 | 0.85 | raised from 0.8; decision "bij de huidige score vastgelegd, tot responsive foto's (eigenaar, 2026-11-01)" |
| `/over-mij` | 0.92 | 0.9 | exception removed |
| `/portfolio` | 0.93 | 0.9 | none |
| `/soorten-fotoshoots` | 0.92 | 0.9 | exception removed |
| `/soorten-fotoshoots/newborn` | 0.91 | 0.9 | exception removed |
| `/soorten-fotoshoots/zwangerschap` | 0.90 | 0.85 | stays; decision "scoort rond 0,90; met 1 run onbetrouwbaar als doel (eigenaar, 2026-11-01)" |
| `/soorten-fotoshoots/gezin` | 0.89 | 0.85 | stays; same decision text as `/` |
| `/soorten-fotoshoots/loveshoot` | 0.88 | 0.85 | stays; same decision text as `/` |
| `/soorten-fotoshoots/portret` | 0.90 | 0.85 | stays; same decision text as zwangerschap |
| `/contact` | 0.94 | 0.9 | none |
| `/privacyverklaring` | 0.96 | 0.9 | none |
| not found (`/__audit/404`) | 0.97 | 0.9 | none |
Desktop: 0.9 on all 12 URLs (all measured 0.99 or 1.00). Accessibility and best practices 1 and SEO 1 are unchanged. `numberOfRuns` stays 1.
Outcome of the check: `lhci assert` against the unit's existing measurement (36 mobile and 36 desktop reports, no new collect): all 12 URLs pass in both presets. The median figures also meet the new targets; `/` sits exactly at its floor (0.85) and zwangerschap and portret at 0.90 against a floor of 0.85. Because `numberOfRuns` is 1 and `/` is at its floor, a slow run can fail `pnpm check` locally.
Code consequence: `photoPagePaths` (derived from the exception keys, used only by one list test) is removed from `lighthouserc.cjs` and `lighthouserc.d.cts`, because after the decisions it no longer lists every shoot page; `src/app.test.tsx` now checks only `indexedPaths` for the shoot pages. The comments in `lighthouserc.cjs` that spoke of "temporary" exceptions were rewritten.
## Test inventory
- Unit (`pnpm test`, after the decisions): 132 files, 1390 tests passed, coverage thresholds met (statements 96.1 %, branches 94.25 %, functions 97.36 %, lines 96.6 %), seed 511446714. Baseline before the unit: 130 files, 1277 tests.
- Browser (`pnpm e2e`, last full local run at Step 21, before the final measurement; not repeated): 12 files, 248 passed, 204 skipped locally (the nginx suites and lftp tests need nginx and lftp, which are not installed on this PC), 0 failed.
- Properties (all labelled, global seed): P-HST-01 to 06 in `config/canonicalUrls.test.ts` and `config/previewServer.test.ts` (P-HST-05 at server level); P-HST-07, 08 and the IIS text test (replacing P-HST-10) in `config/serverConfig.test.ts`; P-HST-09 in `e2e/serverRules.e2e.ts` (bounded 100 runs); P-HST-11 in `config/lighthouserc.test.ts`.
- Existing tests that changed (plan section 6): the three `serverConfig.test.ts` tests (stricter), the BR-SRV-07 group of `previewServer.test.ts` and P16/P17, `src/app.test.tsx` (not-found path; now also the removal of the `photoPagePaths` checks), `rawHtml.e2e.ts`, `hydration.e2e.ts`, `displayHtml.e2e.ts` (404 for `/404.html`), `images.e2e.ts`. `navViewport.ts` lost a plan-step mention in a comment.
## Verification points (condensed, details in verification-log.md)
- V1 to V5, V12: OK on nginx 1.24.0 in CI run 593 (commit 8cb9185): `serverRules.e2e.ts` 134 of 134 passed. Three defects were found and fixed through this proof (harness permissions as root, case-insensitive map keys, backslash in `Location`).
- V6: WITHDRAWN (IIS needs a host).
- V7, V8, V11, V13, V14: OK (V11 against stubs, V14 by reading the generated text against the Pi instructions).
- V9: OK, the audit route passes (best practices 1, accessibility 1, no runtime error).
- V10: OK against a local `file:` target with real lftp 4.9.2 (run 594); the later change to separate lftp sessions with round markers has not been confirmed in CI; FTPS against a real host is untested.
- Step 21 (CP4): lint, format, test, build, e2e, `audit:deps` green; `audit:dev` reports 23 (non-blocking).
## Deviations
None from the design. Two plan texts were adjusted by outcome: `photoPagePaths` is removed (see above); the V9 comparison with `/404.html` and `ignoreStatusCode` was not run because the audit route passes.
## Unverified
- The IIS rules (U1 to U6 in infrastructure-design.md § 7.2): generated text only.
- nginx 1.30.6 on the Pi: CI proves nginx 1.24.0; the check on the Pi is `nginx -t` plus the curl matrix during the rollout.
- lftp over FTPS against a real host (ssl settings, login, directory layout).
- The parity and real-build nginx suites on the latest commit and the changed lftp sessions: awaiting the CI run that is in progress.
- Production compression: the final measurement ran with gzip on the preview server.
## Human tasks (see pi-install-instructions.md)
The first deploy to the test host **needs** these: the owner places the generated `web/deploy/nginx/andreaslop-test.conf` on the Pi as `pi-install-instructions.md` says (H2, after separate approval, with the backup outside `conf.d`) and reloads nginx; then deploys right after (H3: a manual branch deploy or the merge; the merge waits for H2), with the checks of the instructions and of deployment-architecture.md § 5. Without H2 the old SPA config stays active and `verify-deployment.sh` in the deploy job fails on purpose. Optional: the proxy check or change (H4, "Proxy Pi" table). The `server-ops` draft is requested separately by the Pi-Main session. Everything about the webhost (Q1 to Q6, U1 to U6) waits for a purchase; `deploy-production` stays dispatch-only until then.
## Open points for the owner
- `/` sits exactly at its floor of 0.85 with one run; responsive photos remove the exceptions of `/`, gezin and loveshoot.
- zwangerschap and portret are kept at 0.85 only because one run is unreliable at 0.90.
- Merge, H2, H3, webhost.
@@ -108,3 +108,20 @@ All mobile and desktop CLS values are below 0.01 except: `/soorten-fotoshoots/ne
## State after the measurement
Port 4173 was free before and after; no process left running; `.lighthouseci` removed from `web/`; `dist` built from the committed code just before the runs and not changed since; `git status --short` empty, as before. No git write command was used.
## Owner decisions
Recorded 2026-11-01 by the owner, after this report. Applied in `web/lighthouserc.cjs` (`mobileExceptions`); `lighthouserc.desktop.cjs` and `numberOfRuns: 1` are unchanged.
| Page | Score (final) | Decision | Mobile target now |
|---|---|---|---|
| `/over-mij` | 0.92 | no exception | 0.9 |
| `/soorten-fotoshoots` | 0.92 | no exception | 0.9 |
| `/soorten-fotoshoots/newborn` | 0.91 | no exception | 0.9 |
| `/soorten-fotoshoots/zwangerschap` | 0.90 | exception stays at 0.85: "scoort rond 0,90; met 1 run onbetrouwbaar als doel (eigenaar, 2026-11-01)" | 0.85 |
| `/soorten-fotoshoots/portret` | 0.90 | same as zwangerschap | 0.85 |
| `/` | 0.85 | floor raised from 0.8 to 0.85: "bij de huidige score vastgelegd, tot responsive foto's (eigenaar, 2026-11-01)" | 0.85 |
| `/soorten-fotoshoots/gezin` | 0.89 | stays at 0.85, same text as `/` | 0.85 |
| `/soorten-fotoshoots/loveshoot` | 0.88 | stays at 0.85, same text as `/` | 0.85 |
`/portfolio`, `/contact`, `/privacyverklaring` and the not-found page keep 0.9. The check above was repeated with the new config: `lhci assert` on the same 36 mobile and 36 desktop reports: all 12 URLs pass in both presets (no new collect). The median figures are all at or above the new targets (lowest margin: `/` 0.85 at floor 0.85).
@@ -14,9 +14,9 @@ Status values: OK, BLOCKED, DEVIATION, WITHDRAWN, OPEN.
| V6 | Withdrawn for this unit (IIS needs a host). The checks move to the "Before go-live" list, U1 to U6 | WITHDRAWN (no host) | | | WITHDRAWN |
| V7 | `previewServer.ts`: the new `resolveRequest` contract (redirect result, query handling, `--audit-route`); unit 1 tests for BR-SRV-07 are updated (the "interim" rules become final); `pageFiles.ts` stays the single path to file mapping | 7, 8 | OK: `resolveRequest` returns `FileResult` or `RedirectResult` (301) and takes `{ auditRoute }`; `handle()` sends the 301 with a relative `Location` plus the raw query, `Content-Length: 0`, the security headers and no `Cache-Control`, also for HEAD; `/404` and `/404.html` are 404; `/__audit/404` is 200 only with `--audit-route`; `//x` and `/%5Cevil.example/` give the 404 page. The BR-SRV-07 tests are rewritten into the final rules. `pageFiles.ts` is still the only path-to-file mapping. | `pnpm exec vitest run config/previewServer.test.ts`: 89 passed (two runs, seeds 943967193 and 1045251215); `tsc --noEmit` and eslint clean | OK |
| V8 | The 301 is followed by Chrome with the query string intact for `?pakket=` and `?shoot=` links, and the hydrated page has 1 title (extend the existing "URL die de server niet kent en de router wel" e2e) | 17 | OK in Chrome (urls.e2e.ts, hydration.e2e.ts): /Over-Mij, /Over-Mij?pakket=gezin, /over-mij/, /over-mij/?x=1, /soorten-fotoshoots/, /index.html and /over-mij.html each give exactly one 301 and then 200 on the canonical URL with the query kept; hydrated page has 1 title, the title of its own page, no robots tag, no console message or CSP violation. Unknown URL, /404 and /404.html: 404, 1 title, 1 noindex. | Local run, pnpm build then pnpm e2e: 12 files passed, 248 tests passed, 204 skipped (nginx), seed 1174228318. The ?shoot= links are not in the list: the redirect keeps the raw query byte for byte (P-HST-05) | OK |
| V9 | One Lighthouse run of the 404 page on the preview audit route, and (as comparison) `/404.html` with `ignoreStatusCode`; record best-practices for both, then keep the simpler passing option (O2) | 23 (measurement-final.md) | | | open |
| V9 | One Lighthouse run of the 404 page on the preview audit route, and (as comparison) `/404.html` with `ignoreStatusCode`; record best-practices for both, then keep the simpler passing option (O2) | 22, 23 (measurement-final.md) | OK: the audit route is kept (owner choice O2). In the final measurement (3 runs, mobile and desktop) the not-found page through `/__audit/404` has no runtime error, best practices 1, accessibility 1 in every run; mobile median performance 0.97, desktop 1.00. The comparison with `/404.html` and `ignoreStatusCode` was not run: `/404.html` is a real 404 now and the audit route passes. SEO 0.58 is the deliberately failing `is-crawlable` audit. | measurement-final.md (Accessibility, best practices, SEO; V9 line), commit 6d4d012 | OK |
| V10 | lftp: dry run against a `file:` target proves that pass 1 skips all nested `*.html` and `web.config`, pass 2 uploads them, pass 3 deletes only stale files | 14 | Proven against a local `file:` target with real lftp 4.9.2 (CI run 594, commit 38708b8, Ubuntu noble arm64): the per-pass tests passed, so pass 1 (`--exclude-glob '*.html' --exclude-glob web.config`) copies no HTML (nested included) and no web.config; pass 2 (`put -O` plus `--include-glob '*.html'` alone) copies all HTML including the nested page and 404.html, so `--include-glob` alone includes only HTML and does descend into subdirectories; pass 3 deletes only the stale file; the final tree equals dist plus web.config; `LFTP_OPEN=file:///` with an absolute remote dir works. This proves lftp's pattern syntax against a `file:` target, NOT FTPS against a real host (ssl settings, login, and the host's directory layout are untested). One test failed in that run: it looked for `assets/a.js` and `.html` in lftp's verbose output and found no `.html` line (index of first HTML -1), so lftp's output format is not what that test assumed; the order is now proven by the script itself: one lftp session per round with `== Ronde N` markers and set -e, plus the per-pass trees. That change (separate sessions, markers) has not yet run in CI. | CI run 594 log (25 of 26 deployScripts tests passed); e2e/deployScripts.e2e.ts | OK (file: target); FTPS unverified
| V11 | `verify-deployment.sh` fails against a copy of the old nginx config (home page for `/over-mij`) and passes against the new one | 13 | OK against stubs: verify-deployment.sh exits 1 against a stub that imitates the old nginx config (index.html with 200 for every path), with the messages "/over-mij: antwoord is niet gelijk aan over-mij.html", "status 200, verwacht 404" and "/over-mij/: status 200, verwacht 301"; it exits 0 against a stub with the new rules (also with a trailing slash on the URL) and against the preview server on the fixture site. Also fails per missing security header, with --test without X-Robots-Tag or gzip; gzip missing only warns without --test. Not run against the real old or new nginx file on the Pi (nothing is contacted); the first deploy-test run shows it against the new config. | pnpm exec vitest run --config vitest.e2e.config.ts e2e/deployScripts.e2e.ts: 22 passed, 5 skipped (lftp) | OK (stubs) |
| V12 | CI: the `lighthouse` job (or a new `server-rules` job) installs nginx, `pnpm e2e` includes `serverRules.e2e.ts`, and the job fails if nginx is missing | 5, 16 | OK: the lighthouse job installs nginx and lftp, Browsertests runs with CI=true, serverRules ran with nginx present. The missing-nginx failure path was proven locally (CI=true without nginx fails with "nginx ontbreekt in CI (BR-HST-24)"). | CI run 593 (commit 8cb9185), job lighthouse, step Browsertests, nginx/1.24.0 (Ubuntu) on the Pi runner (container, root); e2e/serverRules.e2e.ts: 134 tests, all passed, none skipped (2088 ms), 67 per mime variant (.js as text/javascript and as application/javascript); the run totals 348 tests with 341 passed and 7 failed, all 7 in images.e2e.ts and reveal.e2e.ts (timeouts, unrelated); the test prints "[serverRules] nginx -v: nginx version: nginx/1.24.0 (Ubuntu)" once per variant. Earlier cycles found and fixed three defects through this proof: workers as www-data could not read the mkdtemp fixture (harness, run 592: 403), map plain keys ignore case so /Over-Mij was not redirected (generator), and /%5Cevil.example/ produced Location /evil.example (generator, BR-HST-06). The install step in run 593 uses policy-rc.d to keep the package from starting a service. | OK |
| V13 | `lighthouserc.cjs`: the exception table is empty on delivery unless an owner decision exists; P-HST-11 passes; `pnpm lighthouse` still starts the preview with `--audit-route` and `Local` appears for `startServerReadyPattern` | 11, 12 | Exception table holds the 8 carried-over entries (targets unchanged by plan; decision text "tijdelijk, tot de eindmeting van prerendering" until the owner decides); effective per-URL assertions identical before/after for mobile and desktop, performance level error and warn; `config/lighthouserc.test.ts` + `src/app.test.tsx` 55 tests green; start command has `--audit-route` | OK: `pnpm exec lhci collect --url=http://localhost:4173/__audit/404 --numberOfRuns=1` started `pnpm preview --port 4173 --strictPort --audit-route`, the `Local` line was seen, Lighthouse audited the page with status 200 and no run warning (mobile: performance 0.96, accessibility 1, best-practices 1, seo 0.58 because the page is noindex; one run, indicative only). Port 4173 was free before and after |
| V13 | `lighthouserc.cjs`: the exception table is empty on delivery unless an owner decision exists; P-HST-11 passes; `pnpm lighthouse` still starts the preview with `--audit-route` and `Local` appears for `startServerReadyPattern` | 11, 12, 26 | OK. On delivery (Step 11) the table held the 8 carried-over entries with a provisional decision text; the owner decided per page on 2026-11-01 after the final measurement and the table now holds 5 entries, each with the owner's decision text (see code-summary.md, NFR-PR-P-01). Effective targets mobile: `/` 0.85; zwangerschap, gezin, loveshoot, portret 0.85; all other URLs 0.9; desktop 0.9 everywhere. `config/lighthouserc.test.ts` and `src/app.test.tsx`: 55 tests green; `lhci assert` on the unit's final measurement (36 runs per preset): all 12 URLs pass, mobile and desktop. The start command has `--audit-route`, `numberOfRuns` is 1. | Earlier evidence (Step 12): `pnpm exec lhci collect --url=http://localhost:4173/__audit/404 --numberOfRuns=1` started `pnpm preview --port 4173 --strictPort --audit-route`, the `Local` line was seen, Lighthouse audited the page with status 200 and no run warning. | OK |
| V14 | The generated header comment fits the Pi: install path `/etc/nginx/conf.d/andreaslop-test.conf` (included from `nginx.conf:38`), no `sites-enabled`, no global `nginx.conf` change; the file works for a first install and for an update of an existing file | 3 | Header comment rewritten: install path /etc/nginx/conf.d/andreaslop-test.conf, included in http {} from nginx.conf, no sites-enabled, no global nginx.conf change, own gzip block because the Pi has none, works behind an HTTP/1.0 proxy, 444 from 00-default.conf for an unknown host (old WordPress remark removed), server_name and root adaptable, no default_server. The same file serves a first install and an update (it replaces the existing file in place). | Generated deploy/nginx/andreaslop-test.conf (lines 1-12); equals nginxTestConf() (serverConfig.test.ts sync test green) Fit check against pi-install-instructions.md (final conf, 2026-11-01): (1) backup lives outside conf.d, no `.bak` in documents or generated comments: OK. (2) install path, `root /var/www/html/andreaslop-test` = DEPLOY_PATH_TEST, header mentions 00-default.conf and 444: OK. (3) every location repeats the full set of seven headers, `/assets/` has one Cache-Control, no `etag` directive, `/robots.txt` is a test-only location, no map rule matches `/404` or `/404.html`: OK. (4) proxy checks are the owner's, nothing in the code depends on them: OK. Expected results of the instructions hold in the conf by reading. Not run against a real nginx here. | OK |
@@ -481,13 +481,13 @@ Preconditions for Part I: Step 21 green; the main session has confirmed that it
## Part J: Documents (batch B9)
### Step 24: Code summary and verification log [ ]
### Step 24: Code summary and verification log [x]
- Executor: Sonnet.
- Do: write `aidlc-docs/features/prerendering/construction/hosting-and-targets/code/code-summary.md` in the format of `construction/display-fallbacks/code/code-summary.md`: status; commits (leave "to be filled by the main session"); files created, modified and removed (from `git status --short` and `git diff --stat`), grouped (URL modules, nginx generator, IIS generator, preview server, Lighthouse, deploy scripts, workflow, tests, documents) with the rule ids each implements; test inventory (files, counts, which properties P-HST-01 to 11 where, which existing tests changed and why: § 6 and the Step 17 record); the verification log V1 to V14 condensed (V6 WITHDRAWN; V10 OPEN if lftp was unavailable locally; V1 to V5 with the proof source); the Step 21 outcome; deviations; what is **unverified**: the IIS rules (U1 to U6 in infrastructure-design.md § 7.2), the nginx 1.24/1.30 gap, lftp syntax if not tested, the first CI run; open points for the owner; a pointer to `pi-install-instructions.md`. Complete the verification log (Outcome, Evidence, Status for every row).
- Done when: both files exist and every file of the diff is listed.
### Step 25: Reverse-engineering delta and the temporary note [ ]
### Step 25: Reverse-engineering delta and the temporary note [x]
- Executor: Sonnet.
- Implements: NFR-PR-Q-05.
@@ -505,15 +505,16 @@ Preconditions for Part I: Step 21 green; the main session has confirmed that it
## Part K: After the owner's decisions (batch B10, Sonnet; runs only when the main session passes the decisions)
### Step 26: Apply the owner's per-page decisions [ ]
### Step 26: Apply the owner's per-page decisions [x]
- Executor: Sonnet.
- Implements: NFR-PR-P-01; BR-HST-21, 23.
- Do: with the decisions written in the main session's message (page, new `minScore` or "remove the exception", the date and where the decision is recorded): edit only the `mobileExceptions` table in `web/lighthouserc.cjs`: delete entries for pages that now meet 0.9, change or keep others with `decision` set to the owner's decision text and its record location; leave `numberOfRuns` at 1; do not edit `lighthouserc.desktop.cjs`. Update the comments in the file to match. If a decision is missing for a page below 0.90, STOP and ask; never choose for the owner.
- Done when: `pnpm exec vitest run config/lighthouserc.test.ts src/app.test.tsx`, `pnpm lint`, `pnpm format:check`, `pnpm exec tsc --noEmit` green; the effective target table matches the decisions exactly.
- Record: the final target table.
- Done. Mobile: `/` 0.85; zwangerschap, gezin, loveshoot, portret 0.85; `/over-mij`, `/portfolio`, `/soorten-fotoshoots`, newborn, `/contact`, `/privacyverklaring`, `/__audit/404` 0.9. Desktop 0.9 everywhere. `lhci assert` on the existing final measurement: 12 of 12 pass, both presets. `photoPagePaths` removed (no longer true for every shoot page); `src/app.test.tsx` adjusted.
### Step 27: Final documents [ ]
### Step 27: Final documents [x]
- Executor: Sonnet.
- Do: update `code-summary.md` (targets applied, decisions with their record), the Lighthouse exception line in `aidlc-docs/_shared/reverse-engineering/code-quality-assessment.md` and any other shared line that states the old exceptions, and `measurement-final.md` (a short "Owner decisions" section). Run `pnpm test` once for the summary counts.
+30 -25
View File
@@ -27,33 +27,39 @@ const notFoundPath = '/__audit/404';
// Mobile performance exceptions, keyed by path. Every entry needs a recorded
// decision and a floor below 0.9 (BR-HST-23); a page without an entry must
// reach 0.9. These are the temporary exceptions carried over from the
// frontend-shell feature, until the final measurement of prerendering:
// - the homepage (0.8): the photos are not responsive yet and the title only
// appears after the JavaScript (NFR-P-01).
// - the indexed content pages whose largest paint is a photo (0.85):
// Lighthouse simulates a slow connection and the photo is only requested
// once the main bundle and the page's own chunk have run, so they land on
// LCP ~3.2s and a score of ~0.895, right on 0.9 (measured on /over-mij and
// /soorten-fotoshoots; fewer image bytes do not move it). The shoot pages
// (largest paint: the first story photo) are in the same position.
const temporary = 'tijdelijk, tot de eindmeting van prerendering';
// reach 0.9. Decided by the owner on 2026-11-01 after the final measurement
// of prerendering (measurement-final.md):
// - /over-mij, /soorten-fotoshoots and the newborn page (0.91 to 0.92) have no
// exception any more.
// - zwangerschap and portret score around 0.90; with one run that is unreliable
// as a target, so their floor stays at 0.85.
// - the homepage (0.85 measured, floor raised from 0.8), gezin and loveshoot
// (0.89 and 0.88, floor 0.85) are recorded at their current score until the
// photos are responsive (NFR-P-01).
const unreliableAtNinety =
'scoort rond 0,90; met 1 run onbetrouwbaar als doel (eigenaar, 2026-11-01)';
const untilResponsivePhotos =
"bij de huidige score vastgelegd, tot responsive foto's (eigenaar, 2026-11-01)";
const mobileExceptions = {
'/': { minScore: 0.8, decision: temporary },
'/over-mij': { minScore: 0.85, decision: temporary },
'/soorten-fotoshoots': { minScore: 0.85, decision: temporary },
'/soorten-fotoshoots/newborn': { minScore: 0.85, decision: temporary },
'/soorten-fotoshoots/zwangerschap': { minScore: 0.85, decision: temporary },
'/soorten-fotoshoots/gezin': { minScore: 0.85, decision: temporary },
'/soorten-fotoshoots/loveshoot': { minScore: 0.85, decision: temporary },
'/soorten-fotoshoots/portret': { minScore: 0.85, decision: temporary },
'/': { minScore: 0.85, decision: untilResponsivePhotos },
'/soorten-fotoshoots/zwangerschap': {
minScore: 0.85,
decision: unreliableAtNinety,
},
'/soorten-fotoshoots/gezin': {
minScore: 0.85,
decision: untilResponsivePhotos,
},
'/soorten-fotoshoots/loveshoot': {
minScore: 0.85,
decision: untilResponsivePhotos,
},
'/soorten-fotoshoots/portret': {
minScore: 0.85,
decision: unreliableAtNinety,
},
};
// The exceptions of the content pages with a photo as largest paint
const photoPagePaths = Object.keys(mobileExceptions).filter(
(path) => path !== '/',
);
const validateExceptions = (exceptions, paths) => {
for (const [path, { minScore, decision }] of Object.entries(exceptions)) {
if (!paths.includes(path)) {
@@ -128,7 +134,6 @@ module.exports = {
indexedPaths,
noindexPaths,
notFoundPath,
photoPagePaths,
mobileExceptions,
validateExceptions,
buildIndexedEntries,
-1
View File
@@ -7,7 +7,6 @@ declare const config: {
indexedPaths: string[];
noindexPaths: string[];
notFoundPath: string;
photoPagePaths: string[];
mobileExceptions: MobileExceptions;
validateExceptions: (exceptions: MobileExceptions, paths: string[]) => void;
buildIndexedEntries: (
+1 -3
View File
@@ -591,7 +591,7 @@ describe('shoot pages', () => {
describe('pagina-register', () => {
// Finite sets, so example-based: every shoot page is registered
// everywhere, and nothing else lives under /soorten-fotoshoots/
it('has every shoot page in the router, registry, sitemap and Lighthouse lists', async () => {
it('has every shoot page in the router, registry, sitemap and Lighthouse list', async () => {
const { router } = await renderApp('/');
const sitemap = sitemapXml(
Object.entries(sitePages).map(([path, page]) => ({
@@ -612,12 +612,10 @@ describe('pagina-register', () => {
);
expect(sitemap).toContain(`<loc>${siteUrl}${path}</loc>`);
expect(lighthouseConfig.indexedPaths).toContain(path);
expect(lighthouseConfig.photoPagePaths).toContain(path);
}
expect(underPrefix(Object.keys(router.routesByPath))).toEqual(expected);
expect(underPrefix(Object.keys(sitePages))).toEqual(expected);
expect(underPrefix(lighthouseConfig.indexedPaths)).toEqual(expected);
expect(underPrefix(lighthouseConfig.photoPagePaths)).toEqual(expected);
const sitemapPaths = [...sitemap.matchAll(/<loc>([^<]*)<\/loc>/g)].map(
(match) => match[1].replace(siteUrl, ''),
);