Check a single span for zombie conflicts. Looks for live edges from unknown changes.
(
txn: &T,
workspace: &mut Workspace,
change: &Change,
node: GraphNode<NodeId>,
change_id: NodeId,
)
| 370 | /// |
| 371 | /// Looks for live edges from unknown changes. |
| 372 | fn check_vertex_for_zombies<T: GraphTxnT>( |
| 373 | txn: &T, |
| 374 | workspace: &mut Workspace, |
| 375 | change: &Change, |
| 376 | node: GraphNode<NodeId>, |
| 377 | change_id: NodeId, |
| 378 | ) -> Result<(), LocalApplyError> { |
| 379 | // The original code used `iter_adjacent(node, empty(), all() - DELETED)`, |
| 380 | // which spans BOTH forward and parent (reverse) edges — everything that |
| 381 | // is NOT deleted. The typed replacement must therefore check both |
| 382 | // directions: `iter_forward` (alive forward edges) and `iter_parents` |
| 383 | // (alive parent edges). |
| 384 | |
| 385 | // --- Forward edges (alive only) --- |
| 386 | let forward_edges = txn |
| 387 | .iter_forward(node, false) |
| 388 | .map_err(|e| LocalApplyError::Internal { |
| 389 | message: format!("Failed to iterate forward edges for zombies: {}", e), |
| 390 | })?; |
| 391 | |
| 392 | for edge in &forward_edges { |
| 393 | if edge.introduced_by == change_id || edge.introduced_by.is_root() { |
| 394 | continue; |
| 395 | } |
| 396 | |
| 397 | if let Ok(Some(hash)) = txn.get_external(edge.introduced_by) { |
| 398 | if !change.knows(&hash) { |
| 399 | // Unknown live edge - this is a zombie |
| 400 | workspace.add_zombie_vertex(node); |
| 401 | return Ok(()); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | // --- Parent edges (alive only) --- |
| 407 | let parent_edges = txn |
| 408 | .iter_parents(node, false) |
| 409 | .map_err(|e| LocalApplyError::Internal { |
| 410 | message: format!("Failed to iterate parent edges for zombies: {}", e), |
| 411 | })?; |
| 412 | |
| 413 | for edge in &parent_edges { |
| 414 | if edge.introduced_by == change_id || edge.introduced_by.is_root() { |
| 415 | continue; |
| 416 | } |
| 417 | |
| 418 | if let Ok(Some(hash)) = txn.get_external(edge.introduced_by) { |
| 419 | if !change.knows(&hash) { |
| 420 | // Unknown live edge - this is a zombie |
| 421 | workspace.add_zombie_vertex(node); |
| 422 | return Ok(()); |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | Ok(()) |
| 428 | } |
| 429 |
no test coverage detected