You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add maintenance mode for SCCN migration window #342
During the SCCN Cloudflare migration (Epic #314, Phase 6 D1 data sync + Phase 8 DNS cutover), we need to freeze writes on the personal-account backend so the D1 dump captures a consistent snapshot. Any writes during the dump/restore window risk silent data loss.
Solution
Add a maintenance-mode middleware to the backend that can be toggled via the MAINTENANCE_MODE env var (off | read-only | full) and redeployed.
Modes
off (default): normal operation
read-only: block all POST/PUT/DELETE except admin endpoints; GETs still work so users can clone/download
full: 503 on everything except /health, /notices, and admin auth (so admins can toggle back)
Response shape — 503 with Retry-After header and JSON body:
{
"error": "Service Unavailable",
"message": "NEMAR is in maintenance mode for the SCCN migration.",
"mode": "read-only",
"eta": null
}
Scope
backend/src/middleware/maintenance.ts with 3 modes
MAINTENANCE_MODE in both wrangler.toml and wrangler-sccn.toml
CLI detects maintenance 503 and shows a friendly banner (no stack trace)
Tests for each mode (no mocks)
Context
Blocks Epic #314 Phase 6 (D1 data migration) and Phase 8 (DNS cutover). Hotfix branched off main since production needs it first.
Activity
Add maintenance mode middleware (#342)
Merge pull request #343 from nemarOrg/feature/issue-342-maintenance-mode
Sync main to dev: maintenance mode + hotfixes