MVP-1.5 · Usage outbox (batched, retried, demo tenants skipped) #266

Open
opened 2026-09-20 20:17:21 +00:00 by sharang · 0 comments
Owner

Goal

Usage reporting (§9.2) is best-effort and fire-and-forget today, so metering can silently lose events across a restart — which for a metered SKU means lost revenue and an unauditable bill. Make it durable.

What to change

  • A Mongo-backed usage outbox (agent.rs:75-120).
  • Batch and flush every ≤ 60 s.
  • Retry with the same idempotency key so a replay cannot double-count.
  • Skip demo tenants.

Acceptance

  • Usage events survive an agent restart mid-flush: a stage script asserts no loss and no duplication across a restart.
  • Retries reuse the idempotency key; the registry deduplicates.
  • Demo tenants produce no usage records.
  • The outbox backlog is exposed as a metric (MVP-1.7) and alerted on (MVP-5.1).
## Goal Usage reporting (§9.2) is best-effort and fire-and-forget today, so metering can silently lose events across a restart — which for a metered SKU means lost revenue and an unauditable bill. Make it durable. ## What to change - A Mongo-backed usage outbox (`agent.rs:75-120`). - Batch and flush every ≤ 60 s. - Retry with the same idempotency key so a replay cannot double-count. - Skip demo tenants. ## Acceptance - [ ] Usage events survive an agent restart mid-flush: a stage script asserts no loss and no duplication across a restart. - [ ] Retries reuse the idempotency key; the registry deduplicates. - [ ] Demo tenants produce no usage records. - [ ] The outbox backlog is exposed as a metric (MVP-1.7) and alerted on (MVP-5.1).
sharang added this to the Production MVP milestone 2026-09-20 20:17:21 +00:00
sharang added the infrastructureenhancement labels 2026-09-20 20:17:21 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#266