045-store-receipts-and-work-claims
Receipts and work claims: an inbound item is recorded once per content revision, processed once per processor revision, and never silently dropped
Every product that ingests from an outside source rebuilds the same table: a key, a body digest, the first outcome, and a rule for a repeat (statecraft-platform's `sc_idempotency`; aicortex's work-claim rows over the Lease and the Outbox). This spec puts one primitive in rahi-store. A receipt names an inbound item by tenant, source namespace, and external key (or a synthetic key when the source has none) and records a digest of its content; classification distinguishes first seen, exact redelivery, changed content under the same key (recorded as a new revision or a collision, never dropped), and erased. Receipt rows stage into the caller's TxnBuilder beside the domain writes and Outbox::stage. Processing is identified separately (receipt revision plus processor and its policy revision) so a correction or a new policy reprocesses. Work is reserved under the existing Lease into a fenced claim row with attempt history, bounded retry, a visible dead-letter state, and reclaim after expiry; queue counts reach /metrics redacted. Retention compacts to a tombstone, erasure keeps only the key digest and is never undone, and a crash-point table states recovery at every boundary. Owner decisions of 2026-09-24 are recorded.
Read the full pinned specification ↗Relationships
depended on by
amended by
Claimed units
- establishes
{ "kind": "file", "path": "crates/rahi-store/src/receipt.rs" } - establishes
{ "kind": "file", "path": "crates/rahi-store/src/work.rs" } - establishes
{ "kind": "file", "path": "crates/rahi-store/tests/receipt.rs" } - establishes
{ "kind": "file", "path": "crates/rahi-store/tests/work.rs" } - establishes
{ "kind": "file", "path": "crates/rahi-store/tests/receipt_recovery.rs" } - extends
{ "nature": "additive", "spec": "011-store-hiqlite", "unit": { "kind": "file", "path": "crates/rahi-store/src/lib.rs" } } - extends
{ "nature": "additive", "spec": "011-store-hiqlite", "unit": { "kind": "file", "path": "crates/rahi-store/src/error.rs" } } - extends
{ "nature": "additive", "spec": "012-store-coordination", "unit": { "kind": "file", "path": "crates/rahi-store/src/lock.rs" } } - extends
{ "nature": "additive", "spec": "023-observability", "unit": { "kind": "file", "path": "crates/rahi-edge/src/obs/metrics.rs" } } - extends
{ "nature": "additive", "spec": "023-observability", "unit": { "kind": "file", "path": "crates/rahi-edge/tests/obs.rs" } } - refines
{ "aspect": "a work claim that outlives the lease TTL is a chassis row created and renewed under a short-held lease and fenced by its own token (012 D-10)", "unit": { "id": "rahi_store::lock::Lease", "kind": "symbol" } }
Source headings
- 045: Receipts and work claims
- 1. Purpose
- 2. Territory
- 2.1 What is new
- 2.2 What is reused unchanged
- 2.3 What is extended
- 3. Behavior
- 3.1 Receipt identity
- 3.2 Classification outcomes
- 3.3 Atomic participation
- 3.4 Processing identity
- 3.5 Work reservation
- 3.6 Retention and erasure
- 3.7 Crash-point recovery
- 4. Functional requirements
- 5. Acceptance criteria
- 6. Out of scope
- 7. Resolved decisions
- Follow-up: statecraft-platform's `sc_idempotency`
- Verification
Frozen anchors
No frozen anchors declared.