VAYUFailure Labs
Colour theme
Investigate a failure

VAYU FAILURE LABS · DISCLOSED SYNTHETIC SCENARIO

Browse all labs

Incremental watermark boundary replay

LAB 05 · PYTHON / SQL

The job ran once.
The boundary row ran twice.

Synthetic case7–9 minutesEasy difficulty

THE FAILURE

A daily revenue total rises after a rerun. The duplicate event_ids occur exactly at the stored incremental boundary.

THE CONSTRAINT

Several source events can share one timestamp. Replacing >= with > alone can lose valid events at that same boundary.

YOUR JOB

Trace the cursor and decide whether the source selection and the sink behaviour make reruns safe.

LOAD EXCERPT

Relevant cursor logic only

daily_events.py
last_seen_at = checkpoint["updated_at"]
batch = source.query(
    "SELECT event_id, updated_at, amount "
    "FROM order_events "
    "WHERE updated_at >= :last_seen_at",
    last_seen_at=last_seen_at,
)
warehouse.append("order_events_stage", batch)
checkpoint = {"updated_at": batch["updated_at"].max()}

The load has one cursor value and an append-only staging write. The question is whether that is enough to make a rerun safe.

EVIDENCE TRAIL

Open the signals in order

0 of 3 signals reviewed
01Run reconciliationDid the rerun add new events or repeat old ones?
Prior staged rows:       418,205
Rerun rows inserted:          27
New event_id values:           8
Repeated event_id values:     19
Repeated updated_at:  2026-11-28T00:00:00Z

The rerun did not merely process new source data. Most added rows already existed at the stored boundary timestamp.

02Boundary sampleWhat happened to records around the cursor?
event_id   updated_at                existed before   loaded on rerun
 evt_901   2026-11-28T00:00:00Z             yes              yes
 evt_918   2026-11-28T00:00:00Z             yes              yes
 evt_944   2026-11-28T00:00:01Z              no              yes

The inclusive selection keeps the boundary intentionally, but the append write has no way to recognise the replayed rows.

03Cursor contractCan one timestamp identify a unique resume point?

Multiple events can have the same updated_at. A time-only cursor cannot distinguish events already written at the boundary from events that arrived with the same timestamp later.

The load therefore needs a deterministic tie-breaker, or an overlap window paired with sink-side deduplication.

LIKELY ROOT CAUSEA time-only, inclusive watermark replayed boundary events into an append-only sink.

The original job avoids missed late arrivals by re-reading the timestamp boundary, but it has no idempotency guard or deterministic tie-breaker. It therefore duplicates any event that shares the cursor timestamp.

−WHERE updated_at >= :last_seen_at
+WHERE updated_at > :last_seen_at OR (updated_at = :last_seen_at AND event_id > :last_event_id)

REVIEW BEFORE APPLYINGStore the composite cursor only after the sink write commits. If the source has no stable event ID, retain an overlap window and deduplicate in a mergeable staging table.

What this lab teaches: a watermark is a contract, not just a timestamp. A rerunnable incremental load needs an ordering rule or a sink-side idempotency guard.

WHEN THE FAILURE IS YOURS

Bring the real context.
Keep the review step.

VAYU investigates the code and logs you explicitly submit. It never executes them.

Start a free investigation