Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
(
repo: &Repository,
id: &str,
node: &MemoryNode,
inputs: &MemLiftInputs,
)
| 394 | |
| 395 | /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper). |
| 396 | fn write_legacy_sidecar( |
| 397 | repo: &Repository, |
| 398 | id: &str, |
| 399 | node: &MemoryNode, |
| 400 | inputs: &MemLiftInputs, |
| 401 | ) { |
| 402 | let path = attested_sidecar_path(repo, id); |
| 403 | std::fs::create_dir_all(path.parent().unwrap()).unwrap(); |
| 404 | let mut artifact = serde_json::Map::new(); |
| 405 | artifact.insert("node".to_string(), node.to_value()); |
| 406 | let mut source = serde_json::Map::new(); |
| 407 | source.insert( |
| 408 | "sourceContentHash".to_string(), |
| 409 | Value::String(source_content_hash(inputs)), |
| 410 | ); |
| 411 | artifact.insert("source".to_string(), Value::Object(source)); |
| 412 | std::fs::write( |
| 413 | &path, |
| 414 | serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(), |
| 415 | ) |
| 416 | .unwrap(); |
| 417 | } |
| 418 | |
| 419 | #[test] |
| 420 | fn test_normalize_memory_path_all_forms() { |