Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper).
(
repo: &Repository,
id: &str,
node: &MemoryNode,
inputs: &MemLiftInputs,
)
| 341 | |
| 342 | /// Mirror `attest`'s legacy sidecar write exactly ({node, source} wrapper). |
| 343 | fn write_legacy_sidecar( |
| 344 | repo: &Repository, |
| 345 | id: &str, |
| 346 | node: &MemoryNode, |
| 347 | inputs: &MemLiftInputs, |
| 348 | ) { |
| 349 | let path = attested_sidecar_path(repo, id); |
| 350 | std::fs::create_dir_all(path.parent().unwrap()).unwrap(); |
| 351 | let mut artifact = serde_json::Map::new(); |
| 352 | artifact.insert("node".to_string(), node.to_value()); |
| 353 | let mut source = serde_json::Map::new(); |
| 354 | source.insert( |
| 355 | "sourceContentHash".to_string(), |
| 356 | Value::String(source_content_hash(inputs)), |
| 357 | ); |
| 358 | artifact.insert("source".to_string(), Value::Object(source)); |
| 359 | std::fs::write( |
| 360 | &path, |
| 361 | serde_json::to_string_pretty(&Value::Object(artifact)).unwrap(), |
| 362 | ) |
| 363 | .unwrap(); |
| 364 | } |
| 365 | |
| 366 | #[test] |
| 367 | fn test_normalize_memory_path_all_forms() { |