usesuper::*;use serde_json::json;fn args(value: Value) -> Map<String, Value> { value.as_object().cloned().expect("object")}// RULE: a call reads chat by its tool, by the chat table it names, or by a hit of a chat kind anywhere in its answer; nothing else counts.#[test]fn a_chat_read_is_known_by_tool_table_or_hit() { assert!(reads_chat("read_message_thread", &Map::new(), &Value::Null)); assert!(reads_chat("list_records", &args(json!({ "table": "story" })), &json!([]))); assert!(reads_chat("search_records", &Map::new(), &json!({ "records": { "message": [{ "kind": "message" }] } }))); assert!(!reads_chat("list_todos", &Map::new(), &json!({ "todos": [{ "kind": "todo" }] }))); assert!(!reads_chat("list_records", &args(json!({ "table": "note" })), &json!([])));}// RULE: the hold lasts QUIET_FOR from the last chat read, per workspace and connection, and then lifts.#[test]fn the_hold_is_per_connection_and_lifts_after_the_window() {let at = Utc::now(); note_read("ws-1", "token-a", at); assert!(read_chat_lately("ws-1", "token-a", at + Duration::hours(23))); assert!(!read_chat_lately("ws-1", "token-b", at)); assert!(!read_chat_lately("ws-2", "token-a", at)); assert!(!read_chat_lately("ws-1", "token-a", at + QUIET_FOR));}