Read a vault path from KG node metadata. New identity schemes can change node IDs without changing this retrieval contract.
(node: &KgNode)
| 623 | /// Read a vault path from KG node metadata. New identity schemes can change |
| 624 | /// node IDs without changing this retrieval contract. |
| 625 | fn memory_path_from_node(node: &KgNode) -> Option<String> { |
| 626 | node.metadata |
| 627 | .as_ref() |
| 628 | .and_then(|metadata| metadata.get("vault_path")) |
| 629 | .and_then(|path| path.as_str()) |
| 630 | .filter(|path| path.starts_with("memory/") && path.ends_with(".md")) |
| 631 | .map(String::from) |
| 632 | .or_else(|| legacy_memory_node_id_to_path(&node.id)) |
| 633 | } |
| 634 | |
| 635 | /// Legacy fallback: `memory:architecture` -> `memory/architecture.md`. |
| 636 | fn legacy_memory_node_id_to_path(node_id: &str) -> Option<String> { |
no test coverage detected