| 1 | use serde_json::{json, Value}; |
| 2 | |
| 3 | pub fn summarize(report: &Value) -> Vec<Value> { |
| 4 | let mut checks = Vec::new(); |
| 5 | let mut add = |name: &str, passed: bool, detail: &str| { |
| 6 | checks.push(json!({"name":name,"status":if passed{"PASS"}else{"FAIL"},"detail":detail})) |
| 7 | }; |
| 8 | let source = &report["source_before_push"]; |
| 9 | let receiver = &report["receiver_after_pull"]; |
| 10 | add("recorded change and inline provenance",receiver["change"]["available"]==true&&receiver["change"]["cost_micro_usd"]==source["change"]["cost_micro_usd"],"Fresh receiver loads the transferred change; inline metadata is queryable without a working tree."); |
| 11 | add( |
| 12 | "semantic FileOps", |
| 13 | receiver["change"]["file_ops"] == source["change"]["file_ops"], |
| 14 | "Recorded semantic operation count survives transport.", |
| 15 | ); |
| 16 | add( |
| 17 | "initial unhashed transcript", |
| 18 | receiver["change"]["unhashed"] == source["change"]["unhashed"], |
| 19 | "Initial display payload transferred; not authenticated by the change hash.", |
| 20 | ); |
| 21 | add("opaque metadata fidelity",receiver["change"]["metadata_bytes"].as_u64().unwrap_or(0)>0,"The fixture supplied a nonempty envelope, but the stored source and receiver both lost it."); |
| 22 | add( |
| 23 | "provenance and graph attestation", |
| 24 | receiver["provenance"]["available"] == true && receiver["attestation_available"] == true, |
| 25 | "Independent evidence artifacts and backlinks arrived.", |
| 26 | ); |
| 27 | add( |
| 28 | "session ledger reconstruction", |
| 29 | !receiver["session_ledger"].is_null(), |
| 30 | "Transferred provenance reconstructed a durable session ledger.", |
| 31 | ); |
| 32 | add( |
| 33 | "tags", |
| 34 | receiver["tags"]["feature"] |
| 35 | .as_array() |
| 36 | .is_some_and(|a| a.iter().any(|v| v == "acceptance-tag")), |
| 37 | "Named feature tag arrived.", |
| 38 | ); |
| 39 | add("structured vault queries after fresh pull",report["receiver_backend"]["intent_query"]["available"]==true,"Raw recorded vault files arrived, but GetVaultEntry could not query the intent after the inactive-view pull."); |
| 40 | add( |
| 41 | "vault reconstruction after promotion", |
| 42 | report["receiver_backend_after_insert_sync"]["intent_query"]["available"] == true, |
| 43 | "Later active/root-view ingestion populated queryable vault rows.", |
| 44 | ); |
| 45 | add( |
| 46 | "signed revision cryptographic fidelity", |
| 47 | report["receiver_backend_after_insert_sync"]["signed_intent_query"]["signature_valid"] |
| 48 | == true, |
| 49 | "The exact stored signed document remains verifiable using only its public key.", |
| 50 | ); |
| 51 | add("signed source freshness fidelity",report["receiver_backend_after_insert_sync"]["signed_intent_query"]["source_fresh"]==report["source_backend"]["signed_intent_query"]["source_fresh"],"Source was fresh; reconstructed source metadata/body differed and receiver classified it stale."); |
| 52 | add( |
| 53 | "database-only vault data", |
| 54 | receiver["vault_global"]["scratch/db-only.md"]["available"] == true, |
| 55 | "A durable vault row with no recorded file had no sync artifact.", |
| 56 | ); |
| 57 | add( |
| 58 | "authored database-only KG data", |
| 59 | !receiver["knowledge"]["authored_db_only_node"].is_null(), |
| 60 | "The authored node was not reproduced by received artifacts.", |