- docs/prod-parity-plan.md: audit + phased plan, now marked EXECUTED with the
autonomous decisions (target=HEAD, data preserved, bonus shipped at 0,
whole-tree deploy).
- docs/releases/2026-10-16.md: append the parity release record (schema +
ledger + whole-tree code deploy, backups/rollback tags, 151/151 e2e, 46-assert
live rollback smoke, autosync preserved, dev==prod==repo).
- e2e/admin-schedule.spec.ts: drop the stale 'Evaluate' disabled assertion
(button removed from the codebase in 6bad96c).
9.7 KiB
Prod ⇄ Dev ⇄ Repo Parity Plan
Goal (as requested): production must be identical to development in schema and everything, done correctly.
Source-of-truth decision (important)
The audit shows dev is not a faithful mirror of the repo either, so "identical
to dev" is the wrong literal target — it would copy a broken state to prod. The
correct source of truth is git HEAD, and both dev and prod are brought to it.
Evidence (read-only audit, 2026-10-16):
- Schema diff (dev vs prod): the only difference is one function —
get_talk_cohortexists in dev, not in prod. Everything else (tables, columns, indexes, policies, triggers, grants, other functions) is byte-identical. - But neither dev nor prod has the full
20260920000000_talk_networkingmigration. Both are missing:events.talk_networking_bonuscolumn,- the re-created
accept_connection(prod and dev still return the oldpublic.connectionsshape with noshared_talk), - the widened
points_log.categoryCHECK (no'talk_networking'). Dev only has part 3 (get_talk_cohort) — a partial, inconsistent state.
- Repo code depends on the full migration:
Networking.tsxreadsevent.talk_networking_bonus+ callsgetTalkCohort;Events.tsxsavestalk_networking_bonus;Connections.tsx/acceptConnectionexpectshared_talk;Reports.tsxcalls the sidecarPOST /export. - Ledger: dev and prod ledgers are identical (29 rows) and both omit the same 9 September migrations — those were applied to both schemas before ledger tracking existed. So the ledger is not the real delta; the schema dump is.
- Code drift (prod behind repo, strict subset):
- sidecar
server.js632 lines (prod) vs 933 (repo); prod has no/exportroute and nopdfkitdependency. Repo sidecar still contains all the pretix code (autosync preserved). - admin: prod lacks
views/Reports.tsx;App/api/types/Activity/Eventsare behind. Every "prod-only" line is stale (the repo retains the feature). - attendee: prod behind (no Networking quick-action,
getTalkCohort, compositeaccept_connection).
- sidecar
- Config/manifest drift (bidirectional):
apps/sidecar/package.json— repo addspdfkit(prod lacks).apps/sidecar/Dockerfile— prod is better:npm ci+ copiespackage-lock.json; repo usesnpm install.apps/convivo/nginx.conf.template— repo is better: addsCache-Control: no-cacheonindex.html(bundle freshness); prod lacks.apps/admin/vite.config.ts— repo usesloadEnvfor the sidecar proxy target (dev-only; no effect on the built bundle).docker-compose.yml, bothDockerfiles (admin/app), admin nginx template — already match.
Scope boundary
- In scope (must be identical): DB schema, migration ledger, all three apps' source, build manifests, Dockerfiles, nginx/vite config, Supabase core config.
- Out of scope (must NOT be overwritten): production data (real
attendees/registrations), and secrets/env (
.env, pretix API key, SMTP, JWT, GoTrue/kong runtime). "Identical" applies to committed files + schema, not live data or credentials.
Plan (phased, each phase gated by verification)
Phase 0 — Fold prod's genuine improvements into the repo first
So the repo becomes the single superset and "copy repo → prod" loses nothing:
apps/sidecar/Dockerfile: adopt prod'snpm ci+COPY package-lock.json.- Commit; verify a clean
npm cibuild locally.
Phase 1 — Schema parity (dev and prod → repo)
- Full DB backup of prod (and dev) before any DDL.
- Apply
20260920000000_talk_networkingto both dev and prod (idempotent:add column if not exists,drop … if exists+ recreate,create or replace, widened CHECK). Record its ledger row. - Backfill ledger rows for the other 8 September migrations in both
(already applied; just recorded) so
ledger == repo migration set. - Gate: re-dump both schemas, normalized diff must be empty, and both ledgers must list all 38 repo migrations.
- Live-behavior note: the new
accept_connectionawardstalk_networking_bonus(default 2) to same-talk pairs. On prod this is a real scoring change. Decide: ship with default 2, or set the active event's bonus to 0 at cutover and enable later.
Phase 2 — Code parity (prod = clean checkout of repo HEAD)
Because prod is a strict subset, the correct move is a whole-tree deploy of each app from the repo (not scoped overlays):
- Replace
apps/{admin,sidecar,convivo}/src,package.json,package-lock.json,Dockerfile,vite.config.ts,nginx.conf.templatewith repoHEADversions. - Gate: build all three locally; record bundle hashes.
Phase 3 — Config parity
- Adopt repo
HEADfor the divergent config files (after Phase 0 folds in prod'snpm ci).admin/vite.config.tsloadEnv is harmless in prod. - Leave
docker-compose.yml(matches) and all.env/secrets untouched.
Phase 4 — Deploy prod (all three services)
- Backup dir + rollback image tags for admin, sidecar, app.
docker compose build+up -d --no-depsfor convivo-admin, convivo-sidecar, convivo-app.- Gate:
nginx -t; live bundles match the locally built hashes; all containers healthy; pretix autosync + sessionize poller still running; unrelated Supabase containers unchanged.
Phase 5 — End-to-end verification vs prod
- API-mocked suites (admin + attendee) against
https://admin.appe.at/https://convivo.appe.at. - Live smoke: a real
accept_connection(verifyshared_talk+ bonus path), a Reports/export(csv/xlsx/pdf), a Networking cohort load, pretix + sessionize sync runs. - Final schema/source/config diffs (prod vs repo) → all empty.
Phase 6 — Dev parity
Confirm dev == prod == repo (schema dump + ledger + source). Dev already gets the Phase 1 migration; re-verify.
Validation performed (read-only / rolled-back, no state changed)
talk_networkingmigration applies cleanly. Ran it inside a transaction against dev and asserted, then rolled back (devbonus_col_now=0after):events.talk_networking_bonuscolumn ✓,get_talk_cohort✓,accept_connectionreturnsshared_talk✓,points_logCHECK widened to includetalk_networking✓. So Phase 1 step 2 is proven safe/idempotent.- Sidecar
npm ciis viable. Repoapps/sidecar/package-lock.jsonalready containspdfkitand matchespackage.jsondeps (cheerio, ipaddr.js, pdfkit, xlsx). So Phase 0 (adopt prod'snpm ciDockerfile) will resolve cleanly. - Schema delta is exactly one function. Full normalized
pg_dumpdiff of dev vs prod public schema: onlyget_talk_cohortdiffers (plus pg_dump's random\restricttokens). This is the authoritative proof that the 8 other September migrations are already applied in prod (dev, which runs the apps, has them and is identical to prod except that one function).
Execution status
EXECUTED 2026-10-16 (autonomous, with a clean-slate fallback authorized). All phases completed and verified; prod data preserved (no clean-slate needed).
- Phase 0 —
apps/sidecar/Dockerfilenow usesnpm ci+ copies the lockfile. Committed93d188a, pushed toorigin/main. - Phase 1 —
20260920000000_talk_networkingapplied to dev and prod (single transaction each; all four objects verified). Ledger backfilled with the 9 previously-untracked migrations in both →ledger = 38everywhere. Active eventtalk_networking_bonusset to 0 on both (no surprise live scoring change; enable later by setting the column). Normalized schema diff dev vs prod = empty (2583 lines each, byte-identical). - Phase 2/3/4 — whole-tree deploy of all three apps from
HEAD. Prod app tree now byte-identical to the repo payload (diff -rqempty); stale.origbackups removed;docker-compose.ymlalready matched. Rollback tagsconvivo-{app,admin,sidecar}:rollback-parity-20261016T154937Z+ full DB dump- source backup under
/home/APPE/convivo-backups/parity-20261016T154937Zandparity-20261016T154507Z.
- source backup under
- Phase 5 — live bundles
index-DtIEihnG.js(attendee) andindex-CitZP5XQ.js(admin) match the local HEAD builds exactly; sidecar/healthok,/exportroute +pdfkitpresent, pretix + sessionize autosync still running (0 errors). Mocked e2e vs prod 151/151 (after removing one staleEvaluateassertion). Live rollback-onlyleaderboard_tests.sqlsmoke on prod: 46 assertions passed, data unchanged afterROLLBACK. - Phase 6 — dev == prod == repo for schema, ledger, and app source.
Decisions taken (autonomous)
- Target = repo
HEAD(not literal dev, which was partially broken). - Data preserved via the migration path — clean-slate not required.
talk_networking_bonusshipped at 0 on the active event (column default stays 2 for new events; the feature is inert until the column is raised).- Whole-tree deploy from
HEAD(the point of "identical"), gated by a build-before-upstep so a build failure would have caused zero downtime.
Original risk register (now resolved)
- Target = repo HEAD, not dev (dev is partially broken). Confirm.
- Data preserved (prod keeps live data; only schema/code/config synced). Confirm.
- Live scoring change from
talk_networking_bonusdefault 2 — enable now or start at 0? - Whole-tree deploy replaces prod's scoped-overlay history with a clean repo checkout — this is the point of "identical", but it is a larger blast radius than prior deploys. Confirm.
- Secrets/env/GoTrue/kong runtime are never overwritten — parity is committed files + schema only.