Give the reviewer an input they can read
A small fix gives you room to show how you reason about behavior. In this fictional example, a daily shipment report says there are three shipments because it received three rows. The IDs are S12, S18, and S12. The report is supposed to count distinct shipment IDs, so the expected total is two. Put the sample input and expected output in the README before asking someone to inspect the code.
Explain why the count matters in this example. Suppose the operations team uses the report to figure out how many shipments need attention that day. A repeated row sends them looking for an extra shipment. You can show the consequence with the same three rows. Use a sanitized or fictional fixture if the original input contains customer or company details.
Write down the rule before the implementation
For this report, the shipment ID determines whether a row represents a shipment already counted. Keep a set of IDs that have passed the report’s eligibility checks. Add the ID when an eligible row appears, and count the IDs in the set. Write down what happens when an ineligible row for S12 arrives before an eligible one. If you add the ID too early, the good row may never be counted.
Also say what happens when the ID is missing or two rows for the same ID disagree on another field. The count alone may be straightforward. Choosing which date or quantity to report would be a separate rule. If the change only fixes the count, show that boundary in the README so the next engineer knows when to ask for a decision.
Show why the test would catch the failure
Start with the three-row example. An assertion for a total of two fails against the old counting rule and passes against the new one. Add a case where all IDs are unique so a change that always returns two gets caught. Add an empty input case and state the expected total. If zero units is a valid quantity in your report, exercise a zero-unit row so a later filter change does not quietly drop it.
Give the reviewer the same test command you use yourself. If it needs a particular runtime or fixture, say so next to the command. Keep the fixture short enough that a reader can count the rows by hand. Link directly to the test and the change. A repository landing page alone leaves the reviewer to find the work you want to discuss.
Write a handoff for the next engineer
Try a short handoff for the example. “The report counted rows, so a replayed shipment showed up twice. It now counts distinct eligible shipment IDs. The regression fixture has two unique IDs across three rows and expects two.” Add where you’d check if the count drifts again. In this example you might compare the report with a source extract for the same date and eligibility rules.
Include one trade-off you could revisit in an interview. A set is easy to follow for a report that reads a small file in one run. If the report starts processing large files or needs to remember IDs across runs, explain what you would need to know about volume, storage, and the lifetime of an ID before choosing a different approach.
A CV bullet for the fictional project might read, “Fixed duplicate shipment counts by counting eligible shipment IDs once and added regression tests for repeated IDs and empty input.” Link to the README section that shows the failure. If this was a team project, say which part of the change and testing you owned. Bring one question you’d ask the report owner if the inputs changed. For instance, would the same ID appearing on two days represent a replay or a legitimate shipment in a new reporting period? The answer determines where the counting rule applies.
In the Veylscore assessment
The same record ID appears twice in a report. Explain how you’d count it once and test the result.