From aa88e4ea391fa5c4cdd4c7f1024965c4ac4ab9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Thu, 29 Oct 2026 16:20:36 +0100 Subject: [PATCH] Starter: new sites don't inherit the reference site's temporary silences Merge follow-up for doctor + starter (both fine alone; three tests failed together): - generate.ts: an inherited ipal-doctor.json rule with `until` is a temporary follow-up of the reference site itself (the four live-seo silences until 2026-11-30); a new site starts with those checks on. Permanent, reasoned exceptions (i18n-literals, audit:collections-present) are still inherited. - reference/src/instrumentation.ts: the doctor's cookieCrawl header comment is wrapped in @starter:if crawl, so a site without crawl doesn't mention it. - docs/agent/reference-site/INDEX.md regenerated (the merge-time copy repeated the ipal-doctor.json section). Co-Authored-By: Claude Opus 5.5 --- docs/agent/reference-site/INDEX.md | 154 +---------------------------- reference/src/instrumentation.ts | 2 + src/modules/starter/generate.ts | 7 +- 3 files changed, 9 insertions(+), 154 deletions(-) diff --git a/docs/agent/reference-site/INDEX.md b/docs/agent/reference-site/INDEX.md index 59c4f97..677d79f 100644 --- a/docs/agent/reference-site/INDEX.md +++ b/docs/agent/reference-site/INDEX.md @@ -25,8 +25,6 @@ Rules: AGENT.md §13, §0a. | `README.md` | how to run the reference site and what is where | | `docs/DEPLOY.md` | the Coolify runbook: local check, app settings, MongoDB resource, env, targeted seeds, DNS, rollback | | `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) | -| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) | -| `ipal-doctor.json` | the production domain and launch state for ipal-doctor (below) | | `next.config.ts` | security headers, enforced CSP, admin CSP, upload headers, images, no X-Powered-By | | `package.json` | scripts (build, start, seed, tokens, generate), pinned Payload versions and overrides | | `playwright.config.ts` | smoke tests against the built, seeded site (below) | @@ -102,90 +100,6 @@ legacy-peer-deps=true } ``` -### `ipal-doctor.json` - -```json -{ - "domain": "example-studio.pl", - "launched": false, - "rules": { - "audit:collections-present": { - "off": true, - "reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection" - }, - "i18n-literals": { - "off": true, - "files": [ - "src/components/design/**" - ], - "reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code" - }, - "live-seo:duplicate-meta-descriptions-google-ignores-them": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the reference-site track: three pages per language have no own meta description and fall back to the site description; the seed should give each page one" - }, - "live-seo:heading-levels-skipped": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the block-library track: entryList cards use h3 with no h2 on the archive pages (h1 → h3)" - }, - "live-seo:first-image-not-prioritised-lcp": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the block-library track: on the archive pages the first image is an entryList card, which is not marked priority" - }, - "live-seo:thin-pages-words": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the reference-site track: demo archive and service pages hold fewer than 150 words of made-up content" - } - } -} -``` - -### `ipal-doctor.json` - -```json -{ - "domain": "example-studio.pl", - "launched": false, - "rules": { - "audit:collections-present": { - "off": true, - "reason": "Project decisions: posts and caseStudies with archive pages; entryFields.ts is their shared field helper, not a collection" - }, - "i18n-literals": { - "off": true, - "files": [ - "src/components/design/**" - ], - "reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code" - }, - "live-seo:duplicate-meta-descriptions-google-ignores-them": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the reference-site track: three pages per language have no own meta description and fall back to the site description; the seed should give each page one" - }, - "live-seo:heading-levels-skipped": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the block-library track: entryList cards use h3 with no h2 on the archive pages (h1 → h3)" - }, - "live-seo:first-image-not-prioritised-lcp": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the block-library track: on the archive pages the first image is an entryList card, which is not marked priority" - }, - "live-seo:thin-pages-words": { - "off": true, - "until": "2026-11-30", - "reason": "Follow-up for the reference-site track: demo archive and service pages hold fewer than 150 words of made-up content" - } - } -} -``` - ### `playwright.config.ts` ```ts @@ -263,8 +177,6 @@ Rules: AGENT.md §3, ipal-setup stage 3. | `src/db.ts` | the database adapter, alone in one file (MongoDB) (below) | | `src/i18n.config.ts` | the ONLY source of languages (below) | | `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) | -| `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) | -| `src/instrumentation.ts` | env validation at startup (assertEnv, database name rule) (below) | | `src/payload.config.ts` | ipalKit with every module the site uses, R2, mail, 2FA, white-label | | `src/proxy.ts` | the locale proxy with Markdown negotiation (not middleware.ts) (below) | @@ -325,71 +237,9 @@ export function register() { if (process.env.NEXT_RUNTIME !== 'nodejs') {return} // storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for // local checks and CI only — never set it in Coolify. + // @starter:if crawl // cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service). - // databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor). - // R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md). - assertEnv( - ipalEnvRules({ - // @starter:if crawl - cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service - // @starter:endif - databaseName: { domain: 'example-studio.pl' }, - // @starter:if graph - //: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph - // @starter:endif - ipHeader: true, - // @starter:if r2 - storage: process.env.ALLOW_LOCAL_MEDIA !== '1', - // @starter:else - //: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions) - // @starter:endif - }).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)), - ) -} -``` - -### `src/instrumentation.ts` - -```ts -import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env' - -export function register() { - if (process.env.NEXT_RUNTIME !== 'nodejs') {return} - // storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for - // local checks and CI only — never set it in Coolify. - // cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service). - // databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor). - // R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md). - assertEnv( - ipalEnvRules({ - // @starter:if crawl - cookieCrawl: true, // IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production — the shared cookie-crawler service - // @starter:endif - databaseName: { domain: 'example-studio.pl' }, - // @starter:if graph - //: emailGraph: true, // GRAPH_* — e-mail through Microsoft Graph - // @starter:endif - ipHeader: true, - // @starter:if r2 - storage: process.env.ALLOW_LOCAL_MEDIA !== '1', - // @starter:else - //: storage: false, // media on local disk — a Coolify persistent volume (AGENTS.md → Project decisions) - // @starter:endif - }).map((rule) => (rule.name === 'R2_PUBLIC_URL' ? { ...rule, required: false } : rule)), - ) -} -``` - -### `src/instrumentation.ts` - -```ts -import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env' - -export function register() { - if (process.env.NEXT_RUNTIME !== 'nodejs') {return} - // storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for - // local checks and CI only — never set it in Coolify. - // cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service). + // @starter:endif // databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor). // R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md). assertEnv( diff --git a/reference/src/instrumentation.ts b/reference/src/instrumentation.ts index b09889b..668280d 100644 --- a/reference/src/instrumentation.ts +++ b/reference/src/instrumentation.ts @@ -4,7 +4,9 @@ export function register() { if (process.env.NEXT_RUNTIME !== 'nodejs') {return} // storage: R2 is required in production. ALLOW_LOCAL_MEDIA=1 lets a production build run on local disk for // local checks and CI only — never set it in Coolify. + // @starter:if crawl // cookieCrawl: IPAL_COOKIE_SCAN_URL / IPAL_COOKIE_SCAN_TOKEN in production (cookieScanner.crawl, the shared service). + // @starter:endif // databaseName: DATABASE_URI must name example-studiopl_dev / example-studiopl_prod (databaseNamesFor). // R2_PUBLIC_URL optional: media are served through the app by default (storage.md, env.md). assertEnv( diff --git a/src/modules/starter/generate.ts b/src/modules/starter/generate.ts index 8e9d625..e8345ad 100644 --- a/src/modules/starter/generate.ts +++ b/src/modules/starter/generate.ts @@ -180,12 +180,15 @@ type DoctorRule = { [key: string]: unknown; off?: boolean; reason: string; until /** * ipal-doctor.json: the domain, not launched yet, and every deliberate difference silenced with its reason — * the reference site's own silences (`inherited`, from its ipal-doctor.json) while the files they cover are in - * the site, CSP report-only for 28 days, and each module the owner turned off. + * the site, CSP report-only for 28 days, and each module the owner turned off. A temporary silence of the + * reference site (one with `until`, a follow-up of its own) is not inherited: a new site starts with that check on. */ export function renderDoctorConfig(a: StarterAnswers, ctx: SiteContext, inherited: Record = {}): string { const until = new Date(`${ctx.date}T00:00:00Z`) until.setUTCDate(until.getUTCDate() + 28) - const kept = Object.entries(inherited).filter(([id]) => id !== 'audit:collections-present' || a.content.collections.length > 0) + const kept = Object.entries(inherited) + .filter(([, rule]) => !rule.until) + .filter(([id]) => id !== 'audit:collections-present' || a.content.collections.length > 0) const rules: Record = { ...Object.fromEntries(kept), csp: { off: true, reason: 'report-only at the start; switch to enforce once the [csp] reports are clean (security.md → ROLL OUT CSP)', until: until.toISOString().slice(0, 10) },