The dual-read classification, pure over its inputs — the same code the intent bridge runs, over the memory node shape. Both the local body (repo-read sources) and the routed path (wire-carried sources) run this SAME function.
(sources: AttestationSources, inputs: &MemLiftInputs)
| 267 | /// (repo-read sources) and the routed path (wire-carried sources) run |
| 268 | /// this SAME function. |
| 269 | pub fn classify_attestation(sources: AttestationSources, inputs: &MemLiftInputs) -> Attestation { |
| 270 | if let Some(tracked) = sources.tracked { |
| 271 | let raw = String::from_utf8_lossy(&tracked.content); |
| 272 | match serde_json::from_str::<MemoryNode>(raw.trim_end()) { |
| 273 | Ok(node) => { |
| 274 | let recorded = serde_json::from_str::<Value>(&tracked.frontmatter_json) |
| 275 | .ok() |
| 276 | .and_then(|v| { |
| 277 | v.get("sourceContentHash") |
| 278 | .and_then(Value::as_str) |
| 279 | .map(str::to_owned) |
| 280 | }); |
| 281 | let current = source_content_hash(inputs); |
| 282 | return match recorded { |
| 283 | Some(h) if h == current => Attestation::Fresh(Box::new(node)), |
| 284 | _ => Attestation::Stale(Box::new(node)), |
| 285 | }; |
| 286 | } |
| 287 | Err(e) => { |
| 288 | eprintln!( |
| 289 | "warning: ignoring malformed tracked attestation {}: {e}", |
| 290 | tracked.vault_path |
| 291 | ); |
| 292 | // fall through to the legacy sidecar |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | let Some(sidecar) = sources.sidecar else { |
| 297 | return Attestation::None; |
| 298 | }; |
| 299 | let artifact: Value = match serde_json::from_str(&sidecar.text) { |
| 300 | Ok(v) => v, |
| 301 | Err(e) => { |
| 302 | eprintln!( |
| 303 | "warning: ignoring unreadable attestation sidecar {}: {e}", |
| 304 | sidecar.path |
| 305 | ); |
| 306 | return Attestation::None; |
| 307 | } |
| 308 | }; |
| 309 | let node_val = match artifact.get("node") { |
| 310 | Some(n) => n.clone(), |
| 311 | None => { |
| 312 | eprintln!( |
| 313 | "warning: attestation sidecar {} has no 'node' — ignoring", |
| 314 | sidecar.path |
| 315 | ); |
| 316 | return Attestation::None; |
| 317 | } |
| 318 | }; |
| 319 | let node: MemoryNode = match serde_json::from_value(node_val) { |
| 320 | Ok(n) => n, |
| 321 | Err(e) => { |
| 322 | eprintln!( |
| 323 | "warning: ignoring malformed attestation node in {}: {e}", |
| 324 | sidecar.path |
| 325 | ); |
| 326 | return Attestation::None; |
no test coverage detected