codebaobab
Python workspace

All problemsData & Systems

Release Delivery Client

Finish an async client that delivers a label's song releases through a scored practice API.

Python60 minutesData & Systems

Challenge brief

Read before you begin

Your mission · Async delivery challenge

Make the delivery client handle failed Orders so one failure never stops the rest.

Low Tide Music Group's first catalog update on its own delivery client stopped after one failed release, so 831 songs missed release day. Artists were affected, and the partner counted the broken release against the label's quality score. Three in a month brings manual review, and the next update goes out December 4.

  • Target · C0 100%
  • Scale · 1,000 Orders
Skip to round setup

Your assignment

  1. Run the starter once and read the C0 result.
  2. Write one Order's state machine in PLAN.md.
  3. Add FailedOrder and a way to submit it.
  4. Handle each failure path, one at a time.
  5. Handle the new requirement when it arrives.

The problem

Metadata queued after a failure

Asset generation failed for the ninth Order, and the client queued Metadata anyway.

Impact: The partner marked the Order broken, which hurts the label's quality score.

One failure ended the run

The exception from the broken Order stopped the whole delivery.

Impact: 831 songs were never taken and missed release day.

No way to report failure

The SDK has no FailedOrder, so the client only knows the success path.

Impact: The label cannot see which generation failed to fix its source files.

Context

Songs missed release day
831
Broken Orders trigger review
3
Next catalog update
Dec 4

Requirements

  • Take the Order before anything else.
  • Never queue Metadata after Asset generation fails.
  • Wait while Metadata is PENDING.
  • FailedOrder carries what succeeded, the rest null.
  • ShippableOrder when Assets and Metadata succeed.
  • Exactly one final submission per Order.
  • One failed Order never stops the others.
  • Await every call; wait with asyncio.sleep().

System overview

Edit the components marked “Your work”. The other components show where your changes fit.

Label catalogQueues song releases
Order queueHolds orders in sequence
Delivery client(Your work)Delivers each release
Delivery SDKWraps partner calls
Partner APIGenerates assets and metadata
Partner ingestGrades submissions
Read the connections
  • Label catalog → Order queue: Orders
  • Order queue → Delivery client: peek, take
  • Delivery client → Delivery SDK: await calls
  • Delivery SDK → Partner API: HTTP
  • Partner API → Partner ingest: submission
  • Label catalog: Puts each song release on the partner queue as an Order.
  • Order queue: Partner side. Only the Order at the head can be taken.
  • Delivery client: main(sdk) in delivery/client.py; run runs it on the test server's simulated clock.
  • Delivery SDK: delivery/sdk.py: one async function per call, ApiError and the classes.
  • Partner API: Asset and Metadata generation jobs, 20 to 80 ms each.
  • Partner ingest: Grades each submission: CORRECT, INCORRECT or BROKEN. Final.

Details

Full requirements

Functional

  1. Take an Order before anything else, then queue Asset generation, get the Assets and each Asset's AssetDetail. The partner rejects work on an Order nobody took.
  2. Asset generation has failed when get assets fails or returns an empty list. Then never queue Metadata (the Order breaks) and submit a FailedOrder with the Order only: assets null, metadata null.
  3. Queue Metadata only after the Assets are done, and wait while its status is PENDING. It has failed when the status is FAILED, the get metadata call fails, or it returns null or {}. Then submit a FailedOrder with the Order and every Asset with its details, metadata null.
  4. When both succeed, submit a ShippableOrder with the Order, the Assets with their details and the Metadata.
  5. Exactly one submission per Order, and a submission is final. One Order that fails must never stop the Orders behind it.
  6. Add FailedOrder and a way to submit it to the SDK next to ShippableOrder. Every call is awaited, and waits use await asyncio.sleep().

Non-functional

  • Scoring: a challenge passes only when 100% of its Orders end CORRECT. C0 has 7 to 9 Orders, 0 ms per call and a 30-second limit, and always holds every kind of failure.
  • Production shape: the partner answers in about 50 ms a call, one Order takes about a dozen calls, and a release-day drop is up to 1,000 Orders. The scoreboard adds those conditions later in the round.
  • Failure mix: in last quarter's deliveries about 6% of Orders had a failed Asset generation and 9% a failed Metadata generation. Both are normal answers, not outages.
  • Time: generation jobs take 20 to 80 ms, on a simulated clock. A client that blocks the clock, or makes far more calls than a correct client needs, is stopped by the test server.

Out of scope

  • The test server and run(): they are the grader. Read them, and leave them unchanged.
  • Fixing source files for failed Orders: the label's content team does that from the FailedOrder.
  • Authentication, and any real partner API: everything runs in memory.
Data model

Order

FieldTypeNotes
order_idstringSuch as ord-3fa9c1.
title, artiststringThe song and the artist.
isrcstringThe recording's ISRC code.

Asset and AssetDetail

FieldTypeNotes
asset_id, order_idstringOne or more Assets per Order.
type, filenamestringaudio, cover_art and so on.
detailsAssetDetail{asset_id, checksum, size_bytes, format}, one per Asset, filled in by the client.

Submission body

FieldTypeNotes
statusstringSHIPPABLE or FAILED.
orderOrderAlways present.
assetsAsset[] or nullnull when Asset generation failed.
metadataMetadata or nullnull in every FailedOrder.
Files you are given · 4
  • logs/c0-seed-7-starter.log The Terminal log of the starter client on C0 with seed 7. Pass {"challenge": "C0", "seed": 7} to run to repeat it exactly.
    === C0: 8 orders, 0 ms latency, time limit 30s (seed 7) ===
        0.0s  1/8 finished   score 0/8
      main() raised an exception:
        Traceback (most recent call last):
          File "delivery/client.py", line 33, in main
            await process_order(sdk, order)
          File "delivery/client.py", line 19, in process_order
            await sdk.queue_metadata_generation(order.order_id)
          File "delivery/sdk.py", line 154, in queue_metadata_generation
            await self._request("POST", "/orders/%s/metadata/generate" % order_id)
          File "delivery/sdk.py", line 115, in _request
            raise ApiError(status, reply)
        delivery.sdk.ApiError: HTTP 409: {'code': 'ORDER_BROKEN', 'error': 'metadata generation queued although asset generation failed'}
      8 order(s) not correct (first 8 shown):
        ord-bb3b93  BROKEN        submitted=None      metadata generation queued although asset generation failed
        ord-7b382e  NOT_SUBMITTED submitted=None      never taken
        ord-724c60  NOT_SUBMITTED submitted=None      never taken
        ord-442f7d  NOT_SUBMITTED submitted=None      never taken
        ord-5c882b  NOT_SUBMITTED submitted=None      never taken
        ord-1e840b  NOT_SUBMITTED submitted=None      never taken
        ord-b92152  NOT_SUBMITTED submitted=None      never taken
        ord-99ba40  NOT_SUBMITTED submitted=None      never taken
      C0 score: 0/8 (0%)   incorrect 0, broken 1, not submitted 7; 7 requests, 0.0s
  • samples/failed-order-assets.json The body a FailedOrder must have when Asset generation failed.
    {
      "status": "FAILED",
      "order": {
        "order_id": "ord-3fa9c1",
        "title": "Paper Lantern",
        "artist": "Juno Vale",
        "isrc": "XXCBB2600007"
      },
      "assets": null,
      "metadata": null
    }
  • samples/failed-order-metadata.json The body a FailedOrder must have when Metadata generation failed: the Assets with their details, and no Metadata.
    {
      "status": "FAILED",
      "order": {
        "order_id": "ord-3fa9c1",
        "title": "Paper Lantern",
        "artist": "Juno Vale",
        "isrc": "XXCBB2600007"
      },
      "assets": [
        {
          "asset_id": "ord-3fa9c1-a1",
          "order_id": "ord-3fa9c1",
          "type": "audio",
          "filename": "ord-3fa9c1_1_audio.wav",
          "details": {
            "asset_id": "ord-3fa9c1-a1",
            "checksum": "9b2f41c07e",
            "size_bytes": 10170287,
            "format": "WAV"
          }
        },
        {
          "asset_id": "ord-3fa9c1-a2",
          "order_id": "ord-3fa9c1",
          "type": "cover_art",
          "filename": "ord-3fa9c1_2_cover_art.jpg",
          "details": {
            "asset_id": "ord-3fa9c1-a2",
            "checksum": "51d0aa8e33",
            "size_bytes": 2861402,
            "format": "JPEG"
          }
        }
      ],
      "metadata": null
    }
  • metrics/deliveries-2026-11.csv November deliveries from the partner's report. failed_assets and failed_metadata count Orders correctly submitted as FailedOrders. On November 20 the new client submitted 8 Orders, broke the ninth, and never took the other 831.
    date,client,orders,correct,failed_assets,failed_metadata,broken,not_submitted
    2026-11-06,vendor,212,212,13,19,0,0
    2026-11-13,vendor,388,388,22,35,0,0
    2026-11-20,in-house,840,8,0,0,1,831
Tickets · 3
  • TASK-201 Read the API notes and run the starter once Reported by Nadia (release operations)

    Expected You can say which Order went wrong first, why, and why every Order behind it was never taken.

    Actual C0 scores 0/8, matching logs/c0-seed-7-starter.log: ord-bb3b93 is BROKEN, main() raised a 409 ORDER_BROKEN, and the other 7 Orders are NOT_SUBMITTED.

  • TASK-202 Write one Order's path as a small state machine Reported by Tobi (Delivery tech lead)

    Expected PLAN.md shows each call, its possible answers, and which of the three submissions each ending needs.

    Actual PLAN.md says "No plan yet."

  • TASK-203 Add FailedOrder, then each failure path, one at a time Reported by Tobi (Delivery tech lead)

    Expected C0 scores 100% on every seed. Seed 7 ends with 8 of 8 correct: two FailedOrders for Assets, four for Metadata and two ShippableOrders.

    Actual The SDK has no FailedOrder and no way to submit one, and the client only knows the path where everything succeeds.

What you hand in
  • delivery/client.py and delivery/sdk.py with C0 at 100%, and the later challenges at 100% when they join the scoreboard.
  • PLAN.md: the state machine of one Order and the three endings.
  • Your answer to the interviewer's follow-up and the debrief questions, including how you know each failure path is right.
How the work is judged
Breaking down the work
Writes the endings of one Order before prompting, then adds one ending at a time with a C0 run after each.
Directing the assistant
Gives the assistant the six rules, the submission shapes and the reasons from the C0 row, and keeps the SDK change apart from the client change.
Checking the work
Reads the reason for each Order in the C0 row, repeats a failing seed, and runs new seeds until 100% holds.
Judging the assistant
Catches a status loop that treats FAILED as done, one try around the whole Order, or an empty Asset list shipped; never edits the grader.
Correct result
C0 at 100% on every seed: three distinct endings, each with exactly the data the rules call for, and no Order lost behind a failure.
Explaining the work
Explains why a failed generation is an answer about the Order and not a reason to stop the run.
Trade-offs to discuss
  • Where a failure is decided: in the SDK (Metadata.from_json returns None) or in the client, and what each hides.
  • Recording an Order the client could not finish versus submitting a guess, when a submission is final.
  • Speed against the partner's rules: how much work in flight a delivery can have before it risks Orders it cannot finish.
How you are graded
  • Decomposition 15%
  • Prompting the assistant 15%
  • Verification 20%
  • Judgment about AI output 15%
  • Correctness 25%
  • Communication 10%

Scores use evidence from your session. A short or incomplete session may not provide enough evidence for every skill. See a sample scorecard

Interview guidance

This client delivers a record label's song releases to Spotify through a practice API, and today it only handles the Order where nothing goes wrong. Run scores it: the share of Orders submitted correctly in each challenge, and a challenge passes only at 100%. Get C0 to 100% first. Read the API notes before you prompt, use the AI assistant however you like, and tell me how you know each failure path is right.

  • AI is allowed and expected: your own Claude, OpenAI or Gemini key, or the free in-browser model.
  • You are graded on how you drive and check the AI, not on how much you prompt.
  • Run the checks; read what fails.
  • A new requirement will arrive partway through.
  • Too little AI use is reported as “not enough to grade”, never as a fail.
Debrief · 7 questions
  • What did you delegate to the AI, and why?
  • Name one AI suggestion you rejected or changed, and why.
  • Choose one block the AI helped write. Explain what each line does and which test verifies it.
  • What is still risky, and what would you test or ship next?
  • Walk through the endings of one Order. Where in your code does each FailedOrder get its data, and what stops an Asset failure from reaching queue_metadata_generation?
  • A call answers 500 and the retry answers ALREADY_SUBMITTED. What happened, and how does your client treat it? What about a take whose reply was lost?
  • Why does only one loop peek and take, and what limits how far it runs ahead of the workers?