# Production operations release — 19 October 2026

## Implemented
- Real workspace is the default; demo remains explicitly selectable and isolated.
- Consent-scoped private coordination messages, server-side access checks, idempotent sends and 30-day cleanup. Only the requester and that response's donor can read; admin status alone does not grant access.
- Verified phone sync from the trusted authentication result, AES-256-GCM with random nonce and identity-bound authenticated data. No client-supplied phone is accepted. Owner-only disclosure requires active donor consent; access is audited. Saved phone contact must be reconfirmed within 30 days.
- SMS opt-in/out and Bangladesh quiet hours. Transactional notification outbox, claimed jobs, retry backoff, five-attempt cap, stable idempotency keys, a five-minute recipient cooldown, delivery receipts and cancellation for inactive users/requests.
- Operator assignment, paginated queues, report review, suspension/restoration and independently authorized donation reversal with points correction.
- Material request edits revoke old consent and shares, withdraw responses and require fresh matching. Editing is blocked after handoff or any donation report. A matching epoch permits new outreach after edits without duplicate ordinary invitations.
- Expanded identity-scoped data export and erasure of stored contacts, conversations involving the erased account and delivery records. Authentication-provider deletion is separate.
- Maintenance expires requests/consents/availability and removes old messages, stale rate-limit buckets and old share records. A database lease limits traffic-driven background execution to once per five minutes. There is an authenticated job endpoint for an external scheduler.
- Explicit trusted-gateway configuration. Standalone production defaults must not trust user-supplied platform identity headers. Invalid external sessions do not silently switch to a different platform account.
- Public information pages opt into indexing; account, request detail and share pages retain noindex. Private APIs use no-store.

## Runtime setup
Keys are documented in the root `.env.example`. Set runtime values through Sites settings, never source control or frontend environment prefixes. Keep a secure recovery copy of the phone encryption key: replacing it without re-encrypting existing rows makes those numbers unreadable. No provider account has been invented or borrowed from another business.

Dedicated Supabase authentication still needs its URL, publishable key and channel flags, redirect allowlist, SMS/email provider and tested recovery. It remains auth only; application data is in D1. Configure actual trusted operator IDs in `QUICKGENCY_ADMIN_IDS`. Do not treat Google/email sign-in as mobile verification.

## SMS adapter contract
This release implements a server-to-server adapter boundary, not a connection to a named SMS vendor. Configure `QUICKGENCY_DELIVERY_URL` to your owned HTTPS adapter and `QUICKGENCY_DELIVERY_TOKEN` to its bearer secret. The adapter receives POST JSON:

```json
{"id":"job-uuid","to":"+8801…","channel":"sms","template":"quickgency_update","message":"Generic coordination update"}
```

The Authorization header contains the bearer credential; Idempotency-Key is the job UUID. The adapter MUST persist deduplication by this key before sending to its vendor and return a 2xx JSON response `{"id":"provider-message-id"}`. Acceptance is not delivery. Redirects are rejected; request timeout is ten seconds. No clinical/request details or private message text are sent in SMS. Failed attempts retry with backoff, capped at five; exhausted jobs remain visible as `dead`.

The adapter posts `{ "id":"job-uuid", "providerId":"provider-message-id", "status":"delivered" }` (or `failed`) to `/api/delivery-receipt`, authenticated by `QUICKGENCY_RECEIPT_TOKEN`. Retry a receipt that races the initial acknowledgement; `updated:false` can also mean an already processed or mismatched receipt. Protect receipt credentials, verify actual vendor signatures in the adapter and never accept a browser's delivery claim. Configure sender registration, vendor limits and opt-out handling with the selected provider before enabling.

## Maintenance and scheduling
`POST /api/jobs` uses `Authorization: Bearer <QUICKGENCY_JOB_TOKEN>`. It performs cleanup and processes up to ten due jobs if delivery is configured. It exposes no visitor identity or private data. An external scheduler should run every minute for reliable outreach; the traffic-driven fallback does not guarantee execution while idle. No unattended scheduler has been connected in this release. Operator buttons offer manual cleanup and dispatch. Stale consent cannot authorize contact even before cleanup runs.

A phone/message already seen or a provider call already in flight cannot be recalled by revocation. The application denies future access; SMS opt-out cancels jobs still queued. Provider-side deduplication is mandatory for crash recovery. Monitor accepted jobs that never receive receipts.

## Release and incident runbook
1. Maintain separate staging and production configuration. Test migration SQL on a restored staging copy before live data grows.
2. Before every release, take a provider-supported D1 backup and record its identifier and source commit. Keep phone encryption keys in a secret manager separately from the DB backup. This release does not claim a hosted backup/restore drill was performed.
3. Run `pnpm test`, `pnpm typecheck`, `pnpm build`, and `node tests/worker-smoke.mjs`. The Worker test applies all migrations to an ephemeral database and uses synthetic identities, never production.
4. Publish the exact tested source with generated Drizzle SQL/snapshots. Migrations already applied are immutable. Do not roll back the database by dropping new tables. Roll back compatible application code or make a forward corrective migration.
5. Alert a named operator for `housekeeping_failed`, unexpected 5xx, an aged maintenance run, unresolved reports and dead/aged delivery jobs. Log event categories and request IDs only; no tokens, phone numbers or private message text.
6. During provider failure, disable outbound delivery configuration, keep the truthful availability notice and in-app inbox, and handle requests through assigned operators. Do not claim successful SMS from an accepted HTTP response.
7. Recovery drill: restore a DB backup into isolated staging with the matching key, compare non-sensitive table counts, verify a synthetic consent/message flow, then document measured recovery time and data loss window. Hosting access is needed to execute this drill.

## Remaining launch gates requiring people/accounts or independent verification
- Real dedicated auth project, OTP/SMS adapter and end-to-end delivery test; operator account IDs; external scheduler; monitoring/alert destination; secret recovery ownership.
- Real-browser mobile/accessibility/social crawler tests; independent security assessment and representative hosted load/cost test. This environment has no supported browser QA tool.
- Staff roster and coverage hours, escalation protocol, verification/evidence standards, donor recruitment and verified hospital relationships. National location rows do not imply service availability.
- Retention policy for pseudonymous audit/request records, local professional policy/legal review and authentication-provider erasure process. The implemented message retention is 30 days; other retention periods are not silently invented.
- Staff allowlists are separated: administrators manage configuration-facing actions and suspensions; coordinators assign/review and manage assigned requests; verifiers review donation evidence. Populate actual account IDs and test the intended roster. Verification excludes the reporter/donor, and reversal also excludes the original verifier. No hospital partnership or clinical suitability is implied.

This release materially expands the application but is not a certification of production emergency readiness.

## Verification boundary
56 deterministic service/security tests pass, including encryption tampering, unauthorized access, consent expiry, idempotency, retry exhaustion, quiet hours, cooldown, role separation, correction, erasure and lease recovery. Production build and built-Worker checks are also required for this release. Real browser tests, provider delivery and hosted restore/load drills remain separate gates.
