stage 3 of 6 · try of no-docs

book-shipment

wrong

Book an order with Tern, safe to retry (needs from the docs: D3 idempotency)

Made
28 Nov 2026, 21:11 UTC
Model
claude-sonnet-5-5
Steps
11
Tool calls
9
Friction
6 flagged steps
Tokens read
269k
Time
28s
Cost
$0.066
Address
tern-docs/try/20261128-2029-menv/book-shipment
1quote-at-checkoutwrong2quote-optionswrong3book-shipmentwrong4sync-shipmentsright5order-statuswrong6cancel-before-pickupwrong
This is the backend of Larkspur Tea, a small online tea shop. We ship with Tern, a parcel carrier. Tern's API documentation is at http://localhost:8080/ and Tern's sandbox API is running at http://localhost:8081 (the test key is already in `shop/settings.py`). Implement `book` in `shop/shipping.py`: book a paid order's parcel with Tern on the service the customer chose, and return Tern's shipment id. Our connection to Tern sometimes drops in the middle of a request, so `book` must retry when that happens, and a retry must never book the same order twice. Keep the shop's existing tests passing; add your own if you like.