i2goSignals

goSignals

17. JTI is the event dedup key

Date: 2026-06-07

Status

Accepted. Amended 2026-10-05 by planning spec #112 (community #359, #363): a SET’s per-stream delivery intent is now a deliveries reference document (one per stream and inbound jti, state pending or delivered, carrying the stored wire ackJti), replacing the pendingEvents and deliveredEvents collections. jti stays the dedup key and the no-orphan-marker rule now applies to deliveries references. jti is the dedup key for inbound SETs only: a re-signed outbound copy gets a new JTI (the row’s derived ackJti) and is stored in events under it with an originalJti back-reference to the inbound JTI (community #363); ingest duplicate detection stays on the inbound JTI. Retention on those references is recorded in planning ADR 0077 (independentid/i2gosignals-planning docs/adr/0077-retention-window-fixed-at-acknowledgement-unreferenced-body-sweep.md).

Context

RFC 8417 §2.2 requires that every Security Event Token carry a globally unique jti. goSignals nevertheless treated eventCol as an append-only log: there was no unique index on jti, and the two EventDAO implementations diverged on duplicate behaviour. The Mongo DAO inserted a fresh document on every call and grew duplicate rows; the memory DAO silently overwrote the prior entry in its map[jti]Event. Neither path told the router that the event had already been seen, so a re-delivery (a receiver retry, a transmitter recovery sweep, a poll reissue) was treated as a brand-new event: eventsIn double-incremented, the matcher fanned the event out to every outbound stream a second time, and push buffers re-enqueued a JTI they had already delivered. The duplicate was visible downstream as a second SET on the wire — a protocol-level surprise that RFC 8417 explicitly forbids.

The same gap blocks SSTP. The crash-recovery model in draft-hunt-secevent-sstp-00 relies on the transmitter being able to ingest the same SET twice and have the second ingestion be a single-document atomic no-op — i.e. on JTI uniqueness being enforced inside the persistence layer, not re-derived above it. PRD #153 closes the gap as a prerequisite for SSTP and as a correctness fix for the existing RFC 8935 and RFC 8936 paths.

Decision

The JTI is the persistence-layer deduplication key for eventCol. There is no (jti, sid) compound key — RFC 8417 already promises global JTI uniqueness, and goSignals is one transmitter scope, so JTI alone is sufficient.

The contract is enforced at the storage edge and carried up to the router as a typed sentinel:

At server startup the Mongo provider runs a one-shot safety net: if duplicate JTIs already exist in eventCol, the sparse-unique index creation is skipped and a WARN is logged with a remediation hint pointing at the release-note cleanup snippet. Duplicate-suppression is OFF until the operator deletes the extras and restarts. The missing index is also visible to operators as an eventsIn discrepancy in the Prometheus view. Documented in the v0.12.0 release notes alongside a Mongo shell snippet for cleanup.

Consequences

Positive

Negative