Verifying the Work
By the end of this lesson, you should be able to evaluate a worker's handoff, select checks from the requirements, distinguish different kinds of evidence, and make a reasoned accept-or-revise decision.
Start with the change, then the explanation
An assistant's summary is useful for orientation, but it is not the source of truth. Open the diff and compare it with the assignment. Identify the files changed, the behavior introduced, and any changes to tests or settings. If the summary says one file changed and the diff shows five, resolve that discrepancy before accepting the story.
For the reading-list example, the complete rejected implementation fits on two lines. It strips whitespace, uses a set, lowercases titles, and sorts the result. Every operation is visible. The set removes repeated lowercase values, but the sorting discards the reader's chosen order. Lowercasing changes the spelling that should have been preserved. It also does not implement the agreed Unicode comparison rule.
None of those defects requires a crash. The function returns a list and looks concise. This is why "runs without errors" is too weak an acceptance criterion. Correctness depends on the agreement, not merely on whether the programming language accepts the code.
Compare expected and observed behavior
Consider this focused case:
titles = ["Solaris", "Dune", "Earthsea", "dune"]
expected = ["Solaris", "Dune", "Earthsea"]
observed_rejected = ["dune", "earthsea", "solaris"]
The rejected output reveals two product failures at once: the order changed, and the first spelling disappeared. Use separate focused tests as well, so a failure message tells you which rule broke. A combined example shows the whole experience; isolated cases help explain the cause.
The supplied example runner executes eleven contract tests against each implementation. The deliberately rejected candidate fails five tests. The corrected candidate passes all eleven. Those are the observed outcomes for these specific files and cases; they do not establish that every possible input has been proven correct.
The complete recorded outputs are in the downloadable example. To reproduce them after extracting the portable package, open a terminal in that package's root and run:
python3 example/run_checks.py rejected
python3 example/run_checks.py corrected
The first command should finish with a nonzero exit status because it tests a known rejected implementation. The second should finish with exit status zero. Neither command changes your project or connects to the network. Python must already be installed; do not paste commands into an unfamiliar project directory and assume the files are the same.
Separate four levels of confidence
First, there is a worker claim: "I ran the tests." Second, there is recorded evidence: the command and its output. Third, there is a check you or another reviewer actually rerun against the candidate. Fourth, there is product acceptance: the owner deciding the result serves the intended experience.
These levels can support one another without becoming interchangeable. Recorded output might belong to an older file. A rerun might use tests that omit an important rule. Passing tests might still produce an awkward interface. A happy owner might have tried only the easiest path. Name what each result establishes and what remains uncertain.
For our tiny function, useful additional inspection includes checking that the input is never modified, that the set stores comparison keys rather than output spellings, and that no hidden file or network work has been added. Rerunning the same assertion many times adds little if the missing question is whether the requirement itself was understood.
Read the correction as an explanation of behavior
Here is the corrected implementation:
def clean_titles(titles):
result = []
seen = set()
for title in titles:
cleaned = title.strip()
if not cleaned:
continue
key = cleaned.casefold()
if key not in seen:
seen.add(key)
result.append(cleaned)
return result
Trace one duplicate. The first Dune becomes the comparison key dune; the original trimmed spelling is appended. The later dune has the same key, so nothing is appended. Trace a new title: it is appended at the moment it first appears, with no later sorting. The loop reads the input and constructs separate containers, leaving the original list untouched.
This trace connects lines to requirements. It is more useful than saying the implementation uses an "efficient algorithm." Performance claims would need appropriate measurements if performance mattered. For the tiny supplied lists, the important issue is whether the behavior is correct and understandable.
Inspect the tests too
Tests are code written by someone, often the same assistant that wrote the implementation. Inspect their expected results. If a test expects sorted lowercase titles, it can pass while encoding the exact mistake you want to reject. A green result is only as relevant as the question the test asks.
The supplied suite covers empty input, whitespace-only input, trimming, ordinary duplicates, mixed-case duplicates, first spelling, unsorted order, Unicode case folding, input preservation, return of a new list, and preservation of internal whitespace distinctions. The rejected candidate passes some of these. That matters: an honest report must show the failures as well as the successes.
For a larger change, inspect boundaries between components and old data as well. A unit test for one function does not demonstrate that an application calls it correctly. A browser screenshot does not demonstrate that a download contains the right bytes. Choose evidence at the level where the consequence appears.
Write a bounded correction request
A useful response to the rejected candidate is: "Revise. The result sorts the list and loses the first spelling. It also uses lowercasing instead of the agreed casefold comparison. Preserve original order and first trimmed spelling, add distinguishing tests for those rules, and rerun the full suite. Keep the existing interface and exclusions."
That request identifies the contract failures and the evidence needed to close them. It does not add a new interface or silently expand the task. If you find yourself changing the intended behavior instead, acknowledge a product revision and update the agreement before asking the worker to continue.
Avoid vague rejection such as "make it better." It leaves the assistant to guess what bothered you and may trigger unrelated changes. Avoid accepting a promise to fix it later when the failed behavior is part of the current task's definition of success.
Make an acceptance decision with limits
For this example, an engineering review can conclude that the corrected source satisfies the specified cases, stays within scope, and preserves input. It should still identify the supported input type and the exact matching rule. Those limitations are part of the interface, not unfinished features to conceal.
The owner then tries a representative personal list. Does the result preserve the intended study sequence and recognizable spelling? If it does, the owner may accept the behavior. This course does not supply a fabricated owner acceptance. Your exercise is to explain what you would check and why your decision follows from the evidence.
In your own project, write a short acceptance note: the candidate identifier, requirements reviewed, checks actually performed, limitations, decision, and who made it. A decision with a date and source reference is easier to audit than a chat message saying "looks good" that cannot be connected to the final files.
Practice: evaluate one missing case
Suppose the corrected implementation passed every output check, but nobody compared the input before and after the call. Would you accept an assignment that explicitly requires input preservation? Identify the remaining uncertainty and propose the smallest check that resolves it.
A sound answer is to copy the input list, call the function, and compare the original with the copy. Also inspect whether the function sorts or edits the input in place. The missing evidence does not automatically prove a bug. It establishes a question that must be resolved before the acceptance criterion is met.
