Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
(
repo: &Repository,
id: &str,
node: &MemoryNode,
inputs: &MemLiftInputs,
)
| 452 | |
| 453 | /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper). |
| 454 | fn write_legacy_sidecar( |
| 455 | repo: &Repository, |
| 456 | id: &str, |
| 457 | node: &MemoryNode, |
| 458 | inputs: &MemLiftInputs, |
| 459 | ) { |
| 460 | let path = attested_sidecar_path(repo, id); |
| 461 | std::fs::create_dir_all(path.parent().unwrap()).unwrap(); |
| 462 | let mut artifact = serde_json::Map::new(); |
| 463 | artifact.insert("node".to_string(), node.to_value()); |
| 464 | let mut source = serde_json::Map::new(); |
| 465 | source.insert( |
| 466 | "sourceContentHash".to_string(), |
| 467 | Value::String(source_content_hash(inputs)), |
| 468 | ); |
| 469 | artifact.insert("source".to_string(), Value::Object(source)); |
| 470 | std::fs::write( |
| 471 | &path, |
| 472 | serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(), |
| 473 | ) |
| 474 | .unwrap(); |
| 475 | } |
| 476 | |
| 477 | #[test] |
| 478 | fn test_normalize_memory_path_all_forms() { |