Rollout and Rollback Runbook
This runbook covers the OSS release candidate of the LenserFight Trust Gateway (LTG). It assumes the CLI, daemon, and Supabase migrations are deployed together.
Rollout Order
- Apply migrations through
20270513000001_pre_oss_gateway_security_hardening.sqlon a disposable database. - Run
supabase db test --db-url $LOCAL_DB_URLand confirm gateway tests07_gateway_security.sqland08_gateway_xp_audit.sqlpass. - Build the binaries:
bash
pnpm nx build cli
pnpm nx run gateway:build
pnpm nx run gateway:build-init- Initialize one local device:
bash
LF_GATEWAY_KEY_FILE_FALLBACK=1 node dist/apps/gateway/init.js
node dist/apps/cli/main.js gateway identity show- Run offline-safe doctor checks:
bash
node dist/apps/cli/main.js gateway doctor --check daemon,transport --json- Enable Tailscale only after explicit consent:
bash
lf gateway consent show
lf gateway consent grant tailscale
lf gateway serve --tailscaleRollback Strategy
Most gateway schema changes are additive, but XP and audit-chain side effects are append-only. Treat them as compensating-action rollbacks rather than destructive reversions.
| Area | Rollback Action | Notes |
|---|---|---|
| Daemon runtime | Stop lf-gatewayd; do not pass --tailscale; revoke consent with lf gateway consent revoke. | No database rollback required. |
| Device trust | Use devices.fn_device_revoke through CLI/RPC. | Revocation is audited and should not be deleted. |
| Sync engine | Stop daemon loops and stop calling fn_sync_push/fn_sync_pull. | Outbox rows can remain for later reconciliation. |
| Attestation verification | Stop using fn_record_signed_attestation; trust remains capped unless verified rows exist. | Do not delete verification rows; they are incident evidence. |
| XP | Add compensating XP ledger events if a rule over-awarded. | Do not mutate existing XP ledger rows directly. |
| Audit chain | Leave existing audit.hash_chains rows intact. | Use audit.fn_chain_verify to document integrity state. |
Emergency Disablement
Use this sequence for a suspected compromised device or bad gateway release:
- Revoke the device trust in Supabase using the owner account.
- Set workspace
global_kill_switch = trueorrunner_paused = true. - Stop
lf-gatewaydon all local machines. - Revoke Tailscale consent locally:
bash
lf gateway consent revoke- Run:
sql
SELECT * FROM audit.fn_chain_verify('<lenser-id>'::uuid, 'gateway');- Preserve logs containing
xp.apply failedorgateway hash chain append failednotices.
Release Validation Checklist
lf gateway doctor --check daemon,transport --jsonpasses in CI.- The daemon refuses
SUPABASE_SERVICE_ROLE_KEY. --bind 0.0.0.0is rejected.--tailscalerefuses startup without matching consent.audit.fn_chain_verifyrefuses non-owner authenticated callers.VERIFIED_LOCAL_EXECUTION_COMPLETEDXP only mints onfully_trustedtransitions.