//! Settings presentation is authored through the same MCP writer as any tool. mod support; use serde_json::json; use support::harness::Harness; use support::mcp::{call_tool_raw, mint_token}; /// RULE: Whose database a table is read from, whether words are filed into it and the screen its list is are what the table is, never the owner's look: update_definition refuses scope, setup and list_route. #[test] fn a_tables_scope_setup_and_list_route_are_not_look() { let mut h = Harness::new(); let token = mint_token(&mut h, &["read", "write"], "Synthetic settings arranger"); for (key, value) in [("scope", json!("database")), ("setup", json!(false)), ("list_route", json!("/today"))] { let refused = call_tool_raw(&h, &token, "update_definition", json!({"table":"assistant", key: value})); assert!(refused.is_error, "{key} is changed by a look edit"); } } /// RULE (owner, 3 Nov 2026: "marking a todo as done is just having a check mark"): which act a mark drawn on a card runs is the table's look, edited by update_definition like any — the todo's check bound to Drop reads back so — and held to the table's commands: a command it does not declare, or one that deletes, is refused. #[test] fn a_tables_marks_are_look_held_to_its_commands() { let mut h = Harness::new(); let token = mint_token(&mut h, &["read", "write"], "Synthetic mark binder"); let read = call_tool_raw(&h, &token, "update_definition", json!({"table":"todo"})); assert!(!read.is_error, "{}", read.text); assert_eq!(read.json()["definition"]["marks"], json!({"check":"done"}), "the kit binds the check to done"); let bound = call_tool_raw(&h, &token, "update_definition", json!({"table":"todo","marks":{"check":"drop"}})); assert!(!bound.is_error, "{}", bound.text); let read = call_tool_raw(&h, &token, "update_definition", json!({"table":"todo"})); assert_eq!(read.json()["definition"]["marks"], json!({"check":"drop"})); for id in ["nowhere", "delete"] { let refused = call_tool_raw(&h, &token, "update_definition", json!({"table":"todo","marks":{"check":id}})); assert!(refused.is_error, "the check bound to {id} was taken"); assert!(refused.text.contains("marks.check"), "{}", refused.text); } }