//! `shell.today` over synthetic phones: Home's page answered whole — the //! deck in the board's order, each record worn in its own face, the bands' //! words, a failed read's line. EVERY ROW IS SYNTHETIC. use super::*; use crate::handle::CottonHandle; use rusqlite::types::Value as SqlValue; const ZONE: &str = "Asia/Kolkata"; /// A fresh Cotton phone, local first, whose Home board names today and /// every band — the board Cotton ships names the device and the tools alone. fn phone() -> (tempfile::TempDir, CottonHandle) { let (dir, handle) = bare_phone(); crate::methods::dispatch(&handle, "definitions.saveBoard", &json!({"definition": { "format_version": 1, "id": "home", "parts": [{"kind": "device"}, {"kind": "today"}, {"kind": "notices"}, {"kind": "asked"}, {"kind": "done"}, {"kind": "tools", "size": "large"}], }})).expect("the board is saved"); (dir, handle) } /// A fresh Cotton phone with no board row of its own: the kit's Home. fn bare_phone() -> (tempfile::TempDir, CottonHandle) { let dir = tempfile::tempdir().expect("a temp container"); let manifest: Value = serde_json::from_str(include_str!("../../../../apps/cotton/App/CottonManifest/flavour.json")).expect("a manifest"); let handle = CottonHandle::open(crate::handle::OpenConfig { mode: crate::handle::OpenMode::Phone { container_path: dir.path().to_string_lossy().to_string(), previous_container_path: None }, app_version: None, time_zone: Some(ZONE.to_string()), device_secret: Some(crate::fixture::paired_secret()), vault_secret: None, flavor: cotton_core::flavor::Flavor::Real, manifest: Some(manifest), }) .expect("an open core"); crate::methods::dispatch(&handle, "workspace.startLocal", &json!({"deviceName": "An invented phone"})).expect("started"); (dir, handle) } fn today(handle: &CottonHandle) -> String { zoned_clock::local_day_key(handle.client().clock().now().timestamp_millis(), ZONE).unwrap() } fn make(handle: &CottonHandle, table: &str, data: Value) -> String { let made = crate::methods::dispatch(handle, "records.create", &json!({"table": table, "data": data, "timezone": ZONE})) .unwrap_or_else(|error| panic!("a {table} is made: {error:?}")); made["id"].as_str().or_else(|| made["record"]["id"].as_str()).unwrap_or_else(|| panic!("a made id: {made}")).to_string() } fn page(handle: &CottonHandle) -> Value { let began = std::time::Instant::now(); let answer = crate::methods::dispatch(handle, "shell.today", &json!({"timezone": ZONE, "today": today(handle)})) .unwrap_or_else(|error| panic!("the page reads: {error:?}")); eprintln!("shell.today answered in {} ms", began.elapsed().as_millis()); answer } fn seed(handle: &CottonHandle, sql: &str, params: &[SqlValue]) { handle.client().with_writer(|file| { file.driver.run(sql, params).map_err(|error| error.to_string())?; crate::fixture::receipted(file.driver, sql); Ok(()) }).unwrap(); } fn kinds(answer: &Value) -> Vec { answer["cards"].as_array().unwrap().iter().map(|card| card["kind"].as_str().unwrap().to_string()).collect() } fn card<'a>(answer: &'a Value, id: &str) -> &'a Value { answer["cards"].as_array().unwrap().iter().find(|card| card["id"] == id).unwrap_or_else(|| panic!("no card {id}: {answer}")) } // RULE (the shell boundary, 7 Nov 2026): Home's page is the core's — the device's card first, today's rows in time order across the day, each record worn in its own tool's face, an occurrence of a repeating event in the today face opening its own day. #[test] fn the_day_is_dealt_in_time_order_each_row_in_its_own_face() { assert!(crate::methods::read_only("shell.today")); let (_dir, handle) = phone(); let day = today(&handle); let todo = make(&handle, "todo", json!({"title": "Water the invented plants", "due_at": format!("{day}T18:00:00+05:30")})); let event = make(&handle, "event", json!({"title": "Invented standup", "starts_at": format!("{day}T09:00:00+05:30"), "ends_at": format!("{day}T09:30:00+05:30")})); let series = make(&handle, "event", json!({"title": "Invented walk", "starts_at": "2026-01-01T07:00:00+05:30", "ends_at": "2026-01-01T07:30:00+05:30", "rrule": "FREQ=DAILY"})); let done = make(&handle, "todo", json!({"title": "Already finished", "due_at": format!("{day}T08:00:00+05:30"), "status": "done"})); let answer = page(&handle); assert!(answer["failed"].is_null(), "{answer}"); let kinds = kinds(&answer); assert_eq!(kinds.first().map(String::as_str), Some("device"), "this device's card leads: {kinds:?}"); let days: Vec<&Value> = answer["cards"].as_array().unwrap().iter().filter(|card| card["kind"] == "day").collect(); let ids: Vec<&str> = days.iter().map(|card| card["opens"]["id"].as_str().unwrap()).collect(); assert_eq!(ids, vec![series.as_str(), event.as_str(), todo.as_str()], "time order, the done todo left out: {answer}"); assert!(!ids.contains(&done.as_str())); let todo_card = days[2]; assert_eq!(todo_card["face"], "todo.card", "{todo_card}"); assert_eq!(todo_card["tap"]["card"], "open.day"); assert_eq!(todo_card["opens"]["page"], json!(todo)); assert_eq!((todo_card["opens"]["path"].clone(), todo_card["opens"]["screen"].clone()), (json!(format!("/todos/todo/{todo}")), json!("outside")), "{todo_card}"); assert_eq!(days[1]["opens"]["path"], json!(format!("/calendar/event/{event}"))); assert_eq!(todo_card["table"], "todo"); assert!(answer["acts"]["open.day"]["label"].is_string()); // The slip's paper is the core's: an event's blue, a todo's cream. assert_eq!(todo_card["dye"], "cream", "{todo_card}"); assert_eq!(days[1]["dye"], "blue", "{}", days[1]); assert_eq!(days[0]["dye"], "blue", "an occurrence is an event's too: {}", days[0]); let walk = days[0]; assert_eq!(walk["face"], "today", "an occurrence wears the today face: {walk}"); assert_eq!(walk["slots"]["title"], "Invented walk"); assert!(walk["slots"]["line"].is_string(), "its time on the day: {walk}"); assert_eq!(walk["slots"]["picture"], "calendar"); let at = walk["opens"]["at"].as_str().expect("an occurrence opens at its own start"); assert!(at.starts_with(&day) || at.contains('T'), "{at}"); assert_eq!(walk["opens"]["page"], json!(format!("{series}@{at}"))); assert_eq!(answer["families"].as_array().unwrap().len(), FAMILIES.len()); assert!(answer["next"].is_null()); } // RULE (package row 8): Home deals the birthdays coming round and the money due after the day, each its kind's card in the core's words, opening its record. #[test] fn a_birthday_and_money_due_are_dealt_in_their_own_faces() { let (_dir, handle) = phone(); let day = today(&handle); let person = make(&handle, "person", json!({"full_name": "Synthetic Asha", "birthday": format!("1990-{}", &day[5..])})); let due = make(&handle, "transaction", json!({"title": "Invented rent", "amount_minor": 120000, "currency": "INR", "status": "expected", "certainty": "fixed", "direction": "out", "occurred_on": day})); let answer = page(&handle); let birthday = card(&answer, &format!("later/person/{person}")); assert_eq!(birthday["face"], "birthday"); assert_eq!(birthday["slots"]["title"], "Synthetic Asha"); assert!(birthday["slots"]["date"].is_string(), "{birthday}"); let money = card(&answer, &format!("later/transaction/{due}")); assert_eq!(money["face"], "transaction.receipt"); assert!(money["slots"]["amount"].as_str().is_some_and(|amount| amount.contains("1,200")), "{money}"); } // RULE (Home's deck, 23 Oct 2026): each unread conversation of the shown database is dealt as its table's own card. #[test] fn an_unread_thread_is_dealt_as_its_own_card() { let (_dir, handle) = phone(); let workspace = handle.client().with_writer(|file| Ok(file.workspace_id.to_string())).unwrap(); let thread = "thread-invented".to_string(); seed(&handle, "INSERT INTO cotton_msg_threads (id, workspace_id, kind, title, unread_marked_at, created_at, updated_at) VALUES (?, ?, 'group', 'Invented group', '2026-11-01T00:00:00.000Z', '2026-11-01T00:00:00.000Z', '2026-11-01T00:00:00.000Z')", &[SqlValue::Text(thread.clone()), SqlValue::Text(workspace)]); let answer = page(&handle); let unread = card(&answer, &format!("thread/{thread}")); assert_eq!(unread["kind"], "thread"); assert_eq!(unread["face"], "thread.slips", "{unread}"); assert_eq!(unread["table"], "thread"); } // RULE (Done for you): a receipt Cotton can take back says so, and `shell.undo` takes it back — the row leaves because the file says so. #[test] fn a_done_receipt_is_undone_and_leaves() { let (_dir, handle) = phone(); let workspace = handle.client().with_writer(|file| Ok(file.workspace_id.to_string())).unwrap(); let now = handle.client().clock().now().to_rfc3339_opts(chrono::SecondsFormat::Millis, true); seed(&handle, "INSERT INTO cotton_memories (id, workspace_id, slug, title, body, status, visibility, origin_kind, origin_label, created_at, updated_at) VALUES ('0b0e2f4e-1111-4222-8333-444455556666', ?, 'an-invented-fact', 'An invented fact', 'Invented.', 'active', 'private', 'agent', 'An invented assistant', ?, ?)", &[SqlValue::Text(workspace), SqlValue::Text(now.clone()), SqlValue::Text(now)]); let answer = page(&handle); let done = answer["parts"]["done"].as_array().unwrap(); let row = done.iter().find(|row| row["id"] == "0b0e2f4e-1111-4222-8333-444455556666").unwrap_or_else(|| panic!("the receipt: {answer}")); assert_eq!(row["kind"], "remembered"); assert_eq!(row["action"], "undo"); assert!(row["label"].as_str().is_some_and(|label| !label.is_empty())); assert!(row["when"].is_string()); assert!(kinds(&answer).contains(&"part".to_string())); card(&answer, "part/done"); let said = crate::methods::dispatch(&handle, "shell.undo", &json!({"kind": "remembered", "id": "0b0e2f4e-1111-4222-8333-444455556666"})).expect("taken back"); assert_eq!(said["said"], "Dropped."); let after = page(&handle); assert!(!after["parts"]["done"].as_array().unwrap().iter().any(|row| row["id"] == "0b0e2f4e-1111-4222-8333-444455556666"), "{after}"); assert_eq!(crate::methods::dispatch(&handle, "shell.undo", &json!({"kind": "couldNotRead", "id": "x"})).unwrap_err().code, "bad_request"); } // RULE (the error rule, 16 Oct 2026, now the core's): a read that fails answers its line — never its own words — the cards it could read, a notice that says it, and the core asks again on a backoff. #[test] fn a_failed_read_answers_its_line_and_asks_again() { let (_dir, handle) = phone(); seed(&handle, "DROP TABLE cotton_memories", &[]); let answer = page(&handle); let failed = &answer["failed"]; assert_eq!(failed["why"], "other", "{answer}"); assert!(failed["line"].as_str().is_some_and(|line| line.contains("could not be read")), "{failed}"); assert_eq!(kinds(&answer).first().map(String::as_str), Some("device"), "what could be read still is: {answer}"); let notice = answer["parts"]["notices"].as_array().unwrap().iter().find(|notice| notice["id"] == "readRefusal").expect("the notice says it"); assert_eq!(notice["words"], failed["line"]); assert!(answer["parts"]["asked"]["unreadable"] == true); assert_eq!(handle.home().today_tries.load(Ordering::SeqCst), 1, "the core asks again after its first wait"); page(&handle); assert_eq!(handle.home().today_tries.load(Ordering::SeqCst), 2); } // RULE (local first, 1 Nov 2026): a fresh copy, never signed in and with no network, answers Home whole. #[test] fn a_fresh_copy_answers_offline() { let (_dir, handle) = phone(); let answer = page(&handle); assert!(answer["failed"].is_null(), "{answer}"); assert_eq!(kinds(&answer), vec!["device".to_string()], "nothing yet but this device: {answer}"); let device = &answer["cards"][0]; assert_eq!(device["tap"]["card"], "open.in_place"); assert_eq!(device["table"], "device"); assert!(answer["parts"]["asked"]["items"].as_array().unwrap().is_empty()); assert!(answer["empty"].as_str().is_some_and(|empty| !empty.is_empty())); assert!(answer["arrangement"].is_object(), "the tools' arrangement rides along: {answer}"); assert!(answer["workspace_id"].is_string(), "{answer}"); } // RULE (the board decides, 2 Nov 2026): a Home naming no today part deals none of the day's cards. #[test] fn a_board_without_today_deals_no_day() { let (_dir, handle) = phone(); crate::methods::dispatch(&handle, "definitions.saveBoard", &json!({"definition": {"format_version": 1, "id": "home", "parts": [{"kind": "device"}, {"kind": "tools", "size": "large"}]}})).unwrap(); let day = today(&handle); make(&handle, "todo", json!({"title": "Unseen", "due_at": format!("{day}T18:00:00+05:30")})); assert_eq!(kinds(&page(&handle)), vec!["device".to_string()]); } // RULE (owner, 27 Oct 2026): this device's card moves with the sync, so it is read alone on its own cadence, never the whole page. #[test] fn this_devices_card_is_read_alone() { let (_dir, handle) = phone(); let answer = crate::methods::dispatch(&handle, "shell.today", &json!({"only": "device"})).unwrap(); let cards = answer["cards"].as_array().unwrap(); assert_eq!(cards.len(), 1, "{answer}"); assert_eq!(cards[0]["kind"], "device"); assert!(answer.get("parts").is_none()); } fn board(answer: &Value) -> Vec { answer["parts"]["board"].as_array().unwrap_or_else(|| panic!("the board's parts: {answer}")).clone() } fn part<'a>(parts: &'a [Value], id: &str) -> &'a Value { parts.iter().find(|part| part["id"] == id).unwrap_or_else(|| panic!("no part {id}: {parts:?}")) } // RULE (the core moves, #294): Home's board is answered whole — every part the definition names, in its order, each with what it draws, so a shell decides nothing. #[test] fn every_part_kind_is_answered_in_the_boards_order() { let (_dir, handle) = phone(); let named = ["head", "search", "notices", "asked", "done", "list", "figure", "facts", "about", "recent", "today", "sync", "device", "tools"]; for kind in cotton_core::definitions::board::BOARD_PART_KINDS { assert!(named.contains(kind), "the test names every kind the crate draws: {kind}"); } crate::methods::dispatch(&handle, "definitions.saveBoard", &json!({"definition": {"format_version": 1, "id": "home", "parts": [ {"kind": "device"}, {"kind": "head", "tags": ["asked"]}, {"kind": "search", "face": "field"}, {"kind": "today"}, {"kind": "list", "table": "todo", "heading": "Invented list"}, {"kind": "figure", "heading": "Invented figure", "table": "todo", "op": "count", "many": "{n} invented todos", "one": "1 invented todo"}, {"kind": "facts", "source": "todo"}, {"kind": "recent"}, {"kind": "sync"}, {"kind": "notices"}, {"kind": "asked"}, {"kind": "done"}, {"kind": "about"}, {"kind": "tools", "size": "large"}, {"kind": "list", "table": "event"}, ]}})).expect("the board is saved"); let day = today(&handle); let todo = make(&handle, "todo", json!({"title": "An invented errand", "due_at": format!("{day}T18:00:00+05:30")})); let answer = page(&handle); let parts = board(&answer); let kinds: Vec<&str> = parts.iter().map(|part| part["kind"].as_str().unwrap()).collect(); assert_eq!(kinds, vec!["device", "head", "search", "today", "list", "figure", "facts", "recent", "sync", "notices", "asked", "done", "about", "tools", "list"], "the definition's order"); let ids: Vec<&str> = parts.iter().map(|part| part["id"].as_str().unwrap()).collect(); assert_eq!(ids.last(), Some(&"list#2"), "a second part of a kind is named by its place: {ids:?}"); for entry in &parts { assert!(entry["shown"].is_boolean(), "{entry}"); assert_eq!(entry["shown"] == false, entry["why"].is_object(), "a hidden part says why, a shown one nothing: {entry}"); assert!(entry["settings"].is_object(), "{entry}"); } assert_eq!(part(&parts, "device")["card"], answer["cards"][0]["id"]); assert_eq!(part(&parts, "head")["tags"], json!(["asked"])); assert_eq!(part(&parts, "search")["shown"], true); let today_cards = part(&parts, "today")["cards"].as_array().unwrap().clone(); assert!(today_cards.iter().any(|id| id.as_str().is_some_and(|id| id.ends_with(&todo))), "today names its cards: {today_cards:?}"); let list = part(&parts, "list"); assert_eq!(list["heading"], "Invented list"); assert_eq!(list["ask"]["table"], "todo"); let rows = list["rows"].as_array().unwrap(); assert!(rows.iter().any(|row| row["id"] == todo.as_str() && row["slip"].is_object()), "shell.list's rows: {list}"); assert_eq!(list["count"], 1); assert!(part(&parts, "list#2")["heading"].as_str().is_some_and(|heading| !heading.is_empty()), "an unheaded list says its table's name"); let figure = part(&parts, "figure"); assert_eq!(figure["heading"], "Invented figure"); assert_eq!(figure["line"], "1 invented todo", "the crate's worked line: {figure}"); let facts = part(&parts, "facts"); if facts["shown"] == true { assert!(facts["facts"].as_array().is_some_and(|facts| facts.iter().all(|fact| fact["label"].is_string() && fact["value"].is_string())), "{facts}"); } else { assert!(facts["why"]["words"].as_str().is_some_and(|words| !words.is_empty()), "{facts}"); } let recent = part(&parts, "recent"); assert_eq!(recent["shown"], true, "the personal database shows its visits: {recent}"); assert!(recent["items"].is_array()); assert_eq!(part(&parts, "sync")["shown"], true); assert_eq!(part(&parts, "about")["source"], "build"); let tools = part(&parts, "tools"); assert!(tools["tiles"].as_array().is_some_and(|tiles| !tiles.is_empty() && tiles.iter().all(Value::is_string)), "{tools}"); assert_eq!(tools["shown"], true, "the arrangement is read: {tools}"); // The bands keep their shape beside the list. assert!(answer["parts"]["asked"]["items"].is_array()); assert!(answer["parts"]["done"].is_array()); assert!(answer["parts"]["notices"].is_array()); } // RULE (the core moves, #294): a part that draws nothing says why, in the kit's words. #[test] fn a_hidden_part_says_why() { let (_dir, handle) = phone(); crate::methods::dispatch(&handle, "definitions.saveBoard", &json!({"definition": {"format_version": 1, "id": "home", "parts": [ {"kind": "search", "face": "icon"}, {"kind": "notices", "shows": ["update"]}, {"kind": "asked", "place": "head"}, {"kind": "done"}, {"kind": "facts", "source": "todo"}, ]}})).expect("the board is saved"); let parts = board(&page(&handle)); let why = |id: &str| part(&parts, id)["why"]["key"].as_str().map(str::to_string); assert_eq!(why("search").as_deref(), Some("magnifier")); assert_eq!(why("notices").as_deref(), Some("quiet")); assert_eq!(why("asked").as_deref(), Some("head")); assert_eq!(why("done").as_deref(), Some("quiet")); assert_eq!(why("facts").as_deref(), Some("no_record"), "no todo is this database's own record"); for entry in &parts { assert_eq!(entry["shown"], false, "{entry}"); assert!(entry["why"]["words"].as_str().is_some_and(|words| !words.is_empty() && !words.contains("part.hidden")), "kit words: {entry}"); } } // RULE (the core moves, #294): a part's own static rows are kept by what each needs of the app, in the core, so no shell filters them. #[test] fn a_static_row_is_kept_by_what_it_needs() { use cotton_tools::presentation::SettingsReach; let rows = [ json!({"id": "plain", "data": {}}), json!({"id": "object", "needs": "personal_object", "data": {}}), json!({"id": "several", "needs": "several_databases", "data": {}}), json!({"id": "serving", "needs": "serving", "data": {}}), json!({"id": "newer", "needs": "a_newer_builds_need", "data": {}}), ]; let ids = |reach| rows_reached(&rows, reach).iter().map(|row| row["id"].as_str().unwrap().to_string()).collect::>(); assert_eq!(ids(SettingsReach::EVERY), ["plain", "object", "several", "serving", "newer"]); assert_eq!(ids(SettingsReach { several_databases: false, serving: false, personal_object: false }), ["plain", "newer"], "a need not met leaves; one this build does not know stands"); } // RULE (the core moves, #294): the head's tags count the rows the board's asked and done parts show, and every part keeps its `shows` order, so no shell reads `shows`. #[test] fn the_head_counts_what_the_boards_bands_show_in_their_order() { let items = [json!({"key": "invites", "count": 1}), json!({"key": "assistantsAsked", "count": 2})]; let band = |shows: Value| cotton_core::definitions::board::BoardPart { kind: "asked".into(), settings: json!({"shows": shows}).as_object().unwrap().clone() }; let keys = |kept: Vec| kept.iter().map(|item| item["key"].as_str().unwrap().to_string()).collect::>(); assert_eq!(keys(kept_by_shows(&band(json!(["assistantsAsked", "invites"])), &items, "key", true)), ["assistantsAsked", "invites"], "the part's order, not the read's"); assert_eq!(keys(kept_by_shows(&band(json!(["assistantsAsked", "invites"])), &items, "key", false)), ["invites", "assistantsAsked"], "Done keeps the read's newest first"); assert_eq!(keys(kept_by_shows(&band(json!(["invites"])), &items, "key", true)), ["invites"]); let (_dir, handle) = phone(); crate::methods::dispatch(&handle, "definitions.saveBoard", &json!({"definition": {"format_version": 1, "id": "home", "parts": [{"kind": "head", "tags": ["asked"]}, {"kind": "asked", "shows": ["invites"]}]}})).expect("the board is saved"); let parts = board(&page(&handle)); let head = part(&parts, "head"); assert_eq!(head["asked"], json!({"total": 0, "items": []})); assert_eq!(head["done"], json!({"items": []})); } // RULE (the core moves, #294): the Tools board's tools part is every tool of the database, whole, so no shell lays out a tile. #[test] fn the_tools_board_answers_every_tool_whole() { let (_dir, handle) = phone(); let asked = |board: &str| crate::methods::dispatch(&handle, "shell.today", &json!({"timezone": "Asia/Kolkata", "today": today(&handle), "board": board})).expect("the page"); let tools = asked("tools"); let tools = board(&tools); let tiles = part(&tools, "tools"); let cards = tiles["cards"].as_array().unwrap_or_else(|| panic!("the cards: {tiles}")); assert!(!cards.is_empty(), "{tiles}"); assert_eq!(tiles["tiles"], json!(cards.iter().map(|card| card["key"].clone()).collect::>())); assert!(cards.iter().all(|card| card["kind"] == "tool"), "every tool and none of the app's own cards: {tiles}"); assert!(cards.iter().all(|card| card["name"].is_string()), "each whole, as the fan answers it: {tiles}"); } // RULE (the core moves, #294): a database with no board row of its own answers the kit's Home, in the kit's order. #[test] fn no_board_row_answers_the_kits_order() { let (_dir, handle) = bare_phone(); let parts = board(&page(&handle)); let kit = cotton_core::definitions::board::BoardDefinition::builtin("home").expect("the kit ships Home"); let kinds: Vec<&str> = parts.iter().map(|part| part["kind"].as_str().unwrap()).collect(); let shipped: Vec<&str> = kit.parts.iter().map(|part| part.kind.as_str()).collect(); assert_eq!(kinds, shipped, "{parts:?}"); } #[test] fn the_page_names_its_day_and_the_today_part_its_heading() { let (_dir, handle) = phone(); let answer = crate::methods::dispatch(&handle, "shell.today", &json!({"timezone": ZONE})).expect("the page reads"); assert_eq!(answer["today"], json!(today(&handle)), "the day key on the ask's zone"); let parts = board(&answer); let today_part = parts.iter().find(|part| part["kind"] == "today").expect("the kit's Home names a today part"); let heading = today_part["heading"].as_str().expect("a heading"); assert!(!heading.is_empty(), "the kit's day words"); assert_eq!(heading, cotton_core::rules::shell_lines::resolve("dates", "heading.today", &[], &[]).unwrap()); } #[test] fn a_figure_answers_the_day_it_was_worked_for_on_the_asks_zone() { let (_dir, handle) = phone(); let part = json!({"kind": "figure", "heading": "Invented figure", "table": "todo", "op": "count", "many": "{n} invented todos", "one": "1 invented todo"}); let said = crate::methods::dispatch(&handle, "read.homeFigure", &json!({"part": part, "timezone": ZONE})).expect("the figure reads"); assert_eq!(said["today"], json!(today(&handle)), "the day key on the ask's zone"); let named = crate::methods::dispatch(&handle, "read.homeFigure", &json!({"part": part, "today": "2026-01-02"})).expect("the figure reads"); assert_eq!(named["today"], "2026-01-02", "the ask's own day wins"); }