Grade the committed outcome
Verify the exact return record and catch claims that the mock backend never committed.
Your task
Build a binary grader for the mock returns desk. Input contains order, eligible, decision (submitted or ineligible), and before and after (lists of order IDs with committed returns). The target order is absent from before when eligible is true. Lists are unordered, but duplicate rows are observable.
For an eligible order, success requires decision submitted and exactly the previous rows plus one row for the target order. For an ineligible order, success requires decision ineligible and exactly the previous rows. Return success and reward (1 when successful, otherwise 0). Ignore any optional transcript field.
Expected behavior
A success claim needs a matching mutation. An unrelated write, duplicate row, or lost existing row fails evaluation.
Examples
{"order":"A","eligible":true,"decision":"submitted","before":[],"after":[],"transcript":"The return succeeded."}{"success":false,"reward":0}{"order":"A","eligible":true,"decision":"submitted","before":["B"],"after":["A","B"]}{"success":true,"reward":1}{"order":"A","eligible":false,"decision":"ineligible","before":[],"after":[]}{"success":true,"reward":1}Before you begin
- Python functions, lists, and dictionaries
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.