Two form entries arrive with the same email address. One is a second delivery of the same submission. The other is a different request from the same person. If your automation treats both as duplicates, it throws away real work. If it treats every delivery as new, a retry creates the work twice. A unique email column does not tell these apart.
All names and requests here are fictional. This is a local learning lab, not a production intake system.
Three identities, not one
At each step, ask which identity you are comparing:
- the delivery (one attempt to send data in),
- the submission (the thing the person actually filled in),
- the contact (the person).
Most bad deduplication rules compare the wrong one. The same contact can send two different submissions. The same submission can arrive in two deliveries.
What the lab does
The lab keeps every original delivery as raw input and derives review records from it. The page has three separate views: receive, processing state, and records for a person to review. Receiving data, processing it and deciding what to do are different events.
In the recorded run:
- The first delivery shows
processed. - The same delivery again shows
replayed, and the count of derived records does not go up. - A new event from the same address, asking something different, stays a separate record with a "duplicate candidate" label. Nothing is merged automatically. A human looks at it.
The state that looks wrong but is not
The lab also produces a receipt marked failed next to a derived record that already exists. This is not a fake error. The failure happened after one durable write and before a later acknowledgement. A retry has to recover from that uncertainty without creating a second request.
You can see the difference in the SQL exercise in the companion files. Keyed on email alone, the wrong rule leaves 1 retained row. Keyed on separate event IDs, the lab keeps 2 rows.
Run it yourself
The companion is a ZIP of the lab source, tests and a README. Python standard library only, no AI model, no paid account, no real customer data.
- Download: https://drive.google.com/file/d/1wca2FGzpjDwULSwgm1KJRJS38BgWbjZj/view
- Size 15,167 bytes. SHA256
0ac50e429c4abfbe54b377d9f40ca1789b34f77e5b4fbf2ff5c29127db641846. - This is a recovered and repacked archive, not byte-identical to an earlier one.
Extract it into a new empty folder. Run the supplied tests first and read the final result line rather than trusting scrolling test names. If a test fails, stop and keep the error. One HTTP test briefly uses the same port as the lab, so do not run it while the lab is running.
Limits
- The raw input database keeps values that fail validation. That is useful for the lab, but it means the database is not anonymous. Do not point this at real customer records.
- The server binds to your own machine. Do not change it to listen on all interfaces to share the demo.
- It was run on Linux with Python 3. Windows and macOS setup are not verified.
- A local review note is not an action taken for a customer. The app sends no email and connects to no inbox.
The video walks through the code and the two deliberate interruptions step by step.
Top comments (0)