Read a vault path from KG node metadata. New identity schemes can change node IDs without changing this retrieval contract.
(node: &KgNode)
| 569 | /// Read a vault path from KG node metadata. New identity schemes can change |
| 570 | /// node IDs without changing this retrieval contract. |
| 571 | fn memory_path_from_node(node: &KgNode) -> Option<String> { |
| 572 | node.metadata |
| 573 | .as_ref() |
| 574 | .and_then(|metadata| metadata.get("vault_path")) |
| 575 | .and_then(|path| path.as_str()) |
| 576 | .filter(|path| path.starts_with("memory/") && path.ends_with(".md")) |
| 577 | .map(String::from) |
| 578 | .or_else(|| legacy_memory_node_id_to_path(&node.id)) |
| 579 | } |
| 580 | |
| 581 | /// Legacy fallback: `memory:architecture` -> `memory/architecture.md`. |
| 582 | fn legacy_memory_node_id_to_path(node_id: &str) -> Option<String> { |
no test coverage detected