AI code review · Self-paced workshop

Capstone answer key — spoilers

Practise understanding changes, checking AI findings, and making review decisions you can defend.

Workshop index · Download all examples and lessons

Request changes. The new promotion loop violates two parts of the written contract:

  1. It drops waiting bookings that do not fit. Removing the head before determining whether it can be promoted loses the customer’s queue entry. The loop also continues and may admit smaller groups behind it, violating FIFO. Keep the head in place and stop when it cannot fit.
  2. It rejects exact fits. A strict < comparison prevents a group from using all available seats. The contract explicitly permits equality. Fixing this comparison alone does not fix lost entries or FIFO.

Example comments:

Required: the loop removes the queue head even when it cannot fit. With capacity 5, bookings a:2 and z:3, and waitlist b:3, c:1, cancelling a should leave b,c waiting. The candidate discards b and promotes c. Please inspect the head before removing it and stop when it cannot fit.

Required: an exact-fit group is not promoted. With capacity 5, booking a:5, and waitlist b:5, cancelling a should confirm b. The strict comparison rejects it. Please include equality and test exact-fill promotion.

The recorded AI claim about shared nested objects is false for these implementations: Python uses deepcopy, and TypeScript uses structuredClone on JSON-shaped input. Check the input remains unchanged; do not rely on names alone. There is no external notification delivery in this exercise, so claims about network retry behaviour require additional scope and code.

The fixes in this directory preserve response shape and the early return for unknown IDs. Tests cover input isolation, repeated cancellation, ordered multiple promotions, exact fits, oversized queue heads, and an empty queue. They are examples of contract-level evidence, not a proof of correctness for arbitrary future changes.

Use the rubric in docs/curriculum.md. Accept differently worded comments and additional valid findings. A strong review distinguishes the two defects and recognises that the lost-entry/FIFO failure remains after changing < to <=.