← Files Data Engineering CopilotARCHIVED FILE

references/core-invariants.md

1.31 KB · Nov 22, 2026 · 18:55 UTC

↓ Download file

See the change to this file →

# Production correctness invariants

Use this across every design/review. An invariant must be expressed as a test, not an adjective.

| Concern | Invariant | Smallest useful check |
|---|---|---|
| Grain | One output row per declared business key | Group by keys and count > 1 |
| Completeness | Every eligible source key/window accounted for | Anti-join or count by version/window |
| Replay | Reapplying the same input has no new business effect | Run deterministic replay twice on isolated fixture |
| CDC | Older sequence cannot overwrite newer state | Out-of-order event fixture |
| Deletes | Tombstones handled according to contract | Delete + reinsert fixture |
| Join | Multiplicity cannot inflate additive measures | Pre/post join counts by grain |
| Late arrival | Accepted late events processed per policy | Event-time boundary fixture |
| Checkpoint | Restart does not accidentally replay/unload data | Check state compatibility and source range |
| Recovery | Restorable state and source snapshot exist | Restore drill in nonproduction |
| Security | Data crossing trust boundaries remains authorized | Tenant/role-negative tests |

Never infer a key, exactly-once guarantee or metric definition solely from a table name. Check dates/time zones and applicable source snapshot. Use read-only checks before production mutations.

SHA-256: f7bf60f87e91276cf5ab971bd2045b318a05e5bb3304f4468521b1dec291a9f7