Cloud operations and isolated recovery
The prototype for #47 implements private configuration validation, bounded operational diagnostics, an additive migration and an isolated native backup/restore drill. ADR-0011 defines the recovery admission barrier; host evidence records its executed checks. This does not provision a provider or automatically open restored control paths.
Configuration, health and metrics
operationsConfig validates a private realm, expected database role, PostgreSQL URL, key length and exact browser origins. Non-local database connections require sslmode=verify-full. Isolated composition requires a test realm/local host; production composition requires explicit protected-main selection. Errors contain fixed codes, never rejected values, URLs or keys. This validator is an explicit composition prerequisite, not an environment-to-production fallback. Continue to use the existing protected-main build/CI gate and independently configured Gredice directory/resource ownership.
Trusted composition installs OperationsHttp/configureOperations with the shared current identity/resource/audit boundary and an OperationsMonitor. GET /api/sites/:siteId/operations/health requires diagnostics.read, current site access and committed authorization evidence, then rechecks authority after probes. Ordinary starts and branch previews return redacted 503. Capacity, unavailable dependencies or missing probes produce degraded results. A quarantined database also denies required audit admission; use the separate owner connection to diagnose recovery state.
The native database probe checks fsync, required registry/jobs/audit/realtime/telemetry/media schema, installed admission barrier and its state. A database-owner runtime role is degraded. Broker and private-object probes are explicitly supplied trusted adapters; absence is unconfigured, and no fixture implies provider readiness. Probes have 750 ms deadlines, one active health call and retained per-service slots: a callback that ignores cancellation cannot accumulate overlapping work on repeated timeouts. Database pool/statement/connection deadlines still apply to underlying SQL.
Operational logs have 64 entries and closed operation/outcome fields, generated opaque correlation IDs and capped duration; counters saturate at signed int32 and reset on process boot. No arbitrary message, stack, URL, request body, actor/media payload or credential field is accepted. Pass generated correlation IDs from trusted authorization/admission wrappers when instrumenting other service operations. These process-local observations are not durable audit or a carrier meter. Public site diagnostics return current probe results only; private owner tooling owns historical process logs/counters across sites.
Migration and least privilege
Apply 0010-operations.sql after the existing audit baseline using the private owner script pnpm --filter @arbi/dashboard db:migrate:operations. Supply ARBI_OPERATIONS_DATABASE_URL, ARBI_OPERATIONS_DATABASE_ROLE, ARBI_OPERATIONS_REALM and ARBI_OPERATIONS_NAMESPACE privately. The script checks the actual role and registry realm/namespace; it prints fixed outcomes and preserves existing quarantine. Application startup never runs migrations.
The application role must not own database/schema/audit tables. Retain each adapter's narrow existing grants, then grant EXECUTE on arbi_operations_ready() and SELECT on arbi_operations_gate for diagnostics. Do not grant UPDATE/INSERT/DELETE/TRUNCATE on the barrier or recovery receipts. The security-definer lock function has no parameters, a fixed search path and no public execution grant. Recovery/migration uses postgresOperatorDatabase through an explicitly private owner connection; no request can select this mode.
The migration is additive/idempotent and does not rewrite prior audit, registry or command identities. Reapplying it cannot reset a quarantined database to ready. New ordinary postgresDatabase transactions hold the barrier lock inside BEGIN through COMMIT. Before this migration is installed, legacy databases retain their existing behavior; deployment readiness reports the missing recovery schema. Roll back application code only after considering whether it supports quarantine. Do not remove the barrier, drop immutable history or expose an older unguarded binary to an unresolved restore.
Backup, restore and recovery limits
The committed operator drill helpers accept only an owned, private /tmp/arbi-enrollment-pg-* Unix socket cluster, test realm and bounded arbi_* database names. They reject network/production targets, other registry realms, an active source barrier, an existing/nonempty target, source-as-target and a changed archive. Stop all writers, quarantine source admission and keep the owner connection private. pg_dump creates the consistent custom archive; table fingerprints preserve registry/jobs/reports/leases/audit/outbox/usage/media/realtime/telemetry references. The archive is SHA-256 checked, at most 16 MiB and mode 0600 in a private directory. The manifest/catalog references also stay private; no dump is a public repository artifact.
pg_restore --single-transaction --exit-on-error restores a different empty test database. The tool reapplies the additive owner migrations to restore closed PUBLIC privileges, then verifies the reference fingerprints. It does not copy deployment grants. Independently trusted immutable release-catalog digest/signature material must match the restored release references; a catalogue signature is not replaced by a backup manifest. The archive checksum is not an authentication signature. Private object bytes, provider directory state, signing keys and events after the snapshot are not in this database backup.
quarantineRestoredRealm operates through the private connection, for at most 32 test sites and 128 immutable recovery receipts. It is idempotent by recovery ID/archive digest. Its transaction retires restored active leases, marks pending command delivery receiver-changed while preserving original command/actor/terminal evidence, revokes restored device keys, removes current receiver/telemetry projections and broker replay/grant state, revokes synthetic dashboard sessions and changes realtime epoch. Durable policy authorization plus per-site/aggregate receipts commit atomically with the gate. SQL/audit failure rolls everything back. Application admission remains blocked; no lease, old signed snapshot, original command or token is replayed automatically.
There is no automatic release API. Before a privileged operator sets admission ready, reconcile post-backup device journals, local fence/clock/boot state, new enrollment, current Gredice session/account/device revocation, external broker/relay grants, immutable release trust and private media object integrity. Restore unknowns never become physical completion, fresh metering, zero usage or a known carrier allowance. Expired/manual intent stays expired. Preserve off-database evidence and account for its recovery point separately.
For production, use independently controlled Neon backup/PITR and an isolated restore branch, private-object inventory/version backups, external identity/provider revocation and deployment-role reconstruction. Keep the restored target inaccessible to ordinary credentials until checks complete. Define recovery point/retention from the selected provider policy and actual object snapshots; the prototype's snapshot contains no writes after dump and proves no production RPO/RTO. Record a provider-specific drill before production enablement. Rotate revoked device/user/service/signing credentials through their owning workflows; never recover a private signing key from an application dump.
Operational response and retention
Dependency outage stops new admission at the existing required-audit/current-authority boundary; cloud health returns explicit degradation. Diagnose via private fixed-code operations counters, immutable correlation records and provider status, then restore the dependency and reauthorize the original caller. Refresh observations; do not resend an old manual gesture, capture or update based on a recovered connection.
Schedule bounded telemetry, realtime, image, usage and audit lifecycle maintenance with their separate owner roles and deadlines. A scheduler/health probe must not retire audit payloads without the accepted policy/holds/steward receipt. Quarantine blocks ordinary maintenance as well as admission. Preserve private incident artifacts with access/retention controls, inspect reconciliation gaps and record operator recovery decisions before releasing service. Remote health/control cannot replace independent local stopping, hardware commissioning or qualified safety review. Recording remains unavailable.