Hardens the upload path check and the deploy verification
A remote of . or .. could have made the cleanup pass delete the wrong folder, so such paths are refused before anything runs. A connection error now ends in the normal summary instead of aborting the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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): B0 to B6 done; CI proof of parity running
|
||||
- **Current Stage**: CONSTRUCTION - Code Generation (unit 3: hosting-and-targets): B0 to B7 done; B8 final measurement running
|
||||
- **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
|
||||
|
||||
|
||||
+1
-1
@@ -19,4 +19,4 @@ Status values: OK, BLOCKED, DEVIATION, WITHDRAWN, OPEN.
|
||||
| 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 |
|
||||
| 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) | 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 |
|
||||
|
||||
+2
-2
@@ -243,7 +243,7 @@ The preview server keeps its gzip (BR-SRV-08). Lighthouse therefore measures com
|
||||
|
||||
| Rule | Statement |
|
||||
|---|---|
|
||||
| BR-HST-12 | `/assets/*` (hashed names): `public, max-age=31536000, immutable`. Everything else, including HTML, `robots.txt`, `sitemap.xml`, `favicon.png` and unhashed images: `no-cache`. 301 responses carry no extra cache header (browsers may keep a 301; acceptable because the redirect set is fixed by the page list) |
|
||||
| BR-HST-12 | `/assets/*` (hashed names): `public, max-age=31536000, immutable`. Everything else, including HTML, `robots.txt`, `sitemap.xml`, `favicon.png` and unhashed images: `no-cache`. 301 responses set no cache header of their own (browsers may keep a 301; acceptable because the redirect set is fixed by the page list). On nginx the 301s from the server-level `if` and `rewrite` do inherit the server-level `Cache-Control: no-cache`; that is harmless (a 301 is revalidated instead of kept) and needs no config change. Known difference: the preview server sends no `Cache-Control` on its 301s, so a parity test must not compare that header on redirects |
|
||||
| BR-HST-13 | The five security headers of `securityHeaders('production')` are present on every response: 200, 301, 404, the 404 page, 405 and error responses. Test adds `X-Robots-Tag`. nginx uses `add_header ... always` in every location and at server level; IIS uses `customHeaders`; the preview server merges them in `send()` |
|
||||
|
||||
Only `/assets` is long-cached (owner decision O3). `robots.txt`, `sitemap.xml`, the favicon and other unhashed files revalidate: a long lifetime would keep a stale `robots.txt` after go-live, and a 304 is cheap with `ETag`. Lighthouse's cache audit is informational and does not weigh in the score.
|
||||
@@ -281,7 +281,7 @@ The webhost package has **not been purchased** (owner, 2026-11-01). The `web.con
|
||||
|
||||
| Id | Unverified point | Consequence if it fails |
|
||||
|---|---|---|
|
||||
| U1 | URL Rewrite `CustomResponse` 404 (rules 6 and 8) together with `httpErrors` `ExecuteURL` to `/404.html`: whether rule 6 re-fires on the executed child request (empty 404 body) and whether `existingResponse="Replace"` is honoured | Unknown URLs or `/404.html` return an empty or default 404. Options then: drop rule 6 (`/404.html` serves the page with 200, `noindex`), or accept the host's generic 404 page. The owner decides when a host exists (this covers the former O4 and O5) |
|
||||
| U1 | URL Rewrite `CustomResponse` 404 (rules 6 and 8) together with `httpErrors` `ExecuteURL` to `/404.html`: whether rule 6 re-fires on the executed child request (empty 404 body); in particular `/404.html` is answered by rule 6 as a 404 and then executed through `ExecuteURL`, so if rewrite rules also run on that child request, the 404 page could come back empty and whether `existingResponse="Replace"` is honoured | Unknown URLs or `/404.html` return an empty or default 404. Options then: drop rule 6 (`/404.html` serves the page with 200, `noindex`), or accept the host's generic 404 page. The owner decides when a host exists (this covers the former O4 and O5) |
|
||||
| U2 | Directory handling: rule 7 before the handler's own directory redirect, rule 8 for directory-only names (`/assets`), `/soorten-fotoshoots` next to its directory | A redirect loop, or a directory redirect instead of the page |
|
||||
| U3 | `httpCompression` is server level and can not be set in `web.config`; only `urlCompression` can | No compression on production unless the host enables it for HTML, JS, CSS, SVG, JSON, XML. FR-PR-23 then depends on the host |
|
||||
| U4 | 500.19 risk: any locked or missing section (`rewrite`, `httpErrors`, `customHeaders`, `staticContent`, `urlCompression`) makes IIS answer every request under that folder with 500, static files included | Whole site down until a valid `web.config` is uploaded. Remove the offending section once the host names it |
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ The final commands with full paths go into the draft in the `server-ops` reposit
|
||||
| `map` and `$andreaslop_canonical` | No clash. The only other map in `/etc/nginx` is `$connection_upgrade` in `nginx.conf`. All `conf.d` files are included in `http` (`nginx.conf` line 38), so a map at the top of the file is at http level |
|
||||
| `root` | `/var/www/html` is a symlink to `/mnt/storage1/www/html/`; `/var/www/html/andreaslop-test` exists (`webadmin:www-data`, 775). The owner confirmed `DEPLOY_PATH_TEST` is `/var/www/html/andreaslop-test`, which equals this `root` |
|
||||
| gzip and headers from other vhosts | gzip is on nowhere, and `nginx.conf` has no http-level `add_header`. gzip in this server block changes no other site |
|
||||
| Default block | Since 2026-10-21, `/etc/nginx/conf.d/00-default.conf` answers an unknown host with 444. The current comment that nginx would fall back to WordPress is out of date; correct it in the generator |
|
||||
| Default block | Since 2026-10-21, `/etc/nginx/conf.d/00-default.conf` answers an unknown host with 444. The generated header says so |
|
||||
| nginx 1.30.6 | Every directive in the sketch is standard there. `if` with only `return` at server level is safe |
|
||||
| `map` matching | Plain string keys in `map` compare case-insensitively, so `/over-mij ""` also matched `/Over-Mij` and blocked its redirect (found by the real nginx in CI). Canonical forms are therefore case-sensitive regex keys placed before the variant regexes; the first regex that matches wins and no loop arises. The draft must use the regenerated config |
|
||||
| `error_page` | Its internal redirect runs server-level rewrite and `if` again with `$uri=/404.html`. That matches no map rule. **Keep it so: no map rule may match `/404` or `/404.html`** |
|
||||
|
||||
+6
-3
@@ -419,14 +419,15 @@ The riskiest mechanism is the nginx block (a `map`, a server-level `if` and `rew
|
||||
|
||||
## Part H: Finish (batch B7)
|
||||
|
||||
### Step 19: Comments, naming, formatting review [ ]
|
||||
### Step 19: Comments, naming, formatting review [x]
|
||||
|
||||
- Executor: Sonnet.
|
||||
- Do: read `git diff` of `web/` and check: no comment or test title names a plan step or this plan; comments explain why; the file header of `previewServer.ts`, `serverConfig.ts`, `lighthouserc.cjs` and the generated files state the current truth (no mention of the 200 at `/404.html`, no "SPA fallback"); no leftover scratch code; no `console.log` in the new code except the intended skip line; `pnpm exec prettier --check` on every changed file; every new file has a short header comment saying why it exists.
|
||||
- Done when: `pnpm lint`, `pnpm format:check`, `pnpm exec tsc --noEmit` clean; the review notes are one line each in the Record.
|
||||
- Record: findings fixed.
|
||||
- Done. Review of the unit 3 files (previewServer.ts, canonicalUrls.ts, compressibleTypes.ts, lighthouserc.cjs, serverConfig.ts, the three deploy scripts, nginx conf, web.config, workflow): no comment or test title names a plan step, no SPA or `/404.html`-200 text, no scratch code, `console.log` only in the intended places (ready line, `writeServerConfig`, seed line, test names), every new file has a header. One fix: `src/test/navViewport.ts` named "Step 17" and is now timeless (an unit 2 file). Prettier, eslint and `tsc --noEmit` clean. Defects found in the line-by-line read are listed in the report to the main session, not fixed.
|
||||
|
||||
### Step 20: Fit with the Pi install instructions and hand-over notes [ ]
|
||||
### Step 20: Fit with the Pi install instructions and hand-over notes [x]
|
||||
|
||||
- Executor: Sonnet.
|
||||
- Do: `aidlc-docs/features/prerendering/construction/hosting-and-targets/infrastructure-design/pi-install-instructions.md` was written by the Pi-Main session through the main session. **Do not change it.** `infrastructure-design.md` § 13 links to it from H2, H4 and the rollback text (the main session edited them). Step 20 only verifies that the generated files fit it, and records the result:
|
||||
@@ -438,13 +439,15 @@ The riskiest mechanism is the nginx block (a `map`, a server-level `if` and `rew
|
||||
The Pi-Main session requests the `server-ops` draft separately, with the generated text of `web/deploy/nginx/andreaslop-test.conf`; this plan only produces that file. **This plan does not touch the Pi, `server-ops` or the webhost, and does not merge.** Human tasks, listed so nobody mistakes them for plan steps: H2 (the owner places the config as the instructions say, after separate approval, and reloads), H3 (the deploy right after: a manual branch deploy or the merge, with the checks of the instructions and of deployment-architecture.md § 5), the optional proxy check/change H4, the first CI proof of Step 6, and everything about the webhost (Q1 to Q6, U1 to U6). Add one line to `code-summary.md` (Step 24) that references the instructions file.
|
||||
- Done when: the four points are recorded OK (or DEVIATION with the exact difference) in the verification log under V14; `pi-install-instructions.md` is unchanged by this plan.
|
||||
- Record: one line.
|
||||
- Done. All four points hold in the generated text (V14 updated). Findings for the owner are in the report to the main session; `pi-install-instructions.md` is untouched.
|
||||
|
||||
### Step 21: Full verification (Code Generation Step 13.5; CP4) [ ]
|
||||
### Step 21: Full verification (Code Generation Step 13.5; CP4) [x]
|
||||
|
||||
- Executor: Haiku.
|
||||
- Do: from `web/`, in order, each to completion: `pnpm lint`, `pnpm format:check`, `pnpm test`, `pnpm build && pnpm e2e`, `pnpm audit:deps`, `pnpm audit:dev`. Then record SHA-256 of `lighthouserc.cjs` targets file for Step 23: compute the effective target table of Step 11 again and compare it with the baseline from Step 11's Record (must be identical).
|
||||
- Done when: **CP4**: all green (audit:dev only reports). Counts, seed, durations in the Record. If any fails: STOP, report.
|
||||
- Record: counts; the targets comparison result.
|
||||
- Done (CP4). `pnpm lint`, `pnpm format:check`, `tsc --noEmit` clean; `pnpm test` 132 files, 1390 tests passed, seed 743185601, 75.9 s; fresh `pnpm build && pnpm e2e`: 12 files passed, 248 tests passed, 204 skipped (nginx and lftp not installed here; CI covers them), seed 1046879097, 202 s; `pnpm audit:deps` no known vulnerabilities; `pnpm audit:dev` reports 23 (2 low, 10 moderate, 11 high), non-blocking. Targets: `lighthouserc.cjs` SHA-256 `6e146472ed7a...` (mobile) and `lighthouserc.desktop.cjs` `f13d993389ba...` (unchanged from the baseline); the effective per-URL assertions (24 URL entries, mobile and desktop) of the baseline commit 4f32042 and of the current files are identical (0 differences; the 404 URL compared as the 404 page).
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user