Skip to content
AyoKoding

Artifact: A Three-Round Correction Loop, Converging

Three feedback rounds on one diff, narrowing toward the acceptance bar -- exercises co-23.

Acceptance bar: the endpoint must (1) return 409 Conflict if the shipment already shipped, (2) return 404 if the shipment ID doesn't exist, (3) return 200 with the cancellation record on success, (4) be idempotent -- a second cancel call on an already-cancelled shipment also returns 200, not an error.

Round 1 diff: implements criteria 1 and 3 only. Feedback: "criteria 2 and 4 are both missing -- an unknown shipment ID currently falls through to a 500, and a second cancel call on an already-cancelled shipment raises instead of returning 200."

Round 2 diff: adds a 404 check for unknown IDs (closes criterion 2) and adds an already-cancelled check that raises a 409 (attempts criterion 4, but wrongly). Feedback: "criterion 4 specifically requires a second cancel to return 200, not 409 -- 409 is reserved for 'shipment already shipped' (criterion 1). An already-cancelled shipment is a different case: cancelling twice should be a no-op success, not a conflict."

Round 3 diff: adds a dedicated already-cancelled branch that returns 200 with the existing cancellation record instead of re-raising 409, keeping the shipped-conflict check (criterion 1) untouched. Result: all four criteria met; round 3 is accepted.

Convergence table:

RoundCriteria metCriteria still open
11, 32, 4
21, 2, 34 (wrong status code)
31, 2, 3, 4none

Last updated July 17, 2026

Command Palette

Search for a command to run...