Parent: #878
Problem
DependencyGraph.remove_dependency() (added in #1035) removes a node and its incoming edges from parent nodes, but does not clean up child nodes that become orphaned. It also does not remove stale entries from the parents list on child nodes.
For example, if tomli==1.5 fails to bootstrap in --multiple-versions mode and is removed from the graph:
- Its children (e.g.,
flit-core==3.11.0) remain in self.nodes even if no other node references them
flit-core==3.11.0.parents still contains a stale edge pointing to the deleted tomli==1.5 node
Orphaned nodes don't affect build order (traversal starts from ROOT), but they appear in the serialized graph JSON as unreachable noise.
Expected behavior
When a node is removed, its children should be checked for remaining parents. Children with no remaining parents should be removed recursively.
Suggested fix
- Collect child nodes before deletion
- Clean up
parents list on children (remove stale edges to deleted node)
- Recursively remove children that have no remaining parents
Parent: #878
Problem
DependencyGraph.remove_dependency()(added in #1035) removes a node and its incoming edges from parent nodes, but does not clean up child nodes that become orphaned. It also does not remove stale entries from theparentslist on child nodes.For example, if
tomli==1.5fails to bootstrap in--multiple-versionsmode and is removed from the graph:flit-core==3.11.0) remain inself.nodeseven if no other node references themflit-core==3.11.0.parentsstill contains a stale edge pointing to the deletedtomli==1.5nodeOrphaned nodes don't affect build order (traversal starts from ROOT), but they appear in the serialized graph JSON as unreachable noise.
Expected behavior
When a node is removed, its children should be checked for remaining parents. Children with no remaining parents should be removed recursively.
Suggested fix
parentslist on children (remove stale edges to deleted node)