S2 Wave — Financial & Security Assurance
Reading guide
This is the S2 wave report for main, recorded by task s2-12 (docs sync). It is a point-in-time snapshot of what landed during the S2 assurance wave, not a live release verdict.
Read the base and tip SHAs first, then compare against newer gate evidence before relying on it. Labels (IMPLEMENTED / VERIFIED / NOT_VERIFIED / BLOCKED) follow the charter's evidence-before-labels rule.
S2 WAVE
- Repository: nougat-inc/devpay
- Branch: main
- Pre-wave base:
d910a68(S1 line tip;financial-invariants.mdcites this base) - Wave span on main:
cabbc7f(s2-01 merge) →940fd75(s2-10 merge); CI wiring merged at1b4f139(s2-11) - Recorded at: 2026-11-06 (UTC)
- Theme: prove the financial and security claims made in
docs/operations/financial-invariants.mdwith independent oracles, fault injection, durability, audit-chain verification, and recovery-operation security — all on local miniflare + local D1 loopback.
Per-task ledger
Merge SHAs below are the commits as they landed on main (first-parent). Owners are recorded where the artifact itself names a lane; otherwise the implementing lane was internal backend. Gate/QA/Security acceptance records are held in the orchestration control-plane DB (not in this repo) — presence of a merge on main records the PM promote decision; per-gate artifact SHAs are not duplicated here.
| Task | Lane (as recorded in artifact) | Merge SHA | Deliverable |
|---|---|---|---|
| s2-01 | INDEPENDENT_QA (oracle header) | cabbc7f (38f0c5b + 9578c8f) | docs/operations/financial-invariants.md (en+ko) — machine-checkable invariant contract; tests/oracle/* independent oracle + run-oracle.sh (50 legs recorded) |
| s2-02 | internal backend | e6a05cf (0563771) | checks.rs settlement_consistency false-positive fix (gross = Σ(amount−refunded)) + settlement_membership / settlement_fee_mismatch / settlement_run_mismatch / post_settlement_refund finding types + payments-orphan under reference_integrity + recon.persist/recon.persist.<run_id> probes; tests/recon2 (39 legs) |
| s2-03 | internal backend | c5cffd7 (82271e4) | x-fi-probes request-header arming (same DEV_AUTH + non-prod PAYMENT_MODE gate) + probes at refund/settle/inbox/webhook midpoints + outbox dispatch created_at SELECT fix; tests/fault-injection (77 legs) |
| s2-04 | internal backend | 3544d62 (3a4a64f) | tests/durable2 inbox/outbox durability battery with real loopback Toss stub + OUTBOX_SINK_URL sink stub (19 legs) |
| s2-05 | internal backend | 637654a (06d2e64 + cb5c071) | audit.rs verify fields (checkpoint_comparison, evidence_coverage, key_ids, algorithm, truncated, link_breaks, sequence_gaps) + audit2.* FI probes; tests/audit2 (79 legs, phases A–G) + independent tests/audit-v2-verifier.mjs |
| s2-06 | INDEPENDENT_SECURITY (suite header) | a0e8241 (6e67367) | tests/recovery-security — recovery-op security controls verification (46 legs; commit records 46/46 PASS on local miniflare + local D1 at base d910a68) |
| s2-07 | internal backend | 483a342 (c0613d9) | docs/operations/incident-response.md P0–P3 severity/escalation contract + tests/alerts (28 legs; commit records 15/15 + 13/13) |
| s2-08 | internal backend | b025419 (ed9c5cd) | tests/perf-baseline measurement battery (22 legs; commit records 22/22 PASS) + perf-baseline-out/perf-results.json artifact + docs/operations/performance-baseline.md |
| s2-10 | internal backend | 940fd75 (1daf526 + ca9fca5) | cron resume+reap of recon runs; stale receipt-less EXECUTING op convergence (>10 min); preflight + v2 evidence on purchase/renew/paid-feedback/finalize_paid/feedback-payment; alert:evidence_gaps; next_counter self-heal; webhook transmission freshness ±600 s → 401 WEBHOOK_STALE; approve CAS-first; tests/assurance-gaps (26 legs); durable2 INBOX-SIG-04 converted from documented WARN to asserted PASS; run-audit-evidence prev_sequence drift guard nit |
| s2-11 | internal backend | 1b4f139 (a15657e) | CI wiring — nine S2 suite steps added to the financial-integrity job as required gates + perf artifact upload |
| s2-12 | PRODUCT_DESIGN | (this doc) | Documentation sync — this report + register/status/runbook updates (en+ko) |
s2-09 has no code/docs commit on main — it is a process-level (orchestration/QA-gate) slot, consistent with the S1 pattern.
Findings fixed during the wave
| Finding | Found by | Fixed by | Verification |
|---|---|---|---|
settlement_consistency false positive — recon summed raw amount_krw while settle commits gross = Σ(amount−refunded_krw); committed settlements containing partially_refunded orders tripped permanent og<>g findings | financial-invariants NOT_VERIFIED pin → oracle Phase D measured it (s2-01) | e6a05cf (s2-02): recon authority now Σ(amount_krw − COALESCE(refunded_krw,0)); post-commit member refunds surface as separate post_settlement_refund findings instead of being silently absorbed | recon2 (39 legs) |
Armed-but-unasserted FI probes (settle.claimed/settle.chk/settle.counter S1 residual) | S1 register | c5cffd7 (s2-03): x-fi-probes per-request arming + probe classes asserted per-leg | fault-injection (77 legs) |
Outbox delivered-body missing created_at (SELECT didn't fetch the column) | durable2 WARN note | 82271e4 (s2-03): created_at added to the claim SELECT | durable2 (19 legs) |
F1 — approve decision row could race the CAS update (security review Medium from s2-06 lane) | recovery-security review | ca9fca5 (s2-10): CAS UPDATE first, changes==1 asserted else 409 OP_STATE_INVALID before decision insert — exactly one decision row per op | assurance-gaps APR-01/02 (24-way race → exactly 1 decision) |
Receipt-less EXECUTING ops never converged (stuck forever between execute CAS and receipt write) | wave review | 1daf526 (s2-10): verify converges stale (>10 min) receipt-less EXECUTING via target-state re-evaluation to VERIFIED/FAILED; fresh EXECUTING deferred to avoid racing live execution | assurance-gaps OPS-01..04 |
M1 — checkpoint comparison could false-positive on chains > 5 000 rows (events read capped at VERIFY_LIMIT prefix) | audit2 review | cb5c071/06d2e64 (s2-05): scope-max sequence read without LIMIT | audit2 (79 legs) + audit-v2-verifier.mjs |
| M2 — checkpoint reseal laundering: comparing only the newest seal let a 5-minute cron reseal hide an older mismatch | audit2 review | cb5c071/06d2e64 (s2-05): every audit_checkpoints seal is compared against the current chain — any mismatch → ok:false | audit2 tamper legs |
Counter row-missing → silent seq=1 fallback (later UNIQUE collisions surfaced as lossy 500s) | S1 register residual | 1daf526/ca9fca5 (s2-10): next_counter seed-then-increment — INSERT OR IGNORE heals a missing row; real DB errors and post-increment missing rows fail closed (500 TX). audit_v2_sequence deliberately does not use this — a missing row there must stay a fail-closed migration signal | assurance-gaps CNT-01/02, FBP-01/02 |
Signed webhook events replayable indefinitely (signature covers transmission-time but no freshness check; INBOX-SIG-04 documented WARN in durable2) | durable2 documented residual | 1daf526 (s2-10): tosspayments-webhook-transmission-time freshness gate, ` | now − ts |
Cron always created a fresh recon run — budget-paused running runs could stall forever; stale running runs were not reaped | wave review | 1daf526 (s2-10): scheduled() reaps stale runs (failed + INCOMPLETE checks) and resumes a live running run instead of creating a new one | assurance-gaps CRON-01/02 |
| Sealed-without-evidence / burned-sequence residue silent except console logs | wave review | 1daf526 (s2-10): scheduled_assurance folds residue into a chain-sealed alert:evidence_gaps evidence record | assurance-gaps ALR-01/02 |
v2 evidence coverage gaps on money paths (purchase paid, subscription renew, paid feedback, finalize_paid, feedback-payment creation) | wave review | 1daf526/ca9fca5 (s2-10): audit preflight (fail-closed before the live-payments gate) + payment.capture/feedback.donation v2 evidence | assurance-gaps EVD-01..03, PROD-01..03, FBP-01/02 |
Independent-suite inventory (S2 additions)
All S2 suites run local-only: wrangler dev --local + miniflare local D1 + loopback stubs (Toss authority, outbox sink). None may run against staging or production. CI wiring landed at 1b4f139 — see the note under Residual risks for what remains unverified.
| Suite | Runner | Legs (recorded) | Purpose | CI-wired |
|---|---|---|---|---|
| Independent financial oracle | tests/run-oracle.sh → oracle.test.mjs + oracle/ | 50 | Independent expectation math (financial-oracle.mjs does not import app code); violation-injection counterexamples; pinned the INV-SETTLE FP (S2-01a) | Yes — suite_oracle |
| Recon engine hardening | tests/run-recon2.sh | 39 | s2-02 checks: membership/fee/run xcheck, post_settlement_refund, refund_consistency, ledger_uniqueness, payments-orphan, findings caps + pause/resume, recon.persist probe | Yes — suite_recon2 |
| Fault injection | tests/run-fault-injection.sh | 77 | x-fi-probes per-request arming; mid-pipeline injection legs (refund/settle/inbox/webhook/SIGKILL) with external-call + ledger-effect counts | Yes — suite_fault_injection |
| Inbox/outbox durability | tests/run-durable2.sh | 19 | Spawn/kill wrangler, trigger-based fault induction, real sink stub; leg result enum PASS/FAIL/WARN/NOT_VERIFIED | Yes — suite_durable2 |
| Audit v2 + evidence continuity | tests/run-audit2.sh | 79 | Phases A–G: tamper bridges, burned sequence, coverage gap, checkpoint write failure, key rotation/mismatch, prod preflight fail-closed; independent audit-v2-verifier.mjs cross-check | Yes — suite_audit2 |
| Recovery-op security | tests/run-recovery-security.sh | 46 | SoD, rejection/state gates, 401/403 admin-plane isolation, idempotency, CAS races, evidence linkage, zero external PG mutation | Yes — suite_recovery_security |
| Alert/escalation contract | tests/run-alerts.sh | 28 | Severity-field contract on seeded drift + 3-consecutive-failure alert:recon_failures evidence/consumer read | Yes — suite_alerts |
| Perf/concurrency baseline | tests/run-perf-baseline.sh | 22 | Recon scan/settle commit/audit verify-checkpoint throughput + concurrency probes; measured artifact committed | Yes — suite_perf_baseline (+ artifact upload) |
| Routed assurance-gap fixes | tests/run-assurance-gaps.sh | 26 | s2-10 legs: cron resume/reap, EXECUTING convergence, evidence coverage, webhook freshness, alert fold, counter self-heal, prod preflight | Yes — suite_assurance_gaps |
Prior-wave suites unchanged: run-integrity.sh (recon engine), run-settle-recovery.sh (27 checks), run-refund-safety.sh (32), run-exceptions-ops.sh (38), run-audit-evidence.sh (47), run-durable.sh (55, product-suites job). Still not in CI: run-failclosed.sh (20/20 local), run-integration.sh (local-only).
Residual risks and NOT_VERIFIED register (S3 scope)
- Real PG sandbox —
BLOCKED_EXTERNAL_CREDENTIALS; all legs are mock/TEST-stub only. - Remote D1 / production deploy / staging cron runtime —
NOT_VERIFIED; every S2 leg is local miniflare loopback. - External alert delivery —
alert:recon_failuresandalert:evidence_gapsare chain-sealed evidence records only; no email/Slack/webhook channel exists (PLANNED). be/Axum parity — all S2 surfaces are Worker-only; Axum has no equivalent routes (NOT_VERIFIEDfor parity claims).- Actual GitHub Actions run of the newly wired S2 steps —
NOT_VERIFIEDat record time; step outcomes self-report (PASS/FAIL/SKIPPED/BLOCKED/NOT_VERIFIED) so a missing run cannot summarize as PASS. - Checkpoint-comparison window — comparison reads the latest 200
audit_checkpointsseals; a mismatch older than the 200-seal window is not re-evaluated (ACCEPTEDresidual). - Unkeyed checkpoint fold —
root_hashis an unkeyed SHA-256 fold over storedintegrity_hashvalues; the seal itself is not HMAC-signed (ACCEPTEDresidual). evidence_coverageis report-only —sealed_without_evidence/orphan_evidenceare reported but deliberately not folded intook(in-flight emit races); promotion is a PM policy decision. s2-10'salert:evidence_gapssurfaces the residue but does not close this item.- 2-instance loser surfaces 500 not clean 409 — sqlite contention on shared local D1 (perf-baseline reproduces F-04); N>2/remote unexamined.
- Ordered-counter restart-collision edge — if the
countersrow is deleted while orders exist, self-heal reseeds at seq=1 and the nextorder_nocollides (UNIQUE → fail-closed 500). It now fails loudly instead of silently, but no seq-rebuild exists. {e}-in-500-bodies sweep — pre-existing sites still open (non-blocking).- Auth act-as same-isolate repeat — pre-existing, not re-audited.
BETA_NOT_READY— perfinancial-invariants.mdstatus; nothing in this wave changes the product-level readiness verdict.
Critical/High findings
0 unresolved at wave tip (940fd75). The wave's security-review findings (F1 approve-CAS race, EXECUTING convergence, M1/M2 audit verify gaps, webhook freshness) were all routed and fixed within S2 — each row in "Findings fixed" names the fixing SHA and asserting legs.
Verification status summary
- VERIFIED (local loopback only): every suite listed above, per its recorded leg counts, on miniflare local D1.
- NOT_VERIFIED: real PG, remote D1, production/staging deploy, deployed cron behavior, external alert delivery, Axum parity, the first real CI run of the new steps.
- BLOCKED: real PG credentials (charter-gated), production operations (explicit approval required).