Build a workflow engine to automate DoorDash's self-help menu: given stubbed Workflow (DAG of START/END/IS_LATE/FULL_REFUND nodes), MockDoorDashAPI (get_order, get_current_eta, issue_refund) and WorkflowEngine.execute_workflow(workflow, order_id), implement the stubs (get_start_node, from_txt, execute_workflow) so the provided test passes.
Asked in the onsite - AI Code Craft stage. Use AI tooling locally; prompt engineering is evaluated. Reported follow-ups include partial refunds for slightly late orders and investigating 10-20 second execution time.
Implement execute_workflow(workflow, order_id). workflow is a JSON object with definition, orders, and current_etas. Return true when a FULL_REFUND node is reached and false otherwise. A late order has current_eta > promised_eta.
workflow["definition"] contains one node per nonempty line.START, END, IS_LATE, and FULL_REFUND.START node.promised_eta, and each current ETA is an integer.def execute_workflow(workflow, order_id):