Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -7,7 +7,7 @@ and how the Web-Vitals → Sentry bridge surfaces real-user metrics.
Companion artefacts: `.lighthouserc.staging.json`,
`.lighthouserc.json`, `scripts/lighthouse-puppeteer-auth.cjs`,
`scripts/rotate-lighthouse-session-cookie.mjs`,
`.github/workflows/lighthouse.yml`, `.gitea/workflows/lighthouse.yml`,
`.gitea/workflows/lighthouse.yml`,
`apps/web/app/lib/observability/web-vitals.ts`,
`apps/web/app/lib/pwa/registerServiceWorker.ts`,
`apps/web/public/manifest.webmanifest`, `apps/web/public/sw.js`.
@@ -21,7 +21,7 @@ CI workflow audits the **deployed staging site**
That makes it a **post-deploy / monitoring audit, not a per-commit merge
gate** — staging always lags the commit under review. The workflow
(`.gitea/workflows/lighthouse.yml`, mirrored in `.github/`) runs:
(`.gitea/workflows/lighthouse.yml`) runs:
- **nightly** at 03:00 UTC (`schedule`), and
- **on demand** (`workflow_dispatch`).
@@ -31,18 +31,17 @@ it as a production-quality alarm, not a blocked PR.
The Gitea runner image (`node:20-bookworm`) ships no browser, so the
workflow installs `chromium` via `apt-get` and points LHCI at it with
`CHROME_PATH=/usr/bin/chromium`. The GitHub runner (`ubuntu-latest`)
already bundles Chrome.
`CHROME_PATH=/usr/bin/chromium`.
## Audit targets
`.lighthouserc.staging.json` audits the public staging routes — the
surface that renders without authentication:
| URL |
| -------------------------------------------- |
| `https://boiler.saas-ctrl.com/login` |
| `https://boiler.saas-ctrl.com/privacy-policy` |
| URL |
| --------------------------------------------------- |
| `https://boiler.saas-ctrl.com/login` |
| `https://boiler.saas-ctrl.com/privacy-policy` |
| `https://boiler.saas-ctrl.com/terms-and-conditions` |
Only **Performance** is a hard gate (`error`). The product is a B2B
@@ -52,13 +51,13 @@ not asserted at all. Accessibility and Best-Practices stay visible as
(axe-core plus the `jsx-a11y` ESLint baseline, task #73), so a second
blocking gate here would be redundant.
| Category | Threshold | Severity |
| --------------- | --------- | ------------------------- |
| Performance | 0.95 | error |
| Accessibility | 0.95 | warn |
| Best Practices | 0.95 | warn |
| PWA | 0.90 | warn |
| SEO | — | not asserted (irrelevant) |
| Category | Threshold | Severity |
| -------------- | --------- | ------------------------- |
| Performance | 0.95 | error |
| Accessibility | 0.95 | warn |
| Best Practices | 0.95 | warn |
| PWA | 0.90 | warn |
| SEO | — | not asserted (irrelevant) |
Numeric audits (FCP / LCP / TBT / CLS) stay at `warn` severity so trend
regressions remain visible without failing the run.
@@ -74,14 +73,16 @@ the cookie or password.
Required workflow secrets:
| Secret | Purpose |
| ------ | ------- |
| `LIGHTHOUSE_LOGIN_EMAIL` | Email of the staging Lighthouse bot user. |
| Secret | Purpose |
| --------------------------- | -------------------------------------------- |
| `LIGHTHOUSE_LOGIN_EMAIL` | Email of the staging Lighthouse bot user. |
| `LIGHTHOUSE_LOGIN_PASSWORD` | Password of the staging Lighthouse bot user. |
The session cookie name is `hivegrid_session`; workflows also pass
`LIGHTHOUSE_SESSION_COOKIE_NAME=hivegrid_session` and
`LIGHTHOUSE_COOKIE_DOMAIN=boiler.saas-ctrl.com`.
The app session cookie name is `__Host-hivegrid_app_session`; workflows also
pass `LIGHTHOUSE_SESSION_COOKIE_NAME=__Host-hivegrid_app_session`. The cookie
is injected URL-bound without a `Domain` attribute so Chromium preserves the
`__Host-` contract. `LIGHTHOUSE_COOKIE_DOMAIN=app.hivegrid.de` remains only as
a compatibility input for local, non-prefixed cookie names.
During rollout the workflow still forwards the older
`LIGHTHOUSE_SESSION_COOKIE` secret as a fallback. If the login email or
@@ -91,9 +92,11 @@ each run mints a fresh cookie.
## Authenticated routes
Auditing `/app/$tenant/*` and `/admin/*` needs that freshly minted
`hivegrid_session` cookie. `scripts/lighthouse-puppeteer-auth.cjs` injects the
cookie for protected URLs and is already wired into
Auditing app routes needs that freshly minted `__Host-hivegrid_app_session`
cookie. Admin routes require a separately minted
`__Host-hivegrid_admin_session`; an app cookie is intentionally never reused
on the admin sibling host. `scripts/lighthouse-puppeteer-auth.cjs` injects the
configured cookie for protected URLs and is already wired into
`.lighthouserc.staging.json`. The current staging target list still
audits only public routes; add protected URLs once the exact tenant/admin
coverage list is chosen. Without a protected URL in the config, the
@@ -121,7 +124,7 @@ To reproduce a CI staging finding locally, point LHCI at the staging
config instead — no local server needed, just a Chrome install:
```sh
pnpm dlx @lhci/cli@0.13.x autorun --config=./.lighthouserc.staging.json
pnpm dlx @lhci/cli@0.13.0 autorun --config=./.lighthouserc.staging.json
```
The run prints the temporary-public-storage report URLs in its output;
@@ -130,14 +133,18 @@ share those when debugging a regression.
## PWA manifest + service-worker
`apps/web/public/manifest.webmanifest` describes the installable app.
`apps/web/public/sw.js` is a minimal cache-first / network-first service
`apps/web/public/sw.js` is an assets-only cache-first service
worker registered from `root.tsx` via `registerServiceWorker`.
Cache strategy:
- `/assets/...` (hashed by React-Router build) → **cache-first**
- `/api/...`, `/app/...`, `/admin/...` → **network-first** with cache fallback
- everything else (marketing routes, brand assets) → **network-first**
- HTML, loader/data, API, media and all other URLs → **not intercepted**; the
browser HTTP cache applies the origin `Cache-Control`/`Vary` contract.
Session-derived responses must never enter Service Worker Cache Storage. Cache
Storage is URL-keyed and an offline fallback could otherwise expose one user's
cached HTML or JSON to another user of the same browser profile.
The `CACHE_VERSION` constant inside `sw.js` is the invalidation lever —
bump it on any deploy that changes the asset graph in a backward-
@@ -171,14 +178,14 @@ dev, preview, staging, and production without extra gating.
## Troubleshooting CI runs
| Symptom | Likely cause / fix |
| -------------------------------------------------- | ----------------------------------------------------------------------------- |
| Symptom | Likely cause / fix |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `Chrome installation not found` / `Healthcheck failed!` | The runner has no browser. The Gitea workflow installs `chromium`; confirm the install step ran and `CHROME_PATH` is set. |
| Cookie rotation step fails with missing env vars | Add `LIGHTHOUSE_LOGIN_EMAIL` and `LIGHTHOUSE_LOGIN_PASSWORD` as repo Actions secrets. |
| Audit reports the `/login` page for a protected URL | Cookie injection failed or the bot no longer belongs to the tenant/admin surface being audited. |
| Performance score < 0.95 only on first run | Cold cache; LHCI reruns automatically (`numberOfRuns=3`). |
| Audit times out | Lower `numberOfRuns` to 1 temporarily while iterating; restore afterwards. |
| All URLs fail to load | Staging is down or redeploying — check the `web` container on staging. |
| Cookie rotation step fails with missing env vars | Add `LIGHTHOUSE_LOGIN_EMAIL` and `LIGHTHOUSE_LOGIN_PASSWORD` as repo Actions secrets. |
| Audit reports the `/login` page for a protected URL | Cookie injection failed or the bot no longer belongs to the tenant/admin surface being audited. |
| Performance score < 0.95 only on first run | Cold cache; LHCI reruns automatically (`numberOfRuns=3`). |
| Audit times out | Lower `numberOfRuns` to 1 temporarily while iterating; restore afterwards. |
| All URLs fail to load | Staging is down or redeploying — check the `web` container on staging. |
## Updating thresholds