Flatten a dependency tree into a list of bugs