Cutover weekend and rollback
How v2 replaces v1 in one weekend, what has to be true first, and how to go back. A CTO session keeps this guide. The steps that touch production become TL steps in the timeline's staff testing and cutover rows before they run; zuki runs every one of them.
It moved here on 2026-10-12 from the Google doc [Guide] v2 cutover weekend and rollback, brought in line with D20 and D21 on the way (#57). The old guide had a fixed date and a replay script; both are gone.
Before you start
Section titled “Before you start”The gate
Section titled “The gate”Cutover happens on the first suitable weekend after all four are true (D20). There is no fixed date.
- 10 nightly rehearsals in a row, each with reconcile at zero unexplained differences. A known difference counts only once it is signed in migration.accepted_differences (D18).
- Every test green: every pgTAP test, the per-role menu check and the Playwright journeys (D19).
- Each team lead's sign-off, after staff testing and their team's shadow day.
- A finance period close just before the weekend.
When picking the weekend, weigh the known calendar risks (D20): year-end holidays and close; GR 33/2026 from 16 January 2027 (D15); Ramadan and Lebaran, roughly February to early March 2027.
Also in place beforehand
Section titled “Also in place beforehand”- The v2 production project: Singapore, Postgres 17, the nightly pg_dump, MFA for super_admin (D16), and the auth settings (D51). Migrations applied by zuki, no seed (D11).
- Personal data: a retention rule for each kind of personal data, app.anonymize_driver(), the breach procedure, and the lawyer's review (D15, OQ18).
- Who does what on the weekend: zuki is the migration admin and runs every step; Syamsul Haris decides go/no-go, Saturday's call included (D62).
- What must work on the first Monday: everything moves, and driver onboarding, vehicle onboarding and collection must not break (D61).
- The E2E organization in production for the smoke tests; it stays there, sealed (D59).
- The point of no return, Tuesday (below), agreed with finance.
Links and QR codes that keep working
Section titled “Links and QR codes that keep working”- Printed unit QR codes encode v1's unit_id; v2 keeps it as unit_code, and the scanner reads the same payload.
- The static queue QR at the pool points at /antrian; v2 keeps that path.
- /bastk links already sent to drivers on WhatsApp keep resolving: v2 finds the old id through id_map.
- The domain moves to v2, and v1 moves to a read-only subdomain for reference.
Times are for the chosen weekend; T is the Saturday.
| When | What |
|---|---|
| T − 2 weeks | Staff testing on v2 staging starts, with a shadow day per team. Finance confirms the period close. |
| T − 1 week | Staff hear the date and get short training per team. v1 changes stop unless critical (D75): no new features or schema changes, so the last week's nights run on a v1 that no longer moves. |
| Friday 18:00 | v1 read-only (writes revoked) and v1's crons off. The week's last reconciliation in v1. |
| Friday 19:00 | The final run on v2 production: snapshot, migrate, photo difference, reconcile. Must be zero unexplained differences. |
| Saturday 08:00 | Smoke tests on v2 production, inside the E2E organization. Team leads walk through their day with real data. |
| Saturday 14:00 | Go/no-go, the real decision (D21). Go: the domain moves to v2 and v1 to its read-only subdomain. No-go: v1's writes and crons come back and nothing was entered in v2. |
| Sunday and Monday | Developers at the pool on Monday morning: queue opening, handovers, the gate. Every entry is in the audit log. |
| Tuesday | Finance checks the first nights of rent billing and Monday's payments in v2. Point of no return: after it, v1 is archived. |
| After cutover | The migration files are frozen into a baseline; from then on, schema changes are new files only (D11). |
The Friday run
Section titled “The Friday run”-
Stop v1's writes. Revoke insert, update and delete from v1's app roles, or put v1's app in maintenance mode, and stop v1's crons. Confirm no writes for 5 minutes.
-
Export v1's
activity_logon its own. The migration doesn't carry it: v2's audit log starts at cutover (zuki, #324, 2026-10-28). Through v2_reader, once writes have stopped, save the one table twice:- a CSV:
\copy (select * from public.activity_log) to 'activity_log.csv' csv header; - a one-table dump:
pg_dump -t public.activity_log.
Either opens without Supabase: the CSV in DuckDB, the dump in a throwaway
postgres:17container. Both hold who did what in v1, so they're personal data. Keep them outside the repository, beside v1's archive. Who may open them, and for how long, follows OQ18 (D15). Count the rows in each against v1 before going on. - a CSV:
-
Run the same migration as every night, with its foreign server pointed at v1 production, into the empty v2 production project.
-
Copy only the photo difference. The bulk went up in the weeks before, at D14 paths.
-
Reconcile. Anything above zero unexplained differences is a no-go, unless the difference is signed in migration.accepted_differences by the leads it concerns (D18).
-
Leave v2's scheduled jobs off (the rent generator, ETLE, GPS) until Saturday's go.
Rollback
Section titled “Rollback”Roll back if any driver balance differs from the balance of record, the gate lets out a car it shouldn't or blocks one it shouldn't, the queue can't open, or a role can't log in or do its work.
Before Tuesday's point of no return
Section titled “Before Tuesday's point of no return”There is no replay script (D21). A script that writes v2's entries back into v1's jsonb would be a reverse migration, written once and thrown away, for about one business day of entries.
- Point the domain back to v1, and restore v1's write access and its crons. v1's data is exactly as it was on Friday.
- Export what was entered in v2 meanwhile from audit_log, as a report.
- Re-enter those entries in v1 by hand, from the report, team by team.
- Tell staff, fix the cause, and wait for the gate again. The nightly rehearsal keeps running; the next attempt takes the next suitable weekend after the gate is met (D20).
After the point of no return
Section titled “After the point of no return”Fix forward in v2. v1 stays readable on its subdomain, then is archived. After that, v1's activity history is in the Friday run's activity_log export.