Runbook — Graph API Version Upgrade (stub)
This is a stub. The full runbook is promoted to docs/operations/upgrade.md in Phase 7.
What this runbook covers
The quarterly procedure for bumping the pinned Meta Graph API version (e.g. v23.0 → v24.0). Includes app version bumps and the rolling deploy sequence.
Outline
Graph API version bump (quarterly)
-
Read the changelog —
https://developers.facebook.com/docs/graph-api/changelog/breaking-changesfor the target version. Note any breaking changes to:- Webhook payload shapes.
- Message send endpoint structures.
- Media upload/download endpoints.
- Error codes (additions or removals).
-
Update fixtures + types — apply any payload changes to
src/meta/types.ts. Update test fixtures intests/fixtures/meta-payloads/to reflect new shapes. -
Branch and test — bump
WA_GRAPH_API_VERSIONin.env.exampleanddocker-compose.prod.yml. Run fullpnpm test:ciagainst the new version’s mocked endpoints. -
Staging dry-run — deploy to a staging compose pointing at a Meta test number. Run the smoke checklist. Send + receive across every message type.
-
Production deploy — merge, deploy, watch
audit_logfor new error codes. Have a quick rollback path ready (revert + redeploy).
App version bumps
- Patch / minor: standard rolling deploy. Inngest functions are versioned per the SDK; functions in-flight at deploy time finish on the old version, new events use the new version.
- Major: read the migration notes. Drizzle migrations apply automatically on app startup — but DB-breaking changes require a maintenance window, documented per-bump.
Rolling deploy sequence
- CI builds image with new SHA, pushes to
ghcr.io. - On the host:
cd /opt/whatsapp-mcp && git pull. docker compose pull app.docker compose up -d app— Compose restarts the app; Postgres + Nginx keep running./healthreaches 200 within 30 s.pnpm smokegreen.
Rollback (forward-only migrations + restore-from-backup)
Drizzle is forward-only — there are no auto-generated DOWN scripts. The rollback policy is:
- App-only rollback (no schema change in the broken release):
git checkout <previous-sha>→docker compose pull && docker compose up -d. Done in < 1 minute. - App + schema rollback (broken release ran a migration): you cannot un-apply the migration in place. Instead:
- Take an immediate
pg_dumpof the current (broken) state to a quarantine file in case forensics is needed. - Restore the latest pre-deploy
pg_dumpfrom/var/lib/whatsapp-mcp/backups/into a fresh Postgres volume (see backups.md). Recent data since the last backup is lost — acceptable trade for “rollback safely”. - Deploy the previous app SHA.
- Investigate the failed migration in a staging branch; fix forward in a new migration; re-deploy.
- Take an immediate
This is why backup cadence matters. Nightly is the floor; if a phase introduces a high-churn migration, take an ad-hoc pg_dump immediately before the deploy.
Open items
Full runbook will include the exact changelog-watching schedule (calendar invite), the staging compose file, and a per-version verification matrix.