Replay a Stream Without Repeating Its Actions
Separate historical evaluation from live actions through replay permissions, feature snapshots, comparison eligibility, and deliberate promotion controls.
Recomputing a decision is not repeating an instruction
A model changes. The team rewinds yesterday's events to compare results. The new scores look promising, but the replay also sends customer notifications a second time. Nothing duplicated inside the stream processor: the historical events were intentionally processed again. The duplication occurred because the system confused a fresh computation with a fresh entitlement to act.
Streaming inference has at least three identities to preserve: the source event, the computation performed on that event, and the business action resulting from the computation. Reusing one identifier for all three makes replay convenient until a side effect crosses a system boundary.
Design these identities separately. A source event identifies an observation. A computation identity adds the model, feature snapshot, policy version, and execution purpose. An action identity describes the effect the business intends to happen once. Two computations may legitimately produce different decisions about one source event while still referring to the same possible notification or fulfillment instruction.
Give replay a different destination
The safest comparison replay writes results to an isolated namespace. It does not inherit live action permissions merely because it uses the same processing graph. Make execution purpose an enforced input: live, evaluation, backfill, or reconciliation. Treat an absent purpose as an error rather than assuming live operation.
Isolation should extend beyond the final sink. A feature enrichment stage might update a cache, increment a counter, or call a service that records usage. Inventory these effects before declaring a graph safe to replay. A sink switch at the end cannot undo mutations performed halfway through the pipeline.
For a comparison run, store both the historical decision and the recomputed decision under a replay identifier. Keep their timestamps distinct. Event time describes when the observation occurred; computation time describes when the new reasoning happened. Neither should silently overwrite the other.
When the goal is a genuine backfill, define the intended external change explicitly. “Run last week again” is too broad. “Populate missing analytical records without sending notifications” specifies an effect boundary that can be tested and enforced.
Establish comparison eligibility before agreement
Replay quality depends on which events can be compared honestly. A historical decision may have used a feature value that was later overwritten. A schema migration may have changed the meaning of a field. Processing the old event successfully does not prove that the reconstructed inputs match what was available at the time.
Consider 240 historical events. Suppose 180 have complete, compatible feature snapshots; forty lack a required historical value; and twenty use a schema whose old meaning cannot be recovered. Only the 180 complete events enter paired decision comparison. Of those, 150 decisions agree and thirty differ. The observed agreement is 150 divided by 180, or about 83.3%, not 150 divided by 240. The excluded sixty events remain visible as coverage gaps.
Figure 1 — Sixty events lack comparable historical inputs; the 150 agreements describe only the 180 eligible pairs. Coverage and agreement answer different questions. Illustrative model — not measured data.
Inspect exclusion by event cohort. If missing snapshots cluster among infrequent customers, an apparently stable replay may tell little about that group. Publishing an overall agreement rate without eligibility coverage rewards systems that quietly drop their hardest inputs. Store exclusion reasons beside results so reviewers can distinguish model change from changes in the evaluation population.
Promotion needs a new authority decision
Evaluation output should be inert even when its payload resembles a live instruction. Restrict replay credentials at the destination, and prevent an evaluation worker from switching itself into live mode. A purpose field is useful metadata but is not a security boundary unless another component enforces it.
If reviewers decide that some changed decisions should affect live systems, use a separate promotion step. That step resolves current entity state, checks whether the proposed change is still relevant, and obtains fresh authority. Historical computation time is not an authorization timestamp. A notification that would have been appropriate yesterday may be confusing today even if it was never sent.
Keep promotion records linked to the replay manifest, including selected events and the reason for applying them. Application-specific effect handling remains necessary, but it belongs at the live destination boundary. The streaming platform's responsibility is to prevent a comparison run from acquiring that authority accidentally.
Take care with partial promotion. Selecting every changed decision can amplify a replay selection bias if only complete snapshots were eligible. Review the missing cohort before interpreting the selected set as the full population needing correction. Sometimes the right outcome is a better historical feature capture mechanism rather than a live update.
Preserve event-time semantics across versions
A replay can change results even with an unchanged model when window boundaries or late-arrival rules differ. Record the watermark policy, allowed lateness, partitioning rule, and window definition in the comparison manifest. Otherwise a different set of events may enter an aggregate feature while both runs claim to use the same feature name.
For reconstruction, use the events available at the original decision boundary. A later-arriving observation may be valuable for retrospective analysis but introduces hindsight into a historical performance comparison. Give that analysis a separate purpose and label. This prevents an apparent accuracy gain from being purchased with information that the original decision could not have known.
Budget replay against live work
Even isolated replay can harm customers by consuming the capacity that live events need. Assume a fictional inference pool processes 2,000 events per second. Live arrivals average 1,400 per second. Allocating all remaining 600 to replay leaves no reserve for bursts, recovery, or uneven partition load.
A conservative initial replay allocation might be 300 per second, leaving 300 as nominal headroom. Reprocessing 10.8 million events then takes ten hours if that allocation remains continuously available. At 600 per second it would take five hours, but only under the stronger assumption that live demand never needs the spare capacity.
Figure 2 — Duration equals event count divided by allocated throughput; rounded values assume no interruptions. Spare capacity is an input assumption, not a service guarantee. Illustrative model — not measured data.
Control replay using live age and resource contention, not only aggregate CPU. A shared feature store can saturate while inference workers remain idle. A hot partition can delay one customer's events while the global average looks healthy. Pause or slow replay when the protected live metric crosses its limit.
Reproducibility requires historical inputs
A model version is insufficient to reproduce a decision if enrichment reads today's customer state. Replaying a historical event against current features answers a different question. Both questions can be useful, but they must carry different labels.
For historical reconstruction, preserve or reconstruct the feature values available at the original decision time. For counterfactual evaluation, declare which inputs are intentionally changed. Record unavailable historical features as missing rather than silently substituting current values. Otherwise apparent model improvements may be artifacts of information that did not exist at the time.
Evaluate outputs in pairs. Compare old and new decisions for the same event under the declared feature policy. Count changed decisions, missing-input cases, and unresolved comparisons separately. A high agreement rate can conceal a concentrated shift in the small cohort that matters most.
Exercise the replay boundary before production
Run a comparison with destination write permission deliberately absent and verify that every stage still completes its permitted analytical work. Insert an enrichment step that attempts a write and confirm the permission boundary rejects it. Revoke access to one historical snapshot and verify that the event becomes an eligibility gap rather than receiving today's substitute value.
Restart the replay after a checkpoint, then compare the result set by event identity and computation version. An aggregate row count can conceal one missing event and one duplicate. Keep comparison output deterministic where the computation allows it; otherwise declare the execution settings and variation expected across repeats.
Assign ownership for each failure class. Platform engineers own checkpoint integrity and capacity isolation; feature owners resolve historical availability; application owners decide whether a changed result deserves current action. A replay should finish with a reviewable manifest of completed comparisons, excluded events, and unapplied recommendations. It should never silently convert an analytical backlog into a queue of live instructions.
Rehearse cancellation as well. Stopping the replay scheduler must prevent future evaluation work from starting, while already committed results remain identifiable. Confirm that a canceled run cannot later be promoted by a stale approval referring only to its display name. Bind approval to the immutable result manifest so resumed or extended runs require a deliberate new review.
The release criterion is not that every replay produces identical output. New models are supposed to change some decisions. The criterion is that every changed computation remains distinguishable from a newly authorized effect, and every proposed promotion has a current, independently enforced authority decision.