// RULE: every board the dial can name — Home's (the root page), the Tools // card's and the Settings card's — reads only the shell's own tables. The dial // holds those cards in any flavour whatever tools its manifest installs (the // manifest's `fan` key decides which), so a table one of these boards reads // must exist in every database from creation: a shell table. Rigby build 4 // (22 Oct 2026): the Settings card opened the settings board, whose list reads // table `settings`, and 13e1775e7 had deleted that definition, so the card drew // "Its table has no definition here" and This device, Classic lists, Debug and // About were unreachable from the dial. Holding the boards to the shell's // tables covers every shipped flavour at once, and reads no file outside // crates/ (which flavour holds which card is pinned app-side, GenesisTests). use serde_json::Value; /// The boards the dial's own cards open. const DIAL_BOARDS: [&str; 3] = ["home", "tools", "settings"]; fn board(id: &str) -> Value { let (_, json) = cotton_core::definitions::board::BUILTIN_BOARD_FILES .iter() .find(|(board, _)| *board == id) .unwrap_or_else(|| panic!("the kit ships no board {id:?}")); serde_json::from_str(json).expect("a shipped board parses") } #[test] fn every_board_the_dial_can_name_reads_only_the_shells_tables() { let shell = cotton_tools::presentation::SHELL_TABLES; let mut missing = Vec::new(); for id in DIAL_BOARDS { for part in board(id)["parts"].as_array().into_iter().flatten() { if let Some(table) = part["table"].as_str() { if !shell.contains(&table) { missing.push(format!("board {id:?} reads table {table:?}, which is not the shell's")); } } } } assert!(missing.is_empty(), "{}", missing.join("\n")); } /// The shell's tables each ship a definition, so a board reading one draws; /// one this build does not compile as a built-in is a plain table, with no /// engine to bind. #[test] fn every_shell_table_ships_its_definition() { for id in cotton_tools::presentation::SHELL_TABLES { let (definition, builtin) = cotton_tools::presentation::shell_table(id); assert_eq!(definition["id"].as_str(), Some(id)); assert!(builtin || definition["engine"].is_null(), "the shell's plain table {id:?} names an engine"); } } /// The shell's tables are the shell kit's own (kits/shell/kit.json), so a /// database the phone starts holds every table the object serves with the /// shell — the deck's face choices among them. #[test] fn the_shell_tables_are_the_shell_kits_tables() { let mut listed: Vec<&str> = cotton_core::kit::shell::SHELL_KIT_TABLES.iter().map(|(id, _)| *id).collect(); let mut shell = cotton_tools::presentation::SHELL_TABLES.to_vec(); listed.sort_unstable(); shell.sort_unstable(); assert_eq!(shell, listed); }