ASF-injectie 5/5: end-to-end test op de master-host, ASF Website:AuthoredBaseUrl, rooktest-uitbreiding, docs

- ASF appsettings: Website:AuthoredBaseUrl=https://andreaslop.nl, PublicBaseUrl leeg (env).
- Api.Tests/AsfInjectionPipelineTests: pagina met markers, echte database; een CMS-wijziging is direct zichtbaar (ETag wijzigt), data-blok == publieke API, 304, sitemap-adres.
- smoke-site.sh: onverwerkte CMS-markers op / falen; data-blok moet siteUrl van deze host hebben.
- docs: asf-host-injection 'as built'.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 16:16:27 +01:00
co-authored by Claude Sonnet 5.5
parent 4baadf3144
commit 571aaf9cd2
6 changed files with 207 additions and 3 deletions
+18 -1
View File
@@ -2,7 +2,7 @@
- **Slug**: asf-host-injection
- **Type**: Feature, **proposal; not approved, build not started**
- **Status**: Plan agreed with the ASF session (their counterpart: `AndreaSlopFotografie-packages/aidlc-docs/features/asf-cms-host-injection/plan.md`, section "Host contract"). Bryan accepted the approach (neutral list first, styled cards after hydration; the host writes the list HTML) on 2026-11-15 but said **not to start building yet**: he first reads the plan and finds out whether .NET 10 can run on the hosting package (hosting bundle or self-contained).
- **Status**: **Built** on `feature/contact-forms-module` (commits 7d66944, a136615, ef4fb9d, 4baadf3 and the one after it; tests green locally), **not yet deployed**: needs the website build with the markers and `Website__PublicBaseUrl=https://test.andreaslop.nl` in the ASF-test env file. Before: plan agreed with the ASF session (their counterpart: `AndreaSlopFotografie-packages/aidlc-docs/features/asf-cms-host-injection/plan.md`, section "Host contract"). Bryan accepted the approach (neutral list first, styled cards after hydration; the host writes the list HTML) on 2026-11-15 but said **not to start building yet**: he first reads the plan and finds out whether .NET 10 can run on the hosting package (hosting bundle or self-contained).
- **Affected components (planned)**: `SlpModularCms.Core` (`Hosting/Website`: generalise `IndexHtmlInjector`, hook in `PrerenderedSiteMiddleware`), `SlpModularCms.Modules.Offerings` (marker providers), `scripts/smoke-site.sh`, docs
- **Documented**: 2026-11-15
- **Documentation Language**: English
@@ -42,3 +42,20 @@ Injected pages: `Cache-Control: no-cache`, strong ETag from the final body, 304
## Risks
Markers stripped by a build (confirmed not the case for ASF's Vite/TanStack prerender); proxy or IIS caching of HTML; .NET 10 unavailable on the package; the per-base-URL cache keyed from the Host header when no `PublicBaseUrl` is configured (to be capped in this unit); several app instances (invalidation is per process; the 60-second TTL bounds the lag). Estimated effort: about 1.5 days for the host side, plus ASF's front-end rework.
## As built (2026-11-15)
| Piece | Where |
|---|---|
| Marker edits (regions, data block, JSON-LD, inline values, script escaping) | `Core/Hosting/Website/HtmlMarkerEditor.cs` |
| Injector for every html/xml/txt file of the prerendered host and for the SpaFallback index.html; caching (60 s, direct invalidation, capped at 256 entries), ETag/304, address replacement, per-part fail-open | `Core/Hosting/Website/HtmlMarkerInjector.cs`; hook in `PrerenderedSiteMiddleware` (`ServeFile`); registered by `AddCmsWebsite` |
| Neutral list and banner HTML, price rules (whole euros, `1.250`) | `Offerings/Services/CmsPageHtml.cs`; golden files of the website repo (ASF commit 16027f5) in `Offerings.Tests/Golden/host-injection`, `GoldenHtmlTests` |
| Marker transform (regions, `#cms-data` with `siteUrl`, JSON-LD price, `data-cms-price`) | `Offerings/Services/OfferingsHtmlTransform.cs` (`IHtmlPageTransform`) |
| Settings | ASF `appsettings.json`: `Website:AuthoredBaseUrl=https://andreaslop.nl`, `Website:PublicBaseUrl` empty (env `Website__PublicBaseUrl`) |
| End-to-end test (real database, ASF settings, temporary web root) | `Api.Tests/AsfInjectionPipelineTests` |
| Smoke test | `scripts/smoke-site.sh`: unprocessed `CMS:DATA` / `CMS:OFFER-JSON-LD` markers on `/` fail; a data block must carry this host's `siteUrl`; ETag and no-cache on the injected home page |
Behaviour choices: a successful empty answer empties a region (no live package, no active banner); a failing service leaves the baked content; a package without a derivable price removes `offers` from the JSON-LD (a failing service does not); a file without markers and without the authored address stays a plain static file; 404.html is not injected.
**Deploy order matters**: set `Website__PublicBaseUrl=https://test.andreaslop.nl` on ASF-test before the first website build with markers is deployed, otherwise the data block's `siteUrl` is the production address and the smoke test fails on purpose.
+1 -1
View File
@@ -24,6 +24,6 @@ Only hosts in `WebsiteMode.SpaFallback` (SlpSoftware). The ASF host (`Prerendere
| `KnownPaths` | Only these paths are pages (200, the SPA shell); any other website path is a real 404 (still the shell). `/api`, `/admin` and assets keep working. |
| `Sitemap:Paths` | Paths listed in the sitemap. |
## Index markers (`IndexHtmlInjector`)
## Index markers (`HtmlMarkerInjector` (until 2026-11-15 `IndexHtmlInjector`; generalised for the prerendered host, see asf-host-injection))
The host fills markers in `index.html`: `<!--SLP:OFFERINGS-JSON-LD-->` (schema.org `ItemList` of `Offer`) and `<!--SLP:OFFERINGS-HTML-->` (a static `#packages-static` list), rendered by `OfferingsIndexMarkers` from the live offerings. 60-second cache, invalidated directly by every offering change, `ETag` with 304 support; if a provider fails the plain page is still served. The markers must stay in `<body>` above `#root`; the website removes `#packages-static` on start-up.