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