Invalidate stale checkpoints
Implement resume_plan(dependencies, checkpoint, versions). A stored entry has a version and may have any result, including None. A node can be reused only if a checkpoint entry exists, its version matches, and every predecessor is reusable. Return sorted reuse and rerun lists. Ignore obsolete checkpoint nodes. Require versions to describe exactly the graph nodes; reject unknown dependencies and cycles. This plans pure computations only; external effects need separate reconciliation.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
Inputa -> b -> d; a version changed; independent c unchanged
Outputreuse=[c], rerun=[a,b,d]
InputAll versions match and all entries exist
OutputAll nodes reusable
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor