4.3 KiB
4.3 KiB
GL/Kuknos settlement operations runbook
Scope and invariants
GL is the financial source of truth and admission boundary. Kuknos is required eventual settlement. Never edit or delete GL journals, transaction events, settlement rows, or operator-audit rows. Never retry a CONFIRMED settlement. Never mark an application transaction successful from an operator console without matching GL and Kuknos evidence.
The kuknos-mock service in DevOps/local/compose.yml exists only for deterministic local orchestration tests. Never deploy it or point staging/production settlement configuration at it; release validation requires an authorized transaction against the real Kuknos network.
Normal lifecycle
- The application records/adopts the value change through GL.
- GL stores one signed XDR under a stable idempotency key.
- The worker claims PENDING or RETRYABLE work with a bounded lease.
- Kuknos submission returns a transaction hash and GL records CONFIRMED.
- Wallet reconciliation stores the hash and final application status.
- GL reconciliation compares the confirmed hash with lifecycle evidence.
Health and alert interpretation
database_ready=false: stop financial ingress immediately. Read-only pages may remain available.settlement_ready=false: stop financial ingress. Check GL database and worker logs.- Increasing
settlement_pending: check worker activity and Horizon latency. - Increasing
settlement_retryable: check Horizon response codes, TLS, DNS, passphrase, and XDR validity. - Any
settlement_manual_review: operator investigation is required. - Any open reconciliation issue: compare the settlement, latest GL transaction event, Wallet transaction, and Kuknos transaction before taking action.
MISSING_LEDGER_CONFIRMATION: Kuknos confirmed but matching lifecycle evidence did not arrive within ten minutes.TRANSACTION_HASH_MISMATCH: GL lifecycle evidence and Kuknos settlement reference different hashes. Treat this as a high-severity integrity incident.
Manual-review procedure
- Record the incident/ticket identifier.
- Locate the settlement by idempotency key in AdminPanel.
- Verify source service, source transaction ID, network, attempts, signed XDR, expected hash, and last error.
- Query Kuknos independently using the known transaction hash and source account sequence. A timeout is not proof that submission failed.
- Compare the Wallet transaction and GL transaction-event history.
- If Kuknos already accepted the transaction, do not retry; allow reconciliation to repair local state or escalate a mismatch.
- If Kuknos proves the transaction was not accepted and the signed XDR remains valid, select the settlement in AdminPanel, enter a specific reason including the incident ID, and invoke retry.
- Confirm that GL creates an immutable
RETRYaudit row containing actor, reason, prior status, and resulting status. - Watch the settlement until CONFIRMED or MANUAL_REVIEW. Do not repeatedly force retries.
Outage recovery
- Keep financial writes disabled while GL, PostgreSQL, or Kuknos readiness is uncertain.
- Restore PostgreSQL first, then GL, then the settlement worker, then Wallet/API financial ingress.
- Do not purge queues or pending rows. Stale worker locks release automatically after their lease.
- Confirm GL health and backlog age are stable.
- Run/observe reconciliation and resolve every mismatch before reopening financial writes.
- Re-enable traffic gradually and monitor retry rate, oldest pending age, database errors, and transaction conservation.
Rollback
- Disable financial ingress.
- Retain database migrations and all settlement/audit records.
- Roll application images back to the previous known-good versions.
- Start GL before Wallet financial services.
- Resume the worker with the same database; stable idempotency keys make pending submissions restart-safe.
- Reconcile all work created across the deployment boundary before reopening traffic.
Required production alerts
- GL database or settlement readiness false for two consecutive probes.
- Oldest pending settlement above five minutes.
- Retryable count increasing for five minutes.
- Any transition to MANUAL_REVIEW.
- Any new reconciliation issue, especially hash mismatch.
- Reconciliation job failure or absence of successful runs for five minutes.