Database naming rule; seeding after launch touches named records only

- Rule (VERY IMPORTANT): databases are named <domain without dots>_prod /
  _dev (intecion.com → intecioncom_prod / intecioncom_dev) on MongoDB and
  Postgres — AGENT.md top rules, deployment.md §4.2a (Coolify), env.md,
  ipal-setup architecture questions (derive, then confirm), AGENTS.md
  template. ipalEnvRules({ databaseName }) warns (never fails) on a
  mismatch, domain from NEXT_PUBLIC_SERVER_URL or { domain }, { warn }
  overridable; helpers databaseNamesFor, databaseNameFromUri,
  checkDatabaseName from the root and /env.
- Rule (VERY IMPORTANT): after launch never re-seed everything — AGENT.md,
  seeding.md, ipal-site, ipal-form, ipal-reference. createSeeder gains
  `only` / SEED_ONLY (pages:slug, forms:title, global:slug, collection:*;
  the rest → "skip (not listed)") and refuses a run with no record list
  against a production / non-local database unless IPAL_SEED_ALLOW_FULL=1
  (guard.allowFull; dry runs allowed). Seed templates carry an ONLY list;
  the form seed touches only its own form.
- Tests: seed only/full-run guard, database-name helpers and warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 13:27:46 +01:00
co-authored by Claude Opus 5.5
parent 9ecab39783
commit af7d96f0e3
19 changed files with 331 additions and 46 deletions
+18 -2
View File
@@ -36,6 +36,19 @@ patch `node_modules` or fork the package.
**Docs language:** all ipal-kit docs, this guide and the skills are written in English.
Write new rules, AGENTS.md entries and plugin-gap reports in English.
> **VERY IMPORTANT — seeding after launch.** Once a site is live, **never run a full seed again**: the owner's
> edits on the live site must survive. Every later change targets **named records only** — specific pages,
> globals, forms or fields — listed in the seed (`only: [...]` / `SEED_ONLY="pages:kontakt,global:header"`).
> Never re-seed everything, not even in create-only mode, without the owner's explicit OK. `createSeeder`
> refuses a run with no record list against a production or non-local database unless `IPAL_SEED_ALLOW_FULL=1`
> (set it only after that OK).
**Database names** (MongoDB and Postgres): the site's domain **with the dots removed**, plus `_prod` or `_dev` —
`intecion.com` → `intecioncom_prod` / `intecioncom_dev`, `architektimprez.pl` → `architektimprezpl_prod` /
`architektimprezpl_dev`. The name is the path of `DATABASE_URI`: `mongodb://…@mongo:27017/intecioncom_prod?authSource=admin`,
`postgres://…@db:5432/intecioncom_prod`. You derive the names from the domain and confirm them with the owner (ipal-setup
stage 0). `ipalEnvRules({ databaseName: true })` warns when they do not match (deployment.md §4.2a).
**Seeding on production** (details: `node_modules/@intecion/ipal-kit/docs/seeding.md`). Write seeds with
`createSeeder` from `@intecion/ipal-kit/seed` (the templates do) — it enforces every rule below:
- Seeds are create-only and idempotent: match by the default-locale slug / form title / the global, skip what exists.
@@ -44,6 +57,7 @@ Write new rules, AGENTS.md entries and plugin-gap reports in English.
- On production: dry run first (`SEED_DRY_RUN=1`), back up the database (Coolify **Backup now**), then the real run.
- `SEED_UPDATE=1` on production / a non-local database only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`, after a backup;
records an editor changed are always skipped and reported (`skip (edited)`) — never use `SEED_FORCE=1` there.
- After launch: named records only (`only` / `SEED_ONLY`); a full run of a live database is refused without `IPAL_SEED_ALLOW_FULL=1`.
- Schema and one-off data fixes → Payload migrations; field renames with content → **ipal-migrate-fields**; content → seeds.
## Ask before you build — architecture questions
@@ -60,7 +74,7 @@ the ready-to-send list is in **ipal-setup** stage 0 (ipal-site phase 0 uses the
| Forms | which forms, who receives them, e-mail provider (SMTP from the panel or Microsoft Graph) |
| Analytics and consent | GA4 / GTM / pixels, Consent Mode basic or advanced, cookie banner mode, cookie scan |
| SEO / GEO | market and local business data, AI crawler policy (llms.txt, Markdown, MCP, AI bots) |
| Data and media | database (Postgres or MongoDB), media storage (R2 or local disk) |
| Data and media | database (Postgres or MongoDB) and its names (`<domain without dots>_prod` / `_dev` — derive, then confirm), media storage (R2 or local disk) |
| Admin | 2FA, white-label (client brand in the panel), agency credit |
| Hosting | Coolify, the production domain(s), who adds the DNS records (deployment.md §6) |
@@ -1290,10 +1304,12 @@ Write everything in this file in English.
## Project decisions
- Architecture answers (AGENT.md "Ask before you build"), one line each: languages + default + URLs ·
styling · pages/collections · forms + e-mail · analytics/consent/cookie scan · SEO/GEO · database + media ·
styling · pages/collections · forms + e-mail · analytics/consent/cookie scan · SEO/GEO · database (+ names
`<domain>_prod` / `<domain>_dev`, e.g. `intecioncom_prod`) + media ·
2FA/white-label/credit · hosting + domains + DNS
- <client-specific decisions, e.g. "blog without authors", "404 = homepage">
- <approved workarounds: what, why, plugin-request file, owner's approval>
- Launch date: <date> — from then on seeds touch named records only (AGENT.md "seeding after launch")
- <exceptions to the rules — with the reason>
- <only on a client decision> ipal-audit-skip: <keys from AGENT.md §0b> — <reason, source of the decision>
```