← 返回 doordash 的题目列表AI Coding: Workflow Engine for Delayed Delivery Refunds + AI-generated Tests
类型:online_judge
Problem: Build a Parsable and Executable Workflow Engine for Delayed Delivery Refunds
Implement a simplified workflow engine to automate refund handling for delayed deliveries. Users provide a text-based workflow description where each step is a node. Your system must parse the text, build a workflow graph, and execute it to produce a refund decision (full/partial/no refund, follow-ups).
Inputs
A workflow text description (you define the syntax, but must specify it clearly) supporting at least:
Sequential execution
Conditional branching (if/else)
Node parameters (e.g., delay thresholds, refund percentages)
An Order object (promised ETA, actual delivery time/current time, order amount, delivered flag, etc.).
Output
Execution result:
action: NO_REFUND / PARTIAL_REFUND / FULL_REFUND
amount: refund amount (0 if none)
reason: explanation of which rule matched
Example capabilities
Delivered & delay > 30 min => full refund
Delivered & delay 10~30 min => partial refund (e.g., 20%)
Not delivered & past ETA by 20 min => partial credit or trigger human follow-up
Constraints
Parser must handle invalid input with readable errors.
Extensible design: easy to add new node types.
Testing: provide runnable tests, including
hand-written unit tests
an "AI-generated test case" strategy (property-based / random generation / mutation), and show at least 5 generated test examples.
Scale
Workflow nodes: 1 ~ 200
Execution time target: < 100ms per run (excluding external IO)
Deliverables
Syntax definition (EBNF or examples)
Core parsing + execution code
Test code and sample AI-generated cases
Example
Input
workflow: IF delivered AND delay_min > 30 THEN FULL_REFUND
order: delivered=true, delay_min=45, amount=30.00
Output
action=FULL_REFUND, amount=30.00