usesuper::*;/// The Debug group's slow reads: a read at or over `SLOW_READ` is kept with/// its steps and the rows its largest list drew; a faster one is not.#[test]fn a_slow_read_is_kept_with_its_steps_and_rows_and_a_fast_one_is_not() { read_took("read.testSlowOne", SLOW_READ, 41_000, &json!({ "rows": [1, 2, 3], "tags": [1] })); read_took("read.testFastOne", SLOW_READ - Duration::from_millis(1), 9, &json!([]));let kept = slow_reads();let slow = kept.iter().find(|read| read.name == "read.testSlowOne").expect("kept"); assert_eq!((slow.ms, slow.steps, slow.rows), (200, 41_000, Some(3))); assert!(slow.line().contains("read.testSlowOne · 200 ms · 41000 steps · 3 rows"), "{}", slow.line()); assert!(!kept.iter().any(|read| read.name == "read.testFastOne"));}/// RULE: Internal read failures reach the phone Debug group and report with their cause intact; credential-shaped text is redacted before the ring and event retain it, so diagnosing an unpack cannot expose credentials.#[test]fn a_failed_home_read_is_retained_for_debug_without_credentials() {let log = super::super::log_ring::LogRing::default();let events = crate::events::EventBus::new(); method_failed(&log, &events, "read.home", "unreadable: no such table: synthetic_missing; Bearer synthetic-bearer https://example.invalid/path?token=synthetic-query password=synthetic-password");let lines = failure_lines(&log).join("\n"); assert!(lines.contains("read.home failed: unreadable: no such table: synthetic_missing"), "{lines}");for secret in ["synthetic-bearer", "synthetic-query", "synthetic-password"] { assert!(!lines.contains(secret), "{lines}"); } assert!(events.buffered_of(crate::events::EventKind::Log) > 0, "the retained failure also reaches live subscribers");}/// LOOK-ONLY: Albums says its first-look counts, and they stand until said again.#[test]fn the_albums_first_look_counts_are_said_and_kept() { say(&json!({ "albums": { "photos": 5053, "videos": 127, "looked": 1912, "small": 0, "noLocalPicture": 0, "owed": 0, "failed": 0, "seconds": 140, "perMinute": 820, "faces": 400, "vectors": 300, "shownGroups": 9, "warnings": 0 } }));let albums = said().albums.expect("said"); assert_eq!((albums.photos, albums.looked, albums.seconds, albums.per_minute, albums.shown_groups), (5053, 1912, 140, Some(820), 9)); say(&json!({ "build": "synthetic-build" })); assert!(said().albums.is_some(), "a key left out stays");}/// SITES 5: Comms says its live Sites pages' figures, and they stand until said again; a shape that does not parse/// clears them rather than keeping stale ones.#[test]fn the_sites_figures_are_said_and_kept() { say(&json!({ "sites": { "alive": 2, "mostAlive": 3, "limit": 4, "letGo": 1, "warnings": 0, "webEnded": 0, "peakFootprintMb": 380 } }));let sites = said().sites.expect("said"); assert_eq!((sites.alive, sites.most_alive, sites.limit, sites.peak_footprint_mb), (2, 3, 4, Some(380))); say(&json!({ "build": "synthetic-build" })); assert!(said().sites.is_some(), "a key left out stays"); say(&json!({ "sites": "not figures" })); assert!(said().sites.is_none());}