Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-mv/blob/main/rust/crates/interplane-conformance/tests/subset_malformed.rs # interplane-mv INTERPLANE: open interoperability protocol between AI models and agent runtimes. Models express intent. Runtimes retain authority. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-mv / rust / crates / interplane-conformance / tests / subset_malformed.rs` 50 lines ยท 1422 bytes Raw Blame History 1 //! The subset rule refuses a malformed table entry by name instead of reading it as empty. 2 use std::path::Path; 3 4 use interplane_conformance::ojson::OJson; 5 use interplane_conformance::subset::Corpus; 6 7 fn corpus() -> Corpus { 8 Corpus::new(&Path::new(env!("CARGO_MANIFEST_DIR")).join("../../..")) 9 } 10 11 /// The shared table with the `aien` entry changed by `edit`. 12 fn table_with(edit: impl Fn(&mut serde_json::Value)) -> OJson { 13 let mut t = corpus().load_table().unwrap().to_value(); 14 edit(&mut t["adapters"]["aien"]); 15 OJson::parse(&t.to_string()).unwrap() 16 } 17 18 fn refused(table: &OJson) -> String { 19 corpus() 20 .plans("aien", table) 21 .expect_err("a malformed entry is refused") 22 } 23 24 #[test] 25 fn the_shared_entry_is_accepted() { 26 let table = corpus().load_table().unwrap(); 27 assert!(!corpus().plans("aien", &table).unwrap().is_empty()); 28 } 29 30 #[test] 31 fn a_non_string_prefix_is_refused() { 32 let t = table_with(|e| e["effects"]["write_file"]["args"]["path"]["prefix"] = 7.into()); 33 assert!( 34 refused(&t).contains("effects.write_file.args.path.prefix must be a string"), 35 "{}", 36 refused(&t) 37 ); 38 } 39 40 #[test] 41 fn a_missing_approval_map_is_refused() { 42 let t = table_with(|e| { 43 e.as_object_mut().unwrap().remove("approval_effects"); 44 }); 45 assert!( 46 refused(&t).contains("table entry has no approval_effects"), 47 "{}", 48 refused(&t) 49 ); 50 }