The deployment that skips its checks
A failed build skips one dependent task, but a later deployment still runs.
What’s going wrong
Original Microsoft-style interview practice. This is not an actual Microsoft interview question. Bugger does not provide an AI assistant.
A pipeline correctly skips a task whose prerequisite failed. Its downstream deployment can nevertheless execute using artifacts that were never built. Repair schedule so failure blocks every dependent descendant while unrelated work continues.
Read {"tasks":[{"id":"build","dependsOn":[],"fails":true},...]} from stdin. Tasks form a directed acyclic graph, have unique nonempty string IDs, and refer only to declared IDs. Every task has a boolean fails value, but that value matters only if the task actually executes. Declarations may appear in any order.
Repeatedly choose the first pending task in original declaration order whose prerequisites have all reached a terminal status. If every prerequisite succeeded, execute it once and mark it failed when fails is true, otherwise succeeded. If any prerequisite failed or was skipped, mark the task skipped without executing it. A skipped task is terminal and can unblock evaluation of its descendants. Continue until all tasks are terminal.
Print {"execution":[IDs in actual execution order],"status":[[ID,status],...]} with statuses in original declaration order. Status is succeeded, failed or skipped. Valid input contains at most 100 tasks; dependency lists contain no duplicate IDs. Empty input is valid. There is no parallel execution, retry, cancellation, filesystem or network.
Expected behavior
Execute a task only after all of its prerequisites succeeded. Propagate skipped status through dependent descendants, and continue independent branches in deterministic order.
Reproduction
{"tasks":[{"id":"deploy","dependsOn":["test"],"fails":false},{"id":"test","dependsOn":["build"],"fails":false},{"id":"build","dependsOn":[],"fails":true}]}{"execution":["build"],"status":[["deploy","skipped"],["test","skipped"],["build","failed"]]}{"tasks":[{"id":"deploy","dependsOn":["test"],"fails":false},{"id":"build","dependsOn":[],"fails":false},{"id":"test","dependsOn":["build"],"fails":false}]}{"execution":["build","test","deploy"],"status":[["deploy","succeeded"],["build","succeeded"],["test","succeeded"]]}{"tasks":[{"id":"deploy","dependsOn":["test"],"fails":false},{"id":"build","dependsOn":[],"fails":true},{"id":"docs","dependsOn":[],"fails":false},{"id":"test","dependsOn":["build"],"fails":false}]}{"execution":["build","docs"],"status":[["deploy","skipped"],["build","failed"],["docs","succeeded"],["test","skipped"]]}Before you begin
- Directed acyclic dependency graphs
- TypeScript maps and sets
- Tracing terminal states and stable scheduling order
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.