Reconciliation and idempotency
Reconcile before committing
Idempotency means repeating the same logical input leaves the published business state unchanged. It does not mean every execution produces identical logs. Define the daily slice and stable key (Day, LineId), source version, schema and expected controls. In this lab exact duplicate replays are ignored, one invalid price is quarantined, conflicting duplicates block the batch, and wrong-day rows block the batch. Reject counts are part of the approved manifest; the invalid amount cannot be summed. Production control totals must come from independent upstream evidence, not from the same partial output.
Separate candidate, committed and report-ready states
The local verifier uses SQLite transactions to replace one business-day slice after count, key and amount reconciliation. The single-writer policy is intentional: overlapping runs require locking or version checks and separate staging. A real Fabric implementation must select a supported transactional strategy for the chosen destination, verify write semantics and test rollback. A committed table is not automatically a refreshed semantic model. Track the committed version and report-ready version separately; if model refresh fails, retry that stage against the same approved data, rather than append the source again.
Worked example 1 — reconcile the daily manifest
Five input rows are three unique accepted lines, one exact replay and one reject. North 16,000 cents plus South 8,000 equals 24,000. The prior approved day has 12,000 cents. After commit, the cumulative store contains four rows and 36,000 cents. Do not add the replayed B again (would inflate the day by 6,000). Do not treat the unparseable D value as zero. If the stage contains only A, the count and total checks fail and the prior snapshot remains unchanged.
Worked example 2 — commit interruption and replay
In the local simulator, an exception after DELETE and before INSERT inside a transaction rolls back the replacement. The old approved table remains unchanged. Then run the complete candidate, commit it and simulate a failed model refresh: the new data is present, but the report-ready state has not advanced. Two subsequent identical daily replacements produce the same four rows and 36,000 cents. In a real recovery, prefer retrying just the model refresh if the committed version remains valid; the verifier separately demonstrates full slice replay parity. Never assume all Gen2 update methods have this transactional behavior.
Failure gates and safe operation
Fail closed for a schema mismatch or conflicting key; quarantine only explicitly permitted invalid rows. Compare stage key uniqueness, expected counts, daily revenue and prior-day preservation. Reject a partial write even if the pipeline reports success. Keep an immutable source manifest, versioned definitions, sanitized audit evidence and rollback procedure. For an optional Fabric run, obtain approval for a disposable environment, one manual run plus one retry, limited access and cleanup. Native transactional semantics, concurrent writers, gateway behavior and model refresh are not exercised here.
Practice and references
Run the verifier, complete the worksheet and explain which state advances for each failure. Design a separate model-refresh retry with an immutable committed version and no source reload. Record data ownership and a capacity budget without guessing actual CU usage. Review destinations, retries, monitoring and earlier Chapters 18, 37 and 48. Next: Direct Lake semantic model engineering.