1. Extend the ToDo List for AI so dependent tasks stay BLOCKED until all parent tasks SUCCEED.
Accept parent task IDs during task creation; initialize a child as BLOCKED unless every parent is SUCCEEDED; after a parent succeeds, move the child to READY only when all of its parents have succeeded.
At a high level, I would store each task with its parent task IDs and current status. The main challenge is stopping a child from running too early. I would explain two flows: creating the task and reacting when a parent succeeds. A new dependent task starts BLOCKED, then becomes READY only if every parent is SUCCEEDED. After any parent succeeds, affected children are checked again. The trade-off is repeated checks, but the dependency rule stays simple and correct.
The system must stop a dependent task from starting before all required parent work is finished. For example, T3 may depend on T1 and T2. T3 must stay BLOCKED while either parent is not SUCCEEDED. The important part is applying this rule when T3 is created and again when a parent later succeeds. The diagram does this with a stored Task Record, a status check, and a Parent Succeeds Event that finds affected children and checks them again.
- Can a task have zero, one, or many parent task IDs?
- Is SUCCEEDED the only parent state that can unblock a child?
- Should a child become READY as soon as its last parent succeeds?
I would start with one simple rule: a child becomes READY only when every parent is SUCCEEDED. If even one parent has another status, the child stays BLOCKED. A task with no parents becomes READY because it has nothing to wait for.
This same rule is used during task creation and during later parent updates. That keeps the behavior easy to understand.
For the create path, the request accepts optional parent_ids. The diagram uses T3 as an example with parents T1 and T2. The task is written to the Tasks Store, which keeps the task and its dependency information.
The Task Record contains the task ID, title, parent IDs, and status. For the dependent example, T3 starts as BLOCKED before the parent check decides whether it can move to READY.
Next, we evaluate the task status. If parent_ids is empty, the task becomes READY. If parents exist, we check their current statuses.
If every parent is SUCCEEDED, we set T.status to READY. Otherwise, we set T.status to BLOCKED. This prevents a dependent task from becoming runnable before all required work is complete.
The second flow starts when a parent task P becomes SUCCEEDED. We find every task T whose parent_ids contains P. Those tasks are the children affected by this parent update.
Each matching child goes back through the same status evaluation. We do not make a child READY just because one parent finished. We check all of its parents again.
The final decision stays simple. If all parents are SUCCEEDED, the child moves to READY. If any parent is not SUCCEEDED, the child remains BLOCKED.
The benefit is one clear rule for both flows. The downside is repeated checking. A child may be evaluated several times as different parents finish, but this prevents it from running too early.
The benefit is that one simple rule controls every dependency. A child becomes READY only when every parent is SUCCEEDED. The same check is used when the task is created and when a parent later succeeds. This makes the behavior easier to reason about and keeps both flows consistent. The downside is extra checking. When one parent succeeds, the system finds its dependent children and checks all parents for each child again. A child with several parents may be checked several times. We accept that extra work because it prevents dependent tasks from starting before all required parent work is complete.
The interviewer wants to see whether you can turn a dependency rule into correct state changes. They also want to see whether you notice both important moments: task creation and parent completion. A strong answer uses the same rule in both places, avoids unblocking a child too early, and explains the state flow clearly without adding unnecessary system parts.









