Check a single span for zombie conflicts. Looks for live edges from unknown changes.
(
txn: &T,
workspace: &mut Workspace,
change: &Change,
verified_frontier: &VerifiedCausalFrontier,
node: GraphNode<NodeId>,
change_id: NodeId,
)
| 525 | /// |
| 526 | /// Looks for live edges from unknown changes. |
| 527 | fn check_vertex_for_zombies<T: GraphTxnT>( |
| 528 | txn: &T, |
| 529 | workspace: &mut Workspace, |
| 530 | change: &Change, |
| 531 | verified_frontier: &VerifiedCausalFrontier, |
| 532 | node: GraphNode<NodeId>, |
| 533 | change_id: NodeId, |
| 534 | ) -> Result<(), LocalApplyError> { |
| 535 | // The original code used `iter_adjacent(node, empty(), all() - DELETED)`, |
| 536 | // which spans BOTH forward and parent (reverse) edges — everything that |
| 537 | // is NOT deleted. The typed replacement must therefore check both |
| 538 | // directions: `iter_forward` (alive forward edges) and `iter_parents` |
| 539 | // (alive parent edges). |
| 540 | |
| 541 | // --- Forward edges (alive only) --- |
| 542 | let forward_edges = txn |
| 543 | .iter_forward(node, false) |
| 544 | .map_err(|e| LocalApplyError::Internal { |
| 545 | message: format!("Failed to iterate forward edges for zombies: {}", e), |
| 546 | })?; |
| 547 | |
| 548 | for edge in &forward_edges { |
| 549 | if edge.introduced_by == change_id || edge.introduced_by.is_root() { |
| 550 | continue; |
| 551 | } |
| 552 | |
| 553 | if let Ok(Some(hash)) = txn.get_external(edge.introduced_by) { |
| 554 | if !change.knows_with_frontier(&hash, verified_frontier) { |
| 555 | // Unknown live edge - this is a zombie |
| 556 | workspace.add_zombie_vertex(node); |
| 557 | return Ok(()); |
| 558 | } |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | // --- Parent edges (alive only) --- |
| 563 | let parent_edges = txn |
| 564 | .iter_parents(node, false) |
| 565 | .map_err(|e| LocalApplyError::Internal { |
| 566 | message: format!("Failed to iterate parent edges for zombies: {}", e), |
| 567 | })?; |
| 568 | |
| 569 | for edge in &parent_edges { |
| 570 | if edge.introduced_by == change_id || edge.introduced_by.is_root() { |
| 571 | continue; |
| 572 | } |
| 573 | |
| 574 | if let Ok(Some(hash)) = txn.get_external(edge.introduced_by) { |
| 575 | if !change.knows_with_frontier(&hash, verified_frontier) { |
| 576 | // Unknown live edge - this is a zombie |
| 577 | workspace.add_zombie_vertex(node); |
| 578 | return Ok(()); |
| 579 | } |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | Ok(()) |
| 584 | } |
no test coverage detected