Integrity Dashboard
Convergent-Once · Crash-Safe · Idempotent · Observable
🔬 Platform Boundary Discovered (Sage — Feb 25, 2026)
Base44 uniqueConstraints are advisory only — not DB-enforced. Under true concurrency, multiple records with the same idem_key or dedupe_key can be created. This means hard exactly-once requires an external atomic primitive (Cloudflare Durable Object, Upstash Redis, or Postgres ON CONFLICT).
Current contract: "Convergent-Once" — advisory lock via StoreOperation (announce → 150ms settle → earliest-wins) guarantees convergence under test conditions. Production-grade hard exactly-once is Stage 9 Option 1 (external gatekeeper).
Core Invariants
Memory State (115 total)
Outbox State (129 total)
Integrity Controls
Red Team Attack Suite
20 simultaneous requests with same idem_key. Advisory lock: 1 winner creates Memory+Outbox, 19 get replay. Expect: 1 Memory, 1 extract, 1 embed.
Bottle created, crash before Memory. Retry same idem_key. Expect: exactly 1 Memory in correct state.
Memory exists in stored with no Outbox. Repair sweep must create missing job + transition state.
Job claims, crashes (zombie >5 min). Zombie sweep detects stale claim and resets to pending.
10 simultaneous embed job attempts. Advisory lock: 1 winner creates, 9 skip. Exactly 1 in DB.
100 pending jobs created and processed. None stuck, no double transitions.
Memory State Machine (legal transitions only)
Illegal transitions (skip, regression, circular) → 500 error
Execution Log
Waiting for activity...
Stage 9 PASS Criteria
Contract: Convergent-Once (Base44-native advisory lock pattern)
Stage 9 Option 1 — Hard Exactly-Once Roadmap
Sage's recommendation: add one external atomic primitive. Keep Base44 for everything else.
POST /claim/idempotency · POST /claim/outbox · POST /lease/job
Cloudflare Durable Object or Upstash Redis (SETNX)
claimIdempotency(tenant, idem_key) before Memory create. If lost → return existing.
2–3 lines of code in mwStoreMemoryTransactional
leaseJob(outbox_id) before execute. Real atomic lease with expiry. No more best-effort claimed_by.
Replace current claimed_by pattern in outboxWorker
Tests A+E expect exact counts (0 duplicates), not convergence. Crash tests become stronger.
Remove advisory lock fallback logic from tests