# Official lists are versioned rules

The repository's architectural decision, rationale and consequences.

# Official lists are versioned rules

**Status:** accepted · **Date:** 2026-11-06 · **Related:** [ADR-0002](0002-no-barrels-on-server-capable-modules.md), [ADR-0015](0015-household-data-lives-on-the-device.md)

**Enforcement:** `scripts/leaf-modules.test.mjs` (the `// LEAF MODULE` header), Brandt-household tests in `packages/preparedness` (82 L water, 67,000 kcal); `packages/api/src/features/lists/lists.procedures.test.ts` (seeded versions equal the package, publish needs two distinct sign-offs, published rows refuse UPDATE/DELETE/TRUNCATE through the `list_version_immutable` trigger and have no tenant UPDATE/DELETE grant).

Every quantity in Varu must cite its source, date and version, and a published version must never change (RNF12). The list is needed on the phone, in the web editor and in the API, and the phone must compute without a network.

## Decision [#decision]

1. **A leaf, isomorphic package `packages/preparedness`.** No I/O, no framework imports, a `// LEAF MODULE` header. It holds the list versions `DE-2025.10` (BBK "Vorsorgen für Krisen und Katastrophen", 13.10.2025) and `EU-72H` (EU Preparedness Union Strategy, 26.03.2025), the quantity formulas and readiness. Mobile, web and API import it.
2. **Formulas are rules, not code paths.** Water 2 L/person/day; pets 0.2 L/pet/day (a hypothesis, marked as such); kcal/day adult 2,200, needs-help 1,900, child 1,500, baby 800; goal days 3, 7 or 10. Readiness is the mean of 8 areas; days is the minimum of water days and food days.
3. **Published versions are immutable rows in Postgres** for the editor and for `GET /lists/:country/:version`: a list version, its item rules, its source and two review sign-offs. Publishing inserts; nothing updates. A correction is a new version.
4. **The app ships the versions it knows** and learns newer ones from the API; the home records which version it follows.

## Why not the alternatives [#why-not-the-alternatives]

- **Rules only in Postgres.** The phone would need the network to compute readiness, which breaks offline use.
- **Rules only in the app bundle.** The municipality editor could not publish, and a correction would need a store release.

## Consequences [#consequences]

- Package and database must agree: a test loads each published seed version and compares it with the package.
- Changing a formula is a new version, never an edit of `DE-2025.10`.

