Skip to content
Davide Scuteri Moretti
Senior Data Architect
19
Essay

Idempotence and the Right to Recompute

Idempotence is often introduced through the compact equation $F(F(x))=F(x)$. In production data platforms, however, the problem is not simply whether a pure function returns the same value when applied twice. Pipelines read mutable sources, create external effects, allocate identifiers, update state, and publish results to systems with their own transaction semantics. This essay develops idempotence as an end-to-end architectural property that enables safe replay, backfill, recovery, and historical correction. It distinguishes functional, operational, and observational idempotence; examines keys, checkpoints, merge semantics, and effect journals; and relates recomputation to a broader philosophy of corrigibility. A trustworthy platform must be able to revisit its own past without multiplying it. The right to recompute is therefore not an implementation convenience but a condition of accountable knowledge: claims may need to be corrected when code, definitions, reference data, or evidence improve.

8 minute read·July 2026·Davide Scuteri Moretti
idempotencereplaybackfillexactly-once effectsevent processingcorrectiontransactional publicationdata reliability
Themes
  • Reproducibility

1. Beyond the textbook equation

For a mathematical function , idempotence is defined by

Projection, set normalisation, and certain closure operations possess this property. Data pipelines usually do not apply their transformation output as the next transformation input. They read a source, derive records, and write to an external store. The practical concern is whether repeating an execution changes the observable state incorrectly.

Let an execution be a state transition

where is persistent system state and the input. Operational idempotence requires

where projects the system onto effects visible to legitimate consumers. The internal system may record a second attempt, additional logs, or updated metrics; these differences are acceptable if the published semantic state is unchanged.

This formulation introduces a crucial distinction. Physical repetition may occur many times. Logical effect should occur once, or should converge to the same governed state.

2. Three kinds of idempotence

Functional idempotence concerns the transformation itself. Given fully specified inputs and context, it produces an output that is stable under repetition or reapplication. Operational idempotence concerns side effects such as inserts, messages, files, and external calls. Observational idempotence concerns what consumers can infer from the platform after repetition.

Let

be an idempotence profile. A pipeline can score differently on each component. A deterministic transformation may have while duplicate inserts make . A sink may deduplicate rows while exposing repeated notification events, yielding partial observational idempotence.

This decomposition is more useful than labelling a pipeline “idempotent.” It directs engineering attention to the effect boundary. The safest transformation can still corrupt a downstream process if publication semantics are not controlled.

3. Idempotency keys and semantic identity

A common mechanism assigns an idempotency key to each logical effect. Repeated attempts with the same key are recognised as instances of one operation. The difficult question is how is derived.

A source offset is convenient but may identify delivery rather than business event. A hash of the full record changes when harmless metadata changes. A natural business key may not exist, or may be reused. Composite keys must incorporate identity and version:

where is domain identity, event identity, semantic version, and publication purpose or partition where relevant.

The key must distinguish legitimate corrections from duplicates. If a laboratory result is revised, the platform should not suppress the revision merely because subject, test, and timestamp match. A robust key separates event identity from event version:

Idempotence is therefore inseparable from ontology. One cannot deduplicate correctly without deciding what counts as the same event.

4. Upserts, merges, and convergence

Many batch pipelines implement replay through MERGE or upsert operations. If the source record is authoritative and the key stable, repeated merges converge. But convergence can hide history and silently overwrite corrections.

Let the target state for key be , and let update operator combine a new record :

For idempotence we require

For order independence, often desirable but not always possible, we would additionally require commutativity:

Last-write-wins is idempotent under stable timestamps but may be semantically wrong. Maximum version wins can fail when versions are source-local. Additive counters are not idempotent unless inputs are uniquely identified. Set union is naturally idempotent but may be inappropriate for ordered or revised events.

Merge semantics must therefore be part of the contract, not an implementation default. The question is not “does the engine support upsert?” but “what algebra describes lawful state evolution?”

5. Checkpoints, watermarks, and replay scope

Streaming and incremental batch systems track progress through checkpoints or watermarks. A checkpoint answers what has been processed; it does not necessarily prove what has been committed. If checkpoint advancement and sink publication are not atomic, failures can produce loss or duplication.

Let be consumed position and committed position. Safety requires an invariant such as

and a protocol ensuring that after recovery every event in is either reprocessed idempotently or known to have been durably published.

Replay scope should be explicit. A failed task may require replay of one partition, one event-time interval, one semantic version, or the full downstream dependency cone. If task changes in graph , affected nodes are

Yet not every descendant must always be recomputed. Materiality analysis can compare contract and transformation changes to actual dependencies. Safe recomputation is most efficient when lineage is executable rather than merely visual.

6. Backfill as a first-class operation

A backfill applies a current or historical computation to a past interval. It is often treated as an exceptional operational procedure, assembled under pressure. In a mature platform it is a designed capability with declared semantics.

A backfill request can be represented as

where is the event-time window, the contract version, the reference-data version, the publication policy, and the merge or restatement mode.

The most important distinction is between correction and restatement. Correction fixes a failure under the rules that should already have applied. Restatement intentionally recomputes history under new rules. The former aims to reproduce the previously intended state; the latter creates a new interpretive version of history.

Without this distinction, backfills can rewrite institutional memory invisibly. A dashboard changes, but the organisation cannot tell whether old data arrived, an error was fixed, or the definition was revised.

7. Exactly once and the language of guarantees

“Exactly once” is among the most abused phrases in data engineering. Physical execution may occur more than once because retries are fundamental to reliable distributed systems. What can often be guaranteed is exactly-once visible effect within a defined boundary.

Let be the number of physical attempts and the number of committed logical effects. A practical guarantee is

The boundary matters. A transactional table may ensure one committed row while an external email, API call, or non-transactional message is duplicated. End-to-end exactly-once semantics require either a shared transaction, an outbox pattern, deduplicating consumers, or compensating logic.

Architectural language should therefore be precise: at-least-once delivery with idempotent sink; exactly-once table publication; effectively-once domain effect under key . Precision is not pedantry. It allows risk to be assigned to the correct layer.

8. Corrigibility and the right to recompute

The philosophical importance of idempotence lies in corrigibility. Data platforms produce institutional claims: totals, classifications, alerts, eligibility decisions, operational views. These claims may later require revision because evidence arrives late, code defects are discovered, standards change, or categories are reconsidered.

A platform that cannot recompute safely makes its first interpretation technologically privileged. It converts contingency into permanence. Conversely, a platform that recomputes without preserving versions makes the past unstable and unauditable.

The right to recompute must therefore be paired with the duty to preserve the history of recomputation. Let published state be versioned:

with transition records

The organisation can then distinguish the history represented by the data from the history of its own interpretations.

This is an ethics of correction. Systems should neither fossilise mistakes nor erase the fact that correction occurred.

9. Design principles for safe recomputation

A recomputable platform typically includes immutable source capture or restorable snapshots, stable event identities, versioned transformations, reference snapshots, idempotent publication, explicit merge algebra, replayable orchestration, and downstream invalidation signals.

Operationally, a replay should produce a manifest containing input interval, input hashes, code and contract versions, affected products, expected row movements, quality results, and publication decision. Dry-run comparison is valuable:

Material changes can require approval before publication. Minor corrections can be automated according to policy.

The goal is not to make every pipeline infinitely replayable at negligible cost. It is to make the cost and consequence of replay known, bounded, and proportional to the importance of the output.

Conclusion

Idempotence in data platforms is not adequately captured by applying a function twice. It is the capacity of an end-to-end computational process to tolerate repeated attempts, recover from partial failure, and revisit historical intervals without duplicating, erasing, or ambiguously rewriting semantic effects.

The engineering mechanisms are keys, transactions, merge laws, checkpoints, manifests, versioned state, and controlled publication. The conceptual foundation is identity: what counts as the same event, the same effect, and the same historical claim. The cultural foundation is corrigibility.

A trustworthy platform reserves the right to recompute because knowledge can improve. It also accepts the duty to record why recomputation occurred and what changed. In that balance, idempotence becomes more than reliability technique. It becomes the computational form of responsible correction.

Conceptual references

Gray, J., and Reuter, A. Transaction Processing (1992). Helland, P. “Life Beyond Distributed Transactions” (2007). Kleppmann, M. Designing Data-Intensive Applications (2017). Lamport, L. “Time, Clocks, and the Ordering of Events in a Distributed System” (1978). Popper, K. Conjectures and Refutations (1963).

Continue reading