Released: TBD Compare: v0.12.0-alpha.10…v0.12.0-alpha.11
alpha.11 lands the community half of the event-retention and reset-accounting design (enterprise Q91 / ADR 0055). Two changes make the data plane able to bound how long delivered events are retained, and make stream reset bill as real egress the way the metering model always intended. Both are additive: the purge engine ships dormant (keep-forever default), and streams that set no retention window and never reset are byte-for-byte unchanged.
The headline is a per-stream retention window + ack-anchored refcount purge
(#226, PR #227). A new RetentionWindowDays on the stream state record (kept
off the SSF wire) lets a stream cap how long an event is retained after all
subscribers have acked it; a refcount-based purge engine reclaims events once
they are both past the window and fully acked, and a daily per-stream occupancy
sampler records the point-in-time retained-event count that the enterprise
metering pipeline averages into a Mean Retained Events figure. The engine is
wired but default-off — with no window configured, retention is unbounded
exactly as before.
The companion closes a metering bypass on stream reset (#225, PR #228).
ResetEventStream re-drives already-delivered events through the fan-out, but
the fan-out metering hook was bypassed at the reset re-queue path, so that
re-driven egress went uncounted. The fix emits the re-queued events as
chargeable events_out tagged source: reset, so a reset is billed as fresh
egress — while protocol replay (a failed-ack re-poll of an already-metered
event) remains free by construction. The family continues to ship byte-matched
at the tag (v0.12.0-alpha.11).
ff1ad3e; impl 508d2e0). New
RetentionWindowDays field on the stream state record, kept off the SSF
wire (internal state only). New pkg/services/retention.go purge engine:
an event is eligible for reclamation only once it is both past the
configured window and fully acked by every subscriber (ack-anchored
refcount), so a slow or offline subscriber cannot lose un-acked events.RetentionWindowDays set the default is
keep-forever; the engine performs no reclamation. This is the safe default —
retention must be explicitly opted into per stream.$max gauge per Q91.5).pkg/services/retention_test.go,
pkg/dao/memory/event_dao_retention_test.go,
pkg/ssfModels/model_stream_state_retention_test.go.source: reset egress on stream reset re-queue (PR #228,
merge ce817a9; fix dc4dbe6). The fan-out metering hook was bypassed on the
ResetEventStream re-queue path, so re-driven events were delivered but not
counted. The fix routes reset re-queue through the metering hook, emitting the
re-driven events as chargeable events_out tagged source: reset.go.mod community require to this tag to pick up the
retention state field and the reset-metering fix.go test -race ./... is green module-wide. New coverage includes the retention
engine (pkg/services/retention_test.go), the memory-DAO retention path
(pkg/dao/memory/event_dao_retention_test.go), and the stream-state retention
field (pkg/ssfModels/model_stream_state_retention_test.go). Per-PR gates
(gofmt -l, go vet, -race) pass with no new warnings.