//! The ink's knobs are the shipped data's, and what a reading is.usesuper::*;/// RULE: the knobs are the shipped data's: the model's doubt is 0.35 (the held-out writers' curve, 3 Nov 2026) and its floor 0.20, a doubtful run gives way to a cut of it read 0.7 surely and a letter read under 0.8 is read turned 15° either way too, a flat zigzag turning back twice is nothing, the ink is 3 pt and fades in 0.6 s, a scratch-out turns back three times.#[test]fn the_knobs_are_the_data() {let knobs = &shipped().knobs; assert_eq!(knobs.letter_confidence, 0.35); assert_eq!(knobs.letter_floor, 0.20); assert_eq!(knobs.doubt_cut, 0.7); assert_eq!(knobs.read_turns, vec![-15.0, 0.0, 15.0]); assert_eq!(knobs.turn_under, 0.8); assert_eq!(knobs.scratch_flat, 0.5); assert_eq!(knobs.ink_width, 3.0); assert_eq!(knobs.ink_fade_seconds, 0.6); assert_eq!(knobs.scratch_reversals, 3); assert_eq!(knobs.scratch_travel, 3.2); assert_eq!(knobs.scratch_tilt, 55.0); assert_eq!(knobs.scratch_never, 6);}/// RULE: the grouping's knobs are the shipped data's: strokes join within 0.4 s anywhere, or within 1.0 s near the letter (a box's longer side away), at most four to a letter, its strokes overlapping across by 0.2 of the narrower or stopping short by 0.1 of the taller; a lone upright line under 0.6 of the page is a letter's stroke; a lone level line of 160 pt swipes at once.#[test]fn the_grouping_knobs_are_the_data() {let knobs = &shipped().knobs; assert_eq!(knobs.group_seconds, 0.4); assert_eq!(knobs.group_near_seconds, 1.0); assert_eq!(knobs.group_near, 1.0); assert_eq!(knobs.group_overlap, 0.2); assert_eq!(knobs.group_touch, 0.1); assert_eq!(knobs.vertical_short, 0.6); assert_eq!(knobs.dot, 16.0); assert_eq!(knobs.most_strokes, 4); assert_eq!(knobs.swipe_at_once, 160.0); assert_eq!(knobs.page_swipe, 70.0, "the deck's page swipe, as Swift's DeckKnobs.swipe");}/// RULE: the check's knobs are the shipped data's — `check_ratio` 2.5 and `check_angle` 40–110°, raised from 2.0 and 120° until no letter of the public corpus reads as a check, each leg 0.85 straight, opening up within 35°; the phone keeps the last 5,000 groups.#[test]fn the_check_and_capture_knobs_are_the_data() {let knobs = &shipped().knobs; assert_eq!(knobs.check_ratio, 2.5); assert_eq!(knobs.check_angle, vec![40.0, 110.0]); assert_eq!(knobs.check_straight, 0.85); assert_eq!(knobs.angle_range, 35.0); assert_eq!(knobs.keep_groups, 5000);}/// RULE (owner, 3 Nov 2026: "Every time there's some time gap … it starts from the beginning. We don't need that"): the alphabet has no knob for a pause that starts the letters again; removed means removed.#[test]fn no_pause_starts_the_letters_again() {let raw: serde_json::Value = serde_json::from_str(ALPHABET).unwrap(); assert!(raw["knobs"].get("prefix_seconds").is_none()); assert!(shipped().with(&serde_json::json!({"prefix_seconds": 5})).is_err(), "a knob the alphabet lacks is refused, never added");}/// RULE: every Cotton app reads ink (owner, Nov 2026: letters written above the arc search the app's whole database, in every Cotton app); Rigby, Cotton Project and the business apps never do.#[test]fn only_the_cotton_apps_read_ink() {// A Cotton app, read from the registry: Cotton itself, or an app whose kit names only personal tables (an app// over the one object; Developer's `app_report` lives in Cotton's own product object and does not count against it). Rigby and Cotton Project wear the personal kit under another name; a business has its own.let registry: serde_json::Value = serde_json::from_slice(&std::fs::read(cotton_store::manifest_dir().join("../../apps/registry.json")).unwrap()).unwrap();let cotton_apps: Vec<&str> = registry["apps"] .as_array() .unwrap() .iter() .filter(|app| { app["slug"] == "cotton" || app["kit"].as_str().is_some_and(|kit| {crate::kit::APP_KITS.iter().any(|(id, json)| { *id == kit && serde_json::from_str::<serde_json::Value>(json).expect("a kit.json")["tables"].as_array().is_some_and(|tables| tables.iter().all(|table| table.as_str().is_some_and(|table| table.starts_with("personal/") || table == "app_report"))) }) }) }) .map(|app| app["slug"].as_str().unwrap()) .collect(); assert!(shipped().flavours.iter().any(|flavour| flavour == "cotton"), "Cotton reads ink");for flavour in &shipped().flavours { assert!(cotton_apps.contains(&flavour.as_str()), "{flavour} reads ink but is no Cotton app in apps/registry.json"); }}/// RULE: a reading is a letter or a digit by the model's class: a digit 0–9, else a letter; a mark is neither.#[test]fn a_reading_is_a_letter_or_a_digit() { assert_eq!(Symbol::of("7"), Symbol::Digit); assert_eq!(Symbol::of("o"), Symbol::Letter); assert_eq!(Reading::Letter { letter: "0".into(), score: 1.0 }.letter(), Some("0")); assert_eq!(Reading::Mark(CHECK.into()).letter(), None, "a check is no letter"); assert_eq!(shipped().admits("text"), Admits::LETTERS); assert_eq!(shipped().admits("amount"), Admits::DIGITS); assert_eq!(shipped().admits("photo"), Admits::default(), "a type the alphabet does not name holds neither"); assert_eq!(Admits::EVERY.symbols(), vec![Symbol::Letter, Symbol::Digit]);}