Date: 2026-06-07
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).
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.
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:
internal/dao/mongo/event_dao.go): a sparse-unique index on
eventCol.jti is created at startup (in
internal/providers/dbProviders/mongo_provider/provider.go). Inserts that
violate it surface as MongoDB error code 11000; the DAO translates that into
the exported sentinel interfaces.ErrDuplicateJTI.internal/dao/memory/event_dao.go): a map-existence check
before insert returns interfaces.ErrDuplicateJTI directly. No silent
overwrite.internal/services/event_service.go) loads the existing
record via FindByJTI on the sentinel branch and returns
(existingRec, ErrDuplicateJTI) — the storage edge is authoritative; the
service does not pre-check (which would race). An INFO log line
"Duplicate JTI ingestion suppressed" (with jti and sid) records the
no-op.internal/eventRouter) short-circuits on
errors.Is(err, interfaces.ErrDuplicateJTI): eventsIn is not incremented
a second time, the matcher does not run, no JTI is added to any outbound
stream’s pending queue, and no push/poll buffer is woken. The handler
returns 202 Accepted, matching the RFC 8935 idempotency expectation.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.
eventsIn and outbound fan-out stop double-counting on retries; metrics
reflect distinct events rather than wire deliveries.interfaces.ErrDuplicateJTI gives every caller (router today,
SSTP handler tomorrow) one stable signal to branch on.(jti, sid) escape hatch — a buggy upstream that re-uses JTIs across
different logical events will be rejected, surfacing the upstream bug rather
than masking it. This is the intended behaviour under RFC 8417 §2.2.jti globally unique), RFC 8935 §2.4 (push idempotency),
draft-hunt-secevent-sstp-00 (crash recovery relies on single-document
atomic idempotency).internal/dao/interfaces (sentinel),
docs/releases/v0.12.0.md (operator-facing migration note).