Architecture Decision Record

ADR-0012: Append Is Idempotent and Confirmation Means Durable Commit

Status: Accepted · Date: 2026-03-06

Status: Accepted

Date: 2026-03-06

Context

BSFG must tolerate retries, partitions, reconnects, and duplicated delivery attempts without producing ambiguous fact history. Producers need a retry-safe append contract. Consumers and operators need a precise definition of what confirmation means at the boundary layer.

JetStream supports publish acknowledgement once a message has been stored, and supports message deduplication using a message ID header within a dedupe window. Consumers separately track delivery acknowledgements. :contentReference[oaicite:0]{index=0}

BSFG must define a stronger, transport-local meaning for both idempotency and confirmation than “some downstream consumer eventually processed it.”

Options Considered

Option Description Benefits Drawbacks
Reject all duplicate IDs Any repeated message_id is treated as an error.

|

| | Allow duplicate appends | Every retry appends a new record; dedupe is pushed downstream. |

|

| | Business-level confirmation | Confirmation means a consumer processed and accepted the fact semantically. |

|

| | Idempotent append + durable commit confirmation (Selected) | Repeated message_id with identical content returns the original durable sequence; conflicting content is rejected; confirmation means durable log commit. |

|

|

Decision

BSFG append semantics are idempotent at the boundary layer.

if message_id already exists and payload is identical:
    return existing stream sequence

if message_id already exists and payload differs:
    reject as conflicting_duplicate

message_id is the idempotency key. Payload identity is evaluated over the semantic message content, including the canonical fact body and attachment references.

BSFG confirmation semantics are defined as:

ConfirmReceipt = durable commit in target zone log

Confirmation therefore means the fact has been accepted and durably stored in the target zone’s JetStream stream. It does not mean:

Consequences

Benefits:

Tradeoffs: