Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\adapters\mock\src\console_mode_probe.rs:124: use windows_sys::Win32::System::Console::{ ENABLE_ECHO_INPUT, ENABLE_LINE_INPUT, ENABLE_PROCESSED_INPUT, }; - set_input_bits(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT, false); + set_input_bits( + ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT, + false, + ); } /// SEED the defect: turn cooked input back on, so a rig asserting it stays off Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\auth.rs:379: let token = establish_with_pid("alice", "old-dead-sid", DEAD_PID); // Correct token PLUS a mismatched sid: the token path wins first. let proof = Proof::resolve(Some(token), Some("new-live-sid".into())); - assert_eq!(authenticate("alice", &proof), AuthResult::Ok, "token authenticates"); assert_eq!( + authenticate("alice", &proof), + AuthResult::Ok, + "token authenticates" + ); + assert_eq!( recorded_sid("alice"), "old-dead-sid", "the token path must NOT rotate the pin (re-pin is the sid-only dead-owner branch)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\auth.rs:396: std::fs::create_dir_all(&path).unwrap(); info::write_info( &path, - &InfoJson::new(&psyche_id, "2026-06-01T00:00:00Z", std::process::id(), session, "psyche"), + &InfoJson::new( + &psyche_id, + "2026-06-01T00:00:00Z", + std::process::id(), + session, + "psyche", + ), ) .unwrap(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\auth.rs:404: /// Establish a top-level parent perch pinned to `sid`, plus a nested worker /// `owlery//nested/` whose STORED registration sid is /// `stored_sid` — the WORKER-TRUTH W-2 layout the sid-symmetric auth reads. - fn establish_parent_with_worker(parent: &str, parent_sid: &str, worker: &str, stored_sid: &str) { + fn establish_parent_with_worker( + parent: &str, + parent_sid: &str, + worker: &str, + stored_sid: &str, + ) { let ppath = perch::resolve_perch_path(parent, ParentHint::Infer); std::fs::create_dir_all(&ppath).unwrap(); info::write_info( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\auth.rs:478: fn worker_missing_is_no_endpoint() { let _h = isolated_home(); let proof = Proof::resolve(None, Some("sid-1".into())); - assert_eq!(worker_authenticate("ghost-w1", &proof), AuthResult::NoEndpoint); + assert_eq!( + worker_authenticate("ghost-w1", &proof), + AuthResult::NoEndpoint + ); } // [unit->REQ-BIND-HONEST-SELF-STAMP] CROSS-PERCH BIND HONESTY: the dead-owner Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:278: // [impl->REQ-MSG-DELIVERY-AXES] // [impl->REQ-SPOOL-TAKE-AUDIT] hook-poll leg — record who drained the row. let audit = spool::TakerAudit::new(spool::TakerLeg::HookPoll, None, Some(std::process::id())); - let drained = - spool::drain_active_window_audited_at(&perch_path, include_deferred, &audit).unwrap_or_default(); + let drained = spool::drain_active_window_audited_at(&perch_path, include_deferred, &audit) + .unwrap_or_default(); // DRAIN-TIME NOTIF VALIDITY (ADR-0046 Amendment 1, KNOWN-HAZARDS 7.53): a // notify copy spooled while the endpoint was busy is a detached snapshot no // dismissal can recall — it delivers "update available" on a node that has Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:368: let store = NotifStore::open().expect("notif store"); let mut epochs = spt_store::epoch::EpochSource::load(); let stale = store - .produce("beef", &mut epochs, "home", "update", "doyle", "update available") + .produce( + "beef", + &mut epochs, + "home", + "update", + "doyle", + "update available", + ) .expect("stale row"); let live = store - .produce("beef", &mut epochs, "home", "consent", "doyle", "consent needed") + .produce( + "beef", + &mut epochs, + "home", + "consent", + "doyle", + "consent needed", + ) .expect("live row"); let envelope = |row: &spt_store::notif::NotifRow| { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:610: spool::spool_message_deferred_at(&perch_path, "alice", "deferred one").unwrap(); let rows = spool::peek_non_deferred_at(&perch_path).unwrap(); - assert_eq!(rows.len(), 1, "peek_non_deferred_at must exclude deferred rows"); + assert_eq!( + rows.len(), + 1, + "peek_non_deferred_at must exclude deferred rows" + ); assert!(rows[0].2.contains("live one")); // Marking delivered does not touch the deferred row. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:638: establish("dave"); let perch_path = perch::resolve_perch_path("dave", ParentHint::Infer); spool::spool_message_windowed_at( - &perch_path, "x", "D", spool::WINDOW_DEFAULT, spool::CHANNEL_ANY, false, + &perch_path, + "x", + "D", + spool::WINDOW_DEFAULT, + spool::CHANNEL_ANY, + false, ) .unwrap(); spool::spool_message_windowed_at( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:645: - &perch_path, "x", "I", spool::WINDOW_IDLE_ONLY, spool::CHANNEL_ANY, false, + &perch_path, + "x", + "I", + spool::WINDOW_IDLE_ONLY, + spool::CHANNEL_ANY, + false, ) .unwrap(); spool::spool_message_windowed_at( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:649: - &perch_path, "x", "A", spool::WINDOW_ACTIVE_ONLY, spool::CHANNEL_ANY, false, + &perch_path, + "x", + "A", + spool::WINDOW_ACTIVE_ONLY, + spool::CHANNEL_ANY, + false, ) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:669: // active_only survived the active-no-include drain; the hook with // include_deferred takes it (resting gate aside). spool::spool_message_windowed_at( - &perch_path, "x", "A2", spool::WINDOW_ACTIVE_ONLY, spool::CHANNEL_ANY, false, + &perch_path, + "x", + "A2", + spool::WINDOW_ACTIVE_ONLY, + spool::CHANNEL_ANY, + false, ) .unwrap(); let with_def = poll_drain("dave", true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\delivery.rs:802: assert_eq!(perch::read_activity_at(&perch_path), (true, None)); assert_eq!(cmd_state("legacy", "idle", true), 0); let (is_idle, since) = perch::read_activity_at(&perch_path); - assert!(is_idle && since.is_some(), "the idle direction is dated too"); + assert!( + is_idle && since.is_some(), + "the idle direction is dated too" + ); // ── A DISAGREEING stamp reads as undated (it describes the state we // left), so the same exception rewrites it in agreement — the endpoint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:546: // Resume-context pull (REQ-RESUME-CONTEXT-PULL): auth-gated like the sibling // id-scoped verbs; session_id is accepted for the adapter contract but the // Tier-1 handler resolves project context from the perch's bound cwd. - ApiCmd::PsycheDownload { id, auth } => { - gated(&id, &auth, |id| { - reporting::cmd_psyche_download(id, ctx.manifest.as_ref()) - }) - } + ApiCmd::PsycheDownload { id, auth } => gated(&id, &auth, |id| { + reporting::cmd_psyche_download(id, ctx.manifest.as_ref()) + }), ApiCmd::DrivenBy { id, auth } => gated(&id, &auth, reporting::cmd_driven_by), // Read-only JSON report; the bare form self-resolves like whoami, so it takes // no auth (no mutation, exposes only what `endpoint list` already shows). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:627: // adapter (no record) degrades to `(None, None)`, unchanged. let adapters_dir = spt_store::perch::adapters_dir(); match spt_runtime::registry::resolve_option(&adapters_dir, adapter) { - Ok((record, manifest)) => Ok(( - Some(manifest), - Some(PathBuf::from(&record.source_dir)), - )), + Ok((record, manifest)) => { + Ok((Some(manifest), Some(PathBuf::from(&record.source_dir)))) + } Err(_) => Ok((None, None)), } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:826: .unwrap(); let (manifest, install_dir) = - resolve_ctx_manifest(Some(path.as_path()), Some("mock-h:full")).expect("override resolves"); + resolve_ctx_manifest(Some(path.as_path()), Some("mock-h:full")) + .expect("override resolves"); let m = manifest.expect("override yields a manifest"); assert_eq!(m.adapter.hostable_types, vec!["LiveAgent", "Shell"]); assert_eq!(install_dir.as_deref(), Some(dir.as_path())); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:838: #[test] fn ctx_manifest_unregistered_no_manifest_is_none_not_fatal() { let _h = crate::testutil::isolated_home(); - let (manifest, install_dir) = - resolve_ctx_manifest(None, Some("ghost:full")).expect("unregistered does not hard-fail"); - assert!(manifest.is_none(), "no manifest for an unregistered adapter"); + let (manifest, install_dir) = resolve_ctx_manifest(None, Some("ghost:full")) + .expect("unregistered does not hard-fail"); + assert!( + manifest.is_none(), + "no manifest for an unregistered adapter" + ); assert!(install_dir.is_none(), "no install_dir either"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:905: ); // [unit->REQ-SHELL-3] drive-poll is the shell-side drain; the link is the // auth (mirrors emit), and it is mandatory. - assert!(parse(&["spt", "--adapter", "m", "drive-poll", "shell-0", "--link", "cafe"]).is_ok()); + assert!(parse(&[ + "spt", + "--adapter", + "m", + "drive-poll", + "shell-0", + "--link", + "cafe" + ]) + .is_ok()); assert!( parse(&["spt", "--adapter", "m", "drive-poll", "shell-0"]).is_err(), "drive-poll requires the link credential" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:912: ); // [unit->REQ-SHELL-4] the shell-side tunnel verb: id + direction + the link // token (the auth, mirrors drive-poll); the link is mandatory. + assert!(parse(&[ + "spt", + "--adapter", + "m", + "tunnel", + "shell-0", + "recv", + "--link", + "cafe" + ]) + .is_ok()); + assert!(parse(&[ + "spt", + "--adapter", + "m", + "tunnel", + "shell-0", + "send", + "--link", + "cafe" + ]) + .is_ok()); assert!( - parse(&["spt", "--adapter", "m", "tunnel", "shell-0", "recv", "--link", "cafe"]).is_ok() - ); - assert!( - parse(&["spt", "--adapter", "m", "tunnel", "shell-0", "send", "--link", "cafe"]).is_ok() - ); - assert!( parse(&["spt", "--adapter", "m", "tunnel", "shell-0", "recv"]).is_err(), "the shell tunnel verb requires the link credential" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\mod.rs:932: ); // Optional adapter correlation metadata is accepted. assert!(parse(&[ - "spt", "--adapter", "m", "worker-start", "alice", "--agent-id", "cc-3f2a", - "--agent-type", "code-reviewer" + "spt", + "--adapter", + "m", + "worker-start", + "alice", + "--agent-id", + "cc-3f2a", + "--agent-type", + "code-reviewer" ]) .is_ok()); assert!(parse(&[ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:805: /// line. Already-seen hits are skipped so a repeated keyword never permanently /// blocks a later, distinct hint. // [impl->REQ-MANIFEST-4] -fn select_and_mark_hint( - manifest: &Manifest, - session: &str, - message: &str, -) -> Option { +fn select_and_mark_hint(manifest: &Manifest, session: &str, message: &str) -> Option { let dir = perch::session_dir(session); let seen_file = dir.join("hints-seen"); let mut seen: std::collections::HashSet = std::fs::read_to_string(&seen_file) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:925: // Own-node driver (a same-node rc through the net path) self-attributes to THIS // node, exactly like the local-controller arm — never a foreign null-label hex. Some(driver) if crate::roster::is_own_node_hex(driver, Some(self_key)) => { - Some(NodeRefJson { label: self_label, key: self_key.to_string() }) + Some(NodeRefJson { + label: self_label, + key: self_key.to_string(), + }) } Some(remote) => Some(NodeRefJson { label: resolve_label(remote), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:998: // precisely because this used to run the git derivation; now it never // spawns git). Absent/stale → None, same '-' semantics. // [impl->REQ-PROJECT-INDEX-READER-CUTOVER] - let project = crate::picker::data::indexed_latest_project_ref( - &spt_store::projindex::read_index(), - &id, - ) - .map(|r| r.id); + let project = + crate::picker::data::indexed_latest_project_ref(&spt_store::projindex::read_index(), &id) + .map(|r| r.id); let subnets = spt_store::subnet::SubnetStore::load() .subnets .iter() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1034: 0 } Err(e) => { - eprintln!("ENDPOINT_INFO_ENCODE_FAIL:{id_err}: {e}", id_err = payload.id); + eprintln!( + "ENDPOINT_INFO_ENCODE_FAIL:{id_err}: {e}", + id_err = payload.id + ); EXIT_REFUSED } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1071: ); assert_eq!( remote, - Some(NodeRefJson { label: Some("PEER".into()), key: "cafe1234".into() }), + Some(NodeRefJson { + label: Some("PEER".into()), + key: "cafe1234".into() + }), ); // Local controller (controlled, no remote driver): names THIS node. let local = derive_attached_node(None, true, "selfhex", Some("SELF".into()), |_| None); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1078: assert_eq!( local, - Some(NodeRefJson { label: Some("SELF".into()), key: "selfhex".into() }), + Some(NodeRefJson { + label: Some("SELF".into()), + key: "selfhex".into() + }), "a local controller surfaces via `controlled`, not driven_by", ); // Uncontrolled: null. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1104: ); assert_eq!( own, - Some(NodeRefJson { label: Some("SELF".into()), key: "selfhex".into() }), + Some(NodeRefJson { + label: Some("SELF".into()), + key: "selfhex".into() + }), "an own-node driver self-attributes to THIS node, not a foreign hex", ); // A genuinely remote driver is unaffected — verbatim key + resolved label. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1117: ); assert_eq!( remote, - Some(NodeRefJson { label: Some("PEER".into()), key: "cafe1234".into() }), + Some(NodeRefJson { + label: Some("PEER".into()), + key: "cafe1234".into() + }), ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1138: info::write_info(&path, &rec).unwrap(); assert_eq!(cmd_endpoint_info(Some("alice")), 0, "seeded perch reports"); - assert_eq!(cmd_endpoint_info(Some("ghost")), EXIT_REFUSED, "unknown id refused"); + assert_eq!( + cmd_endpoint_info(Some("ghost")), + EXIT_REFUSED, + "unknown id refused" + ); } // [unit->REQ-ACTIVITY-INFO-PULL] ADR-0048 decision 1, pull avenue: `activity` is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1155: adapter: None, controlled: false, attached_node: None, - local_node: NodeRefJson { label: None, key: "selfhex".into() }, + local_node: NodeRefJson { + label: None, + key: "selfhex".into(), + }, project: None, cwd: None, subnets: Vec::new(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1188: // Fresh perch: nothing has reported idle → busy (the working state). let idle_file = perch::resolve_idle_file("alice", ParentHint::Infer); - assert!(!idle_file.exists(), "PRECONDITION: no sentinel on a fresh perch"); + assert!( + !idle_file.exists(), + "PRECONDITION: no sentinel on a fresh perch" + ); assert_eq!(perch::activity_label_at(&path), "busy"); - assert_eq!(cmd_endpoint_info(Some("alice")), 0, "a busy endpoint reports"); + assert_eq!( + cmd_endpoint_info(Some("alice")), + 0, + "a busy endpoint reports" + ); // The adapter reports idle → the sentinel appears → the pull says idle. std::fs::write(&idle_file, "").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1199: "idle", "REQ-ACTIVITY-INFO-PULL: the sentinel is the only input to the word" ); - assert_eq!(cmd_endpoint_info(Some("alice")), 0, "an idle endpoint reports too"); + assert_eq!( + cmd_endpoint_info(Some("alice")), + 0, + "an idle endpoint reports too" + ); // Back to work → the sentinel clears → the word flips back. No latch. std::fs::remove_file(&idle_file).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1274: "an ordinary boundary rotates normally despite a custody record on the node" ); let rec = info::read_info(&perch::resolve_perch_path("victim", ParentHint::Infer)).unwrap(); - assert_eq!(rec.session_id, "fresh-sid", "the fresh sid rotates the perch pin"); + assert_eq!( + rec.session_id, "fresh-sid", + "the fresh sid rotates the perch pin" + ); } // [unit->REQ-TERM-6] a boundary appends the rotated session to the perch's Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1293: assert_eq!(rows[0].session_id, "sid-1"); assert_eq!(rows[0].trigger, spt_store::sessions::SessionTrigger::Clear); assert_eq!(rows[1].session_id, "sid-2"); - assert_eq!(rows[1].trigger, spt_store::sessions::SessionTrigger::Compact); + assert_eq!( + rows[1].trigger, + spt_store::sessions::SessionTrigger::Compact + ); } #[test] // [unit->REQ-NOTIF-1] `api boundary` is a reported resurface point Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1376: let all = spt_store::spool::drain_all_at(&perch_path).unwrap(); assert_eq!(all.len(), 1, "{all:?}"); assert!( - all[0].body.contains("Scout → mock-shell-0 (mock-shell), offline"), + all[0] + .body + .contains("Scout → mock-shell-0 (mock-shell), offline"), "{:?}", all[0] ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1383: assert!( - all[0].body.contains("instantiable shell adapters on this node"), + all[0] + .body + .contains("instantiable shell adapters on this node"), "{:?}", all[0] ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\reporting.rs:1538: 0 ); assert_eq!( - ingest_digest_entry("alice", r#"{"role":"tool","tool":{"name":"Write","arg":"a"}}"#), + ingest_digest_entry( + "alice", + r#"{"role":"tool","tool":{"name":"Write","arg":"a"}}"# + ), 0 ); let log = std::fs::read_to_string(perch.join("digest.log")).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:523: let owner_alive = info::read_pid(&perch_path) .map(proc::is_process_alive) .unwrap_or(false); - if owner_alive && !existing.session_id.is_empty() && existing.session_id != session_id - { + if owner_alive && !existing.session_id.is_empty() && existing.session_id != session_id { return Err(BindError::Conflict { id: id.to_string(), held: existing.session_id.clone(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:624: // [impl->REQ-DIGEST-PROFILE-ENV] rec.read_env = resolve_read_env( adapter - .and_then(|a| { - spt_runtime::registry::resolve_option(&perch::adapters_dir(), a).ok() - }) + .and_then(|a| spt_runtime::registry::resolve_option(&perch::adapters_dir(), a).ok()) .map(|(_, m)| { spt_runtime::runtime::capture_read_env(&m, |k| std::env::var(k).ok()) }), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1335: // 1. BIND — the spt-hosted bind EARNS the hosting authority. assert_eq!( - cmd_bind("topo", Some("sid-topo".into()), None, None, None, "live_agent"), + cmd_bind( + "topo", + Some("sid-topo".into()), + None, + None, + None, + "live_agent" + ), 0, "the spt-hosted bind succeeds" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1370: // stamps on the sessions poll (driven here, as a brain would). let mut driver = connect_broker(&sock); driver.attach(session, 0).expect("attach as controller"); - let _ = driver.sessions().expect("sessions poll converges the stamps"); + let _ = driver + .sessions() + .expect("sessions poll converges the stamps"); let controlled = info::read_info(&perch).unwrap(); assert!( controlled.controlled, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1467: }) .expect("spawn the endpoint's PTY session"); assert_eq!( - cmd_bind("deadpty", Some("sid-dead".into()), None, None, None, "live_agent"), + cmd_bind( + "deadpty", + Some("sid-dead".into()), + None, + None, + None, + "live_agent" + ), 0 ); let perch = perch::resolve_perch_path("deadpty", ParentHint::Infer); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1602: let mut child = { #[cfg(windows)] { - std::process::Command::new("cmd").args(["/C", "rem"]).spawn() + std::process::Command::new("cmd") + .args(["/C", "rem"]) + .spawn() } #[cfg(unix)] { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1613: let pid = child.id(); child.wait().expect("reap probe child"); drop(child); // close our process handle — on Windows a held handle keeps the pid probe-able - // Poll to the parent-watch cadence: the pid must read gone within one window. + // Poll to the parent-watch cadence: the pid must read gone within one window. let gone = { let mut g = false; for _ in 0..40 { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1727: let eof = Error::new(ErrorKind::UnexpectedEof, "failed to fill whole buffer"); let msg = seed_fail_message(4321, &eof); assert!(msg.starts_with("SEED_FAIL:4321:")); - assert!(msg.contains("stale pre-0.9.0 broker"), "names the cause: {msg}"); + assert!( + msg.contains("stale pre-0.9.0 broker"), + "names the cause: {msg}" + ); assert!(msg.contains("spt daemon stop"), "names the fix: {msg}"); assert!( !msg.contains("failed to fill whole buffer"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1912: #[test] fn listen_online_gate_refuses_capability_only_online() { // The full table: capability alone never suffices. - assert!(!listen_online_gate(true, Some("ready_agent")), "the hybrid birth shape"); - assert!(!listen_online_gate(true, None), "no persisted record — nothing earned"); + assert!( + !listen_online_gate(true, Some("ready_agent")), + "the hybrid birth shape" + ); + assert!( + !listen_online_gate(true, None), + "no persisted record — nothing earned" + ); assert!(!listen_online_gate(true, Some("gateway"))); - assert!(!listen_online_gate(false, Some("live_agent")), "not live-capable — no stamp"); + assert!( + !listen_online_gate(false, Some("live_agent")), + "not live-capable — no stamp" + ); assert!(!listen_online_gate(false, None)); - assert!(listen_online_gate(true, Some("live_agent")), "the one earned shape"); + assert!( + listen_online_gate(true, Some("live_agent")), + "the one earned shape" + ); } // W3 (REQ-HAZARD-BIND-CWD-UNSET): the refuted v0.12.1 P1 — a freshly bound Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1934: #[test] fn bind_records_cwd_so_picker_can_group_by_project() { let _h = isolated_home(); - let code = cmd_bind("cwdy", Some("sid-cwd".into()), None, None, None, "live_agent"); + let code = cmd_bind( + "cwdy", + Some("sid-cwd".into()), + None, + None, + None, + "live_agent", + ); assert_eq!(code, 0); let rec = info::read_info(&perch::resolve_perch_path("cwdy", ParentHint::Infer)).unwrap(); - let cwd = rec.cwd.expect("bind must record info.cwd (was never set — the refuted P1)"); + let cwd = rec + .cwd + .expect("bind must record info.cwd (was never set — the refuted P1)"); assert!(!cwd.is_empty(), "recorded cwd must be non-empty"); // It is THIS process's current_dir (what cmd_bind passes via current_dir()). - let expected = std::env::current_dir().unwrap().to_string_lossy().into_owned(); - assert_eq!(cwd, expected, "bind records its own current_dir as the perch cwd"); + let expected = std::env::current_dir() + .unwrap() + .to_string_lossy() + .into_owned(); + assert_eq!( + cwd, expected, + "bind records its own current_dir as the perch cwd" + ); // The picker derives project membership off exactly this field // (data.rs:138 → project_id_for_dir); the derivation is non-empty so the // endpoint resolves to a real project category, not "" (no membership). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1948: let project = spt_store::project::project_id_for_dir(std::path::Path::new(&cwd)); - assert!(!project.is_empty(), "cwd-derived project id is non-empty: {project:?}"); + assert!( + !project.is_empty(), + "cwd-derived project id is non-empty: {project:?}" + ); } // [unit->REQ-HAZARD-BIND-CWD-UNSET] CARRY-FORWARD: a revive that supplies no Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1962: let anchor = std::process::id(); // First bind: spt-hosted, stamps a concrete cwd (this process's dir). - let code = cmd_bind("revivee", Some("sid-1".into()), None, None, None, "live_agent"); + let code = cmd_bind( + "revivee", + Some("sid-1".into()), + None, + None, + None, + "live_agent", + ); assert_eq!(code, 0); let perch_path = perch::resolve_perch_path("revivee", ParentHint::Infer); - let first = info::read_info(&perch_path).unwrap().cwd.expect("first bind set cwd"); + let first = info::read_info(&perch_path) + .unwrap() + .cwd + .expect("first bind set cwd"); assert!(!first.is_empty()); // Re-bind via the harness-hosted seed path with seed.cwd = None (put_seed Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:1994: // First bind, then the daemon stamps a DORMANT resting intent + its // auto-suspend anchor (info::set_rest_state — the D9-2 / REQ-INST-3 write). - let code = cmd_bind("resty", Some("sid-1".into()), None, None, None, "live_agent"); + let code = cmd_bind( + "resty", + Some("sid-1".into()), + None, + None, + None, + "live_agent", + ); assert_eq!(code, 0); let perch_path = perch::resolve_perch_path("resty", ParentHint::Infer); info::set_rest_state(&perch_path, "dormant", Some(1_700_000_000_000)) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2075: assert_eq!(stopped.rest_state.as_deref(), Some("suspended")); // `endpoint run --create` binds the fresh life under a NEW session id. - let code = cmd_bind("recreated", Some("sid-2".into()), None, None, None, "live_agent"); + let code = cmd_bind( + "recreated", + Some("sid-2".into()), + None, + None, + None, + "live_agent", + ); assert_eq!(code, 0); let after = info::read_info(&perch_path).unwrap(); - assert_eq!(after.status.as_deref(), Some("online"), "the fresh bind is online"); assert_eq!( + after.status.as_deref(), + Some("online"), + "the fresh bind is online" + ); + assert_eq!( after.rest_state.as_deref(), Some("active"), "a fresh bind over a stopped life stamps the intent it caused, not the corpse's" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2099: let _h = isolated_home(); let _reg = start_seed_daemon(); - let code = cmd_bind("virgin", Some("sid-1".into()), None, None, None, "live_agent"); + let code = cmd_bind( + "virgin", + Some("sid-1".into()), + None, + None, + None, + "live_agent", + ); assert_eq!(code, 0); let rec = info::read_info(&perch::resolve_perch_path("virgin", ParentHint::Infer)).unwrap(); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2137: #[test] // [unit->REQ-SEAM-POSTSPAWN] first-contact bind establishes a live perch. fn post_spawn_bind_establishes_perch() { let _h = isolated_home(); - let code = cmd_bind("bob", Some("sid-boot".into()), None, None, None, "live_agent"); + let code = cmd_bind( + "bob", + Some("sid-boot".into()), + None, + None, + None, + "live_agent", + ); assert_eq!(code, 0); let rec = info::read_info(&perch::resolve_perch_path("bob", ParentHint::Infer)).unwrap(); assert_eq!(rec.session_id, "sid-boot"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2148: fn rebind_same_session_ok() { let _h = isolated_home(); assert_eq!( - cmd_bind("bob", Some("sid-boot".into()), None, None, None, "live_agent"), + cmd_bind( + "bob", + Some("sid-boot".into()), + None, + None, + None, + "live_agent" + ), 0 ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2155: - cmd_bind("bob", Some("sid-boot".into()), None, None, None, "live_agent"), + cmd_bind( + "bob", + Some("sid-boot".into()), + None, + None, + None, + "live_agent" + ), 0 ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2165: fn bind_with_type_establishes_a_gateway_endpoint() { let _h = isolated_home(); assert_eq!( - cmd_bind("playdate-gw", Some("sid-gw".into()), None, None, None, "gateway"), + cmd_bind( + "playdate-gw", + Some("sid-gw".into()), + None, + None, + None, + "gateway" + ), 0 ); let perch = perch::resolve_perch_path("playdate-gw", ParentHint::Infer); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2173: // The open-type tag round-trips to the user-backed Gateway recognizer // the user-msg identity gate keys on (REQ-MSG-5). - let ty = spt_proto::endpoint::EndpointType::from_tag( - &info::read_info(&perch).unwrap().state, - ); + let ty = + spt_proto::endpoint::EndpointType::from_tag(&info::read_info(&perch).unwrap().state); assert!(spt_proto::event::is_gateway_endpoint(&ty)); // Revive without --type (default live_agent) preserves the gateway type. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2182: assert_eq!( - cmd_bind("playdate-gw", Some("sid-gw".into()), None, None, None, "live_agent"), + cmd_bind( + "playdate-gw", + Some("sid-gw".into()), + None, + None, + None, + "live_agent" + ), 0 ); assert_eq!(info::read_info(&perch).unwrap().state, "gateway"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2206: // gateway carry-forward test's same-sid revive). let perch = perch::resolve_perch_path("hybrid", ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let prior = info::InfoJson::new("hybrid", "0", std::process::id(), "sid-bind", "ready_agent"); + let prior = + info::InfoJson::new("hybrid", "0", std::process::id(), "sid-bind", "ready_agent"); info::write_info(&perch, &prior).unwrap(); // spt-hosted live_agent bind over it (same session — a revive). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2213: assert_eq!( - cmd_bind("hybrid", Some("sid-bind".into()), None, None, None, "live_agent"), + cmd_bind( + "hybrid", + Some("sid-bind".into()), + None, + None, + None, + "live_agent" + ), 0 ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2218: let after = info::read_info(&perch).unwrap(); - assert_eq!(after.state, "ready_agent", "the prior type is PRESERVED (REQ-EP-6)"); assert_eq!( + after.state, "ready_agent", + "the prior type is PRESERVED (REQ-EP-6)" + ); + assert_eq!( after.controllable, Some(true), "the spt-hosted bind stamps broker-PTY controllable — the hosting authority" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2243: ); let perch = perch::resolve_perch_path("gwoff", ParentHint::Infer); let after = info::read_info(&perch).unwrap(); - assert_eq!(after.controllable, None, "a gateway bind is not broker-PTY-controllable"); + assert_eq!( + after.controllable, None, + "a gateway bind is not broker-PTY-controllable" + ); assert_ne!( after.status.as_deref(), Some(spt_store::liveness::STATUS_ONLINE), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2436: let rec = info::read_info(&perch::resolve_perch_path("late", ParentHint::Infer)) .expect("perch info.json after sid-fallback bind"); - assert_eq!(rec.session_id, "sid-late", "the perch records the supplied sid"); + assert_eq!( + rec.session_id, "sid-late", + "the perch records the supplied sid" + ); assert_eq!(rec.state, "live_agent"); assert_eq!(rec.parent_pid, Some(anchor)); assert!(perch::resolve_ready_file("late", ParentHint::Infer).exists()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2481: #[test] fn seed_restorable_spends_dead_seeds_restores_recoverable() { // SPENT: a dead-anchor or contentless seed can never bind as itself. - assert!(!seed_restorable(&BindError::StaleSeed(1)), "dead anchor is spent"); - assert!(!seed_restorable(&BindError::EmptySession), "empty session is spent"); + assert!( + !seed_restorable(&BindError::StaleSeed(1)), + "dead anchor is spent" + ); + assert!( + !seed_restorable(&BindError::EmptySession), + "empty session is spent" + ); // RESTORED: the anchor is alive; the corrected retry must find its seed again. assert!( seed_restorable(&BindError::Conflict { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\startup.rs:2584: // An alive parent pid clears the liveness gate, so the bind reaches the // establish-time custody guard — which refuses the bearer-string squat. - let err = bind_from_session_id("attacker", "psid-x", std::process::id(), None, None) - .unwrap_err(); + let err = + bind_from_session_id("attacker", "psid-x", std::process::id(), None, None).unwrap_err(); assert_eq!( err, BindError::PsycheCustodySquat { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\api\worker.rs:251: &InfoJson::new("alice", "0", std::process::id(), "", "ready_agent"), ) .unwrap(); - assert_eq!(cmd_worker_start("alice", None, None, Some("presented-sid")), 0); - let rec = info::read_info(&perch::resolve_perch_path("alice-w1", ParentHint::Infer)).unwrap(); + assert_eq!( + cmd_worker_start("alice", None, None, Some("presented-sid")), + 0 + ); + let rec = + info::read_info(&perch::resolve_perch_path("alice-w1", ParentHint::Infer)).unwrap(); assert_eq!( rec.session_id, "presented-sid", "empty parent sid → fall back to the presented sid" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:725: }, /// Delete a **local** profile. Refuses a shipped profile name (adapter-owned, /// immutable) and errors if no local file exists. - DeleteProfile { - adapter: String, - name: String, - }, + DeleteProfile { adapter: String, name: String }, /// Read a `[strings]` dot-path from an adapter option's merged view /// (`[:profile] `). Resolves through the profile overlay /// like every other consumer; prints the value (strings raw, else JSON). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1256: fn bare_invocation(template: String) -> i32 { use clap::CommandFactory; use std::io::IsTerminal; - match decide_bare(std::io::stdin().is_terminal(), std::io::stdout().is_terminal()) { + match decide_bare( + std::io::stdin().is_terminal(), + std::io::stdout().is_terminal(), + ) { BareAction::Picker => crate::picker::run(None, None), BareAction::Help => { // Render the help, then transform its inline Markdown to terminal Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1264: // would emit the raw `**`/backtick markers verbatim. let cmd = Cli::command(); let raw = cmd.help_template(template).render_help().to_string(); - print!("{}", crate::helpfmt::render(&raw, crate::helpfmt::stdout_color())); + print!( + "{}", + crate::helpfmt::render(&raw, crate::helpfmt::stdout_color()) + ); println!(); 0 } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1374: // Bare `spt subnet` = the flagless status view WITH the hint // footer; explicit `status` drops it (M8 decision 12). None => cmd_subnet_status(None, false, true, json), - Some(SubnetCmd::Status { name, nodes }) => cmd_subnet_status(name, nodes, false, json), + Some(SubnetCmd::Status { name, nodes }) => { + cmd_subnet_status(name, nodes, false, json) + } Some(SubnetCmd::Create { name }) => cmd_subnet_create(name), Some(SubnetCmd::ShowCode { name }) => cmd_subnet_show_code(name, json), Some(SubnetCmd::Join { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1464: // Direct CLI: no picker-threaded cwd — cmd_endpoint_run // resolves it (resume info.cwd → current_dir). RunTarget::Direct { adapter, id } => cmd_endpoint_run( - &adapter, &id, resume, None, start, attach, view, subnet.as_deref(), save, + &adapter, + &id, + resume, + None, + start, + attach, + view, + subnet.as_deref(), + save, ), // Bare (or partial) → the interactive picker (REQ-RUN-PICKER). // A lone --adapter pre-selects it; a lone --id with no existing Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1567: "taken by {} sid={} pid={} at={}", r.taken_leg.as_deref().unwrap_or("?"), r.taken_sid.as_deref().unwrap_or("-"), - r.taken_pid.map(|p| p.to_string()).unwrap_or_else(|| "-".to_string()), - r.taken_at_ms.map(|m| m.to_string()).unwrap_or_else(|| "-".to_string()), + r.taken_pid + .map(|p| p.to_string()) + .unwrap_or_else(|| "-".to_string()), + r.taken_at_ms + .map(|m| m.to_string()) + .unwrap_or_else(|| "-".to_string()), ) } else { "pending".to_string() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1678: 0 } Ok(None) => { - eprintln!("NO_DIGEST:{id} has no activity buffer (no session-log source / no records yet?)"); + eprintln!( + "NO_DIGEST:{id} has no activity buffer (no session-log source / no records yet?)" + ); 1 } Err(e) => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1776: .turns .iter() .flat_map(|t| { - t.input_seq.into_iter().chain(t.entries.iter().filter_map(|e| match e { - DigestEntry::Agent { seq, .. } | DigestEntry::ToolSprint { seq, .. } => *seq, - _ => None, - })) + t.input_seq + .into_iter() + .chain(t.entries.iter().filter_map(|e| match e { + DigestEntry::Agent { seq, .. } | DigestEntry::ToolSprint { seq, .. } => *seq, + _ => None, + })) }) .min(); if let Some(floor) = lowest { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1812: let has_new_activity = entries.iter().any(|e| { matches!( e, - DigestEntry::Agent { seq: Some(_), .. } | DigestEntry::ToolSprint { seq: Some(_), .. } + DigestEntry::Agent { seq: Some(_), .. } + | DigestEntry::ToolSprint { seq: Some(_), .. } ) }); if input_new || has_new_activity { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1862: ); } } - let out = serde_json::to_string_pretty(&v) - .unwrap_or_else(|_| spt_daemon::digest_to_json(digest)); + let out = + serde_json::to_string_pretty(&v).unwrap_or_else(|_| spt_daemon::digest_to_json(digest)); (out, Vec::new()) } else { let mut err = Vec::new(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:1983: /// `Picker` hands off to the interactive picker with the given prefills. #[derive(Debug, PartialEq, Eq)] enum RunTarget { - Direct { adapter: String, id: String }, - Picker { adapter: Option, id: Option }, + Direct { + adapter: String, + id: String, + }, + Picker { + adapter: Option, + id: Option, + }, } /// Pure router for `spt endpoint run`. `recorded` yields an existing perch's Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2003: (Some(adapter), Some(id)) => RunTarget::Direct { adapter, id }, (None, Some(id)) => match recorded(&id) { Some(adapter) => RunTarget::Direct { adapter, id }, - None => RunTarget::Picker { adapter: None, id: Some(id) }, + None => RunTarget::Picker { + adapter: None, + id: Some(id), + }, }, (adapter, id) => RunTarget::Picker { adapter, id }, } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2029: // (Some,Some) → Direct verbatim, perch never consulted. assert_eq!( resolve_run_target(s("claude-spt"), s("foo"), |_| panic!("must not read perch")), - RunTarget::Direct { adapter: "claude-spt".into(), id: "foo".into() } + RunTarget::Direct { + adapter: "claude-spt".into(), + id: "foo".into() + } ); // (None,Some) + existing perch's recorded adapter → Direct (the D-1 reuse). assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2037: assert_eq!(id, "foo"); s("claude-spt") }), - RunTarget::Direct { adapter: "claude-spt".into(), id: "foo".into() } + RunTarget::Direct { + adapter: "claude-spt".into(), + id: "foo".into() + } ); // (None,Some) + no perch / adapterless → today's create-new picker prefill. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2044: resolve_run_target(None, s("foo"), |_| None), - RunTarget::Picker { adapter: None, id: s("foo") } + RunTarget::Picker { + adapter: None, + id: s("foo") + } ); // (Some,None) → picker with the adapter pre-selected. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2049: resolve_run_target(s("claude-spt"), None, |_| None), - RunTarget::Picker { adapter: s("claude-spt"), id: None } + RunTarget::Picker { + adapter: s("claude-spt"), + id: None + } ); // (None,None) → bare picker. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2054: resolve_run_target(None, None, |_| None), - RunTarget::Picker { adapter: None, id: None } + RunTarget::Picker { + adapter: None, + id: None + } ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2092: // Resolve the harness adapter option (`[:profile]`) through the // merged view (split → parent lookup → overlay), exactly like shell spawn. let adapters_dir = spt_store::perch::adapters_dir(); - let (manifest, install_dir) = match spt_runtime::registry::resolve_option(&adapters_dir, adapter) - { - // The record's `source_dir` is the adapter install dir (W3a) — carried to - // the broker so a live adapter update can target this endpoint. - Ok((r, m)) if m.adapter.kind == spt_runtime::manifest::AdapterKind::Harness => { - (m, Some(r.source_dir)) - } - Ok(_) => { - eprintln!( - "ENDPOINT_RUN_NOT_HARNESS:{adapter}: not a kind=\"harness\" adapter — \ + let (manifest, install_dir) = + match spt_runtime::registry::resolve_option(&adapters_dir, adapter) { + // The record's `source_dir` is the adapter install dir (W3a) — carried to + // the broker so a live adapter update can target this endpoint. + Ok((r, m)) if m.adapter.kind == spt_runtime::manifest::AdapterKind::Harness => { + (m, Some(r.source_dir)) + } + Ok(_) => { + eprintln!( + "ENDPOINT_RUN_NOT_HARNESS:{adapter}: not a kind=\"harness\" adapter — \ `endpoint run` brings up harness endpoints (shells use `shell spawn`)" - ); - return 1; - } - Err(e) => { - eprintln!( - "ENDPOINT_RUN_ADAPTER_UNREGISTERED:{adapter}: not an active registered \ + ); + return 1; + } + Err(e) => { + eprintln!( + "ENDPOINT_RUN_ADAPTER_UNREGISTERED:{adapter}: not an active registered \ harness adapter / valid profile on this node ({e}; spt adapter list)" - ); - return 1; - } - }; + ); + return 1; + } + }; // B2 (REQ-RESUME-HARNESS-SESSION-ID): a fresh bringup mints a provisional // spawn-time session id; `--resume` must feed the native-resume template Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2127: let (is_resume, session_id) = match resume { None => (false, spt_daemon::harnesshost::mint_session_id()), Some(requested) => { - let perch = spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); + let perch = + spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); // sessions::last_k returns oldest→newest; the resolver wants newest-first. let mut ledger: Vec = spt_store::sessions::last_k(&perch, spt_store::sessions::MAX_LEDGER) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2236: .or_else(|| { is_resume .then(|| { - let perch = - spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); + let perch = spt_store::perch::resolve_perch_path( + id, + spt_store::perch::ParentHint::Infer, + ); spt_store::info::read_info(&perch).and_then(|r| r.cwd) }) .flatten() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2253: // multi-subnet node with no `--subnet` refuses HERE — before launch+await — // never the silent 25s online-timeout. A resume/rebind (a prior perch // exists) is left to the bind path. [impl->REQ-RUN-MULTISUBNET-HOME] - if let Err(code) = resolve_home_and_write_skeleton(id, adapter, subnet, project_cwd.as_deref()) { + if let Err(code) = resolve_home_and_write_skeleton(id, adapter, subnet, project_cwd.as_deref()) + { return code; } // RESUME UNBOUND STAMP (ADR-0042 decision 2): the skeleton write above Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2268: // broker's death observers (mark_offline → terminal_normalize). // [impl->REQ-RESUME-UNBOUND-STAMP] let perch_path = spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); - let unbound_rollback: Option = - spt_store::info::resume_unbound_stamp(&perch_path).ok().flatten(); + let unbound_rollback: Option = spt_store::info::resume_unbound_stamp(&perch_path) + .ok() + .flatten(); // `{node}` fill (REQ-MANIFEST-NODE-KEY): the CLI self-spawn has no daemon in-mem // label handle, so the shared resolver falls to the OS hostname — the same // self-label source the CLI uses everywhere (subnet self, member self). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2352: match spt_daemon::config::DaemonConfig::upsert_startup_endpoint(entry) { Ok(replaced) => eprintln!( "ENDPOINT_AUTOSTART_SAVED:{id} adapter={adapter}{}", - if replaced { " (replaced prior entry)" } else { "" } + if replaced { + " (replaced prior entry)" + } else { + "" + } ), Err(e) => eprintln!("ENDPOINT_AUTOSTART_SAVE_FAIL:{id}: {e}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2436: /// Multi-subnet, no `--subnet`, INTERACTIVE → confirm the proposed default /// (Y/n); `default` is the MRU pick when it is still a member, else the first /// subnet. - Confirm { default: String, subnets: Vec }, + Confirm { + default: String, + subnets: Vec, + }, } /// Order subnet `names` by the `mru` preference list (recency-ordered, head = Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2483: RunHomeDecision::RefuseAmbiguous(ordered) } else { let default = ordered[0].clone(); - RunHomeDecision::Confirm { default, subnets: ordered } + RunHomeDecision::Confirm { + default, + subnets: ordered, + } } } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2503: project_cwd: Option<&str>, ) -> Result<(), i32> { use std::io::{IsTerminal, Write}; - let perch_path = - spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); + let perch_path = spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); if spt_store::info::read_info(&perch_path).is_some() { return Ok(()); // resume/rebind — the bind path owns home (immutable) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2511: let store = spt_store::subnet::SubnetStore::load(); let interactive = std::io::stdin().is_terminal() && std::io::stderr().is_terminal(); - let project_id = project_cwd - .map(|c| spt_store::project::project_id_for_dir(std::path::Path::new(c))); + let project_id = + project_cwd.map(|c| spt_store::project::project_id_for_dir(std::path::Path::new(c))); let mru = spt_store::recent_home::mru_preference(project_id.as_deref()); let home = match decide_run_home( spt_store::home::assign_home(&store, subnet), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2661: assert_eq!(run_on_live_decision(false, true, false), RunOnLive::Spawn); // Live + CREATE intent → typed conflict, attach-mode AND headless (the // create contract has no silent-ensure overload). - assert_eq!(run_on_live_decision(true, false, true), RunOnLive::CreateConflict); - assert_eq!(run_on_live_decision(true, true, true), RunOnLive::CreateConflict); + assert_eq!( + run_on_live_decision(true, false, true), + RunOnLive::CreateConflict + ); + assert_eq!( + run_on_live_decision(true, true, true), + RunOnLive::CreateConflict + ); // Live + RESUME intent + attach → reattach, not a 2nd session (B1/B4). - assert_eq!(run_on_live_decision(true, false, false), RunOnLive::Reattach); + assert_eq!( + run_on_live_decision(true, false, false), + RunOnLive::Reattach + ); // Live + RESUME intent + headless → refuse the duplicate (idempotent). - assert_eq!(run_on_live_decision(true, true, false), RunOnLive::RefuseAlreadyLive); + assert_eq!( + run_on_live_decision(true, true, false), + RunOnLive::RefuseAlreadyLive + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2716: // INTERACTIVE, MRU stale (not a current member) → first subnet default. assert_eq!( decide_run_home(Err(HomeError::Ambiguous(names.clone())), true, &mru_stale), - RunHomeDecision::Confirm { default: "homenet".into(), subnets: names.clone() } + RunHomeDecision::Confirm { + default: "homenet".into(), + subnets: names.clone() + } ); // INTERACTIVE, no MRU at all → first subnet default, original order. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:2723: decide_run_home(Err(HomeError::Ambiguous(names.clone())), true, none), - RunHomeDecision::Confirm { default: "homenet".into(), subnets: names } + RunHomeDecision::Confirm { + default: "homenet".into(), + subnets: names + } ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3328: // local perch — the same source the human column uses. // [impl->REQ-ENDPOINT-LIST-PROJECT-COL] let project = - crate::picker::data::indexed_latest_project_ref(&index, &p.id) - .map(|pr| pr.id); + crate::picker::data::indexed_latest_project_ref(&index, &p.id).map(|pr| pr.id); // The roster-survey activity key (ADR-0048): one sentinel read // per LOCAL row, through the shared vocabulary source. An // unbound perch reports nothing — see the field doc. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3377: // UNBOUND surfaces here too (REQ-ENDPOINT-UNBOUND-ATTACH): the Self // pin must not read a live pre-bind session as plain alive=false. let unbound = if p.unbound { " UNBOUND" } else { "" }; - format!("{} ready={} alive={}{}", p.state, p.ready, p.alive, unbound) + format!( + "{} ready={} alive={}{}", + p.state, p.ready, p.alive, unbound + ) }) .unwrap_or_else(|| "(no local perch)".to_string()); - let info = spt_store::info::read_info(&perch::resolve_perch_path(&self_id, ParentHint::Infer)); + let info = + spt_store::info::read_info(&perch::resolve_perch_path(&self_id, ParentHint::Infer)); let desc = info.as_ref().and_then(|rec| rec.resources.clone()); // The harness-reachable psyche-host-failure annotation (v0.8.1, // REQ-HAZARD-LIVEHOST-BOOT-RACE): an online live agent whose Psyche failed Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3432: // #8: the LATEST project (the indexed history head) — looked up // here, then passed in (this_node_cell stays pure over its inputs). // [impl->REQ-ENDPOINT-LIST-PROJECT-COL] - let project_ref = - crate::picker::data::indexed_latest_project_ref(&index, &p.id); + let project_ref = crate::picker::data::indexed_latest_project_ref(&index, &p.id); this_node_cell(&p, rec.as_ref(), project_ref) }) .collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3635: // #8: the LATEST project = the #4-gossiped recent_projects head. IDs only cross // the wire (no dir), so the disambiguation degrades this to the bare ID. // [impl->REQ-ENDPOINT-LIST-PROJECT-COL] - project_ref: r.recent_projects.first().map(|id| crate::picker::model::ProjectRef { - id: id.clone(), - dir: String::new(), - // IDs only cross the wire (no dir, no URL) → display falls back to the id - // verbatim (REQ-PICKER-PROJECT-DISPLAY-NAME honest fallback). - display: id.clone(), - }), + project_ref: r + .recent_projects + .first() + .map(|id| crate::picker::model::ProjectRef { + id: id.clone(), + dir: String::new(), + // IDs only cross the wire (no dir, no URL) → display falls back to the id + // verbatim (REQ-PICKER-PROJECT-DISPLAY-NAME honest fallback). + display: id.clone(), + }), } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3757: .map(|(c, project)| { // A corrupt record renders as the SUSPENDED square + a CORRUPT word so it // reads as an actionable record condition, not plain offline clutter. - let disp = if c.corrupt { EpDisplay::Suspended } else { c.display }; + let disp = if c.corrupt { + EpDisplay::Suspended + } else { + c.display + }; let square = disp.square(color); // glyph beside the name (A6 c) let label = if c.corrupt { "CORRUPT".to_string() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3781: ) }) .collect(); - let id_w = rendered.iter().map(|c| c.0.chars().count()).max().unwrap_or(0); - let proj_w = rendered.iter().map(|c| c.2.chars().count()).max().unwrap_or(0); - let type_w = rendered.iter().map(|c| c.3.chars().count()).max().unwrap_or(0); + let id_w = rendered + .iter() + .map(|c| c.0.chars().count()) + .max() + .unwrap_or(0); + let proj_w = rendered + .iter() + .map(|c| c.2.chars().count()) + .max() + .unwrap_or(0); + let type_w = rendered + .iter() + .map(|c| c.3.chars().count()) + .max() + .unwrap_or(0); let status_w = rendered.iter().map(|c| c.5).max().unwrap_or(0); let mut out = String::new(); for c in &rendered { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3851: }) .cloned() .collect(); - kept.sort_by(|a, b| instance_rank(a).cmp(&instance_rank(b)).then_with(|| a.id.cmp(&b.id))); + kept.sort_by(|a, b| { + instance_rank(a) + .cmp(&instance_rank(b)) + .then_with(|| a.id.cmp(&b.id)) + }); (kept, hidden) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3896: const ORANGE: &str = "38;5;208"; let mut out = String::new(); // This node FIRST — cyan header, local roster is the status truth. - out.push_str(&ansi_wrap(&format!("This node: {this_node_ident}"), CYAN, color)); + out.push_str(&ansi_wrap( + &format!("This node: {this_node_ident}"), + CYAN, + color, + )); out.push('\n'); if !our_subnets.is_empty() { out.push_str(&ansi_wrap( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:3958: /// wake path. // [impl->REQ-PICKER-REMOTE-WAKE] pub fn cmd_endpoint_wake_remote(id: &str, node: &str) -> i32 { - cmd_rest(&format!("{id}@{node}"), spt_daemon::RestEvent::Wake, "WOKE", true) + cmd_rest( + &format!("{id}@{node}"), + spt_daemon::RestEvent::Wake, + "WOKE", + true, + ) } fn cmd_rest(id: &str, event: spt_daemon::RestEvent, verb: &str, bare_remote_fallback: bool) -> i32 { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:4122: 0 } crate::wansend::WanRestOutcome::NoReply { node } => { - eprintln!("{verb}_REFUSED:{target}: {node} closed the stream without a reply (access gate)"); + eprintln!( + "{verb}_REFUSED:{target}: {node} closed the stream without a reply (access gate)" + ); 1 } crate::wansend::WanRestOutcome::RemoteFail { node, detail } => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:4810: .flatten(); // One broker handle answers net-status, both F-025 image queries (broker // + coordinator), and the W2 stall-evict tally. - let (net_up, broker_image, broker_queried, coordinator_image, coordinator_queried, stall_stats) = - if running { - match spt_daemon::brain::Brain::cold_start( - &spt_daemon::broker_socket_name(), - now_ms(), - ) { - Ok(mut b) => { - let n = b.net_status().ok().map(|s| s.enabled).unwrap_or(true); - let stall = b.stall_evicts().ok().flatten(); - // Ok(Some)=version / Ok(None)=old broker (both a successful - // query) vs Err=couldn't query — keep them distinct so a - // transient IPC failure does not read as a definite stale. - let (bi, bq) = match b.broker_image_version() { - Ok(v) => (v, true), - Err(_) => (None, false), - }; - let (ci, cq) = match b.coordinator_image_version() { - Ok(v) => (v, true), - Err(_) => (None, false), - }; - (Some(n), bi, bq, ci, cq, stall) - } - Err(_) => (Some(true), None, false, None, false, None), + let ( + net_up, + broker_image, + broker_queried, + coordinator_image, + coordinator_queried, + stall_stats, + ) = if running { + match spt_daemon::brain::Brain::cold_start(&spt_daemon::broker_socket_name(), now_ms()) + { + Ok(mut b) => { + let n = b.net_status().ok().map(|s| s.enabled).unwrap_or(true); + let stall = b.stall_evicts().ok().flatten(); + // Ok(Some)=version / Ok(None)=old broker (both a successful + // query) vs Err=couldn't query — keep them distinct so a + // transient IPC failure does not read as a definite stale. + let (bi, bq) = match b.broker_image_version() { + Ok(v) => (v, true), + Err(_) => (None, false), + }; + let (ci, cq) = match b.coordinator_image_version() { + Ok(v) => (v, true), + Err(_) => (None, false), + }; + (Some(n), bi, bq, ci, cq, stall) } - } else { - (None, None, false, None, false, None) - }; + Err(_) => (Some(true), None, false, None, false, None), + } + } else { + (None, None, false, None, false, None) + }; let (stall_evict_count, stall_evict_last_ms) = match stall_stats { Some((c, l)) => (Some(c), Some(l)), None => (None, None), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5005: // [impl->REQ-PROJECT-INDEX-WRITER] W2 observability: the materialized // project index's writer health (index presence alone is not health). if let Some(line) = render_project_index_line( - spt_daemon::projwriter::read_stats_at(&spt_daemon::projwriter::stats_path()) - .as_ref(), + spt_daemon::projwriter::read_stats_at(&spt_daemon::projwriter::stats_path()).as_ref(), ) { println!("{line}"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5028: { let svc = spt_daemon::service::platform_service(); if svc.detected() { - let active = if svc.is_active() { "active" } else { "inactive" }; + let active = if svc.is_active() { + "active" + } else { + "inactive" + }; println!("managed-by: {} ({active})", svc.label()); } else if let Some(hint) = svc.boot_hint() { println!("managed-by: manual — {hint}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5215: // replicated row could in principle arrive already-expired): the row // is auto-dismissed instead of surfaced (ADR-0046 decision 5). Ok((row, spt_daemon::FirstFireOutcome::Expired { .. })) => { - println!("NOTIF_EXPIRED:{} (TTL passed; auto-dismissed)", row.notif_id); + println!( + "NOTIF_EXPIRED:{} (TTL passed; auto-dismissed)", + row.notif_id + ); 0 } Err(e) => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5351: } else { format!("Updated spt-core to v{product_version}.") }; - format!("{head}\nChangelog: {RELEASES_URL}\n{}", restart_required_notice()) + format!( + "{head}\nChangelog: {RELEASES_URL}\n{}", + restart_required_notice() + ) } /// Friendly already-applied message for `spt update apply` (F-025) — mirrors Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5658: let bundle_path = cache.docs_bundle_path(); let _ = std::fs::remove_dir_all(&staging); if let Err(e) = std::fs::create_dir_all(&staging) { - eprintln!("UPDATE_DOCS_SKIPPED: create {}: {e} — docs retry next fetch", staging.display()); + eprintln!( + "UPDATE_DOCS_SKIPPED: create {}: {e} — docs retry next fetch", + staging.display() + ); return; } let mut keys = std::collections::BTreeMap::new(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5696: if docs_dir.exists() { if let Err(e) = std::fs::rename(&docs_dir, &old) { let _ = std::fs::remove_dir_all(&staging); - eprintln!( - "UPDATE_DOCS_SKIPPED: retire old docs: {e} — docs retry next fetch" - ); + eprintln!("UPDATE_DOCS_SKIPPED: retire old docs: {e} — docs retry next fetch"); return; } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:5935: None, ) { Ok(out) if out.success() => GhStatus::Available, - Err(spt_runtime::RuntimeError::Spawn(e)) - if e.kind() == std::io::ErrorKind::NotFound => - { + Err(spt_runtime::RuntimeError::Spawn(e)) if e.kind() == std::io::ErrorKind::NotFound => { GhStatus::Missing } _ => GhStatus::Unauthed, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6032: } #[cfg(target_os = "macos")] { - std::process::Command::new("open").arg(url).spawn().map(|_| ()) + std::process::Command::new("open") + .arg(url) + .spawn() + .map(|_| ()) } #[cfg(all(unix, not(target_os = "macos")))] { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6335: EffectiveTransport::Gh => { std::fs::create_dir_all(scratch_dir).map_err(|e| e.to_string())?; let (template, keys) = gh_download_command(repo, tag, asset, scratch_dir); - match spt_runtime::run_bounded_command( - &template, - &keys, - Duration::from_secs(300), - None, - ) { + match spt_runtime::run_bounded_command(&template, &keys, Duration::from_secs(300), None) + { Ok(out) if out.success() => { let path = scratch_dir.join(asset); let bytes = std::fs::read(&path).map_err(|e| e.to_string()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6419: // [impl->REQ-INSTALL-9] fn tar_extract_all(archive: &std::path::Path, dest: &std::path::Path) -> Result<(), ExtractError> { let keys = std::collections::BTreeMap::from([ - ("archive".to_string(), archive.to_string_lossy().into_owned()), + ( + "archive".to_string(), + archive.to_string_lossy().into_owned(), + ), ("dest".to_string(), dest.to_string_lossy().into_owned()), ]); match spt_runtime::run_bounded_command( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6499: let staging = match dest.parent() { Some(parent) => parent.join(format!( "{}.spt-stage", - dest.file_name().map(|n| n.to_string_lossy()).unwrap_or_default() + dest.file_name() + .map(|n| n.to_string_lossy()) + .unwrap_or_default() )), None => dest.with_extension("spt-stage"), }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6775: // (REQ-UPDATE-FETCH-CURRENT-UX). Classify and report it as such; with // --apply, install an already-staged set instead of printing the hint // (REQ-UPDATE-FETCH-APPLY-FLAG). - let class = classify_fetch_reject(&reason, cache.applied_version(), cache.staged_version()); + let class = + classify_fetch_reject(&reason, cache.applied_version(), cache.staged_version()); return match fetch_reject_action(class, apply) { FetchAction::Apply => cmd_update_apply(false), FetchAction::DoneOk => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6828: return 1; } }; - if let Err(reason) = - spt_daemon::release::verify_update_set_artifact(&meta, triple, &bytes) + if let Err(reason) = spt_daemon::release::verify_update_set_artifact(&meta, triple, &bytes) { let _ = std::fs::remove_dir_all(&scratch); // Friendly Display, not the raw enum Debug (REQ-UPDATE-FETCH-CURRENT-UX); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:6861: eprintln!("UPDATE_DOCS_SKIPPED: stage: {e} — docs retry next fetch"); } } - Err(reason) => eprintln!( - "UPDATE_DOCS_SKIPPED: {reason} — docs retry next fetch" - ), + Err(reason) => { + eprintln!("UPDATE_DOCS_SKIPPED: {reason} — docs retry next fetch") + } }, Err(e) => eprintln!( "UPDATE_DOCS_SKIPPED: {} from {repo}: {e} — docs retry next fetch", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:7490: stale_row, } => { if let Some(root_pid) = stale_row { - eprintln!("{}", crate::teardown::stale_row_line("STOPPED", id, root_pid)); + eprintln!( + "{}", + crate::teardown::stale_row_line("STOPPED", id, root_pid) + ); } // The clauses name what ACTUALLY happened. The old line asserted // "address unregistered" on every marker-less stop, whether or not Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:8255: let os = elevation::current_os(); let is_unix = matches!(os, elevation::Os::Unix); let has_pkexec = is_unix && program_on_path("pkexec"); - let term = if is_unix { first_terminal_emulator() } else { None }; + let term = if is_unix { + first_terminal_emulator() + } else { + None + }; let path = elevation::decide_elevation_path( os, elevation::current(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:8285: let argv = elevation::terminal_argv(term, &exe, &argv_tail); match std::process::Command::new(term).args(&argv[1..]).spawn() { Ok(_) => { - eprintln!("Elevated terminal launched — complete the prompt in the new window."); + eprintln!( + "Elevated terminal launched — complete the prompt in the new window." + ); Some(0) } Err(_) => None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:9110: // inbound_block_hint all flow through here). Node-id rows carry no // Markdown markers, so only the hints restyle/strip. // [impl->REQ-CLI-OUTPUT-MARKDOWN] - print!("{}", crate::helpfmt::render(&out, crate::helpfmt::stdout_color())); + print!( + "{}", + crate::helpfmt::render(&out, crate::helpfmt::stdout_color()) + ); let _ = std::io::stdout().flush(); return 0; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:9251: } // Same human status view as the non-`--nodes` branch — render the prose. // [impl->REQ-CLI-OUTPUT-MARKDOWN] - print!("{}", crate::helpfmt::render(&out, crate::helpfmt::stdout_color())); + print!( + "{}", + crate::helpfmt::render(&out, crate::helpfmt::stdout_color()) + ); let _ = std::io::stdout().flush(); 0 } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:9354: /// Elevation-gated, gate-first. Own identity refuses (leave owns that). // [impl->REQ-SUBNET-6] fn cmd_subnet_prune(node: &str) -> i32 { - if let Some(msg) = trust_mutation_refusal(elevation::current(), "pruning a node's roster rows") { + if let Some(msg) = trust_mutation_refusal(elevation::current(), "pruning a node's roster rows") + { if let Some(code) = try_auto_elevate() { return code; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:9451: /// `leave`). // [impl->REQ-MESH-4] fn cmd_subnet_revoke(nodes: &[String], force_rotate_seed: bool) -> i32 { - if let Some(msg) = - trust_mutation_refusal(elevation::current(), "revoking a node and rotating the seed") - { + if let Some(msg) = trust_mutation_refusal( + elevation::current(), + "revoking a node and rotating the seed", + ) { if let Some(code) = try_auto_elevate() { return code; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:9710: if let Some(code) = try_auto_elevate() { return Some(code); } - let msg = join_elevation_refusal(elevation::current()) - .unwrap_or_else(|| "ELEVATION_REQUIRED: re-run elevated (run as administrator / root)".to_string()); + let msg = join_elevation_refusal(elevation::current()).unwrap_or_else(|| { + "ELEVATION_REQUIRED: re-run elevated (run as administrator / root)".to_string() + }); eprintln!("{}", with_elevation_hint(msg)); Some(EXIT_NOT_ELEVATED) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10260: // strip intact; only the human topic list is rendered. eprintln!( "{}", - render(&format!("NO_SUCH_TOPIC:{t} — topics:\n{}", list()), stderr_color()) + render( + &format!("NO_SUCH_TOPIC:{t} — topics:\n{}", list()), + stderr_color() + ) ); 2 } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10494: fn subprocess_detail(stderr: &str, stdout: &str) -> String { let detail = { let e = stderr.trim(); - if e.is_empty() { stdout.trim() } else { e } + if e.is_empty() { + stdout.trim() + } else { + e + } }; if detail.is_empty() { String::new() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10571: _ => None, } { if let Some(rec) = registered_github_home(&adapters, spec) { - let dir = adapters.join("_github").join(spec.replace(['/', '\\'], "-")); + let dir = adapters + .join("_github") + .join(spec.replace(['/', '\\'], "-")); eprintln!( "ADAPTER_ADD_ALREADY_REGISTERED:{}: already installed at {}.\n\ Use `spt adapter update {}` to refresh it in place (safe stage-then-swap),\n\ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10620: if dest.exists() { if let Err(e) = std::fs::remove_dir_all(&dest) { let _ = std::fs::remove_dir_all(&staging); - eprintln!("ADAPTER_CLONE_FAIL: replace {}: {e}", dest.display()); + eprintln!( + "ADAPTER_CLONE_FAIL: replace {}: {e}", + dest.display() + ); return 1; } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10645: } (None, None, Some(spec)) => { let asset = asset.as_deref().unwrap_or("adapter.spt"); - match fetch_release_adapter(&adapters, &spec, tag.as_deref(), asset, transport) { + match fetch_release_adapter(&adapters, &spec, tag.as_deref(), asset, transport) + { Ok(dest) => dest, Err(code) => return code, } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10652: } _ => { - eprintln!( - "ADAPTER_BAD_ARGS: exactly one of , --github, or --release" - ); + eprintln!("ADAPTER_BAD_ARGS: exactly one of , --github, or --release"); return 2; } }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10705: spt_daemon::adapter_update::AdapterUpdateOutcome::Delegate(cmd) => { let rc = conduct("INSTALL", &cmd); // Only run the post-step once the acquisition succeeded. - if rc == 0 { install_post_step() } else { rc } + if rc == 0 { + install_post_step() + } else { + rc + } } spt_daemon::adapter_update::AdapterUpdateOutcome::Skipped(reason) => { // file_pull with no payload yet: the install is GENUINELY Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10858: // [impl->REQ-MANIFEST-3] // [impl->REQ-ADAPTER-VERSION-CMD] AdapterCmd::Version { option } => cmd_adapter_version(&adapters, &option, json), - AdapterCmd::GetString { option, key } => match registry::get_string(&adapters, &option, &key) - { - Ok(Some(value)) => { - // Strings print raw; structured leaves print as JSON (machine- - // readable for a hook). spt-core never executes the value. - if let Some(s) = value.as_str() { - println!("{s}"); - } else { - println!("{}", serde_json::to_string(&value).unwrap_or_default()); + AdapterCmd::GetString { option, key } => { + match registry::get_string(&adapters, &option, &key) { + Ok(Some(value)) => { + // Strings print raw; structured leaves print as JSON (machine- + // readable for a hook). spt-core never executes the value. + if let Some(s) = value.as_str() { + println!("{s}"); + } else { + println!("{}", serde_json::to_string(&value).unwrap_or_default()); + } + 0 } - 0 + Ok(None) => { + eprintln!("ADAPTER_STRING_UNSET:{option}: no value at '{key}'"); + 1 + } + Err(e) => { + eprintln!("ADAPTER_STRING_FAIL:{option}: {e}"); + 1 + } } - Ok(None) => { - eprintln!("ADAPTER_STRING_UNSET:{option}: no value at '{key}'"); - 1 - } - Err(e) => { - eprintln!("ADAPTER_STRING_FAIL:{option}: {e}"); - 1 - } - }, + } // [impl->REQ-TERM-5] // [impl->REQ-ADAPTER-PROOF-DIR-OVERRIDE] - AdapterCmd::DigestProof { option, sample, session, dir, manifest } => { - cmd_adapter_digest_proof( - &adapters, - &option, - sample.as_deref(), - session.as_deref(), - dir.as_deref(), - manifest.as_deref(), - ) - } + AdapterCmd::DigestProof { + option, + sample, + session, + dir, + manifest, + } => cmd_adapter_digest_proof( + &adapters, + &option, + sample.as_deref(), + session.as_deref(), + dir.as_deref(), + manifest.as_deref(), + ), // [impl->REQ-ADAPTER-TRANSLATE-PROOF] // [impl->REQ-ADAPTER-PROOF-DIR-OVERRIDE] - AdapterCmd::TranslateProof { option, event, session, dir, manifest } => { - cmd_adapter_translate_proof( - &adapters, - &option, - &event, - session.as_deref(), - dir.as_deref(), - manifest.as_deref(), - ) - } + AdapterCmd::TranslateProof { + option, + event, + session, + dir, + manifest, + } => cmd_adapter_translate_proof( + &adapters, + &option, + &event, + session.as_deref(), + dir.as_deref(), + manifest.as_deref(), + ), // [impl->REQ-MANIFEST-3] AdapterCmd::SetString { option, key, value } => { let (adapter, profile) = spt_runtime::profile::split_option(&option); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10943: } else { match spt_runtime::resolve::set_active(&adapters, &target) { Ok(keys) => { - println!("{target} is now the active profile for: {}.", keys.join(", ")); + println!( + "{target} is now the active profile for: {}.", + keys.join(", ") + ); 0 } Err(e) => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10967: /// (adapter file deletions are rare; a stale unreferenced file is harmless), so a /// running binary that vanished from the manifest is never yanked mid-update. // [impl->REQ-ADAPTER-LIVE-UPDATE] -fn apply_release_crc_swap( - staged: &std::path::Path, - dest: &std::path::Path, -) -> Result<(), String> { +fn apply_release_crc_swap(staged: &std::path::Path, dest: &std::path::Path) -> Result<(), String> { // Extract to a sibling temp tree (platform-selective per W1), then diff+swap // into `dest`. The temp tree is removed on every exit. let staging = dest.with_extension("crc-stage"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10978: std::fs::create_dir_all(&staging).map_err(|e| e.to_string())?; let result = (|| { extract_release_archive(staged, &staging).map_err(|e| e.to_string())?; - let plan = spt_daemon::crc_swap::plan_crc_swap(&staging, dest).map_err(|e| e.to_string())?; + let plan = + spt_daemon::crc_swap::plan_crc_swap(&staging, dest).map_err(|e| e.to_string())?; spt_daemon::crc_swap::apply_crc_swap(&plan).map_err(|e| e.to_string()) })(); let _ = std::fs::remove_dir_all(&staging); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:10995: /// blind swap on an unverifiable floor); `register` at the re-register step remains the /// choke-point backstop for every other entry path. The temp is removed on every exit. // [impl->REQ-ADAPTER-FLOOR-ENFORCE] -fn staged_floor_ok(staged: &std::path::Path, dest: &std::path::Path, name: &str) -> Result<(), String> { +fn staged_floor_ok( + staged: &std::path::Path, + dest: &std::path::Path, + name: &str, +) -> Result<(), String> { let peek = dest.with_extension("floor-peek"); let _ = std::fs::remove_dir_all(&peek); let res = (|| -> Result<(), String> { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11002: - std::fs::create_dir_all(&peek).map_err(|e| format!("could not verify the core-version floor: {e}"))?; + std::fs::create_dir_all(&peek) + .map_err(|e| format!("could not verify the core-version floor: {e}"))?; extract_release_archive(staged, &peek) .map_err(|e| format!("could not verify the core-version floor: {e}"))?; let mtoml = std::fs::read_to_string(peek.join("manifest.toml")) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11100: let what = match o.outcome { ServiceOutcome::Started => "started".to_string(), ServiceOutcome::AlreadyRunning => "already running".to_string(), - ServiceOutcome::Held => "held for an update — starts when the hold releases".to_string(), + ServiceOutcome::Held => { + "held for an update — starts when the hold releases".to_string() + } ServiceOutcome::BindDeferred => { "start = \"bind\" — starts at the adapter's first shell bind".to_string() } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11244: } if let Some(o) = asked.as_deref() { if rows.is_empty() { - eprintln!("ADAPTER_SERVICE_UNKNOWN:{o}: no registered adapter declares a service for \ - this option, and none is supervised"); + eprintln!( + "ADAPTER_SERVICE_UNKNOWN:{o}: no registered adapter declares a service for \ + this option, and none is supervised" + ); return 1; } } else if rows.is_empty() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11308: /// trailing-trimmed (the caller adds one newline). Pure (modulo `color`); the /// caller invokes it ONLY after an update is actually applied — never on a no-op. // [impl->REQ-ADAPTER-UPDATE-MESSAGE] -fn adapter_update_notice(manifest: &spt_runtime::manifest::Manifest, color: bool) -> Option { +fn adapter_update_notice( + manifest: &spt_runtime::manifest::Manifest, + color: bool, +) -> Option { let msg = manifest.update.as_ref()?.message.as_deref()?; Some(crate::helpfmt::render(msg, color).trim_end().to_string()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11629: None => { // Validation requires `repo`; a record reaching here without one // is corrupt — never silently fetch from nowhere. - eprintln!("ADAPTER_UPDATE_FAIL:{}: gh_release missing repo", record.name); + eprintln!( + "ADAPTER_UPDATE_FAIL:{}: gh_release missing repo", + record.name + ); return AdapterUpdateOutcome::Failed; } }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11744: // though: a daemon that is not running is supervising nothing, so // there is nothing to quiesce and the direct swap is correct. // [impl->REQ-RESIDENT-SERVICE] - let service_needs_daemon = effective_manifest.service.is_some() - && spt_daemon::is_running(); + let service_needs_daemon = + effective_manifest.service.is_some() && spt_daemon::is_running(); let applied = if adapter_has_live_endpoint(&record.name) || service_needs_daemon { eprintln!( "ADAPTER_UPDATE_LIVE:{}: live endpoint(s) or a supervised service — \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11829: /// --jq .tag_name` (the private-repo path). (REQ-UPD-9, REQ-ADAPTER-GH-TRANSPORT) // [impl->REQ-UPD-9] // [impl->REQ-ADAPTER-GH-TRANSPORT] -fn gh_latest_release_version( - repo: &str, - transport: EffectiveTransport, -) -> Result { +fn gh_latest_release_version(repo: &str, transport: EffectiveTransport) -> Result { // Test seam: `SPT_TEST_GH_LATEST` short-circuits the network so the // `adapter update` post-step flow (REQ-ADAPTER-UPDATE-POST) can be integration- // tested deterministically — set it to the installed version to exercise the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11854: } EffectiveTransport::Gh => { let (template, keys) = gh_version_command(repo); - match spt_runtime::run_bounded_command( - &template, - &keys, - Duration::from_secs(60), - None, - ) { + match spt_runtime::run_bounded_command(&template, &keys, Duration::from_secs(60), None) + { Ok(out) if out.success() => out.stdout.trim().to_string(), Ok(out) => return Err(format!("gh api exit {:?}", out.status_code)), Err(e) => return Err(e.to_string()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:11938: let bytes = std::fs::read(staged).map_err(|e| e.to_string())?; let tag_v = format!("v{tag}"); let github = adapters.join("_github"); - let sig_bytes = - fetch_release_asset_bytes(repo, Some(&tag_v), &format!("{asset}.sig"), transport, &github)?; + let sig_bytes = fetch_release_asset_bytes( + repo, + Some(&tag_v), + &format!("{asset}.sig"), + transport, + &github, + )?; let sig_hex = String::from_utf8(sig_bytes).map_err(|e| e.to_string())?; spt_daemon::verify_detached(&bytes, sig_hex.trim(), &key).map_err(|e| e.to_string()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12037: // bare program there before PATH so proof runs exactly as the daemon does // (REQ-INSTALL-11). Registered adapter → its `source_dir`; with // `--dir`/`--manifest` → an on-disk DEV install (REQ-ADAPTER-PROOF-DIR-OVERRIDE). - let (install_dir, manifest) = match resolve_proof_target(adapters, option, dir, manifest_override) { - Ok(pair) => pair, - Err(e) => { - eprintln!("DIGEST_PROOF_FAIL:{option}: {e}"); - return 1; - } - }; + let (install_dir, manifest) = + match resolve_proof_target(adapters, option, dir, manifest_override) { + Ok(pair) => pair, + Err(e) => { + eprintln!("DIGEST_PROOF_FAIL:{option}: {e}"); + return 1; + } + }; let Some(declared) = manifest.digest.clone() else { eprintln!("DIGEST_PROOF_NO_SECTION:{option}: adapter declares no [digest] extractor"); return 2; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12107: } }; - let config = spt_daemon::resolve_config(Some(&declared), &spt_daemon::DigestOverride::default()); + let config = + spt_daemon::resolve_config(Some(&declared), &spt_daemon::DigestOverride::default()); let (digest, diag) = spt_term::project_lines_diagnosed(lines.iter().map(String::as_str), &config); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12114: println!("=== digest-proof: {option} ==="); - println!("parsed {} record(s), dropped {}", diag.parsed, diag.drop_count()); + println!( + "parsed {} record(s), dropped {}", + diag.parsed, + diag.drop_count() + ); println!("\n--- parsed records ---"); for l in &lines { if spt_term::record_to_tagged_result(l).is_ok() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12135: // A broken extractor (drops) or a silent empty (nothing parsed) fails the proof. if diag.drop_count() > 0 { - eprintln!("DIGEST_PROOF_DROPS:{option}: {} line(s) did not match the contract", diag.drop_count()); + eprintln!( + "DIGEST_PROOF_DROPS:{option}: {} line(s) did not match the contract", + diag.drop_count() + ); return 1; } if diag.parsed == 0 { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12188: // does (REQ-INSTALL-11), mirroring the daemon's harnesshost path resolution. // Registered adapter → its `source_dir`; with `--dir`/`--manifest` → an on-disk // DEV install (REQ-ADAPTER-PROOF-DIR-OVERRIDE). - let (install_dir, manifest) = match resolve_proof_target(adapters, option, dir, manifest_override) { - Ok(pair) => pair, - Err(e) => { - eprintln!("TRANSLATE_PROOF_FAIL:{option}: {e}"); - return 1; - } - }; + let (install_dir, manifest) = + match resolve_proof_target(adapters, option, dir, manifest_override) { + Ok(pair) => pair, + Err(e) => { + eprintln!("TRANSLATE_PROOF_FAIL:{option}: {e}"); + return 1; + } + }; let Some(declared) = manifest.message_idle_translation_binary.clone() else { eprintln!( "TRANSLATE_PROOF_NO_SECTION:{option}: adapter declares no \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12465: // not the parent. Deregistered/harness adapters and unknown profiles // refuse. Approval/cap gates extend here at D3d. let adapters_dir = spt_store::perch::adapters_dir(); - let shell_manifest = match spt_runtime::registry::resolve_option(&adapters_dir, &adapter) { - Ok((_, m)) if m.adapter.kind == spt_runtime::manifest::AdapterKind::Shell => m.shell, + let shell_manifest = match spt_runtime::registry::resolve_option( + &adapters_dir, + &adapter, + ) { + Ok((_, m)) if m.adapter.kind == spt_runtime::manifest::AdapterKind::Shell => { + m.shell + } Ok(_) => None, // a harness adapter has no [shell] Err(e) => { eprintln!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12520: let parent = spt_runtime::profile::split_option(&adapter).0; let existing = shellinfo::list_shells(&owlery, &owner) .iter() - .filter(|(_, i)| spt_runtime::profile::split_option(&i.adapter_name).0 == parent) + .filter(|(_, i)| { + spt_runtime::profile::split_option(&i.adapter_name).0 == parent + }) .count(); if existing >= cap as usize { match shell_manifest.over_cap { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12739: // adapter_name → overlaid [shell]); a deregistered parent yields // None and close falls back to the manifestless force path. let adapters_dir = spt_store::perch::adapters_dir(); - let shell = spt_runtime::registry::resolve_option(&adapters_dir, &info.adapter_name) - .ok() - .filter(|(_, m)| m.adapter.kind == spt_runtime::manifest::AdapterKind::Shell) - .and_then(|(_, m)| m.shell); + let shell = + spt_runtime::registry::resolve_option(&adapters_dir, &info.adapter_name) + .ok() + .filter(|(_, m)| { + m.adapter.kind == spt_runtime::manifest::AdapterKind::Shell + }) + .and_then(|(_, m)| m.shell); match spt_daemon::shellhost::close_shell(&owlery, &owner, &id, shell.as_ref()) { Ok(spt_daemon::shellhost::CloseOutcome::TornDown) => { spt_daemon::grants::revoke_can_shutdown_grant(&id); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:12897: eprintln!("SHELL_DRIVE_FAIL: daemon start: {e}"); return 1; } - match spt_daemon::drive_channel_write(&owlery, &owner, &shell_ref, &drive_type, &payload) - { + match spt_daemon::drive_channel_write( + &owlery, + &owner, + &shell_ref, + &drive_type, + &payload, + ) { Ok(spt_daemon::DriveDelivery::Driven { id, drive_type }) => { eprintln!("SHELL_DRIVEN:{id} type={drive_type} (latest-wins slot; drains via api drive-poll --link)"); 0 Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13346: } else { "[o]nce / [d]eny" }; - eprintln!("SHELL_ACT_APPROVAL:{}: {why} (class {class}) — approve? {menu}", ask.capability); + eprintln!( + "SHELL_ACT_APPROVAL:{}: {why} (class {class}) — approve? {menu}", + ask.capability + ); let mut line = String::new(); let _ = std::io::stdin().read_line(&mut line); let mut store = spt_store::grants::GrantStore::load(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13634: /// class: acting on a claim we have just been told is false. Distinct from /// the ordinary non-quiesce case below, which keeps the clean-anyway /// posture — a slow-to-settle endpoint is not a named survivor. - RefusedSurvivor { root_pid: Option }, + RefusedSurvivor { + root_pid: Option, + }, /// The caller's confirm declined. Aborted, /// Everything else was cleaned but the perch tree survived (the one hard Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13677: // Self-guard: never purge the endpoint THIS session is running as (the harness // injects SPT_ENDPOINT_ID = the id) — that would delete your own records mid-run. if std::env::var("SPT_ENDPOINT_ID").ok().as_deref() == Some(id) { - return PurgeReport { outcome: PurgeOutcome::RefusedOwnEndpoint, warnings }; + return PurgeReport { + outcome: PurgeOutcome::RefusedOwnEndpoint, + warnings, + }; } let perch = perch::resolve_perch_path(id, ParentHint::Infer); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13687: // never ask a question it is going to decline anyway. let was_alive = spt_store::liveness::is_perch_alive(&perch); if was_alive && !force { - return PurgeReport { outcome: PurgeOutcome::RefusedOnline, warnings }; + return PurgeReport { + outcome: PurgeOutcome::RefusedOnline, + warnings, + }; } // Confirm (destructive + irreversible) — the CALLER owns the surface. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13696: // to. Declining returns Aborted with genuinely nothing done. // [impl->REQ-ENDPOINT-TEARDOWN-AUTHORITY] if !confirm() { - return PurgeReport { outcome: PurgeOutcome::Aborted, warnings }; + return PurgeReport { + outcome: PurgeOutcome::Aborted, + warnings, + }; } if was_alive { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13805: id: id.to_string(), cwd: None, }); - PurgeReport { outcome: PurgeOutcome::Purged, warnings } + PurgeReport { + outcome: PurgeOutcome::Purged, + warnings, + } } // [impl->REQ-ENDPOINT-PURGE] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13915: // No label / empty label → bare `cli`, no trailing separator. assert_eq!(cli_origin_from_label(None), "cli"); assert_eq!(cli_origin_from_label(Some("")), "cli"); - assert!(!cli_origin_from_label(None).ends_with('@'), "never a dangling cli@"); + assert!( + !cli_origin_from_label(None).ends_with('@'), + "never a dangling cli@" + ); // The live resolver is never blank and never a dangling @ (label or bare cli). let live = cli_origin_label(); assert!(!live.is_empty() && !live.ends_with('@')); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13935: "no source knows this id — the ONLY shape that may be refused" ); let shapes: [(&str, StopEvidence); 4] = [ - ("ready marker", StopEvidence { ready_marker: true, ..Default::default() }), - ("perch record", StopEvidence { perch_record: true, ..Default::default() }), ( + "ready marker", + StopEvidence { + ready_marker: true, + ..Default::default() + }, + ), + ( + "perch record", + StopEvidence { + perch_record: true, + ..Default::default() + }, + ), + ( "registered address", - StopEvidence { registered_address: true, ..Default::default() }, + StopEvidence { + registered_address: true, + ..Default::default() + }, ), - ("broker row", StopEvidence { broker_row: true, ..Default::default() }), + ( + "broker row", + StopEvidence { + broker_row: true, + ..Default::default() + }, + ), ]; for (name, evidence) in shapes { assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13962: // Nothing at all: every source empty, and the broker (asked, because // nothing local answered) has no row either. let none = resolve_stop_evidence_in(owlery, "ghost", || false); - assert_eq!(none, StopEvidence::default(), "an unknown id leaves no trace anywhere"); + assert_eq!( + none, + StopEvidence::default(), + "an unknown id leaves no trace anywhere" + ); assert!(!none.known()); // A perch record alone — the shape a stopped-but-not-purged endpoint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13971: std::fs::create_dir_all(owlery.join("recorded")).unwrap(); let record_only = resolve_stop_evidence_in(owlery, "recorded", || false); assert!(record_only.perch_record && !record_only.ready_marker); - assert!(record_only.known(), "a record-only endpoint is still stoppable"); + assert!( + record_only.known(), + "a record-only endpoint is still stoppable" + ); // Its ready marker joins it (a marker lives INSIDE the perch dir, so // "ready without a record" is not a shape the filesystem can express — Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13985: registry::register_address("registered", &addr, owlery).unwrap(); let address_only = resolve_stop_evidence_in(owlery, "registered", || false); assert!(address_only.registered_address && !address_only.perch_record); - assert!(address_only.known(), "a registry row alone is still stoppable"); + assert!( + address_only.known(), + "a registry row alone is still stoppable" + ); // A broker row alone: nothing local, so the probe IS consulted. let broker_only = resolve_stop_evidence_in(owlery, "hosted", || true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:13992: assert_eq!( broker_only, - StopEvidence { broker_row: true, ..Default::default() }, + StopEvidence { + broker_row: true, + ..Default::default() + }, "the broker answered where the disk could not" ); assert!(broker_only.known()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14120: fn update_fetch_apply_flag_parses() { assert!(matches!( parse(&["spt", "update", "fetch", "--apply"]).unwrap().cmd, - Some(Cmd::Update { action: Some(UpdateCmd::Fetch { apply: true, .. }), .. }) + Some(Cmd::Update { + action: Some(UpdateCmd::Fetch { apply: true, .. }), + .. + }) )); assert!(matches!( parse(&["spt", "update", "fetch"]).unwrap().cmd, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14127: - Some(Cmd::Update { action: Some(UpdateCmd::Fetch { apply: false, .. }), .. }) + Some(Cmd::Update { + action: Some(UpdateCmd::Fetch { apply: false, .. }), + .. + }) )); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14243: // composite (no subcommand), with `--core-only`/`-c` and `--restart` flags; // flags conflict with subcommands (clap-level). #[test] - fn bare_update_parses_composite_flags() { + fn bare_update_parses_composite_flags() { match parse(&["spt", "update"]).unwrap().cmd { Some(Cmd::Update { action: None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14427: notice, "Reload required: run /reload-plugins.", "color-off render strips the markdown markers to bare prose", ); - assert!(!notice.contains('*'), "no literal markdown markers leak through"); + assert!( + !notice.contains('*'), + "no literal markdown markers leak through" + ); } // [unit->REQ-ADAPTER-UPDATE-MESSAGE] No `[update].message` ⇒ no notice: an Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14449: #[test] fn post_step_notice_arbitration() { assert_eq!(post_step_notice(""), PostNotice::None); - assert_eq!(post_step_notice(" \n "), PostNotice::None, "blank → None"); assert_eq!( + post_step_notice(" \n "), + PostNotice::None, + "blank → None" + ); + assert_eq!( post_step_notice(UPDATE_POST_MESSAGE_SENTINEL), PostNotice::ManifestMessage, "the reserved sentinel fires the static manifest message", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14495: let (idir, m) = resolve_proof_target(&adapters, "dev", Some(devdir.to_str().unwrap()), None).unwrap(); assert_eq!(idir, devdir, "--dir sets the install dir"); - assert_eq!(m.adapter.name, "dev", "manifest read from /manifest.toml"); + assert_eq!( + m.adapter.name, "dev", + "manifest read from /manifest.toml" + ); // --manifest: install dir = the file's parent. - let (idir, m) = - resolve_proof_target(&adapters, "dev", None, Some(manifest_file.to_str().unwrap())) - .unwrap(); + let (idir, m) = resolve_proof_target( + &adapters, + "dev", + None, + Some(manifest_file.to_str().unwrap()), + ) + .unwrap(); assert_eq!(idir, devdir, "--manifest's parent is the install dir"); assert_eq!(m.adapter.name, "dev"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14536: // [unit->REQ-ADAPTER-VERSION-CMD] the subcommand parses to Version{option}. #[test] fn adapter_version_parses() { - match parse(&["spt", "adapter", "version", "claude-spt"]).unwrap().cmd.unwrap() { - Cmd::Adapter { action: AdapterCmd::Version { option } } => { + match parse(&["spt", "adapter", "version", "claude-spt"]) + .unwrap() + .cmd + .unwrap() + { + Cmd::Adapter { + action: AdapterCmd::Version { option }, + } => { assert_eq!(option, "claude-spt"); } _ => panic!("expected Adapter Version"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14562: // The resolved manifest exposes exactly the declared [adapter].version — // the value `cmd_adapter_version` prints. let (_, m) = spt_runtime::registry::resolve_option(&adapters, "cc").unwrap(); - assert_eq!(m.adapter.version, "3.1.4", "the [adapter].version field is the source"); + assert_eq!( + m.adapter.version, "3.1.4", + "the [adapter].version field is the source" + ); - assert_eq!(cmd_adapter_version(&adapters, "cc", false), 0, "registered adapter → exit 0"); - assert_eq!(cmd_adapter_version(&adapters, "ghost", false), 1, "unregistered adapter → exit 1"); + assert_eq!( + cmd_adapter_version(&adapters, "cc", false), + 0, + "registered adapter → exit 0" + ); + assert_eq!( + cmd_adapter_version(&adapters, "ghost", false), + 1, + "unregistered adapter → exit 1" + ); } // [unit->REQ-ADAPTER-GH-TRANSPORT] The version command is the exact `gh api` Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14601: "gh release download {tag} --repo {repo} --pattern {asset} --dir {dir} --clobber", "tagged download template is the exact `gh release download ` form", ); - assert_eq!(keys.get("tag").map(String::as_str), Some("v0.13.2"), "tag key"); - assert_eq!(keys.get("repo").map(String::as_str), Some("Owner/repo"), "repo key"); - assert_eq!(keys.get("asset").map(String::as_str), Some("adapter.spt"), "asset key"); assert_eq!( + keys.get("tag").map(String::as_str), + Some("v0.13.2"), + "tag key" + ); + assert_eq!( + keys.get("repo").map(String::as_str), + Some("Owner/repo"), + "repo key" + ); + assert_eq!( + keys.get("asset").map(String::as_str), + Some("adapter.spt"), + "asset key" + ); + assert_eq!( keys.get("dir").map(String::as_str), Some(out_dir.to_string_lossy().as_ref()), "dir key mirrors out_dir's lossy string", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14623: "latest-release template omits the {{tag}} token: {template}", ); assert_eq!( - template, - "gh release download --repo {repo} --pattern {asset} --dir {dir} --clobber", + template, "gh release download --repo {repo} --pattern {asset} --dir {dir} --clobber", "latest-release template is the exact no-tag-arg form", ); - assert!(!keys.contains_key("tag"), "no-tag form carries no `tag` key"); + assert!( + !keys.contains_key("tag"), + "no-tag form carries no `tag` key" + ); // The remaining keys are still fully populated. - assert_eq!(keys.get("repo").map(String::as_str), Some("Owner/repo"), "repo key"); - assert_eq!(keys.get("asset").map(String::as_str), Some("adapter.spt"), "asset key"); assert_eq!( + keys.get("repo").map(String::as_str), + Some("Owner/repo"), + "repo key" + ); + assert_eq!( + keys.get("asset").map(String::as_str), + Some("adapter.spt"), + "asset key" + ); + assert_eq!( keys.get("dir").map(String::as_str), Some(out_dir.to_string_lossy().as_ref()), "dir key mirrors out_dir's lossy string", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14650: .cmd .unwrap() { - Cmd::Adapter { action: AdapterCmd::Add { gh, https, .. } } => { + Cmd::Adapter { + action: AdapterCmd::Add { gh, https, .. }, + } => { assert!(gh, "--gh sets gh=true"); assert!(!https, "--gh leaves https=false"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14657: _ => panic!("expected Adapter Add"), } // --https alone. - match parse(&["spt", "adapter", "add", "--release", "Owner/repo", "--https"]) - .unwrap() - .cmd - .unwrap() + match parse(&[ + "spt", + "adapter", + "add", + "--release", + "Owner/repo", + "--https", + ]) + .unwrap() + .cmd + .unwrap() { - Cmd::Adapter { action: AdapterCmd::Add { gh, https, .. } } => { + Cmd::Adapter { + action: AdapterCmd::Add { gh, https, .. }, + } => { assert!(https, "--https sets https=true"); assert!(!gh, "--https leaves gh=false"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14674: .cmd .unwrap() { - Cmd::Adapter { action: AdapterCmd::Add { gh, https, .. } } => { + Cmd::Adapter { + action: AdapterCmd::Add { gh, https, .. }, + } => { assert!(!gh && !https, "neither flag → both false (auto)"); } _ => panic!("expected Adapter Add"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14681: } // --gh --https together is rejected by conflicts_with. assert!( - parse(&["spt", "adapter", "add", "--release", "Owner/repo", "--gh", "--https"]).is_err(), + parse(&[ + "spt", + "adapter", + "add", + "--release", + "Owner/repo", + "--gh", + "--https" + ]) + .is_err(), "--gh and --https are mutually exclusive (clap conflicts_with)", ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14703: spt_store::info::write_info(&perch, &rec).unwrap(); spt_store::info::set_status(&perch, spt_store::liveness::STATUS_ONLINE).unwrap(); spt_store::info::set_rest_state(&perch, "dormant", Some(1_000)).unwrap(); - assert!(spt_store::liveness::is_perch_alive(&perch), "online before stop"); + assert!( + spt_store::liveness::is_perch_alive(&perch), + "online before stop" + ); assert_eq!(cmd_stop(id), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14719: "stop normalizes the rest intent terminally" ); assert_eq!(got.dormant_since_ms, None, "anchor cleared with the pair"); - assert!(!spt_store::liveness::is_perch_alive(&perch), "offline after stop"); + assert!( + !spt_store::liveness::is_perch_alive(&perch), + "offline after stop" + ); // Already-offline + raw-Active input: stop still lands the full triple // (the surviving `active` intent is the wake order that must die). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14726: spt_store::info::set_rest_state(&perch, "active", None).unwrap(); assert_eq!(cmd_stop(id), 0); let got = spt_store::info::read_info(&perch).unwrap(); - assert_eq!(got.status.as_deref(), Some(spt_store::liveness::STATUS_OFFLINE)); assert_eq!( + got.status.as_deref(), + Some(spt_store::liveness::STATUS_OFFLINE) + ); + assert_eq!( got.rest_state.as_deref(), Some("suspended"), "a stale raw-Active intent on an already-offline perch is normalized" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14778: let id = "askfirst"; let perch = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid", "live_agent"); + let mut rec = + spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid", "live_agent"); // Broker-hosted: the topology on which the stop leg is a real teardown. rec.controllable = Some(true); spt_store::info::write_info(&perch, &rec).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14802: "declining must leave the endpoint RUNNING — the stop leg is behind the confirm" ); assert_eq!( - spt_store::info::read_info(&perch).unwrap().status.as_deref(), + spt_store::info::read_info(&perch) + .unwrap() + .status + .as_deref(), Some(spt_store::liveness::STATUS_ONLINE), "a declined --force purge tears NOTHING down" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14818: purge_endpoint_core(id, true, || true).outcome, PurgeOutcome::Purged )); - assert!(!perch.exists(), "an accepted --force purge removes the perch"); + assert!( + !perch.exists(), + "an accepted --force purge removes the perch" + ); } // [int->REQ-ENDPOINT-PURGE] purge removes EVERY node-local record keyed on the id: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14882: v.save().unwrap(); } assert!( - spt_store::visibility::VisibilityStore::load().sync_subnets(id).is_some(), + spt_store::visibility::VisibilityStore::load() + .sync_subnets(id) + .is_some(), "visibility sync row exists pre-purge" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14891: // EVERY record gone. assert!(!perch.exists(), "the perch tree is gone"); - assert!(!psyche_perch.exists(), "the nested {id}-psyche perch is gone (recursive remove)"); assert!( + !psyche_perch.exists(), + "the nested {id}-psyche perch is gone (recursive remove)" + ); + assert!( spt_store::registry::lookup_address(id, &owlery).is_none(), "the registry address row is gone" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14918: "the access row is gone" ); assert!( - spt_store::visibility::VisibilityStore::load().sync_subnets(id).is_none(), + spt_store::visibility::VisibilityStore::load() + .sync_subnets(id) + .is_none(), "the visibility rows are gone" ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14947: // A relay listener registered → normal TCP delivery, NOT inject. let addr: std::net::SocketAddr = "127.0.0.1:6553".parse().unwrap(); spt_store::registry::register_address(id, &addr, &owlery).unwrap(); - assert!(!spt_daemon::is_spt_hosted_no_relay(id, &owlery), "a relay address takes the TCP path"); + assert!( + !spt_daemon::is_spt_hosted_no_relay(id, &owlery), + "a relay address takes the TCP path" + ); spt_store::registry::unregister_address(id, &owlery).unwrap(); // Not controllable (harness-hosted live agent) → not an inject target. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14954: rec.controllable = None; spt_store::info::write_info(&perch_path, &rec).unwrap(); spt_store::info::set_status(&perch_path, spt_store::liveness::STATUS_ONLINE).unwrap(); - assert!(!spt_daemon::is_spt_hosted_no_relay(id, &owlery), "non-controllable is not an inject target"); + assert!( + !spt_daemon::is_spt_hosted_no_relay(id, &owlery), + "non-controllable is not an inject target" + ); // Offline → not an inject target regardless. rec.controllable = Some(true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14961: spt_store::info::write_info(&perch_path, &rec).unwrap(); spt_store::info::set_status(&perch_path, spt_store::liveness::STATUS_OFFLINE).unwrap(); - assert!(!spt_daemon::is_spt_hosted_no_relay(id, &owlery), "offline is not an inject target"); + assert!( + !spt_daemon::is_spt_hosted_no_relay(id, &owlery), + "offline is not an inject target" + ); } // [unit->REQ-ENDPOINT-LIST-NODE-GROUPED] [unit->REQ-ENDPOINT-LIST-PALETTE] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:14998: let lines: Vec<&str> = out.lines().collect(); assert_eq!(lines.len(), 2); assert!(!out.contains('\t'), "no tab separators"); - assert!(!out.contains("\x1b["), "color=false ⇒ no SGR escape bytes: {out:?}"); + assert!( + !out.contains("\x1b["), + "color=false ⇒ no SGR escape bytes: {out:?}" + ); // #11/#15: both rows read ONLINE (the shared EpDisplay label), never a raw // wire word; the absent type renders `-`. assert!(lines[0].contains(" - "), "absent type renders as -: {out}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15005: assert!(lines[1].contains("live_agent"), "{out}"); - assert!(lines[0].contains("ONLINE") && lines[1].contains("ONLINE"), "{out}"); - assert!(!out.contains("Dormant") && !out.contains("Active"), "no raw {{:?}} status: {out}"); + assert!( + lines[0].contains("ONLINE") && lines[1].contains("ONLINE"), + "{out}" + ); + assert!( + !out.contains("Dormant") && !out.contains("Active"), + "no raw {{:?}} status: {out}" + ); // Alignment: the status label starts at the SAME column on every row despite // variable-width ids. let col = |line: &str, word: &str| line.find(word).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15015: ); // color=true wraps the square glyph in an SGR sequence (the picker palette). let colored = format_instance_rows(&cells, false, true); - assert!(colored.contains("\x1b["), "colored output carries SGR: {colored:?}"); + assert!( + colored.contains("\x1b["), + "colored output carries SGR: {colored:?}" + ); // [unit->REQ-ENDPOINT-LIST-RENDER-POLISH] A6 (c): the status GLYPH rides beside // the endpoint name — each row begins (past the indent) with the square glyph, // not the status word at the row end. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15025: "each row starts with the status glyph beside the name: {out}" ); // A6 (d): the status WORD carries the palette color (green ONLINE), not just the square. - assert!(colored.contains("\x1b[32mONLINE"), "status word colored: {colored:?}"); + assert!( + colored.contains("\x1b[32mONLINE"), + "status word colored: {colored:?}" + ); // --detail adds the resources column. let detailed = format_instance_rows(&cells, true, false); - assert!(detailed.contains("blurb"), "detail surfaces resources: {detailed}"); + assert!( + detailed.contains("blurb"), + "detail surfaces resources: {detailed}" + ); } // [unit->REQ-ENDPOINT-LIST-PROJECT-COL] #8: the second column renders each Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15048: }; let cells = vec![ // Two DISTINCT dirs that derive the same `spt-core` slug → disambiguated. - cell("a", Some(ProjectRef { id: "spt-core".into(), dir: "C:/x/projects/spt-core".into(), display: "spt-core".into() })), - cell("b", Some(ProjectRef { id: "spt-core".into(), dir: "D:/spt-core".into(), display: "spt-core".into() })), + cell( + "a", + Some(ProjectRef { + id: "spt-core".into(), + dir: "C:/x/projects/spt-core".into(), + display: "spt-core".into(), + }), + ), + cell( + "b", + Some(ProjectRef { + id: "spt-core".into(), + dir: "D:/spt-core".into(), + display: "spt-core".into(), + }), + ), // A unique project → bare `owl/`. - cell("c", Some(ProjectRef { id: "owl".into(), dir: "C:/x/owl".into(), display: "owl".into() })), + cell( + "c", + Some(ProjectRef { + id: "owl".into(), + dir: "C:/x/owl".into(), + display: "owl".into(), + }), + ), // No project known → `-`. cell("d", None), ]; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15058: let out = format_instance_rows(&cells, false, false); let lines: Vec<&str> = out.lines().collect(); - assert!(lines[0].contains("spt-core (projects)/"), "collision disambiguated by parent: {out}"); - assert!(lines[1].contains("spt-core (D:)/"), "collision disambiguated by drive: {out}"); - assert!(lines[2].contains(" owl/ "), "unique project renders bare id + slash: {out}"); - assert!(lines[3].contains(" - "), "unknown project renders '-': {out}"); + assert!( + lines[0].contains("spt-core (projects)/"), + "collision disambiguated by parent: {out}" + ); + assert!( + lines[1].contains("spt-core (D:)/"), + "collision disambiguated by drive: {out}" + ); + assert!( + lines[2].contains(" owl/ "), + "unique project renders bare id + slash: {out}" + ); + assert!( + lines[3].contains(" - "), + "unknown project renders '-': {out}" + ); // The project column sits between id and status (id / / / type / status). assert!( lines[2].find(" owl/").unwrap() < lines[2].find("ONLINE").unwrap(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15082: Some("spt-core"), "remote head = newest gossiped project" ); - assert_eq!(cell.project_ref.as_ref().map(|r| r.dir.as_str()), Some(""), "no dir on the wire"); + assert_eq!( + cell.project_ref.as_ref().map(|r| r.dir.as_str()), + Some(""), + "no dir on the wire" + ); row.recent_projects.clear(); assert!( instance_cell_from_resource(&row).project_ref.is_none(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15104: endpoint_type: None, project: project.map(str::to_string), }; - assert!(serde_json::to_string(&remote(Some("spt-core"))).unwrap().contains("\"project\":\"spt-core\"")); - assert!(!serde_json::to_string(&remote(None)).unwrap().contains("project"), "None omits the key"); + assert!(serde_json::to_string(&remote(Some("spt-core"))) + .unwrap() + .contains("\"project\":\"spt-core\"")); + assert!( + !serde_json::to_string(&remote(None)) + .unwrap() + .contains("project"), + "None omits the key" + ); let local = |project: Option<&str>| LocalPerchJson { id: "e".into(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15117: project: project.map(str::to_string), activity: None, }; - assert!(serde_json::to_string(&local(Some("owl"))).unwrap().contains("\"project\":\"owl\"")); - assert!(!serde_json::to_string(&local(None)).unwrap().contains("project"), "None omits the key"); + assert!(serde_json::to_string(&local(Some("owl"))) + .unwrap() + .contains("\"project\":\"owl\"")); + assert!( + !serde_json::to_string(&local(None)) + .unwrap() + .contains("project"), + "None omits the key" + ); } /// A LocalPerchJson with everything but `activity` fixed — the roster-survey Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15200: } // Build a gossiped ResourceRow for the node-grouped tests below. - fn res_row(id: &str, node: &str, label: &str, status: spt_net::net::registry::Status, epoch: u64) -> spt_net::net::registry::ResourceRow { + fn res_row( + id: &str, + node: &str, + label: &str, + status: spt_net::net::registry::Status, + epoch: u64, + ) -> spt_net::net::registry::ResourceRow { spt_net::net::registry::ResourceRow { endpoint_id: id.into(), node: node.into(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15207: status, resources: None, - node_label: if label.is_empty() { None } else { Some(label.into()) }, + node_label: if label.is_empty() { + None + } else { + Some(label.into()) + }, bound: true, controller_node: None, harness_only: false, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15227: fn node_group_same_id_two_nodes_two_groups() { use spt_net::net::registry::Status; let tagged = vec![ - ("home".to_string(), res_row("dup", "aaaa1111", "ALPHA", Status::Active, 1)), - ("home".to_string(), res_row("dup", "bbbb2222", "BRAVO", Status::Active, 1)), + ( + "home".to_string(), + res_row("dup", "aaaa1111", "ALPHA", Status::Active, 1), + ), + ( + "home".to_string(), + res_row("dup", "bbbb2222", "BRAVO", Status::Active, 1), + ), ]; let groups = group_remote_nodes("selfnode", tagged); assert_eq!(groups.len(), 2, "two nodes → two groups: {groups:?}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15244: spt_net::net::registry::node_label_display("aaaa1111", Some("ALPHA")), "canonical LABEL (keyprefix…): {groups:?}" ); - assert!(groups[0].node_display.starts_with("ALPHA (") && groups[0].node_display.contains('…')); + assert!( + groups[0].node_display.starts_with("ALPHA (") && groups[0].node_display.contains('…') + ); assert!(groups[1].node_display.contains("BRAVO"), "{groups:?}"); - assert_ne!(groups[0].node_display, "aaaa1111", "must not leak bare key-hex"); + assert_ne!( + groups[0].node_display, "aaaa1111", + "must not leak bare key-hex" + ); } // [unit->REQ-ENDPOINT-LIST-NODE-GROUPED] the freshest-epoch twin rule: the SAME Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15259: use spt_net::net::registry::Status; // bignet: stale (epoch 1) Suspended; sptdev: fresh (epoch 5) Active. let tagged = vec![ - ("bignet".to_string(), res_row("eel", "node00hex", "REMOTE", Status::Suspended, 1)), - ("sptdev".to_string(), res_row("eel", "node00hex", "REMOTE", Status::Active, 5)), + ( + "bignet".to_string(), + res_row("eel", "node00hex", "REMOTE", Status::Suspended, 1), + ), + ( + "sptdev".to_string(), + res_row("eel", "node00hex", "REMOTE", Status::Active, 5), + ), ]; let groups = group_remote_nodes("selfnode", tagged); assert_eq!(groups.len(), 1, "one node group"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15267: let g = &groups[0]; assert_eq!(g.cells.len(), 1, "subnet duplication collapsed to one row"); // The fresher (epoch 5, Active→Online) status wins over the stale Suspended. - assert_eq!(g.cells[0].display, EpDisplay::Online, "freshest epoch status wins"); + assert_eq!( + g.cells[0].display, + EpDisplay::Online, + "freshest epoch status wins" + ); // Both subnets unioned, sorted. - assert_eq!(g.shared_subnets, vec!["bignet".to_string(), "sptdev".to_string()]); + assert_eq!( + g.shared_subnets, + vec!["bignet".to_string(), "sptdev".to_string()] + ); } // [unit->REQ-ENDPOINT-LIST-NODE-GROUPED] this node's OWN gossip rows are Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15280: use spt_net::net::registry::Status; let tagged = vec![ // A row authored by THIS node — must be dropped. - ("home".to_string(), res_row("mine", "selfnode", "ME", Status::Active, 1)), + ( + "home".to_string(), + res_row("mine", "selfnode", "ME", Status::Active, 1), + ), // A genuine remote row — kept. - ("home".to_string(), res_row("theirs", "remotehex", "THEM", Status::Active, 1)), + ( + "home".to_string(), + res_row("theirs", "remotehex", "THEM", Status::Active, 1), + ), ]; let groups = group_remote_nodes("selfnode", tagged); assert_eq!(groups.len(), 1, "only the remote node forms a group"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15289: assert!(groups[0].node_display.contains("THEM")); - assert!(groups[0].cells.iter().all(|c| c.id == "theirs"), "self row discarded"); + assert!( + groups[0].cells.iter().all(|c| c.id == "theirs"), + "self row discarded" + ); } // [unit->REQ-ENDPOINT-LIST-NODE-GROUPED] the whole node-grouped render: This Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15325: let plain = render_node_grouped("HOST (a1b2…)", &our, &this, &remote, false, false, false); assert!(!plain.contains("\x1b["), "color off ⇒ no SGR: {plain:?}"); // This node FIRST, then the remote node. - let this_at = plain.find("This node: HOST (a1b2…)").expect("This-node header"); + let this_at = plain + .find("This node: HOST (a1b2…)") + .expect("This-node header"); let rem_at = plain.find("REMOTE (dead…)").expect("remote header"); - assert!(this_at < rem_at, "This node renders before the remote node: {plain}"); + assert!( + this_at < rem_at, + "This node renders before the remote node: {plain}" + ); // Our joined subnets under This node; unioned subnets under the remote. assert!(plain.contains("Shared subnets: bignet, sptdev"), "{plain}"); // Per-node Total lines; NO grand total, NO ENDPOINTS line. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15334: - assert_eq!(plain.matches("Total:").count(), 2, "one Total per node: {plain}"); + assert_eq!( + plain.matches("Total:").count(), + 2, + "one Total per node: {plain}" + ); assert!(plain.contains(" Total: 1\n"), "{plain}"); - assert!(!plain.contains("ENDPOINTS:"), "the stderr ENDPOINTS line is removed: {plain}"); - assert!(!plain.to_lowercase().contains("grand total"), "no grand total: {plain}"); + assert!( + !plain.contains("ENDPOINTS:"), + "the stderr ENDPOINTS line is removed: {plain}" + ); + assert!( + !plain.to_lowercase().contains("grand total"), + "no grand total: {plain}" + ); // Color ON: cyan This-node header + orange remote header. let colored = render_node_grouped("HOST (a1b2…)", &our, &this, &remote, false, false, true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15341: - assert!(colored.contains("\x1b[36mThis node: HOST (a1b2…)\x1b[0m"), "cyan This node: {colored:?}"); - assert!(colored.contains("\x1b[38;5;208mREMOTE (dead…)\x1b[0m"), "orange remote: {colored:?}"); + assert!( + colored.contains("\x1b[36mThis node: HOST (a1b2…)\x1b[0m"), + "cyan This node: {colored:?}" + ); + assert!( + colored.contains("\x1b[38;5;208mREMOTE (dead…)\x1b[0m"), + "orange remote: {colored:?}" + ); } // [unit->REQ-ENDPOINT-LIST-MERGE-LOCAL] [unit->REQ-ENDPOINT-LIST-NODE-IDENT] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15391: false, false, ); - assert!(out.contains("This node: hfenduleam (a1b2…)"), "header names this node: {out}"); - assert!(out.contains("freshself") && out.contains("skeleton"), "both perches listed: {out}"); - assert!(out.contains("UNBOUND"), "the unbound seat carries the UNBOUND label: {out}"); - assert!(out.contains(" Total: 2\n"), "this-node Total counts the roster: {out}"); + assert!( + out.contains("This node: hfenduleam (a1b2…)"), + "header names this node: {out}" + ); + assert!( + out.contains("freshself") && out.contains("skeleton"), + "both perches listed: {out}" + ); + assert!( + out.contains("UNBOUND"), + "the unbound seat carries the UNBOUND label: {out}" + ); + assert!( + out.contains(" Total: 2\n"), + "this-node Total counts the roster: {out}" + ); // Empty roster ⇒ header + quiet marker, Total 0. let empty = render_node_grouped("somenode (dead…)", &[], &[], &[], false, false, false); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15401: assert!(empty.contains("This node: somenode (dead…)")); - assert!(empty.contains("(no local perches)"), "empty roster ⇒ quiet marker: {empty}"); + assert!( + empty.contains("(no local perches)"), + "empty roster ⇒ quiet marker: {empty}" + ); assert!(empty.contains(" Total: 0\n"), "{empty}"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15435: ids.contains(&"online") && ids.contains(&"broken"), "corrupt ALWAYS shows: {ids:?}" ); - assert!(!ids.contains(&"resting"), "plain suspended hidden by default: {ids:?}"); + assert!( + !ids.contains(&"resting"), + "plain suspended hidden by default: {ids:?}" + ); let (all, hidden_all) = filter_and_order(&cells, true); assert_eq!(hidden_all, 0, "show_all hides nothing"); assert_eq!(all.len(), 3, "show_all reveals the resting row too"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15476: fn rest_filter_total_disclosure_and_corrupt_annotation() { use crate::picker::model::EpDisplay; // color=false → plain body (no SGR); A6 (b) adds the dim wrap only under color. - assert_eq!(render_total(2, 3, false), " Total: 2 (+3 suspended hidden)\n"); + assert_eq!( + render_total(2, 3, false), + " Total: 2 (+3 suspended hidden)\n" + ); assert_eq!(render_total(2, 0, false), " Total: 2\n"); // [unit->REQ-ENDPOINT-LIST-RENDER-POLISH] A6 (b): under color the Total takes // the dim-gray SGR 90 chrome, same as the Shared-subnets line. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15483: - assert!(render_total(2, 0, true).contains("\x1b[90m"), "Total dim under color"); + assert!( + render_total(2, 0, true).contains("\x1b[90m"), + "Total dim under color" + ); let corrupt = vec![icell("broken", EpDisplay::Offline, true)]; let out = format_instance_rows(&corrupt, false, false); assert!(out.contains("CORRUPT"), "corrupt row annotated: {out}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15505: project: None, }; let s = serde_json::to_string(&with).unwrap(); - assert!(s.contains("\"endpoint_type\":\"live_agent\""), "advertised type present: {s}"); + assert!( + s.contains("\"endpoint_type\":\"live_agent\""), + "advertised type present: {s}" + ); let without = EndpointRowJson { id: "x".into(), node: "n".into(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15546: ); } - // [unit->REQ-UPD-9] the gh_release version-compare decision: a strictly-newer // latest release ripples (update), a same/older one does not (skip). Dotted // numeric ordering with missing components as 0; an unparseable tag is treated Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15594: // Pack the archive with the same `tar` the extractor unpacks with. let archive = tmp.path().join("adapter.spt"); let keys = std::collections::BTreeMap::from([ - ("archive".to_string(), archive.to_string_lossy().into_owned()), + ( + "archive".to_string(), + archive.to_string_lossy().into_owned(), + ), ("src".to_string(), src.to_string_lossy().into_owned()), ]); spt_runtime::run_bounded_command( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15636: .unwrap(); let archive = tmp.join(format!("{name}.spt")); let keys = std::collections::BTreeMap::from([ - ("archive".to_string(), archive.to_string_lossy().into_owned()), + ( + "archive".to_string(), + archive.to_string_lossy().into_owned(), + ), ("src".to_string(), src.to_string_lossy().into_owned()), ]); spt_runtime::run_bounded_command( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15664: assert!(!dest.exists(), "precondition: dest starts absent"); let res = staged_floor_ok(&archive, &dest, "hifloor"); - assert!(res.is_err(), "a staged floor above the core must refuse the swap"); + assert!( + res.is_err(), + "a staged floor above the core must refuse the swap" + ); let msg = res.unwrap_err(); assert!( msg.contains("9.9.9") && msg.contains("hifloor"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15672: ); // The live home was never touched, and the throwaway peek dir is gone. - assert!(!dest.exists(), "a refused peek must NOT create the live dest home"); assert!( + !dest.exists(), + "a refused peek must NOT create the live dest home" + ); + assert!( !dest.with_extension("floor-peek").exists(), "the throwaway .floor-peek temp is removed on exit" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15689: let dest = tmp.path().join("live-home"); let res = staged_floor_ok(&archive, &dest, "lofloor"); - assert!(res.is_ok(), "a staged floor the core clears must peek OK: {res:?}"); + assert!( + res.is_ok(), + "a staged floor the core clears must peek OK: {res:?}" + ); assert!(!dest.exists(), "the peek never writes dest, even on Ok"); assert!( !dest.with_extension("floor-peek").exists(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15714: #[test] fn bare_tty_guard() { assert_eq!(decide_bare(true, true), BareAction::Picker); - assert_eq!(decide_bare(false, true), BareAction::Help, "piped stdin → help"); - assert_eq!(decide_bare(true, false), BareAction::Help, "redirected stdout → help"); - assert_eq!(decide_bare(false, false), BareAction::Help, "CI/non-tty → help"); + assert_eq!( + decide_bare(false, true), + BareAction::Help, + "piped stdin → help" + ); + assert_eq!( + decide_bare(true, false), + BareAction::Help, + "redirected stdout → help" + ); + assert_eq!( + decide_bare(false, false), + BareAction::Help, + "CI/non-tty → help" + ); } // [unit->REQ-MSG-5] the LOCAL origination gate: a bare CLI (no agent Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15791: let p = parse_event(&body).expect("composed a typed envelope"); assert_eq!(p.event_type.as_deref(), Some("msg")); assert_eq!(p.from(), Some("me")); - assert_eq!(p.body, "hello", "json rides ALONGSIDE the body, never replacing it"); - assert_eq!(p.attr("json"), Some(r#"{"k":"v"}"#), "json attr round-trips"); + assert_eq!( + p.body, "hello", + "json rides ALONGSIDE the body, never replacing it" + ); + assert_eq!( + p.attr("json"), + Some(r#"{"k":"v"}"#), + "json attr round-trips" + ); // user-msg + json: honored type carries the json attr too. let (body, _) = apply_user_msg_gate(None, "me", "ship", true, Some(r#"{"n":1}"#)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15801: assert_eq!(p.attr("json"), Some(r#"{"n":1}"#)); // A json value with a quote attr-escapes (no envelope corruption / forgery). - let (body, _) = - apply_user_msg_gate(None, "me", "x", false, Some(r#"{"q":"a\"b","from":"evil"}"#)); + let (body, _) = apply_user_msg_gate( + None, + "me", + "x", + false, + Some(r#"{"q":"a\"b","from":"evil"}"#), + ); let p = parse_event(&body).expect("attr-escaped json parses cleanly"); - assert_eq!(p.from(), Some("me"), "the real from is intact — json can't forge it"); + assert_eq!( + p.from(), + Some("me"), + "the real from is intact — json can't forge it" + ); assert_eq!(p.body, "x"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15905: assert!(matches!( parse(&["spt", "send", "bob", "--from", "alice"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Send { .. } )); assert!(matches!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15912: - parse(&["spt", "send", "bob", "--active-only"]).unwrap().cmd.unwrap(), - Cmd::Send { active_only: true, .. } + parse(&["spt", "send", "bob", "--active-only"]) + .unwrap() + .cmd + .unwrap(), + Cmd::Send { + active_only: true, + .. + } )); assert!(matches!( - parse(&["spt", "send", "bob", "--idle-only", "--ephemeral"]).unwrap().cmd.unwrap(), - Cmd::Send { idle_only: true, ephemeral: true, .. } + parse(&["spt", "send", "bob", "--idle-only", "--ephemeral"]) + .unwrap() + .cmd + .unwrap(), + Cmd::Send { + idle_only: true, + ephemeral: true, + .. + } )); // --idle-only and --active-only are mutually exclusive. assert!(parse(&["spt", "send", "bob", "--idle-only", "--active-only"]).is_err()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15921: // Hidden back-compat alias: the old `--deferred` still parses → active_only. assert!(matches!( - parse(&["spt", "send", "bob", "--deferred"]).unwrap().cmd.unwrap(), - Cmd::Send { active_only: true, .. } + parse(&["spt", "send", "bob", "--deferred"]) + .unwrap() + .cmd + .unwrap(), + Cmd::Send { + active_only: true, + .. + } )); // W3 channel axis: --prefer-native / --force-native, mutually exclusive, // composing with the window axis (--force-native --active-only is valid). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15928: assert!(matches!( - parse(&["spt", "send", "bob", "--prefer-native"]).unwrap().cmd.unwrap(), - Cmd::Send { prefer_native: true, .. } + parse(&["spt", "send", "bob", "--prefer-native"]) + .unwrap() + .cmd + .unwrap(), + Cmd::Send { + prefer_native: true, + .. + } )); assert!(matches!( - parse(&["spt", "send", "bob", "--force-native", "--active-only"]).unwrap().cmd.unwrap(), - Cmd::Send { force_native: true, active_only: true, .. } + parse(&["spt", "send", "bob", "--force-native", "--active-only"]) + .unwrap() + .cmd + .unwrap(), + Cmd::Send { + force_native: true, + active_only: true, + .. + } )); assert!(parse(&["spt", "send", "bob", "--prefer-native", "--force-native"]).is_err()); // W4 metadata axis: --json-payload carries an opaque blob. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15938: assert!(matches!( - parse(&["spt", "send", "bob", "--json-payload", "{\"k\":1}"]).unwrap().cmd.unwrap(), - Cmd::Send { json_payload: Some(_), .. } + parse(&["spt", "send", "bob", "--json-payload", "{\"k\":1}"]) + .unwrap() + .cmd + .unwrap(), + Cmd::Send { + json_payload: Some(_), + .. + } )); assert!(matches!( parse(&["spt", "ring", "bob", "--timeout", "5"]) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15944: .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Ring { .. } )); assert!(matches!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15952: // [unit->REQ-MSG-2] `ready --once` absorbs the removed `poll`'s // drain-then-exit semantics (M7 plan decision 2); `poll` itself is gone. assert!(matches!( - parse(&["spt", "ready", "bob", "--once"]).unwrap().cmd.unwrap(), + parse(&["spt", "ready", "bob", "--once"]) + .unwrap() + .cmd + .unwrap(), Cmd::Ready { once: true, .. } )); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15970: // and omits it (no trailing separator) when the blurb is absent or blank. #[test] fn self_pin_includes_description_when_present() { - let with = - render_self_pin("ling", "Ready ready=true alive=true", Some("triage bot"), None, None, None); - assert!(with.starts_with("SELF: ling "), "id-first SELF pin: {with}"); + let with = render_self_pin( + "ling", + "Ready ready=true alive=true", + Some("triage bot"), + None, + None, + None, + ); + assert!( + with.starts_with("SELF: ling "), + "id-first SELF pin: {with}" + ); assert!(with.contains("triage bot"), "description rendered: {with}"); // Absent / blank blurb → no description, no dangling separator. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15979: let without = render_self_pin("ling", "Ready", None, None, None, None); assert_eq!(without, "SELF: ling Ready"); let blank = render_self_pin("ling", "Ready", Some(" "), None, None, None); - assert_eq!(blank, "SELF: ling Ready", "whitespace blurb treated as absent"); + assert_eq!( + blank, "SELF: ling Ready", + "whitespace blurb treated as absent" + ); // [unit->REQ-ENDPOINT-LIST-NODE-GROUPED] the SELF pin names THIS node with a // `(self @ )` marker (the node-grouped view pins SELF first, naming its Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15986: // home node inline); a blank/absent node adds no marker. - let pinned = - render_self_pin("ling", "Ready", Some("triage bot"), Some("HFENDULEAM (a1b2…)"), None, None); + let pinned = render_self_pin( + "ling", + "Ready", + Some("triage bot"), + Some("HFENDULEAM (a1b2…)"), + None, + None, + ); assert!( pinned.contains("(self @ HFENDULEAM (a1b2…))"), "the pin names this node: {pinned}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:15992: ); // The marker rides the SELF identity line (not a separate line). - assert_eq!(pinned.lines().count(), 1, "marker stays on the SELF line: {pinned}"); + assert_eq!( + pinned.lines().count(), + 1, + "marker stays on the SELF line: {pinned}" + ); let unmarked = render_self_pin("ling", "Ready", None, Some(" "), None, None); assert_eq!(unmarked, "SELF: ling Ready", "a blank node adds no marker"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16015: Some(&err), None, ); - assert!(out.contains("online"), "status still rendered authoritatively: {out}"); - assert!(out.contains("psyche-host: FAILED"), "failure annotated: {out}"); - assert!(out.contains("psychebin: program not found"), "reason inline: {out}"); - assert!(out.contains("3 attempts"), "attempts inline (pluralized): {out}"); + assert!( + out.contains("online"), + "status still rendered authoritatively: {out}" + ); + assert!( + out.contains("psyche-host: FAILED"), + "failure annotated: {out}" + ); + assert!( + out.contains("psychebin: program not found"), + "reason inline: {out}" + ); + assert!( + out.contains("3 attempts"), + "attempts inline (pluralized): {out}" + ); assert!(out.contains("2026-06-16T00:00:00Z"), "ts inline: {out}"); // attempts == 1 → singular "attempt". Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16032: // No error → no annotation line. let clean = render_self_pin("ling", "live_agent", None, None, None, None); - assert!(!clean.contains("psyche-host"), "no annotation when clean: {clean}"); + assert!( + !clean.contains("psyche-host"), + "no annotation when clean: {clean}" + ); } // [unit->REQ-PUBLIC-ERROR-SURFACES] F-1 (the F-030 seed): a broker-stamped Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16050: None, Some("inject worker panicked"), ); - assert!(out.contains("input-translation: FAILED"), "fault annotated: {out}"); - assert!(out.contains("inject worker panicked"), "reason inline: {out}"); + assert!( + out.contains("input-translation: FAILED"), + "fault annotated: {out}" + ); + assert!( + out.contains("inject worker panicked"), + "reason inline: {out}" + ); assert!(out.contains("spt endpoint run"), "next action named: {out}"); // Composes with the psyche-host annotation (both lines, order stable). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16065: // Blank fault → treated as absent. let blank = render_self_pin("ling", "live_agent", None, None, None, Some(" ")); - assert!(!blank.contains("input-translation"), "blank fault adds no line: {blank}"); + assert!( + !blank.contains("input-translation"), + "blank fault adds no line: {blank}" + ); } // [unit->REQ-WHOAMI-1] whoami stays a top-level hot-path verb (parse Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16174: assert!(matches!( parse(&["spt", "endpoint", "list", "--subnet", "home", "--detail"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::List { subnet: Some(_), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16191: assert!(matches!( parse(&["spt", "endpoint", "rename", "ling", "oak"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Rename { .. }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16212: "work" ]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Fork { delete_source: false, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16226: ); // [unit->REQ-INST-3] the resting verbs (one local id). assert!(matches!( - parse(&["spt", "endpoint", "suspend", "ling"]).unwrap().cmd.unwrap(), + parse(&["spt", "endpoint", "suspend", "ling"]) + .unwrap() + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Suspend { .. }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16233: )); assert!(matches!( - parse(&["spt", "endpoint", "wake", "ling"]).unwrap().cmd.unwrap(), + parse(&["spt", "endpoint", "wake", "ling"]) + .unwrap() + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Wake { .. }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16239: )); // [unit->REQ-SHELL-2] shutdown with and without the self-default id. assert!(matches!( - parse(&["spt", "endpoint", "shutdown"]).unwrap().cmd.unwrap(), + parse(&["spt", "endpoint", "shutdown"]) + .unwrap() + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Shutdown { id: None }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16246: )); assert!(matches!( - parse(&["spt", "endpoint", "stop", "bob"]).unwrap().cmd.unwrap(), + parse(&["spt", "endpoint", "stop", "bob"]) + .unwrap() + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Stop { .. }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16273: "ling" ]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Description { action: Some(DescriptionCmd::Set { .. }) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16281: } )); assert!(matches!( - parse(&["spt", "endpoint", "description"]).unwrap().cmd.unwrap(), + parse(&["spt", "endpoint", "description"]) + .unwrap() + .cmd + .unwrap(), Cmd::Endpoint { action: Some(EndpointCmd::Description { action: None }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16314: } )); assert!(matches!( - parse(&["spt", "daemon", "run", "--detached"]).unwrap().cmd.unwrap(), + parse(&["spt", "daemon", "run", "--detached"]) + .unwrap() + .cmd + .unwrap(), Cmd::Daemon { action: Some(DaemonCmd::Run { detached: true }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16333: } )); assert!(matches!( - parse(&["spt", "daemon", "stop", "--force"]).unwrap().cmd.unwrap(), + parse(&["spt", "daemon", "stop", "--force"]) + .unwrap() + .cmd + .unwrap(), Cmd::Daemon { action: Some(DaemonCmd::Stop { force: true }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16377: use std::cell::Cell; // Session already up ⇒ true on the first check, NO sleeps. let sleeps = Cell::new(0u32); - assert!(poll_until_ready(|| true, 5, || sleeps.set(sleeps.get() + 1))); + assert!(poll_until_ready( + || true, + 5, + || sleeps.set(sleeps.get() + 1) + )); assert_eq!(sleeps.get(), 0, "no sleep when the session is already up"); // No session ever ⇒ false (timeout): every attempt checked, slept between. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16393: ); assert!(!out, "no session ⇒ timeout false"); assert_eq!(checks.get(), 4, "checked every attempt"); - assert_eq!(sleeps.get(), 3, "slept between attempts only (never after the last)"); + assert_eq!( + sleeps.get(), + 3, + "slept between attempts only (never after the last)" + ); // Session appears on a later attempt ⇒ true. let n = Cell::new(0u32); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16405: 5, || {} )); - assert_eq!(n.get(), 3, "stopped polling the moment the session appeared"); + assert_eq!( + n.get(), + 3, + "stopped polling the moment the session appeared" + ); } // [unit->REQ-NOTIF-2] the notify/notif surfaces parse: `subnet notify` Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16425: "doyle" ]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Subnet { action: Some(SubnetCmd::Notify { .. }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16439: assert!(matches!( parse(&["spt", "notif", "list", "--subnet", "home"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Notif { action: NotifCmd::List { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16446: )); assert!(matches!( - parse(&["spt", "notif", "dismiss", "cafe:7"]).unwrap().cmd.unwrap(), + parse(&["spt", "notif", "dismiss", "cafe:7"]) + .unwrap() + .cmd + .unwrap(), Cmd::Notif { action: NotifCmd::Dismiss { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16580: assert!(matches!( parse(&["spt", "grant", "add", "owner-shutdown", "ling"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Grant { action: GrantCmd::Add { qualifier: None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16591: assert!(matches!( parse(&["spt", "grant", "revoke", "spawn-shell", "ling"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Grant { action: GrantCmd::Revoke { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16603: } )); assert!(matches!( - parse(&["spt", "grant", "list", "ling"]).unwrap().cmd.unwrap(), + parse(&["spt", "grant", "list", "ling"]) + .unwrap() + .cmd + .unwrap(), Cmd::Grant { action: GrantCmd::List { agent: Some(_) } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16695: assert!(matches!( parse(&["spt", "adapter", "add", "C:/adapters/mock"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Adapter { action: AdapterCmd::Add { path: Some(_), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16708: assert!(matches!( parse(&["spt", "adapter", "add", "--github", "user/repo"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Adapter { action: AdapterCmd::Add { path: None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16721: // [unit->REQ-INSTALL-9] the release-archive source parses with its tag // and asset modifiers. assert!(matches!( - parse(&["spt", "adapter", "add", "--release", "user/repo", "--tag", "v1.0.0"]) - .unwrap() - .cmd.unwrap(), + parse(&[ + "spt", + "adapter", + "add", + "--release", + "user/repo", + "--tag", + "v1.0.0" + ]) + .unwrap() + .cmd + .unwrap(), Cmd::Adapter { action: AdapterCmd::Add { path: None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16737: match parse(&["spt", "adapter", "remove", "mock-shell", "--force"]) .unwrap() .cmd - .unwrap() + .unwrap() { Cmd::Adapter { action: AdapterCmd::Remove { name, force }, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16753: action: AdapterCmd::List } )); - match parse(&["spt", "adapter", "create-profile", "claude-spt", "work", "--from", "o.toml"]) - .unwrap() - .cmd + match parse(&[ + "spt", + "adapter", + "create-profile", + "claude-spt", + "work", + "--from", + "o.toml", + ]) .unwrap() + .cmd + .unwrap() { Cmd::Adapter { - action: AdapterCmd::CreateProfile { adapter, name, from }, + action: + AdapterCmd::CreateProfile { + adapter, + name, + from, + }, } => { assert_eq!((adapter.as_str(), name.as_str()), ("claude-spt", "work")); assert_eq!(from.as_deref(), Some("o.toml")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16767: _ => panic!("expected Adapter CreateProfile"), } assert!(matches!( - parse(&["spt", "adapter", "delete-profile", "claude-spt", "work"]).unwrap().cmd.unwrap(), + parse(&["spt", "adapter", "delete-profile", "claude-spt", "work"]) + .unwrap() + .cmd + .unwrap(), Cmd::Adapter { action: AdapterCmd::DeleteProfile { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16776: // `adapter` and nowhere else: a bare `spt service` must not parse, because // "service" already means the OS service manager hosting the daemon. assert!(matches!( - parse(&["spt", "adapter", "service", "list"]).unwrap().cmd.unwrap(), + parse(&["spt", "adapter", "service", "list"]) + .unwrap() + .cmd + .unwrap(), Cmd::Adapter { action: AdapterCmd::Service { action: AdapterServiceCmd::List Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16789: .unwrap() { Cmd::Adapter { - action: AdapterCmd::Service { - action: AdapterServiceCmd::Status { option }, - }, + action: + AdapterCmd::Service { + action: AdapterServiceCmd::Status { option }, + }, } => assert_eq!(option, "hub:staging"), _ => panic!("expected Adapter Service Status"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16799: parse(&["spt", "service", "list"]).is_err(), "a bare `spt service` must not exist — the verb group is adapter-scoped" ); - match parse(&["spt", "adapter", "digest-proof", "claude-spt", "--sample", "log.jsonl"]) - .unwrap() - .cmd + match parse(&[ + "spt", + "adapter", + "digest-proof", + "claude-spt", + "--sample", + "log.jsonl", + ]) .unwrap() + .cmd + .unwrap() { Cmd::Adapter { - action: AdapterCmd::DigestProof { option, sample, session, dir, manifest }, + action: + AdapterCmd::DigestProof { + option, + sample, + session, + dir, + manifest, + }, } => { assert_eq!(option, "claude-spt"); assert_eq!(sample.as_deref(), Some("log.jsonl")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16840: spt_runtime::registry::register(&adapters, &d, 1).unwrap(); let proof = |sample: &std::path::Path| { - cmd_adapter_digest_proof(&adapters, "cc", Some(sample.to_str().unwrap()), None, None, None) + cmd_adapter_digest_proof( + &adapters, + "cc", + Some(sample.to_str().unwrap()), + None, + None, + None, + ) }; // A clean contract sample → proof passes. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16869: std::fs::write(pd.join("manifest.toml"), nodig).unwrap(); spt_runtime::registry::register(&adapters, &pd, 1).unwrap(); assert_eq!( - cmd_adapter_digest_proof(&adapters, "plain", Some(good.to_str().unwrap()), None, None, None), + cmd_adapter_digest_proof( + &adapters, + "plain", + Some(good.to_str().unwrap()), + None, + None, + None + ), 2, "no [digest] section → exit 2" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16912: // BEFORE F-004: this hard-failed with "no value for substitution key // {session_id}". Now the default placeholder resolves and the proof runs. assert_eq!( - cmd_adapter_digest_proof(&adapters, "cc", Some(good.to_str().unwrap()), None, None, None), + cmd_adapter_digest_proof( + &adapters, + "cc", + Some(good.to_str().unwrap()), + None, + None, + None + ), 0, "a session_id-templated extractor proofs with the default placeholder" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16919: // An explicit --session pins the id (same successful path). assert_eq!( - cmd_adapter_digest_proof(&adapters, "cc", Some(good.to_str().unwrap()), Some("sessA"), None, None), + cmd_adapter_digest_proof( + &adapters, + "cc", + Some(good.to_str().unwrap()), + Some("sessA"), + None, + None + ), 0, "--session pins the id and still proofs" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16942: .unwrap() { Cmd::Adapter { - action: AdapterCmd::TranslateProof { option, event, session, dir, manifest }, + action: + AdapterCmd::TranslateProof { + option, + event, + session, + dir, + manifest, + }, } => { assert_eq!(option, "claude-spt"); assert_eq!(event, ""); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:16993: .parent() .and_then(|deps| deps.parent()) .expect("target profile dir"); - profile_dir.join(format!("translate_proof_fixture{}", std::env::consts::EXE_SUFFIX)) + profile_dir.join(format!( + "translate_proof_fixture{}", + std::env::consts::EXE_SUFFIX + )) } // [unit->REQ-ADAPTER-TRANSLATE-PROOF] translate-proof drives the REAL Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17082: spt_runtime::registry::register(&adapters, &d, 1).unwrap(); let create = |adapter: &str, name: &str, from: Option<&str>| { - cmd_adapter(AdapterCmd::CreateProfile { - adapter: adapter.into(), - name: name.into(), - from: from.map(str::to_string), - }, false) + cmd_adapter( + AdapterCmd::CreateProfile { + adapter: adapter.into(), + name: name.into(), + from: from.map(str::to_string), + }, + false, + ) }; // A tighten-only local overlay from a file: created. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17093: let overlay = spt_store::perch::spt_home().join("work.toml"); std::fs::write(&overlay, "[shell]\nrequire_approval = \"always\"\n").unwrap(); - assert_eq!(create("claude-spt", "work", Some(overlay.to_str().unwrap())), 0); assert_eq!( + create("claude-spt", "work", Some(overlay.to_str().unwrap())), + 0 + ); + assert_eq!( spt_runtime::registry::local_profile_names(&adapters, "claude-spt"), vec!["work"] ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17100: // Shadowing a shipped name refuses; a floor-loosening overlay refuses. - assert_eq!(create("claude-spt", "locked", None), 1, "shipped-name shadow refused"); + assert_eq!( + create("claude-spt", "locked", None), + 1, + "shipped-name shadow refused" + ); let loose = spt_store::perch::spt_home().join("loose.toml"); std::fs::write(&loose, "[shell]\nrequire_approval = \"none\"\n").unwrap(); - assert_eq!(create("claude-spt", "loose", Some(loose.to_str().unwrap())), 1, "loosen refused"); + assert_eq!( + create("claude-spt", "loose", Some(loose.to_str().unwrap())), + 1, + "loosen refused" + ); // list renders adjacent (shipped + local) and returns 0. assert_eq!(cmd_adapter(AdapterCmd::List, false), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17109: // delete-profile: a shipped name is immutable; the local is removed. let del = |name: &str| { - cmd_adapter(AdapterCmd::DeleteProfile { - adapter: "claude-spt".into(), - name: name.into(), - }, false) + cmd_adapter( + AdapterCmd::DeleteProfile { + adapter: "claude-spt".into(), + name: name.into(), + }, + false, + ) }; assert_eq!(del("locked"), 1, "shipped profile is immutable"); assert_eq!(del("work"), 0, "local removed"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17135: // `use` points the declared host binary at the adapter. assert_eq!( - cmd_adapter(AdapterCmd::Use { target: "claude-spt".into(), clear: false }, false), + cmd_adapter( + AdapterCmd::Use { + target: "claude-spt".into(), + clear: false + }, + false + ), 0 ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17142: - spt_runtime::resolve::load(&adapters).0.get("claude").map(String::as_str), + spt_runtime::resolve::load(&adapters) + .0 + .get("claude") + .map(String::as_str), Some("claude-spt") ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17146: // An unregistered target fails — nothing pinned. assert_eq!( - cmd_adapter(AdapterCmd::Use { target: "ghost".into(), clear: false }, false), + cmd_adapter( + AdapterCmd::Use { + target: "ghost".into(), + clear: false + }, + false + ), 1 ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17152: // `--clear` drops the pointer. assert_eq!( - cmd_adapter(AdapterCmd::Use { target: "claude-spt".into(), clear: true }, false), + cmd_adapter( + AdapterCmd::Use { + target: "claude-spt".into(), + clear: true + }, + false + ), 0 ); assert!(spt_runtime::resolve::load(&adapters).0.is_empty()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17172: spt_runtime::registry::register(&adapters, &d, 1).unwrap(); let get = |opt: &str, key: &str| { - cmd_adapter(AdapterCmd::GetString { option: opt.into(), key: key.into() }, false) + cmd_adapter( + AdapterCmd::GetString { + option: opt.into(), + key: key.into(), + }, + false, + ) }; let set = |opt: &str, key: &str, val: &str| { - cmd_adapter(AdapterCmd::SetString { - option: opt.into(), - key: key.into(), - value: val.into(), - }, false) + cmd_adapter( + AdapterCmd::SetString { + option: opt.into(), + key: key.into(), + value: val.into(), + }, + false, + ) }; // Read the base string (found = 0); a missing key = 1. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17187: assert_eq!(get("claude-spt", "nope"), 1, "unset key exits 1"); // set-string needs a local target: a bare option is a usage error. - assert_eq!(set("claude-spt", "base", "x"), 2, "bare option has no local target"); + assert_eq!( + set("claude-spt", "base", "x"), + 2, + "bare option has no local target" + ); // Create a local profile, set a string into it, read it back composite. - cmd_adapter(AdapterCmd::CreateProfile { - adapter: "claude-spt".into(), - name: "work".into(), - from: None, - }, false); + cmd_adapter( + AdapterCmd::CreateProfile { + adapter: "claude-spt".into(), + name: "work".into(), + from: None, + }, + false, + ); assert_eq!(set("claude-spt:work", "base", "overridden"), 0); assert_eq!( spt_runtime::registry::get_string(&adapters, "claude-spt:work", "base") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17238: _ => panic!("expected Shell Spawn"), } assert!(matches!( - parse(&["spt", "shell", "spawn", "GameRobot"]).unwrap().cmd.unwrap(), + parse(&["spt", "shell", "spawn", "GameRobot"]) + .unwrap() + .cmd + .unwrap(), Cmd::Shell { action: ShellCmd::Spawn { alias: None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17256: assert!(matches!( parse(&["spt", "shell", "teardown", "TempleKeeper"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Shell { action: ShellCmd::Teardown { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17264: assert!(matches!( parse(&["spt", "shell", "rename", "GameRobot-0", "Keeper"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Shell { action: ShellCmd::Rename { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17272: match parse(&["spt", "shell", "cmd", "TempleKeeper", "move", "north", "3"]) .unwrap() .cmd - .unwrap() + .unwrap() { Cmd::Shell { action: ShellCmd::Cmd { shell_ref, op, .. }, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17285: assert!(matches!( parse(&["spt", "shell", "relink", "GameRobot-0"]) .unwrap() - .cmd.unwrap(), + .cmd + .unwrap(), Cmd::Shell { action: ShellCmd::Relink { .. } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17292: )); // [unit->REQ-SHELL-3] drive parses the ref, the manifest-bounded type, // and the opaque payload; the type flag is required. - match parse(&["spt", "shell", "drive", "GameRobot-0", "--type", "stick", "x=0.7,y=-0.2"]) - .unwrap() - .cmd - .unwrap() + match parse(&[ + "spt", + "shell", + "drive", + "GameRobot-0", + "--type", + "stick", + "x=0.7,y=-0.2", + ]) + .unwrap() + .cmd + .unwrap() { Cmd::Shell { action: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17339: _ => panic!("expected Shell Send"), } assert!(matches!( - parse(&["spt", "shell", "send", "Scout"]).unwrap().cmd.unwrap(), + parse(&["spt", "shell", "send", "Scout"]) + .unwrap() + .cmd + .unwrap(), Cmd::Shell { action: ShellCmd::Send { text: None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17369: let adapters = spt_store::perch::adapters_dir(); let spawn = |adapter: &str, alias: Option<&str>| { - cmd_shell(ShellCmd::Spawn { - adapter: adapter.into(), - alias: alias.map(str::to_string), - owner: Some("doyle".into()), - }, false) + cmd_shell( + ShellCmd::Spawn { + adapter: adapter.into(), + alias: alias.map(str::to_string), + owner: Some("doyle".into()), + }, + false, + ) }; // Nothing registered → refuse. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17472: // Teardown frees the slot… assert_eq!( - cmd_shell(ShellCmd::Teardown { - shell_ref: "Toast".into(), - owner: Some("doyle".into()) - }, false), + cmd_shell( + ShellCmd::Teardown { + shell_ref: "Toast".into(), + owner: Some("doyle".into()) + }, + false + ), 0 ); assert_eq!(spawn("mock-shell", None), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17492: // resolve from the registered manifest, never the perch) — and the D4 // surface still refuses. assert_eq!( - cmd_shell(ShellCmd::Cmd { - shell_ref: "mock-shell-0".into(), - op: vec!["notify".into()], - owner: Some("doyle".into()), - }, false), + cmd_shell( + ShellCmd::Cmd { + shell_ref: "mock-shell-0".into(), + op: vec!["notify".into()], + owner: Some("doyle".into()), + }, + false + ), 1 ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17503: - cmd_shell(ShellCmd::Relink { - shell_ref: "mock-shell-0".into(), - owner: Some("doyle".into()) - }, false), + cmd_shell( + ShellCmd::Relink { + shell_ref: "mock-shell-0".into(), + owner: Some("doyle".into()) + }, + false + ), 1 ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17533: spt_runtime::registry::register(&adapters, &src, 1).unwrap(); assert_eq!( - cmd_shell(ShellCmd::Spawn { - adapter: "mock-shell".into(), - alias: Some("Scout".into()), - owner: Some("doyle".into()), - }, false), + cmd_shell( + ShellCmd::Spawn { + adapter: "mock-shell".into(), + alias: Some("Scout".into()), + owner: Some("doyle".into()), + }, + false + ), 0 ); let shell_perch = perch::resolve_shell_perch_path_in(&owlery, "doyle", "mock-shell-0"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17545: spt_daemon::shellhost::read_link_token(&shell_perch).expect("spawn parked a token"); let relink = |shell_ref: &str, owner: &str| { - cmd_shell(ShellCmd::Relink { - shell_ref: shell_ref.into(), - owner: Some(owner.into()), - }, false) + cmd_shell( + ShellCmd::Relink { + shell_ref: shell_ref.into(), + owner: Some(owner.into()), + }, + false, + ) }; // Foreign owner resolves nothing; alias addressing works for the owner. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17635: // held. Reading a stopped row here as proof the host is gone is exactly // the lie ADR-0045 forbids, so the verb must not write one. assert_eq!( - spt_store::info::read_info(&perch_path).unwrap().status.as_deref(), + spt_store::info::read_info(&perch_path) + .unwrap() + .status + .as_deref(), Some(spt_store::liveness::STATUS_ONLINE), "harness-hosted: the verb claims nothing about the harness's process" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17642: assert_eq!(cmd_shutdown(Some("ling".into())), 0, "idempotent (NO_EDGE)"); - assert_eq!(cmd_shutdown(None), 1, "no self resolvable outside a session"); assert_eq!( + cmd_shutdown(None), + 1, + "no self resolvable outside a session" + ); + assert_eq!( cmd_shutdown(Some("ling@node".into())), 1, "qualified refused (D5)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17777: spt_runtime::registry::register(&adapters, &src, 1).unwrap(); } let spawn = |adapter: &str| { - cmd_shell(ShellCmd::Spawn { - adapter: adapter.into(), - alias: None, - owner: Some("doyle".into()), - }, false) + cmd_shell( + ShellCmd::Spawn { + adapter: adapter.into(), + alias: None, + owner: Some("doyle".into()), + }, + false, + ) }; assert_eq!(spawn("toast"), 0); assert_eq!(spawn("mute"), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17855: // Teardown retires the grant with the slot. assert_eq!( - cmd_shell(ShellCmd::Teardown { - shell_ref: "toast-0".into(), - owner: Some("doyle".into()) - }, false), + cmd_shell( + ShellCmd::Teardown { + shell_ref: "toast-0".into(), + owner: Some("doyle".into()) + }, + false + ), 0 ); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17907: std::fs::write(owner_perch.join("info.json"), "{}").unwrap(); assert_eq!( - cmd_shell(ShellCmd::Spawn { - adapter: "mock-shell".into(), - alias: Some("Scout".into()), - owner: Some("doyle".into()), - }, false), + cmd_shell( + ShellCmd::Spawn { + adapter: "mock-shell".into(), + alias: Some("Scout".into()), + owner: Some("doyle".into()), + }, + false + ), 0 ); let shell_perch = perch::resolve_shell_perch_path_in(&owlery, "doyle", "mock-shell-0"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17918: let token = spt_daemon::shellhost::read_link_token(&shell_perch).expect("token parked"); let key = spt_daemon::shellhost::link_key(&token); let cmd = |op: &[&str]| { - cmd_shell(ShellCmd::Cmd { - shell_ref: "Scout".into(), - op: op.iter().map(|s| s.to_string()).collect(), - owner: Some("doyle".into()), - }, false) + cmd_shell( + ShellCmd::Cmd { + shell_ref: "Scout".into(), + op: op.iter().map(|s| s.to_string()).collect(), + owner: Some("doyle".into()), + }, + false, + ) }; // Vocabulary bounds: unknown op + extra args refuse, nothing spooled. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:17951: let blob = spt_store::perch::spt_home().join("map.png"); std::fs::write(&blob, b"PNGDATA").unwrap(); assert_eq!( - cmd_shell(ShellCmd::Send { - shell_ref: "mock-shell-0".into(), - text: Some("hello shell".into()), - file: Some(blob), - owner: Some("doyle".into()), - }, false), + cmd_shell( + ShellCmd::Send { + shell_ref: "mock-shell-0".into(), + text: Some("hello shell".into()), + file: Some(blob), + owner: Some("doyle".into()), + }, + false + ), 0 ); let rows = spt_store::spool::peek_all_at(&shell_perch).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18084: spt_store::nodeid::load_or_create().unwrap(); let owlery = perch::owlery_dir(); let spawn = |adapter: &str| { - cmd_shell(ShellCmd::Spawn { - adapter: adapter.into(), - alias: None, - owner: Some("doyle".into()), - }, false) + cmd_shell( + ShellCmd::Spawn { + adapter: adapter.into(), + alias: None, + owner: Some("doyle".into()), + }, + false, + ) }; // Two fit under the cap; the third refuses (every instance here is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18100: assert_eq!(spawn("free"), 0); // Teardown frees the slot. assert_eq!( - cmd_shell(ShellCmd::Teardown { - shell_ref: "capped-0".into(), - owner: Some("doyle".into()) - }, false), + cmd_shell( + ShellCmd::Teardown { + shell_ref: "capped-0".into(), + owner: Some("doyle".into()) + }, + false + ), 0 ); assert_eq!(spawn("capped"), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18155: establish_owner("doyle"); let owlery = perch::owlery_dir(); let spawn = |adapter: &str| { - cmd_shell(ShellCmd::Spawn { - adapter: adapter.into(), - alias: None, - owner: Some("doyle".into()), - }, false) + cmd_shell( + ShellCmd::Spawn { + adapter: adapter.into(), + alias: None, + owner: Some("doyle".into()), + }, + false, + ) }; // Profiled spawn: succeeds, colon-free id, composite carried. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18203: subnets.save().unwrap(); let owlery = perch::owlery_dir(); let spawn = |adapter: &str| { - cmd_shell(ShellCmd::Spawn { - adapter: adapter.into(), - alias: None, - owner: Some("doyle".into()), - }, false) + cmd_shell( + ShellCmd::Spawn { + adapter: adapter.into(), + alias: None, + owner: Some("doyle".into()), + }, + false, + ) }; // Ungranted, non-TTY: refused, nothing minted, the escalation notif Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18303: establish_owner("ling"); let owlery = perch::owlery_dir(); let spawn = |owner: &str, adapter: &str, alias: Option<&str>| { - cmd_shell(ShellCmd::Spawn { - adapter: adapter.into(), - alias: alias.map(str::to_string), - owner: Some(owner.into()), - }, false) + cmd_shell( + ShellCmd::Spawn { + adapter: adapter.into(), + alias: alias.map(str::to_string), + owner: Some(owner.into()), + }, + false, + ) }; assert_eq!(spawn("doyle", "mock-shell", Some("Scout")), 0); assert_eq!(spawn("ling", "other-shell", None), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18317: assert!(spt_store::shellinfo::resolve_shell_ref(&owlery, "ling", "mock-shell-0").is_none()); assert!(spt_store::shellinfo::resolve_shell_ref(&owlery, "ling", "Scout").is_none()); assert_eq!( - cmd_shell(ShellCmd::Cmd { - shell_ref: "mock-shell-0".into(), - op: vec!["notify".into()], - owner: Some("ling".into()), - }, false), + cmd_shell( + ShellCmd::Cmd { + shell_ref: "mock-shell-0".into(), + op: vec!["notify".into()], + owner: Some("ling".into()), + }, + false + ), 1, "a non-owner cannot drive the command channel" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18328: assert_eq!( - cmd_shell(ShellCmd::Teardown { - shell_ref: "Scout".into(), - owner: Some("ling".into()) - }, false), + cmd_shell( + ShellCmd::Teardown { + shell_ref: "Scout".into(), + owner: Some("ling".into()) + }, + false + ), 1, "a non-owner cannot tear down" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18336: assert_eq!( - cmd_shell(ShellCmd::Rename { - shell_ref: "mock-shell-0".into(), - alias: "Stolen".into(), - owner: Some("ling".into()), - }, false), + cmd_shell( + ShellCmd::Rename { + shell_ref: "mock-shell-0".into(), + alias: "Stolen".into(), + owner: Some("ling".into()), + }, + false + ), 1, "a non-owner cannot rename" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18440: // Cursor 150 sits inside the window (floor 100 <= 150) → not a predate. let (shown, predates) = filter_after(&digest, 150); assert!(!predates, "cursor inside the window does not predate it"); - let inputs: Vec<_> = shown.turns.iter().filter_map(|t| t.input.as_deref()).collect(); - assert_eq!(inputs, vec!["new"], "only the turn newer than the cursor survives"); + let inputs: Vec<_> = shown + .turns + .iter() + .filter_map(|t| t.input.as_deref()) + .collect(); + assert_eq!( + inputs, + vec!["new"], + "only the turn newer than the cursor survives" + ); } // [unit->REQ-DIGEST-CURSOR] a cursor BELOW the window's lowest committed seq Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18465: // Cursor 10 is below the window floor (500) → predates. let (shown, predates) = filter_after(&digest, 10); assert!(predates, "a cursor below the window floor predates it"); - assert_eq!(shown.turns.len(), 1, "the FULL window is returned, not empty"); + assert_eq!( + shown.turns.len(), + 1, + "the FULL window is returned, not empty" + ); // The JSON form carries the after_predates_window signal. let (json, _) = digest_snapshot_output(&shown, predates, 7, true, "ep"); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18516: // Poll just below the sealed turn: exactly that turn comes back. let (shown, predates) = filter_after(&remote_reply, 59); assert!(!predates, "a cursor inside the window is not a predate"); - let inputs: Vec<_> = shown.turns.iter().filter_map(|t| t.input.as_deref()).collect(); - assert_eq!(inputs, vec!["tag this release"], "only rows past the cursor"); + let inputs: Vec<_> = shown + .turns + .iter() + .filter_map(|t| t.input.as_deref()) + .collect(); + assert_eq!( + inputs, + vec!["tag this release"], + "only rows past the cursor" + ); // Poll AT the sealed turn's newest seq: nothing new — the incremental poll // terminates instead of re-reading the same turn forever. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18593: v.get("after_predates_window").is_none(), "no spurious predates signal when the cursor did not predate" ); - assert!(err.is_empty(), "--json leaves stderr clean (no DIGEST: trailer): {err:?}"); + assert!( + err.is_empty(), + "--json leaves stderr clean (no DIGEST: trailer): {err:?}" + ); } // [unit->REQ-DIGEST-JSON-SELF-CONTAINED] the human (non-json) path keeps Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:18625: v.get("after_predates_window").and_then(|x| x.as_bool()), Some(true) ); - assert!(err.is_empty(), "--json stays stderr-clean on the predates path too"); + assert!( + err.is_empty(), + "--json stays stderr-clean on the predates path too" + ); } // [unit->REQ-MSG-2] ring timeout defaults to 60s when unspecified. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19169: // sites route it through helpfmt::render — so STRIP mode (a piped adapter) // yields zero backticks / zero ANSI while the human words survive. // [unit->REQ-CLI-OUTPUT-MARKDOWN] - assert!(HINT_FOOTER.contains('`'), "the hint footer authors backticks"); + assert!( + HINT_FOOTER.contains('`'), + "the hint footer authors backticks" + ); let stripped = crate::helpfmt::render(&empty, false); assert!( !stripped.contains('`'), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19560: let mismatch = install_platform_check("x86_64-unknown-linux-gnu", Some("aarch64")); assert!(mismatch.is_err(), "a host-arch disagreement must refuse"); let unprobed = install_platform_check("x86_64-unknown-linux-gnu", None); - assert!(unprobed.is_ok(), "an unprobeable host keeps the registry leg only"); + assert!( + unprobed.is_ok(), + "an unprobeable host keeps the registry leg only" + ); } // [unit->REQ-INSTALL-BOOTSTRAP-VERB] placement is idempotent: a fresh Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19714: #[test] fn finish_message_states_fully_live_no_manual_restart() { let fresh = render_finish_message(9, "0.29.0", false); - assert!(fresh.contains("Updated spt-core to v0.29.0"), "head: {fresh}"); - assert!(fresh.contains("fully live"), "states the node runs it: {fresh}"); + assert!( + fresh.contains("Updated spt-core to v0.29.0"), + "head: {fresh}" + ); + assert!( + fresh.contains("fully live"), + "states the node runs it: {fresh}" + ); let already = render_finish_message(9, "0.29.0", true); assert!( already.contains("already installed"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19756: let stale = render_broker_image_line(Some("0.19.1"), "0.20.0"); assert!(stale.contains("0.19.1"), "names the running image: {stale}"); - assert!(stale.contains("0.20.0"), "names the installed version: {stale}"); + assert!( + stale.contains("0.20.0"), + "names the installed version: {stale}" + ); let too_old = render_broker_image_line(None, "0.20.0"); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19810: let stale = render_coordinator_image_line(Some("0.19.1"), "0.20.0"); assert!(stale.contains("0.19.1"), "names the running image: {stale}"); - assert!(stale.contains("0.20.0"), "names the installed version: {stale}"); assert!( + stale.contains("0.20.0"), + "names the installed version: {stale}" + ); + assert!( stale.contains("spt daemon refresh"), "gives the in-place remedy: {stale}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19871: fn stall_evict_line_surfaces_only_a_real_tally() { assert_eq!(render_stall_evict_line(None), None, "unqueryable → no line"); - let healthy = render_stall_evict_line(Some((0, 0))).expect("Some(0) renders a healthy line"); + let healthy = + render_stall_evict_line(Some((0, 0))).expect("Some(0) renders a healthy line"); assert!(healthy.contains("healthy"), "got {healthy}"); assert!(healthy.contains("none"), "got {healthy}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19878: - let evicted = - render_stall_evict_line(Some((3, 1_700_000_000_000))).expect("a non-zero tally renders"); + let evicted = render_stall_evict_line(Some((3, 1_700_000_000_000))) + .expect("a non-zero tally renders"); assert!(evicted.contains('3'), "names the count: {evicted}"); - assert!(evicted.contains("1700000000000"), "names the last time: {evicted}"); assert!( + evicted.contains("1700000000000"), + "names the last time: {evicted}" + ); + assert!( evicted.to_lowercase().contains("reattach") || evicted.to_lowercase().contains("take"), "explains control was released: {evicted}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19904: use spt_daemon::pump::health::PumpHealth; let now = 1_700_000_100_000u64; - assert_eq!(render_peer_health_line(None, now), None, "no snapshot → no line"); + assert_eq!( + render_peer_health_line(None, now), + None, + "no snapshot → no line" + ); let mut solo = PumpHealth::default(); solo.set_targets(Vec::::new(), 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19911: - assert_eq!(render_peer_health_line(Some(&solo), now), None, "solo node → silent"); + assert_eq!( + render_peer_health_line(Some(&solo), now), + None, + "solo node → silent" + ); assert_eq!(peer_health_verdict_token(&solo), "idle"); // The sequester fingerprint: all targets failing, nothing live. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19931: // Public wording only. assert!(!line.contains("REQ-"), "no internal req tag: {line}"); - assert!(!line.contains("PUMP_PEER_FAIL"), "no internal CODE marker: {line}"); + assert!( + !line.contains("PUMP_PEER_FAIL"), + "no internal CODE marker: {line}" + ); } // [unit->REQ-PROJECT-INDEX-WRITER] the project-index observability line: a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19954: stats.last_cycle.tree_scans = 2; let fresh = render_project_index_line(Some(&stats)).expect("stats render"); assert!(fresh.contains("fresh"), "got {fresh}"); - assert!(fresh.contains("3 endpoint(s)") && fresh.contains("2 project(s)"), "got {fresh}"); - assert!(fresh.contains("1 branch enum") && fresh.contains("2 tree scan"), "got {fresh}"); + assert!( + fresh.contains("3 endpoint(s)") && fresh.contains("2 project(s)"), + "got {fresh}" + ); + assert!( + fresh.contains("1 branch enum") && fresh.contains("2 tree scan"), + "got {fresh}" + ); stats.last_error = Some("branch enumeration: boom".to_string()); let failed = render_project_index_line(Some(&stats)).expect("failure renders"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19962: - assert!(failed.contains("last-known-good"), "degradation is stated: {failed}"); + assert!( + failed.contains("last-known-good"), + "degradation is stated: {failed}" + ); for line in [&fresh, &failed] { assert!(!line.contains("REQ-"), "no internal req tag: {line}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19972: #[test] fn stop_guard_refuses_live_sessions_without_force() { // No hosted sessions → proceed regardless of force. - assert!(stop_live_session_guard(&[], false).is_ok(), "nothing hosted → stop"); + assert!( + stop_live_session_guard(&[], false).is_ok(), + "nothing hosted → stop" + ); assert!(stop_live_session_guard(&[], true).is_ok()); // --force proceeds even with live sessions. assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19982: // Live sessions, no --force → refuse + name them + point at --force. let err = stop_live_session_guard(&["doyle".into(), "perri".into()], false) .expect_err("live sessions without --force must refuse"); - assert!(err.contains("doyle") && err.contains("perri"), "names the sessions: {err}"); + assert!( + err.contains("doyle") && err.contains("perri"), + "names the sessions: {err}" + ); assert!(err.contains("--force"), "points at the override: {err}"); - assert!(err.contains("come back"), "reassures they survive a restart: {err}"); + assert!( + err.contains("come back"), + "reassures they survive a restart: {err}" + ); assert!(!err.contains("REQ-"), "no internal tag leaks: {err}"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:19998: let netless = render_connection_lines(false, Some(0), 1_000_000, 30_000); assert!(netless.contains("no connection"), "surfaces the real cause"); assert!(netless.contains("waiting on network")); - assert!(!netless.contains("STALLED"), "no false stall off a stale heartbeat"); + assert!( + !netless.contains("STALLED"), + "no false stall off a stale heartbeat" + ); // Net up, fresh heartbeat ⇒ live. let live = render_connection_lines(true, Some(95_000), 100_000, 30_000); assert!(live.contains("peer pump: live")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:20100: true }); let elapsed = start.elapsed(); - assert_eq!(got, vec![true, false, true], "wedged probe reads false, fast ones true, order kept"); + assert_eq!( + got, + vec![true, false, true], + "wedged probe reads false, fast ones true, order kept" + ); assert!( elapsed < 4 * ceiling, "the wedged probe costs one ceiling, not its full 1500ms sleep; got {elapsed:?}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:20236: assert!(subnet.contains("spt subnet create")); assert!(subnet.contains("spt subnet show-code")); assert!(subnet.contains("spt subnet join")); + assert!(subnet.contains("6-digit"), "the pairing code is documented"); assert!( - subnet.contains("6-digit"), - "the pairing code is documented" - ); - assert!( subnet.contains("@"), "reaching a remote agent by node-qualified id is documented" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:20538: extract_release_archive(&archive, &dest).expect("fat archive extracts for this platform"); // Shared root placed. - assert!(dest.join("manifest.toml").is_file(), "shared manifest.toml placed"); assert!( + dest.join("manifest.toml").is_file(), + "shared manifest.toml placed" + ); + assert!( dest.join("strings").join("en.toml").is_file(), "shared strings/ placed" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:20629: std::fs::create_dir_all(&dest).unwrap(); extract_release_archive(&archive, &dest).expect("legacy flat archive extracts"); - assert!(dest.join("manifest.toml").is_file(), "flat manifest.toml placed"); assert!( + dest.join("manifest.toml").is_file(), + "flat manifest.toml placed" + ); + assert!( dest.join("strings").join("en.toml").is_file(), "flat strings/ placed" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\cli.rs:20728: // 5. Idempotent: re-applying the SAME staged archive is a no-op (every file // already matches, so nothing is swapped) and still succeeds. - apply_release_crc_swap(&staged, &dest).expect("re-applying an identical release is a no-op"); + apply_release_crc_swap(&staged, &dest) + .expect("re-applying an identical release is a no-op"); assert_eq!( std::fs::read(dest.join("manifest.toml")).unwrap(), b"version = 2\n", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:135: /// Candidate terminal emulators, in preference order, for the `DISPLAY ∧ no-pkexec` /// Linux-desktop arm (`x-terminal-emulator` is the Debian alternatives symlink). -pub const TERMINAL_EMULATORS: &[&str] = &["x-terminal-emulator", "gnome-terminal", "konsole", "xterm"]; +pub const TERMINAL_EMULATORS: &[&str] = + &["x-terminal-emulator", "gnome-terminal", "konsole", "xterm"]; /// The pure elevation-path decision (the testable seam — the cross-platform /// generalization of the old Unix-only auto-sudo check). Loop-safety is enforced Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:228: // no-injection unit test; dead in the non-Windows BIN target only. #[cfg_attr(not(windows), allow(dead_code))] fn windows_quote_arg(arg: &str) -> String { - let needs_quotes = - arg.is_empty() || arg.chars().any(|c| c == ' ' || c == '\t' || c == '"'); + let needs_quotes = arg.is_empty() || arg.chars().any(|c| c == ' ' || c == '\t' || c == '"'); if !needs_quotes { return arg.to_string(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:445: fn unix_path_order_tty_then_pkexec_then_terminal_then_hint() { let n = Elevation::NotElevated; // Interactive TTY wins regardless of desktop state. - assert_eq!(decide_elevation_path(Os::Unix, n, true, true, true, true), ElevatePath::InlineSudo); - assert_eq!(decide_elevation_path(Os::Unix, n, true, false, false, false), ElevatePath::InlineSudo); + assert_eq!( + decide_elevation_path(Os::Unix, n, true, true, true, true), + ElevatePath::InlineSudo + ); + assert_eq!( + decide_elevation_path(Os::Unix, n, true, false, false, false), + ElevatePath::InlineSudo + ); // No TTY, desktop + pkexec → pkexec (preferred over a terminal emulator). - assert_eq!(decide_elevation_path(Os::Unix, n, false, true, true, true), ElevatePath::Pkexec); + assert_eq!( + decide_elevation_path(Os::Unix, n, false, true, true, true), + ElevatePath::Pkexec + ); // No TTY, desktop, no pkexec, has terminal → terminal emulator. - assert_eq!(decide_elevation_path(Os::Unix, n, false, true, false, true), ElevatePath::TerminalEmulator); + assert_eq!( + decide_elevation_path(Os::Unix, n, false, true, false, true), + ElevatePath::TerminalEmulator + ); // Desktop present but neither pkexec nor a terminal → print floor. - assert_eq!(decide_elevation_path(Os::Unix, n, false, true, false, false), ElevatePath::PrintHint); + assert_eq!( + decide_elevation_path(Os::Unix, n, false, true, false, false), + ElevatePath::PrintHint + ); // No TTY, no DISPLAY (headless) → print floor even with pkexec/term present. - assert_eq!(decide_elevation_path(Os::Unix, n, false, false, true, true), ElevatePath::PrintHint); + assert_eq!( + decide_elevation_path(Os::Unix, n, false, false, true, true), + ElevatePath::PrintHint + ); } // [unit->REQ-ELEVATE-1] Windows: interactive → UAC console; headless/redirected Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:462: #[test] fn windows_uac_only_interactive_other_always_prints() { let n = Elevation::NotElevated; - assert_eq!(decide_elevation_path(Os::Windows, n, true, false, false, false), ElevatePath::UacWindow); - assert_eq!(decide_elevation_path(Os::Windows, n, false, false, false, false), ElevatePath::PrintHint); - assert_eq!(decide_elevation_path(Os::Other, n, true, true, true, true), ElevatePath::PrintHint); + assert_eq!( + decide_elevation_path(Os::Windows, n, true, false, false, false), + ElevatePath::UacWindow + ); + assert_eq!( + decide_elevation_path(Os::Windows, n, false, false, false, false), + ElevatePath::PrintHint + ); + assert_eq!( + decide_elevation_path(Os::Other, n, true, true, true, true), + ElevatePath::PrintHint + ); } // [unit->REQ-HAZARD-SELF-ELEVATE] [unit->REQ-HAZARD-SUDO-SECURE-PATH] every Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:485: let term = terminal_argv("x-terminal-emulator", exe, &a); assert_eq!( term, - vec!["x-terminal-emulator", "-e", "sudo", exe, "subnet", "create", "home fleet"] + vec![ + "x-terminal-emulator", + "-e", + "sudo", + exe, + "subnet", + "create", + "home fleet" + ] ); // Verbatim: the args tail is identical (no added/altered flags), absolute exe. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:492: for argv in [&sudo, &pk] { let exe_pos = argv.iter().position(|s| s == exe).expect("abs exe present"); assert!(exe.starts_with('/'), "absolute exe path"); - assert_eq!(&argv[exe_pos + 1..], a.as_slice(), "verbatim args, no widening"); + assert_eq!( + &argv[exe_pos + 1..], + a.as_slice(), + "verbatim args, no widening" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:508: let a = vec!["subnet".to_string(), "create".to_string(), evil.clone()]; // argv-array launchers: the malicious string is exactly one trailing element. - for argv in [sudo_argv(exe, &a), pkexec_argv(exe, &a), terminal_argv("xterm", exe, &a)] { - assert_eq!(argv.last().unwrap(), &evil, "crafted arg stays one argv element"); - assert!(!argv.iter().any(|s| s == "sh" || s == "-c"), "no sh -c wrapper"); + for argv in [ + sudo_argv(exe, &a), + pkexec_argv(exe, &a), + terminal_argv("xterm", exe, &a), + ] { + assert_eq!( + argv.last().unwrap(), + &evil, + "crafted arg stays one argv element" + ); + assert!( + !argv.iter().any(|s| s == "sh" || s == "-c"), + "no sh -c wrapper" + ); } // Windows params: each arg individually quoted; a quote-bearing arg is escaped Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:520: let inject = windows_runas_params(&[r#"a" & calc.exe"#.to_string()]); // The interior quote is backslash-escaped so it cannot terminate the arg early. assert!(inject.contains(r#"\""#), "interior quote escaped: {inject}"); - assert!(!inject.to_lowercase().contains("cmd /c"), "no cmd /c wrapper"); + assert!( + !inject.to_lowercase().contains("cmd /c"), + "no cmd /c wrapper" + ); } // [unit->REQ-HAZARD-SELF-ELEVATE] [unit->REQ-HAZARD-SUDO-SECURE-PATH] the print-hint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:536: assert!(unix.starts_with("sudo /"), "absolute path under sudo"); // Spaced arg: shell-quoted in the printed sudo line (KNOWN-HAZARDS 5.10). - let spaced = print_hint_command(Os::Unix, "/usr/local/bin/spt", &args(&["subnet", "create", "home fleet"])); + let spaced = print_hint_command( + Os::Unix, + "/usr/local/bin/spt", + &args(&["subnet", "create", "home fleet"]), + ); assert_eq!(spaced, "sudo /usr/local/bin/spt subnet create 'home fleet'"); let win = print_hint_command(Os::Windows, "C:\\Users\\me\\spt.exe", &a); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\elevation.rs:543: - assert!(win.contains("C:\\Users\\me\\spt.exe"), "absolute exe in hint: {win}"); + assert!( + win.contains("C:\\Users\\me\\spt.exe"), + "absolute exe in hint: {win}" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\helpfmt.rs:62: fn resolve_console_color(want: bool, console_vt: Option) -> bool { match (want, console_vt) { (false, _) => false, - (true, None) => true, // not a console → piped/forced bytes pass through - (true, Some(ok)) => ok, // a console → color only if VT could be enabled + (true, None) => true, // not a console → piped/forced bytes pass through + (true, Some(ok)) => ok, // a console → color only if VT could be enabled } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\helpfmt.rs:367: #[test] fn nested_code_inside_bold_styles_both() { // `**`code`**` → bold around a cyan code span. - assert_eq!( - render("**`x`**", true), - "\x1b[1m\x1b[36mx\x1b[39m\x1b[22m" - ); + assert_eq!(render("**`x`**", true), "\x1b[1m\x1b[36mx\x1b[39m\x1b[22m"); assert_eq!(render("**`x`**", false), "x"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\helpfmt.rs:429: fn preexisting_ansi_is_passed_through_untouched() { let styled = "\x1b[31mred **still bold**\x1b[0m"; // The CSI prefix is copied verbatim; the inner `**bold**` still renders. - assert_eq!(render(styled, true), "\x1b[31mred \x1b[1mstill bold\x1b[22m\x1b[0m"); + assert_eq!( + render(styled, true), + "\x1b[31mred \x1b[1mstill bold\x1b[22m\x1b[0m" + ); assert_eq!(render(styled, false), "\x1b[31mred still bold\x1b[0m"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\main.rs:136: "failed printing to stdout: No space left on device (os error 28)" )); // NOT a stdio-print panic at all → untouched. - assert!(!is_broken_pipe_panic("index out of bounds: the len is 0 but the index is 3")); - assert!(!is_broken_pipe_panic("Broken pipe (os error 32)"), "must also be a print panic"); + assert!(!is_broken_pipe_panic( + "index out of bounds: the len is 0 but the index is 3" + )); + assert!( + !is_broken_pipe_panic("Broken pipe (os error 32)"), + "must also be a print panic" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:125: for s in &subnets.subnets { if let Some(reg) = regs.get(&s.name) { for (node, label) in reg.node_labels() { - map.entry(node.to_string()).or_insert_with(|| label.to_string()); + map.entry(node.to_string()) + .or_insert_with(|| label.to_string()); } } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:162: let local: HashMap, String)> = rows .iter() .filter(|r| r.is_local) - .map(|r| (r.id.clone(), (r.status, r.controllable, r.endpoint_type.clone()))) + .map(|r| { + ( + r.id.clone(), + (r.status, r.controllable, r.endpoint_type.clone()), + ) + }) .collect(); for row in rows.iter_mut() { if row.is_local { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:423: /// - an absent row / absent index → empty (renders `-`). // [impl->REQ-PROJECT-INDEX-READER-CUTOVER] // [impl->REQ-PICKER-PROJECT-HISTORY-TRUTH] -pub fn indexed_project_refs( - read: &spt_store::projindex::IndexRead, - id: &str, -) -> Vec { +pub fn indexed_project_refs(read: &spt_store::projindex::IndexRead, id: &str) -> Vec { let Some(row) = read.project_for(id) else { return Vec::new(); }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:473: /// reader git work): an unindexed cwd (stale index / brand-new dir) degrades /// to the dir's folder name — a pure path read, human-recognizable, no git. // [impl->REQ-PROJECT-INDEX-READER-CUTOVER] -fn resume_rows_for( - read: &spt_store::projindex::IndexRead, - perch_path: &Path, -) -> Vec { +fn resume_rows_for(read: &spt_store::projindex::IndexRead, perch_path: &Path) -> Vec { let lookup = |dir: &Path| -> (String, String) { if let spt_store::projindex::IndexRead::Snapshot(idx) = read { if let Some(c) = idx.project_for_cwd(dir) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:520: // offering an untitled, unresumable row. A pre-migration row with no cwd // is kept (its title falls back to the boundary trigger). // [impl->REQ-SESSIONS-LOG-ENDPOINT-ATTRIBUTION] - if e.cwd.as_deref().is_some_and(|cwd| path_under(Path::new(cwd), owlery)) { + if e.cwd + .as_deref() + .is_some_and(|cwd| path_under(Path::new(cwd), owlery)) + { return None; } // The row title shows the DISPLAY name (A1) of the session's own project. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:570: ) -> Vec { spt_store::projderive::project_refs_from(entries, origin_cwd, store_ids, owlery, derive) .into_iter() - .map(|d| ProjectRef { id: d.id, dir: d.dir, display: d.display }) + .map(|d| ProjectRef { + id: d.id, + dir: d.dir, + display: d.display, + }) .collect() } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:577: fn row(id: &str, is_local: bool, status: EpStatus) -> EndpointRow { EndpointRow { id: id.to_string(), - group: if is_local { "local".into() } else { "sub:n".into() }, + group: if is_local { + "local".into() + } else { + "sub:n".into() + }, node: if is_local { "LOCAL".into() } else { "n".into() }, node_key: if is_local { String::new() } else { "n".into() }, status, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:610: use crate::picker::model::EpDisplay; // The derivation rule, directly: unbound (alive=false) IS online; a true // dead perch (neither) is offline. - assert_eq!(row_status(false, true), EpStatus::Online, "live unbound → online"); + assert_eq!( + row_status(false, true), + EpStatus::Online, + "live unbound → online" + ); assert_eq!(row_status(true, false), EpStatus::Online, "alive → online"); assert_eq!(row_status(true, true), EpStatus::Online); - assert_eq!(row_status(false, false), EpStatus::Offline, "neither → offline"); + assert_eq!( + row_status(false, false), + EpStatus::Offline, + "neither → offline" + ); // The full seam: feed the real-rule status + the roster unbound flag into an // EndpointRow exactly as local_rows does → display_status == hollow Unbound. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:620: - let mut r = row("skeleton", true, row_status(/*alive*/ false, /*unbound*/ true)); + let mut r = row( + "skeleton", + true, + row_status(/*alive*/ false, /*unbound*/ true), + ); r.is_unbound = true; // local_rows sets is_unbound = p.unbound r.controllable = Some(false); // would be amber HarnessOnly if not unbound assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:626: "live unbound derives Online → display resolves to hollow Unbound (not gray Offline)" ); // And it must NOT have read as offline (the bug) — no resume rows path etc. - assert_ne!(r.display_status(), EpDisplay::Offline, "never gray-offline for a live unbound"); + assert_ne!( + r.display_status(), + EpDisplay::Offline, + "never gray-offline for a live unbound" + ); } // [int->REQ-ENDPOINT-UNBOUND-ATTACH] the REAL render seam (the one no unit Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:736: spt_store::info::write_info(&p, &rec).unwrap(); } let ids: Vec = gather_endpoints().into_iter().map(|r| r.id).collect(); - assert!(ids.contains(&"realagent".to_string()), "the drivable agent is offered"); assert!( + ids.contains(&"realagent".to_string()), + "the drivable agent is offered" + ); + assert!( !ids.contains(&"cc-random-9f3a".to_string()), "a worker is never a run-picker row (REQ-WORKER-PICKER-EXCLUDED)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:819: "a cold (Suspended) remote perch reads Suspended — NOT online (W4), \ and distinct from Offline (W5)" ); - assert_ne!(dead.status, EpStatus::Online, "the core W4 guarantee: never false-green"); + assert_ne!( + dead.status, + EpStatus::Online, + "the core W4 guarantee: never false-green" + ); assert_eq!( dead.display_status(), crate::picker::model::EpDisplay::Suspended, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:857: // controlled remote endpoint gossips `controlled=true` with // `controller_node=None` (the by=None dispatch_spawn case), and must still // render blue cross-node. - let inst = |bound: bool, controller: Option<&str>, harness: bool, controlled: bool| Instance { - node: remote_node.to_string(), - status: Status::Active, - epoch: 5, - resources: None, - last_active_ms: None, - shell_adapters: Vec::new(), - node_label: Some("REMOTE".to_string()), - machine_id: None, - endpoint_type: None, - bound, - controller_node: controller.map(str::to_string), - harness_only: harness, - adapter: None, - recent_projects: Vec::new(), - controlled, - }; + let inst = + |bound: bool, controller: Option<&str>, harness: bool, controlled: bool| Instance { + node: remote_node.to_string(), + status: Status::Active, + epoch: 5, + resources: None, + last_active_ms: None, + shell_adapters: Vec::new(), + node_label: Some("REMOTE".to_string()), + machine_id: None, + endpoint_type: None, + bound, + controller_node: controller.map(str::to_string), + harness_only: harness, + adapter: None, + recent_projects: Vec::new(), + controlled, + }; let mut reg = SubnetRegistry::new(); // bound + free + not harness → green Online. reg.merge_instance("freeep", inst(true, None, false, false)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:897: let snap_dir = perch::identity_dir().join("registry"); std::fs::create_dir_all(&snap_dir).unwrap(); - std::fs::write(snap_dir.join("home.json"), serde_json::to_string(®).unwrap()).unwrap(); + std::fs::write( + snap_dir.join("home.json"), + serde_json::to_string(®).unwrap(), + ) + .unwrap(); let rows = gather_endpoints(); let disp = |id: &str| { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:906: .unwrap_or_else(|| panic!("remote row {id} missing")) .display_status() }; - assert_eq!(disp("freeep"), EpDisplay::Online, "remote bound+free → green Online"); - assert_eq!(disp("unbep"), EpDisplay::Unbound, "remote unbound → red Unbound (parity)"); - assert_eq!(disp("ctlep"), EpDisplay::Controlled, "remote-driven → blue (parity)"); assert_eq!( + disp("freeep"), + EpDisplay::Online, + "remote bound+free → green Online" + ); + assert_eq!( + disp("unbep"), + EpDisplay::Unbound, + "remote unbound → red Unbound (parity)" + ); + assert_eq!( + disp("ctlep"), + EpDisplay::Controlled, + "remote-driven → blue (parity)" + ); + assert_eq!( disp("locctlep"), EpDisplay::Controlled, "locally-controlled remote (controlled=true, no gossiped driver) → blue (#4 decouple)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:916: ); - assert_eq!(disp("harnep"), EpDisplay::HarnessOnly, "remote harness-only → amber (parity)"); + assert_eq!( + disp("harnep"), + EpDisplay::HarnessOnly, + "remote harness-only → amber (parity)" + ); // The REMOTE-driven row renders its driver as the canonical node display (a // name/keyprefix), not raw hex — the desc-pane `controlled by ` pin. let ctl = rows.iter().find(|r| r.id == "ctlep").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:921: - assert!(ctl.driven_by.is_some(), "a remote-driven row carries its driver for the pin"); + assert!( + ctl.driven_by.is_some(), + "a remote-driven row carries its driver for the pin" + ); // The LOCALLY-controlled row is blue WITHOUT a driver pin — the any-controller // truth came from `controlled`, not the (absent) WHO datum. let loc = rows.iter().find(|r| r.id == "locctlep").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:925: - assert!(loc.controlled, "locally-controlled remote reads controlled from gossip"); - assert!(loc.driven_by.is_none(), "no gossiped driver → no pin, still blue"); + assert!( + loc.controlled, + "locally-controlled remote reads controlled from gossip" + ); + assert!( + loc.driven_by.is_none(), + "no gossiped driver → no pin, still blue" + ); // #4 end-to-end: the gathered row surfaces the REAL gossiped adapter + project // history (not the blurb, not a hardcoded empty) through the whole pipeline. - assert_eq!(loc.adapter_profile, "claude-spt:doyle", "gossiped adapter surfaced by gather"); - assert_eq!(loc.project_history, vec!["spt-core", "owl"], "gossiped projects surfaced by gather"); + assert_eq!( + loc.adapter_profile, "claude-spt:doyle", + "gossiped adapter surfaced by gather" + ); + assert_eq!( + loc.project_history, + vec!["spt-core", "owl"], + "gossiped projects surfaced by gather" + ); } // [int->REQ-PICKER-NODE-GROUPING] bug #13: a machine shared across TWO subnets Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:974: let snap_dir = perch::identity_dir().join("registry"); std::fs::create_dir_all(&snap_dir).unwrap(); - std::fs::write(snap_dir.join("bignet.json"), serde_json::to_string(®_big).unwrap()) - .unwrap(); - std::fs::write(snap_dir.join("sptdev.json"), serde_json::to_string(®_dev).unwrap()) - .unwrap(); + std::fs::write( + snap_dir.join("bignet.json"), + serde_json::to_string(®_big).unwrap(), + ) + .unwrap(); + std::fs::write( + snap_dir.join("sptdev.json"), + serde_json::to_string(®_dev).unwrap(), + ) + .unwrap(); let rows = gather_endpoints(); let eel: Vec<&EndpointRow> = rows.iter().filter(|r| r.id == "eel-a").collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:984: - assert_eq!(eel.len(), 1, "the shared machine's endpoint is ONE row, not one per subnet"); + assert_eq!( + eel.len(), + 1, + "the shared machine's endpoint is ONE row, not one per subnet" + ); let r = eel[0]; // Grouped by the MACHINE (node display), not "{subnet}:{node}". - assert!(!r.group.contains(':'), "group is the machine, not subnet:node: {}", r.group); - assert!(r.group.contains("REMOTE"), "group is the machine display: {}", r.group); + assert!( + !r.group.contains(':'), + "group is the machine, not subnet:node: {}", + r.group + ); + assert!( + r.group.contains("REMOTE"), + "group is the machine display: {}", + r.group + ); // Both shared subnets are unioned onto the single row (order = gather order). assert!( r.subnets.contains(&"bignet".to_string()) && r.subnets.contains(&"sptdev".to_string()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:992: "both shared subnets listed beneath the machine: {:?}", r.subnets ); - assert_eq!(r.subnets.len(), 2, "no duplicate subnet entries: {:?}", r.subnets); + assert_eq!( + r.subnets.len(), + 2, + "no duplicate subnet entries: {:?}", + r.subnets + ); // Most-alive reconcile: the warm (Dormant→Online) sighting wins over the cold. - assert_eq!(r.status, EpStatus::Online, "most-alive status wins across subnets"); + assert_eq!( + r.status, + EpStatus::Online, + "most-alive status wins across subnets" + ); } // [unit->REQ-PICKER-3] a self-owned endpoint dual-listed in Local + Subnet, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1043: // folder name lowercased (the repo-less fallback). Keeps the derivation unit pure // + fast; id==display here since a folder-name fallback has no distinct URL tail. fn folder_derive(p: &Path) -> (String, String) { - let name = p.file_name().map(|n| n.to_string_lossy().to_lowercase()).unwrap_or_default(); + let name = p + .file_name() + .map(|n| n.to_string_lossy().to_lowercase()) + .unwrap_or_default(); (name.clone(), name) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1066: sess("C:/Users/x/spt-core/owlery/hall-a/nested/hall-a-psyche"), ]; let rows = resume_rows_from(entries, owlery, folder_derive); - assert_eq!(rows.len(), 2, "the owlery-internal psyche session is filtered out"); + assert_eq!( + rows.len(), + 2, + "the owlery-internal psyche session is filtered out" + ); // Newest-first; each row carries its OWN project, not a shared head. assert_eq!(rows[0].project, "beta"); assert_eq!(rows[1].project, "alpha"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1073: // No surviving row points into the owlery. assert!( - rows.iter().all(|r| !r.cwd.as_deref().unwrap_or_default().contains("/owlery/")), + rows.iter() + .all(|r| !r.cwd.as_deref().unwrap_or_default().contains("/owlery/")), "no resume row may reference an owlery-internal session" ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1144: let mut m = std::collections::BTreeMap::new(); m.insert( "c:/p/newest".to_string(), - CwdProject { id: "newest".into(), display: "Newest".into() }, + CwdProject { + id: "newest".into(), + display: "Newest".into(), + }, ); m }, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1154: let refs = indexed_project_refs(&read, "full"); assert_eq!(refs.len(), 2); assert_eq!(refs[0].id, "newest"); - assert_eq!(refs[0].dir, "C:/p/newest", "dirs survive for #5 launch-into"); + assert_eq!( + refs[0].dir, "C:/p/newest", + "dirs survive for #5 launch-into" + ); assert_eq!(refs[1].id, "older"); assert_eq!( indexed_latest_project_ref(&read, "full").map(|r| r.id), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1214: let mut idx = ProjectIndex::empty(1); idx.cwds.insert( "c:/p/indexed-proj".to_string(), - CwdProject { id: "the-slug".into(), display: "TheRealDisplay".into() }, + CwdProject { + id: "the-slug".into(), + display: "TheRealDisplay".into(), + }, ); let rows = resume_rows_for(&IndexRead::Snapshot(idx), &perch_path); assert_eq!(rows.len(), 2); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1221: // Newest-first: the unseen dir (appended last) leads with its folder name… - assert_eq!(rows[0].project, "unseen-dir", "unindexed cwd → folder-name fallback"); + assert_eq!( + rows[0].project, "unseen-dir", + "unindexed cwd → folder-name fallback" + ); // …and the indexed cwd renders the MATERIALIZED display (case + tail // exactly as the writer derived it — never re-derived here). assert_eq!(rows[1].project, "TheRealDisplay"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1226: // Degraded (Absent) index: every row still titles fast via the fallback. let rows = resume_rows_for(&IndexRead::Absent(AbsentReason::Missing), &perch_path); - assert_eq!(rows[1].project, "Indexed-Proj", "absent index → folder name, no stall"); + assert_eq!( + rows[1].project, "Indexed-Proj", + "absent index → folder name, no stall" + ); assert_eq!( spt_store::gitrun::git_spawn_count(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1243: // would have cost 2 perches × branch walks before the cutover. #[test] fn gather_endpoints_projects_from_seeded_index_with_zero_git() { - use spt_store::projindex::{ - CwdProject, EndpointProject, ProjectIndex, ProjectRefEntry, - }; + use spt_store::projindex::{CwdProject, EndpointProject, ProjectIndex, ProjectRefEntry}; let _home = crate::testutil::isolated_home(); // Two offline local perches; ep-idx has a resume-able ledger row. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1289: ); idx.cwds.insert( "c:/p/proj-x".to_string(), - CwdProject { id: "proj-x".into(), display: "proj-x".into() }, + CwdProject { + id: "proj-x".into(), + display: "proj-x".into(), + }, ); spt_store::projindex::write_index(&idx).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1304: let ep = rows.iter().find(|r| r.id == "ep-idx").expect("ep-idx row"); assert_eq!(ep.project_history, vec!["proj-x".to_string()]); assert_eq!(ep.project_refs.len(), 1); - assert_eq!(ep.project_refs[0].dir, "C:/p/proj-x", "launch-into dir carried"); assert_eq!( + ep.project_refs[0].dir, "C:/p/proj-x", + "launch-into dir carried" + ); + assert_eq!( ep.resume_rows.first().map(|r| r.project.as_str()), Some("proj-x"), "resume title reads the index cwd map" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1312: ); - let bare = rows.iter().find(|r| r.id == "ep-bare").expect("ep-bare row"); - assert!(bare.project_history.is_empty(), "unindexed endpoint renders '-'"); + let bare = rows + .iter() + .find(|r| r.id == "ep-bare") + .expect("ep-bare row"); + assert!( + bare.project_history.is_empty(), + "unindexed endpoint renders '-'" + ); } // [unit->REQ-PICKER-PROJECT-HISTORY-TRUTH] the derivation: sessions.log cwds Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1345: fn project_refs_from_unions_fresh_origin_and_store_branches() { let owlery = Path::new("C:/Users/x/spt-core/owlery"); // Fresh: empty ledger, origin cwd = the created-in project. - let fresh = project_refs_from(&[], Some("C:/Users/x/Documents/projects/spt-core"), vec![], owlery, folder_derive); - assert_eq!(fresh.iter().map(|r| r.id.clone()).collect::>(), vec!["spt-core"]); + let fresh = project_refs_from( + &[], + Some("C:/Users/x/Documents/projects/spt-core"), + vec![], + owlery, + folder_derive, + ); + assert_eq!( + fresh.iter().map(|r| r.id.clone()).collect::>(), + vec!["spt-core"] + ); // A psyche-host fresh perch (owlery-internal origin) has NO phantom project. - let psyche = project_refs_from(&[], Some("C:/Users/x/spt-core/owlery/hall-a/nested/hall-a-psyche"), vec![], owlery, folder_derive); - assert!(psyche.is_empty(), "an owlery-internal origin is not a project"); + let psyche = project_refs_from( + &[], + Some("C:/Users/x/spt-core/owlery/hall-a/nested/hall-a-psyche"), + vec![], + owlery, + folder_derive, + ); + assert!( + psyche.is_empty(), + "an owlery-internal origin is not a project" + ); // Store-only projects union after the session/origin ids, with an empty dir. - let unioned = project_refs_from(&[sess("C:/p/alpha")], None, vec!["beta".into()], owlery, folder_derive); - assert_eq!(unioned.iter().map(|r| r.id.clone()).collect::>(), vec!["alpha", "beta"]); - assert_eq!(unioned[1].dir, "", "a store-only project carries no session dir"); + let unioned = project_refs_from( + &[sess("C:/p/alpha")], + None, + vec!["beta".into()], + owlery, + folder_derive, + ); + assert_eq!( + unioned.iter().map(|r| r.id.clone()).collect::>(), + vec!["alpha", "beta"] + ); + assert_eq!( + unioned[1].dir, "", + "a store-only project carries no session dir" + ); } // [unit->REQ-PICKER-PROJECT-DISPLAY-NAME] the pure display render: a ref shows its Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1371: // A1: the slug id stays the key, but the RENDER is the friendly display — // an operator sees "spt-core", never "github-com-sabermage-spt-core". let a1 = [ - pr("github-com-sabermage-spt-core", "C:/x/projects/spt-core", "spt-core"), + pr( + "github-com-sabermage-spt-core", + "C:/x/projects/spt-core", + "spt-core", + ), pr("github-com-sabermage-owl", "C:/x/owl", "owl"), ]; assert_eq!(disambiguate_project_ids(&a1), vec!["spt-core", "owl"]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1378: // Collision on the DISPLAY (two different repos both named spt-core, different // parents) → parent-folder suffix (one at a drive root). let coll = [ - pr("github-com-a-spt-core", "C:/x/projects/spt-core", "spt-core"), + pr( + "github-com-a-spt-core", + "C:/x/projects/spt-core", + "spt-core", + ), pr("github-com-b-spt-core", "D:/spt-core", "spt-core"), ]; assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1386: vec!["spt-core (projects)", "spt-core (D:)"] ); // Drive-only: both dirs at a root → the drive letter disambiguates. - let drive = [ - pr("a", "C:/proj", "proj"), - pr("b", "D:/proj", "proj"), - ]; - assert_eq!(disambiguate_project_ids(&drive), vec!["proj (C:)", "proj (D:)"]); + let drive = [pr("a", "C:/proj", "proj"), pr("b", "D:/proj", "proj")]; + assert_eq!( + disambiguate_project_ids(&drive), + vec!["proj (C:)", "proj (D:)"] + ); // Store-only ref (no dir) → display == id verbatim (honest slug fallback). let store_only = [pr("github-com-x-ghost", "", "github-com-x-ghost")]; - assert_eq!(disambiguate_project_ids(&store_only), vec!["github-com-x-ghost"]); + assert_eq!( + disambiguate_project_ids(&store_only), + vec!["github-com-x-ghost"] + ); // C-1 (REMOTE-TRUTH): two refs sharing a display AND the SAME dir are NOT a real // collision — counting raw occurrences mis-fired a suffix (the endpoint-list path // collides a one-dir-per-endpoint cell with itself). Distinct-dir count = 1 → both bare. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1400: let same_dir = [ - pr("github-com-a-spt-core", "C:/x/projects/spt-core", "spt-core"), - pr("github-com-b-spt-core", "C:/x/projects/spt-core", "spt-core"), + pr( + "github-com-a-spt-core", + "C:/x/projects/spt-core", + "spt-core", + ), + pr( + "github-com-b-spt-core", + "C:/x/projects/spt-core", + "spt-core", + ), ]; - assert_eq!(disambiguate_project_ids(&same_dir), vec!["spt-core", "spt-core"]); + assert_eq!( + disambiguate_project_ids(&same_dir), + vec!["spt-core", "spt-core"] + ); } // [unit->REQ-PICKER-4] the `driven_by` controller pin renders the node NAME, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\data.rs:1426: // No label for this key ⇒ truncated `keyprefix…` form, still not the full hex. let other_hex = "deadbeef9876cafef00d"; let bare = driven_by_display(Some(other_hex), &node_labels).unwrap(); - assert!(bare.contains('…'), "should be the truncated keyprefix form: {bare}"); + assert!( + bare.contains('…'), + "should be the truncated keyprefix form: {bare}" + ); assert_ne!(bare, other_hex, "must not leak the bare full key-hex"); - assert!(bare.len() < other_hex.len(), "truncated, shorter than raw hex: {bare}"); + assert!( + bare.len() < other_hex.len(), + "truncated, shorter than raw hex: {bare}" + ); } // [unit->REQ-RUN-PICKER-HOME] home_subnet_options returns the node's member Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:101: // path (run() → setup_terminal); the non-interactive REQ-HOST-RUN-1 flow never // reaches here, so a headless invocation never retitles the operator's terminal. // [impl->REQ-PICKER-WINDOW-TITLE] - crossterm::execute!(stdout, SetTitle("SPT Endpoint Picker"), EnterAlternateScreen)?; + crossterm::execute!( + stdout, + SetTitle("SPT Endpoint Picker"), + EnterAlternateScreen + )?; Terminal::new(CrosstermBackend::new(stdout)) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:354: KeyCode::Char('s') if model.launch_keys_live() => { return model.confirm_terminal(ConfirmOption::Shortcut) } - KeyCode::Char('h') if model.launch_keys_live() => { - return model.start_headless_outcome() - } + KeyCode::Char('h') if model.launch_keys_live() => return model.start_headless_outcome(), KeyCode::Enter => { let opt = model.selected_confirm()?; return match opt { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:597: #[test] fn purge_outcomes_convert_to_flash_lines() { use crate::cli::PurgeOutcome as O; - assert_eq!(purge_failure_flash(&O::RefusedOnline), "! purge refused: endpoint is online"); assert_eq!( + purge_failure_flash(&O::RefusedOnline), + "! purge refused: endpoint is online" + ); + assert_eq!( purge_failure_flash(&O::RefusedOwnEndpoint), "! purge refused: this session's own endpoint" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:612: // the picker closes it is the operator's only handle to the tree whose // records purge deliberately kept. assert_eq!( - purge_failure_flash(&O::RefusedSurvivor { root_pid: Some(4242) }), + purge_failure_flash(&O::RefusedSurvivor { + root_pid: Some(4242) + }), "! purge refused: session still running (root pid 4242)" ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:640: model.screen = Screen::ConfirmPurge; let mut terminal = Terminal::new(TestBackend::new(80, 24)).expect("test terminal"); - terminal.draw(|f| view::render(&model, f)).expect("draw ConfirmPurge"); + terminal + .draw(|f| view::render(&model, f)) + .expect("draw ConfirmPurge"); // OUT-OF-BAND display mutation: write cells straight through the // BACKEND (bypassing Terminal's diff bookkeeping) — physically what Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:661: model.remove_endpoint("aa"); model.screen = Screen::PickExisting; terminal.clear().expect("baseline reset"); - terminal.draw(|f| view::render(&model, f)).expect("draw PickExisting"); + terminal + .draw(|f| view::render(&model, f)) + .expect("draw PickExisting"); // A fresh terminal rendering the same model = the complete target screen. let mut fresh = Terminal::new(TestBackend::new(80, 24)).expect("fresh terminal"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\mod.rs:707: // Empty buffer: STILL no nav (deliberate — Esc backs out). m.id_buffer.clear(); assert_eq!(handle_key(&mut m, KeyCode::Backspace), None); - assert_eq!(m.screen, Screen::CreateId, "no empty-buffer fallthrough to back()"); + assert_eq!( + m.screen, + Screen::CreateId, + "no empty-buffer fallthrough to back()" + ); // Filter mode: shortens the query, stays filtering on the list. let mut m2 = model_on_pick(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:106: // Hollow ▢: node down (Offline) or no control seat (HarnessOnly). EpDisplay::Offline | EpDisplay::HarnessOnly => glyph::OFFLINE, // Everything actionable is filled ■. - EpDisplay::Online | EpDisplay::Suspended | EpDisplay::Controlled | EpDisplay::Unbound => { - glyph::ONLINE - } + EpDisplay::Online + | EpDisplay::Suspended + | EpDisplay::Controlled + | EpDisplay::Unbound => glyph::ONLINE, } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:120: pub fn ansi_color_code(self) -> &'static str { match self { EpDisplay::Offline | EpDisplay::Suspended => "90", // bright black (dark gray) - EpDisplay::Online => "32", // green - EpDisplay::HarnessOnly => "93", // bright yellow ≈ amber - EpDisplay::Controlled => "34", // blue - EpDisplay::Unbound => "31", // red + EpDisplay::Online => "32", // green + EpDisplay::HarnessOnly => "93", // bright yellow ≈ amber + EpDisplay::Controlled => "34", // blue + EpDisplay::Unbound => "31", // red } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:908: // jumps straight into create-new. let adapter_cursor = prefill_adapter .as_deref() - .and_then(|a| adapter_rows.iter().position(|r| r.address() == a || r.adapter == a)) + .and_then(|a| { + adapter_rows + .iter() + .position(|r| r.address() == a || r.adapter == a) + }) .unwrap_or(0); // W4 UX: a bare picker OPENS on Pick-existing (the common case — most runs // re-attach an existing endpoint); `n` jumps to Create-new and Esc backs to Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1073: // ── Pick-existing: category + list ─────────────────────────────────── /// Cycle the category ring left (-1) or right (+1); resets the item cursor. pub fn move_category(&mut self, delta: isize) { - let cur = Category::ALL.iter().position(|c| *c == self.category).unwrap_or(0); + let cur = Category::ALL + .iter() + .position(|c| *c == self.category) + .unwrap_or(0); let len = Category::ALL.len() as isize; let next = ((cur as isize + delta) % len + len) % len; // category wraps self.category = Category::ALL[next as usize]; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1120: // map matched names back to their endpoint indices, score order scored .into_iter() - .filter_map(|(name, _)| { - idx.iter().copied().find(|&i| self.endpoints[i].id == name) - }) + .filter_map(|(name, _)| idx.iter().copied().find(|&i| self.endpoints[i].id == name)) .collect() } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1368: // the headless escape, see [`start_headless_outcome`](Self::start_headless_outcome)). // Attach = Control intent. ConfirmOption::Attach | ConfirmOption::Start => Some(if online { - Outcome::Attach { id: ep.id.clone(), intent: AttachIntent::Control } + Outcome::Attach { + id: ep.id.clone(), + intent: AttachIntent::Control, + } } else { bringup(RunMode::Attach) }), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1375: ConfirmOption::View => Some(if online { - Outcome::Attach { id: ep.id.clone(), intent: AttachIntent::Viewer } + Outcome::Attach { + id: ep.id.clone(), + intent: AttachIntent::Viewer, + } } else { bringup(RunMode::View) }), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1438: } pub fn resume_rows(&self) -> &[ResumeRow] { - self.selected_endpoint().map(|e| e.resume_rows.as_slice()).unwrap_or(&[]) + self.selected_endpoint() + .map(|e| e.resume_rows.as_slice()) + .unwrap_or(&[]) } pub fn move_resume(&mut self, delta: isize) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1483: resume_adapter: row.adapter.clone(), cwd, subnet: None, // existing perch — home immutable (REQ-RUN-PICKER-HOME) - mode: if headless { RunMode::Start } else { RunMode::Attach }, + mode: if headless { + RunMode::Start + } else { + RunMode::Attach + }, }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1569: resume_adapter: None, cwd, subnet: None, // existing perch — home immutable (REQ-RUN-PICKER-HOME) - mode: if headless { RunMode::Start } else { RunMode::Attach }, + mode: if headless { + RunMode::Start + } else { + RunMode::Attach + }, }) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1579: /// bringup core. `keep_id` carries the existing endpoint's id forward. pub fn reenter_create(&mut self, keep_id: bool) { let id = if keep_id { - self.selected_endpoint().map(|e| e.id.clone()).unwrap_or_default() + self.selected_endpoint() + .map(|e| e.id.clone()) + .unwrap_or_default() } else { String::new() }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1703: node: "n".to_string(), // Remote test rows carry a raw node hex (the C-2 Wake qualifier); local // rows carry none (Wake is remote-only). - node_key: if is_local { String::new() } else { "nodehex01".to_string() }, + node_key: if is_local { + String::new() + } else { + "nodehex01".to_string() + }, status, is_local, adapter_profile: "claude-spt".to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1776: #[test] fn ep_display_glyph_and_square_palette() { // Filled (actionable): online, suspended (wake), controlled, unbound. - for d in [EpDisplay::Online, EpDisplay::Suspended, EpDisplay::Controlled, EpDisplay::Unbound] - { + for d in [ + EpDisplay::Online, + EpDisplay::Suspended, + EpDisplay::Controlled, + EpDisplay::Unbound, + ] { assert_eq!(d.glyph(), glyph::ONLINE, "{d:?} is filled (actionable)"); } // Hollow (cannot act): offline (node down), harness-only (no broker seat). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1787: // square(false) = bare glyph, no escapes; square(true) = SGR-wrapped. assert_eq!(EpDisplay::Online.square(false), glyph::ONLINE); let colored = EpDisplay::Online.square(true); - assert!(colored.starts_with("\x1b[32m") && colored.ends_with("\x1b[0m"), "{colored:?}"); + assert!( + colored.starts_with("\x1b[32m") && colored.ends_with("\x1b[0m"), + "{colored:?}" + ); assert!(colored.contains(glyph::ONLINE)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1815: // Confirm, live once on the choose rows. let mut e2 = ep("hist", "g", EpStatus::Offline, true); e2.project_refs = vec![ - ProjectRef { id: "a".into(), dir: "/p/a".into(), display: "a".into() }, - ProjectRef { id: "b".into(), dir: "/p/b".into(), display: "b".into() }, + ProjectRef { + id: "a".into(), + dir: "/p/a".into(), + display: "a".into(), + }, + ProjectRef { + id: "b".into(), + dir: "/p/b".into(), + display: "b".into(), + }, ]; let mut m2 = PickerModel::new("p".into(), vec![], vec![e2], None, None, vec![]); m2.screen = Screen::PickExisting; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1824: m2.run_cwd = "/here".into(); m2.enter_pick(); assert!(matches!(m2.selected_confirm(), Some(ConfirmOption::Start))); - assert!(!m2.launch_keys_live(), "Start that diverts to choose → dead on Confirm"); + assert!( + !m2.launch_keys_live(), + "Start that diverts to choose → dead on Confirm" + ); assert!(m2.enter_choose_project_if_warranted()); assert!(m2.launch_keys_live(), "Choose-project row → live"); // choose `s` bakes an attach launcher (no resume). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1859: assert!(m4.launch_keys_live(), "Resume row → live"); assert!(matches!( m4.resume_shortcut_outcome(), - Some(Outcome::Shortcut { resume: Some(_), .. }) + Some(Outcome::Shortcut { + resume: Some(_), + .. + }) )); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1869: #[test] fn change_adapter_picks_and_returns_to_confirm() { let rows = vec![ - AdapterOption { adapter: "claude-spt".into(), profile: None, is_leaf: false }, - AdapterOption { adapter: "claude-spt".into(), profile: Some("fast".into()), is_leaf: true }, - AdapterOption { adapter: "codex".into(), profile: None, is_leaf: false }, + AdapterOption { + adapter: "claude-spt".into(), + profile: None, + is_leaf: false, + }, + AdapterOption { + adapter: "claude-spt".into(), + profile: Some("fast".into()), + is_leaf: true, + }, + AdapterOption { + adapter: "codex".into(), + profile: None, + is_leaf: false, + }, ]; let mut e = ep("agent", "g", EpStatus::Offline, true); e.adapter_profile = "claude-spt".into(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1931: "suspended → gray-FILLED, not offline" ); e.status = EpStatus::Offline; - assert_eq!(e.display_status(), EpDisplay::Offline, "offline → gray-hollow"); + assert_eq!( + e.display_status(), + EpDisplay::Offline, + "offline → gray-hollow" + ); assert_ne!(EpStatus::Suspended, EpStatus::Offline); assert_eq!(EpDisplay::Suspended.label(), "SUSPENDED"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1966: "BOX".into(), None, ); - assert_eq!(full.adapter_profile, "claude-spt:doyle", "adapter from gossip, not the blurb"); - assert_eq!(full.project_history, vec!["spt-core", "owl"], "history from gossiped projects"); + assert_eq!( + full.adapter_profile, "claude-spt:doyle", + "adapter from gossip, not the blurb" + ); + assert_eq!( + full.project_history, + vec!["spt-core", "owl"], + "history from gossiped projects" + ); assert!(full.controlled, "controlled read verbatim from gossip"); assert!(full.driven_by.is_none(), "no gossiped driver → no pin"); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1975: EpDisplay::Controlled, "controlled=true → blue even with no gossiped driver (the #4 decouple)" ); - assert_eq!(full.description, "a yellow-pages blurb", "the blurb stays the description"); + assert_eq!( + full.description, "a yellow-pages blurb", + "the blurb stays the description" + ); // N-1 pre-field row: degrades clean — empty adapter/history, not controlled. let bare = EndpointRow::from_resource_row(&row(None, &[], false), "BOX".into(), None); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1982: - assert!(bare.adapter_profile.is_empty(), "pre-field adapter → empty (renders '-')"); - assert!(bare.project_history.is_empty(), "pre-field projects → empty"); + assert!( + bare.adapter_profile.is_empty(), + "pre-field adapter → empty (renders '-')" + ); + assert!( + bare.project_history.is_empty(), + "pre-field projects → empty" + ); assert!(!bare.controlled, "pre-field row → not controlled"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:1994: let mut s = ep("x", "g", EpStatus::Suspended, false); s.is_unbound = true; // ignored once suspended s.driven_by = Some("n".into()); - assert_eq!(s.display_status(), EpDisplay::Suspended, "suspended wins over unbound/controlled"); + assert_eq!( + s.display_status(), + EpDisplay::Suspended, + "suspended wins over unbound/controlled" + ); let off = ep("x", "g", EpStatus::Offline, false); assert_eq!(off.display_status(), EpDisplay::Offline); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2007: // bound + free + controllable live → green Online. assert_eq!(online(&|e| e.controllable = Some(true)), EpDisplay::Online); // bound + controlled → blue Controlled. - assert_eq!(online(&|e| e.driven_by = Some("n".into())), EpDisplay::Controlled); + assert_eq!( + online(&|e| e.driven_by = Some("n".into())), + EpDisplay::Controlled + ); // #3 (REQ-PICKER-CONTROLLED-LOCAL): a LOCALLY-SPAWN-controlled endpoint has // driven_by=None (the by=None dispatch_spawn case) + controlled=true → STILL blue // Controlled in its own node's picker. Keying on driven_by alone (the bug) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2055: assert_eq!(e.display_status(), EpDisplay::HarnessOnly); // A legacy live agent (controllable unknown) is also amber (self-corrects). e.controllable = None; - assert_eq!(e.display_status(), EpDisplay::HarnessOnly, "legacy None → amber"); + assert_eq!( + e.display_status(), + EpDisplay::HarnessOnly, + "legacy None → amber" + ); // A controllable (spt-hosted) live agent → green. e.controllable = Some(true); assert_eq!(e.display_status(), EpDisplay::Online); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2063: // A controlled endpoint → blue, outranking harness-only. e.controllable = Some(false); e.driven_by = Some("cafe".into()); - assert_eq!(e.display_status(), EpDisplay::Controlled, "driven_by → blue"); + assert_eq!( + e.display_status(), + EpDisplay::Controlled, + "driven_by → blue" + ); // A NON-live online endpoint (gateway) is never amber — green, even with // controllable == Some(false)/None. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2070: let mut gw = ep("gw", "g", EpStatus::Online, true); gw.endpoint_type = "gateway".into(); gw.controllable = None; - assert_eq!(gw.display_status(), EpDisplay::Online, "gateway never amber"); + assert_eq!( + gw.display_status(), + EpDisplay::Online, + "gateway never amber" + ); gw.controllable = Some(false); assert_eq!(gw.display_status(), EpDisplay::Online); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2095: let mut e = ep("u", "g", EpStatus::Online, true); e.is_unbound = true; e.controllable = Some(false); // would be HarnessOnly if not unbound - assert_eq!(e.display_status(), EpDisplay::Unbound, "unbound → red, not amber"); + assert_eq!( + e.display_status(), + EpDisplay::Unbound, + "unbound → red, not amber" + ); // A node driving the unbound endpoint still renders Unbound (the dropped // UnboundControlled is absorbed — W5 palette). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2111: // → Offline. (The old test asserted Offline for status=Offline+is_unbound, // which encoded an impossible combo AND the masking bug — removed.) let dead = ep("d", "g", EpStatus::Offline, true); // is_unbound defaults false - assert_eq!(dead.display_status(), EpDisplay::Offline, "a real offline → gray"); + assert_eq!( + dead.display_status(), + EpDisplay::Offline, + "a real offline → gray" + ); // A plain online row with the unbound flag clear is unaffected. let plain = ep("p", "g", EpStatus::Online, true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2152: adapter: None, }; let t = with_proj.title(); - assert!(t.starts_with("spt-core - "), "project head + ` - ` sep: {t}"); + assert!( + t.starts_with("spt-core - "), + "project head + ` - ` sep: {t}" + ); assert!(t.ends_with(" (…12345)"), "trailing …id5: {t}"); assert!( t.contains("AM") || t.contains("PM"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2196: None, vec![], ); - assert_eq!(m.screen, Screen::PickExisting, "bare picker opens on Pick-existing"); + assert_eq!( + m.screen, + Screen::PickExisting, + "bare picker opens on Pick-existing" + ); m.screen = Screen::Kind; // jump back to the Layer-1 menu m.kind_cursor = 0; m.enter_kind(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2251: let mut m = PickerModel::new("p".into(), vec![], vec![], None, None, vec![]); assert_eq!(m.category, Category::Project); m.move_category(-1); - assert_eq!(m.category, Category::Subnet, "left from first wraps to last"); + assert_eq!( + m.category, + Category::Subnet, + "left from first wraps to last" + ); m.move_category(1); assert_eq!(m.category, Category::Project); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2314: m.category = Category::Local; m.enter_pick(); let opts = m.confirm_options(); - assert!(opts.contains(&ConfirmOption::Resume), "offline+local+ledger ⇒ Resume"); - assert!(opts.contains(&ConfirmOption::ChangeAdapter), "offline ⇒ ChangeAdapter"); - assert!(!opts.contains(&ConfirmOption::Instantiate), "local ⇒ no Instantiate"); + assert!( + opts.contains(&ConfirmOption::Resume), + "offline+local+ledger ⇒ Resume" + ); + assert!( + opts.contains(&ConfirmOption::ChangeAdapter), + "offline ⇒ ChangeAdapter" + ); + assert!( + !opts.contains(&ConfirmOption::Instantiate), + "local ⇒ no Instantiate" + ); assert!(opts.contains(&ConfirmOption::Fork) && opts.contains(&ConfirmOption::Shortcut)); // Offline ⇒ Start (bring up), never a bare Attach (nothing live yet). // [unit->REQ-PICKER-ONLINE-ACTION] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2323: assert!(opts.contains(&ConfirmOption::Start), "offline ⇒ Start"); - assert!(!opts.contains(&ConfirmOption::Attach), "offline ⇒ no bare Attach"); + assert!( + !opts.contains(&ConfirmOption::Attach), + "offline ⇒ no bare Attach" + ); // online local: no Resume, no ChangeAdapter. let online = ep("b", "g", EpStatus::Online, true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2360: m.category = Category::Subnet; m.enter_pick(); let opts = m.confirm_options(); - assert!(opts.contains(&ConfirmOption::Wake), "remote suspended ⇒ Wake now"); - assert!(!opts.contains(&ConfirmOption::Start), "remote suspended ⇒ NO local Start"); assert!( + opts.contains(&ConfirmOption::Wake), + "remote suspended ⇒ Wake now" + ); + assert!( + !opts.contains(&ConfirmOption::Start), + "remote suspended ⇒ NO local Start" + ); + assert!( !opts.contains(&ConfirmOption::ChangeAdapter), "remote suspended ⇒ NO ChangeAdapter (co-gate b: it writes a LOCAL record)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2369: - assert!(opts.contains(&ConfirmOption::Instantiate), "remote ⇒ Instantiate survives"); + assert!( + opts.contains(&ConfirmOption::Instantiate), + "remote ⇒ Instantiate survives" + ); assert!(opts.contains(&ConfirmOption::Fork) && opts.contains(&ConfirmOption::Shortcut)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2400: m.category = Category::Local; m.enter_pick(); let opts = m.confirm_options(); - assert!(opts.contains(&ConfirmOption::Start), "local offline ⇒ Start (unchanged)"); - assert!(!opts.contains(&ConfirmOption::Wake), "local offline ⇒ NO Wake"); - assert!(opts.contains(&ConfirmOption::ChangeAdapter), "local offline ⇒ ChangeAdapter kept"); assert!( - matches!(m.confirm_terminal(ConfirmOption::Start), Some(Outcome::Run { .. })), + opts.contains(&ConfirmOption::Start), + "local offline ⇒ Start (unchanged)" + ); + assert!( + !opts.contains(&ConfirmOption::Wake), + "local offline ⇒ NO Wake" + ); + assert!( + opts.contains(&ConfirmOption::ChangeAdapter), + "local offline ⇒ ChangeAdapter kept" + ); + assert!( + matches!( + m.confirm_terminal(ConfirmOption::Start), + Some(Outcome::Run { .. }) + ), "local Start ⇒ local bringup (Outcome::Run), never Wake" ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2424: m.id_push(c); } match m.create_outcome().unwrap() { - Outcome::Run { adapter, id, resume, resume_adapter: _, cwd: _, subnet, mode } => { + Outcome::Run { + adapter, + id, + resume, + resume_adapter: _, + cwd: _, + subnet, + mode, + } => { assert_eq!(adapter, "claude-spt:fast"); assert_eq!(id, "doyle"); assert_eq!(resume, None); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2458: // immediately; a lone entry whose dir differs (A) or any >1 history (B) offers. #[test] fn should_offer_project_choice_fire_conditions() { - let pr = |id: &str, dir: &str| ProjectRef { id: id.into(), dir: dir.into(), display: id.into() }; - assert!(!should_offer_project_choice("/here", &[]), "no history → start"); + let pr = |id: &str, dir: &str| ProjectRef { + id: id.into(), + dir: dir.into(), + display: id.into(), + }; assert!( + !should_offer_project_choice("/here", &[]), + "no history → start" + ); + assert!( !should_offer_project_choice("/here", &[pr("a", "/here")]), "lone entry already at run cwd → no choice" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2485: // "(CURRENT DIR)" marker instead (A-2). No history → empty. #[test] fn build_project_choices_head_here_rest() { - let pr = |id: &str, dir: &str| ProjectRef { id: id.into(), dir: dir.into(), display: id.into() }; + let pr = |id: &str, dir: &str| ProjectRef { + id: id.into(), + dir: dir.into(), + display: id.into(), + }; let hist = vec![pr("recent", "/p/recent"), pr("older", "/p/older")]; let ch = build_project_choices("/here", &hist); assert_eq!(ch.len(), 3, "head + current-dir + rest"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2492: assert_eq!(ch[0].cwd, "/p/recent"); // A-3: the not-in-history current-dir row reads "CURRENT DIR --> " // (folder tail of the run cwd), NOT the old "Here: ". - assert_eq!(ch[1].label, "CURRENT DIR --> here", "current-dir row, folder tail"); + assert_eq!( + ch[1].label, "CURRENT DIR --> here", + "current-dir row, folder tail" + ); assert_eq!(ch[1].cwd, "/here"); assert_eq!(ch[2].cwd, "/p/older", "rest newest→oldest"); // Run cwd IS the head dir → no separate current-dir row; the head SELF-IDENTIFIES. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2503: "no separate current-dir row when cwd is already a history dir" ); // A-2: the matching history row carries the "(CURRENT DIR)" marker. - assert_eq!(ch2[0].label, "recent (CURRENT DIR)", "head row self-identifies as current"); + assert_eq!( + ch2[0].label, "recent (CURRENT DIR)", + "head row self-identifies as current" + ); assert!(build_project_choices("/here", &[]).is_empty()); // [unit->REQ-PICKER-CHOOSE-DEDUP-ALL] A4: run cwd matches an OLDER (non-head) // history dir → still no separate current-dir row (that project is already the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2517: assert_eq!(ch3[0].cwd, "/p/recent"); assert_eq!(ch3[1].cwd, "/p/older"); // A-2: the older row that matches the run cwd self-identifies. - assert_eq!(ch3[1].label, "older (CURRENT DIR)", "older row self-identifies as current"); + assert_eq!( + ch3[1].label, "older (CURRENT DIR)", + "older row self-identifies as current" + ); } // [unit->REQ-PICKER-START-PROJECT-CHOICE] "Start now" diverts to the choice Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2527: fn choose_project_outcome_bakes_cwd_and_diverts() { let mut e = ep("agent", "g", EpStatus::Offline, true); e.project_refs = vec![ - ProjectRef { id: "recent".into(), dir: "/p/recent".into(), display: "recent".into() }, - ProjectRef { id: "older".into(), dir: String::new(), display: "older".into() }, + ProjectRef { + id: "recent".into(), + dir: "/p/recent".into(), + display: "recent".into(), + }, + ProjectRef { + id: "older".into(), + dir: String::new(), + display: "older".into(), + }, ]; let mut m = PickerModel::new("p".into(), vec![], vec![e], None, None, vec![]); m.category = Category::Local; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2535: m.run_cwd = "/here".into(); m.enter_pick(); - assert!(m.enter_choose_project_if_warranted(), "history>1 warrants the step"); + assert!( + m.enter_choose_project_if_warranted(), + "history>1 warrants the step" + ); assert_eq!(m.screen, Screen::ChooseProject); // Head choice (cursor 0) bakes its recorded dir + attaches by default. match m.choose_project_outcome(false).unwrap() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2558: // Skip case: a lone entry already at the run cwd starts immediately (no divert). let mut solo = ep("solo", "g", EpStatus::Offline, true); - solo.project_refs = vec![ProjectRef { id: "recent".into(), dir: "/here".into(), display: "recent".into() }]; + solo.project_refs = vec![ProjectRef { + id: "recent".into(), + dir: "/here".into(), + display: "recent".into(), + }]; let mut m2 = PickerModel::new("p".into(), vec![], vec![solo], None, None, vec![]); m2.category = Category::Local; m2.run_cwd = "/here".into(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2565: m2.enter_pick(); assert!(!m2.enter_choose_project_if_warranted()); - assert_eq!(m2.screen, Screen::Confirm, "no divert → today's immediate start"); + assert_eq!( + m2.screen, + Screen::Confirm, + "no divert → today's immediate start" + ); } // [unit->REQ-RUN-PICKER] confirm terminal actions route correctly: an online Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2579: use spt_net::net::attach::AttachIntent; assert_eq!( m.confirm_terminal(ConfirmOption::Attach), - Some(Outcome::Attach { id: "live".into(), intent: AttachIntent::Control }) + Some(Outcome::Attach { + id: "live".into(), + intent: AttachIntent::Control + }) ); assert_eq!( m.confirm_terminal(ConfirmOption::View), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2586: - Some(Outcome::Attach { id: "live".into(), intent: AttachIntent::Viewer }) + Some(Outcome::Attach { + id: "live".into(), + intent: AttachIntent::Viewer + }) ); match m.confirm_terminal(ConfirmOption::Shortcut).unwrap() { Outcome::Shortcut { adapter, id, .. } => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2642: fn resume_outcome_bakes_session() { let mut e = ep("cold", "g", EpStatus::Offline, true); e.resume_rows = vec![ - ResumeRow { session_id: "old".into(), ts: "t1".into(), trigger: "boot".into(), project: String::new(), cwd: None, adapter: None }, - ResumeRow { session_id: "new".into(), ts: "t2".into(), trigger: "clear".into(), project: String::new(), cwd: Some("/proj/new".into()), adapter: None }, + ResumeRow { + session_id: "old".into(), + ts: "t1".into(), + trigger: "boot".into(), + project: String::new(), + cwd: None, + adapter: None, + }, + ResumeRow { + session_id: "new".into(), + ts: "t2".into(), + trigger: "clear".into(), + project: String::new(), + cwd: Some("/proj/new".into()), + adapter: None, + }, ]; let mut m = PickerModel::new("p".into(), vec![], vec![e], None, None, vec![]); m.category = Category::Local; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2721: // re-stamp (Some → the dispatch will re-stamp on a diff). assert_eq!(m.selected_resume().unwrap().session_id, "recorded"); match m.resume_outcome(false).unwrap() { - Outcome::Run { adapter, resume_adapter, .. } => { - assert_eq!(adapter, "claude-spt", "recorded row adapter overrides the endpoint stamp"); + Outcome::Run { + adapter, + resume_adapter, + .. + } => { assert_eq!( + adapter, "claude-spt", + "recorded row adapter overrides the endpoint stamp" + ); + assert_eq!( resume_adapter.as_deref(), Some("claude-spt"), "the literal recorded adapter drives the re-stamp" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2739: m.move_resume(1); assert_eq!(m.selected_resume().unwrap().session_id, "legacy"); match m.resume_outcome(false).unwrap() { - Outcome::Run { adapter, resume_adapter, .. } => { - assert_eq!(adapter, "claude-spt:ccs", "a None-adapter row degrades to the endpoint stamp"); + Outcome::Run { + adapter, + resume_adapter, + .. + } => { assert_eq!( + adapter, "claude-spt:ccs", + "a None-adapter row degrades to the endpoint stamp" + ); + assert_eq!( resume_adapter, None, "a None-adapter row carries NO resume_adapter → dispatch never writes (no clobber)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2762: m.category = Category::Local; assert!(!m.purge_key_live(), "online ⇒ x not live"); m.enter_confirm_purge(); - assert_ne!(m.screen, Screen::ConfirmPurge, "online never reaches the confirm"); + assert_ne!( + m.screen, + Screen::ConfirmPurge, + "online never reaches the confirm" + ); assert!( - m.flash.as_deref().is_some_and(|f| f.contains("offline only")), + m.flash + .as_deref() + .is_some_and(|f| f.contains("offline only")), "online ⇒ flash the offline-only gate, got {:?}", m.flash ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2775: m2.category = Category::Subnet; assert!(!m2.purge_key_live(), "remote ⇒ x not live"); m2.enter_confirm_purge(); - assert_ne!(m2.screen, Screen::ConfirmPurge, "remote never reaches the confirm"); + assert_ne!( + m2.screen, + Screen::ConfirmPurge, + "remote never reaches the confirm" + ); assert!( - m2.flash.as_deref().is_some_and(|f| f.contains("local endpoints only")), + m2.flash + .as_deref() + .is_some_and(|f| f.contains("local endpoints only")), "remote ⇒ flash the local-only gate, got {:?}", m2.flash ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2802: m.category = Category::Local; m.enter_confirm_purge(); assert_eq!(m.screen, Screen::ConfirmPurge); - assert_eq!(m.purge_outcome(), Some(Outcome::Purge { id: "cold".into() })); + assert_eq!( + m.purge_outcome(), + Some(Outcome::Purge { id: "cold".into() }) + ); // Esc rides the shared back(): confirm → list, nothing purged. - assert!(!m.back(), "back never exits the picker from the purge confirm"); + assert!( + !m.back(), + "back never exits the picker from the purge confirm" + ); assert_eq!(m.screen, Screen::PickExisting); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2839: m.enter_pick(); m.reenter_create(true); assert_eq!(m.screen, Screen::CreateAdapter); - assert_eq!(m.id_buffer, "cold", "change-adapter/instantiate keep the id"); + assert_eq!( + m.id_buffer, "cold", + "change-adapter/instantiate keep the id" + ); m.reenter_create(false); assert_eq!(m.id_buffer, "", "fork starts a fresh id"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2871: m.id_push(c); } // CreateId Enter on a multi-subnet node advances to the home layer (no yield). - assert_eq!(m.enter_id(), None, "multi-subnet → CreateHome, no immediate outcome"); + assert_eq!( + m.enter_id(), + None, + "multi-subnet → CreateHome, no immediate outcome" + ); assert_eq!(m.screen, Screen::CreateHome); match m.create_outcome().expect("home-layer Enter yields the Run") { Outcome::Run { subnet, id, .. } => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2888: #[test] fn single_subnet_skips_home_layer() { let rows = build_adapter_tree(&[info("claude-spt", &[], &[])]); - let mut m = PickerModel::new("p".into(), rows.clone(), vec![], None, None, vec!["solo".into()]); + let mut m = PickerModel::new( + "p".into(), + rows.clone(), + vec![], + None, + None, + vec!["solo".into()], + ); m.screen = Screen::CreateId; for c in "doyle".chars() { m.id_push(c); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2895: } - match m.enter_id().expect("single-subnet → Run directly, no home layer") { + match m + .enter_id() + .expect("single-subnet → Run directly, no home layer") + { Outcome::Run { subnet, .. } => assert_eq!(subnet, None, "layer skipped → subnet None"), o => panic!("expected Run, got {o:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2900: - assert_eq!(m.screen, Screen::CreateId, "no CreateHome on a single-subnet node"); + assert_eq!( + m.screen, + Screen::CreateId, + "no CreateHome on a single-subnet node" + ); assert_eq!(m.selected_home(), None); // zero subnets (unpaired) likewise skips the layer. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2913: #[test] fn home_selection_bakes_into_run_subnet() { let rows = build_adapter_tree(&[info("claude-spt", &[], &[])]); - let homes = vec!["bignet".to_string(), "homenet".to_string(), "labnet".to_string()]; + let homes = vec![ + "bignet".to_string(), + "homenet".to_string(), + "labnet".to_string(), + ]; let mut m = PickerModel::new("p".into(), rows, vec![], None, None, homes); m.screen = Screen::CreateId; for c in "doyle".chars() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2928: o => panic!("expected Run, got {o:?}"), } m.move_home(5); // clamps at the last entry, never wraps - assert_eq!(m.selected_home(), Some("labnet".into()), "home cursor clamps at the end"); + assert_eq!( + m.selected_home(), + Some("labnet".into()), + "home cursor clamps at the end" + ); } // [unit->REQ-RUN-PICKER-HOME] Esc backs CreateHome → CreateId, then CreateId → Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\model.rs:2941: assert!(!m.back()); assert_eq!(m.screen, Screen::CreateId, "CreateHome Esc → CreateId"); assert!(!m.back()); - assert_eq!(m.screen, Screen::CreateAdapter, "CreateId Esc → CreateAdapter (unchanged)"); + assert_eq!( + m.screen, + Screen::CreateAdapter, + "CreateId Esc → CreateAdapter (unchanged)" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:207: // fresh run defaults to --create + attach (no action flag). #[test] fn bakes_create_attach_by_default() { - let body = render_script(DEFAULT_BASENAME, "doyle", "claude-spt:fast", None, RunMode::Attach); + let body = render_script( + DEFAULT_BASENAME, + "doyle", + "claude-spt:fast", + None, + RunMode::Attach, + ); assert!(body.contains("--adapter claude-spt:fast")); assert!(body.contains("--id doyle")); assert!(body.contains("--create")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:214: assert!(!body.contains("--resume")); assert!(!body.contains("--start") && !body.contains("--view")); - assert!(has_sentinel(&body), "sentinel rides a comment line near the top"); + assert!( + has_sentinel(&body), + "sentinel rides a comment line near the top" + ); // harness-agnostic spt-core emits `spt-`, NEVER `cc-`. assert!(body.contains("spt-doyle")); assert!(!body.contains("cc-doyle")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:225: fn basename_is_parameterized() { assert_eq!( shortcut_filename(DEFAULT_BASENAME, "doyle"), - if cfg!(windows) { "spt-doyle.cmd" } else { "spt-doyle" } + if cfg!(windows) { + "spt-doyle.cmd" + } else { + "spt-doyle" + } ); assert_eq!( shortcut_filename("cc", "doyle"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:232: - if cfg!(windows) { "cc-doyle.cmd" } else { "cc-doyle" } + if cfg!(windows) { + "cc-doyle.cmd" + } else { + "cc-doyle" + } ); let body = render_script("cc", "doyle", "claude-spt", None, RunMode::Attach); assert!(body.contains("cc-doyle"), "adapter override emits cc-"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:251: // [unit->REQ-RUN-SHORTCUT] sentinel detection only trusts our own header. #[test] fn sentinel_detection() { - assert!(has_sentinel(&render_script(DEFAULT_BASENAME, "x", "a", None, RunMode::Attach))); - assert!(!has_sentinel("#!/bin/sh\necho hi\n"), "a user script has no sentinel"); + assert!(has_sentinel(&render_script( + DEFAULT_BASENAME, + "x", + "a", + None, + RunMode::Attach + ))); + assert!( + !has_sentinel("#!/bin/sh\necho hi\n"), + "a user script has no sentinel" + ); } // [unit->REQ-RUN-SHORTCUT] create → update (our own) → refuse (foreign). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:262: let p = dir.path(); // 1. fresh → Created. - let out = - write_shortcut(p, DEFAULT_BASENAME, "doyle", "claude-spt", None, RunMode::Attach) - .unwrap(); + let out = write_shortcut( + p, + DEFAULT_BASENAME, + "doyle", + "claude-spt", + None, + RunMode::Attach, + ) + .unwrap(); let path = match out { WriteOutcome::Created(path) => path, other => panic!("expected Created, got {other:?}"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:272: assert!(path.exists()); // 2. re-generate over our own → Updated (different selection rewrites). - let out = - write_shortcut(p, DEFAULT_BASENAME, "doyle", "ccs", Some("s9"), RunMode::Start).unwrap(); + let out = write_shortcut( + p, + DEFAULT_BASENAME, + "doyle", + "ccs", + Some("s9"), + RunMode::Start, + ) + .unwrap(); assert!(matches!(out, WriteOutcome::Updated(_))); let body = std::fs::read_to_string(&path).unwrap(); assert!(body.contains("--adapter ccs") && body.contains("--resume s9")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\shortcut.rs:280: // 3. a foreign same-named file → RefusedForeign, untouched. std::fs::write(&path, "#!/bin/sh\necho mine\n").unwrap(); - let out = - write_shortcut(p, DEFAULT_BASENAME, "doyle", "claude-spt", None, RunMode::Attach) - .unwrap(); + let out = write_shortcut( + p, + DEFAULT_BASENAME, + "doyle", + "claude-spt", + None, + RunMode::Attach, + ) + .unwrap(); assert!(matches!(out, WriteOutcome::RefusedForeign(_))); assert_eq!( std::fs::read_to_string(&path).unwrap(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:157: .direction(Direction::Vertical) .constraints([Constraint::Min(1), Constraint::Length(1)]) .split(area); - let list = List::new(adapter_list_items(model)) - .block(titled_block("Choose your harness adapter for this endpoint:")); + let list = List::new(adapter_list_items(model)).block(titled_block( + "Choose your harness adapter for this endpoint:", + )); f.render_widget(list, chunks[0]); f.render_widget(legend(), chunks[1]); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:172: .direction(Direction::Vertical) .constraints([Constraint::Min(1), Constraint::Length(1)]) .split(area); - let list = List::new(adapter_list_items(model)) - .block(titled_block("Change harness adapter (applies to this endpoint):")); + let list = List::new(adapter_list_items(model)).block(titled_block( + "Change harness adapter (applies to this endpoint):", + )); f.render_widget(list, chunks[0]); f.render_widget(legend_text(LEGEND_CHANGE_ADAPTER), chunks[1]); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:316: if last_group != Some(ep.group.as_str()) { items.push(ListItem::new(Span::styled( ep.group.clone(), - Style::default().fg(Color::DarkGray).add_modifier(Modifier::DIM), + Style::default() + .fg(Color::DarkGray) + .add_modifier(Modifier::DIM), ))); // Bug #13: list the machine's shared subnets beneath its ONE header // (a machine in >1 shared subnet is a single group, not a duplicate Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:325: if !ep.subnets.is_empty() { items.push(ListItem::new(Span::styled( format!(" {} {}", glyph::BRANCH, ep.subnets.join(", ")), - Style::default().fg(Color::DarkGray).add_modifier(Modifier::DIM), + Style::default() + .fg(Color::DarkGray) + .add_modifier(Modifier::DIM), ))); } last_group = Some(ep.group.as_str()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:597: fn render_confirm(model: &PickerModel, f: &mut Frame, area: Rect) { let chunks = Layout::default() .direction(Direction::Vertical) - .constraints([Constraint::Length(7), Constraint::Min(1), Constraint::Length(1)]) + .constraints([ + Constraint::Length(7), + Constraint::Min(1), + Constraint::Length(1), + ]) .split(area); render_selection_summary(model, f, chunks[0]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:610: .map(|(i, opt)| item(confirm_option_label(model, *opt), i == model.confirm_cursor)) .collect(); f.render_widget(List::new(items).block(titled_block("Options")), chunks[1]); - f.render_widget(bottom(model, launch_legend(LEGEND_CONFIRM, model)), chunks[2]); + f.render_widget( + bottom(model, launch_legend(LEGEND_CONFIRM, model)), + chunks[2], + ); } // ── Choose-project (after "Start now") ────────────────────────────────────── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:620: fn render_choose_project(model: &PickerModel, f: &mut Frame, area: Rect) { let chunks = Layout::default() .direction(Direction::Vertical) - .constraints([Constraint::Length(7), Constraint::Min(1), Constraint::Length(1)]) + .constraints([ + Constraint::Length(7), + Constraint::Min(1), + Constraint::Length(1), + ]) .split(area); render_selection_summary(model, f, chunks[0]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:635: .map(|(i, c)| item(c.label.clone(), i == model.choose_cursor)) .collect() }; - f.render_widget(List::new(items).block(titled_block("Choose project:")), chunks[1]); + f.render_widget( + List::new(items).block(titled_block("Choose project:")), + chunks[1], + ); f.render_widget(legend_text(launch_legend(LEGEND_CHOOSE, model)), chunks[2]); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:646: fn render_resume(model: &PickerModel, f: &mut Frame, area: Rect) { let chunks = Layout::default() .direction(Direction::Vertical) - .constraints([Constraint::Length(7), Constraint::Min(1), Constraint::Length(1)]) + .constraints([ + Constraint::Length(7), + Constraint::Min(1), + Constraint::Length(1), + ]) .split(area); render_selection_summary(model, f, chunks[0]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:740: let mut m2 = PickerModel::new("spt-core".into(), vec![], vec![spt], None, None, vec![]); m2.screen = Screen::PickExisting; m2.category = Category::Local; - assert!(!rendered(&m2).contains("HARNESS ONLY"), "controllable → plain ONLINE"); + assert!( + !rendered(&m2).contains("HARNESS ONLY"), + "controllable → plain ONLINE" + ); // A REMOTE-controlled endpoint → the blue CONTROLLED status line. let mut ctl = ep("driven", EpStatus::Online, true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:775: let mut mc = PickerModel::new("spt-core".into(), vec![], vec![rc], None, None, vec![]); mc.category = Category::Local; mc.screen = Screen::Confirm; - assert!(rendered(&mc).contains("controlled by cafe"), "remote driver names the node"); + assert!( + rendered(&mc).contains("controlled by cafe"), + "remote driver names the node" + ); let mut lc = ep("localdriven2", EpStatus::Online, true); lc.controlled = true; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:801: mown.category = Category::Local; mown.screen = Screen::Confirm; let out = rendered(&mown); - assert!(out.contains("controlled locally"), "own-node driver reads as local control"); assert!( + out.contains("controlled locally"), + "own-node driver reads as local control" + ); + assert!( !out.contains("controlled by cafe"), "an own-node driver never prints the node name as a foreign driver" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:831: m4.screen = Screen::PickExisting; m4.category = Category::Local; let s4 = rendered(&m4); - assert!(s4.contains("UNBOUND"), "unbound endpoint shows the UNBOUND state"); - assert!(!s4.contains("HARNESS ONLY"), "unbound is not amber harness-only"); + assert!( + s4.contains("UNBOUND"), + "unbound endpoint shows the UNBOUND state" + ); + assert!( + !s4.contains("HARNESS ONLY"), + "unbound is not amber harness-only" + ); // W5: Unbound is now red-FILLED ■ (rc-attachable = actionable), not hollow. // [unit->REQ-SUBNET-DISPLAY-PARITY] - assert!(s4.contains(glyph::ONLINE), "unbound renders the FILLED ■ square (red, actionable)"); + assert!( + s4.contains(glyph::ONLINE), + "unbound renders the FILLED ■ square (red, actionable)" + ); } // [unit->REQ-RUN-PICKER] the kind screen renders both choices + the caret on Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:886: m.screen = Screen::CreateHome; m.id_buffer = "doyle".into(); let s = rendered(&m); - assert!(s.contains("Home subnet for doyle"), "titled with the id: {s}"); - assert!(s.contains("bignet") && s.contains("homenet"), "lists members: {s}"); + assert!( + s.contains("Home subnet for doyle"), + "titled with the id: {s}" + ); + assert!( + s.contains("bignet") && s.contains("homenet"), + "lists members: {s}" + ); } // [unit->REQ-RUN-PICKER] pick-existing renders the category tabs, the status Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:905: m.category = Category::Local; m.local_tab_label = "kitsubito".into(); let s = rendered(&m); - assert!(s.contains("kitsubito (here)"), "the local tab names this node: {s}"); + assert!( + s.contains("kitsubito (here)"), + "the local tab names this node: {s}" + ); assert!(s.contains(glyph::ONLINE), "online square"); assert!(s.contains(glyph::OFFLINE), "offline square"); assert!(s.contains("doyle")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:912: // description pane for the highlighted (first) endpoint: assert!(s.contains("claude-spt:fast"), "adapter:profile in the pane"); assert!(s.contains("spt-core"), "project history in the pane"); - assert!(s.contains("the gatekeeper"), "endpoint description in the pane"); + assert!( + s.contains("the gatekeeper"), + "endpoint description in the pane" + ); } // [unit->REQ-RUN-PICKER] an empty category renders the create hint. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:951: // Offline ⇒ no "View now": a read-only viewer needs a live PTY. // [unit->REQ-PICKER-OFFLINE-NO-VIEW] assert!(!s.contains("View now"), "offline ⇒ no dead View action"); - assert!(s.contains("Resume from history"), "offline+local+ledger ⇒ Resume option"); + assert!( + s.contains("Resume from history"), + "offline+local+ledger ⇒ Resume option" + ); assert!(s.contains("Fork endpoint")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:976: m.category = Category::Local; m.enter_pick(); let s = rendered(&m); - assert!(s.contains("Project history: spt-core"), "friendly display in the confirm panel"); - assert!(!s.contains("github-com-sabermage"), "raw slug never rendered"); + assert!( + s.contains("Project history: spt-core"), + "friendly display in the confirm panel" + ); + assert!( + !s.contains("github-com-sabermage"), + "raw slug never rendered" + ); } // [unit->REQ-PICKER-CHANGE-ADAPTER-FLOW] B-2 (F029): the change-adapter screen Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:985: #[test] fn change_adapter_screen_renders_tree_and_apply_legend() { let rows = vec![ - AdapterOption { adapter: "claude-spt".into(), profile: None, is_leaf: false }, - AdapterOption { adapter: "codex".into(), profile: None, is_leaf: false }, + AdapterOption { + adapter: "claude-spt".into(), + profile: None, + is_leaf: false, + }, + AdapterOption { + adapter: "codex".into(), + profile: None, + is_leaf: false, + }, ]; - let mut m = PickerModel::new("p".into(), rows, vec![ep("agent", EpStatus::Offline, true)], None, None, vec![]); + let mut m = PickerModel::new( + "p".into(), + rows, + vec![ep("agent", EpStatus::Offline, true)], + None, + None, + vec![], + ); m.screen = Screen::PickExisting; m.category = Category::Local; m.enter_pick(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:995: m.enter_change_adapter(); let s = rendered(&m); assert!(s.contains("Change harness adapter"), "change title"); - assert!(s.contains("claude-spt") && s.contains("codex"), "adapter rows"); - assert!(s.contains("enter apply"), "apply legend, not the create legend"); + assert!( + s.contains("claude-spt") && s.contains("codex"), + "adapter rows" + ); + assert!( + s.contains("enter apply"), + "apply legend, not the create legend" + ); } // [unit->REQ-PICKER-KEY-GATE-LAUNCH-CAPABLE] B-1 (F029): the footer renders the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1006: #[test] fn footer_hints_h_s_only_when_launch_keys_live() { // Offline, no history → "Start now" immediate-start → hints shown. - let mut m = PickerModel::new("p".into(), vec![], vec![ep("a", EpStatus::Offline, true)], None, None, vec![]); + let mut m = PickerModel::new( + "p".into(), + vec![], + vec![ep("a", EpStatus::Offline, true)], + None, + None, + vec![], + ); m.screen = Screen::PickExisting; m.category = Category::Local; m.enter_pick(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1013: let s = rendered(&m); - assert!(s.contains("h headless") && s.contains("s shortcut"), "live → hints shown"); + assert!( + s.contains("h headless") && s.contains("s shortcut"), + "live → hints shown" + ); // Online (controllable) → Attach highlighted → not launch-capable → hidden. let mut online = ep("b", EpStatus::Online, true); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1048: s.contains("Fork endpoint here --> /work/spt-core"), "fork label names the launch dir" ); - let file = if cfg!(windows) { "spt-doyle.cmd" } else { "spt-doyle" }; + let file = if cfg!(windows) { + "spt-doyle.cmd" + } else { + "spt-doyle" + }; assert!( s.contains(&format!("Set shortcut here --> /work/spt-core/{file}")), "shortcut label names the exact on-disk file" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1055: ); - assert!(!s.contains("New/Update spt-"), "old static shortcut label gone"); + assert!( + !s.contains("New/Update spt-"), + "old static shortcut label gone" + ); } // [unit->REQ-PICKER-START-PROJECT-CHOICE] the Choose-project screen keeps the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1064: use crate::picker::model::ProjectRef; let mut e = ep("doyle", EpStatus::Offline, true); e.project_refs = vec![ - ProjectRef { id: "spt-core".into(), dir: "/p/spt-core".into(), display: "spt-core".into() }, - ProjectRef { id: "owl".into(), dir: "/p/owl".into(), display: "owl".into() }, + ProjectRef { + id: "spt-core".into(), + dir: "/p/spt-core".into(), + display: "spt-core".into(), + }, + ProjectRef { + id: "owl".into(), + dir: "/p/owl".into(), + display: "owl".into(), + }, ]; let mut m = PickerModel::new("p".into(), vec![], vec![e], None, None, vec![]); m.screen = Screen::PickExisting; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1074: m.enter_pick(); assert!(m.enter_choose_project_if_warranted()); let s = rendered(&m); - assert!(s.contains("Confirm selection"), "TOP Confirm panel retained"); - assert!(s.contains("Choose project:"), "bottom swapped to the choice list"); + assert!( + s.contains("Confirm selection"), + "TOP Confirm panel retained" + ); + assert!( + s.contains("Choose project:"), + "bottom swapped to the choice list" + ); assert!(s.contains("spt-core"), "most-recent project row"); - assert!(s.contains("CURRENT DIR --> here"), "run cwd offered as a distinct dir (A-3 label)"); + assert!( + s.contains("CURRENT DIR --> here"), + "run cwd offered as a distinct dir (A-3 label)" + ); assert!(s.contains("owl"), "older history row"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\picker\view.rs:1127: m.enter_pick(); m.enter_resume(); let s = rendered(&m); - assert!(s.contains("Confirm selection"), "TOP Confirm panel retained"); - assert!(s.contains("Resume from a prior session:"), "bottom swapped to ledger"); - assert!(s.contains("spt-core - "), "a ledger row still renders under it"); + assert!( + s.contains("Confirm selection"), + "TOP Confirm panel retained" + ); + assert!( + s.contains("Resume from a prior session:"), + "bottom swapped to ledger" + ); + assert!( + s.contains("spt-core - "), + "a ledger row still renders under it" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:27: use std::time::{Duration, Instant}; use spt_daemon::attach::{request_attach_endpoint, send_attach_input, send_attach_resize}; -use spt_daemon::effect::{Minter, MintedOp}; use spt_daemon::brain::{now_ms, Brain, BrokerEvent}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::msg::decode_bytes; use spt_net::net::attach::{AttachDecoder, AttachIntent, AttachRecord}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:104: continue; } match parse_decset_private(&buf[i..]) { - DecsetParse::Complete { consumed, params, set } => { + DecsetParse::Complete { + consumed, + params, + set, + } => { for p in params { apply_mouse_mode(mode, p, set); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:131: enum DecsetParse { /// A complete `ESC[?h|l`: the byte length consumed, the numeric /// params, and `set` (`true` for `h`, `false` for `l`). - Complete { consumed: usize, params: Vec, set: bool }, + Complete { + consumed: usize, + params: Vec, + set: bool, + }, /// `ESC[?…` with no final `h`/`l` yet (chunk boundary) — carry + retry. Incomplete, /// `s` does not start a private-mode sequence (`ESC` of something else). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:144: // Need at least `ESC [ ?`. if s.len() < 3 { // Could be the very start of one split across the boundary. - if s.first() == Some(&0x1b) && s.get(1).is_none_or(|&b| b == b'[') + if s.first() == Some(&0x1b) + && s.get(1).is_none_or(|&b| b == b'[') && s.get(2).is_none_or(|&b| b == b'?') { return DecsetParse::Incomplete; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:406: fn parse_reassert_trigger(s: &[u8]) -> ReassertParse { // Alt-screen enter is a private-mode SET — reuse the DECSET parser. match parse_decset_private(s) { - DecsetParse::Complete { consumed, params, set } => { + DecsetParse::Complete { + consumed, + params, + set, + } => { let alt_enter = set && params.iter().any(|&p| matches!(p, 1049 | 47 | 1047)); return if alt_enter { ReassertParse::Fired { consumed } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:625: #[cfg(windows)] fn key_event_step(armed: &mut bool, ke: crossterm::event::KeyEvent) -> KeyAction { use crossterm::event::{KeyCode, KeyModifiers}; - let is_ctrl_b = - ke.code == KeyCode::Char('b') && ke.modifiers.contains(KeyModifiers::CONTROL); + let is_ctrl_b = ke.code == KeyCode::Char('b') && ke.modifiers.contains(KeyModifiers::CONTROL); if *armed { *armed = false; if ke.code == KeyCode::Char('d') && ke.modifiers.is_empty() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:845: } #[cfg(windows)] { - RawGuard { raw, prior_out_mode } + RawGuard { + raw, + prior_out_mode, + } } #[cfg(not(windows))] { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:895: impl DisplayGuard { fn new(out: W, active: bool) -> Self { - DisplayGuard { out, active, done: false } + DisplayGuard { + out, + active, + done: false, + } } /// Emit the cleanup postlude exactly once (idempotent; no-op when inactive). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:929: PumpEnd::Displaced(by) => { format!("\r\n[displaced — '{endpoint_id}' was taken over by {by}]") } - PumpEnd::ReconnectGaveUp { detail, daemon_down } => { + PumpEnd::ReconnectGaveUp { + detail, + daemon_down, + } => { if *daemon_down { format!( "\r\n[session '{endpoint_id}' lost — the spt daemon is down and \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1070: /// reads as absence (the downstream surfaces own that refusal copy). // [impl->REQ-RC-HONEST-SESSION-AUTHORITY] pub(crate) fn session_truth(&mut self, endpoint_id: &str) -> SessionTruth { - match self - .brain - .sessions() - .ok() - .and_then(|reply| { - reply - .sessions - .into_iter() - .find(|s| s.endpoint == endpoint_id) - }) { + match self.brain.sessions().ok().and_then(|reply| { + reply + .sessions + .into_iter() + .find(|s| s.endpoint == endpoint_id) + }) { None => SessionTruth::Absent, Some(s) => { if spt_daemon::broker::session_is_zombie( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1215: /// broker-owned `driven_by` marker (REQ-RCVIEW-1). Drives the client-side /// busy-refuse guidance. `None` ⇒ free (or no perch). fn current_driver(endpoint_id: &str) -> Option { - let perch = spt_store::perch::resolve_perch_path( - endpoint_id, - spt_store::perch::ParentHint::Infer, - ); + let perch = + spt_store::perch::resolve_perch_path(endpoint_id, spt_store::perch::ParentHint::Infer); spt_store::info::read_info(&perch).and_then(|i| i.driven_by) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1242: if *armed { *armed = false; match b { - DETACH_KEY => return DetachParse { forward, detach: true }, + DETACH_KEY => { + return DetachParse { + forward, + detach: true, + } + } DETACH_PREFIX => forward.push(DETACH_PREFIX), // literal ctrl-b other => { forward.push(DETACH_PREFIX); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1401: /// backstop + BrokerGone EOF still guard a session that dies after /// confirmation, so this is not a blank-hang reopening. // [impl->REQ-ENDPOINT-UNBOUND-ATTACH] -pub fn run_attach_session_confirmed( - endpoint_id: &str, - intent: AttachIntent, -) -> Result<(), String> { +pub fn run_attach_session_confirmed(endpoint_id: &str, intent: AttachIntent) -> Result<(), String> { run_attach_inner(endpoint_id, intent, true) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1435: // this machine" instead of a raw hex. The ADR-0044 generation ladder governs // same-identity viewports at the BROKER, below this gate — the recovery seams // (rc reconnect re-drive, dispatcher re-serve) enter there and stay reachable. - let driver = if plain_target { current_driver(&bare_id) } else { None }; + let driver = if plain_target { + current_driver(&bare_id) + } else { + None + }; if pre_broker_busy_guidance(intent, plain_target, driver.as_deref()) { let node = driver.unwrap_or_default(); let own_hex = crate::roster::own_node_hex(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1501: // ends cleanly ("no live session for endpoint") — not a hang. // [impl->REQ-HAZARD-RC-ATTACH-FAILFAST] println!("Endpoint '{endpoint_id}' is offline — nothing to attach to."); - println!( - " spt endpoint run --adapter --id {bare_id} to start it" - ); + println!(" spt endpoint run --adapter --id {bare_id} to start it"); return Ok(()); } AttachGate::Proceed => {} Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1520: // satellite exists (standing ruling). // [impl->REQ-RC-HARNESS-ONLY-REFUSAL] let local_harness_only = plain_target - && spt_store::info::read_info(&perch_path).is_some_and(|i| { - harness_only_row(&i.state, i.controllable, i.status.as_deref()) - }); + && spt_store::info::read_info(&perch_path) + .is_some_and(|i| harness_only_row(&i.state, i.controllable, i.status.as_deref())); let remote_harness_only = !local_harness_only - && crate::wansend::resolve_visible_owner_instance(endpoint_id) - .is_some_and(|inst| { - inst.harness_only - && matches!( - inst.status, - spt_net::net::registry::Status::Active - | spt_net::net::registry::Status::Dormant - ) - }); + && crate::wansend::resolve_visible_owner_instance(endpoint_id).is_some_and(|inst| { + inst.harness_only + && matches!( + inst.status, + spt_net::net::registry::Status::Active + | spt_net::net::registry::Status::Dormant + ) + }); if local_harness_only || remote_harness_only { println!( "Endpoint '{endpoint_id}' is online but harness-hosted — spt does not \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1635: // REQ-HAZARD-RC-ATTACH-FAILFAST / REQ-RC-CROSS-NODE-ATTACH surfaces // unchanged) so the teardown matrix drives postlude-precedes-prose. Ok(end) => { - let _ = writeln!(stdout, "{}", parting_prose(&end, endpoint_id, remote_node.as_deref())); + let _ = writeln!( + stdout, + "{}", + parting_prose(&end, endpoint_id, remote_node.as_deref()) + ); Ok(()) } Err(e) => Err(public_attach_failure(endpoint_id, e)), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1834: or any visible subnet." ))) } - crate::wansend::OwnerDial::Ambiguous(msg) => { - return Err(EstablishFail::NoTarget(msg)) - } + crate::wansend::OwnerDial::Ambiguous(msg) => return Err(EstablishFail::NoTarget(msg)), crate::wansend::OwnerDial::Unreachable { node, detail } => { return Err(EstablishFail::NoTarget(format!( "'{endpoint_id}' is on {node}, but it is not reachable ({detail})." Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1861: // A LOCAL attach (plain-bare hit OR LocalOwner — `req_endpoint` // is None exactly then): the broker's in-process loopback // singleton (re-mint/reuse). - None if req_endpoint.is_none() => brain - .net_dial_loopback() - .map_err(|e| { - std::io::Error::other(format!("loopback re-dial: {e}")) - })? - .conn_id, + None if req_endpoint.is_none() => { + brain + .net_dial_loopback() + .map_err(|e| std::io::Error::other(format!("loopback re-dial: {e}")))? + .conn_id + } // Remote: re-resolve + re-dial the owning node. None => match crate::wansend::resolve_and_dial_owner(&mut brain, endpoint_id) { crate::wansend::OwnerDial::Dialed { conn_id, .. } => conn_id, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:1980: // and working, never the old apparent freeze at a static "Reconnecting…". // establish_attach is CONNECT-ONLY: a down daemon yields DaemonDown here and // is retried (the operator may bring it back) WITHOUT any WMI resurrection. - let target = remote_node.clone().unwrap_or_else(|| "local daemon".to_string()); + let target = remote_node + .clone() + .unwrap_or_else(|| "local daemon".to_string()); let retry_started = Instant::now(); let mut attempt: u64 = 0; let reestablished = loop { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2037: // daemon (only knowable for a LOCAL target) gets the loud "session // lost — daemon down" copy; anything else keeps the generic // didn't-reconnect copy. Remote severs never probe local daemon state. - let daemon_down = - remote_node.is_none() && !spt_daemon::daemon::is_running(); + let daemon_down = remote_node.is_none() && !spt_daemon::daemon::is_running(); return Ok(PumpEnd::ReconnectGaveUp { detail: severed_kind.to_string(), daemon_down, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2127: // Center on the CHARACTER count (the terminal cell count for this ASCII+… // line), clamped so an over-wide text still starts on-screen. let width = text.chars().count() as u16; - let col = if width >= cols { 1 } else { (cols - width) / 2 + 1 }; + let col = if width >= cols { + 1 + } else { + (cols - width) / 2 + 1 + }; let mut out = Vec::new(); out.extend_from_slice(b"\x1b[2J\x1b[H"); out.extend_from_slice(format!("\x1b[{row};{col}H").as_bytes()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2159: /// local daemon was still down at give-up (REQ-RC-RECONNECT-TRUTH) — it /// selects the loud "session lost — daemon down" copy over the generic /// didn't-reconnect copy. [impl->REQ-RC-RECONNECT] [impl->REQ-RC-RECONNECT-TRUTH] - ReconnectGaveUp { detail: String, daemon_down: bool }, + ReconnectGaveUp { + detail: String, + daemon_down: bool, + }, /// The attach produced NO event whatsoever within the generous first-event /// backstop window (REQ-HAZARD-RC-ATTACH-FAILFAST path b): a healthy session — /// even one still painting / mid-init — replays its buffered output (or at Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2323: } Ok(StdinMsg::Detach) => return Ok(detach(brain, stream_id)), Err(mpsc::TryRecvError::Empty) => break, - Err(mpsc::TryRecvError::Disconnected) => { - return Ok(detach(brain, stream_id)) - } + Err(mpsc::TryRecvError::Disconnected) => return Ok(detach(brain, stream_id)), } } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2351: }; seen_any = true; // any broker event proves the attach stream is live match ev { - BrokerEvent::NetStreamData { stream_id: sid, bytes, .. } if sid == stream_id => { + BrokerEvent::NetStreamData { + stream_id: sid, + bytes, + .. + } if sid == stream_id => { for rec in decoder.push(&bytes) { match rec { AttachRecord::Output { seq, data_b64 } => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2365: // Track the harness's mouse-reporting mode from its output // (REQ-RC-MOUSE-FORWARD) before rendering it verbatim. mouse_scanner.feed(mouse_mode, &bytes); - stdout.write_all(&bytes).map_err(|e| format!("write: {e}"))?; + stdout + .write_all(&bytes) + .map_err(|e| format!("write: {e}"))?; // Re-assert the reserved row if the harness output just // destroyed our scroll region — alt-screen enter or a // DECSTBM reset (REQ-RC-IDENTITY). The trigger MEANS the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2450: AttachGate::RefuseZombie ); // Absence corroborates the row: offline refuses, non-offline proceeds. - assert_eq!(attach_gate(SessionTruth::Absent, true), AttachGate::RefuseOffline); - assert_eq!(attach_gate(SessionTruth::Absent, false), AttachGate::Proceed); + assert_eq!( + attach_gate(SessionTruth::Absent, true), + AttachGate::RefuseOffline + ); + assert_eq!( + attach_gate(SessionTruth::Absent, false), + AttachGate::Proceed + ); } // [unit->REQ-RC-QUALIFIED-TARGET-CANONICAL] Every qualified spelling Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2476: fn harness_only_row_matches_online_seatless_live_agents_only() { use spt_store::liveness::STATUS_ONLINE; // The reproduced field shape: online live_agent, controllable=Some(false). - assert!(harness_only_row("live_agent", Some(false), Some(STATUS_ONLINE))); + assert!(harness_only_row( + "live_agent", + Some(false), + Some(STATUS_ONLINE) + )); // Legacy None self-corrects at next bind — until then it reads // harness-only, matching the picker's amber + the gossiped fact. assert!(harness_only_row("live_agent", None, Some(STATUS_ONLINE))); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2483: // A broker PTY seat → attachable, never this refusal. - assert!(!harness_only_row("live_agent", Some(true), Some(STATUS_ONLINE))); + assert!(!harness_only_row( + "live_agent", + Some(true), + Some(STATUS_ONLINE) + )); // Not a live_agent → not this refusal. - assert!(!harness_only_row("worker", Some(false), Some(STATUS_ONLINE))); + assert!(!harness_only_row( + "worker", + Some(false), + Some(STATUS_ONLINE) + )); // Offline/unbound/status-less harness rows fall to the truthful // offline / no-session copy instead. - assert!(!harness_only_row("live_agent", Some(false), Some("offline"))); - assert!(!harness_only_row("live_agent", Some(false), Some("unbound"))); + assert!(!harness_only_row( + "live_agent", + Some(false), + Some("offline") + )); + assert!(!harness_only_row( + "live_agent", + Some(false), + Some("unbound") + )); assert!(!harness_only_row("live_agent", Some(false), None)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2503: fn pre_broker_busy_guidance_fires_for_any_driver_not_just_remote() { use spt_net::net::attach::AttachIntent; // Remote driver → guidance, no broker. - assert!(pre_broker_busy_guidance(AttachIntent::Control, true, Some("desktop"))); + assert!(pre_broker_busy_guidance( + AttachIntent::Control, + true, + Some("desktop") + )); // Own-node (same-machine second window) driver → SAME refusal, no bypass. - assert!(pre_broker_busy_guidance(AttachIntent::Control, true, Some("own-node-hex"))); + assert!(pre_broker_busy_guidance( + AttachIntent::Control, + true, + Some("own-node-hex") + )); // --view / --take bypass (watching coexists; taking displaces). - assert!(!pre_broker_busy_guidance(AttachIntent::Viewer, true, Some("desktop"))); - assert!(!pre_broker_busy_guidance(AttachIntent::Take, true, Some("desktop"))); + assert!(!pre_broker_busy_guidance( + AttachIntent::Viewer, + true, + Some("desktop") + )); + assert!(!pre_broker_busy_guidance( + AttachIntent::Take, + true, + Some("desktop") + )); // No driver latched → the broker's generation ladder owns the answer. assert!(!pre_broker_busy_guidance(AttachIntent::Control, true, None)); // A qualified target names the resolver's answer — never gated here. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2515: - assert!(!pre_broker_busy_guidance(AttachIntent::Control, false, Some("desktop"))); + assert!(!pre_broker_busy_guidance( + AttachIntent::Control, + false, + Some("desktop") + )); } // [unit->REQ-DRIVEN-BY-OWN-NODE-NORMALIZE] the guidance copy names the state Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2561: g.finish(); g.finish(); drop(g); - assert_eq!(cap.snapshot(), DISPLAY_TEARDOWN_POSTLUDE.to_vec(), "exactly one postlude"); + assert_eq!( + cap.snapshot(), + DISPLAY_TEARDOWN_POSTLUDE.to_vec(), + "exactly one postlude" + ); let piped = Capture::default(); drop(DisplayGuard::new(piped.clone(), false)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2581: PumpEnd::Exited(Some(0)), PumpEnd::Detached, PumpEnd::Displaced("node-b".to_string()), - PumpEnd::ReconnectGaveUp { detail: "connection lost".to_string(), daemon_down: true }, - PumpEnd::ReconnectGaveUp { detail: "connection lost".to_string(), daemon_down: false }, + PumpEnd::ReconnectGaveUp { + detail: "connection lost".to_string(), + daemon_down: true, + }, + PumpEnd::ReconnectGaveUp { + detail: "connection lost".to_string(), + daemon_down: false, + }, PumpEnd::Stalled, PumpEnd::NoLiveSession, ]; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2652: got & ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0, "VT-output processing enabled" ); - assert!(got & ENABLE_PROCESSED_OUTPUT != 0, "processed output enabled"); assert!( + got & ENABLE_PROCESSED_OUTPUT != 0, + "processed output enabled" + ); + assert!( got & ENABLE_WRAP_AT_EOL_OUTPUT != 0, "prior console bits preserved" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2717: fn first_event_stall_decision() { // No event + past the generous grace → stalled. assert!(first_event_stalled(false, FIRST_EVENT_GRACE)); - assert!(first_event_stalled(false, FIRST_EVENT_GRACE + Duration::from_secs(1))); + assert!(first_event_stalled( + false, + FIRST_EVENT_GRACE + Duration::from_secs(1) + )); // Any event seen → never stalled (the working/mid-init attach guard). - assert!(!first_event_stalled(true, FIRST_EVENT_GRACE + Duration::from_secs(60))); + assert!(!first_event_stalled( + true, + FIRST_EVENT_GRACE + Duration::from_secs(60) + )); // Before the grace → not yet (a slow-painting session still has time). assert!(!first_event_stalled(false, Duration::from_secs(1))); - assert!(!first_event_stalled(false, FIRST_EVENT_GRACE - Duration::from_millis(1))); + assert!(!first_event_stalled( + false, + FIRST_EVENT_GRACE - Duration::from_millis(1) + )); } /// Shared capture sink for a headless viewport drive (the seam's `out`). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2827: // Returns the OWNING brain too — the finish kills the session through it // (KIND_KILL requires the spawner's session binding). let spawn_ticker = |broker_name: &str| -> (spt_daemon::brain::Brain, u64) { - let mut host = spt_daemon::brain::Brain::cold_start(broker_name, 1) - .expect("host brain connects"); - let sid = host.spawn_session(spt_daemon::msg::SpawnReq { - program: prog.clone(), - args: args.clone(), - rows: 24, - cols: 80, - endpoint: "reheal".to_string(), - cwd: None, - env: Default::default(), - translation_binary: None, - adapter: String::new(), - install_dir: None, - }) - .expect("spawn ticker session"); + let mut host = + spt_daemon::brain::Brain::cold_start(broker_name, 1).expect("host brain connects"); + let sid = host + .spawn_session(spt_daemon::msg::SpawnReq { + program: prog.clone(), + args: args.clone(), + rows: 24, + cols: 80, + endpoint: "reheal".to_string(), + cwd: None, + env: Default::default(), + translation_binary: None, + adapter: String::new(), + install_dir: None, + }) + .expect("spawn ticker session"); (host, sid) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:2968: let (mut host2, _sid2) = spawn_ticker(&broker_name); let banner_needle = b"Reconnecting to "; - let full = wait_for(&viewport, "the reconnect banner + post-bounce output", &|s| { - s.windows(banner_needle.len()) - .position(|w| w == banner_needle) - .is_some_and(|i| String::from_utf8_lossy(&s[i..]).contains("tick")) - }); + let full = wait_for( + &viewport, + "the reconnect banner + post-bounce output", + &|s| { + s.windows(banner_needle.len()) + .position(|w| w == banner_needle) + .is_some_and(|i| String::from_utf8_lossy(&s[i..]).contains("tick")) + }, + ); // Ordering proof: output BEFORE the banner (the live pre-bounce // viewport), the banner, then output AFTER it (the re-established one). let banner_at = full Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3067: #[cfg(unix)] let (prog, args) = ( "sh".to_string(), - vec!["-c".to_string(), "while true; do echo tick; sleep 0.2; done".to_string()], + vec![ + "-c".to_string(), + "while true; do echo tick; sleep 0.2; done".to_string(), + ], ); #[cfg(windows)] let (prog, args) = ( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3077: "for /l %i in (0,0,1) do @(echo tick & ping -n 2 127.0.0.1 >nul)".to_string(), ], ); - let mut spawner = - spt_daemon::brain::Brain::cold_start(&name, 1).expect("spawner connects"); + let mut spawner = spt_daemon::brain::Brain::cold_start(&name, 1).expect("spawner connects"); spawner .spawn_session(spt_daemon::msg::SpawnReq { program: prog, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3105: // cold-started pump can no longer dial in. broker.stop(); - let est = - establish_attach("single-pump", AttachIntent::Viewer, Some(probe.into_brain())) - .unwrap_or_else(|e| { - let msg = match e { - EstablishFail::NoTarget(m) => format!("no-target: {m}"), - EstablishFail::DaemonDown => "daemon-down".to_string(), - EstablishFail::Error(m) => format!("error: {m}"), - }; - panic!( - "a regressed establish_attach that ignores the carried Brain and \ + let est = establish_attach( + "single-pump", + AttachIntent::Viewer, + Some(probe.into_brain()), + ) + .unwrap_or_else(|e| { + let msg = match e { + EstablishFail::NoTarget(m) => format!("no-target: {m}"), + EstablishFail::DaemonDown => "daemon-down".to_string(), + EstablishFail::Error(m) => format!("error: {m}"), + }; + panic!( + "a regressed establish_attach that ignores the carried Brain and \ cold-starts a fresh one would fail here — the broker's accept loop \ is stopped: {msg}" - ) - }); - assert_eq!(est.remote_node, None, "a local attach carries no remote node"); + ) + }); + assert_eq!( + est.remote_node, None, + "a local attach carries no remote node" + ); spawner.kill_session().expect("kill session"); dispatch_stop.store(true, std::sync::atomic::Ordering::Release); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3245: reg.merge_instance("l1", instance(&own_hex)); let reg_dir = spt_store::perch::identity_dir().join("registry"); std::fs::create_dir_all(®_dir).unwrap(); - std::fs::write(reg_dir.join("s1.json"), serde_json::to_string(®).unwrap()).unwrap(); + std::fs::write( + reg_dir.join("s1.json"), + serde_json::to_string(®).unwrap(), + ) + .unwrap(); { use spt_store::peeraddrs::{peer_addrs_file, PeerAddrStore}; PeerAddrStore::record(&peer_addrs_file(), &b_hex, b_addr).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3256: #[cfg(unix)] let (prog, args) = ( "sh".to_string(), - vec!["-c".to_string(), "while true; do echo tick; sleep 0.2; done".to_string()], + vec![ + "-c".to_string(), + "while true; do echo tick; sleep 0.2; done".to_string(), + ], ); #[cfg(windows)] let (prog, args) = ( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3289: let cases: [(&str, String, bool); 4] = [ ("q1", "s1:q1".to_string(), true), ("q2", format!("q2@{b_prefix}"), true), - ("q3", "q3".to_string(), true), // bare → local miss → cross-node + ("q3", "q3".to_string(), true), // bare → local miss → cross-node ("l1", "s1:l1".to_string(), false), // LocalOwner: qualified-local attach ]; for (endpoint, target, expect_remote) in cases { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3296: - let owner = if expect_remote { &remote_name } else { &local_name }; + let owner = if expect_remote { + &remote_name + } else { + &local_name + }; let mut host = spawn_ticker(owner, endpoint); let cap = Capture::default(); let mut cap_out = cap.clone(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3300: let target_for_thread = target.clone(); let viewport = std::thread::spawn(move || { - let est = - establish_attach(&target_for_thread, AttachIntent::Viewer, None).map_err(|e| { - match e { - EstablishFail::NoTarget(m) => format!("no-target: {m}"), - EstablishFail::DaemonDown => "daemon-down".to_string(), - EstablishFail::Error(m) => format!("error: {m}"), - } + let est = establish_attach(&target_for_thread, AttachIntent::Viewer, None) + .map_err(|e| match e { + EstablishFail::NoTarget(m) => format!("no-target: {m}"), + EstablishFail::DaemonDown => "daemon-down".to_string(), + EstablishFail::Error(m) => format!("error: {m}"), })?; let remote = est.remote_node.clone(); let mouse = MouseMode::default(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3423: #[test] fn reconnect_window_expiry_decision() { assert!(!reconnect_expired(Duration::from_secs(0))); - assert!(!reconnect_expired(RECONNECT_WINDOW - Duration::from_millis(1))); + assert!(!reconnect_expired( + RECONNECT_WINDOW - Duration::from_millis(1) + )); assert!(reconnect_expired(RECONNECT_WINDOW)); assert!(reconnect_expired(RECONNECT_WINDOW + Duration::from_secs(1))); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3442: // Over-wide text: col clamps to 1 (never a subtraction underflow). let narrow = reconnect_banner_bytes(2, 10, "a-very-long-node-name-indeed", 5); let ns = String::from_utf8_lossy(&narrow); - assert!(ns.contains("\x1b[1;1H"), "clamped to col 1 row 1, got {ns:?}"); + assert!( + ns.contains("\x1b[1;1H"), + "clamped to col 1 row 1, got {ns:?}" + ); } // [unit->REQ-RC-RECONNECT-TRUTH] the banner carries a VISIBLE countdown — the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3520: } }; let down = render("the daemon connection dropped", true); - assert!(down.contains("daemon is down"), "names the daemon-down truth"); - assert!(down.contains("won't auto-start"), "states rc won't resurrect it"); + assert!( + down.contains("daemon is down"), + "names the daemon-down truth" + ); + assert!( + down.contains("won't auto-start"), + "states rc won't resurrect it" + ); assert!(down.contains("spt daemon start"), "points at the restart"); let generic = render("the connection was severed", false); - assert!(!generic.contains("won't auto-start"), "generic omits the daemon-down line"); - assert!(generic.contains("didn't succeed"), "keeps the didn't-reconnect copy"); + assert!( + !generic.contains("won't auto-start"), + "generic omits the daemon-down line" + ); + assert!( + generic.contains("didn't succeed"), + "keeps the didn't-reconnect copy" + ); } // [int->REQ-RC-RECONNECT-TRUTH] rc is CONNECT-ONLY: an attach against a STOPPED Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3565: std::thread::sleep(Duration::from_millis(20)); } let outcome = worker.join().expect("attach worker joins"); - assert!(outcome.is_ok(), "a loud clean exit, not an Err: {outcome:?}"); + assert!( + outcome.is_ok(), + "a loud clean exit, not an Err: {outcome:?}" + ); // The WMI-resurrection RED: the attach birthed NO daemon. assert!( !spt_daemon::daemon::is_running(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3604: fn classify_read_err_eof_is_graceful_not_fatal() { use std::io::ErrorKind::*; // The exact kind behind "failed to fill whole buffer". - assert_eq!(classify_read_err(UnexpectedEof), ReadDisposition::BrokerGone); + assert_eq!( + classify_read_err(UnexpectedEof), + ReadDisposition::BrokerGone + ); // Same severed-stream class. assert_eq!(classify_read_err(BrokenPipe), ReadDisposition::BrokerGone); - assert_eq!(classify_read_err(ConnectionReset), ReadDisposition::BrokerGone); - assert_eq!(classify_read_err(ConnectionAborted), ReadDisposition::BrokerGone); + assert_eq!( + classify_read_err(ConnectionReset), + ReadDisposition::BrokerGone + ); + assert_eq!( + classify_read_err(ConnectionAborted), + ReadDisposition::BrokerGone + ); // Poll-slice timeouts retry (no event this slice). assert_eq!(classify_read_err(WouldBlock), ReadDisposition::Retry); assert_eq!(classify_read_err(TimedOut), ReadDisposition::Retry); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3653: fn detach_prefix_spans_chunks() { let mut armed = false; // chunk 1 ends on the bare prefix: nothing forwarded yet, armed carries. - assert_eq!(parse(&mut armed, &[b'a', DETACH_PREFIX]), (b"a".to_vec(), false)); + assert_eq!( + parse(&mut armed, &[b'a', DETACH_PREFIX]), + (b"a".to_vec(), false) + ); assert!(armed, "prefix armed across the chunk boundary"); // chunk 2 starts with the detach key: detach fires. assert_eq!(parse(&mut armed, &[DETACH_KEY]), (Vec::new(), true)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3711: // Backspace / Ctrl+Backspace — relocated W7 evidence: // [unit->REQ-HAZARD-RC-INPUT-KEY-ENCODING] assert_eq!(ev(KeyCode::Backspace, N), vec![0x7f]); // char-delete DEL - // [unit->REQ-HAZARD-RC-INPUT-KEY-ENCODING] + // [unit->REQ-HAZARD-RC-INPUT-KEY-ENCODING] assert_eq!(ev(KeyCode::Backspace, ctrl), vec![0x08]); // word-delete ^H // --- CSI tilde keys (unmodified) --- Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3807: let mut armed = false; match key_event_step(&mut armed, ke(KeyCode::Char('b'), ctrl)) { KeyAction::Swallow => {} - other => panic!("unarmed Ctrl+B should Swallow, got {:?}", action_name(&other)), + other => panic!( + "unarmed Ctrl+B should Swallow, got {:?}", + action_name(&other) + ), } assert!(armed, "Ctrl+B must arm the SM"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3822: armed = true; match key_event_step(&mut armed, ke(KeyCode::Char('b'), ctrl)) { KeyAction::Forward(v) => assert_eq!(v, vec![0x02]), - other => panic!("armed + Ctrl+B should Forward [0x02], got {:?}", action_name(&other)), + other => panic!( + "armed + Ctrl+B should Forward [0x02], got {:?}", + action_name(&other) + ), } assert!(!armed); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3830: armed = true; match key_event_step(&mut armed, ke(KeyCode::Char('x'), none)) { KeyAction::Forward(v) => assert_eq!(v, vec![0x02, b'x']), - other => panic!("armed + 'x' should Forward [0x02,'x'], got {:?}", action_name(&other)), + other => panic!( + "armed + 'x' should Forward [0x02,'x'], got {:?}", + action_name(&other) + ), } assert!(!armed); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3842: vec![0x02, 0x04], "Ctrl+D must forward prefix + ^D, never detach" ), - other => panic!("armed + Ctrl+D must NOT Detach, got {:?}", action_name(&other)), + other => panic!( + "armed + Ctrl+D must NOT Detach, got {:?}", + action_name(&other) + ), } assert!(!armed); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3850: armed = false; match key_event_step(&mut armed, ke(KeyCode::Char('a'), none)) { KeyAction::Forward(v) => assert_eq!(v, vec![b'a']), - other => panic!("unarmed 'a' should Forward ['a'], got {:?}", action_name(&other)), + other => panic!( + "unarmed 'a' should Forward ['a'], got {:?}", + action_name(&other) + ), } assert!(!armed); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3873: #[test] fn bracketed_paste_framing_is_exact_and_content_verbatim() { // Single line. - assert_eq!(wrap_bracketed_paste(b"hi"), b"\x1b[200~hi\x1b[201~".to_vec()); + assert_eq!( + wrap_bracketed_paste(b"hi"), + b"\x1b[200~hi\x1b[201~".to_vec() + ); // Multi-line: newlines stay literal INSIDE the markers (no \r submit-storm, // no per-char translation), markers exactly once around the whole block. let content = b"line1\nline2\nline3"; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3898: row: 0, modifiers: KeyModifiers::NONE, }; - assert!(mouse_is_paste(&me(MouseEventKind::Down(MouseButton::Right)))); + assert!(mouse_is_paste(&me(MouseEventKind::Down( + MouseButton::Right + )))); assert!(!mouse_is_paste(&me(MouseEventKind::Up(MouseButton::Right)))); - assert!(!mouse_is_paste(&me(MouseEventKind::Down(MouseButton::Left)))); - assert!(!mouse_is_paste(&me(MouseEventKind::Down(MouseButton::Middle)))); + assert!(!mouse_is_paste(&me(MouseEventKind::Down( + MouseButton::Left + )))); + assert!(!mouse_is_paste(&me(MouseEventKind::Down( + MouseButton::Middle + )))); assert!(!mouse_is_paste(&me(MouseEventKind::Moved))); - assert!(!mouse_is_paste(&me(MouseEventKind::Drag(MouseButton::Right)))); + assert!(!mouse_is_paste(&me(MouseEventKind::Drag( + MouseButton::Right + )))); assert!(!mouse_is_paste(&me(MouseEventKind::ScrollDown))); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3938: }; assert_eq!(scroll_dir(&me(MouseEventKind::ScrollUp)), Some(true)); assert_eq!(scroll_dir(&me(MouseEventKind::ScrollDown)), Some(false)); - assert_eq!(scroll_dir(&me(MouseEventKind::Down(MouseButton::Right))), None); + assert_eq!( + scroll_dir(&me(MouseEventKind::Down(MouseButton::Right))), + None + ); assert_eq!(scroll_dir(&me(MouseEventKind::Moved)), None); assert_eq!(scroll_dir(&me(MouseEventKind::ScrollLeft)), None); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:3993: let mut sc = MouseModeScanner::default(); // `ESC[?1006h` split right in the middle of the digits. sc.feed(&mode, b"tail\x1b[?100"); - assert!(!mode.sgr.load(Acquire), "incomplete half must not toggle yet"); + assert!( + !mode.sgr.load(Acquire), + "incomplete half must not toggle yet" + ); sc.feed(&mode, b"6hmore"); assert!(mode.sgr.load(Acquire), "the completed sequence toggles sgr"); // Split at the very ESC/[/? boundary too. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4010: // assert here trips as a reminder to re-verify the sticky-overlay behavior. #[test] fn status_row_marker_is_disabled_by_flag() { - assert!(!status_row_active(false), "controller: id marker is OFF (#14)"); + assert!( + !status_row_active(false), + "controller: id marker is OFF (#14)" + ); assert!(!status_row_active(true), "a viewer never owns a status row"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4024: "ops : doyle @ HFENDULEAM" ); // local (unset home subnet) still renders the subnet slot. - assert_eq!(identity_line("local", "perri", Some("box")), "local : perri @ box"); + assert_eq!( + identity_line("local", "perri", Some("box")), + "local : perri @ box" + ); // No node → tail omitted. assert_eq!(identity_line("local", "perri", None), "local : perri"); // Empty / whitespace node → tail omitted (trimmed, never a bare ` @ `). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4031: assert_eq!(identity_line("local", "perri", Some("")), "local : perri"); - assert_eq!(identity_line("local", "perri", Some(" ")), "local : perri"); + assert_eq!( + identity_line("local", "perri", Some(" ")), + "local : perri" + ); } // [unit->REQ-RC-IDENTITY] the DECSTBM margin assert reserves row 1 EXACTLY: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4038: // bottom) fail. #[test] fn status_assert_reserves_row1_then_repaints() { - let s = StatusRow { text: "x".to_string(), rows: 24, cols: 80 }; + let s = StatusRow { + text: "x".to_string(), + rows: 24, + cols: 80, + }; let bytes = s.assert_bytes(); // The margin set comes first. assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4056: #[test] fn status_repaint_exact_bytes_and_right_align() { // Short text, right-aligned: width 5 in 80 cols → start col 76. - let s = StatusRow { text: "abcde".to_string(), rows: 24, cols: 80 }; + let s = StatusRow { + text: "abcde".to_string(), + rows: 24, + cols: 80, + }; let mut expect = Vec::new(); expect.extend_from_slice(b"\x1b7"); // DECSC expect.extend_from_slice(b"\x1b[1;1H"); // home Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4069: assert_eq!(s.repaint_bytes(), expect); // Exact fit: width == cols → col 1. - let s = StatusRow { text: "abcd".to_string(), rows: 10, cols: 4 }; + let s = StatusRow { + text: "abcd".to_string(), + rows: 10, + cols: 4, + }; assert!(s.repaint_bytes().windows(6).any(|w| w == b"\x1b[1;1H")); // Text WIDER than cols → clamp to col 1 (never col 0 / negative). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4076: - let s = StatusRow { text: "wide banner text".to_string(), rows: 10, cols: 4 }; + let s = StatusRow { + text: "wide banner text".to_string(), + rows: 10, + cols: 4, + }; let bytes = s.repaint_bytes(); assert!( bytes.windows(6).any(|w| w == b"\x1b[1;1H"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4081: String::from_utf8_lossy(&bytes) ); // The text still rides verbatim. - assert!( - bytes.windows(b"wide banner text".len()).any(|w| w == b"wide banner text") - ); + assert!(bytes + .windows(b"wide banner text".len()) + .any(|w| w == b"wide banner text")); } // [unit->REQ-RC-IDENTITY] restore tears the reserved row down: reset the scroll Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4090: // region to full screen (`ESC[r`) then clear the reclaimed row 1 — EXACT bytes. #[test] fn status_restore_exact_bytes() { - assert_eq!(StatusRow::restore_bytes(), b"\x1b[r\x1b[1;1H\x1b[2K".to_vec()); + assert_eq!( + StatusRow::restore_bytes(), + b"\x1b[r\x1b[1;1H\x1b[2K".to_vec() + ); } // [unit->REQ-RC-IDENTITY] update_size re-points the tracked terminal size (the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4097: // banner repaints on the NEW geometry after a window change). #[test] fn status_update_size_repoints_geometry() { - let mut s = StatusRow { text: "id".to_string(), rows: 24, cols: 80 }; + let mut s = StatusRow { + text: "id".to_string(), + rows: 24, + cols: 80, + }; s.update_size(40, 120); assert_eq!((s.rows, s.cols), (40, 120)); // The repaint now right-aligns against 120 cols: 120 - 2 + 1 = 119. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4141: fn reassert_scanner_survives_split_across_chunks() { // `ESC[?1049h` split mid-digits. let mut sc = ReassertScanner::default(); - assert!(!sc.feed(b"tail\x1b[?10"), "incomplete half must not fire yet"); + assert!( + !sc.feed(b"tail\x1b[?10"), + "incomplete half must not fire yet" + ); assert!(sc.feed(b"49hmore"), "the completed alt-screen enter fires"); // `ESC[r` split at the ESC/[ boundary. let mut sc = ReassertScanner::default(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4176: let assert_len = sink.len(); assert!(sink.starts_with(b"\x1b[2;24r"), "start reserves the row"); assert!( - sink.windows(b"local : doyle @ BOX".len()).any(|w| w == b"local : doyle @ BOX"), + sink.windows(b"local : doyle @ BOX".len()) + .any(|w| w == b"local : doyle @ BOX"), "the identity banner is painted at start" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4185: if scanner.feed(plain) { sink.write_all(&status.assert_bytes()).unwrap(); } - assert_eq!(sink.len(), assert_len, "plain output emits no status re-assert"); + assert_eq!( + sink.len(), + assert_len, + "plain output emits no status re-assert" + ); // (b') harness output WITH an alt-screen enter → re-assert (MARGIN + paint). // The trigger destroyed the scroll region, so the pump re-sets the margin, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\rc.rs:4198: sink.write_all(&status.assert_bytes()).unwrap(); } assert!(fired, "the alt-screen enter trips the re-assert scanner"); - assert!(sink.len() > before, "a re-assert was appended after the trigger"); + assert!( + sink.len() > before, + "a re-assert was appended after the trigger" + ); assert!( sink[before..].starts_with(b"\x1b[2;24r"), "the re-assert re-sets the DECSTBM margin (not just a repaint)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\roster.rs:28: /// The single resolution point the own-node display humanizations key on. // [impl->REQ-DRIVEN-BY-OWN-NODE-NORMALIZE] pub(crate) fn own_node_hex() -> Option { - spt_store::nodeid::load_or_create().ok().map(|k| k.public_key().to_hex()) + spt_store::nodeid::load_or_create() + .ok() + .map(|k| k.public_key().to_hex()) } /// A snapshot of one perch for `spt list`. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\roster.rs:281: #[test] fn match_self_by_ancestry_disambiguates_and_none() { let ancestry = [4321u32, 999, 1]; - let two_live = [("hall-a".to_string(), 4321u32), ("hall-b".to_string(), 5555)]; + let two_live = [ + ("hall-a".to_string(), 4321u32), + ("hall-b".to_string(), 5555), + ]; assert_eq!( match_self_by_ancestry(&ancestry, &two_live).as_deref(), Some("hall-a"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\roster.rs:299: // candidates' read_dir order. ancestry = [inner_parent, outer_grandparent]. let nested_ancestry = [200u32, 100]; // candidates listed OUTER-first (worst case for a candidate-order scan). - let both = [("psyche-host".to_string(), 100u32), ("agent".to_string(), 200)]; + let both = [ + ("psyche-host".to_string(), 100u32), + ("agent".to_string(), 200), + ]; assert_eq!( match_self_by_ancestry(&nested_ancestry, &both).as_deref(), Some("agent"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\roster.rs:437: // Both the top-level Self perch AND the nested psyche perch are enumerated. let resolve = |session: &str| { dirs.iter().find_map(|d| { - info::read_info(d).filter(|r| r.session_id == session).map(|r| r.id) + info::read_info(d) + .filter(|r| r.session_id == session) + .map(|r| r.id) }) }; assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\teardown.rs:222: }; let root_pid = session.pid; let mut brain = probe.into_brain(); - if brain.teardown_session(Some(session.session_id), id).is_err() { + if brain + .teardown_session(Some(session.session_id), id) + .is_err() + { // The request never left; nothing was torn down. return unconfirmed_verdict(root_pid, root_provably_gone); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\teardown.rs:318: #[test] fn timeout_refuses_the_stamp_and_names_the_survivor() { assert!( - !TeardownResult::TimedOut { root_pid: Some(4242) }.may_stamp(), + !TeardownResult::TimedOut { + root_pid: Some(4242) + } + .may_stamp(), "a survivor must never be stamped over" ); for ok in [ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\teardown.rs:332: let line = timeout_line("STOP", "doyle", Some(4242)); assert!(line.contains("STOP_FAIL:doyle"), "stable token: {line}"); - assert!(line.contains("4242"), "names the surviving root pid: {line}"); assert!( + line.contains("4242"), + "names the surviving root pid: {line}" + ); + assert!( line.contains("NOT stamped"), "states that nothing was stamped: {line}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\teardown.rs:340: #[cfg(windows)] - assert!(line.contains("taskkill /PID 4242"), "names the remedy: {line}"); + assert!( + line.contains("taskkill /PID 4242"), + "names the remedy: {line}" + ); #[cfg(not(windows))] assert!(line.contains("kill -9"), "names the remedy: {line}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\wansend.rs:22: use std::time::Duration; use spt_daemon::brain::Brain; -use spt_daemon::effect::{Minter, MintedOp}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::endpoint::broker_socket_name; use spt_net::net::endpoint::addr_for_node_hex; use spt_net::net::registry::{ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\wansend.rs:156: let instance = match resolve_across_visible(®s, &address, &own_hex, excluded) { Resolution::Resolved { instance, .. } => instance, - Resolution::Ambiguous(a) => return OwnerDial::Ambiguous(render_refusal(&address.id, &a, ®s)), + Resolution::Ambiguous(a) => { + return OwnerDial::Ambiguous(render_refusal(&address.id, &a, ®s)) + } Resolution::NotFound => return OwnerDial::NotFound, }; if instance.node == own_hex { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\wansend.rs:197: /// rc can refuse truthfully BEFORE any attach/stream. // [impl->REQ-RC-HARNESS-ONLY-REFUSAL] pub fn resolve_visible_owner_instance(endpoint: &str) -> Option { - let own_hex = spt_store::nodeid::load_or_create().ok()?.public_key().to_hex(); + let own_hex = spt_store::nodeid::load_or_create() + .ok()? + .public_key() + .to_hex(); let address = Address::parse(endpoint).ok()?; let regs = load_snapshots(&perch::identity_dir().join("registry")); let subnets = SubnetStore::load(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\wansend.rs:1041: // The caller's candidate-gather over the snapshot map. let cands: Vec<(String, S)> = regs .values() - .flat_map(|reg| reg.instances("ling").iter().map(|i| (i.node.clone(), i.status))) + .flat_map(|reg| { + reg.instances("ling") + .iter() + .map(|i| (i.node.clone(), i.status)) + }) .collect(); - let wake = RestGoal { target: S::Active, kind: GoalKind::Exists }; + let wake = RestGoal { + target: S::Active, + kind: GoalKind::Exists, + }; // RED before A-3: a bare id was never resolved here → local miss → WOKE_FAIL. // GREEN: exactly one actionable remote instance → route to it. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\wansend.rs:1067: let n = || "b-node".to_string(); assert!(matches!( classify_wan_reply(O::Delivered, n()), - WanSendOutcome::Sent { how: "delivered", .. } + WanSendOutcome::Sent { + how: "delivered", + .. + } )); assert!(matches!( classify_wan_reply(O::Spooled, n()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\src\wansend.rs:1075: )); assert!(matches!( classify_wan_reply(O::Duplicate, n()), - WanSendOutcome::Sent { how: "duplicate", .. } + WanSendOutcome::Sent { + how: "duplicate", + .. + } )); assert!(matches!( classify_wan_reply(O::Refused, n()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\active_only_never_relay_e2e.rs:32: static E2E_LOCK: Mutex<()> = Mutex::new(()); /// `spt send ` with `body` on stdin, bounded off-thread so a hang fails loud. -fn send_bounded(spt_bin: &std::path::Path, home: &std::path::Path, args: &[&str], body: &str) -> Output { +fn send_bounded( + spt_bin: &std::path::Path, + home: &std::path::Path, + args: &[&str], + body: &str, +) -> Output { let mut child = Command::new(spt_bin) .no_window() .args(args) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\active_only_never_relay_e2e.rs:109: seed_remote_only("s1", "remotegw"); // ── active_only: must refuse LOCAL-ONLY, never attempt WAN. ── - let ao = send_bounded(&spt_bin, home.path(), &["send", "--active-only", "remotegw"], "background ctx"); + let ao = send_bounded( + &spt_bin, + home.path(), + &["send", "--active-only", "remotegw"], + "background ctx", + ); let ao_err = String::from_utf8_lossy(&ao.stderr); let ao_out = String::from_utf8_lossy(&ao.stdout); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\active_only_never_relay_e2e.rs:121: !ao_out.contains("SENT(WAN)") && !ao_err.contains("SENT(WAN)"), "active_only must NEVER be sent over the WAN.\nstdout=\n{ao_out}\nstderr=\n{ao_err}" ); - assert_ne!(ao.status.code(), Some(0), "the local-only refusal is a non-zero exit"); + assert_ne!( + ao.status.code(), + Some(0), + "the local-only refusal is a non-zero exit" + ); // ── default contrast: the SAME target DOES take the WAN leg (proving the guard // is active_only-specific). It fails the dial (no broker) but reached WAN. ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\activity_link_push_e2e.rs:206: .stderr(Stdio::from(brain_log_file)) .spawn() .expect("spawn spt daemon run"); - let brain_pid = match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) - { - Some(p) => p, - None => { - let _ = broker.kill(); - let _ = broker.wait(); - panic!( - "PRECONDITION: brain never came up.\n{}", - std::fs::read_to_string(&brain_log).unwrap_or_default() - ); - } - }; + let brain_pid = + match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) { + Some(p) => p, + None => { + let _ = broker.kill(); + let _ = broker.wait(); + panic!( + "PRECONDITION: brain never came up.\n{}", + std::fs::read_to_string(&brain_log).unwrap_or_default() + ); + } + }; // ── The surfaces under test, as a consumer calls them. ── let owlery = perch::owlery_dir(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\activity_link_push_e2e.rs:225: let shell_perch = perch::resolve_shell_perch_path_in(&owlery, owner, shell_id); let token_of = || spt_daemon::shellhost::read_link_token(&shell_perch).expect("a link token is parked"); - let bind = |token: &str| spt(&["api", "--adapter", "mock-shell", "bind-shell", "--link", token]); + let bind = |token: &str| { + spt(&[ + "api", + "--adapter", + "mock-shell", + "bind-shell", + "--link", + token, + ]) + }; let poll = |token: &str| { spt(&[ "api", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\activity_link_push_e2e.rs:281: let body = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { // ── spawn: the noop binary exits, the perch stays offline, a token parks. let out = spt(&[ - "shell", "spawn", "mock-shell", "--alias", "Scout", "--owner", owner, + "shell", + "spawn", + "mock-shell", + "--alias", + "Scout", + "--owner", + owner, ]); assert!( out.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\activity_link_push_e2e.rs:382: "the drive frame prints FIRST, intact: {:?}", both.lines ); - assert_eq!(both.drive.len(), 1, "exactly one drive frame: {:?}", both.lines); + assert_eq!( + both.drive.len(), + 1, + "exactly one drive frame: {:?}", + both.lines + ); assert!( both.lines[1].contains("type=\"activity\""), "the activity frame prints second, on its own line: {:?}", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\activity_link_push_e2e.rs:476: std::thread::sleep(Duration::from_millis(800)); let after = split_drain(&poll(&token_b).stdout); assert!( - after.activity.iter().all(|e| e.attr("state") == Some("busy")), + after + .activity + .iter() + .all(|e| e.attr("state") == Some("busy")), "REQ-ACTIVITY-LINK-PUSH: a frame stamped under the RETIRED link generation is \ never served to the relinked consumer — replaying the stale idle transition \ (since={stale_before}, superseded at {stale_after}) would be actively wrong: {:?}", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\adapter_post_step.rs:74: let out = run_update(&spt_bin, home.path(), "custom", &seam_out); let stdout = String::from_utf8_lossy(&out.stdout); let stderr = String::from_utf8_lossy(&out.stderr); - assert!(out.status.success(), "custom mode exits 0: stderr=\n{stderr}"); assert!( + out.status.success(), + "custom mode exits 0: stderr=\n{stderr}" + ); + assert!( stdout.contains("Plugin synced — run /reload-plugins"), "custom post-step notice is printed: stdout=\n{stdout}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\adapter_post_step.rs:93: assert!(seam.contains("\"adapter_applied\":false"), "seam: {seam}"); assert!(seam.contains("\"adapter_name\":\"cc\""), "seam: {seam}"); assert!(seam.contains("\"version\":\"1.0.0\""), "seam: {seam}"); - assert!(seam.contains("\"previous_version\":\"1.0.0\""), "seam: {seam}"); + assert!( + seam.contains("\"previous_version\":\"1.0.0\""), + "seam: {seam}" + ); assert!(seam.contains("\"profile_name\":null"), "seam: {seam}"); - assert!(seam.contains("\"adapter_dir\":"), "seam carries adapter_dir: {seam}"); + assert!( + seam.contains("\"adapter_dir\":"), + "seam carries adapter_dir: {seam}" + ); // ── sentinel: the reserved token fires the static [update].message. ── let _ = std::fs::remove_file(&seam_out); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\attach_wedge_e2e.rs:86: fn endpoint_run(spt_bin: &Path, home: &Path, id: &str) -> (Output, Option) { let mut cmd = Command::new(spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home); let out = output_bounded(cmd, Duration::from_secs(45)); let stderr = String::from_utf8_lossy(&out.stderr).to_string(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\attach_wedge_e2e.rs:213: .stderr(Stdio::from(brain_log_file)) .spawn() .expect("spawn spt daemon run (broker process)"); - let brain_pid = match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) - { - Some(p) => p, - None => { - let _ = broker.kill(); - let _ = broker.wait(); - panic!( - "PRECONDITION: brain never came up.\n{}", - std::fs::read_to_string(&brain_log).unwrap_or_default() - ); - } - }; + let brain_pid = + match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) { + Some(p) => p, + None => { + let _ = broker.kill(); + let _ = broker.wait(); + panic!( + "PRECONDITION: brain never came up.\n{}", + std::fs::read_to_string(&brain_log).unwrap_or_default() + ); + } + }; // ── (4) Bring up the VICTIM endpoint and prove it is SERVED (rc sees the tick). ── let victim = "wedge1"; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\attach_wedge_e2e.rs:261: // `--force`: `wedge2` is a live hosted session by design, so the W3 // STOP-LIVE-SESSION-WARN contract refuses a plain stop — this teardown // intends to kill it. [int->REQ-DAEMON-STOP-LIVE-SESSION-WARN] - cmd.no_window().args(["daemon", "stop", "--force"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop", "--force"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\attach_wedge_e2e.rs:294: let _ = broker.wait(); // ── Assertions. ── - assert!(victim_online, "PRECONDITION: the victim endpoint must come ONLINE"); + assert!( + victim_online, + "PRECONDITION: the victim endpoint must come ONLINE" + ); assert!( victim_served, "PRECONDITION: the victim must be SERVED (rc saw its tick) before we wedge it" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\bind_cwd_project_e2e.rs:174: let run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\bind_cwd_project_e2e.rs:221: if let Some(p) = harness_pid { kill_pid(p); } - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); if let Some(p) = spt_store::info::read_pid(&psyche_perch) { kill_pid(p); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\bind_cwd_project_e2e.rs:229: let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\bind_cwd_project_e2e.rs:250: "REQ-HAZARD-BIND-CWD-UNSET: a real endpoint-run perch must record info.cwd \ (it was NEVER set pre-W3 — the refuted v0.12.1 P1)", ); - assert!(!cwd.trim().is_empty(), "recorded cwd must be non-empty, got {cwd:?}"); + assert!( + !cwd.trim().is_empty(), + "recorded cwd must be non-empty, got {cwd:?}" + ); // The picker membership gate: the cwd-derived project id is non-empty and a // FRESH endpoint (no committed context) appears under that project SOLELY Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\bind_honest_cross_perch_e2e.rs:79: fn seed_perch(id: &str, session_id: &str, pid: u32, state: &str) -> PathBuf { let path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&path).unwrap(); - info::write_info(&path, &InfoJson::new(id, "2026-06-01T00:00:00Z", pid, session_id, state)).unwrap(); + info::write_info( + &path, + &InfoJson::new(id, "2026-06-01T00:00:00Z", pid, session_id, state), + ) + .unwrap(); path } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\bind_honest_cross_perch_e2e.rs:122: .stderr(Stdio::from(brain_log_file)) .spawn() .expect("spawn spt daemon run (broker process)"); - let brain_pid = match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) - { - Some(p) => p, - None => { - let _ = broker.kill(); - let _ = broker.wait(); - panic!( - "PRECONDITION: brain never came up.\n{}", - std::fs::read_to_string(&brain_log).unwrap_or_default() - ); - } - }; + let brain_pid = + match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) { + Some(p) => p, + None => { + let _ = broker.kill(); + let _ = broker.wait(); + panic!( + "PRECONDITION: brain never came up.\n{}", + std::fs::read_to_string(&brain_log).unwrap_or_default() + ); + } + }; // Precondition: the victim is pinned to its OWN sid before the attack. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\boundary_ready_strand_e2e.rs:110: // ── The pre-boundary soft session-end (CC fires it for the departing session, // whose sid still matches the pin → authenticates → removes the ready // marker). REAL `api session-end` with the pinned sid as auth proof. ── - let end = spt(&["api", "--adapter", "dummyharness", "--manifest", &mp, "session-end", id, "--session-id", sid]); - assert!(end.status.success(), "soft session-end: {}", String::from_utf8_lossy(&end.stderr)); + let end = spt(&[ + "api", + "--adapter", + "dummyharness", + "--manifest", + &mp, + "session-end", + id, + "--session-id", + sid, + ]); + assert!( + end.status.success(), + "soft session-end: {}", + String::from_utf8_lossy(&end.stderr) + ); assert!(!ready.exists(), "soft session-end removed the ready marker"); assert!( !spt_daemon::is_spt_hosted_no_relay(id, &owlery), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\boundary_ready_strand_e2e.rs:122: // clear`; auth proof = the still-current pin (sid), --to-session-id = the // successor. ── let boundary = spt(&[ - "api", "--adapter", "dummyharness", "--manifest", &mp, - "boundary", "clear", id, "--to-session-id", new_sid, "--session-id", sid, + "api", + "--adapter", + "dummyharness", + "--manifest", + &mp, + "boundary", + "clear", + id, + "--to-session-id", + new_sid, + "--session-id", + sid, ]); let b_err = String::from_utf8_lossy(&boundary.stderr).to_string(); let ready_after = ready.exists(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\boundary_ready_strand_e2e.rs:130: let target_after = spt_daemon::is_spt_hosted_no_relay(id, &owlery); - let sid_after = info::read_info(&perch::resolve_perch_path(id, ParentHint::Infer)) - .map(|r| r.session_id); + let sid_after = + info::read_info(&perch::resolve_perch_path(id, ParentHint::Infer)).map(|r| r.session_id); eprintln!( "=== F029 C-2 DIAGNOSTIC: boundary_exit={:?} ready_after={ready_after} \ target_after={target_after} sid_after={sid_after:?} ===\n{b_err}", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\boundary_ready_strand_e2e.rs:140: if let Ok(p) = std::fs::read_to_string(home.path().join("daemon.pid")) { if let Ok(p) = p.trim().parse::() { #[cfg(windows)] - let _ = Command::new("taskkill").no_window().args(["/PID", &p.to_string(), "/F"]).output(); + let _ = Command::new("taskkill") + .no_window() + .args(["/PID", &p.to_string(), "/F"]) + .output(); #[cfg(unix)] let _ = Command::new("kill").args(["-9", &p.to_string()]).output(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\boundary_ready_strand_e2e.rs:148: assert!(boundary.status.success(), "boundary must succeed:\n{b_err}"); // The rotation happened (the pin advanced to the successor). - assert_eq!(sid_after.as_deref(), Some(new_sid), "the boundary rotated the sid"); + assert_eq!( + sid_after.as_deref(), + Some(new_sid), + "the boundary rotated the sid" + ); // The load-bearing claim (C-2): the boundary RE-STAMPED ready, so the rotated // perch is a live inject target again — the checkpoint FIRE can land. // [int->REQ-HAZARD-BOUNDARY-READY-STRAND] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\boundary_ready_strand_e2e.rs:155: - assert!(ready_after, "the boundary must RE-STAMP the ready marker (C-2)"); + assert!( + ready_after, + "the boundary must RE-STAMP the ready marker (C-2)" + ); assert!( target_after, "after the boundary the perch is a live inject target again — the post-clear \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_respawn_rename.rs:130: .append(true) .open(&canonical) .expect("open the new P to append padding"); - f.write_all(&[0u8; 4096]).expect("append padding -> bytes B"); + f.write_all(&[0u8; 4096]) + .expect("append padding -> bytes B"); } let hash_b = file_hash(&canonical); assert_ne!(hash_a, hash_b, "the swap must flip the binary hash"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_respawn_rename.rs:142: // rename to P.old-8 and respawns bytes A → this assert fails; post-fix it // spawns the captured P (bytes B). Windows never followed the rename. ── kill_pid(pid0); - let (pid1, hash1) = wait_ready(&ready, Some(pid0), Duration::from_secs(45)).unwrap_or_else(|| { - kill_pid(pid0); - let _ = broker.kill(); - panic!("supervisor never respawned the brain after the rename"); - }); + let (pid1, hash1) = + wait_ready(&ready, Some(pid0), Duration::from_secs(45)).unwrap_or_else(|| { + kill_pid(pid0); + let _ = broker.kill(); + panic!("supervisor never respawned the brain after the rename"); + }); assert_ne!(pid0, pid1, "the respawned brain is a fresh process"); assert_eq!( hash1.as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:203: // Both are the real `spt` binary, so `daemon brain` runs; B differs only by // trailing bytes (behavior identical, exe_hash flips). let spt_bin = PathBuf::from(env!("CARGO_BIN_EXE_spt")); - let suffix = spt_bin.extension().map(|e| format!(".{}", e.to_string_lossy())).unwrap_or_default(); + let suffix = spt_bin + .extension() + .map(|e| format!(".{}", e.to_string_lossy())) + .unwrap_or_default(); let fixture_a = home.path().join(format!("brain-A{suffix}")); let fixture_b = home.path().join(format!("brain-B{suffix}")); std::fs::copy(&spt_bin, &fixture_a).expect("stage fixture A"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:214: .append(true) .open(&fixture_b) .expect("open fixture B to append padding"); - f.write_all(&[0u8; 4096]).expect("append padding to fixture B"); + f.write_all(&[0u8; 4096]) + .expect("append padding to fixture B"); } let hash_a = file_hash(&fixture_a); let hash_b = file_hash(&fixture_b); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:221: assert_ne!(hash_a, hash_b, "the swap must flip the binary hash"); // ── The broker (leg-b stable kernel) + a loopback QUIC peer. ── - let broker = net_broker(&broker_socket_name(), Identity::generate(), &home.path().join("a")); + let broker = net_broker( + &broker_socket_name(), + Identity::generate(), + &home.path().join("a"), + ); let peer_name = format!("spt-d7-peer-{}.sock", std::process::id()); let _peer = net_broker(&peer_name, Identity::generate(), &home.path().join("b")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:232: let mut driver = connect_retry(&broker_socket_name()); // (1) A hosted PTY child the broker holds. - let sid = driver.spawn_session(echo_spawn_req()).expect("spawn session"); + let sid = driver + .spawn_session(echo_spawn_req()) + .expect("spawn session"); let child_pid = broker.session_pid(sid).expect("hosted child has a pid"); // (2) A live QUIC connection the broker holds: dial the loopback peer. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:240: let mut peer_brain = connect_retry(&peer_name); peer_brain.net_status().expect("peer status").addr }; - driver.net_dial(peer_addr, None).expect("dial the loopback peer"); + driver + .net_dial(peer_addr, None) + .expect("dial the loopback peer"); // Both endpoints are now broker-held. assert_eq!(broker.session_count(), 1, "one hosted session established"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:298: Some(hash_a.as_str()), "gen-0 brain.ready exe_hash must be fixture A" ); - assert_eq!(broker.session_count(), 1, "session survived the driver drop + resume"); assert_eq!( + broker.session_count(), + 1, + "session survived the driver drop + resume" + ); + assert_eq!( broker.session_pid(sid), Some(child_pid), "the PTY child's pid is unchanged through the resume" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:306: ); - assert_eq!(broker.net_conn_count(), 1, "the QUIC conn survived the driver drop"); + assert_eq!( + broker.net_conn_count(), + 1, + "the QUIC conn survived the driver drop" + ); // ── SWAP: flip the selected binary to B, then trigger a planned restart // (what `apply` does: swap on disk, signal the brain to cycle). ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:335: Some(child_pid), "REQ-UPD-3: the hosted PTY child's pid is unchanged across the brain-process swap" ); - assert_eq!(broker.session_count(), 1, "exactly one hosted session throughout"); assert_eq!( + broker.session_count(), + 1, + "exactly one hosted session throughout" + ); + assert_eq!( broker.net_conn_count(), 1, "the live QUIC conn the broker holds survived the brain-process swap (SPIKE-03 in production topology)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:349: // a zombie handle merely lingers. The input rides the KIND_INPUT effect verb // on a FRESH raw connection, which does NOT steal the supervised brain's // output subscription (it is not an attach). ── - let seq_before = broker - .session_output_seq(sid) - .unwrap_or_else(|| teardown_panic(&stop, "hosted session vanished before the functional probe")); + let seq_before = broker.session_output_seq(sid).unwrap_or_else(|| { + teardown_panic(&stop, "hosted session vanished before the functional probe") + }); { let mut raw = LocalSocketTransport::connect(&broker_socket_name()) .unwrap_or_else(|_| teardown_panic(&stop, "could not open a raw input connection")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:366: }; write_frame( &mut raw, - &Envelope::new(KIND_INPUT, serde_json::to_value(input).expect("InputReq serializes")), + &Envelope::new( + KIND_INPUT, + serde_json::to_value(input).expect("InputReq serializes"), + ), ) .unwrap_or_else(|_| teardown_panic(&stop, "could not write the marker input frame")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\brain_survive.rs:375: let mut advanced = false; let deadline = Instant::now() + Duration::from_secs(15); while Instant::now() < deadline { - if broker.session_output_seq(sid).map(|s| s > seq_before).unwrap_or(false) { + if broker + .session_output_seq(sid) + .map(|s| s > seq_before) + .unwrap_or(false) + { advanced = true; break; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\composite_e2e.rs:158: let assets = gh_root.join("assets"); std::fs::create_dir_all(&assets).unwrap(); std::fs::write(gh_root.join("tag.txt"), "v1.1.0").unwrap(); - std::fs::write(assets.join("update-set.json"), signed_set_json(1, NEW_CORE_BYTES)).unwrap(); + std::fs::write( + assets.join("update-set.json"), + signed_set_json(1, NEW_CORE_BYTES), + ) + .unwrap(); std::fs::write(assets.join("spt-composite-artifact"), NEW_CORE_BYTES).unwrap(); - std::fs::write(assets.join("adapter.spt"), adapter_spt(root.path(), "1.1.0")).unwrap(); + std::fs::write( + assets.join("adapter.spt"), + adapter_spt(root.path(), "1.1.0"), + ) + .unwrap(); let gh_log = root.path().join("gh.log"); // ── (3) Register the gh_release adapter `cc` at 1.0.0 (its install dir is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\composite_e2e.rs:169: let install_dir = spt_store::perch::spt_home().join("srcs").join("cc"); std::fs::create_dir_all(&install_dir).unwrap(); std::fs::write(install_dir.join("manifest.toml"), adapter_manifest("1.0.0")).unwrap(); - spt_runtime::registry::register(&spt_store::perch::adapters_dir(), &install_dir, 1000) - .unwrap(); + spt_runtime::registry::register(&spt_store::perch::adapters_dir(), &install_dir, 1000).unwrap(); std::env::remove_var("SPT_HOME"); // ── (4) ONE invocation: bare `spt update`. ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:144: spool::spool_message_at(&perch_path, "tester", "hello over the contract").unwrap(); // Inbound assertion 3 — `api poll` drains it (the full delivery round-trip). - let poll = Command::new(&spt_bin).no_window() + let poll = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:166: // Auth negative — a poll with no proof is refused (REQ-HAZARD-LOCAL-API-AUTH // exercised through the real binary). - let unauth = Command::new(&spt_bin).no_window() + let unauth = Command::new(&spt_bin) + .no_window() .args(["api", "--adapter", "mock", "poll", id]) .env("SPT_HOME", home.path()) .env_remove("OWL_SESSION_ID") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:200: spool::spool_message_at(&perch_path, "tester", "delivered via listen").unwrap(); // Seed the startup record keyed by the anchor pid. - let seed = Command::new(&spt_bin).no_window() + let seed = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:218: // Listen consumes the seed (explicit --parent-pid for a deterministic match), // binds the perch, drains the backlog, and exits (--once). - let listen = Command::new(&spt_bin).no_window() + let listen = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:309: let anchor = std::process::id().to_string(); // Seed the startup record keyed by the anchor pid. - let seed = Command::new(&spt_bin).no_window() + let seed = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:350: // Listen (live-capable manifest): M11-W0.2 — BINDS the perch and marks it // status=online (the first-host handoff); the Psyche/pulse no longer spawn in // THIS process. The brain hosts the lifecycle (driven below). - let listen = Command::new(&spt_bin).no_window() + let listen = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:423: } // 3. Graceful shutdown fires the echo-commune BEFORE teardown (3.3). - let shutdown = Command::new(&spt_bin).no_window() + let shutdown = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:490: spool::spool_message_at(&perch_path, "tester", "delivered after cold start").unwrap(); // Cold seed — auto-starts the daemon and PUTs the seed into its memory. - let seed = Command::new(&spt_bin).no_window() + let seed = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\contract_e2e.rs:519: ); // Listen TAKEs the seed from the daemon, binds, drains the backlog, exits. - let listen = Command::new(&spt_bin).no_window() + let listen = Command::new(&spt_bin) + .no_window() .args([ "api", "--adapter", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\coordinator_image_e2e.rs:146: }; let reported = wait_coordinator_image(&broker_socket_name(), Duration::from_secs(45)) - .unwrap_or_else(|| { - teardown_panic(&stop, "the live coordinator never reported its image") - }); + .unwrap_or_else(|| teardown_panic(&stop, "the live coordinator never reported its image")); // The version the brain PROCESS was compiled at — which for this build is the // workspace version the CLI compares against. Sourced from the running // process: nothing was read off disk to produce it. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\create_bind_rest_active_e2e.rs:166: ); let after = record(id); - assert_eq!(after.session_id, "sid-life-2", "the new life owns the perch"); + assert_eq!( + after.session_id, "sid-life-2", + "the new life owns the perch" + ); assert_eq!( after.status.as_deref(), Some("online"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\docs_bundle_e2e.rs:29: /// A signed update set for the CURRENT platform whose docs entry matches /// `docs_sha` (`None` ⇒ docs-less set). -fn signed_set(version: u64, artifact: &[u8], docs_sha: Option) -> spt_daemon::SignedUpdateSet { +fn signed_set( + version: u64, + artifact: &[u8], + docs_sha: Option, +) -> spt_daemon::SignedUpdateSet { let meta = spt_daemon::UpdateSetMetadata { version, channel: "stable".to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\docs_bundle_e2e.rs:150: // Leg 1 — happy path: signed docs entry + matching staged bundle ⇒ apply // lands the version-matched tree at $SPT_HOME/docs and clears the stage. let (home1, spt1) = fresh_home(tmp.path(), "node-good"); - let (ok, stdout, stderr, swapped) = - stage_and_apply(&home1, &spt1, &artifact, Some(bundle_sha.clone()), Some(&bundle)); + let (ok, stdout, stderr, swapped) = stage_and_apply( + &home1, + &spt1, + &artifact, + Some(bundle_sha.clone()), + Some(&bundle), + ); assert!(ok, "apply must succeed: {stderr}"); assert!( stdout.contains("UPDATE_DOCS_LANDED"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\docs_bundle_e2e.rs:186: Some(bundle_sha), Some(b"NOT-THE-SIGNED-BYTES"), ); - assert!(ok2, "binary apply must succeed despite docs failure: {stderr2}"); assert!( + ok2, + "binary apply must succeed despite docs failure: {stderr2}" + ); + assert!( stderr2.contains("UPDATE_DOCS_SKIPPED"), "distinct skip token on stderr: {stderr2}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\docs_bundle_e2e.rs:208: // Leg 3 — a docs-less set stays exactly the pre-docs behavior: no token // either way, binary applies. let (home3, spt3) = fresh_home(tmp.path(), "node-docsless"); - let (ok3, stdout3, stderr3, swapped3) = - stage_and_apply(&home3, &spt3, &artifact, None, None); + let (ok3, stdout3, stderr3, swapped3) = stage_and_apply(&home3, &spt3, &artifact, None, None); assert!(ok3, "docs-less apply succeeds: {stderr3}"); assert!( !stdout3.contains("UPDATE_DOCS") && !stderr3.contains("UPDATE_DOCS"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\drive_e2e.rs:134: let owlery = perch::owlery_dir(); let shell_perch = perch::resolve_shell_perch_path_in(&owlery, "doyle", "mock-shell-0"); - let token_of = || { - spt_daemon::shellhost::read_link_token(&shell_perch).expect("a link token is parked") - }; + let token_of = + || spt_daemon::shellhost::read_link_token(&shell_perch).expect("a link token is parked"); let drive = |drive_type: &str, payload: &str| { spt(&[ "shell", "drive", "Scout", "--type", drive_type, payload, "--owner", "doyle", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\drive_e2e.rs:175: // ── spawn: the noop binary exits, the perch stays offline; a token is parked. let out = spt(&[ - "shell", "spawn", "mock-shell", "--alias", "Scout", "--owner", "doyle", + "shell", + "spawn", + "mock-shell", + "--alias", + "Scout", + "--owner", + "doyle", ]); assert!( out.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\drive_e2e.rs:182: "spawn: {}", String::from_utf8_lossy(&out.stderr) ); - assert!(!is_online(), "the noop binary never binds — perch starts offline"); + assert!( + !is_online(), + "the noop binary never binds — perch starts offline" + ); // FIXTURE INTENT (REQ-HAZARD-SHELL-STALE-ONLINE): this suite models a LIVE // linked binary — the test process drives the link through `api drive-poll` // exactly as the resident would. But the spawn template is a noop that already Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\drive_e2e.rs:197: // ── (1) DROP-AT-WRITE: driving an offline shell drops (exit 0, diagnostic), // writes no slot — the poll comes back empty. let out = drive("stick", "x=0.1"); - assert!(out.status.success(), "an offline drive is a defined drop (exit 0)"); assert!( + out.status.success(), + "an offline drive is a defined drop (exit 0)" + ); + assert!( String::from_utf8_lossy(&out.stderr).contains("DRIVE_DROPPED"), "offline drive diagnoses a drop: {}", String::from_utf8_lossy(&out.stderr) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\drive_e2e.rs:219: assert!(drive("stick", "x=0.9").status.success()); let out = drive_poll(&token_a); let frame = String::from_utf8_lossy(&out.stdout); - assert!(frame.contains("type=\"drive\""), "served the drive frame: {frame}"); assert!( + frame.contains("type=\"drive\""), + "served the drive frame: {frame}" + ); + assert!( frame.contains("x=0.9") && !frame.contains("x=0.1"), "the latest write superseded the earlier one: {frame}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\drive_e2e.rs:243: // leaves no `drive` artifact under the perch (the real guarantee is // by-construction — DriveHub is an in-memory map, no fs/serde). assert!(drive("stick", "x=0.4").status.success()); - let no_drive_file = std::fs::read_dir(&shell_perch) - .unwrap() - .flatten() - .all(|e| !e.file_name().to_string_lossy().to_lowercase().contains("drive")); - assert!(no_drive_file, "the drive slot is held in memory, not a perch file"); + let no_drive_file = std::fs::read_dir(&shell_perch).unwrap().flatten().all(|e| { + !e.file_name() + .to_string_lossy() + .to_lowercase() + .contains("drive") + }); + assert!( + no_drive_file, + "the drive slot is held in memory, not a perch file" + ); // ── (5) CLEAR-ON-LINK-BREAK: a frame written while online must NEVER be // served to the relinked instance. Break the link (close_shell flips offline, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:152: .stderr(Stdio::from(brain_log_file)) .spawn() .expect("spawn spt daemon run (broker process)"); - let brain_pid = match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) - { - Some(p) => p, - None => { - let _ = broker.kill(); - let _ = broker.wait(); - panic!( - "PRECONDITION: brain never came up.\n{}", - std::fs::read_to_string(&brain_log).unwrap_or_default() - ); - } - }; + let brain_pid = + match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) { + Some(p) => p, + None => { + let _ = broker.kill(); + let _ = broker.wait(); + panic!( + "PRECONDITION: brain never came up.\n{}", + std::fs::read_to_string(&brain_log).unwrap_or_default() + ); + } + }; // ── (4) The REAL spt-hosted bringup: endpoint run --start (broker spawns the // dummy into a PTY; the dummy binds its perch + heartbeats). ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:171: let run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:201: .and_then(|s| s.trim().parse().ok()); let alive_after = { std::thread::sleep(Duration::from_millis(700)); - harness_pid.map(spt_store::proc::is_process_alive).unwrap_or(false) + harness_pid + .map(spt_store::proc::is_process_alive) + .unwrap_or(false) }; // ── (5) rc ATTACH: stream the live PTY output; assert the heartbeat arrives. ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:269: kill_pid(p); } // The reconcile may have hosted a `{id}-psyche` — reap it too (scoped). - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); if let Some(p) = spt_store::info::read_pid(&psyche_perch) { kill_pid(p); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:277: let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:445: let start_run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\dummy_harness_e2e.rs:572: if let Some(p) = harness_pid_2 { kill_pid(p); } - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); if let Some(p) = spt_store::info::read_pid(&psyche_perch) { kill_pid(p); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\endpoint_autostart_e2e.rs:200: // Non-vacuity: the SAME line, once terminated, must match — otherwise the // assertion above would pass for the wrong reason. - std::fs::write(logs.join("daemon.stderr.log"), format!("boot\n{REPLAY_LINE}\n")).unwrap(); + std::fs::write( + logs.join("daemon.stderr.log"), + format!("boot\n{REPLAY_LINE}\n"), + ) + .unwrap(); let sink = read_logs_sink(home.path()); assert_eq!( autostart_replay_line(&sink, "gwauto"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\endpoint_autostart_e2e.rs:337: let mut cmd = Command::new(&spt_bin); cmd.no_window() .args([ - "endpoint", "run", "--adapter", "cc", "--id", id, "--start", "--save", + "endpoint", + "run", + "--adapter", + "cc", + "--id", + id, + "--start", + "--save", ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\endpoint_autostart_e2e.rs:374: reaper.add(pid); kill_pid(pid); } - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); if let Some(pid) = spt_store::info::read_pid(&psyche_perch) { reaper.add(pid); kill_pid(pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\endpoint_autostart_e2e.rs:428: session_b = spt_store::info::read_info(&self_perch).map(|r| r.session_id); // Done once the loud token is present AND the perch carries a fresh // (post-restart) session id distinct from run A's. - let fresh = matches!((&session_a, &session_b), (Some(a), Some(b)) if !b.is_empty() && a != b); + let fresh = + matches!((&session_a, &session_b), (Some(a), Some(b)) if !b.is_empty() && a != b); if autostart_line.is_some() && fresh { break; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\endpoint_teardown_authority_e2e.rs:352: let _ = std::fs::remove_file(&self.descendant_marker); let out = self.spt( &[ - "endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start", + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", ], Duration::from_secs(45), ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\endpoint_teardown_authority_e2e.rs:616: ); // ── …and the RESUME shape of the same recovery. ── - assert_eq!(stop2_code, Some(0), "the recovered endpoint stops cleanly too"); + assert_eq!( + stop2_code, + Some(0), + "the recovered endpoint stops cleanly too" + ); assert!( survivors2.is_empty(), "the recovered endpoint's subtree is reaped as well — the fix is not one-shot: {survivors2:?}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\fixtures\gh_fixture.rs:35: if let Ok(log) = std::env::var("SPT_FAKE_GH_LOG") { use std::io::Write; - if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(&log) { + if let Ok(mut f) = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(&log) + { let _ = writeln!(f, "gh {}", args.join(" ")); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\fixtures\git_fixture.rs:12: let args: Vec = std::env::args().skip(1).collect(); if let Ok(log) = std::env::var("SPT_GIT_SHIM_LOG") { use std::io::Write; - if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(&log) { + if let Ok(mut f) = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(&log) + { let _ = writeln!(f, "git {}", args.join(" ")); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_e2e.rs:67: fn offline_peer(id: &str) -> PathBuf { let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch_path).unwrap(); - let rec = spt_store::info::InfoJson::new(id, "now", std::process::id(), "peer-sess", "ready_agent"); + let rec = + spt_store::info::InfoJson::new(id, "now", std::process::id(), "peer-sess", "ready_agent"); spt_store::info::write_info(&perch_path, &rec).unwrap(); perch_path } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_e2e.rs:98: .unwrap() .write_all(body.as_bytes()) .unwrap(); - child.wait_with_output().expect("send output").status.success() + child + .wait_with_output() + .expect("send output") + .status + .success() } /// The single spooled body for `perch_path` (oldest), or panic. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_e2e.rs:119: let spt_bin = PathBuf::from(env!("CARGO_BIN_EXE_spt")); let mock_bin = sibling_bin("mock-session"); - assert!(mock_bin.exists(), "mock-session must be built: {}", mock_bin.display()); + assert!( + mock_bin.exists(), + "mock-session must be built: {}", + mock_bin.display() + ); // Load the mock-gateway manifest; point [session.self] at the built binaries. let manifest_path = concat!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_e2e.rs:164: let gw_perch = perch::resolve_perch_path(gw, ParentHint::Infer); let rec = spt_store::info::read_info(&gw_perch).expect("gateway info.json after bind"); assert_eq!(rec.session_id, gw_session); - assert_eq!(rec.state, "gateway", "a Gateway binds with its open-type tag"); + assert_eq!( + rec.state, "gateway", + "a Gateway binds with its open-type tag" + ); // 2. A user-msg SENT FROM the gateway is HONORED (the user-backed origin): // the peer's spool carries a verbatim user-msg envelope. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_e2e.rs:212: let peer_a = "peer-of-agent"; let peer_a_perch = offline_peer(peer_a); assert!( - send_user_msg(&spt_bin, home.path(), peer_a, agent, agent_session, "do this"), + send_user_msg( + &spt_bin, + home.path(), + peer_a, + agent, + agent_session, + "do this" + ), "send from the agent succeeds (degraded, never rejected)" ); let body = spooled_body(&peer_a_perch); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:89: }); let host = NetHost::start(hermetic(Identity::generate())).expect("net host start"); - let broker = Broker::bind_in_with_net(&broker_socket_name(), dir.join("effects.log"), Some(host)) - .expect("bind broker with net"); + let broker = + Broker::bind_in_with_net(&broker_socket_name(), dir.join("effects.log"), Some(host)) + .expect("bind broker with net"); let serve = Arc::clone(&broker); thread::spawn(move || { let _ = serve.serve(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:130: /// Spawn `cmd` with `input` on stdin, capture output, bounded. fn output_with_stdin(mut cmd: Command, input: Vec, deadline: Duration) -> Output { - cmd.stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()); + cmd.stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); let (tx, rx) = std::sync::mpsc::channel(); thread::spawn(move || { let res = (|| { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:208: spt_store::nodeid::load_or_create().expect("node identity"); let rec = spt_store::info::read_info(&perch::resolve_perch_path(gw_a, ParentHint::Infer)) .expect("owner info"); - assert_eq!(rec.state, "gateway", "the owner is a Gateway-typed endpoint, not an agent"); + assert_eq!( + rec.state, "gateway", + "the owner is a Gateway-typed endpoint, not an agent" + ); let owlery = perch::owlery_dir(); let shell_perch = perch::resolve_shell_perch_path_in(&owlery, gw_a, "mock-shell-0"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:215: let token_of = || spt_daemon::shellhost::read_link_token(&shell_perch).expect("a link token is parked"); let online_by_token = |token: &str| { - let out = spt(&["api", "--adapter", "mock-shell", "bind-shell", "--link", token]); - assert!(out.status.success(), "bind-shell: {}", String::from_utf8_lossy(&out.stderr)); + let out = spt(&[ + "api", + "--adapter", + "mock-shell", + "bind-shell", + "--link", + token, + ]); assert!( + out.status.success(), + "bind-shell: {}", + String::from_utf8_lossy(&out.stderr) + ); + assert!( String::from_utf8_lossy(&out.stderr).contains("SHELL_TUNNEL_OPEN"), "bind-shell opens the tunnel for a Gateway owner too: {}", String::from_utf8_lossy(&out.stderr) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:225: }; // ── spawn (offline) under the GATEWAY owner → online by token → tunnel opens. - let out = spt(&["shell", "spawn", "mock-shell", "--alias", "Scout", "--owner", gw_a]); - assert!(out.status.success(), "gateway spawn: {}", String::from_utf8_lossy(&out.stderr)); + let out = spt(&[ + "shell", + "spawn", + "mock-shell", + "--alias", + "Scout", + "--owner", + gw_a, + ]); + assert!( + out.status.success(), + "gateway spawn: {}", + String::from_utf8_lossy(&out.stderr) + ); let token_a = token_of(); // FIXTURE INTENT (REQ-HAZARD-SHELL-STALE-ONLINE): the suite models a LIVE // linked binary — the test process drains the link via `api drive-poll` / Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:242: // durable shell channel — no agent-family gate on the command path. let before = spt_store::spool::pending_count_at(&shell_perch).unwrap(); let out = spt(&["shell", "cmd", "--owner", gw_a, "Scout", "press", "A"]); - assert!(out.status.success(), "gateway cmd: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "gateway cmd: {}", + String::from_utf8_lossy(&out.stderr) + ); assert_eq!( spt_store::spool::pending_count_at(&shell_perch).unwrap(), before + 1, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:258: "gateway drive" ); let out = spt(&[ - "api", "--adapter", "mock-shell", "drive-poll", "mock-shell-0", "--link", &token_a, + "api", + "--adapter", + "mock-shell", + "drive-poll", + "mock-shell-0", + "--link", + &token_a, ]); let frame = String::from_utf8_lossy(&out.stdout); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:269: // ── tunnel: opaque bytes round-trip BOTH directions under the gateway owner. // A payload the grammar would mangle (NULs + an `| { - let out = - spt_stdin(&["shell", "tunnel", "Scout", "send", "--owner", gw_a], bytes); - assert!(out.status.success(), "gateway tunnel send: {}", String::from_utf8_lossy(&out.stderr)); + let out = spt_stdin( + &["shell", "tunnel", "Scout", "send", "--owner", gw_a], + bytes, + ); + assert!( + out.status.success(), + "gateway tunnel send: {}", + String::from_utf8_lossy(&out.stderr) + ); }; let shell_recv_until = |want: usize| -> Vec { let mut got = Vec::new(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:278: for _ in 0..400 { let out = spt(&[ - "api", "--adapter", "mock-shell", "tunnel", "mock-shell-0", "recv", "--link", + "api", + "--adapter", + "mock-shell", + "tunnel", + "mock-shell-0", + "recv", + "--link", &token_a, ]); got.extend_from_slice(&out.stdout); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:303: let blob: Vec = b"\x00opaque\xff\xfe\x00".to_vec(); owner_send(blob.clone()); let got = shell_recv_until(blob.len()); - assert_eq!(got, blob, "owner→shell opaque bytes round-trip byte-exact under a gateway owner"); + assert_eq!( + got, blob, + "owner→shell opaque bytes round-trip byte-exact under a gateway owner" + ); let reply: Vec = b"\x00\x01\xaa reply".to_vec(); let out = spt_stdin( - &["api", "--adapter", "mock-shell", "tunnel", "mock-shell-0", "send", "--link", &token_a], + &[ + "api", + "--adapter", + "mock-shell", + "tunnel", + "mock-shell-0", + "send", + "--link", + &token_a, + ], reply.clone(), ); - assert!(out.status.success(), "shell tunnel send: {}", String::from_utf8_lossy(&out.stderr)); - assert_eq!(owner_recv_until(reply.len()), reply, "shell→owner round-trip byte-exact"); + assert!( + out.status.success(), + "shell tunnel send: {}", + String::from_utf8_lossy(&out.stderr) + ); + assert_eq!( + owner_recv_until(reply.len()), + reply, + "shell→owner round-trip byte-exact" + ); // ── act-gate (REQ-CONSENT-3): the class-keyed `attach` refuses ungranted, // then a grant KEYED ON THE GATEWAY'S ENDPOINT-ID flips it through — the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:317: // same id-not-type invariant on the consent surface. - let out = spt(&["shell", "cmd", "--owner", gw_a, "Scout", "attach", "busid-1"]); - assert!(!out.status.success(), "ungranted gated attach refuses under the gateway"); + let out = spt(&[ + "shell", "cmd", "--owner", gw_a, "Scout", "attach", "busid-1", + ]); assert!( + !out.status.success(), + "ungranted gated attach refuses under the gateway" + ); + assert!( String::from_utf8_lossy(&out.stderr).contains("CONSENT_PENDING"), "refused as a pending act-gate: {}", String::from_utf8_lossy(&out.stderr) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:324: ); // The grant target IS the gateway's endpoint-id (not a type, not an agent id). - let out = spt(&["grant", "add", "shell-act:attach", gw_a, "--qualifier", "hid"]); - assert!(out.status.success(), "grant add: {}", String::from_utf8_lossy(&out.stderr)); - let out = spt(&["shell", "cmd", "--owner", gw_a, "Scout", "attach", "busid-1"]); + let out = spt(&[ + "grant", + "add", + "shell-act:attach", + gw_a, + "--qualifier", + "hid", + ]); assert!( out.status.success(), + "grant add: {}", + String::from_utf8_lossy(&out.stderr) + ); + let out = spt(&[ + "shell", "cmd", "--owner", gw_a, "Scout", "attach", "busid-1", + ]); + assert!( + out.status.success(), "the grant keyed on the gateway endpoint-id flips the gated cmd through: {}", String::from_utf8_lossy(&out.stderr) ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:342: spt_daemon::shellhost::close_shell(&owlery, gw_a, "mock-shell-0", Some(&shell)) .expect("link break closes the gateway-owned shell"); let out = spt(&["shell", "relink", "Scout", "--owner", gw_a]); - assert!(out.status.success(), "gateway relink: {}", String::from_utf8_lossy(&out.stderr)); - assert_ne!(token_a, token_of(), "relink rotates the link token for a gateway owner"); + assert!( + out.status.success(), + "gateway relink: {}", + String::from_utf8_lossy(&out.stderr) + ); + assert_ne!( + token_a, + token_of(), + "relink rotates the link token for a gateway owner" + ); // ── NEGATIVE: gateway-B (SAME type="gateway", DIFFERENT id) is refused on // every control path for gateway-A's shell — exclusivity keys on the owner Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\gateway_owner_shell_e2e.rs:357: "same-type different-id owner: cmd is NO_SHELL: {}", String::from_utf8_lossy(&out.stderr) ); - let out = spt(&["shell", "drive", "Scout", "--type", "stick", "x=0.1", "--owner", gw_b]); + let out = spt(&[ + "shell", "drive", "Scout", "--type", "stick", "x=0.1", "--owner", gw_b, + ]); assert!(!out.status.success(), "gateway-B drive refused"); assert!( String::from_utf8_lossy(&out.stderr).contains("NO_SHELL"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_drain_e2e.rs:103: .unwrap_or_default(); let mock_session = sibling_bin("mock-session"); let xlate_fixture = sibling_bin("translate_proof_fixture"); - assert!(mock_session.exists(), "dummy-harness must be built: {}", mock_session.display()); - assert!(xlate_fixture.exists(), "translation fixture must be built: {}", xlate_fixture.display()); + assert!( + mock_session.exists(), + "dummy-harness must be built: {}", + mock_session.display() + ); + assert!( + xlate_fixture.exists(), + "translation fixture must be built: {}", + xlate_fixture.display() + ); // ── (2) Register adapter `cc`: a long-lived dummy-harness `[session.self]` + // the REAL `translate_proof_fixture` as the idle-translation binary (choreo Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_drain_e2e.rs:199: let mut rec = spt_store::info::read_info(&self_perch) .expect("the online endpoint must have an info.json"); let session_id = rec.session_id.clone(); - assert!(!session_id.is_empty(), "the bound harness must have stamped a session_id"); + assert!( + !session_id.is_empty(), + "the bound harness must have stamped a session_id" + ); if rec.controllable != Some(true) { rec.controllable = Some(true); spt_store::info::write_info(&self_perch, &rec).expect("stamp controllable=true"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_drain_e2e.rs:287: } let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_drain_e2e.rs:295: let _ = broker.wait(); // ── ASSERTIONS ── - assert!(run.status.success(), "endpoint run --start must succeed: {run_stderr}"); + assert!( + run.status.success(), + "endpoint run --start must succeed: {run_stderr}" + ); assert!( online, "PRECONDITION: the cc endpoint must bind ONLINE before the idle edge.\n\ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:98: let last = turns .last() .unwrap_or_else(|| panic!("the digest must carry at least one turn: {doc}")); - let partial = last.get("partial").and_then(|p| p.as_bool()).unwrap_or(false); + let partial = last + .get("partial") + .and_then(|p| p.as_bool()) + .unwrap_or(false); let input_seq = last.get("input_seq").and_then(|s| s.as_u64()); // `DigestEntry` is an externally-tagged enum, so an entry is // `{"Agent": {"text": …, "seq": 1}}` — reach through the variant wrapper. `seq` Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:334: } let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:342: let _ = broker.wait(); // ── PRECONDITIONS ── - assert!(run.status.success(), "endpoint run --start must succeed: {run_stderr}"); assert!( + run.status.success(), + "endpoint run --start must succeed: {run_stderr}" + ); + assert!( online, "PRECONDITION: the cc endpoint must bind ONLINE.\n=== brain stderr ===\n{brain_stderr}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:350: - assert!(!session_id.is_empty(), "PRECONDITION: the harness must stamp a session_id"); + assert!( + !session_id.is_empty(), + "PRECONDITION: the harness must stamp a session_id" + ); for (what, out) in [ ("input", &entry_input), ("agent", &entry_agent), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:393: seq is the whole thing a seq-keyed scanner reads", ); // Log-less sink: the seq IS the append-only line index (line 0 = the input). - assert_eq!(seq, 0, "the sealed seq is the source log position, not a window index"); - assert_eq!(entry_seqs, vec![Some(1)], "the agent reply seals at its own line index"); assert_eq!( + seq, 0, + "the sealed seq is the source log position, not a window index" + ); + assert_eq!( + entry_seqs, + vec![Some(1)], + "the agent reply seals at its own line index" + ); + assert_eq!( repull, sealed, "a re-pull of an unchanged idle endpoint must return the IDENTICAL seq — a \ scanner that polls twice can never see the cursor move under it" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:404: // ── LEG 3: THE BLINK. The seal is stateless, so the middle read may unseal — // but the RESEAL must reproduce byte-identical seqs (doyle's ruled grounds: // seqs are computed from log position, not from when the seal ran). ── - eprintln!( - "BLINK OBSERVED: sealed={sealed:?} -> busy={blink_busy:?} -> resealed={resealed:?}" - ); + eprintln!("BLINK OBSERVED: sealed={sealed:?} -> busy={blink_busy:?} -> resealed={resealed:?}"); assert_eq!( resealed, sealed, "REQ-DIGEST-SEAL-ON-IDLE / doyle blink ruling: an idle->busy->idle round trip \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\idle_edge_seal_e2e.rs:420: // ── LEG 4: THE STRAGGLER. A post-seal record folds in; published seqs hold. ── let (late_partial, late_input_seq, late_entry_seqs) = straggled.clone(); - assert!(!late_partial, "the endpoint is still idle — the turn stays sealed"); + assert!( + !late_partial, + "the endpoint is still idle — the turn stays sealed" + ); assert_eq!( late_input_seq, Some(seq), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\job_escape_e2e.rs:154: /// ABSOLUTE powershell path (KH 5.12 no-bare-powershell) + `.no_window()`. /// Returns 0 if the query yields nothing (no child / dead parent). fn conhost_children_of(parent_pid: u32) -> usize { - const POWERSHELL_ABS: &str = - r"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"; + const POWERSHELL_ABS: &str = r"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"; let filter = format!("ParentProcessId={parent_pid}"); let script = format!( "@(Get-CimInstance Win32_Process -Filter '{filter}' | \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\job_escape_e2e.rs:305: std::thread::spawn(move || { let _ = tx.send(cmd.output()); }); - rx.recv_timeout(Duration::from_secs(20)).ok().and_then(|r| r.ok()) + rx.recv_timeout(Duration::from_secs(20)) + .ok() + .and_then(|r| r.ok()) }; kill_pid(broker_pid); // taskkill /F /T — broker + brain + conhost subtree if is_process_alive(brain_pid) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\job_escape_e2e.rs:558: ); // ── Assertions. ── - assert!(daemon_alive_before, "PRECONDITION: daemon must be alive before the job terminate"); + assert!( + daemon_alive_before, + "PRECONDITION: daemon must be alive before the job terminate" + ); // Non-vacuity: the job really does kill its members. assert!( control_died, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\json_emit.rs:24: /// Run `spt --json` under the isolated home, bounded so a wedged /// subprocess fails loud instead of hanging the suite. -fn run_json(spt_bin: &std::path::Path, home: &std::path::Path, args: &[&str]) -> std::process::Output { +fn run_json( + spt_bin: &std::path::Path, + home: &std::path::Path, + args: &[&str], +) -> std::process::Output { let mut cmd = Command::new(spt_bin); cmd.no_window() .args(args) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\json_emit.rs:45: fn parse_json(label: &str, out: &std::process::Output) -> serde_json::Value { let stdout = String::from_utf8_lossy(&out.stdout); let stderr = String::from_utf8_lossy(&out.stderr); - eprintln!("=== {label} --json ===\nstatus={}\nstdout=\n{stdout}\nstderr=\n{stderr}", out.status); + eprintln!( + "=== {label} --json ===\nstatus={}\nstdout=\n{stdout}\nstderr=\n{stderr}", + out.status + ); serde_json::from_str::(stdout.trim()).unwrap_or_else(|e| { panic!("{label} --json must emit parseable JSON, got non-JSON ({e}): stdout=\n{stdout}") }) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\json_emit.rs:90: // ── how-to (bare) → the topic list DTO ── let out = run_json(&spt_bin, home.path(), &["how-to"]); - assert!(out.status.success(), "how-to --json should exit 0: {:?}", out); + assert!( + out.status.success(), + "how-to --json should exit 0: {:?}", + out + ); let v = parse_json("how-to", &out); assert!( v.get("topics").map(|t| t.is_array()).unwrap_or(false), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\json_emit.rs:99: // ── adapter version → {adapter, version} DTO ── let out = run_json(&spt_bin, home.path(), &["adapter", "version", "cc"]); - assert!(out.status.success(), "adapter version --json should exit 0: {:?}", out); + assert!( + out.status.success(), + "adapter version --json should exit 0: {:?}", + out + ); let v = parse_json("adapter version", &out); assert_eq!( v.get("version").and_then(|s| s.as_str()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\json_emit.rs:109: // ── daemon status → the status DTO (running=false here; still valid JSON) ── let out = run_json(&spt_bin, home.path(), &["daemon", "status"]); - assert!(out.status.success(), "daemon status --json should exit 0: {:?}", out); + assert!( + out.status.success(), + "daemon status --json should exit 0: {:?}", + out + ); let v = parse_json("daemon status", &out); assert!( v.get("running").map(|r| r.is_boolean()).unwrap_or(false), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\list_json_liveness_parity_e2e.rs:98: fn write_pid_alive_gateway(id: &str) { let perch_path = perch::owlery_dir().join(id); std::fs::create_dir_all(&perch_path).unwrap(); - let rec = spt_store::info::InfoJson::new(id, "t", std::process::id(), &format!("sid-{id}"), "gateway"); + let rec = spt_store::info::InfoJson::new( + id, + "t", + std::process::id(), + &format!("sid-{id}"), + "gateway", + ); spt_store::info::write_info(&perch_path, &rec).unwrap(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\list_json_liveness_parity_e2e.rs:165: output_bounded(cmd, Duration::from_secs(30)) }; let human_stdout = String::from_utf8_lossy(&human_out.stdout); - assert!(human_out.status.success(), "endpoint list (human) must succeed"); + assert!( + human_out.status.success(), + "endpoint list (human) must succeed" + ); // Restrict to the lines that mention the gateway — the human surface must not // read it Suspended/Offline (it discards the own-node gossip, shows roster truth). let gw_lines: String = human_stdout Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\list_json_liveness_parity_e2e.rs:191: --json, identical to the human/picker surface (REQ-LIST-JSON-LIVENESS-PARITY)" ); assert!( - !gw_lines.to_lowercase().contains("suspend") && !gw_lines.to_lowercase().contains("offline"), + !gw_lines.to_lowercase().contains("suspend") + && !gw_lines.to_lowercase().contains("offline"), "human and --json must AGREE the gateway is live — human read it non-Suspended.\n\ === gateway lines ===\n{gw_lines}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\listen_seed_retry_e2e.rs:92: let seed = Command::new(&spt) .no_window() .args([ - "api", "--adapter", "mock", "seed", "--pid", &anchor, "--session-id", session_id, + "api", + "--adapter", + "mock", + "seed", + "--pid", + &anchor, + "--session-id", + session_id, ]) .env("SPT_HOME", home.path()) .status() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\listen_seed_retry_e2e.rs:102: // First listen: NO --subnet → HOME refusal AFTER the seed was taken. let refused = Command::new(&spt) .no_window() - .args(["api", "--adapter", "mock", "listen", id, "--parent-pid", &anchor, "--once"]) + .args([ + "api", + "--adapter", + "mock", + "listen", + id, + "--parent-pid", + &anchor, + "--once", + ]) .env("SPT_HOME", home.path()) .output() .expect("run first api listen"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\listen_seed_retry_e2e.rs:129: let retry = Command::new(&spt) .no_window() .args([ - "api", "--adapter", "mock", "listen", id, "--parent-pid", &anchor, "--subnet", - "work", "--once", + "api", + "--adapter", + "mock", + "listen", + id, + "--parent-pid", + &anchor, + "--subnet", + "work", + "--once", ]) .env("SPT_HOME", home.path()) .output() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\listen_seed_retry_e2e.rs:158: // The perch bound live with the seed's session id, homed to the retry's subnet. let rec = spt_store::info::read_info(&perch_path).expect("perch info.json after retry"); - assert_eq!(rec.session_id, session_id, "the perch carries the seed's sid"); + assert_eq!( + rec.session_id, session_id, + "the perch carries the seed's sid" + ); assert_eq!(rec.state, "live_agent"); - assert_eq!(rec.home_subnet.as_deref(), Some("work"), "homed to the retry's --subnet"); + assert_eq!( + rec.home_subnet.as_deref(), + Some("work"), + "homed to the retry's --subnet" + ); } // [int->REQ-LISTEN-SESSION-ID-FALLBACK] F-034 leg c: a session with NO live seed Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\listen_seed_retry_e2e.rs:189: let listen = Command::new(&spt) .no_window() .args([ - "api", "--adapter", "mock", "listen", id, "--parent-pid", &anchor, "--session-id", - sid, "--once", + "api", + "--adapter", + "mock", + "listen", + id, + "--parent-pid", + &anchor, + "--session-id", + sid, + "--once", ]) .env("SPT_HOME", home.path()) .output() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:268: .append(true) .open(&xlate_staged) .expect("open staged xlate to append padding"); - f.write_all(&[0u8; 4096]).expect("append padding to staged xlate"); + f.write_all(&[0u8; 4096]) + .expect("append padding to staged xlate"); } // The staging manifest declares the SAME absolute translation path (so the // post-swap install-dir manifest still points the broker at `/xlate`). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:300: // (b) the session/endpoint is STILL alive (no restart — brain-parity): the // harness pid is alive AND the perch is still ONLINE. ── let hash_after = file_hash(&xlate_install); - let swap_landed = hash_after.is_some() - && hash_after == hash_staged - && hash_after != hash_before; + let swap_landed = + hash_after.is_some() && hash_after == hash_staged && hash_after != hash_before; let harness_alive_after = harness_pid .map(spt_store::proc::is_process_alive) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:334: if let Some(p) = harness_pid { kill_pid(p); } - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); if let Some(p) = spt_store::info::read_pid(&psyche_perch) { kill_pid(p); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:342: let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:438: .map(|e| format!(".{}", e.to_string_lossy())) .unwrap_or_default(); let xlate_fixture = sibling_bin("translate_proof_fixture"); - assert!(xlate_fixture.exists(), "fixture must be built: {}", xlate_fixture.display()); + assert!( + xlate_fixture.exists(), + "fixture must be built: {}", + xlate_fixture.display() + ); // The install dir holds the OLD xlate; a minimal manifest so read_translation_path // resolves (the apply reads it around the swap). NO adapter registration, NO Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:485: std::fs::copy(&xlate_fixture, &xlate_staged).unwrap(); { use std::io::Write; - let mut f = std::fs::OpenOptions::new().append(true).open(&xlate_staged).unwrap(); + let mut f = std::fs::OpenOptions::new() + .append(true) + .open(&xlate_staged) + .unwrap(); f.write_all(&[0u8; 4096]).unwrap(); } std::fs::write(staging.join("manifest.toml"), &manifest_toml).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:492: let hash_before = file_hash(&xlate_install); let hash_staged = file_hash(&xlate_staged); - assert_ne!(hash_before, hash_staged, "PRECONDITION: staged xlate must differ"); + assert_ne!( + hash_before, hash_staged, + "PRECONDITION: staged xlate must differ" + ); // ── The delegated apply with ZERO matching sessions. ── let mut brain = Brain::cold_start(&broker_socket_name(), now_ms()) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:519: // ── Reap SCOPED before asserting. ── let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:580: .unwrap_or_default(); let mock_session = sibling_bin("mock-session"); let xlate_fixture = sibling_bin("translate_proof_fixture"); - assert!(mock_session.exists(), "dummy-harness must be built: {}", mock_session.display()); - assert!(xlate_fixture.exists(), "fixture must be built: {}", xlate_fixture.display()); + assert!( + mock_session.exists(), + "dummy-harness must be built: {}", + mock_session.display() + ); + assert!( + xlate_fixture.exists(), + "fixture must be built: {}", + xlate_fixture.display() + ); // Register adapter `cc` with a trivial (empty overlay) `[profiles.prof]` so // `--adapter cc:prof` resolves. The install dir + absolute translation path are Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:647: let run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "cc:prof", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "cc:prof", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:697: .append(true) .open(&xlate_staged) .expect("open staged xlate to append padding"); - f.write_all(&[0u8; 4096]).expect("append padding to staged xlate"); + f.write_all(&[0u8; 4096]) + .expect("append padding to staged xlate"); } std::fs::write(staging.join("manifest.toml"), &manifest_toml).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:704: let hash_before = file_hash(&xlate_install); let hash_staged = file_hash(&xlate_staged); - assert_ne!(hash_before, hash_staged, "PRECONDITION: staged xlate must differ"); + assert_ne!( + hash_before, hash_staged, + "PRECONDITION: staged xlate must differ" + ); // ── The apply carries the bare PARENT `cc` — the composite `cc:prof` session // must be selected by the parent-matcher. ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:719: let hash_after = file_hash(&xlate_install); let swap_landed = hash_after.is_some() && hash_after == hash_staged && hash_after != hash_before; - let harness_alive_after = harness_pid.map(spt_store::proc::is_process_alive).unwrap_or(false); + let harness_alive_after = harness_pid + .map(spt_store::proc::is_process_alive) + .unwrap_or(false); let mut still_online = false; let online_deadline = Instant::now() + Duration::from_secs(8); while Instant::now() < online_deadline { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:751: } let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:759: let _ = broker.wait(); // ── ASSERTIONS ── - assert!(run.status.success(), "endpoint run --start must succeed: {run_stderr}"); assert!( + run.status.success(), + "endpoint run --start must succeed: {run_stderr}" + ); + assert!( online, "PRECONDITION: the cc:prof composite endpoint must bind ONLINE before the apply.\n\ === brain stderr ===\n{brain_stderr}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:839: .unwrap_or_default(); let mock_session = sibling_bin("mock-session"); let xlate_fixture = sibling_bin("translate_proof_fixture"); - assert!(mock_session.exists(), "dummy-harness must be built: {}", mock_session.display()); - assert!(xlate_fixture.exists(), "fixture must be built: {}", xlate_fixture.display()); + assert!( + mock_session.exists(), + "dummy-harness must be built: {}", + mock_session.display() + ); + assert!( + xlate_fixture.exists(), + "fixture must be built: {}", + xlate_fixture.display() + ); // Register the LIVE adapter `cc` (the endpoint we run). let install_dir = perch::spt_home().join("srcs").join("cc"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:958: let cc_hash_before = file_hash(&xlate_install); let other_before = file_hash(&other_xlate); let other_staged_hash = file_hash(&other_staged); - assert_ne!(other_before, other_staged_hash, "PRECONDITION: staged other xlate must differ"); + assert_ne!( + other_before, other_staged_hash, + "PRECONDITION: staged other xlate must differ" + ); // ── The FOREIGN apply: adapter `other`, its own install/staging dirs. The `cc` // session must NOT be selected (parent-matcher: `cc` != `other`). ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:976: let cc_untouched = cc_hash_after.is_some() && cc_hash_after == cc_hash_before; let other_swapped = other_after.is_some() && other_after == other_staged_hash && other_after != other_before; - let harness_alive_after = harness_pid.map(spt_store::proc::is_process_alive).unwrap_or(false); + let harness_alive_after = harness_pid + .map(spt_store::proc::is_process_alive) + .unwrap_or(false); let mut still_online = false; let online_deadline = Instant::now() + Duration::from_secs(8); while Instant::now() < online_deadline { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:1009: } let _ = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_adapt_translation_swap_e2e.rs:1017: let _ = broker.wait(); // ── ASSERTIONS ── - assert!(run.status.success(), "endpoint run --start must succeed: {run_stderr}"); + assert!( + run.status.success(), + "endpoint run --start must succeed: {run_stderr}" + ); assert!( online, "PRECONDITION: the cc endpoint must bind ONLINE before the foreign apply.\n\ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_bind_firsthost_e2e.rs:92: // and marks it online (the W0.3 first-host handoff). The Psyche does NOT spawn // in this process — bind only writes the online signal. let out = spt(&[ - "api", "--adapter", "mocklive", "--manifest", &mp, "bind", "agent8", - "--type", "live_agent", "--set-session-id", "sid-1", + "api", + "--adapter", + "mocklive", + "--manifest", + &mp, + "bind", + "agent8", + "--type", + "live_agent", + "--set-session-id", + "sid-1", ]); - assert!(out.status.success(), "bind: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "bind: {}", + String::from_utf8_lossy(&out.stderr) + ); // The real establish-marks-online: written by cmd_bind, NOT hand-seeded. let self_perch = perch::resolve_perch_path("agent8", ParentHint::Infer); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_bind_firsthost_e2e.rs:148: &cfg, StartReason::Cold, ); - assert!(set.is_empty(), "an offline transition un-hosts the lifecycle"); + assert!( + set.is_empty(), + "an offline transition un-hosts the lifecycle" + ); // Reap any REAL daemon that auto-started against this throwaway home (hygiene). if let Ok(p) = std::fs::read_to_string(home.path().join("daemon.pid")) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_firsthost_e2e.rs:98: // ── seed (keyed by THIS process's pid — alive, passes the recycle guard) ── let out = spt(&[ - "api", "--adapter", "mocklive", "seed", "--pid", &pid, "--session-id", "sid-1", + "api", + "--adapter", + "mocklive", + "seed", + "--pid", + &pid, + "--session-id", + "sid-1", ]); - assert!(out.status.success(), "seed: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "seed: {}", + String::from_utf8_lossy(&out.stderr) + ); // ── the REAL live listen --once: binds the Self perch + marks it online // (the W0.2 establish-marks-online), drains, exits. The Psyche does NOT spawn Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_firsthost_e2e.rs:107: // in this process anymore. let out = spt(&[ - "api", "--adapter", "mocklive", "--manifest", &mp, "listen", "agent7", - "--parent-pid", &pid, "--once", + "api", + "--adapter", + "mocklive", + "--manifest", + &mp, + "listen", + "agent7", + "--parent-pid", + &pid, + "--once", ]); - assert!(out.status.success(), "listen: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "listen: {}", + String::from_utf8_lossy(&out.stderr) + ); // The real establish-marks-online: the perch carries status=online, written by // cmd_listen (NOT hand-seeded). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_firsthost_e2e.rs:158: &cfg, StartReason::Cold, ); - assert!(set.is_empty(), "an offline transition un-hosts the lifecycle"); + assert!( + set.is_empty(), + "an offline transition un-hosts the lifecycle" + ); // Reap any REAL daemon that auto-started against this throwaway home (hygiene). if let Ok(p) = std::fs::read_to_string(home.path().join("daemon.pid")) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_resolve_e2e.rs:96: // ── Phase 1: agnostic seed + no-`--adapter` listen → resolves via host_binaries. // The seed itself carries NO --adapter (adapter-agnostic, REQ-START-5). let out = spt(&["api", "seed", "--pid", &pid, "--session-id", "sid-1"]); - assert!(out.status.success(), "agnostic seed: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "agnostic seed: {}", + String::from_utf8_lossy(&out.stderr) + ); let out = spt(&["api", "listen", "agent-a", "--parent-pid", &pid, "--once"]); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_resolve_e2e.rs:119: // ── Phase 2: the active-profile pointer overrides the freshest fallback. let out = spt(&["adapter", "use", "older-spt"]); - assert!(out.status.success(), "adapter use: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "adapter use: {}", + String::from_utf8_lossy(&out.stderr) + ); let out = spt(&["api", "seed", "--pid", &pid, "--session-id", "sid-2"]); - assert!(out.status.success(), "re-seed: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "re-seed: {}", + String::from_utf8_lossy(&out.stderr) + ); let out = spt(&["api", "listen", "agent-b", "--parent-pid", &pid, "--once"]); - assert!(out.status.success(), "pointer listen: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "pointer listen: {}", + String::from_utf8_lossy(&out.stderr) + ); let perch_b = perch::resolve_perch_path("agent-b", ParentHint::Infer); assert_eq!( - spt_store::info::read_info(&perch_b).unwrap().adapter.as_deref(), + spt_store::info::read_info(&perch_b) + .unwrap() + .adapter + .as_deref(), Some("older-spt"), "the active-profile pointer wins over the freshest-registered fallback" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\live_resolve_e2e.rs:139: spt(&["adapter", "remove", "fresh-spt"]); let out = spt(&["api", "seed", "--pid", &pid, "--session-id", "sid-3"]); - assert!(out.status.success(), "re-seed: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "re-seed: {}", + String::from_utf8_lossy(&out.stderr) + ); let out = spt(&["api", "listen", "agent-c", "--parent-pid", &pid, "--once"]); assert!(!out.status.success(), "a zero-match resolution must refuse"); let stderr = String::from_utf8_lossy(&out.stderr); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\livehost_bootgate_e2e.rs:154: // ── (5b) NO PHANTOM: the nested `{id}-psyche` perch must NEVER appear (host_one // writes it only on a Psyche spawn). Give a host-attempt window past the offline // flip to be sure no late tick revived it. ── - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); let settle = Instant::now() + Duration::from_secs(8); while Instant::now() < settle { std::thread::sleep(Duration::from_millis(200)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:174: } let _ = { let mut cmd = Command::new(spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:186: fn wait_status(perch_path: &Path, want: &str, budget: Duration) -> bool { let deadline = Instant::now() + budget; while Instant::now() < deadline { - if spt_store::info::read_info(perch_path).and_then(|i| i.status).as_deref() == Some(want) { + if spt_store::info::read_info(perch_path) + .and_then(|i| i.status) + .as_deref() + == Some(want) + { return true; } std::thread::sleep(Duration::from_millis(120)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:217: std::env::set_var("SPT_HOME", home.path()); let spt_bin = PathBuf::from(env!("CARGO_BIN_EXE_spt")); let mock = sibling_bin("mock-session"); - assert!(mock.exists(), "build the dummy harness: cargo build -p mock-adapter --bin mock-session"); + assert!( + mock.exists(), + "build the dummy harness: cargo build -p mock-adapter --bin mock-session" + ); // ≥2 subnets — the gap only exists here (a single-subnet node auto-homes). // FIRST = the control home we will pin with --subnet. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:232: let refuse = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyharness", "--id", refuse_id]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + refuse_id, + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:246: let mut cmd = Command::new(&spt_bin); cmd.no_window() .args([ - "endpoint", "run", "--adapter", "dummyharness", "--id", home_id, - "--subnet", control, "--start", + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + home_id, + "--subnet", + control, + "--start", ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:254: }; let home_perch = perch::resolve_perch_path(home_id, ParentHint::Infer); - let online = wait_status(&home_perch, spt_store::liveness::STATUS_ONLINE, Duration::from_secs(20)); + let online = wait_status( + &home_perch, + spt_store::liveness::STATUS_ONLINE, + Duration::from_secs(20), + ); // Read the inherited home + sync scope (compute pre-reap). let bound_home = spt_store::info::read_info(&home_perch).and_then(|i| i.home_subnet); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:263: let brain_stderr = std::fs::read_to_string(&brain_log).unwrap_or_default(); let harness_pid = harness_pid_of(&String::from_utf8_lossy(&run.stderr)); - reap(home.path(), &spt_bin, &mut broker, brain_pid, harness_pid.as_slice(), home_id); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + harness_pid.as_slice(), + home_id, + ); // ── Assertions. ── - assert_ne!(refuse.status.code(), Some(0), "no-subnet multi-home run must NOT succeed"); + assert_ne!( + refuse.status.code(), + Some(0), + "no-subnet multi-home run must NOT succeed" + ); assert!( refuse_err.contains("MULTI_SUBNET_HOME"), "must refuse with the MULTI_SUBNET_HOME --subnet guidance (not a silent 25s timeout).\n\ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:273: === run stderr ===\n{refuse_err}" ); - assert!(!refuse_skeleton, "a refused run must write NO skeleton perch"); + assert!( + !refuse_skeleton, + "a refused run must write NO skeleton perch" + ); assert!( run.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:325: let run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:332: let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); - let online = wait_status(&perch_path, spt_store::liveness::STATUS_ONLINE, Duration::from_secs(20)); + let online = wait_status( + &perch_path, + spt_store::liveness::STATUS_ONLINE, + Duration::from_secs(20), + ); let bound_home = spt_store::info::read_info(&perch_path).and_then(|i| i.home_subnet); let brain_stderr = std::fs::read_to_string(&brain_log).unwrap_or_default(); let harness_pid = harness_pid_of(&String::from_utf8_lossy(&run.stderr)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:337: - reap(home.path(), &spt_bin, &mut broker, brain_pid, harness_pid.as_slice(), id); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + harness_pid.as_slice(), + id, + ); - assert!(run.status.success(), "single-subnet run: {}", String::from_utf8_lossy(&run.stderr)); - assert!(online, "single-subnet auto-home must bind ONLINE.\n{brain_stderr}"); - assert_eq!(bound_home.as_deref(), Some("solo"), "auto-homed to the sole subnet"); + assert!( + run.status.success(), + "single-subnet run: {}", + String::from_utf8_lossy(&run.stderr) + ); + assert!( + online, + "single-subnet auto-home must bind ONLINE.\n{brain_stderr}" + ); + assert_eq!( + bound_home.as_deref(), + Some("solo"), + "auto-homed to the sole subnet" + ); } // ── (3) Fresh-UNBOUND attach-before-bind ─────────────────────────────────────── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:370: let run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "holdharness", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "holdharness", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:378: let harness_pid = harness_pid_of(&String::from_utf8_lossy(&run.stderr)); // The perch is UNBOUND (skeleton written UNBOUND, never bound) — and STAYS so. - let is_unbound = wait_status(&perch_path, spt_store::liveness::STATUS_UNBOUND, Duration::from_secs(15)); + let is_unbound = wait_status( + &perch_path, + spt_store::liveness::STATUS_UNBOUND, + Duration::from_secs(15), + ); // rc ATTACH the live pre-bind session → the heartbeat must flow. let rc_err = home.path().join("rc.stderr.log"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:422: // Re-read status AFTER the attach: it must STILL be UNBOUND — proving the attach // landed on a genuinely pre-bind session, never a bound one. - let still_unbound = spt_store::info::read_info(&perch_path).and_then(|i| i.status).as_deref() + let still_unbound = spt_store::info::read_info(&perch_path) + .and_then(|i| i.status) + .as_deref() == Some(spt_store::liveness::STATUS_UNBOUND); let rc_stderr = std::fs::read_to_string(&rc_err).unwrap_or_default(); let rc_connected = rc_stderr.contains("PUMP_IPC_READER") && !rc_stderr.contains("RC_FAIL"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\multi_subnet_bringup_e2e.rs:431: kill_pid(rc.id()); let _ = rc.kill(); let _ = rc.wait(); - reap(home.path(), &spt_bin, &mut broker, brain_pid, harness_pid.as_slice(), id); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + harness_pid.as_slice(), + id, + ); - assert!(run.status.success(), "hold-unbound run --start: {}", String::from_utf8_lossy(&run.stderr)); + assert!( + run.status.success(), + "hold-unbound run --start: {}", + String::from_utf8_lossy(&run.stderr) + ); assert!( is_unbound, "the skeleton must be STATUS_UNBOUND (hold-unbound never binds).\n{brain_stderr}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\nested_resolution_e2e.rs:65: fn seed_homed_parent(id: &str, home: &str) { let path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&path).unwrap(); - let mut rec = InfoJson::new(id, "2026-06-01T00:00:00Z", std::process::id(), "sid", "live_agent"); + let mut rec = InfoJson::new( + id, + "2026-06-01T00:00:00Z", + std::process::id(), + "sid", + "live_agent", + ); rec.home_subnet = Some(home.to_string()); info::write_info(&path, &rec).unwrap(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\oneliner_e2e.rs:211: // [unit->REQ-INSTALL-10] #[test] fn at_logon_task_launches_daemon_in_background_not_foreground() { - let ps1 = std::fs::read_to_string(installer_dir().join("install.ps1")) - .expect("read install.ps1"); + let ps1 = + std::fs::read_to_string(installer_dir().join("install.ps1")).expect("read install.ps1"); // The line that registers the at-logon task action. let task_line = ps1 .lines() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\poll_envelope_e2e.rs:55: // Two offline sends spool (the perch exists but holds no live listener). // The first body is multi-LINE on purpose: it must arrive as ONE whole // envelope (newline escaped to
), proving self-delimiting framing. - let q1 = send(home, &["send", "doyle", "--from", "alice"], "line one\nline two"); + let q1 = send( + home, + &["send", "doyle", "--from", "alice"], + "line one\nline two", + ); assert!(q1.contains("QUEUED:doyle"), "first send spools: {q1:?}"); let q2 = send(home, &["send", "doyle", "--from", "bob"], "second message"); assert!(q2.contains("QUEUED:doyle"), "second send spools: {q2:?}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\poll_envelope_e2e.rs:83: } // Oldest first; the multi-line body rides as ONE line, newline →
. assert_eq!( - lines[0], - r#"line one
line two
"#, + lines[0], r#"line one
line two
"#, "multi-line body is one whole self-delimiting envelope" ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_reader_e2e.rs:185: // ── (4) The reader verbs, git-poisoned, against the daemon-built index. ── let list_json = run_poisoned(&["endpoint", "list", "--json"]); - assert!(list_json.status.success(), "list --json failed: {}", - String::from_utf8_lossy(&list_json.stderr)); + assert!( + list_json.status.success(), + "list --json failed: {}", + String::from_utf8_lossy(&list_json.stderr) + ); let v: serde_json::Value = serde_json::from_slice(&list_json.stdout).unwrap(); let local = v["local"].as_array().expect("local rows"); let project_of = |id: &str| -> Option { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_reader_e2e.rs:215: ); let info = run_poisoned(&["api", "endpoint-info", "ep1"]); - assert!(info.status.success(), "endpoint-info failed: {}", - String::from_utf8_lossy(&info.stderr)); + assert!( + info.status.success(), + "endpoint-info failed: {}", + String::from_utf8_lossy(&info.stderr) + ); let payload: serde_json::Value = serde_json::from_slice(&info.stdout).unwrap(); assert_eq!( payload["project"].as_str(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_reader_e2e.rs:257: std::thread::sleep(Duration::from_millis(200)); } } - assert_eq!(shim_violations(), "", "maintenance polling spawned no reader git"); + assert_eq!( + shim_violations(), + "", + "maintenance polling spawned no reader git" + ); // ── (6) Degradation: the index deleted out from under the readers — // verbs stay fast, render no attribution, still ZERO git. ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_reader_e2e.rs:264: std::fs::remove_file(&index_path).unwrap(); let degraded = run_poisoned(&["endpoint", "list", "--json"]); - assert!(degraded.status.success(), "a missing index must not fail the list"); + assert!( + degraded.status.success(), + "a missing index must not fail the list" + ); let v: serde_json::Value = serde_json::from_slice(°raded.stdout).unwrap(); assert!( v["local"] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_reader_e2e.rs:273: .all(|r| r["project"].is_null()), "absent index → every project column degrades to '-' (null)" ); - assert_eq!(shim_violations(), "", "the degraded read spawned no git either"); + assert_eq!( + shim_violations(), + "", + "the degraded read spawned no git either" + ); // ── (7) Reap SCOPED. ── let _ = { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:53: /// `(pid, generation)` out of `brain.ready`; `None` until it parses. fn read_ready(path: &Path) -> Option<(u32, u64)> { let v: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(path).ok()?).ok()?; - Some((v.get("pid")?.as_u64()? as u32, v.get("generation")?.as_u64()?)) + Some(( + v.get("pid")?.as_u64()? as u32, + v.get("generation")?.as_u64()?, + )) } /// Poll `brain.ready` until it holds a pid different from `was`, up to `budget`. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:173: // Cold publish: rows for every perch, precedence via the shared kernel. // [int->REQ-PROJECT-INDEX-WRITER] - let cold = wait_index(&index_path, Duration::from_secs(20), "cold publish", |idx| { - idx.endpoints.len() == 3 - }); + let cold = wait_index( + &index_path, + Duration::from_secs(20), + "cold publish", + |idx| idx.endpoints.len() == 3, + ); assert_eq!(cold.endpoints["ep1"].source.as_deref(), Some("session-cwd")); assert_eq!(cold.endpoints["ep1"].display.as_deref(), Some("proj-a")); assert_eq!(cold.endpoints["ep2"].source.as_deref(), Some("origin-cwd")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:220: let _ = broker.wait(); let bytes_before = std::fs::read(&index_path).unwrap(); let stats_path = home.path().join("index").join("project-index-stats.json"); - let run_before: u64 = serde_json::from_str::( - &std::fs::read_to_string(&stats_path).unwrap(), - ) - .unwrap()["last_run_ms"] - .as_u64() - .unwrap(); + let run_before: u64 = + serde_json::from_str::(&std::fs::read_to_string(&stats_path).unwrap()) + .unwrap()["last_run_ms"] + .as_u64() + .unwrap(); let brain_log2 = home.path().join("brain2.stderr.log"); let mut broker2: Child = spawn_daemon(&brain_log2); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:295: id: "ep3".to_string(), cwd: Some(dir_c.to_string_lossy().to_string()), }); - let idx = wait_index(&index_path, Duration::from_secs(15), "session event → ep3 row", |i| { - i.endpoints.get("ep3").is_some_and(|e| e.source.as_deref() == Some("session-cwd")) - }); + let idx = wait_index( + &index_path, + Duration::from_secs(15), + "session event → ep3 row", + |i| { + i.endpoints + .get("ep3") + .is_some_and(|e| e.source.as_deref() == Some("session-cwd")) + }, + ); assert_eq!(idx.endpoints["ep3"].display.as_deref(), Some("proj-c")); // (4b) CONTEXT: a committed slice gives ep2 membership in `beta` — the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:305: let slice = cs.project_context_path("beta", "ep2").unwrap(); std::fs::write(&slice, "ep2 in beta").unwrap(); cs.commit_project("beta", "ep2 slice").unwrap().unwrap(); - wait_index(&index_path, Duration::from_secs(15), "context commit → new generation", |i| { - i.source_generation != cold.source_generation + wait_index( + &index_path, + Duration::from_secs(15), + "context commit → new generation", + |i| { + i.source_generation != cold.source_generation // ep2's RENDERED attribution stays origin-cwd (higher precedence); // the membership refresh is visible through the generation move. && i.endpoints.get("ep2").is_some_and(|e| e.source.as_deref() == Some("origin-cwd")) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:313: - }); + }, + ); // (4c) RENAME through the real CLI verb (offline perch): row follows the id. let rename = { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:325: "rename failed: {}", String::from_utf8_lossy(&rename.stderr) ); - let idx = wait_index(&index_path, Duration::from_secs(15), "rename → row moves", |i| { - i.endpoints.contains_key("ep1r") && !i.endpoints.contains_key("ep1") - }); + let idx = wait_index( + &index_path, + Duration::from_secs(15), + "rename → row moves", + |i| i.endpoints.contains_key("ep1r") && !i.endpoints.contains_key("ep1"), + ); assert_eq!( idx.endpoints["ep1r"].display.as_deref(), Some("proj-a"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:339: // fork nudge composes the new row from its copied membership. write_perch(&owlery, "forked", None, None); cs.fork_endpoint("ep1r", "forked").unwrap(); - let idx = wait_index(&index_path, Duration::from_secs(15), "fork → new row", |i| { - i.endpoints.get("forked").is_some_and(|e| e.project_id.is_some()) - }); + let idx = wait_index( + &index_path, + Duration::from_secs(15), + "fork → new row", + |i| { + i.endpoints + .get("forked") + .is_some_and(|e| e.project_id.is_some()) + }, + ); assert_eq!( idx.endpoints["forked"].source.as_deref(), Some("context-recency"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\projindex_writer_e2e.rs:361: "purge failed: {}", String::from_utf8_lossy(&purge.stderr) ); - wait_index(&index_path, Duration::from_secs(15), "purge → row dropped", |i| { - !i.endpoints.contains_key("ep2") - }); + wait_index( + &index_path, + Duration::from_secs(15), + "purge → row dropped", + |i| !i.endpoints.contains_key("ep2"), + ); // ── (5) Reap SCOPED. ── let _ = { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_download_e2e.rs:72: ) .unwrap(); let drop_file = drops.join(format!("{id}-commune.md")); - std::fs::write(&drop_file, "\nfresh pending brief\n").unwrap(); + std::fs::write( + &drop_file, + "\nfresh pending brief\n", + ) + .unwrap(); let spt_bin = PathBuf::from(env!("CARGO_BIN_EXE_spt")); let run = || { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_download_e2e.rs:94: // ── (1) With a present drop: durable brief + after it ── let out = run(); let stdout = String::from_utf8_lossy(&out.stdout).to_string(); - eprintln!("=== W5 psyche-download (pending) ===\nstatus={}\n{stdout}", out.status); - assert!(out.status.success(), "psyche-download must succeed (auth ok): {:?}", out); - assert!(stdout.contains("durable live mind"), "durable emitted"); - assert!(stdout.contains(""), "present drop surfaces as "); - assert!(stdout.contains("fresh pending brief"), "the drop body rides verbatim"); + eprintln!( + "=== W5 psyche-download (pending) ===\nstatus={}\n{stdout}", + out.status + ); + assert!( + out.status.success(), + "psyche-download must succeed (auth ok): {:?}", + out + ); + assert!( + stdout.contains("durable live mind"), + "durable emitted" + ); + assert!( + stdout.contains(""), + "present drop surfaces as " + ); + assert!( + stdout.contains("fresh pending brief"), + "the drop body rides verbatim" + ); let live_at = stdout.find("").unwrap(); let pend_at = stdout.find("").unwrap(); assert!(live_at < pend_at, "pending appends AFTER the durable tier"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_download_e2e.rs:105: // PRESENTATION-ONLY: the read must NOT consume the drop. - assert!(drop_file.exists(), "the pull must not delete the drop (ingest is sole writer)"); + assert!( + drop_file.exists(), + "the pull must not delete the drop (ingest is sole writer)" + ); // ── (2) Drop consumed by ingest (simulated = file removed) → self-clearing ── std::fs::remove_file(&drop_file).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_download_e2e.rs:111: let stdout2 = String::from_utf8_lossy(&out2.stdout).to_string(); eprintln!("=== W5 psyche-download (post-ingest) ===\n{stdout2}"); assert!(out2.status.success()); - assert!(stdout2.contains("durable live mind"), "durable brief still emitted"); + assert!( + stdout2.contains("durable live mind"), + "durable brief still emitted" + ); assert!( !stdout2.contains(""), "after the drop is ingested the pending slice self-clears (no duplication)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:35: use common::CommandNoWindowExt; use spt_daemon::{BrainLifecycle, DaemonConfig}; +use spt_runtime::Manifest; use spt_store::info::{self, InfoJson}; use spt_store::liveness::STATUS_ONLINE; use spt_store::perch::{self, ParentHint}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:41: -use spt_runtime::Manifest; fn start_inproc_daemon() { let reg = std::sync::Arc::new(spt_daemon::SeedRegistry::new()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:111: fn seed_bound_perch(id: &str, session_id: &str) { let path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&path).unwrap(); - let mut rec = InfoJson::new(id, "2026-06-01T00:00:00Z", std::process::id(), session_id, "live_agent"); + let mut rec = InfoJson::new( + id, + "2026-06-01T00:00:00Z", + std::process::id(), + session_id, + "live_agent", + ); rec.status = Some(STATUS_ONLINE.to_string()); rec.controllable = Some(true); info::write_info(&path, &rec).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:157: std::fs::write(&gate, "").unwrap(); let report = host.pulse_tick(Some(sid1)).expect("first pulse tick"); assert!(report.echo_fired, "the armed gate fired the first turn"); - assert_eq!(report.turn_outcome, Some(Ok(())), "the first turn ran cleanly"); + assert_eq!( + report.turn_outcome, + Some(Ok(())), + "the first turn ran cleanly" + ); assert!( wait_until(Duration::from_secs(5), || proof.exists()), "the psyche_resume role wrote the proof file (RED if the turn is neutered)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:164: ); let uuid1 = std::fs::read_to_string(&proof).unwrap().trim().to_string(); - assert_ne!(uuid1, sid1, "the psyche's own sid is NOT the parent's (the W1 custody bug)"); - assert_eq!(uuid1.len(), 36, "the psyche sid is a canonical UUID: {uuid1:?}"); + assert_ne!( + uuid1, sid1, + "the psyche's own sid is NOT the parent's (the W1 custody bug)" + ); + assert_eq!( + uuid1.len(), + 36, + "the psyche sid is a canonical UUID: {uuid1:?}" + ); assert!( - custody.exists() - && std::fs::read_to_string(&custody).unwrap().contains(&uuid1), + custody.exists() && std::fs::read_to_string(&custody).unwrap().contains(&uuid1), "the minted psyche sid is persisted to the nested custody record" ); // The custody record is NOT an info.json → invisible to the perch instance scans. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:183: let mut cmd = Command::new(&spt_bin); cmd.no_window() .args([ - "api", "--adapter", "dummyharness", "--manifest", &mp, - "boundary", "clear", id, "--to-session-id", sid2, "--session-id", sid1, + "api", + "--adapter", + "dummyharness", + "--manifest", + &mp, + "boundary", + "clear", + id, + "--to-session-id", + sid2, + "--session-id", + sid1, ]) .env("SPT_HOME", home.path()) .env_remove("OWL_SESSION_ID"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:191: output_bounded(cmd, Duration::from_secs(60)) }; let b_err = String::from_utf8_lossy(&boundary.stderr).to_string(); - let sid_after = info::read_info(&perch::resolve_perch_path(id, ParentHint::Infer)) - .map(|r| r.session_id); + let sid_after = + info::read_info(&perch::resolve_perch_path(id, ParentHint::Infer)).map(|r| r.session_id); let custody_after = std::fs::read_to_string(&custody).ok(); eprintln!( "=== F030 W2 DIAGNOSTIC: boundary_exit={:?} parent_sid_after={sid_after:?} \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:204: if let Ok(p) = std::fs::read_to_string(home.path().join("daemon.pid")) { if let Ok(p) = p.trim().parse::() { #[cfg(windows)] - let _ = Command::new("taskkill").no_window().args(["/PID", &p.to_string(), "/F"]).output(); + let _ = Command::new("taskkill") + .no_window() + .args(["/PID", &p.to_string(), "/F"]) + .output(); #[cfg(unix)] let _ = Command::new("kill").args(["-9", &p.to_string()]).output(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:211: } assert!(boundary.status.success(), "boundary must succeed:\n{b_err}"); - assert_eq!(sid_after.as_deref(), Some(sid2), "the boundary rotated the PARENT sid"); + assert_eq!( + sid_after.as_deref(), + Some(sid2), + "the boundary rotated the PARENT sid" + ); // The custody record is byte-for-byte untouched by the parent boundary. assert_eq!( spt_store::psyche_custody::read_psyche_sid(&psyche_perch).as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\psyche_sid_custody_e2e.rs:225: std::fs::write(&gate, "").unwrap(); let report2 = host.pulse_tick(Some(sid2)).expect("second pulse tick"); assert!(report2.echo_fired, "the armed gate fired the second turn"); - assert_eq!(report2.turn_outcome, Some(Ok(())), "the second turn ran cleanly"); + assert_eq!( + report2.turn_outcome, + Some(Ok(())), + "the second turn ran cleanly" + ); assert!( wait_until(Duration::from_secs(5), || proof.exists()), "the second turn wrote the proof file" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:114: /// Register a harness adapter with a RAW `[session.self]` command — the zombie /// rig's entry (a wrapper command that survives its client's death). -fn register_raw_harness(home: &Path, spt_bin: &Path, name: &str, self_cmd: &str, exe_suffix: String) { +fn register_raw_harness( + home: &Path, + spt_bin: &Path, + name: &str, + self_cmd: &str, + exe_suffix: String, +) { let src = perch::spt_home().join("srcs").join(name); std::fs::create_dir_all(&src).unwrap(); let psyche_bin = src.join(format!("psychebin{exe_suffix}")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:161: /// `{id}-psyche` for EVERY endpoint the test started. Never machine-wide /// (shared runner) — which is why `ids` is a list rather than the caller /// hand-rolling a second teardown that can drift from this one. -fn reap(home: &Path, spt_bin: &Path, broker: &mut Child, brain_pid: u32, extra: &[u32], ids: &[&str]) { +fn reap( + home: &Path, + spt_bin: &Path, + broker: &mut Child, + brain_pid: u32, + extra: &[u32], + ids: &[&str], +) { for p in extra { kill_pid(*p); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:174: } let _ = { let mut cmd = Command::new(spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home); output_bounded(cmd, Duration::from_secs(20)) }; kill_pid(brain_pid); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:186: fn wait_status(perch_path: &Path, want: &str, budget: Duration) -> bool { let deadline = Instant::now() + budget; while Instant::now() < deadline { - if spt_store::info::read_info(perch_path).and_then(|i| i.status).as_deref() == Some(want) { + if spt_store::info::read_info(perch_path) + .and_then(|i| i.status) + .as_deref() + == Some(want) + { return true; } std::thread::sleep(Duration::from_millis(120)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:295: std::env::set_var("SPT_HOME", home.path()); let spt_bin = PathBuf::from(env!("CARGO_BIN_EXE_spt")); let mock = sibling_bin("mock-session"); - assert!(mock.exists(), "build the dummy harness: cargo build -p mock-adapter --bin mock-session"); + assert!( + mock.exists(), + "build the dummy harness: cargo build -p mock-adapter --bin mock-session" + ); seed_subnets(&["solo"]); register_harness(home.path(), &spt_bin, &mock, "holdharness", "hold-unbound"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:305: let run = run_start(home.path(), &spt_bin, "holdharness", id, &[]); let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); let harness_pid = harness_pid_of(&String::from_utf8_lossy(&run.stderr)); - let was_unbound = - wait_status(&perch_path, spt_store::liveness::STATUS_UNBOUND, Duration::from_secs(15)); + let was_unbound = wait_status( + &perch_path, + spt_store::liveness::STATUS_UNBOUND, + Duration::from_secs(15), + ); // Hand-stamp the organic contradiction: offline row over the live session. spt_store::info::set_status(&perch_path, spt_store::liveness::STATUS_OFFLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:313: let (captured, rc_stderr, saw_tick) = rc_attach_capture(home.path(), &spt_bin, id, &[]); let brain_stderr = std::fs::read_to_string(&brain_log).unwrap_or_default(); - reap(home.path(), &spt_bin, &mut broker, brain_pid, harness_pid.as_slice(), &[id]); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + harness_pid.as_slice(), + &[id], + ); - assert!(run.status.success(), "hold-unbound run: {}", String::from_utf8_lossy(&run.stderr)); - assert!(was_unbound, "precondition: the skeleton reads UNBOUND before the stamp.\n{brain_stderr}"); assert!( + run.status.success(), + "hold-unbound run: {}", + String::from_utf8_lossy(&run.stderr) + ); + assert!( + was_unbound, + "precondition: the skeleton reads UNBOUND before the stamp.\n{brain_stderr}" + ); + assert!( !captured.contains("is offline — nothing to attach to"), "the offline fast-fail must NOT fire over an honest live session.\n=== rc stdout ===\n{captured}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:352: let id = "ghost1"; let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch_path).unwrap(); - let rec = spt_store::info::InfoJson::new(id, "2026-07-18T00:00:00Z", 4242, "sid-x", "live_agent"); + let rec = + spt_store::info::InfoJson::new(id, "2026-07-18T00:00:00Z", 4242, "sid-x", "live_agent"); spt_store::info::write_info(&perch_path, &rec).unwrap(); spt_store::info::set_status(&perch_path, spt_store::liveness::STATUS_OFFLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:359: let out = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["rc", id]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["rc", id]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; reap(home.path(), &spt_bin, &mut broker, brain_pid, &[], &[id]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:392: let self_cmd = "cmd /c \"ping -n 3 127.0.0.1 >nul & pause\""; #[cfg(unix)] let self_cmd = "sh -c \"sleep 2; read x\""; - register_raw_harness(home.path(), &spt_bin, "zombieharness", self_cmd, String::new()); + register_raw_harness( + home.path(), + &spt_bin, + "zombieharness", + self_cmd, + String::new(), + ); let (mut broker, brain_pid, brain_log) = spawn_broker(home.path(), &spt_bin); let id = "zomb1"; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:414: }; let wrapper_alive_post = harness_pid.is_some_and(spt_store::proc::is_process_alive); let brain_stderr = std::fs::read_to_string(&brain_log).unwrap_or_default(); - reap(home.path(), &spt_bin, &mut broker, brain_pid, harness_pid.as_slice(), &[id]); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + harness_pid.as_slice(), + &[id], + ); - assert!(run.status.success(), "zombie-shape run: {}", String::from_utf8_lossy(&run.stderr)); - assert!(wrapper_alive_pre, "precondition: the wrapper survives its client chain.\n{brain_stderr}"); + assert!( + run.status.success(), + "zombie-shape run: {}", + String::from_utf8_lossy(&run.stderr) + ); + assert!( + wrapper_alive_pre, + "precondition: the wrapper survives its client chain.\n{brain_stderr}" + ); let stdout = String::from_utf8_lossy(&out.stdout); assert!( stdout.contains("defunct session"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:459: let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); let run1 = run_start(home.path(), &spt_bin, "dummyharness", id, &[]); let pid1 = harness_pid_of(&String::from_utf8_lossy(&run1.stderr)); - let online = wait_status(&perch_path, spt_store::liveness::STATUS_ONLINE, Duration::from_secs(20)); + let online = wait_status( + &perch_path, + spt_store::liveness::STATUS_ONLINE, + Duration::from_secs(20), + ); // Kill the harness (the natural death path — the field shape's launchpad): // the broker's death observers reap the session and terminal-normalize the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:467: if let Some(p) = pid1 { kill_pid(p); } - let offline = wait_status(&perch_path, spt_store::liveness::STATUS_OFFLINE, Duration::from_secs(20)); + let offline = wait_status( + &perch_path, + spt_store::liveness::STATUS_OFFLINE, + Duration::from_secs(20), + ); // RESUME with the never-binding harness: the pre-bind window is permanent. let run2 = run_start( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:480: let pid2 = harness_pid_of(&String::from_utf8_lossy(&run2.stderr)); // THE writer-truth assert: the resumed-but-never-bound perch reads UNBOUND, // not offline (pre-fix: stayed offline forever). - let unbound = wait_status(&perch_path, spt_store::liveness::STATUS_UNBOUND, Duration::from_secs(15)); + let unbound = wait_status( + &perch_path, + spt_store::liveness::STATUS_UNBOUND, + Duration::from_secs(15), + ); let (captured, rc_stderr, saw_tick) = rc_attach_capture(home.path(), &spt_bin, id, &[]); let brain_stderr = std::fs::read_to_string(&brain_log).unwrap_or_default(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:487: let extra: Vec = pid1.into_iter().chain(pid2).collect(); reap(home.path(), &spt_bin, &mut broker, brain_pid, &extra, &[id]); - assert!(run1.status.success(), "bind bringup: {}", String::from_utf8_lossy(&run1.stderr)); - assert!(online, "precondition: the dummy binds ONLINE.\n{brain_stderr}"); - assert!(offline, "precondition: the harness death lands the offline row.\n{brain_stderr}"); - assert!(run2.status.success(), "resume launch: {}", String::from_utf8_lossy(&run2.stderr)); assert!( + run1.status.success(), + "bind bringup: {}", + String::from_utf8_lossy(&run1.stderr) + ); + assert!( + online, + "precondition: the dummy binds ONLINE.\n{brain_stderr}" + ); + assert!( + offline, + "precondition: the harness death lands the offline row.\n{brain_stderr}" + ); + assert!( + run2.status.success(), + "resume launch: {}", + String::from_utf8_lossy(&run2.stderr) + ); + assert!( unbound, "a resuming perch must read UNBOUND (not offline) through the pre-bind window.\n\ === run2 stderr ===\n{}\n=== perch ===\n{:?}\n=== brain ===\n{brain_stderr}", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:524: let local_id = "hh1"; let perch_path = perch::resolve_perch_path(local_id, ParentHint::Infer); std::fs::create_dir_all(&perch_path).unwrap(); - let mut rec = - spt_store::info::InfoJson::new(local_id, "2026-07-18T00:00:00Z", 4242, "sid-h", "live_agent"); + let mut rec = spt_store::info::InfoJson::new( + local_id, + "2026-07-18T00:00:00Z", + 4242, + "sid-h", + "live_agent", + ); rec.controllable = Some(false); spt_store::info::write_info(&perch_path, &rec).unwrap(); spt_store::info::set_status(&perch_path, spt_store::liveness::STATUS_ONLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:532: let local_out = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["rc", local_id]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["rc", local_id]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:561: ); let reg_dir = perch::identity_dir().join("registry"); std::fs::create_dir_all(®_dir).unwrap(); - std::fs::write(reg_dir.join("solo.json"), serde_json::to_string(®).unwrap()).unwrap(); + std::fs::write( + reg_dir.join("solo.json"), + serde_json::to_string(®).unwrap(), + ) + .unwrap(); let remote_out = { let mut cmd = Command::new(&spt_bin); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:568: - cmd.no_window().args(["rc", remote_id]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["rc", remote_id]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; - reap(home.path(), &spt_bin, &mut broker, brain_pid, &[], &[local_id]); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + &[], + &[local_id], + ); for (label, out) in [("local", &local_out), ("remote", &remote_out)] { let stdout = String::from_utf8_lossy(&out.stdout); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:575: - assert!(out.status.success(), "{label}: the preflight refusal is a clean exit"); assert!( + out.status.success(), + "{label}: the preflight refusal is a clean exit" + ); + assert!( stdout.contains("harness-hosted"), "{label}: the refusal names the actual state.\n=== rc stdout ===\n{stdout}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:588: } } - // ── 6. rc owns its display: NO pump diagnostic interleaves it ─────────────── // // [int->REQ-RC-DISPLAY-SOLE-WRITER] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:619: std::env::set_var("SPT_HOME", home.path()); let spt_bin = PathBuf::from(env!("CARGO_BIN_EXE_spt")); let mock = sibling_bin("mock-session"); - assert!(mock.exists(), "build the dummy harness: cargo build -p mock-adapter --bin mock-session"); + assert!( + mock.exists(), + "build the dummy harness: cargo build -p mock-adapter --bin mock-session" + ); seed_subnets(&["solo"]); register_harness(home.path(), &spt_bin, &mock, "soleharness", "hold-unbound"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:670: let default_id = "sole-default"; let probe_run = run_start(home.path(), &spt_bin, "soleharness", probe_id, &[]); let default_start = run_start(home.path(), &spt_bin, "soleharness", default_id, &[]); - let mut harness_pids: Vec = - harness_pid_of(&String::from_utf8_lossy(&probe_run.stderr)).into_iter().collect(); - harness_pids.extend(harness_pid_of(&String::from_utf8_lossy(&default_start.stderr))); + let mut harness_pids: Vec = harness_pid_of(&String::from_utf8_lossy(&probe_run.stderr)) + .into_iter() + .collect(); + harness_pids.extend(harness_pid_of(&String::from_utf8_lossy( + &default_start.stderr, + ))); let probe = attach_and_capture(probe_id, true); let default_run = attach_and_capture(default_id, false); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\rc_attach_truth.rs:679: - reap(home.path(), &spt_bin, &mut broker, brain_pid, &harness_pids, &[probe_id, default_id]); + reap( + home.path(), + &spt_bin, + &mut broker, + brain_pid, + &harness_pids, + &[probe_id, default_id], + ); let brain_stderr = std::fs::read_to_string(&brain_log).unwrap_or_default(); for (label, run) in [("probe", &probe_run), ("default", &default_start)] { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\ready_resume_ledger_e2e.rs:151: StartReason::Cold, ); let hosted = set.len(); - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); let psyche_appeared = spt_store::info::read_info(&psyche_perch).is_some(); eprintln!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\release_verify_e2e.rs:65: ]) .status() .expect("run gh (installed + authed on the release-e2e runner)"); - assert!(st.success(), "gh release download {asset} from {repo}@{tag}"); + assert!( + st.success(), + "gh release download {asset} from {repo}@{tag}" + ); let dest = tmp.path().join(asset); let raw = std::fs::read_to_string(&dest).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:88: fn make_perch(id: &str) -> PathBuf { let path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&path).unwrap(); - info::write_info(&path, &InfoJson::new(id, "0", 0, &format!("sid-{id}"), "gateway")).unwrap(); + info::write_info( + &path, + &InfoJson::new(id, "0", 0, &format!("sid-{id}"), "gateway"), + ) + .unwrap(); path } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:113: let src = home.join("srcs").join(name); std::fs::create_dir_all(&src).unwrap(); for (from, to) in bins { - std::fs::copy(from, src.join(format!("{to}{}", std::env::consts::EXE_SUFFIX))) - .unwrap_or_else(|e| panic!("stage {to} for {name}: {e}")); + std::fs::copy( + from, + src.join(format!("{to}{}", std::env::consts::EXE_SUFFIX)), + ) + .unwrap_or_else(|e| panic!("stage {to} for {name}: {e}")); } std::fs::write(src.join("manifest.toml"), manifest).unwrap(); src Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:123: /// `(pid, generation)` out of `brain.ready` — the daemon-is-really-up signal. fn brain_ready(path: &Path) -> Option<(u32, u64)> { let v: serde_json::Value = serde_json::from_str(&std::fs::read_to_string(path).ok()?).ok()?; - Some((v.get("pid")?.as_u64()? as u32, v.get("generation")?.as_u64()?)) + Some(( + v.get("pid")?.as_u64()? as u32, + v.get("generation")?.as_u64()?, + )) } #[test] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:201: .expect("spawn spt daemon run"); let broker_pid = broker.id(); let ready_path = home.path().join("brain.ready"); - let daemon_up = wait_until(Duration::from_secs(45), || brain_ready(&ready_path).is_some()); + let daemon_up = wait_until(Duration::from_secs(45), || { + brain_ready(&ready_path).is_some() + }); // ── (3) The boot service rose with it, with nobody asking. ── let boot_alive = wait_until(Duration::from_secs(45), || { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:215: wait_until(Duration::from_secs(45), || path.exists()); std::fs::read_to_string(&path).unwrap_or_default() }; - let mock_env = std::fs::read_to_string(service_dir("svcboot").join("mock-env")).unwrap_or_default(); + let mock_env = + std::fs::read_to_string(service_dir("svcboot").join("mock-env")).unwrap_or_default(); let spooled: Vec<(i64, String, String)> = spt_store::spool::peek_all_at(&inbox) .unwrap_or_default() .into_iter() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:371: notice is contract, not courtesy, and its absence leaves the operator \ believing something is running: {add_offline_err}" ); - assert!(daemon_up, "PRECONDITION: the daemon never came up.\n{daemon_stderr}"); assert!( + daemon_up, + "PRECONDITION: the daemon never came up.\n{daemon_stderr}" + ); + assert!( boot_alive, "REQ-RESIDENT-SERVICE: a `start = \"boot\"` service is desired-state-running \ — it must rise WITH the daemon, with no operator action at all.\n{daemon_stderr}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resident_service_e2e.rs:423: declared service through the reconcile nudge and say so per option — \ installing an adapter never requires restarting spt: {add_live_err}" ); - assert!(rel_started, "and the service must really be running.\n{daemon_stderr}"); + assert!( + rel_started, + "and the service must really be running.\n{daemon_stderr}" + ); assert!( broker_survived, "the nudged daemon is the SAME process (pid {broker_pid}) — a service that \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_no_control_steal_e2e.rs:95: use std::thread; use std::time::{Duration, Instant}; -use spt_daemon::brainproc::{ready_generation_at, supervise_brain, BrainRestart, StartReason, TrialEnv}; +use spt_daemon::brainproc::{ + ready_generation_at, supervise_brain, BrainRestart, StartReason, TrialEnv, +}; use spt_daemon::codec::{read_frame, write_frame}; use spt_daemon::endpoint::broker_socket_name; use spt_daemon::frame::{Envelope, Role}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_no_control_steal_e2e.rs:237: let sid = loop { let f = read_frame(&mut c).expect("frame before spawned"); if f.kind == KIND_SPAWNED { - break serde_json::from_value::(f.payload).unwrap().session_id; + break serde_json::from_value::(f.payload) + .unwrap() + .session_id; } }; let ticks = Arc::new(AtomicU64::new(0)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_no_control_steal_e2e.rs:371: if Instant::now() >= baseline_deadline { teardown_panic( &stop, - &format!("PRECONDITION: session {sid} controller never received a tick — \ - the child never produced output; the rig cannot show a steal"), + &format!( + "PRECONDITION: session {sid} controller never received a tick — \ + the child never produced output; the rig cannot show a steal" + ), ); } thread::sleep(Duration::from_millis(25)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_no_control_steal_e2e.rs:441: // slot → A_i's sink was dropped → its tally FREEZES. The child keeps ticking either // way (broker-hosted, independent of the brain), so a frozen tally is a displaced // controller, not a dead child. ── - let t0: Vec = sessions.iter().map(|(_, t)| t.load(Ordering::Relaxed)).collect(); + let t0: Vec = sessions + .iter() + .map(|(_, t)| t.load(Ordering::Relaxed)) + .collect(); // ~2s ≫ the 150ms tick, so GREEN accrues ~10+ ticks; comfortably clears CI jitter. thread::sleep(Duration::from_secs(2)); - let t1: Vec = sessions.iter().map(|(_, t)| t.load(Ordering::Relaxed)).collect(); + let t1: Vec = sessions + .iter() + .map(|(_, t)| t.load(Ordering::Relaxed)) + .collect(); // ── Wait out the trial verdict (assertion 3). With no wedged controller, GREEN drains // true and promotes within a heartbeat of ready; a RED that also wedged its stolen Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_no_control_steal_e2e.rs:463: // ── Teardown BEFORE asserting (so a failing assert still reaps the subprocess brain + // the N ticker children). ── stop.store(true, Ordering::Relaxed); - let child_pids: Vec> = sessions.iter().map(|(sid, _)| broker.session_pid(*sid)).collect(); + let child_pids: Vec> = sessions + .iter() + .map(|(sid, _)| broker.session_pid(*sid)) + .collect(); for pid in child_pids.into_iter().flatten() { kill_pid(pid); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_no_control_steal_e2e.rs:471: let promotions = env.promotions.lock().unwrap().clone(); let rollbacks = env.rollbacks.lock().unwrap().clone(); - let gained: Vec = t0.iter().zip(&t1).map(|(a, b)| b.saturating_sub(*a)).collect(); + let gained: Vec = t0 + .iter() + .zip(&t1) + .map(|(a, b)| b.saturating_sub(*a)) + .collect(); eprintln!( "=== UPDATE-WEDGE-2 RESUME-STEAL GATE: n={N_SESSIONS} ticks_before={t0:?} \ ticks_after={t1:?} gained_in_window={gained:?} promoted={promoted} \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_template_e2e.rs:199: let fresh_run = { let mut cmd = Command::new(&spt_bin); cmd.no_window() - .args(["endpoint", "run", "--adapter", "dummyresume", "--id", id, "--start"]) + .args([ + "endpoint", + "run", + "--adapter", + "dummyresume", + "--id", + id, + "--start", + ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\resume_template_e2e.rs:257: let mut cmd = Command::new(&spt_bin); cmd.no_window() .args([ - "endpoint", "run", "--adapter", "dummyresume", "--id", id, "--resume", - resumed_session, "--start", + "endpoint", + "run", + "--adapter", + "dummyresume", + "--id", + id, + "--resume", + resumed_session, + "--start", ]) .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(45)) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\run_no_dup_session_e2e.rs:78: /// `endpoint run --id --start` (headless): spawn+return, no attach. Returns /// the captured output and the broker-spawned harness pid parsed from the /// `ENDPOINT_RUN:… pid=NNN` machine token (None when no spawn line — a refusal). -fn endpoint_run_start(spt_bin: &Path, home: &Path, id: &str, extra: &[&str]) -> (Output, Option) { - let mut args = vec!["endpoint", "run", "--adapter", "dummyharness", "--id", id, "--start"]; +fn endpoint_run_start( + spt_bin: &Path, + home: &Path, + id: &str, + extra: &[&str], +) -> (Output, Option) { + let mut args = vec![ + "endpoint", + "run", + "--adapter", + "dummyharness", + "--id", + id, + "--start", + ]; args.extend_from_slice(extra); let mut cmd = Command::new(spt_bin); cmd.no_window().args(&args).env("SPT_HOME", home); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\run_no_dup_session_e2e.rs:113: /// `endpoint_id` — the same `KIND_SESSIONS` map `SessionProbe::has_session` reads. /// Returns the sorted broker session ids for the endpoint (empty = none). fn broker_session_ids_for(endpoint_id: &str) -> Vec { - let mut brain = match spt_daemon::Brain::cold_start( - &spt_daemon::endpoint::broker_socket_name(), - 1, - ) { - Ok(b) => b, - Err(_) => return Vec::new(), - }; + let mut brain = + match spt_daemon::Brain::cold_start(&spt_daemon::endpoint::broker_socket_name(), 1) { + Ok(b) => b, + Err(_) => return Vec::new(), + }; let reply = match brain.sessions() { Ok(r) => r, Err(_) => return Vec::new(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\run_no_dup_session_e2e.rs:188: .stderr(Stdio::from(brain_log_file)) .spawn() .expect("spawn spt daemon run (broker process)"); - let brain_pid = match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) - { - Some(p) => p, - None => { - let _ = broker.kill(); - let _ = broker.wait(); - panic!( - "PRECONDITION: brain never came up.\n{}", - std::fs::read_to_string(&brain_log).unwrap_or_default() - ); - } - }; + let brain_pid = + match wait_for_ready_pid(&home.path().join("brain.ready"), Duration::from_secs(30)) { + Some(p) => p, + None => { + let _ = broker.kill(); + let _ = broker.wait(); + panic!( + "PRECONDITION: brain never came up.\n{}", + std::fs::read_to_string(&brain_log).unwrap_or_default() + ); + } + }; // ── (4) Bring the endpoint LIVE (gen1) and prove it holds EXACTLY ONE session. ── let id = "dupguard"; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\run_no_dup_session_e2e.rs:234: // ── (7) daemon stop (bounded). ── let stop = { let mut cmd = Command::new(&spt_bin); - cmd.no_window().args(["daemon", "stop"]).env("SPT_HOME", home.path()); + cmd.no_window() + .args(["daemon", "stop"]) + .env("SPT_HOME", home.path()); output_bounded(cmd, Duration::from_secs(20)) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\run_no_dup_session_e2e.rs:254: // ── (8) Reap scoped: every captured harness pid + any hosted psyche + brain + // broker. Never machine-wide. ── - for p in [harness_pid1, harness_pid2, harness_pid3].into_iter().flatten() { + for p in [harness_pid1, harness_pid2, harness_pid3] + .into_iter() + .flatten() + { kill_pid(p); } let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\run_no_dup_session_e2e.rs:266: let _ = broker.wait(); // ── Assertions. ── - assert!(run1.status.success(), "PRECONDITION: gen1 `endpoint run --start` must succeed"); + assert!( + run1.status.success(), + "PRECONDITION: gen1 `endpoint run --start` must succeed" + ); assert!(online, "PRECONDITION: the endpoint must come ONLINE"); assert_eq!( gen1_sessions.len(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\send_stamp_agent_id_e2e.rs:107: std::env::remove_var("SPT_HOME"); // ── ASSERTIONS ── - assert!(ok_pos, "the perch-bound send must succeed (spooled QUEUED): {err_pos}"); - assert!(ok_neg, "the perchless send must succeed (spooled QUEUED): {err_neg}"); + assert!( + ok_pos, + "the perch-bound send must succeed (spooled QUEUED): {err_pos}" + ); + assert!( + ok_neg, + "the perchless send must succeed (spooled QUEUED): {err_neg}" + ); assert_eq!( rows.len(), 2, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:130: // ── spawn (ungated) → online. let out = spt(&[ - "shell", "spawn", "mock-shell", "--alias", "Stick", "--owner", "doyle", + "shell", + "spawn", + "mock-shell", + "--alias", + "Stick", + "--owner", + "doyle", ]); assert!( out.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:158: // refuses (non-TTY ⇒ CONSENT_PENDING) and the frame NEVER spools — the // durable channel stays clean (evidence absent, the binary drained nothing). let out = spt(&[ - "shell", "cmd", "--owner", "doyle", "Stick", "attach", "busid-001", + "shell", + "cmd", + "--owner", + "doyle", + "Stick", + "attach", + "busid-001", ]); - assert!( - !out.status.success(), - "ungranted gated attach must refuse" - ); + assert!(!out.status.success(), "ungranted gated attach must refuse"); let pending = String::from_utf8_lossy(&out.stderr).to_string(); assert!( pending.contains("CONSENT_PENDING") && pending.contains("shell-act:attach"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:170: "refused as a pending act-gate, naming the namespaced capability: {pending}" ); assert!( - std::fs::read_to_string(&evidence).map(|s| s.trim().is_empty()).unwrap_or(true), + std::fs::read_to_string(&evidence) + .map(|s| s.trim().is_empty()) + .unwrap_or(true), "the gated command must NOT spool before approval (channel stays clean)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:177: // ── class scope is real: a grant for the WRONG class (`storage`) does not // authorize the `hid`-class `attach` — it still refuses. let out = spt(&[ - "grant", "add", "shell-act:attach", "doyle", "--qualifier", "storage", + "grant", + "add", + "shell-act:attach", + "doyle", + "--qualifier", + "storage", ]); - assert!(out.status.success(), "grant add (storage): {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "grant add (storage): {}", + String::from_utf8_lossy(&out.stderr) + ); let out = spt(&[ - "shell", "cmd", "--owner", "doyle", "Stick", "attach", "busid-001", + "shell", + "cmd", + "--owner", + "doyle", + "Stick", + "attach", + "busid-001", ]); assert!( !out.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:188: "a storage-class grant must not authorize a hid-class attach" ); assert!( - std::fs::read_to_string(&evidence).map(|s| s.trim().is_empty()).unwrap_or(true), + std::fs::read_to_string(&evidence) + .map(|s| s.trim().is_empty()) + .unwrap_or(true), "still no spool under the wrong-class grant" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:195: // ── the RIGHT-class grant (`hid`, the allow-always write) flips the same // `attach` through: it spools, the resident binary drains it, evidence lands. let out = spt(&[ - "grant", "add", "shell-act:attach", "doyle", "--qualifier", "hid", + "grant", + "add", + "shell-act:attach", + "doyle", + "--qualifier", + "hid", ]); - assert!(out.status.success(), "grant add (hid): {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "grant add (hid): {}", + String::from_utf8_lossy(&out.stderr) + ); let out = spt(&[ - "shell", "cmd", "--owner", "doyle", "Stick", "attach", "busid-001", + "shell", + "cmd", + "--owner", + "doyle", + "Stick", + "attach", + "busid-001", ]); assert!( out.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\shell_actgate_e2e.rs:227: // ── a DIFFERENT gated op (`wipe`, class `storage`) is unaffected by the // attach grant — per-capability scope, not per-shell — and still refuses. let out = spt(&[ - "shell", "cmd", "--owner", "doyle", "Stick", "wipe", "everything", + "shell", + "cmd", + "--owner", + "doyle", + "Stick", + "wipe", + "everything", ]); assert!( !out.status.success(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\translate_proof.rs:128: let out = run_spt( &spt_bin, home.path(), - &["adapter", "translate-proof", "cc", "--event", event, "--session", "sessA"], + &[ + "adapter", + "translate-proof", + "cc", + "--event", + event, + "--session", + "sessA", + ], Some("nocommit"), ); let stderr = String::from_utf8_lossy(&out.stderr); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\translate_proof.rs:224: let out = run_spt( &spt_bin, home.path(), - &["adapter", "translate-proof", "dev", "--event", event, "--dir", &devdir_s], + &[ + "adapter", + "translate-proof", + "dev", + "--event", + event, + "--dir", + &devdir_s, + ], None, ); let stdout = String::from_utf8_lossy(&out.stdout); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\translate_proof.rs:242: let out = run_spt( &spt_bin, home.path(), - &["adapter", "translate-proof", "dev", "--event", event, "--manifest", &manifest_s], + &[ + "adapter", + "translate-proof", + "dev", + "--event", + event, + "--manifest", + &manifest_s, + ], None, ); let stderr = String::from_utf8_lossy(&out.stderr); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\trial_drain_drive_e2e.rs:106: use std::time::{Duration, Instant}; use spt_daemon::brain::Brain; -use spt_daemon::brainproc::{ready_generation_at, supervise_brain, BrainRestart, StartReason, TrialEnv}; +use spt_daemon::brainproc::{ + ready_generation_at, supervise_brain, BrainRestart, StartReason, TrialEnv, +}; use spt_daemon::codec::{read_frame, write_frame}; use spt_daemon::endpoint::broker_socket_name; use spt_daemon::frame::{Envelope, Role}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\trial_drain_drive_e2e.rs:378: Duration::from_millis(50), env_sup.as_ref(), Duration::from_secs(60), // generous window — covers a slow-CI boot (eaten before the - // ready-latch arms) plus the self-drive reap, with margin + // ready-latch arms) plus the self-drive reap, with margin move |gen, reason: StartReason, binary| { if binary.is_some() { // A rollback spawn means the trial FAILED to promote (the RED Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\trial_drain_drive_e2e.rs:431: let sid = loop { let f = read_frame(&mut a).expect("frame before spawned"); if f.kind == KIND_SPAWNED { - break serde_json::from_value::(f.payload).unwrap().session_id; + break serde_json::from_value::(f.payload) + .unwrap() + .session_id; } }; // A parked long past the test; process-per-test exit reaps it. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:57: }); let host = NetHost::start(hermetic(Identity::generate())).expect("net host start"); - let broker = Broker::bind_in_with_net(&broker_socket_name(), dir.join("effects.log"), Some(host)) - .expect("bind broker with net"); + let broker = + Broker::bind_in_with_net(&broker_socket_name(), dir.join("effects.log"), Some(host)) + .expect("bind broker with net"); let serve = Arc::clone(&broker); thread::spawn(move || { let _ = serve.serve(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:92: /// Spawn `cmd` with `input` on stdin, capture output, bounded. fn output_with_stdin(mut cmd: Command, input: Vec, deadline: Duration) -> Output { - cmd.stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()); + cmd.stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()); let (tx, rx) = std::sync::mpsc::channel(); thread::spawn(move || { let res = (|| { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:161: let token_of = || spt_daemon::shellhost::read_link_token(&shell_perch).expect("a link token is parked"); let online_by_token = |token: &str| { - let out = spt(&["api", "--adapter", "mock-shell", "bind-shell", "--link", token]); + let out = spt(&[ + "api", + "--adapter", + "mock-shell", + "bind-shell", + "--link", + token, + ]); assert!( out.status.success(), "bind-shell: {}", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:175: }; // Owner sends raw bytes into the tunnel. let owner_send = |bytes: Vec| { - let out = spt_stdin(&["shell", "tunnel", "Scout", "send", "--owner", "doyle"], bytes); + let out = spt_stdin( + &["shell", "tunnel", "Scout", "send", "--owner", "doyle"], + bytes, + ); assert!( out.status.success(), "owner tunnel send: {}", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:184: }; let shell_send = |token: &str, bytes: Vec| { let out = spt_stdin( - &["api", "--adapter", "mock-shell", "tunnel", "mock-shell-0", "send", "--link", token], + &[ + "api", + "--adapter", + "mock-shell", + "tunnel", + "mock-shell-0", + "send", + "--link", + token, + ], bytes, ); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:199: let mut got = Vec::new(); for _ in 0..400 { let out = spt(&[ - "api", "--adapter", "mock-shell", "tunnel", "mock-shell-0", "recv", "--link", token, + "api", + "--adapter", + "mock-shell", + "tunnel", + "mock-shell-0", + "recv", + "--link", + token, ]); got.extend_from_slice(&out.stdout); if got.len() >= want { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:223: }; // ── spawn (offline) + online by token → the tunnel opens. - let out = spt(&["shell", "spawn", "mock-shell", "--alias", "Scout", "--owner", "doyle"]); - assert!(out.status.success(), "spawn: {}", String::from_utf8_lossy(&out.stderr)); + let out = spt(&[ + "shell", + "spawn", + "mock-shell", + "--alias", + "Scout", + "--owner", + "doyle", + ]); + assert!( + out.status.success(), + "spawn: {}", + String::from_utf8_lossy(&out.stderr) + ); let token_a = token_of(); online_by_token(&token_a); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:231: // A payload the envelope grammar would mangle: NULs, an ` = b"\x00not really an event\xff\xfe\x00".to_vec(); + let blob1: Vec = + b"\x00not really an event\xff\xfe\x00".to_vec(); let blob2: Vec = (0..=255u8).cycle().take(200 * 1024).collect(); let want: Vec = blob1.iter().chain(blob2.iter()).copied().collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:239: owner_send(blob1.clone()); owner_send(blob2.clone()); let got = shell_recv_until(&token_a, want.len()); - assert_eq!(got.len(), want.len(), "shell drained every owner→shell byte (no loss/dup)"); - assert_eq!(got, want, "owner→shell opaque bytes round-trip byte-exact, in order"); + assert_eq!( + got.len(), + want.len(), + "shell drained every owner→shell byte (no loss/dup)" + ); + assert_eq!( + got, want, + "owner→shell opaque bytes round-trip byte-exact, in order" + ); // ── (1b) shell → owner, byte-exact (the reverse leg of the duplex). let reply: Vec = b"\x00\x01\x02\xaa\xbb reply payload".to_vec(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:247: shell_send(&token_a, reply.clone()); let back = owner_recv_until(reply.len()); - assert_eq!(back, reply, "shell→owner opaque bytes round-trip byte-exact"); + assert_eq!( + back, reply, + "shell→owner opaque bytes round-trip byte-exact" + ); // ── (2)+(3) link-break closes the tunnel, and no pre-break byte survives the // relink (R1). Send a pending payload, DON'T drain it, break the link, relink to Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\tunnel_e2e.rs:272: // Relink (fresh token) + online → a FRESH tunnel; the stale pre-break bytes are // never surfaced to it. let out = spt(&["shell", "relink", "Scout", "--owner", "doyle"]); - assert!(out.status.success(), "relink: {}", String::from_utf8_lossy(&out.stderr)); + assert!( + out.status.success(), + "relink: {}", + String::from_utf8_lossy(&out.stderr) + ); let token_b = token_of(); assert_ne!(token_a, token_b, "relink rotates the link token"); online_by_token(&token_b); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:532: // harness is cold — nothing resident), rest intent Suspended, and the D-2 // ledger row recording the session + adapter the revive must restore. let perch_c2 = seed_perch(ID_C2, 0, "live_agent"); - spt_daemon::resting::write_rest(&perch_c2, spt_daemon::resting::RestState::Suspended, now_ms()) - .expect("seed C-2 suspended intent"); + spt_daemon::resting::write_rest( + &perch_c2, + spt_daemon::resting::RestState::Suspended, + now_ms(), + ) + .expect("seed C-2 suspended intent"); spt_store::sessions::append( &perch_c2, &spt_store::sessions::SessionEntry { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:622: // ── C-2 (serve side): A's qualified wake lands as the wire rest edge; the // reconcile resume leg relaunches the RECORDED adapter's [session.resume] // and the harness's own bind — never a stamp — takes status to online. - rig_wait("C-2: A's wake flipped the rest intent to Active", rig.wait, || { - spt_daemon::resting::read_rest(&perch_c2) - .map(|r| r.state == spt_daemon::resting::RestState::Active) - .unwrap_or(false) - }); + rig_wait( + "C-2: A's wake flipped the rest intent to Active", + rig.wait, + || { + spt_daemon::resting::read_rest(&perch_c2) + .map(|r| r.state == spt_daemon::resting::RestState::Active) + .unwrap_or(false) + }, + ); // The RESUME template ran (not [session.self]) with the LEDGER session id. // [int->REQ-WAKE-RESUME-LEG] - rig_wait("C-2: the [session.resume] template relaunched the harness", rig.wait, || { - resume_marker.exists() - }); + rig_wait( + "C-2: the [session.resume] template relaunched the harness", + rig.wait, + || resume_marker.exists(), + ); assert!( !self_marker.exists(), "the revive must select [session.resume], never the fresh [session.self]" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:638: ); - rig_wait("C-2: the revived harness self-bound (status online)", rig.wait, || { - info::read_info(&perch_c2).is_some_and(|i| i.status.as_deref() == Some("online")) - }); + rig_wait( + "C-2: the revived harness self-bound (status online)", + rig.wait, + || info::read_info(&perch_c2).is_some_and(|i| i.status.as_deref() == Some("online")), + ); assert_eq!( info::read_info(&perch_c2).and_then(|i| i.host_error), None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:809: // arrived as `cli@NODE` (operator #7) and replies bounced NO_PERCH. // [int->REQ-SELF-DETECT-PARENT-PID] let mut seen_from = String::new(); - rig_wait("E-1: B's send landed in the target spool", rig.wait, || { - match spool::peek_all_at(&perch_tgt) { + rig_wait( + "E-1: B's send landed in the target spool", + rig.wait, + || match spool::peek_all_at(&perch_tgt) { Ok(rows) => match rows.iter().find(|(_, _, body, _)| body.contains(E1_BODY)) { Some((_, from, _, _)) => { seen_from = from.clone(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:819: None => false, }, Err(_) => false, - } - }); + }, + ); assert_eq!( seen_from, ID_E1, "the from-stamp is the sender endpoint's own id (parent_pid leg), never the cli origin" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:867: } }); } - let contains = |hay: &[u8], needle: &[u8]| { - hay.windows(needle.len()).any(|w| w == needle) - }; - rig_wait("B-3: pre-bounce ticker output reached the viewport", rig.wait, || { - contains(&capture.lock().unwrap(), b"tick") - }); + let contains = |hay: &[u8], needle: &[u8]| hay.windows(needle.len()).any(|w| w == needle); + rig_wait( + "B-3: pre-bounce ticker output reached the viewport", + rig.wait, + || contains(&capture.lock().unwrap(), b"tick"), + ); let pre_len = capture.lock().unwrap().len(); signal(&rig, &rig.a_hex(), ID_RC, SIG_B3_ATTACHED); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:880: // must paint AFTER the pre-bounce output, and live output must resume // AFTER the banner (the reheal's ring replay), all on the captured bytes. let banner = b"Reconnecting to "; - rig_wait("B-3: the reconnect banner painted after the sever", rig.wait, || { - let cap = capture.lock().unwrap(); - cap[pre_len.min(cap.len())..] - .windows(banner.len()) - .any(|w| w == banner) - }); + rig_wait( + "B-3: the reconnect banner painted after the sever", + rig.wait, + || { + let cap = capture.lock().unwrap(); + cap[pre_len.min(cap.len())..] + .windows(banner.len()) + .any(|w| w == banner) + }, + ); let banner_end = { let cap = capture.lock().unwrap(); pre_len Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\twohost_cli.rs:895: .expect("banner offset") + banner.len() }; - rig_wait("B-3: live output resumed after the banner (reheal)", rig.wait, || { - let cap = capture.lock().unwrap(); - contains(&cap[banner_end.min(cap.len())..], b"tick") - }); + rig_wait( + "B-3: live output resumed after the banner (reheal)", + rig.wait, + || { + let cap = capture.lock().unwrap(); + contains(&cap[banner_end.min(cap.len())..], b"tick") + }, + ); println!("GATED OK: B-3 banner-then-reheal on the real remote bounce"); // Cleanup: the viewport child served its purpose (the session at B lives Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\worker_lifecycle_e2e.rs:75: std::fs::create_dir_all(&path).unwrap(); info::write_info( &path, - &InfoJson::new(id, "2026-07-06T00:00:00Z", std::process::id(), sid, "live_agent"), + &InfoJson::new( + id, + "2026-07-06T00:00:00Z", + std::process::id(), + sid, + "live_agent", + ), ) .unwrap(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\worker_lifecycle_e2e.rs:82: /// `spt api ` against the test SPT_HOME, deadline-bounded. -fn spt_api(spt_bin: &std::path::Path, home: &std::path::Path, args: &[&str]) -> std::process::Output { +fn spt_api( + spt_bin: &std::path::Path, + home: &std::path::Path, + args: &[&str], +) -> std::process::Output { let mut cmd = Command::new(spt_bin); cmd.no_window() .arg("api") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\worker_lifecycle_e2e.rs:103: // Run every real-binary call FIRST, then reap the auto-started daemon, THEN // assert — so a failed assertion can never leak the daemon on the gate box. - let start1 = spt_api(&spt_bin, home.path(), &["worker-start", parent, "--session-id", psid]); - let start2 = spt_api(&spt_bin, home.path(), &["worker-start", parent, "--session-id", psid]); + let start1 = spt_api( + &spt_bin, + home.path(), + &["worker-start", parent, "--session-id", psid], + ); + let start2 = spt_api( + &spt_bin, + home.path(), + &["worker-start", parent, "--session-id", psid], + ); let stop = spt_api( &spt_bin, home.path(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt\tests\worker_lifecycle_e2e.rs:120: // ── (1) worker-start mints {parent}-w1; the BARE id is the whole of stdout. ── let s1_out = String::from_utf8_lossy(&start1.stdout); let s1_err = String::from_utf8_lossy(&start1.stderr); - assert!(start1.status.success(), "worker-start must succeed with the parent's sid: {s1_err}"); + assert!( + start1.status.success(), + "worker-start must succeed with the parent's sid: {s1_err}" + ); assert_eq!( s1_out.trim(), "hostmaster-w1", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\bin\xlate_choreo_fixture.rs:146: fn big_multiline_payload() -> String { let mut s = String::from("HEADSTART "); for i in 0..12 { - s.push_str(&format!("line-{i:02}-payload-body-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n")); + s.push_str(&format!( + "line-{i:02}-payload-body-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" + )); } s.push_str("TAILEND"); s Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\activity.rs:285: #[test] fn a_state_change_owes_a_push_both_directions() { let mut seen = SeenLinks::new(); - remember(&mut seen, &[obs("doyle", "mock-shell-0", "tok-a", false, 900)]); + remember( + &mut seen, + &[obs("doyle", "mock-shell-0", "tok-a", false, 900)], + ); let to_idle = vec![obs("doyle", "mock-shell-0", "tok-a", true, 1_000)]; assert_eq!(plan_pushes(&seen, &to_idle), to_idle, "busy→idle pushes"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\activity.rs:303: #[test] fn a_token_change_with_an_identical_state_owes_a_push() { let mut seen = SeenLinks::new(); - remember(&mut seen, &[obs("doyle", "mock-shell-0", "tok-a", true, 1_000)]); + remember( + &mut seen, + &[obs("doyle", "mock-shell-0", "tok-a", true, 1_000)], + ); // Same owner, same shell, same state, same instant — only the link is new. let relinked = vec![obs("doyle", "mock-shell-0", "tok-b", true, 1_000)]; assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\activity.rs:326: // The shell closed: this sweep observes nothing. remember(&mut seen, &[]); - assert!(seen.is_empty(), "a vanished link is forgotten, not accumulated"); + assert!( + seen.is_empty(), + "a vanished link is forgotten, not accumulated" + ); // It comes back on the SAME token and state — still a push (it is a new // link establishment from the consumer's side). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\activity.rs:385: std::fs::write(owner_perch.join(spt_store::perch::IDLE_SENTINEL), "").unwrap(); perch::stamp_activity_at(&owner_perch, true, 1_753_372_800_123); - park_shell(&owlery, "doyle", "live-0", SHELL_STATUS_ONLINE, Some("tok-live")); - park_shell(&owlery, "doyle", "offline-0", SHELL_STATUS_OFFLINE, Some("tok-off")); + park_shell( + &owlery, + "doyle", + "live-0", + SHELL_STATUS_ONLINE, + Some("tok-live"), + ); + park_shell( + &owlery, + "doyle", + "offline-0", + SHELL_STATUS_OFFLINE, + Some("tok-off"), + ); park_shell(&owlery, "doyle", "tokenless-0", SHELL_STATUS_ONLINE, None); let observed = observe_links(&owlery); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\activity.rs:467: // (identity/ may not exist on a fresh home). let marker = tmp.path().join("identity").join(FLIP_MARKER_FILE); - assert!(!take_flip_observation(&marker), "no marker ⇒ nothing to take"); + assert!( + !take_flip_observation(&marker), + "no marker ⇒ nothing to take" + ); request_flip_observation(&marker).expect("drop creates the parent dir"); request_flip_observation(&marker).expect("a second flip re-drops idempotently"); assert!(take_flip_observation(&marker), "the drop is taken"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:421: } } // This version (or newer) is already the promoted, running image. - applied_version.map(|a| a >= staged_version).unwrap_or(false) + applied_version + .map(|a| a >= staged_version) + .unwrap_or(false) } /// Where the outgoing binary steps aside: a sibling `.old-` Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:580: ) .expect("broker image pump brain"); let v = brain - .broker_image_version_until(Some( - std::time::Instant::now() + Duration::from_secs(2), - )) + .broker_image_version_until(Some(std::time::Instant::now() + Duration::from_secs(2))) .expect("broker image query round-trips before its deadline"); assert_eq!( v.as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:704: /// Sign a single release (sk = [9u8;32], matching `stage`) and write the /// matching release-keys.json — WITHOUT staging, so a test controls the /// platform stamp itself. - fn sign_single(dir: &Path, version: u64, artifact: &[u8]) -> (SignedRelease, std::path::PathBuf) { + fn sign_single( + dir: &Path, + version: u64, + artifact: &[u8], + ) -> (SignedRelease, std::path::PathBuf) { let sk = SigningKey::from_bytes(&[9u8; 32]); let meta = ReleaseMetadata { version, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:816: // Wire the supervisor signal; the verb now raises it and reports honored. let signal = Arc::new(crate::brainproc::BrainRestart::new()); - assert!(broker.set_brain_restart(Arc::clone(&signal)), "first wire wins"); + assert!( + broker.set_brain_restart(Arc::clone(&signal)), + "first wire wins" + ); let mut b2 = cold_connect_retry(&name); assert!( b2.request_brain_restart().expect("verb round-trips"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:847: // Supervisor wired: refresh raises the same planned-restart signal the // apply path rides — with nothing staged anywhere. let signal = Arc::new(crate::brainproc::BrainRestart::new()); - assert!(broker.set_brain_restart(Arc::clone(&signal)), "first wire wins"); assert!( + broker.set_brain_restart(Arc::clone(&signal)), + "first wire wins" + ); + assert!( refresh_brain(&name).expect("refresh round-trips"), "a wired supervisor must report honored=true" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:939: // No served_broker — deliberately. A daemonless apply must not need one. let out = apply_staged_daemonless(&cache, &keys, &exe).expect("apply ok"); assert!( - matches!(out, ApplyStagedOutcome::AppliedDaemonless { version: 7, .. }), + matches!( + out, + ApplyStagedOutcome::AppliedDaemonless { version: 7, .. } + ), "got {out:?}" ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:1161: .record_applied_state(&AppliedRecord::RolledBack { quarantine_version: 7, running_version: 6, - rollback_binary: exe.with_file_name("spt-binary.old-7").to_string_lossy().into(), + rollback_binary: exe + .with_file_name("spt-binary.old-7") + .to_string_lossy() + .into(), }) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\applyhost.rs:1178: .record_applied_state(&AppliedRecord::RolledBack { quarantine_version: 7, running_version: 6, - rollback_binary: exe.with_file_name("spt-binary.old-7").to_string_lossy().into(), + rollback_binary: exe + .with_file_name("spt-binary.old-7") + .to_string_lossy() + .into(), }) .unwrap(); let out = apply_staged(&cache8, &keys8, &exe, &name).expect("ok"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\attach.rs:49: use crate::access::{access_check, AccessDecision, InboundClass}; use crate::brain::{now_ms, Brain, BrokerEvent}; -use crate::effect::{Minter, MintedOp}; +use crate::effect::{MintedOp, Minter}; use crate::msg::{decode_bytes, encode_bytes}; /// Feed the resting-state machine at the attach edges (D9-2, REQ-INST-3): a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:32: use interprocess::local_socket::{SendHalf, Stream}; use crate::codec::{read_frame, write_frame}; -use crate::frame::{Envelope, Role}; use crate::effect::MintedOp; +use crate::frame::{Envelope, Role}; use crate::msg::{ decode_bytes, encode_bytes, AdapterApplyReq, AppliedEvent, BrainRestarted, BrokerImageReply, - CoordinatorImageAnnounce, CoordinatorImageAnnounceReply, CoordinatorImageReply, StallEvictsReply, DisplacedEvent, - EndpointInjected, EndpointInputReq, ErrorEvent, ExitEvent, - InputReq, - KillReq, NetDialReq, NetDialed, NetPresenceEvent, NetPresenceSubscribeReq, NetSent, TeardownReq, KIND_TEARDOWN, - NetStatusReply, NetStreamData, NetStreamEof, NetStreamOpenReq, NetStreamOpened, NetStreamSendReq, - NetStreamSubscribeReq, NetStreamsReply, NetStreamOpenerReply, NetStreamOpenerReq, NetStreamRetireReq, NetStreamRetired, NetStreamUnsubscribeReq, NetStreamUnsubscribed, OutputEvent, MetMember, PairCodeSubmit, PairJoinReply, PairJoinReq, PairMeetReq, ResizeReq, - SessionsReply, SizeEvent, SpawnConflict, SpawnReq, Spawned, StreamLifetime, SubscribeOutcome, - SubscribeReq, SubscribedReply, ViewerEvictedEvent, - KIND_ADAPTER_APPLY, KIND_APPLIED, KIND_BRAIN_RESTART, KIND_BROKER_IMAGE, KIND_BROKER_IMAGE_REPLY, KIND_STALL_EVICTS, KIND_STALL_EVICTS_REPLY, KIND_VIEWER_EVICTED, - KIND_COORDINATOR_IMAGE, KIND_COORDINATOR_IMAGE_ANNOUNCE, KIND_COORDINATOR_IMAGE_ANNOUNCE_REPLY, KIND_COORDINATOR_IMAGE_REPLY, - KIND_BRAIN_RESTARTED, KIND_DISPLACED, KIND_ENDPOINT_INJECTED, KIND_ENDPOINT_INPUT, KIND_ERROR, KIND_EXIT, KIND_INPUT, KIND_KILL, KIND_NET_DIAL, - KIND_NET_DIALED, KIND_NET_DIAL_LOOPBACK, KIND_NET_DIAL_SUBMIT, KIND_NET_DIAL_SUBMITTED, - KIND_NET_PRESENCE_EVENT, KIND_NET_PRESENCE_SUBSCRIBE, - KIND_NET_SENT, - KIND_NET_STATUS, KIND_NET_STATUS_REPLY, KIND_NET_STREAMS, KIND_NET_STREAMS_REPLY, - KIND_NET_STREAM_DATA, KIND_NET_STREAM_EOF, KIND_NET_STREAM_OPEN, KIND_NET_STREAM_OPENED, - KIND_NET_STREAM_OPENER, KIND_NET_STREAM_OPENER_REPLY, KIND_NET_STREAM_RETIRE, KIND_NET_STREAM_RETIRED, - KIND_NET_STREAM_UNSUBSCRIBE, KIND_NET_STREAM_UNSUBSCRIBED, - KIND_MET_MEMBER, KIND_NET_STREAM_SEND, KIND_NET_STREAM_SUBSCRIBE, KIND_OUTPUT, KIND_PAIR_CODE_SUBMIT, KIND_PAIR_JOIN, KIND_PAIR_JOINED, KIND_PAIR_MEET, - KIND_RESIZE, KIND_SESSIONS, KIND_SESSIONS_REPLY, KIND_SIZE, KIND_SPAWN, KIND_SPAWNED, - KIND_SPAWN_CONFLICT, KIND_SPAWN_FRESH, - KIND_SUBSCRIBE, KIND_SUBSCRIBED, KIND_UNSUBSCRIBE, UnsubscribeReq, + CoordinatorImageAnnounce, CoordinatorImageAnnounceReply, CoordinatorImageReply, DisplacedEvent, + EndpointInjected, EndpointInputReq, ErrorEvent, ExitEvent, InputReq, KillReq, MetMember, + NetDialReq, NetDialed, NetPresenceEvent, NetPresenceSubscribeReq, NetSent, NetStatusReply, + NetStreamData, NetStreamEof, NetStreamOpenReq, NetStreamOpened, NetStreamOpenerReply, + NetStreamOpenerReq, NetStreamRetireReq, NetStreamRetired, NetStreamSendReq, + NetStreamSubscribeReq, NetStreamUnsubscribeReq, NetStreamUnsubscribed, NetStreamsReply, + OutputEvent, PairCodeSubmit, PairJoinReply, PairJoinReq, PairMeetReq, ResizeReq, SessionsReply, + SizeEvent, SpawnConflict, SpawnReq, Spawned, StallEvictsReply, StreamLifetime, + SubscribeOutcome, SubscribeReq, SubscribedReply, TeardownReq, UnsubscribeReq, + ViewerEvictedEvent, KIND_ADAPTER_APPLY, KIND_APPLIED, KIND_BRAIN_RESTART, KIND_BRAIN_RESTARTED, + KIND_BROKER_IMAGE, KIND_BROKER_IMAGE_REPLY, KIND_COORDINATOR_IMAGE, + KIND_COORDINATOR_IMAGE_ANNOUNCE, KIND_COORDINATOR_IMAGE_ANNOUNCE_REPLY, + KIND_COORDINATOR_IMAGE_REPLY, KIND_DISPLACED, KIND_ENDPOINT_INJECTED, KIND_ENDPOINT_INPUT, + KIND_ERROR, KIND_EXIT, KIND_INPUT, KIND_KILL, KIND_MET_MEMBER, KIND_NET_DIAL, KIND_NET_DIALED, + KIND_NET_DIAL_LOOPBACK, KIND_NET_DIAL_SUBMIT, KIND_NET_DIAL_SUBMITTED, KIND_NET_PRESENCE_EVENT, + KIND_NET_PRESENCE_SUBSCRIBE, KIND_NET_SENT, KIND_NET_STATUS, KIND_NET_STATUS_REPLY, + KIND_NET_STREAMS, KIND_NET_STREAMS_REPLY, KIND_NET_STREAM_DATA, KIND_NET_STREAM_EOF, + KIND_NET_STREAM_OPEN, KIND_NET_STREAM_OPENED, KIND_NET_STREAM_OPENER, + KIND_NET_STREAM_OPENER_REPLY, KIND_NET_STREAM_RETIRE, KIND_NET_STREAM_RETIRED, + KIND_NET_STREAM_SEND, KIND_NET_STREAM_SUBSCRIBE, KIND_NET_STREAM_UNSUBSCRIBE, + KIND_NET_STREAM_UNSUBSCRIBED, KIND_OUTPUT, KIND_PAIR_CODE_SUBMIT, KIND_PAIR_JOIN, + KIND_PAIR_JOINED, KIND_PAIR_MEET, KIND_RESIZE, KIND_SESSIONS, KIND_SESSIONS_REPLY, KIND_SIZE, + KIND_SPAWN, KIND_SPAWNED, KIND_SPAWN_CONFLICT, KIND_SPAWN_FRESH, KIND_STALL_EVICTS, + KIND_STALL_EVICTS_REPLY, KIND_SUBSCRIBE, KIND_SUBSCRIBED, KIND_TEARDOWN, KIND_UNSUBSCRIBE, + KIND_VIEWER_EVICTED, }; -use spt_net::net::attach::AttachIntent; use crate::transport::{send_hello, LocalSocketTransport}; +use spt_net::net::attach::AttachIntent; /// Wall-clock now in epoch milliseconds — the source for `gen_start` (matches /// the epoch-ms stamping used elsewhere in the tree; no date dependency). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:695: /// asynchronous — the exit waiter removes the row once the child is dead), /// which is also why the request is idempotent broker-side. // [impl->REQ-ENDPOINT-TEARDOWN-AUTHORITY] - pub fn teardown_session( - &mut self, - session_id: Option, - endpoint: &str, - ) -> io::Result<()> { + pub fn teardown_session(&mut self, session_id: Option, endpoint: &str) -> io::Result<()> { self.send( KIND_TEARDOWN, serde_json::to_value(TeardownReq { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:1122: // [impl->REQ-VIEWER-SKIP-TO-LIVE-ON-EVICT] pub fn attach_skip_to_live(&mut self, session_id: u64, by: Option<&str>) -> io::Result<()> { self.session_id = Some(session_id); - self.subscribe_with(session_id, u64::MAX, AttachIntent::Viewer, 0, by.map(str::to_string))?; + self.subscribe_with( + session_id, + u64::MAX, + AttachIntent::Viewer, + 0, + by.map(str::to_string), + )?; self.session_cursors.insert(session_id, 0); self.next_seq = 0; Ok(()) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:1161: ) -> io::Result<()> { self.session_id = Some(session_id); self.next_seq = from_seq; - self.subscribe_with(session_id, from_seq, AttachIntent::Viewer, 0, by.map(str::to_string))?; + self.subscribe_with( + session_id, + from_seq, + AttachIntent::Viewer, + 0, + by.map(str::to_string), + )?; self.session_cursors.insert(session_id, from_seq); Ok(()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:1216: self.session_cursors .insert(info.session_id, info.resume_seq); // [impl->REQ-BRAIN-RESUME-NO-CONTROL-STEAL] - self.subscribe_with(info.session_id, info.resume_seq, AttachIntent::Viewer, 0, None)?; + self.subscribe_with( + info.session_id, + info.resume_seq, + AttachIntent::Viewer, + 0, + None, + )?; resumed.push(info.session_id); } Ok(resumed) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:1271: self.next_seq } - /// Query the broker-owned net endpoint's status (D4a): node id, dialable /// address, conn count — or `enabled: false` on a net-less broker. Reads /// until the reply (consuming interleaved events like [`Brain::spawn_session`]). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2149: let now = Instant::now(); // Pump mode, 30s carrier: reply-read capped to the 10s budget. let d = peer_reply_deadline(Some(Duration::from_secs(30)), now).expect("pump = Some"); - assert_eq!(d, now + PEER_REPLY_READ_BUDGET, "capped at the 10s budget, not 30s"); - assert!(d < now + Duration::from_secs(30), "strictly before the carrier deadline"); + assert_eq!( + d, + now + PEER_REPLY_READ_BUDGET, + "capped at the 10s budget, not 30s" + ); + assert!( + d < now + Duration::from_secs(30), + "strictly before the carrier deadline" + ); // A carrier timeout SHORTER than the budget wins the min (never exceed it). let short = peer_reply_deadline(Some(Duration::from_secs(3)), now).unwrap(); - assert_eq!(short, now + Duration::from_secs(3), "min honors a shorter carrier bound"); + assert_eq!( + short, + now + Duration::from_secs(3), + "min honors a shorter carrier bound" + ); // Non-pump: unbounded. - assert!(peer_reply_deadline(None, now).is_none(), "non-pump stays unbounded"); + assert!( + peer_reply_deadline(None, now).is_none(), + "non-pump stays unbounded" + ); } // [unit->REQ-PUMP-DIAL-FASTFAIL] the reclassification: a connect-then-silent Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2165: #[test] fn reclassify_peer_reply_maps_timeout_off_poison() { let t = reclassify_peer_reply_err(io::Error::new(io::ErrorKind::TimedOut, "silent peer")); - assert_ne!(t.kind(), io::ErrorKind::TimedOut, "no longer the poison kind"); + assert_ne!( + t.kind(), + io::ErrorKind::TimedOut, + "no longer the poison kind" + ); assert_eq!(t.kind(), io::ErrorKind::Other); let passthrough = reclassify_peer_reply_err(io::Error::new(io::ErrorKind::BrokenPipe, "carrier gone")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2270: // A FORWARD JUMP (seq 5, want 1) is a hard `output gap` error on the legacy // path — a cold brain treats a skipped seq as a lost chunk, never silently. stub.feed.send(output_envelope(sid, 5, b"jumped")).unwrap(); - let err = brain.read_event().expect_err("a cold brain rejects a forward gap"); + let err = brain + .read_event() + .expect_err("a cold brain rejects a forward gap"); assert_eq!(err.kind(), io::ErrorKind::InvalidData); assert!( err.to_string().contains("output gap"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2316: stub.feed .send(output_envelope(sid, seq, format!("c{seq}").as_bytes())) .unwrap(); - match brain.read_event().expect("contiguous controller frame accepted") { + match brain + .read_event() + .expect("contiguous controller frame accepted") + { BrokerEvent::Output { seq: got, .. } => assert_eq!(got, seq), other => panic!("expected Output({seq}), got {other:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2351: // ring replays 3,4,5 from the floor; the strict cursor (re-seeded to 3 by // attach_as) ACCEPTS each contiguously — exactly-once re-fetch, no re-gap. brain - .attach_as(sid, brain.controller_resume_floor(), AttachIntent::Control, 0, Some("node-A")) + .attach_as( + sid, + brain.controller_resume_floor(), + AttachIntent::Control, + 0, + Some("node-A"), + ) .expect("controller resume from floor"); for seq in 3u64..=5 { stub.feed Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2358: .send(output_envelope(sid, seq, format!("r{seq}").as_bytes())) .unwrap(); - match brain.read_event().expect("ring-replayed floor frame accepted") { + match brain + .read_event() + .expect("ring-replayed floor frame accepted") + { BrokerEvent::Output { seq: got, .. } => assert_eq!(got, seq), other => panic!("expected re-fetched Output({seq}), got {other:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2375: // UNCHANGED across two consecutive resumes — and returns // `ControllerIrrecoverablyBehind { floor }` rather than looping forever. brain - .attach_as(sid, brain.controller_resume_floor(), AttachIntent::Control, 0, Some("node-A")) + .attach_as( + sid, + brain.controller_resume_floor(), + AttachIntent::Control, + 0, + Some("node-A"), + ) .expect("controller second resume"); stub.feed.send(output_envelope(sid, 9, b"rolled")).unwrap(); let err = brain Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2434: stub.feed .send(sync_output_envelope(sid, 6, b"\x1b[?1049l-sync")) .unwrap(); - match brain.read_event().expect("flagged forward jump accepted (legacy path)") { + match brain + .read_event() + .expect("flagged forward jump accepted (legacy path)") + { BrokerEvent::Output { seq, bytes, .. } => { assert_eq!(seq, 6, "the sync frame itself is delivered"); assert_eq!(bytes, b"\x1b[?1049l-sync"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2455: // Flagged BACKWARD (a replayed boundary re-send of an old sync frame): // dedup-dropped, cursor untouched — feed a contiguous probe behind it to // prove the backward frame produced NO event and NO rewind. - stub.feed.send(sync_output_envelope(sid, 3, b"stale-sync")).unwrap(); + stub.feed + .send(sync_output_envelope(sid, 3, b"stale-sync")) + .unwrap(); stub.feed.send(output_envelope(sid, 8, b"probe")).unwrap(); - match brain.read_event().expect("the backward flagged frame is silently deduped") { + match brain + .read_event() + .expect("the backward flagged frame is silently deduped") + { BrokerEvent::Output { seq, bytes, .. } => { assert_eq!(seq, 8, "the NEXT event is the probe — never the stale sync"); assert_eq!(bytes, b"probe"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2468: // ── RESUME-MODE map path ──────────────────────────────────────────── let (mut brain, stub) = brain_with_stub(); - brain.attach_as_viewer_snap(sid, 0, Some("node-A")).expect("snap viewer"); + brain + .attach_as_viewer_snap(sid, 0, Some("node-A")) + .expect("snap viewer"); stub.feed.send(output_envelope(sid, 0, b"v0")).unwrap(); brain.read_event().expect("seq 0 accepted"); stub.feed Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2475: .send(sync_output_envelope(sid, 6, b"sync-frame")) .unwrap(); - match brain.read_event().expect("flagged forward jump accepted (map path)") { + match brain + .read_event() + .expect("flagged forward jump accepted (map path)") + { BrokerEvent::Output { seq, .. } => assert_eq!(seq, 6), other => panic!("expected Output(6), got {other:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2481: - assert_eq!(brain.session_cursor(sid), Some(7), "map cursor snapped to 7"); - stub.feed.send(sync_output_envelope(sid, 2, b"stale")).unwrap(); + assert_eq!( + brain.session_cursor(sid), + Some(7), + "map cursor snapped to 7" + ); + stub.feed + .send(sync_output_envelope(sid, 2, b"stale")) + .unwrap(); stub.feed.send(output_envelope(sid, 7, b"probe")).unwrap(); - match brain.read_event().expect("backward flagged frame deduped on the map path") { + match brain + .read_event() + .expect("backward flagged frame deduped on the map path") + { BrokerEvent::Output { seq, .. } => assert_eq!(seq, 7, "probe, not the stale sync"), other => panic!("expected Output(7), got {other:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2496: fn an_old_broker_wire_without_the_sync_key_keeps_every_legacy_path() { let sid = 1u64; // The absent key deserializes to false (the resume_seq additive shape). - let old: OutputEvent = serde_json::from_str( - &format!(r#"{{"session_id":{sid},"seq":9,"data_b64":"{}"}}"#, encode_bytes(b"x")), - ) + let old: OutputEvent = serde_json::from_str(&format!( + r#"{{"session_id":{sid},"seq":9,"data_b64":"{}"}}"#, + encode_bytes(b"x") + )) .expect("old-broker OutputEvent parses"); assert!(!old.sync, "absent sync key -> false"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2515: .unwrap(), ); stub.feed.send(repaint).unwrap(); - match brain.read_event().expect("cold baseline accepts the unflagged pseudo-seq") { + match brain + .read_event() + .expect("cold baseline accepts the unflagged pseudo-seq") + { BrokerEvent::Output { seq, .. } => assert_eq!(seq, 4), other => panic!("expected Output(4), got {other:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2522: // Strict afterwards: an unflagged forward jump is still a hard gap. stub.feed.send(output_envelope(sid, 9, b"jump")).unwrap(); - let err = brain.read_event().expect_err("unflagged jump stays reject-gap"); + let err = brain + .read_event() + .expect_err("unflagged jump stays reject-gap"); assert!(err.to_string().contains("output gap")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2564: // ACCEPT it (the broker's Mutex-held replay cannot reorder, so a forward // jump is only ever a legitimate post-eviction ring-floor clamp). stub.feed.send(output_envelope(sid, 12, b"LIVE-A")).unwrap(); - match brain.read_event().expect("post-eviction forward jump accepted") { + match brain + .read_event() + .expect("post-eviction forward jump accepted") + { BrokerEvent::Output { seq, bytes, .. } => { - assert_eq!(seq, 12, "the forward-jumped live seq is accepted, not rejected"); + assert_eq!( + seq, 12, + "the forward-jumped live seq is accepted, not rejected" + ); assert_eq!(bytes, b"LIVE-A"); } other => panic!("expected Output(12) via snap-above, got {other:?}"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2640: // The ring rolled between reads: the next Output frame carries a seq far // ABOVE the cursor (4504 while cursor is 100 — the legacy path would fatal // `output gap: got 4504 want 100`). Snap-above must ACCEPT it. - stub.feed.send(output_envelope(sid, 4504, b"ROLLED")).unwrap(); - match brain.read_event().expect("pre-eviction forward ring-roll gap accepted") { + stub.feed + .send(output_envelope(sid, 4504, b"ROLLED")) + .unwrap(); + match brain + .read_event() + .expect("pre-eviction forward ring-roll gap accepted") + { BrokerEvent::Output { seq, bytes, .. } => { - assert_eq!(seq, 4504, "the forward-jumped live seq is accepted, not rejected"); + assert_eq!( + seq, 4504, + "the forward-jumped live seq is accepted, not rejected" + ); assert_eq!(bytes, b"ROLLED"); } other => panic!("expected Output(4504) via snap-above, got {other:?}"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brain.rs:2657: // From there it tracks contiguously and DEDUPS below the cursor: seq 4505 // accepted, the stale re-send (seq 4504, already delivered) is DEDUPED (not a // gap, not re-emitted), seq 4506 accepted. - stub.feed.send(output_envelope(sid, 4505, b"LIVE-B")).unwrap(); + stub.feed + .send(output_envelope(sid, 4505, b"LIVE-B")) + .unwrap(); stub.feed.send(output_envelope(sid, 4504, b"DUP")).unwrap(); // dedup below cursor - stub.feed.send(output_envelope(sid, 4506, b"LIVE-C")).unwrap(); + stub.feed + .send(output_envelope(sid, 4506, b"LIVE-C")) + .unwrap(); let mut accepted = Vec::new(); for _ in 0..2 { match brain.read_event().expect("subsequent live frames") { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:546: fn record_promoted(&self, version: u64); /// Correct the record: the candidate failed readiness. Persist /// `RolledBack{…}` and fire the loud, resurfacing rollback notif. - fn record_rolled_back(&self, quarantine_version: u64, running_version: u64, rollback_binary: &str); + fn record_rolled_back( + &self, + quarantine_version: u64, + running_version: u64, + rollback_binary: &str, + ); /// The `exe_hash` the candidate stamped in `brain.ready` (the bytes it is /// actually running), or `None` if absent/garbled — degrades the promotion /// bytes-gate to readiness-only (KH 6.11, N-1-safe). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:640: // produce — see `fire_rollback_notif`). dismiss_update_notifs_on_apply(); } - fn record_rolled_back(&self, quarantine_version: u64, running_version: u64, rollback_binary: &str) { + fn record_rolled_back( + &self, + quarantine_version: u64, + running_version: u64, + rollback_binary: &str, + ) { let cache = self.cache(); let _ = cache.record_applied_state(&AppliedRecord::RolledBack { quarantine_version, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:891: // trial, default binary" — the supervisor never panics on the record. let record = env.applied_state(); let binary: Option = match &record { - Some(AppliedRecord::RolledBack { rollback_binary, .. }) => { - Some(PathBuf::from(rollback_binary)) - } + Some(AppliedRecord::RolledBack { + rollback_binary, .. + }) => Some(PathBuf::from(rollback_binary)), _ => None, }; let is_trial = matches!(record, Some(AppliedRecord::AppliedPending { .. })); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:935: // onto the renamed old binary) fails the trial → kill + // rollback, never a falsely-`applied` record. let version = match &record { - Some(AppliedRecord::AppliedPending { version, .. }) => Some(*version), + Some(AppliedRecord::AppliedPending { version, .. }) => { + Some(*version) + } _ => None, }; if let Some(version) = version { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1044: } reason = StartReason::Crash; backoff = next_backoff(backoff, started.elapsed(), base); - eprintln!("BRAIN_RESTART: supervised respawn in {}s", backoff.as_secs()); + eprintln!( + "BRAIN_RESTART: supervised respawn in {}s", + backoff.as_secs() + ); sleep_backoff(backoff, stop); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1413: fn brain_child_args_carry_generation_and_reason() { assert_eq!( brain_child_args(7, StartReason::Update), - vec!["daemon", "brain", "--generation", "7", "--start-reason", "update"] + vec![ + "daemon", + "brain", + "--generation", + "7", + "--start-reason", + "update" + ] ); assert_eq!( brain_child_args(0, StartReason::Cold), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1420: - vec!["daemon", "brain", "--generation", "0", "--start-reason", "cold"] + vec![ + "daemon", + "brain", + "--generation", + "0", + "--start-reason", + "cold" + ] ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1487: Some(7) ); // Staleness is visible at the primitive: gen N−1 ≠ the gen-N a gate seeks. - let stale = parse_ready_generation( - &serde_json::json!({"pid": 4321, "generation": 6}).to_string(), - ); + let stale = + parse_ready_generation(&serde_json::json!({"pid": 4321, "generation": 6}).to_string()); assert_eq!(stale, Some(6)); - assert_ne!(stale, Some(7), "a gen-6 stamp must not satisfy a gen-7 gate"); + assert_ne!( + stale, + Some(7), + "a gen-6 stamp must not satisfy a gen-7 gate" + ); // Fail-safe: legacy bare-pid text, garbage, and a stampless body → None. assert_eq!(parse_ready_generation("4321"), None, "legacy bare pid"); assert_eq!(parse_ready_generation("{ not json"), None, "garbage"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1510: let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("brain.ready"); assert_eq!(ready_generation_at(&path), None, "absent file → not-ready"); - std::fs::write(&path, serde_json::json!({"pid": 1, "generation": 42}).to_string()) - .unwrap(); + std::fs::write( + &path, + serde_json::json!({"pid": 1, "generation": 42}).to_string(), + ) + .unwrap(); assert_eq!(ready_generation_at(&path), Some(42)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1524: // Present → Some(hash). assert_eq!( parse_ready_exe_hash( - &serde_json::json!({"pid": 1, "generation": 3, "exe_hash": "deadbeef"}) - .to_string() + &serde_json::json!({"pid": 1, "generation": 3, "exe_hash": "deadbeef"}).to_string() ), Some("deadbeef".to_string()) ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1732: fast_child() }, ); - assert_eq!(env.promotions.lock().unwrap().as_slice(), &[7], "promoted once"); + assert_eq!( + env.promotions.lock().unwrap().as_slice(), + &[7], + "promoted once" + ); assert!(env.rollbacks.lock().unwrap().is_empty(), "no rollback"); assert_eq!(env.notifs.load(Ordering::Relaxed), 0, "no rollback notif"); - assert!(env.clears.load(Ordering::Relaxed) >= 1, "ready cleared before the trial spawn"); + assert!( + env.clears.load(Ordering::Relaxed) >= 1, + "ready cleared before the trial spawn" + ); let s = spawns.lock().unwrap(); - assert_eq!(s[0].1, StartReason::Cold, "first spawn is the cold trial candidate"); + assert_eq!( + s[0].1, + StartReason::Cold, + "first spawn is the cold trial candidate" + ); assert_eq!(s[0].2, None, "candidate spawns the default current_exe"); - assert_eq!(s[1].2, None, "a later crash respawns the SAME accepted binary, not a rollback"); + assert_eq!( + s[1].2, None, + "a later crash respawns the SAME accepted binary, not a rollback" + ); } /// (DRAINED gate — RED-first) A candidate that signals ready but whose OLD Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1788: &[(6, 5, "/good/spt.old-6".to_string())], "the never-drained candidate is killed + rolled back (conservative, never a false-promote)" ); - assert_eq!(env.notifs.load(Ordering::Relaxed), 1, "one loud rollback notif"); + assert_eq!( + env.notifs.load(Ordering::Relaxed), + 1, + "one loud rollback notif" + ); } /// (DRAINED gate — latch releases) A ready candidate whose old generation drains Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1871: let x = TestTrialEnv::pending(8, "/g/spt.old-8").with_hashes(Some("abc"), Some("xyz")); assert!(matches!(bytes_gate(&x, 8), BytesGate::Mismatch)); let ready_absent = TestTrialEnv::pending(8, "/g/spt.old-8").with_hashes(None, Some("abc")); - assert!(matches!(bytes_gate(&ready_absent, 8), BytesGate::Unverified)); + assert!(matches!( + bytes_gate(&ready_absent, 8), + BytesGate::Unverified + )); let staged_absent = TestTrialEnv::pending(8, "/g/spt.old-8").with_hashes(Some("abc"), None); - assert!(matches!(bytes_gate(&staged_absent, 8), BytesGate::Unverified)); + assert!(matches!( + bytes_gate(&staged_absent, 8), + BytesGate::Unverified + )); } /// (KH 6.11 — Half 2 integration) A candidate that signals ready but is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1918: 1, "rolled back once on the bytes mismatch" ); - assert_eq!(env.notifs.load(Ordering::Relaxed), 1, "loud rollback notif fired"); + assert_eq!( + env.notifs.load(Ordering::Relaxed), + 1, + "loud rollback notif fired" + ); } /// (KH 6.11 — Half 2 integration) A candidate ready AND running the staged Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:1984: env.as_ref(), Duration::from_secs(5), move |gen, reason, binary| { - spawns_c - .lock() - .unwrap() - .push((gen, reason, binary.map(|p| p.display().to_string()))); + spawns_c.lock().unwrap().push(( + gen, + reason, + binary.map(|p| p.display().to_string()), + )); // The candidate never signals ready and exits at once (fast_child); // once selection switches to the rollback binary, stop. if binary.is_some() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:2001: &[(9, 8, "/good/spt.old-9".to_string())], "rolled back exactly once, quarantine=N running=N-1" ); - assert_eq!(env.notifs.load(Ordering::Relaxed), 1, "one loud rollback notif"); + assert_eq!( + env.notifs.load(Ordering::Relaxed), + 1, + "one loud rollback notif" + ); assert!(env.promotions.lock().unwrap().is_empty(), "never promoted"); let s = spawns.lock().unwrap(); let reasons: Vec = s.iter().map(|(_, r, _)| *r).collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:2008: assert_eq!( reasons, - vec![StartReason::Cold, StartReason::Crash, StartReason::Crash, StartReason::Crash], + vec![ + StartReason::Cold, + StartReason::Crash, + StartReason::Crash, + StartReason::Crash + ], "K=3 trial spawns (Cold then Crash×2) all gated, then the rollback respawn" ); assert_eq!(s[0].2, None, "trial candidate = current_exe"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:2016: Some("/good/spt.old-9"), "after rollback, selection switches to the rollback binary" ); - assert_eq!(env.clears.load(Ordering::Relaxed), 3, "ready cleared before each of the 3 trial spawns"); + assert_eq!( + env.clears.load(Ordering::Relaxed), + 3, + "ready cleared before each of the 3 trial spawns" + ); } /// (3/A11) Alive-but-never-ready: the window elapses with the candidate alive Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:2061: &[(5, 4, "/good/spt.old-5".to_string())], "alive-never-ready rolls back" ); - assert_eq!(env.notifs.load(Ordering::Relaxed), 1, "one loud rollback notif"); + assert_eq!( + env.notifs.load(Ordering::Relaxed), + 1, + "one loud rollback notif" + ); assert!(env.promotions.lock().unwrap().is_empty(), "never promoted"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\brainproc.rs:2231: "a fresh broker reading a RolledBack record spawns the good binary, not current_exe" ); assert!(env.promotions.lock().unwrap().is_empty()); - assert!(env.rollbacks.lock().unwrap().is_empty(), "no NEW rollback — it is the recovery steady state"); + assert!( + env.rollbacks.lock().unwrap().is_empty(), + "no NEW rollback — it is the recovery steady state" + ); } /// REGISTRY-LIFECYCLE R1: the executable digest is COMPUTED exactly once Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:34: use std::collections::{HashMap, HashSet, VecDeque}; use std::io; use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, AtomicUsize, Ordering}; -use std::sync::mpsc::{channel, sync_channel, Receiver, RecvTimeoutError, Sender, SyncSender, TrySendError}; +use std::sync::mpsc::{ + channel, sync_channel, Receiver, RecvTimeoutError, Sender, SyncSender, TrySendError, +}; use std::sync::{Arc, Mutex, OnceLock}; use std::thread::{self, JoinHandle}; use std::time::{Duration, Instant}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:52: use crate::frame::{Envelope, Role}; use crate::msg::{ applied_envelope, decode_bytes, displaced_envelope, endpoint_injected_envelope, - evicted_envelope, net_dialed_envelope, output_envelope, - size_envelope, subscribed_envelope, sync_output_envelope, AdapterApplyReq, BrainRestarted, EndpointInputReq, - ErrorEvent, ExitEvent, InputReq, KillReq, NetDialReq, NetPresenceSubscribeReq, NetSent, TeardownReq, KIND_TEARDOWN, - BrokerImageReply, CoordinatorImageAnnounce, CoordinatorImageAnnounceReply, CoordinatorImageReply, - StallEvictsReply, NetStatusReply, NetStreamOpenReq, NetStreamOpened, NetStreamSendReq, NetStreamSubscribeReq, - NetStreamsReply, NetStreamOpenerReply, NetStreamOpenerReq, NetStreamRetireReq, NetStreamRetired, NetStreamUnsubscribeReq, NetStreamUnsubscribed, MetMember, PairCodeSubmit, PairJoinReply, PairJoinReq, PairMeetReq, ResizeReq, SessionInfo, SessionsReply, SpawnReq, - SpawnConflict, Spawned, SubscribeOutcome, SubscribeReq, UnsubscribeReq, KIND_BRAIN_RESTART, KIND_BRAIN_RESTARTED, KIND_ENDPOINT_INPUT, KIND_ERROR, KIND_EXIT, - KIND_INPUT, KIND_KILL, KIND_NET_DIAL, KIND_NET_DIAL_LOOPBACK, KIND_NET_DIAL_SUBMIT, - KIND_NET_DIAL_SUBMITTED, KIND_NET_PRESENCE_SUBSCRIBE, - KIND_NET_SENT, - KIND_ADAPTER_APPLY, KIND_APPLIED, - KIND_BROKER_IMAGE, KIND_BROKER_IMAGE_REPLY, KIND_STALL_EVICTS, KIND_STALL_EVICTS_REPLY, + evicted_envelope, net_dialed_envelope, output_envelope, size_envelope, subscribed_envelope, + sync_output_envelope, AdapterApplyReq, BrainRestarted, BrokerImageReply, + CoordinatorImageAnnounce, CoordinatorImageAnnounceReply, CoordinatorImageReply, + EndpointInputReq, ErrorEvent, ExitEvent, InputReq, KillReq, MetMember, NetDialReq, + NetPresenceSubscribeReq, NetSent, NetStatusReply, NetStreamOpenReq, NetStreamOpened, + NetStreamOpenerReply, NetStreamOpenerReq, NetStreamRetireReq, NetStreamRetired, + NetStreamSendReq, NetStreamSubscribeReq, NetStreamUnsubscribeReq, NetStreamUnsubscribed, + NetStreamsReply, PairCodeSubmit, PairJoinReply, PairJoinReq, PairMeetReq, ResizeReq, + SessionInfo, SessionsReply, SpawnConflict, SpawnReq, Spawned, StallEvictsReply, + SubscribeOutcome, SubscribeReq, TeardownReq, UnsubscribeReq, KIND_ADAPTER_APPLY, KIND_APPLIED, + KIND_BRAIN_RESTART, KIND_BRAIN_RESTARTED, KIND_BROKER_IMAGE, KIND_BROKER_IMAGE_REPLY, KIND_COORDINATOR_IMAGE, KIND_COORDINATOR_IMAGE_ANNOUNCE, KIND_COORDINATOR_IMAGE_ANNOUNCE_REPLY, - KIND_COORDINATOR_IMAGE_REPLY, - KIND_NET_STATUS, KIND_NET_STATUS_REPLY, KIND_NET_STREAMS, KIND_NET_STREAMS_REPLY, - KIND_NET_STREAM_OPEN, KIND_NET_STREAM_OPENED, KIND_NET_STREAM_OPENER, KIND_NET_STREAM_OPENER_REPLY, KIND_NET_STREAM_RETIRE, KIND_NET_STREAM_RETIRED, KIND_NET_STREAM_SEND, KIND_NET_STREAM_SUBSCRIBE, - KIND_NET_STREAM_UNSUBSCRIBE, KIND_NET_STREAM_UNSUBSCRIBED, - KIND_MET_MEMBER, KIND_PAIR_CODE_SUBMIT, KIND_PAIR_JOIN, KIND_PAIR_JOINED, KIND_PAIR_MEET, KIND_RESIZE, KIND_SESSIONS, KIND_SESSIONS_REPLY, KIND_SPAWN, - KIND_SPAWNED, KIND_SPAWN_CONFLICT, KIND_SPAWN_FRESH, KIND_SUBSCRIBE, KIND_UNSUBSCRIBE, + KIND_COORDINATOR_IMAGE_REPLY, KIND_ENDPOINT_INPUT, KIND_ERROR, KIND_EXIT, KIND_INPUT, + KIND_KILL, KIND_MET_MEMBER, KIND_NET_DIAL, KIND_NET_DIAL_LOOPBACK, KIND_NET_DIAL_SUBMIT, + KIND_NET_DIAL_SUBMITTED, KIND_NET_PRESENCE_SUBSCRIBE, KIND_NET_SENT, KIND_NET_STATUS, + KIND_NET_STATUS_REPLY, KIND_NET_STREAMS, KIND_NET_STREAMS_REPLY, KIND_NET_STREAM_OPEN, + KIND_NET_STREAM_OPENED, KIND_NET_STREAM_OPENER, KIND_NET_STREAM_OPENER_REPLY, + KIND_NET_STREAM_RETIRE, KIND_NET_STREAM_RETIRED, KIND_NET_STREAM_SEND, + KIND_NET_STREAM_SUBSCRIBE, KIND_NET_STREAM_UNSUBSCRIBE, KIND_NET_STREAM_UNSUBSCRIBED, + KIND_PAIR_CODE_SUBMIT, KIND_PAIR_JOIN, KIND_PAIR_JOINED, KIND_PAIR_MEET, KIND_RESIZE, + KIND_SESSIONS, KIND_SESSIONS_REPLY, KIND_SPAWN, KIND_SPAWNED, KIND_SPAWN_CONFLICT, + KIND_SPAWN_FRESH, KIND_STALL_EVICTS, KIND_STALL_EVICTS_REPLY, KIND_SUBSCRIBE, KIND_TEARDOWN, + KIND_UNSUBSCRIBE, }; use crate::nethost::{NetHost, NET_EFFECT_SESSION}; use crate::translation::{key_to_bytes, InjectFloor, KeyCmd, ToBinary, TranslationChild}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:307: past_grace: bool, ) -> bool { match wrapper_alive { - None => false, // no probeable pid — never guess - Some(false) => true, // dead root, surviving record — always a zombie + None => false, // no probeable pid — never guess + Some(false) => true, // dead root, surviving record — always a zombie Some(true) => adapter_labeled && past_grace && !has_live_descendants, } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:361: .any(|d| spt_store::proc::is_process_alive(*d)) }); let past_grace = Duration::from_millis(spawned_ms_ago) >= spawn_client_grace(); - zombie_verdict(wrapper_alive, adapter_labeled, has_live_descendants, past_grace) + zombie_verdict( + wrapper_alive, + adapter_labeled, + has_live_descendants, + past_grace, + ) } /// The RC-origin input-fence verdict (ADR-0044 decision 3, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:492: /// invariant, not its exact length. fn inject_miss_strike_budget() -> u32 { match std::env::var("SPT_INJECT_MISS_STRIKE_BUDGET") { - Ok(n) => n.parse::().ok().filter(|b| *b >= 1).unwrap_or(INJECT_MISS_STRIKE_BUDGET), + Ok(n) => n + .parse::() + .ok() + .filter(|b| *b >= 1) + .unwrap_or(INJECT_MISS_STRIKE_BUDGET), Err(_) => INJECT_MISS_STRIKE_BUDGET, } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:592: fn inject_text_chunk() -> usize { match std::env::var("SPT_INJECT_TEXT_CHUNK") { - Ok(n) => n.parse::().ok().filter(|c| *c > 0).unwrap_or(INJECT_TEXT_CHUNK), + Ok(n) => n + .parse::() + .ok() + .filter(|c| *c > 0) + .unwrap_or(INJECT_TEXT_CHUNK), Err(_) => INJECT_TEXT_CHUNK, } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:1417: /// single live writer per connection and a monotonic on-wire seq stream, /// [`REQ-HAZARD-CONTROLLER-WRITER-REORDER`]). Stamps `driven_by` to the new /// controller's identity. - fn become_controller(&mut self, sub: SharedSend, by: Option, from_seq: u64, attach_gen: u64) { + fn become_controller( + &mut self, + sub: SharedSend, + by: Option, + from_seq: u64, + attach_gen: u64, + ) { // Drop the prior controller sink first (its writer's live loop ends when // tx drops), and bump the generation so (a) an in-flight deadline-evict // for the old controller can't unseat this one and (b) a prior writer Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:1434: sub.describe(&format!( "controller session={} endpoint={} by={}", self.session_id, - if self.endpoint.is_empty() { "-" } else { &self.endpoint }, + if self.endpoint.is_empty() { + "-" + } else { + &self.endpoint + }, by.as_deref().unwrap_or("local") )); sub.lifecycle_event( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:1510: _writer: writer, attach_gen, revoked_by, - }); + }); self.stamp_driven_by(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:1686: sub.describe(&format!( "viewer session={} endpoint={} vid={vid}", self.session_id, - if self.endpoint.is_empty() { "-" } else { &self.endpoint } + if self.endpoint.is_empty() { + "-" + } else { + &self.endpoint + } )); sub.lifecycle_event( "viewer-attach", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:1723: let evicted = Arc::new(AtomicBool::new(false)); let writer_evicted = Arc::clone(&evicted); let session_id = self.session_id; - let writer = - thread::spawn(move || viewer_writer(writer_send, session_id, initial, rx, writer_evicted)); + let writer = thread::spawn(move || { + viewer_writer(writer_send, session_id, initial, rx, writer_evicted) + }); self.viewers.insert( vid, ViewerSink { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:1775: "SUBSCRIBE_DECISION: session={} endpoint={} by={} conn={} intent={} \ old_by={} old_gen={} req_gen={} decision={}", self.session_id, - if self.endpoint.is_empty() { "-" } else { &self.endpoint }, + if self.endpoint.is_empty() { + "-" + } else { + &self.endpoint + }, by_lbl, conn, intent_lbl, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:2252: } } - /// Stamp the perch's `driven_by` to the current controller's identity (the /// broker is the single writer — resolves the clear-race). The remote-drive /// detection fact (REQ-REACH-1) moved here from `serve_attach` so a displaced Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:2400: fn drop(&mut self) { self.send.lifecycle_event( "writer-exit", - &format!("role=viewer session={} reason={}", self.session_id, self.reason), + &format!( + "role=viewer session={} reason={}", + self.session_id, self.reason + ), ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:2663: note_controller_write_retired(sid, send.id(), &e); send.lifecycle_event( "writer-exit", - &format!("role=controller session={sid} reason=write-failed kind={:?}", e.kind()), + &format!( + "role=controller session={sid} reason=write-failed kind={:?}", + e.kind() + ), ); return; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:2702: // [impl->REQ-CONN-POISON-ATTRIBUTION] send.lifecycle_event( "writer-exit", - &format!("role=controller session={sid} reason=write-failed kind={:?}", e.kind()), + &format!( + "role=controller session={sid} reason=write-failed kind={:?}", + e.kind() + ), ); return; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4386: // AND the off-lock converge_perch_stamps below see the // cleared state and the stale info.json stamp clears. let _ = log.reap_dead_controller(); - let stamp_gen = - stamp_slot(&endpoint).gen.load(Ordering::Acquire); + let stamp_gen = stamp_slot(&endpoint).gen.load(Ordering::Acquire); SessSnap { id, endpoint, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4507: for id in &my_cb_streams { let _ = host.send_stream(*id, &[], true); let _ = host.retire_stream_terminal(*id); - eprintln!("STREAM_CONNBOUND_RETIRE:{id}: opener conn exited — FIN + terminal retire"); + eprintln!( + "STREAM_CONNBOUND_RETIRE:{id}: opener conn exited — FIN + terminal retire" + ); } // And presence: the liveness log + its ring persist (D4c). if my_presence_sub { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4537: /// [`KIND_SPAWN_CONFLICT`] — NEVER `Spawned(existing)`. `Ok(None)` = the /// conflict was sent (no session to auto-subscribe). // [impl->REQ-SPAWN-FRESH-TRUTHFUL] - fn dispatch_spawn_fresh(&self, env: Envelope, send: &SharedSend) -> Result, String> { + fn dispatch_spawn_fresh( + &self, + env: Envelope, + send: &SharedSend, + ) -> Result, String> { let req: SpawnReq = serde_json::from_value(env.payload).map_err(|e| format!("bad spawn payload: {e}"))?; self.dispatch_spawn_policy(req, send, true) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4583: let gate = { let sessions = recover(&self.sessions); let mut inflight = recover(&self.wake_inflight); - let live = sessions.iter().find(|(_, h)| h.endpoint == req.endpoint).map( - |(sid, h)| { + let live = sessions + .iter() + .find(|(_, h)| h.endpoint == req.endpoint) + .map(|(sid, h)| { ( *sid, h.session.process_id(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4591: !h.adapter.is_empty(), h.spawned_at.elapsed().as_millis() as u64, ) - }, - ); + }); match wake_gate_decision( live.is_some(), inflight.contains(&req.endpoint), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4601: WakeGate::AlreadyLive => { let (sid, spid, adapter_labeled, spawned_ms_ago) = live.expect("live is Some on AlreadyLive"); - Gate::AlreadyLive { sid, spid, adapter_labeled, spawned_ms_ago } + Gate::AlreadyLive { + sid, + spid, + adapter_labeled, + spawned_ms_ago, + } } WakeGate::Racing => Gate::Racing, WakeGate::Claim => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4615: }; match gate { Gate::Claimed(guard) => break Some(guard), - Gate::AlreadyLive { sid, spid, adapter_labeled, spawned_ms_ago } => { + Gate::AlreadyLive { + sid, + spid, + adapter_labeled, + spawned_ms_ago, + } => { // ONE liveness authority (ADR-0041 decision 6, // REQ-ENDPOINT-CYCLE-HONEST): before refusing/deduping by // citing the claimed session, PROBE its client tree — off Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4688: ); let frame = Envelope::new( KIND_SPAWNED, - serde_json::to_value(Spawned { session_id: sid, pid: spid }) - .expect("Spawned serializes"), + serde_json::to_value(Spawned { + session_id: sid, + pid: spid, + }) + .expect("Spawned serializes"), ); send_frame(send, &frame); return Ok(Some(sid)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:4888: // C-1: the shared bounded-respawn give-up counter (starts at 0; the worker // resets it on a healthy commit, the dispatch respawn path increments it). let translation_respawns = Arc::new(AtomicU32::new(0)); - let translation = req - .translation_binary - .as_deref() - .and_then(|argv| { - build_translation( - argv, - &req.endpoint, - &input, - Arc::clone(&translation_respawns), - &log, - ) - }); + let translation = req.translation_binary.as_deref().and_then(|argv| { + build_translation( + argv, + &req.endpoint, + &input, + Arc::clone(&translation_respawns), + &log, + ) + }); recover(&self.sessions).insert( id, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5018: let h = sessions .get(&req.session_id) .ok_or_else(|| format!("no such session {}", req.session_id))?; - (Arc::clone(&h.input), h.translation.clone(), Arc::clone(&h.log)) + ( + Arc::clone(&h.input), + h.translation.clone(), + Arc::clone(&h.log), + ) }; // RC-ORIGIN INPUT FENCE (ADR-0044 decision 3, the required defense): // an rc-tagged input must come from the ACTIVE controller lease's Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5159: // recovered session shows clean; re-stamped if the new binary faults too). let perch = resolve_perch_path(endpoint, ParentHint::Infer); let _ = spt_store::info::set_translation_fault(&perch, None); - eprintln!("TRANSLATION_RESPAWN:{endpoint}: rebuilt faulted binary (attempt {n}/{budget})"); + eprintln!( + "TRANSLATION_RESPAWN:{endpoint}: rebuilt faulted binary (attempt {n}/{budget})" + ); } // Swap it in under the lock (the session may have exited mid-build). let mut map = recover(&self.sessions); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5254: "ENDPOINT_INJECT:{} ({} bytes → translation binary{})", req.endpoint, bytes.len(), - if req.native && !idle { ", native mid-active" } else { "" } + if req.native && !idle { + ", native mid-active" + } else { + "" + } ); send_frame( send, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5279: "ENDPOINT_INJECT:{}: endpoint ACTIVE -> spool (deferred hint), not injected", req.endpoint ); - send_frame(send, &endpoint_injected_envelope(&req.endpoint, false, true)); + send_frame( + send, + &endpoint_injected_envelope(&req.endpoint, false, true), + ); } else { eprintln!( "ENDPOINT_INJECT:{}: no working translation binary (absent/faulted/worker-gone) -> SPOOLED (idle window), not injected", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5286: req.endpoint ); - send_frame(send, &endpoint_injected_envelope(&req.endpoint, false, false)); + send_frame( + send, + &endpoint_injected_envelope(&req.endpoint, false, false), + ); } Ok(()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5292: // No hosted session for this endpoint — tell the caller to spool // NON-deferred (idle-eligible; a non-hosted target has no active window). None => { - send_frame(send, &endpoint_injected_envelope(&req.endpoint, false, false)); + send_frame( + send, + &endpoint_injected_envelope(&req.endpoint, false, false), + ); Ok(()) } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5421: let supervised = crate::brainproc::supervised_generation(); let accepted = match serde_json::from_value::(env.payload) { Ok(a) if coordinator_announce_accepted(a.generation, supervised) => { - *self.coordinator_image.lock().expect("coordinator image lock") = - Some((a.generation, a.version)); + *self + .coordinator_image + .lock() + .expect("coordinator image lock") = Some((a.generation, a.version)); true } _ => false, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5489: }; let frame = Envelope::new( KIND_BRAIN_RESTARTED, - serde_json::to_value(BrainRestarted { honored }) - .expect("BrainRestarted serializes"), + serde_json::to_value(BrainRestarted { honored }).expect("BrainRestarted serializes"), ); send_frame(send, &frame); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:5591: .to_hex(); host.submit_dial(addr, remote_id_hex); // Immediate bare ack — the dial spawned; its outcome is a presence event. - send_frame(send, &Envelope::new(KIND_NET_DIAL_SUBMITTED, serde_json::Value::Null)); + send_frame( + send, + &Envelope::new(KIND_NET_DIAL_SUBMITTED, serde_json::Value::Null), + ); Ok(()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6081: sessions .iter() .find(|(id, h)| { - req.session_id == Some(**id) - || want_endpoint.is_some_and(|e| e == h.endpoint) + req.session_id == Some(**id) || want_endpoint.is_some_and(|e| e == h.endpoint) }) .map(|(_, h)| (h.session.process_id(), Arc::clone(&h.session))) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6174: &rec.name, ) .ok() - .and_then(|m| m.service) - else { + .and_then(|m| m.service) else { continue; }; - let outcome = - crate::servicehost::quiesce_for_update(set, &rec.name, &service); + let outcome = crate::servicehost::quiesce_for_update(set, &rec.name, &service); eprintln!("SERVICE_QUIESCE:{}: {outcome:?}", rec.name); if !outcome.clear_to_swap() { // Release every hold we took, including this one: an Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6318: #[test] fn stamp_divergence_gates_writes() { // Converged already → no writes. - assert_eq!(stamp_divergence(None, false, 0, None, false, 0), (false, false)); + assert_eq!( + stamp_divergence(None, false, 0, None, false, 0), + (false, false) + ); // The stamp-before-bind loss: perch says controlled=false, session IS driven. - assert_eq!(stamp_divergence(None, false, 0, None, true, 0), (true, false)); + assert_eq!( + stamp_divergence(None, false, 0, None, true, 0), + (true, false) + ); // A remote controller's driven_by appears → control write. - assert_eq!(stamp_divergence(None, true, 0, Some("n"), true, 0), (true, false)); + assert_eq!( + stamp_divergence(None, true, 0, Some("n"), true, 0), + (true, false) + ); // Viewer count changed only → viewer write only. - assert_eq!(stamp_divergence(None, true, 0, None, true, 2), (false, true)); + assert_eq!( + stamp_divergence(None, true, 0, None, true, 2), + (false, true) + ); // Both diverge. - assert_eq!(stamp_divergence(Some("a"), false, 1, None, true, 3), (true, true)); + assert_eq!( + stamp_divergence(Some("a"), false, 1, None, true, 3), + (true, true) + ); } // [unit->REQ-UPDATE-RUNNING-IMAGE-SURFACE] the coordinator-image Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6691: ); let ev: crate::msg::ViewerEvictedEvent = serde_json::from_value(env.payload).expect("marker payload"); - assert_eq!(ev.session_id, 7, "the marker names the evicted viewer's session"); + assert_eq!( + ev.session_id, 7, + "the marker names the evicted viewer's session" + ); } // ── NORMAL close: flag false → no marker; the client read hits EOF. ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6755: ); // First append fits the depth-1 queue (no overflow, not evicted yet). - assert_eq!(log.append(b"chunk-0"), None, "no controller; first chunk fits"); + assert_eq!( + log.append(b"chunk-0"), + None, + "no controller; first chunk fits" + ); assert!( !observed.load(Ordering::Acquire), "a viewer keeping within its queue is NOT flagged" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6764: // Second append OVERFLOWS the (still-undrained) depth-1 queue → eviction: // the flag is SET (so the writer skips-to-live) and the sink is removed. - assert_eq!(log.append(b"chunk-1"), None, "no controller; eviction returns no ctrl job"); + assert_eq!( + log.append(b"chunk-1"), + None, + "no controller; eviction returns no ctrl job" + ); assert!( observed.load(Ordering::Acquire), "an overflow eviction must SET the sink's `evicted` flag BEFORE dropping \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6814: fn exit_enqueues_behind_queued_output_per_sink() { let (send, mut client, _recv) = controller_socket_pair(); let mut log = OutputLog::new(9, DEFAULT_LOG_CHUNKS, String::new(), (24, 80)); - let out = log.resolve_subscribe(Arc::clone(&send), 0, AttachIntent::Control, Some("op".into()), 200); + let out = log.resolve_subscribe( + Arc::clone(&send), + 0, + AttachIntent::Control, + Some("op".into()), + 200, + ); assert!(matches!(out, SubscribeOutcome::Controller), "got {out:?}"); // Queue output THEN the Exit through the same fanout the exit waiter uses. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6823: } let frame = Envelope::new( crate::msg::KIND_EXIT, - serde_json::to_value(ExitEvent { session_id: 9, code: Some(0) }).unwrap(), + serde_json::to_value(ExitEvent { + session_id: 9, + code: Some(0), + }) + .unwrap(), ); let fanout = log.exit_fanout(); let (tx, sink) = fanout.controller.expect("controller queue"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6860: let (taker, _cc, _rc2) = controller_socket_pair(); let mut log = OutputLog::new(1, DEFAULT_LOG_CHUNKS, String::new(), (24, 80)); - let out = log.resolve_subscribe(Arc::clone(&live), 0, AttachIntent::Control, Some("op".into()), 200); + let out = log.resolve_subscribe( + Arc::clone(&live), + 0, + AttachIntent::Control, + Some("op".into()), + 200, + ); assert!(matches!(out, SubscribeOutcome::Controller), "got {out:?}"); // NEWER gen + plain Control → loud SUPERSESSION (the live replacement Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6867: // viewport — the T6 shape): the slot moves; outcome is Controller. // (The revoked marker is CONSUMED by the exiting writer — emission is // proven by `revoked_incumbent_writer_emits_the_terminal_displaced`.) - let out = log.resolve_subscribe(Arc::clone(&ctrl2), 0, AttachIntent::Control, Some("op".into()), 300); + let out = log.resolve_subscribe( + Arc::clone(&ctrl2), + 0, + AttachIntent::Control, + Some("op".into()), + 300, + ); assert!(matches!(out, SubscribeOutcome::Controller), "got {out:?}"); let c = log.controller.as_ref().expect("replacement holds the slot"); - assert!(Arc::ptr_eq(&c.send, &ctrl2), "the newer viewport superseded"); + assert!( + Arc::ptr_eq(&c.send, &ctrl2), + "the newer viewport superseded" + ); assert_eq!(c.attach_gen, 300); assert!(!log.is_controller(&live), "the fence moved with the slot"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6883: "older-gen {intent:?} must refuse busy, got {out:?}" ); } - let c = log.controller.as_ref().expect("incumbent survives the replays"); + let c = log + .controller + .as_ref() + .expect("incumbent survives the replays"); assert_eq!(c.attach_gen, 300); // NEWER gen + explicit Take → loud supersession, TookControl outcome. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6890: - let out = log.resolve_subscribe(Arc::clone(&taker), 0, AttachIntent::Take, Some("op".into()), 400); + let out = log.resolve_subscribe( + Arc::clone(&taker), + 0, + AttachIntent::Take, + Some("op".into()), + 400, + ); assert!(matches!(out, SubscribeOutcome::TookControl), "got {out:?}"); let c = log.controller.as_ref().expect("taker holds the slot"); assert!(Arc::ptr_eq(&c.send, &taker)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6894: - assert_eq!(c.attach_gen, 400, "the slot carries the taker's lease generation"); + assert_eq!( + c.attach_gen, 400, + "the slot carries the taker's lease generation" + ); // [unit->REQ-INPUT-CONTROLLER-FENCE] assert!(!log.is_controller(&ctrl2)); assert!(log.is_controller(&taker)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6912: // A real controller with a REAL writer thread (empty ring → empty // initial batch; the writer parks on its live queue). - let out = log.resolve_subscribe(Arc::clone(&a_send), 0, AttachIntent::Control, Some("op".into()), 200); + let out = log.resolve_subscribe( + Arc::clone(&a_send), + 0, + AttachIntent::Control, + Some("op".into()), + 200, + ); assert!(matches!(out, SubscribeOutcome::Controller), "got {out:?}"); // Distinct-lease Take: the old sink drops (tx closes) and its writer Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6919: // must write the terminal Displaced to A's conn on exit. - let out = log.resolve_subscribe(Arc::clone(&taker), 0, AttachIntent::Take, Some("op".into()), 300); + let out = log.resolve_subscribe( + Arc::clone(&taker), + 0, + AttachIntent::Take, + Some("op".into()), + 300, + ); assert!(matches!(out, SubscribeOutcome::TookControl), "got {out:?}"); let env = read_frame(&mut a_client).expect("A's conn carries the terminal frame"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6924: - assert_eq!(env.kind, crate::msg::KIND_DISPLACED, "terminal Displaced, got {}", env.kind); + assert_eq!( + env.kind, + crate::msg::KIND_DISPLACED, + "terminal Displaced, got {}", + env.kind + ); let ev: crate::msg::DisplacedEvent = serde_json::from_value(env.payload).expect("displaced payload"); assert_eq!(ev.session_id, 7); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:6976: // A VIEWER with a generous channel we CAN drain — to prove it stays fed. let (vsend, _vclient, _vrecv) = controller_socket_pair(); let (vtx, vrx) = sync_channel::(VIEWER_CHANNEL_DEPTH); - log.viewers - .insert( - 0, - ViewerSink { - tx: vtx, - send: vsend, - evicted: Arc::new(AtomicBool::new(false)), - _writer: thread::spawn(|| {}), - }, - ); + log.viewers.insert( + 0, + ViewerSink { + tx: vtx, + send: vsend, + evicted: Arc::new(AtomicBool::new(false)), + _writer: thread::spawn(|| {}), + }, + ); // Append 50 chunks. The controller channel (depth 2) fills after 2; every // further append DROPS (returns None — within the deadline, never evict) and Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7030: fn contiguous_advance_freezes_on_a_gap() { let dt = AtomicU64::new(0); contiguous_advance(&dt, 0); - assert_eq!(dt.load(Ordering::Acquire), 1, "seq 0 (== cursor) advances to 1"); + assert_eq!( + dt.load(Ordering::Acquire), + 1, + "seq 0 (== cursor) advances to 1" + ); contiguous_advance(&dt, 1); - assert_eq!(dt.load(Ordering::Acquire), 2, "contiguous seq 1 advances to 2"); + assert_eq!( + dt.load(Ordering::Acquire), + 2, + "contiguous seq 1 advances to 2" + ); // GAP: cursor is 2 but seq 5 arrives (3,4 dropped while Full). FREEZE at 2 — // a high-watermark jump to 6 would skip 3,4 on resume = a B2 violation. contiguous_advance(&dt, 5); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7043: ); // Re-delivering the frozen seq (2, via ring replay) resumes contiguous advance. contiguous_advance(&dt, 2); - assert_eq!(dt.load(Ordering::Acquire), 3, "re-delivering the frozen seq resumes"); + assert_eq!( + dt.load(Ordering::Acquire), + 3, + "re-delivering the frozen seq resumes" + ); // A rewind re-send (seq < cursor) is a no-op. contiguous_advance(&dt, 0); - assert_eq!(dt.load(Ordering::Acquire), 3, "a rewind re-send cannot lower the cursor"); + assert_eq!( + dt.load(Ordering::Acquire), + 3, + "a rewind re-send cannot lower the cursor" + ); } /// W1 — `advance_delivered` moves the shared cursor monotonically (D4-1) via Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7124: // interleaved with single keystrokes. let inputs: Vec> = vec![ b"first".to_vec(), - b"\x03".to_vec(), // Ctrl-C + b"\x03".to_vec(), // Ctrl-C b"PASTE-BLOCK-AAAA".to_vec(), b"z".to_vec(), - b"\r".to_vec(), // Enter + b"\r".to_vec(), // Enter b"PASTE-BLOCK-BBBB".to_vec(), b"last".to_vec(), ]; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7134: for rec in &inputs { - assert!(w.enqueue(rec.clone()), "depth 256: every enqueue is accepted"); + assert!( + w.enqueue(rec.clone()), + "depth 256: every enqueue is accepted" + ); } // Close the FIFO so the drain loop terminates, then drain through the SOLE // writer exactly as `input_writer` does. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7169: // The first DEPTH enqueues fit (accepted, no backpressure yet). for i in 0..DEPTH { - assert!(w.enqueue(vec![i as u8]), "enqueue {i} fits within the bound"); + assert!( + w.enqueue(vec![i as u8]), + "enqueue {i} fits within the bound" + ); } assert!( !w.backpressure.load(Ordering::Acquire), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7189: ); // A second overflow while still saturated stays dropped + backpressured (the // stamp is rising-edge-only, but the STATE remains true — no flap to false). - assert!(!w.enqueue(b"OVERFLOW-2".to_vec()), "still dropping while full"); assert!( + !w.enqueue(b"OVERFLOW-2".to_vec()), + "still dropping while full" + ); + assert!( w.backpressure.load(Ordering::Acquire), "backpressure stays asserted while the queue remains saturated" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7227: panic!("poison the inject floor"); }) .join(); - assert!(floor.is_poisoned(), "precondition: the floor mutex is poisoned"); + assert!( + floor.is_poisoned(), + "precondition: the floor mutex is poisoned" + ); // The fix: the recovered guard is fully usable — open() takes, is_held reads. lock_floor(&floor).open(); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7254: panic!("poison the sessions map mid-attach"); }) .join(); - assert!(sessions.is_poisoned(), "precondition: the sessions mutex is poisoned"); + assert!( + sessions.is_poisoned(), + "precondition: the sessions mutex is poisoned" + ); // The fix: the recovered guard is fully usable — the prior row survives and a // NEW attach can still insert/look up (no permanent wedge). - assert_eq!(recover(&sessions).get(&7).copied(), Some(70), "prior state survives recovery"); + assert_eq!( + recover(&sessions).get(&7).copied(), + Some(70), + "prior state survives recovery" + ); recover(&sessions).insert(9, 90); - assert_eq!(recover(&sessions).get(&9).copied(), Some(90), "the next attach still opens"); + assert_eq!( + recover(&sessions).get(&9).copied(), + Some(90), + "the next attach still opens" + ); } /// The physical screen a FRESH client terminal shows after applying the log's Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7306: log.commit_resize(4, 10); let screen = repaint_screen(&log); - assert_eq!(log.grid.geometry(), (4, 10), "the grid lands on the new geometry"); + assert_eq!( + log.grid.geometry(), + (4, 10), + "the grid lands on the new geometry" + ); assert_eq!(log.size, (4, 10), "the stored letterbox size follows"); - assert_eq!(log.geometry_epoch, 1, "a committed resize opens a new epoch"); assert_eq!( + log.geometry_epoch, 1, + "a committed resize opens a new epoch" + ); + assert_eq!( screen[0], "ABCDEFGHIJ", "the old-geometry row is TRUNCATED by the resize, never re-wrapped" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7316: assert_eq!(screen[1], "", "…so nothing wrapped onto row 2"); - assert_eq!(screen[2], "0123456789", "the new-geometry write wraps at 10"); - assert_eq!(screen[3], "ABCDE", "…and its tail is on row 4, not truncated away"); + assert_eq!( + screen[2], "0123456789", + "the new-geometry write wraps at 10" + ); + assert_eq!( + screen[3], "ABCDE", + "…and its tail is on row 4, not truncated away" + ); } // [unit->REQ-RC-RESIZE-GEOMETRY-EPOCH] The GROW direction, where the rejected Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7359: log.abort_resize(); // the surface refused the resize let screen = repaint_screen(&log); - assert_eq!(log.grid.geometry(), (3, 20), "the grid stays at the old geometry"); - assert_eq!(log.size, (3, 20), "the stored size is not advanced by a refusal"); + assert_eq!( + log.grid.geometry(), + (3, 20), + "the grid stays at the old geometry" + ); + assert_eq!( + log.size, + (3, 20), + "the stored size is not advanced by a refusal" + ); assert_eq!(log.geometry_epoch, 0, "a refused resize opens NO epoch"); - assert_eq!(screen[0], "ABCDEFGHIJKLMNO", "held output replayed at the old width"); - assert_eq!(screen[1], "XY", "post-issue bytes belong to the old geometry too"); + assert_eq!( + screen[0], "ABCDEFGHIJKLMNO", + "held output replayed at the old width" + ); + assert_eq!( + screen[1], "XY", + "post-issue bytes belong to the old geometry too" + ); } // [unit->REQ-RC-RESIZE-GEOMETRY-EPOCH] The barrier is single-occupancy: a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7381: ); log.mark_resize_issued(); log.commit_resize(3, 10); - assert!(log.begin_resize(3, 14).is_ok(), "the barrier reopens after the commit"); + assert!( + log.begin_resize(3, 14).is_ok(), + "the barrier reopens after the commit" + ); } /// Poll the shared `delivered_through` cursor until it reaches `want` (the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7476: baselines the watermark jump instead of reject-gapping it" ); let bytes = decode_bytes(&ev.data_b64).unwrap(); - assert!(bytes.starts_with(b"\x1b[?1049"), "synthesized repaint, not raw"); + assert!( + bytes.starts_with(b"\x1b[?1049"), + "synthesized repaint, not raw" + ); // LEG 3: one successful sync write advances the cursor-of-record past the // WHOLE suppressed range as-if-written. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7571: let mut log = floor_rig(); let (send2, mut client2, _recv2) = controller_socket_pair(); let resume_from = log.delivered_through.load(Ordering::Acquire); - assert_eq!(resume_from, 1, "precondition: the detached cursor is below the floor"); + assert_eq!( + resume_from, 1, + "precondition: the detached cursor is below the floor" + ); log.become_controller(Arc::clone(&send2), None, resume_from, 0); let f = read_frame(&mut client2).expect("the resume initial frame"); let ev: crate::msg::OutputEvent = serde_json::from_value(f.payload).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7578: - assert_eq!(ev.seq, 2, "the repaint rides the watermark pseudo-seq (next_seq - 1)"); + assert_eq!( + ev.seq, 2, + "the repaint rides the watermark pseudo-seq (next_seq - 1)" + ); assert!(ev.sync, "the below-floor repaint batch rides the wire flag"); let bytes = decode_bytes(&ev.data_b64).unwrap(); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7589: assert!(log.append(b"live-after-resume").is_none()); // seq 3 let f = read_frame(&mut client2).expect("the live frame after the repaint"); let ev: crate::msg::OutputEvent = serde_json::from_value(f.payload).unwrap(); - assert_eq!(ev.seq, 3, "live frames stream raw + in-order after the repaint"); + assert_eq!( + ev.seq, 3, + "live frames stream raw + in-order after the repaint" + ); log.clear_controller(); drop(log); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7607: let f = read_frame(&mut client2).expect("the at-floor resume frame"); let ev: crate::msg::OutputEvent = serde_json::from_value(f.payload).unwrap(); assert_eq!(ev.seq, 3); - assert!(!ev.sync, "a raw ring slice is UNFLAGGED — strict B2 semantics untouched"); + assert!( + !ev.sync, + "a raw ring slice is UNFLAGGED — strict B2 semantics untouched" + ); assert_eq!( decode_bytes(&ev.data_b64).unwrap(), b"after-commit-raw", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7631: assert_eq!(f.kind, crate::msg::KIND_SIZE); let f = read_frame(&mut view_client).expect("viewer initial frame"); let ev: crate::msg::OutputEvent = serde_json::from_value(f.payload).unwrap(); - assert_eq!(ev.seq, 2, "below-floor viewer gets the repaint at the pseudo-seq"); + assert_eq!( + ev.seq, 2, + "below-floor viewer gets the repaint at the pseudo-seq" + ); assert!( - decode_bytes(&ev.data_b64).unwrap().starts_with(b"\x1b[?1049"), + decode_bytes(&ev.data_b64) + .unwrap() + .starts_with(b"\x1b[?1049"), "the synthesized repaint, not raw suppressed ring bytes" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7679: let ev: crate::msg::OutputEvent = serde_json::from_value(f.payload).unwrap(); let bytes = decode_bytes(&ev.data_b64).unwrap(); let s = String::from_utf8_lossy(&bytes); - assert!(s.contains("\x1b]2;mid-window-title\x07"), "title change surfaces: {s:?}"); - assert!(s.contains("\x1b[?25l"), "cursor-visibility toggle surfaces: {s:?}"); + assert!( + s.contains("\x1b]2;mid-window-title\x07"), + "title change surfaces: {s:?}" + ); + assert!( + s.contains("\x1b[?25l"), + "cursor-visibility toggle surfaces: {s:?}" + ); // A CROSS-geometry commit resets the scroll region (grid resize // semantics, matching the client terminal's own reset on the letterbox // move) — the region CONTRACT still surfaces, as the explicit reset. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7687: - assert!(s.contains("\x1b[r"), "the region contract surfaces explicitly: {s:?}"); - assert!(s.contains("\x1b[?1049h"), "alt-screen switch surfaces: {s:?}"); - assert!(s.contains("ALT"), "window content surfaces at the target geometry: {s:?}"); + assert!( + s.contains("\x1b[r"), + "the region contract surfaces explicitly: {s:?}" + ); + assert!( + s.contains("\x1b[?1049h"), + "alt-screen switch surfaces: {s:?}" + ); + assert!( + s.contains("ALT"), + "window content surfaces at the target geometry: {s:?}" + ); drop(log); // A SAME-geometry transition (a SIGWINCH re-assert: begin/commit at the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7698: log.add_viewer(Arc::clone(&view_send), 0); let _ = read_frame(&mut view_client).expect("initial size"); let _ = read_frame(&mut view_client).expect("initial repaint"); - log.begin_resize(4, 20).expect("same-geometry barrier closes"); + log.begin_resize(4, 20) + .expect("same-geometry barrier closes"); assert!(log.append(b"\x1b[1;3r").is_none()); log.mark_resize_issued(); log.commit_resize(4, 20); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7748: "the deferred toggles flush INSIDE the sync frame, after the repaint, \ in emission order: {s:?}" ); - assert!(!s.contains("\x1b]8;"), "the hyperlink pair drops balanced: {s:?}"); - assert!(s.contains("LINK"), "the link TEXT still renders via the repaint: {s:?}"); + assert!( + !s.contains("\x1b]8;"), + "the hyperlink pair drops balanced: {s:?}" + ); + assert!( + s.contains("LINK"), + "the link TEXT still renders via the repaint: {s:?}" + ); drop(log); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7831: log.mark_resize_issued(); log.abort_resize(); // the surface refused the resize - assert_eq!(log.grid.geometry(), (3, 20), "abort: grid stays at the old geometry"); + assert_eq!( + log.grid.geometry(), + (3, 20), + "abort: grid stays at the old geometry" + ); assert_eq!(log.size, (3, 20), "abort: stored size untouched"); // Viewer: the FIRST post-abort frame is the sync frame — no `size` frame Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7877: std::env::set_var("SPT_HOME", home.path()); let perch = resolve_perch_path("reaped", ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = spt_store::info::InfoJson::new( - "reaped", - "t", - std::process::id(), - "sid", - "live_agent", - ); + let mut rec = + spt_store::info::InfoJson::new("reaped", "t", std::process::id(), "sid", "live_agent"); rec.controllable = Some(true); spt_store::info::write_info(&perch, &rec).unwrap(); spt_store::info::set_driven_by(&perch, Some("node")).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7892: OutputLog::new(1, DEFAULT_LOG_CHUNKS, "reaped".to_string(), (24, 80)).stamp_reaped(); let after = spt_store::info::read_info(&perch).unwrap(); - assert!(!after.controlled, "control stamps never outlive their session"); + assert!( + !after.controlled, + "control stamps never outlive their session" + ); assert_eq!(after.driven_by, None); assert_eq!( after.controllable, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7922: torn.append(b"x"); // next_seq now 1, ring=[(0,x)] torn.ring.push_back((999, b"garbage".to_vec())); // back(999) >= next_seq(1) → torn let next_before = torn.next_seq; - assert!(torn.clamp_or_reset(), "a torn ring (last seq >= next_seq) is reset"); - assert!(torn.ring.is_empty(), "the torn ring is emptied — no garbage served"); - assert_eq!(torn.next_seq, next_before, "next_seq is preserved (cursors never rewind)"); + assert!( + torn.clamp_or_reset(), + "a torn ring (last seq >= next_seq) is reset" + ); + assert!( + torn.ring.is_empty(), + "the torn ring is emptied — no garbage served" + ); + assert_eq!( + torn.next_seq, next_before, + "next_seq is preserved (cursors never rewind)" + ); // Torn: over-cap ring (an interrupted prune). let mut over = OutputLog::new(3, 2, String::new(), (24, 80)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7954: .join(); assert!(log.is_poisoned(), "precondition: the log mutex is poisoned"); let g = recover_log(&log); - assert!(g.ring.is_empty(), "recover_log clamps the torn ring to empty on recovery"); - assert_eq!(g.next_seq, 1, "next_seq preserved through the poison-recover clamp"); + assert!( + g.ring.is_empty(), + "recover_log clamps the torn ring to empty on recovery" + ); + assert_eq!( + g.next_seq, 1, + "next_seq preserved through the poison-recover clamp" + ); } // [unit->REQ-TRANSLATE-COMMIT-MISS-TOLERANCE] C-1 respool-once / dead-letter: a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:7972: assert_eq!(note_miss_respool(&mut set, "env-A"), MissRespool::Respool); assert!(set.contains("env-A")); // Second miss of the SAME envelope → dead-letter, NOT respooled again. - assert_eq!(note_miss_respool(&mut set, "env-A"), MissRespool::DeadLetter); + assert_eq!( + note_miss_respool(&mut set, "env-A"), + MissRespool::DeadLetter + ); // A DIFFERENT envelope respools once on its own. assert_eq!(note_miss_respool(&mut set, "env-B"), MissRespool::Respool); - assert_eq!(note_miss_respool(&mut set, "env-B"), MissRespool::DeadLetter); + assert_eq!( + note_miss_respool(&mut set, "env-B"), + MissRespool::DeadLetter + ); // A committed envelope is forgotten → a later miss respools it afresh. set.remove("env-A"); assert_eq!(note_miss_respool(&mut set, "env-A"), MissRespool::Respool); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8006: let payload = b"XLATE_OK line one\nline two\nline three"; // Full echo present → verified. let full_echo = b"prompt> XLATE_OK line one\nline two\nline three\n"; - assert!(echo_verified(payload, full_echo), "a fully-echoed head verifies"); + assert!( + echo_verified(payload, full_echo), + "a fully-echoed head verifies" + ); // Head swallowed: only a suffix echoed (the field bug — mid-word start). The // leading prefix is ABSENT → verify MISS. let tail_only = b"three\r\n"; // the ~322B suffix class, head gone Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8015: "a swallowed head (prefix absent from echo) fails verify — the head-loss tell" ); // A keys-only sequence types no echoable text → vacuously verified. - assert!(echo_verified(b"", b""), "empty payload is vacuously verified"); - assert!(echo_verified(b"", b"noise"), "empty payload verifies regardless of echo"); + assert!( + echo_verified(b"", b""), + "empty payload is vacuously verified" + ); + assert!( + echo_verified(b"", b"noise"), + "empty payload verifies regardless of echo" + ); // A short payload (below the prefix window) matches on its whole self. - assert!(echo_verified(b"hi", b"...hi..."), "a short payload matches whole"); - assert!(!echo_verified(b"hi", b"...ho..."), "a short payload absent → miss"); + assert!( + echo_verified(b"hi", b"...hi..."), + "a short payload matches whole" + ); + assert!( + !echo_verified(b"hi", b"...ho..."), + "a short payload absent → miss" + ); } // [unit->REQ-INJECT-MULTILINE-INTEGRITY] Layer 1 re-arm: the settle-gate must re-run Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8034: fn should_settle_rearms_on_observable_pty() { // Echoing/interactive PTY (probe observed → not unobservable): re-settle EVERY // delivery's first byte — this is the class the `/clear` head-swallow bites. - assert!(should_settle(1, false), "observable PTY re-settles before each delivery"); + assert!( + should_settle(1, false), + "observable PTY re-settles before each delivery" + ); // Non-echoing ConPTY (probe unobservable, latched): skip the steady-state settle — // no reader-reattach race, and settling would burn the full deadline every time. - assert!(!should_settle(1, true), "unobservable-probe PTY skips the steady-state settle"); + assert!( + !should_settle(1, true), + "unobservable-probe PTY skips the steady-state settle" + ); // A RE-DRIVE always settles regardless of the latch (only reached on a swallowed // head → readiness must be re-confirmed before retyping). - assert!(should_settle(2, true), "a re-drive settles even when the probe is unobservable"); - assert!(should_settle(2, false), "a re-drive settles on an observable PTY too"); + assert!( + should_settle(2, true), + "a re-drive settles even when the probe is unobservable" + ); + assert!( + should_settle(2, false), + "a re-drive settles on an observable PTY too" + ); } // [unit->REQ-INJECT-MULTILINE-INTEGRITY] the subslice search the head match rides: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8052: assert!(contains_subslice(b"abcdef", b"cde")); assert!(contains_subslice(b"abcdef", b"abc")); assert!(contains_subslice(b"abcdef", b"def")); - assert!(!contains_subslice(b"abcdef", b"ce"), "non-contiguous is not a subslice"); - assert!(contains_subslice(b"abc", b""), "empty needle is vacuously present"); - assert!(!contains_subslice(b"ab", b"abc"), "needle longer than haystack is absent"); + assert!( + !contains_subslice(b"abcdef", b"ce"), + "non-contiguous is not a subslice" + ); + assert!( + contains_subslice(b"abc", b""), + "empty needle is vacuously present" + ); + assert!( + !contains_subslice(b"ab", b"abc"), + "needle longer than haystack is absent" + ); } // [unit->REQ-INJECT-MULTILINE-INTEGRITY] the output-log tap the settle-gate + Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8092: // Small: whole, single emit. let mut parts: Vec> = Vec::new(); chunk_text(b"small", 256, |p| parts.push(p.to_vec())); - assert_eq!(parts, vec![b"small".to_vec()], "a small payload is one whole write"); + assert_eq!( + parts, + vec![b"small".to_vec()], + "a small payload is one whole write" + ); // Large: split into ceil(len/chunk) ordered parts, reassembling exactly. let payload: Vec = (0..1000u16).map(|i| (i % 251) as u8).collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8099: let chunk = 256; let mut got: Vec> = Vec::new(); chunk_text(&payload, chunk, |p| got.push(p.to_vec())); - assert_eq!(got.len(), 1000_usize.div_ceil(chunk), "ceil(len/chunk) parts"); - assert!(got.iter().take(got.len() - 1).all(|p| p.len() == chunk), "all but last are full"); + assert_eq!( + got.len(), + 1000_usize.div_ceil(chunk), + "ceil(len/chunk) parts" + ); + assert!( + got.iter().take(got.len() - 1).all(|p| p.len() == chunk), + "all but last are full" + ); let reassembled: Vec = got.concat(); - assert_eq!(reassembled, payload, "in-order reassembly is byte-identical — no head/tail loss"); + assert_eq!( + reassembled, payload, + "in-order reassembly is byte-identical — no head/tail loss" + ); } // [unit->REQ-HAZARD-INJECT-WORKER-POISON] B6 leg (ii): a PANIC inside the inject Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8401: let mut log = OutputLog::new(1, DEFAULT_LOG_CHUNKS, String::new(), (24, 80)); // Establish: conn A holds the lease at generation 500. - let (out, decision) = - log.resolve_subscribe_inner(Arc::clone(&a), 0, AttachIntent::Control, Some("op".into()), 500); + let (out, decision) = log.resolve_subscribe_inner( + Arc::clone(&a), + 0, + AttachIntent::Control, + Some("op".into()), + 500, + ); assert!(matches!(out, SubscribeOutcome::Controller), "got {out:?}"); assert_eq!(decision, "controller"); let epoch_after_establish = log.controller_epoch.load(Ordering::Acquire); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8411: // replayed. The seat is untouched: same sink, same generation, and the // controller EPOCH does not move (a bump is what stops the live writer // mid-batch, so an unchanged epoch IS "the writer was never disturbed"). - let (out, decision) = - log.resolve_subscribe_inner(Arc::clone(&a), 0, AttachIntent::Control, Some("op".into()), 500); - assert!(matches!(out, SubscribeOutcome::Controller), "the wire answer stays Controller (N-1 tolerant), got {out:?}"); - assert_eq!(decision, "idempotent", "the breadcrumb distinguishes reuse from replacement"); - let seat = log.controller.as_ref().expect("the seat survives its own replay"); - assert!(Arc::ptr_eq(&seat.send, &a), "the SAME sink is preserved — not a fresh one over a dropped writer"); + let (out, decision) = log.resolve_subscribe_inner( + Arc::clone(&a), + 0, + AttachIntent::Control, + Some("op".into()), + 500, + ); + assert!( + matches!(out, SubscribeOutcome::Controller), + "the wire answer stays Controller (N-1 tolerant), got {out:?}" + ); + assert_eq!( + decision, "idempotent", + "the breadcrumb distinguishes reuse from replacement" + ); + let seat = log + .controller + .as_ref() + .expect("the seat survives its own replay"); + assert!( + Arc::ptr_eq(&seat.send, &a), + "the SAME sink is preserved — not a fresh one over a dropped writer" + ); assert_eq!(seat.attach_gen, 500); assert_eq!( log.controller_epoch.load(Ordering::Acquire), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8426: // CELL 2 — a DIFFERENT conn at the same generation is the fix-6 successor: // today's silent swap must NOT regress into idempotence. - let (out, decision) = - log.resolve_subscribe_inner(Arc::clone(&b), 0, AttachIntent::Control, Some("op".into()), 500); + let (out, decision) = log.resolve_subscribe_inner( + Arc::clone(&b), + 0, + AttachIntent::Control, + Some("op".into()), + 500, + ); assert!(matches!(out, SubscribeOutcome::Controller), "got {out:?}"); - assert_eq!(decision, "controller", "a different carrier is a re-serve, not a replay"); + assert_eq!( + decision, "controller", + "a different carrier is a re-serve, not a replay" + ); assert!( Arc::ptr_eq(&log.controller.as_ref().unwrap().send, &b), "the successor conn takes the seat (ADR-0038 fix 6)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8436: ); // CELL 3 — strictly newer generation still supersedes loudly... - let (out, decision) = - log.resolve_subscribe_inner(Arc::clone(&a), 0, AttachIntent::Take, Some("op".into()), 900); + let (out, decision) = log.resolve_subscribe_inner( + Arc::clone(&a), + 0, + AttachIntent::Take, + Some("op".into()), + 900, + ); assert!(matches!(out, SubscribeOutcome::TookControl), "got {out:?}"); assert_eq!(decision, "took"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8444: // CELL 4 — ...and strictly older is still refused busy. - let (out, decision) = - log.resolve_subscribe_inner(Arc::clone(&b), 0, AttachIntent::Control, Some("op".into()), 500); - assert!(matches!(out, SubscribeOutcome::BusyControlled { .. }), "got {out:?}"); + let (out, decision) = log.resolve_subscribe_inner( + Arc::clone(&b), + 0, + AttachIntent::Control, + Some("op".into()), + 500, + ); + assert!( + matches!(out, SubscribeOutcome::BusyControlled { .. }), + "got {out:?}" + ); assert_eq!(decision, "busy"); log.clear_controller(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8495: 12, "and the seat records the floor it was re-established from" ); - assert_eq!(log.controller.as_ref().unwrap().attach_gen, 700, "the generation is preserved (fix 6)"); + assert_eq!( + log.controller.as_ref().unwrap().attach_gen, + 700, + "the generation is preserved (fix 6)" + ); log.clear_controller(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8539: }; assert_eq!(by, "op"); let c = log.controller.as_ref().expect("incumbent survives"); - assert!(Arc::ptr_eq(&c.send, &live), "the newer controller keeps the slot"); + assert!( + Arc::ptr_eq(&c.send, &live), + "the newer controller keeps the slot" + ); assert_eq!(c.attach_gen, 200); // EQUAL generation = the same Request reconstructed (dispatcher Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8563: Some("op".into()), 0, ); - assert!(matches!(out, SubscribeOutcome::Controller), "legacy gen 0 re-takes, got {out:?}"); + assert!( + matches!(out, SubscribeOutcome::Controller), + "legacy gen 0 re-takes, got {out:?}" + ); log.clear_controller(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8606: Some("op".into()), 200, ); - assert!(matches!(out, SubscribeOutcome::Controller), "resume re-takes, got {out:?}"); + assert!( + matches!(out, SubscribeOutcome::Controller), + "resume re-takes, got {out:?}" + ); assert_eq!( log.controller.as_ref().unwrap().attach_gen, 200, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8663: // The matching generation releases normally. log.detach_if_gen(&send, Some(200)); - assert!(log.controller.is_none(), "the owning generation's release clears"); + assert!( + log.controller.is_none(), + "the owning generation's release clears" + ); // None (N-1 / conn cleanup) keeps ptr-identity behavior. log.become_controller(Arc::clone(&send), Some("op".into()), 0, 300); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8670: log.detach_if_gen(&send, None); - assert!(log.controller.is_none(), "gen-less detach keeps the legacy ptr clear"); + assert!( + log.controller.is_none(), + "gen-less detach keeps the legacy ptr clear" + ); } /// #6 CORE (REQ-BROKER-SCREEN-GRID, ADR-0031), the integrated broker seam: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8704: // The initial batch is ONE output frame carrying the synthesized repaint. let frame = read_frame(&mut client).expect("a repaint frame on attach"); - assert_eq!(frame.kind, crate::msg::KIND_OUTPUT, "the initial batch is an output frame"); + assert_eq!( + frame.kind, + crate::msg::KIND_OUTPUT, + "the initial batch is an output frame" + ); let ev: crate::msg::OutputEvent = serde_json::from_value(frame.payload).expect("output payload"); let repaint = decode_bytes(&ev.data_b64).expect("repaint b64 decodes"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8780: let mut auth = avt::Vt::new(cols as usize, rows as usize); auth.feed_str(std::str::from_utf8(frame1).unwrap()); auth.feed_str(std::str::from_utf8(frame2).unwrap()); - let auth: Vec = auth.view().map(|l| l.text().trim_end().to_string()).collect(); + let auth: Vec = auth + .view() + .map(|l| l.text().trim_end().to_string()) + .collect(); // Candidate: what the attaching client's terminal actually shows. let mut seen = avt::Vt::new(cols as usize, rows as usize); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8787: seen.feed_str(std::str::from_utf8(&repaint).unwrap()); seen.feed_str(std::str::from_utf8(&diff).unwrap()); - let seen: Vec = seen.view().map(|l| l.text().trim_end().to_string()).collect(); + let seen: Vec = seen + .view() + .map(|l| l.text().trim_end().to_string()) + .collect(); assert_eq!( seen, auth, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8823: } thread::sleep(Duration::from_millis(1)); } - assert!(writer.is_finished(), "precondition: the writer thread has exited"); + assert!( + writer.is_finished(), + "precondition: the writer thread has exited" + ); log.controller = Some(ControllerSink { attach_gen: 0, establish_from_seq: 0, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8840: Some("remote-node"), "precondition: a stale remote controller is present" ); - assert!(log.reap_dead_controller(), "a dead-writer controller is reaped"); + assert!( + log.reap_dead_controller(), + "a dead-writer controller is reaped" + ); assert!(!log.has_controller(), "the controller slot is cleared"); assert_eq!( log.controller_by(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8847: None, "controller_by is now honest (None) → converge_perch_stamps clears the stamp" ); - assert!(!log.reap_dead_controller(), "idempotent: nothing left to reap"); + assert!( + !log.reap_dead_controller(), + "idempotent: nothing left to reap" + ); } // [unit->REQ-DRIVEN-BY-OWN-NODE-NORMALIZE] own-node latch is TRUTHFUL (doyle Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:8881: Some(own_hex.as_str()), "an own-node controller latches driven_by to its own hex (CONTEXT:386)" ); - assert!(after.controlled, "controlled stays true (any-controller truth)"); + assert!( + after.controlled, + "controlled stays true (any-controller truth)" + ); log.clear_controller(); // A remote hex latches identically. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:9063: let before = STALL_EVICT_COUNT.load(Ordering::Relaxed); let (nsend, _nc, _nr) = controller_socket_pair(); - let outcome = - log.resolve_subscribe(nsend, 0, AttachIntent::Control, Some("newcomer".to_string()), 0); + let outcome = log.resolve_subscribe( + nsend, + 0, + AttachIntent::Control, + Some("newcomer".to_string()), + 0, + ); assert_eq!( outcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:9093: "a blocked-past-deadline writer is reaped though it has not exited" ); assert!(!log.has_controller(), "the controller slot is cleared"); - assert_eq!(log.controller_by(), None, "driven_by truth is now honest (None)"); + assert_eq!( + log.controller_by(), + None, + "driven_by truth is now honest (None)" + ); } /// W3a endpoint selection (REQ-ADAPTER-LIVE-UPDATE, ADR-0025): from the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:9117: // sort+dedup, not just incidental ordering. let rows = vec![ // ep-b matches (sorts AFTER ep-a despite appearing first). - ("ep-b".to_string(), "claude-spt".to_string(), Some(dir_b.clone())), + ( + "ep-b".to_string(), + "claude-spt".to_string(), + Some(dir_b.clone()), + ), // ep-a, two sessions, SAME endpoint+dir → must dedup to one entry. - ("ep-a".to_string(), "claude-spt".to_string(), Some(dir_a.clone())), - ("ep-a".to_string(), "claude-spt".to_string(), Some(dir_a.clone())), + ( + "ep-a".to_string(), + "claude-spt".to_string(), + Some(dir_a.clone()), + ), + ( + "ep-a".to_string(), + "claude-spt".to_string(), + Some(dir_a.clone()), + ), // Non-matching adapter → excluded entirely. - ("ep-c".to_string(), "codex-spt".to_string(), Some(PathBuf::from("/install/ep-c"))), + ( + "ep-c".to_string(), + "codex-spt".to_string(), + Some(PathBuf::from("/install/ep-c")), + ), // Matching adapter but NO install_dir → excluded (nothing to swap). ("ep-d".to_string(), "claude-spt".to_string(), None), // PROFILE-COMPOSITE row (F015B): a `--adapter claude-spt:ccs` endpoint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\broker.rs:9129: // stores the composite `claude-spt:ccs`, but the update carries the // PARENT record name `claude-spt` — it MUST match on the parent (an // exact-match skew is the silent-no-op bug). - ("ep-e".to_string(), "claude-spt:ccs".to_string(), Some(dir_e.clone())), + ( + "ep-e".to_string(), + "claude-spt:ccs".to_string(), + Some(dir_e.clone()), + ), ]; let got = select_endpoints_running_adapter(rows, "claude-spt"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\config.rs:626: cwd: Some("/srv".to_string()), }) .unwrap(); - assert!(replaced, "a re-save of the same id replaces the prior entry"); + assert!( + replaced, + "a re-save of the same id replaces the prior entry" + ); let cfg = DaemonConfig::load(); assert_eq!(cfg.startup_endpoints.len(), 1, "replace, not append"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\config.rs:633: assert_eq!(cfg.startup_endpoints[0].adapter, "cc:gateway"); assert_eq!(cfg.startup_endpoints[0].cwd.as_deref(), Some("/srv")); - assert_eq!(cfg.pulse_period, Duration::from_millis(1234), "knob still intact"); + assert_eq!( + cfg.pulse_period, + Duration::from_millis(1234), + "knob still intact" + ); // A second distinct id → appended alongside, returns false. let replaced = DaemonConfig::upsert_startup_endpoint(StartupEndpoint { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\config.rs:644: assert!(!replaced); let cfg = DaemonConfig::load(); assert_eq!(cfg.startup_endpoints.len(), 2); - let ids: Vec<&str> = cfg.startup_endpoints.iter().map(|e| e.id.as_str()).collect(); + let ids: Vec<&str> = cfg + .startup_endpoints + .iter() + .map(|e| e.id.as_str()) + .collect(); assert!(ids.contains(&"gw") && ids.contains(&"worker")); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\conn.rs:222: // [impl->REQ-CONN-POISON-ATTRIBUTION] fn attribution(&self) -> String { let label = recover(&self.label); - let facts: &str = if label.is_empty() { "role=unattributed" } else { &label }; + let facts: &str = if label.is_empty() { + "role=unattributed" + } else { + &label + }; format!("conn={} {} {}", self.id, facts, log_stamp()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\conn.rs:351: if let Some(armed) = d.inflight { break armed; } - d = self - .dog_cv - .wait(d) - .unwrap_or_else(|p| p.into_inner()); + d = self.dog_cv.wait(d).unwrap_or_else(|p| p.into_inner()); }; // Sleep toward the deadline while THIS op stays in flight. let fired = loop { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\conn.rs:698: let client = LocalSocketTransport::connect(&name).expect("connect"); let server = listener.accept().expect("accept"); let (_recv, send) = server.split(); - ( - BrokerConn::new(send, Duration::from_millis(2000)), - client, - ) + (BrokerConn::new(send, Duration::from_millis(2000)), client) } // [unit->REQ-CONN-POISON-DIAL-SCOPE] the F-039 leg-(a) token split: the loud Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\conn.rs:722: poisoned.starts_with("CONN_WRITE_POISONED:"), "deadline class keeps the loud wedge-observable token: {poisoned}" ); - let retired = conn - .inner - .render_retirement(false, Some(&io::Error::new(io::ErrorKind::BrokenPipe, "peer gone"))); + let retired = conn.inner.render_retirement( + false, + Some(&io::Error::new(io::ErrorKind::BrokenPipe, "peer gone")), + ); assert!( retired.starts_with("CONN_WRITE_RETIRED:"), "organic class emits the DISTINCT retired token: {retired}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\crc_swap.rs:367: let plan = plan_crc_swap(s, i).unwrap(); let want_rel: PathBuf = ["sub", "dir", "x"].iter().collect(); - assert_eq!(rels(&plan), vec![want_rel.clone()], "nested changed file found"); + assert_eq!( + rels(&plan), + vec![want_rel.clone()], + "nested changed file found" + ); let only = &plan[0]; assert_eq!(only.staged, s.join(&want_rel)); assert_eq!(only.target, i.join(&want_rel)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\crc_swap.rs:392: // fresh under a nested parent that does NOT yet exist in install → created. let fresh_rel: PathBuf = ["newdir", "fresh"].iter().collect(); write(&s.join(&fresh_rel), b"FRESH"); - assert!(!i.join("newdir").exists(), "precondition: nested parent absent"); + assert!( + !i.join("newdir").exists(), + "precondition: nested parent absent" + ); let plan = plan_crc_swap(s, i).unwrap(); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\crc_swap.rs:403: apply_crc_swap(&plan).unwrap(); - assert_eq!(fs::read(i.join("changed")).unwrap(), b"NEW", "changed got new bytes"); assert_eq!( + fs::read(i.join("changed")).unwrap(), + b"NEW", + "changed got new bytes" + ); + assert_eq!( fs::read(i.join(&fresh_rel)).unwrap(), b"FRESH", "fresh file materialized with its nested parent dir created" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\crc_swap.rs:479: let result = apply_crc_swap_with(&plan, &rename); - assert!(result.is_err(), "the injected mid-loop commit failure propagates"); + assert!( + result.is_err(), + "the injected mid-loop commit failure propagates" + ); assert_eq!( fs::read(&first_target).unwrap(), b"BEFORE", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\crc_swap.rs:647: write(&s.join("bin"), b"V2"); let stranded_old = i.join("bin.old"); write(&stranded_old, b"LAST-GOOD-V1"); - assert!(!i.join("bin").exists(), "precondition: target missing (crashed pre-commit)"); + assert!( + !i.join("bin").exists(), + "precondition: target missing (crashed pre-commit)" + ); let plan = plan_crc_swap(s, i).unwrap(); apply_crc_swap(&plan).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\crc_swap.rs:692: let plan = plan_crc_swap(s, i).unwrap(); let err = apply_crc_swap_with(&plan, &rename).expect_err("the injected displace fails"); let msg = err.to_string(); - assert!(msg.contains("crc_swap displace original"), "names the op: {msg}"); + assert!( + msg.contains("crc_swap displace original"), + "names the op: {msg}" + ); assert!(msg.contains("bin"), "carries the paths: {msg}"); - assert!(msg.contains("bin.old"), "carries the displacement target: {msg}"); - assert_eq!(err.kind(), std::io::ErrorKind::PermissionDenied, "preserves kind"); + assert!( + msg.contains("bin.old"), + "carries the displacement target: {msg}" + ); + assert_eq!( + err.kind(), + std::io::ErrorKind::PermissionDenied, + "preserves kind" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:94: // --detached BELT (REQ-HAZARD-DETACHED-DAEMON-STDIO): the respawned // unelevated daemon then runs detach_console + the null-handles guard, // so it never keeps live inherited stdio (matches every other rung). - &["daemon".to_string(), "run".to_string(), "--detached".to_string()], + &[ + "daemon".to_string(), + "run".to_string(), + "--detached".to_string(), + ], ) { Ok(Some(pid)) => { eprintln!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:154: // marker-free rather than rendered. The `SUBNET_DETACHED:{name}` // token is the machine contract; the rest is a human hint. // [impl->REQ-CLI-OUTPUT-MARKDOWN] - eprintln!("SUBNET_DETACHED:{name} (startup default — run: spt subnet attach {name})"); + eprintln!( + "SUBNET_DETACHED:{name} (startup default — run: spt subnet attach {name})" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:194: thread::spawn(move || { let _ = serve_broker.serve(); }); - // Inbound net dispatch + outbound peer pump (D9-1) now run in - // the BRAIN child (restoration D2-1): they are pure IPC clients, - // so they live with the restartable brain and respawn with it. - // The broker keeps only the NetHost bring-up and the boot-race - // self-heal that binds it; the brain polls `net-status` and - // starts the consumers once net reports enabled. - // [impl->REQ-HAZARD-BROKER-PROCESS-ISOLATION] + // Inbound net dispatch + outbound peer pump (D9-1) now run in + // the BRAIN child (restoration D2-1): they are pure IPC clients, + // so they live with the restartable brain and respawn with it. + // The broker keeps only the NetHost bring-up and the boot-race + // self-heal that binds it; the brain polls `net-status` and + // starts the consumers once net reports enabled. + // [impl->REQ-HAZARD-BROKER-PROCESS-ISOLATION] if !net_up && node_hex.is_some() { // Boot-race self-heal (REQ-DAEMON-9): net failed to bind // but identity is sound — almost always the autostart Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:230: { let port = crate::docshost::resolve_docs_port( crate::config::DaemonConfig::load().docs_port, - std::env::var(crate::docshost::DOCS_PORT_ENV).ok().as_deref(), + std::env::var(crate::docshost::DOCS_PORT_ENV) + .ok() + .as_deref(), ); let docs_root = spt_store::perch::spt_home().join("docs"); match crate::docshost::start(docs_root, port) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:237: - Ok(bound) => eprintln!( - "DOCS_SERVER_UP: {}", - crate::docshost::docs_url(bound) - ), + Ok(bound) => { + eprintln!("DOCS_SERVER_UP: {}", crate::docshost::docs_url(bound)) + } Err(e) => eprintln!( "DOCS_SERVER_BIND_FAIL: port {port}: {e} — docs surface \ unavailable this run (daemon continues)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:488: return; } backoff = net_retry_backoff(backoff); - eprintln!("NET_BIND_RETRY: net still unavailable, retrying in {}s", backoff.as_secs()); + eprintln!( + "NET_BIND_RETRY: net still unavailable, retrying in {}s", + backoff.as_secs() + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:596: match ensure_decision(is_running(), spt_store::daemon_inhibit::stop_inhibited()) { EnsureOutcome::AlreadyRunning => return Ok(EnsureOutcome::AlreadyRunning), EnsureOutcome::DeclinedStopInhibited => { - eprintln!("DAEMON_START_DECLINED: {}", spt_store::daemon_inhibit::REFUSAL_LINE); + eprintln!( + "DAEMON_START_DECLINED: {}", + spt_store::daemon_inhibit::REFUSAL_LINE + ); return Ok(EnsureOutcome::DeclinedStopInhibited); } EnsureOutcome::Started => {} Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:616: match ensure_decision(is_running(), spt_store::daemon_inhibit::stop_inhibited()) { EnsureOutcome::AlreadyRunning => return Ok(EnsureOutcome::AlreadyRunning), EnsureOutcome::DeclinedStopInhibited => { - eprintln!("DAEMON_START_DECLINED: {}", spt_store::daemon_inhibit::REFUSAL_LINE); + eprintln!( + "DAEMON_START_DECLINED: {}", + spt_store::daemon_inhibit::REFUSAL_LINE + ); return Ok(EnsureOutcome::DeclinedStopInhibited); } EnsureOutcome::Started => {} Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:1110: let mut block = (!env.is_empty() || !env_remove.is_empty()).then(|| unicode_env_block(env, env_remove)); let (env_ptr, env_flag) = match block.as_mut() { - Some(b) => (b.as_mut_ptr() as *mut core::ffi::c_void, CREATE_UNICODE_ENVIRONMENT), + Some(b) => ( + b.as_mut_ptr() as *mut core::ffi::c_void, + CREATE_UNICODE_ENVIRONMENT, + ), None => (std::ptr::null_mut(), 0), }; let mut si_ex: StartupInfoExW = unsafe { std::mem::zeroed() }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:1885: let ps_literal = wmi_cmdline.replace('\'', "''"); let script = wmi_create_script(&ps_literal); // -EncodedCommand wants base64 of the UTF-16LE script bytes. - let utf16le: Vec = script.encode_utf16().flat_map(|u| u.to_le_bytes()).collect(); + let utf16le: Vec = script + .encode_utf16() + .flat_map(|u| u.to_le_bytes()) + .collect(); let encoded = B64.encode(&utf16le); const POWERSHELL_ABS: &str = r"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2042: }; let env = vec![("SPT_ENV_PROBE".to_string(), "7".to_string())]; - let mut child = detached_no_inherit_env(program, &probe, &env, &[], None).expect("spawn probe"); + let mut child = + detached_no_inherit_env(program, &probe, &env, &[], None).expect("spawn probe"); assert_eq!( child.wait_ms(30_000).expect("wait"), Some(7), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2049: "the addition never reached the child" ); - let mut child = detached_no_inherit_env(program, &inherited, &env, &[], None).expect("spawn probe"); + let mut child = + detached_no_inherit_env(program, &inherited, &env, &[], None).expect("spawn probe"); assert_eq!( child.wait_ms(30_000).expect("wait"), Some(5), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2081: } else { ( "sh", - vec!["-c".into(), format!("[ -n \"${PROBE}\" ] && exit 5; exit 0")], + vec![ + "-c".into(), + format!("[ -n \"${PROBE}\" ] && exit 5; exit 0"), + ], ) }; std::env::set_var(PROBE, "leaked"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2190: ("sh", vec!["-c".into(), "sleep 120 & wait".into()]) }; - let mut child = detached_no_inherit_env(program, &args, &[], &[], None).expect("spawn the parent"); + let mut child = + detached_no_inherit_env(program, &args, &[], &[], None).expect("spawn the parent"); // Find the grandchild by PARENTAGE rather than by anything it reports: // the process table is the same oracle the orphan sweep uses, and a // grandchild that has to cooperate to be found is a rig that cannot Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2281: fn the_refusal_line_names_the_remedy() { let line = spt_store::daemon_inhibit::REFUSAL_LINE; assert!(line.contains("stopped by operator"), "says WHY: {line}"); - assert!(line.contains("spt daemon start"), "names the remedy: {line}"); + assert!( + line.contains("spt daemon start"), + "names the remedy: {line}" + ); } // [unit->REQ-ENSURE-DAEMON-STOP-INHIBIT] intent verbs clear, non-intent paths Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2322: const FILE_TYPE_UNKNOWN: u32 = 0x0000; const FILE_TYPE_DISK: u32 = 0x0001; const FILE_TYPE_CHAR: u32 = 0x0002; - assert!(should_null_std_handles(FILE_TYPE_PIPE), "an undrained pipe blocks ⇒ null"); assert!( + should_null_std_handles(FILE_TYPE_PIPE), + "an undrained pipe blocks ⇒ null" + ); + assert!( !should_null_std_handles(FILE_TYPE_DISK), "a FILE redirect (2>run.log / the int-test brain-log) is disk ⇒ survives" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2343: #[test] fn net_retry_backoff_doubles_then_caps() { assert_eq!(net_retry_backoff(NET_RETRY_FIRST), Duration::from_secs(2)); - assert_eq!(net_retry_backoff(Duration::from_secs(2)), Duration::from_secs(4)); - assert_eq!(net_retry_backoff(Duration::from_secs(16)), Duration::from_secs(30)); - assert_eq!(net_retry_backoff(NET_RETRY_CAP), NET_RETRY_CAP, "stays capped"); + assert_eq!( + net_retry_backoff(Duration::from_secs(2)), + Duration::from_secs(4) + ); + assert_eq!( + net_retry_backoff(Duration::from_secs(16)), + Duration::from_secs(30) + ); + assert_eq!( + net_retry_backoff(NET_RETRY_CAP), + NET_RETRY_CAP, + "stays capped" + ); } // [unit->REQ-HAZARD-DETACHED-PIPE-INHERIT] the no-inherit spawn's command Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2392: #[test] fn wmi_create_script_carries_the_no_window_startup_spec() { let s = wmi_create_script("cmd.exe /c rem"); - assert!(s.contains("Win32_ProcessStartup"), "a startup spec is built"); assert!( + s.contains("Win32_ProcessStartup"), + "a startup spec is built" + ); + assert!( s.contains("ProcessStartupInformation=$si"), "the startup spec is passed to Win32_Process.Create" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2468: Err(io::Error::other(format!("{rung:?} failed"))) }); let e = r.expect_err("all rungs failed → Err"); - assert!(e.to_string().contains("InJob"), "the LAST rung's error: {e}"); + assert!( + e.to_string().contains("InJob"), + "the LAST rung's error: {e}" + ); assert_eq!( seen, vec![ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2551: fn GetCurrentProcess() -> isize; fn IsProcessInJob(proc_h: isize, job_h: isize, result: *mut i32) -> i32; } - let gc = detached_no_inherit( - "ping", - &["-n".into(), "300".into(), "127.0.0.1".into()], - ) - .expect("launcher: breakaway spawn of grandchild"); + let gc = detached_no_inherit("ping", &["-n".into(), "300".into(), "127.0.0.1".into()]) + .expect("launcher: breakaway spawn of grandchild"); // Diag: is the launcher itself in a job? is the broken-away gc in ANY // job? (job_h = 0 → "any job"). Written before pidfile so the parent // sees it on read. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2588: // KILL_ON_JOB_CLOSE so terminating the job reaps everything still in it; // BREAKAWAY_OK so a child created WITH CREATE_BREAKAWAY_FROM_JOB may escape // (the permissive shape; a job WITHOUT it would fail the spawn → fall back). - info.basic.limit_flags = - JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_BREAKAWAY_OK; + info.basic.limit_flags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_BREAKAWAY_OK; let ok = unsafe { SetInformationJobObject( job, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2603: let launcher = Command::new(std::env::current_exe().unwrap()) // a unique substring filter selects ONLY this test in the re-run; the // env presence routes it to the launcher arm above (no recursion). - .args(["breakaway_spawn_escapes_a_kill_on_close_job", "--test-threads=1"]) + .args([ + "breakaway_spawn_escapes_a_kill_on_close_job", + "--test-threads=1", + ]) .env("SPT_BREAKAWAY_PIDFILE", &pidfile) - .env("SPT_BREAKAWAY_DIAG", std::env::temp_dir().join(format!("spt_breakaway_diag_{}.log", std::process::id()))) + .env( + "SPT_BREAKAWAY_DIAG", + std::env::temp_dir().join(format!("spt_breakaway_diag_{}.log", std::process::id())), + ) // CREATE_BREAKAWAY_FROM_JOB: escape the test-runner's OWN ancestor job // (cargo/CI run the test harness inside a job), so MY job below becomes // the launcher's ONLY job — otherwise the grandchild's breakaway lands Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2637: }; // Assign the launcher to the job BEFORE it spawns its grandchild — the // grandchild is created with breakaway, so it leaves the job at birth. - let assigned = - unsafe { AssignProcessToJobObject(job, launcher.as_raw_handle() as isize) }; + let assigned = unsafe { AssignProcessToJobObject(job, launcher.as_raw_handle() as isize) }; assert!(assigned != 0, "assign launcher to job"); // Read back the grandchild pid. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\daemon.rs:2680: let _ = launcher.wait(); unsafe { CloseHandle(job) }; let _ = std::fs::remove_file(&pidfile); - let diagpath = std::env::temp_dir().join(format!("spt_breakaway_diag_{}.log", std::process::id())); + let diagpath = + std::env::temp_dir().join(format!("spt_breakaway_diag_{}.log", std::process::id())); let diag = std::fs::read_to_string(&diagpath).unwrap_or_default(); let _ = std::fs::remove_file(&diagpath); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\deadline.rs:348: DeadlineAnchor::open("agent-b", 100, StartReason::Crash, 5_000).unwrap(); // Re-open A in update mode → its own anchor survived B's write. let a = DeadlineAnchor::open("agent-a", 100, StartReason::Update, 9_999).unwrap(); - assert_eq!(a.anchor_ms, 1_000, "agent-a's phase must survive agent-b's write"); + assert_eq!( + a.anchor_ms, 1_000, + "agent-a's phase must survive agent-b's write" + ); assert_ne!(anchor_path("agent-a"), anchor_path("agent-b")); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\deelevate.rs:783: (ok, io::Error::last_os_error()) }; let (mut ok, mut err) = call(FLAGS | CREATE_BREAKAWAY_FROM_JOB); - if ok == 0 && matches!(err.raw_os_error(), Some(ERROR_INVALID_PARAMETER) | Some(ERROR_ACCESS_DENIED)) + if ok == 0 + && matches!( + err.raw_os_error(), + Some(ERROR_INVALID_PARAMETER) | Some(ERROR_ACCESS_DENIED) + ) { eprintln!( "DEELEVATE_BREAKAWAY_DENIED: token spawn rejected CREATE_BREAKAWAY_FROM_JOB \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\deelevate.rs:861: fn env_overlay_keeps_explicit_spt_home_alive() { // Replace: desktop block already has SPT_HOME (the default home). let b = block(&["PATH=C:\\win", "spt_home=C:\\default"]); - let out = apply_env_overrides( - &b, - &[("SPT_HOME".to_string(), "C:\\accept".to_string())], - ); + let out = apply_env_overrides(&b, &[("SPT_HOME".to_string(), "C:\\accept".to_string())]); let got = parse(&out); assert!(got.contains(&"PATH=C:\\win".to_string())); assert!(got.contains(&"SPT_HOME=C:\\accept".to_string())); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\deelevate.rs:880: // Append: block has no SPT_HOME. let b = block(&["PATH=C:\\win"]); - let out = apply_env_overrides( - &b, - &[("SPT_HOME".to_string(), "C:\\accept".to_string())], - ); + let out = apply_env_overrides(&b, &[("SPT_HOME".to_string(), "C:\\accept".to_string())]); assert!(parse(&out).contains(&"SPT_HOME=C:\\accept".to_string())); // No overrides: block passes through unchanged. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:73: /// `[digest]` declared defaults, then the consumer override on top (ADR-0019 /// presentation precedence). // [impl->REQ-TERM-5] -pub fn resolve_config(adapter_digest: Option<&ManifestDigest>, over: &DigestOverride) -> DigestConfig { +pub fn resolve_config( + adapter_digest: Option<&ManifestDigest>, + over: &DigestOverride, +) -> DigestConfig { let mut cfg = DigestConfig::default(); if let Some(d) = adapter_digest { if let Some(w) = d.window_turns { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:282: // partitioned transcript (e.g. CC munges cwd into its project slug); spt-core // never munges it into a harness-specific key. if let Some(c) = cwd { - keys.entry("cwd".to_string()).or_insert_with(|| c.to_string()); + keys.entry("cwd".to_string()) + .or_insert_with(|| c.to_string()); } // [impl->REQ-INSTALL-11] the extractor binary resolves from the adapter // install dir (record `source_dir`) before PATH. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:583: }; let merged = resolve_config(Some(&adapter), &over); assert_eq!(merged.window_turns, 2, "override wins"); - assert_eq!(merged.arg_truncation, 40, "unset override → adapter default"); + assert_eq!( + merged.arg_truncation, 40, + "unset override → adapter default" + ); assert!(merged.sprint_collapse, "override wins"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:606: let perch = perch::resolve_perch_path("solo", ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); // No adapter recorded ⇒ the digest.log path. - let rec = - spt_store::info::InfoJson::new("solo", "0", std::process::id(), "sid", "live_agent"); + let rec = spt_store::info::InfoJson::new( + "solo", + "0", + std::process::id(), + "sid", + "live_agent", + ); spt_store::info::write_info(&perch, &rec).unwrap(); for line in [ r#"{"role":"input","text":"build it"}"#, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:645: body: body.to_string(), ts: Some(ts.to_string()), }; - let backbone = vec![act("first", "2026-06-13T21:00:00Z"), act("third", "2026-06-13T21:00:20Z")]; + let backbone = vec![ + act("first", "2026-06-13T21:00:00Z"), + act("third", "2026-06-13T21:00:20Z"), + ]; let context = vec![ctx("msg", "2026-06-13T21:00:10Z")]; let merged = merge_by_ts(backbone, context); let order: Vec<&str> = merged Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:656: TimelineItem::Boundary { kind, .. } => kind.as_str(), }) .collect(); - assert_eq!(order, vec!["first", "msg", "third"], "context slots in by ts"); + assert_eq!( + order, + vec!["first", "msg", "third"], + "context slots in by ts" + ); } // Supersede test helpers: an Activity at a given generation (ordinal) + localseq, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:673: } } fn sup_bound() -> TimelineItem { - TimelineItem::Boundary { kind: "clear".into(), ts: None } + TimelineItem::Boundary { + kind: "clear".into(), + ts: None, + } } fn texts(items: &[TimelineItem]) -> Vec<&str> { items Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:709: TimelineItem::Activity { record, seq } if record.text == "shared row" => Some(*seq), _ => None, }); - assert_eq!(seq.map(|s| s >> 32), Some(1), "survivor is B's (newest) ordinal"); + assert_eq!( + seq.map(|s| s >> 32), + Some(1), + "survivor is B's (newest) ordinal" + ); // A's row + the /clear boundary emptied ancestor → no orphaned divider. assert!( - !out.iter().any(|it| matches!(it, TimelineItem::Boundary { .. })), + !out.iter() + .any(|it| matches!(it, TimelineItem::Boundary { .. })), "the divider adjacent to the fully-superseded ancestor is trimmed: {out:?}" ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:727: sup_act("dup", "2026-06-13T21:00:00Z", 3, 1), // same gen, real repeat ]; let out = supersede_cross_generation(items); - assert_eq!(texts(&out), vec!["dup", "dup"], "same-ordinal repeats both survive"); + assert_eq!( + texts(&out), + vec!["dup", "dup"], + "same-ordinal repeats both survive" + ); } // [unit->REQ-DIGEST-GENERATION-SUPERSEDE] disjoint sessions (a genuine /clear, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:741: sup_act("after clear", "2026-06-13T21:00:10Z", 1, 0), ]; let out = supersede_cross_generation(items); - assert_eq!(texts(&out), vec!["before clear", "after clear"], "both rows retained"); assert_eq!( - out.iter().filter(|it| matches!(it, TimelineItem::Boundary { .. })).count(), + texts(&out), + vec!["before clear", "after clear"], + "both rows retained" + ); + assert_eq!( + out.iter() + .filter(|it| matches!(it, TimelineItem::Boundary { .. })) + .count(), 1, "the /clear divider between two ≥1-row sessions is preserved" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\digest.rs:763: sup_act("C tail", "2026-06-13T21:00:09Z", 2, 1), ]; let out = supersede_cross_generation(items); - assert_eq!(texts(&out), vec!["A only", "replayed", "C tail"], "B emptied, one 'replayed' under C"); assert_eq!( - out.iter().filter(|it| matches!(it, TimelineItem::Boundary { .. })).count(), + texts(&out), + vec!["A only", "replayed", "C tail"], + "B emptied, one 'replayed' under C" + ); + assert_eq!( + out.iter() + .filter(|it| matches!(it, TimelineItem::Boundary { .. })) + .count(), 1, "exactly one divider between the two surviving sessions (A | C)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1412: let reply = WanReply { outcome: outcome.token().to_string(), }; - let _ = brain.net_stream_send( - stream_id, - &reply.encode_line(), - None, - true, - ); + let _ = brain.net_stream_send(stream_id, &reply.encode_line(), None, true); replied = true; } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1566: // Fresh row → claimable with zero prior failures. assert_eq!(should_claim(None, now), Some(0)); // In flight / terminal → never. - assert_eq!(should_claim(Some(&ClaimState::InFlight { attempts: 0 }), now), None); + assert_eq!( + should_claim(Some(&ClaimState::InFlight { attempts: 0 }), now), + None + ); assert_eq!(should_claim(Some(&ClaimState::Terminal), now), None); // Failure #1 releases with backoff — NOT claimable before next_at, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1573: // claimable at/after it, carrying the attempt count. let failed = DispatchOutcome::Failed("io".into()); let (s1, _) = outcome_transition(&failed, None, 0, now, Duration::ZERO); - let ClaimState::Retry { attempts: 1, next_at } = s1 else { + let ClaimState::Retry { + attempts: 1, + next_at, + } = s1 + else { panic!("failure #1 must requeue, got {s1:?}"); }; assert_eq!(next_at, now + retry_backoff(1)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1580: - assert_eq!(should_claim(Some(&s1), now), None, "backoff holds the claim"); - assert_eq!(should_claim(Some(&s1), next_at), Some(1), "due → reclaimable"); + assert_eq!( + should_claim(Some(&s1), now), + None, + "backoff holds the claim" + ); + assert_eq!( + should_claim(Some(&s1), next_at), + Some(1), + "due → reclaimable" + ); // Backoff doubles per attempt. assert_eq!(retry_backoff(2), retry_backoff(1) * 2); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1588: let (s2, _) = outcome_transition(&failed, None, 1, now, Duration::ZERO); assert!(matches!(s2, ClaimState::Retry { attempts: 2, .. })); let (s3, retire3) = outcome_transition(&failed, None, 2, now, Duration::ZERO); - assert_eq!(s3, ClaimState::Terminal, "attempt {MAX_DISPATCH_ATTEMPTS} exhausts the budget"); - assert!(!retire3, "a request/reply budget exhaustion never terminal-retires the row"); + assert_eq!( + s3, + ClaimState::Terminal, + "attempt {MAX_DISPATCH_ATTEMPTS} exhausts the budget" + ); + assert!( + !retire3, + "a request/reply budget exhaustion never terminal-retires the row" + ); // Terminal CLASSIFICATION outcomes are terminal immediately — a // served exchange and an unclassifiable stream never retry. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1596: - assert_eq!(outcome_transition(&DispatchOutcome::Served("ok".into()), None, 0, now, Duration::ZERO), (ClaimState::Terminal, false)); - assert_eq!(outcome_transition(&DispatchOutcome::Unknown, None, 0, now, Duration::ZERO), (ClaimState::Terminal, false)); + assert_eq!( + outcome_transition( + &DispatchOutcome::Served("ok".into()), + None, + 0, + now, + Duration::ZERO + ), + (ClaimState::Terminal, false) + ); + assert_eq!( + outcome_transition(&DispatchOutcome::Unknown, None, 0, now, Duration::ZERO), + (ClaimState::Terminal, false) + ); } // [unit->REQ-DISPATCH-FALLBACK-CIRCUIT] the failure classification table: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1671: assert_eq!(b.trip(now), BREAKER_BASE); assert!(b.open(now)); assert!(b.open(now + BREAKER_BASE - Duration::from_millis(1))); - assert!(!b.open(now + BREAKER_BASE), "window elapses -> claiming resumes"); + assert!( + !b.open(now + BREAKER_BASE), + "window elapses -> claiming resumes" + ); // Consecutive trips double... (2s, 4s, 8s, 16s, 32s->30s cap) assert_eq!(b.trip(now), BREAKER_BASE * 2); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1698: fn seat_blocked_requeues_budget_free_paced_by_the_breaker_window() { let now = Instant::now(); let window = Duration::from_secs(4); - let blocked = - DispatchOutcome::Failed("stream 9 subscriber busy: prior subscriber still draining".into()); + let blocked = DispatchOutcome::Failed( + "stream 9 subscriber busy: prior subscriber still draining".into(), + ); // Even AT the terminal edge (attempts = MAX-1), SeatBlocked keeps the // attempt count and paces on the breaker window instead of Terminal. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1740: fn oneway_seatblocked_strikes_out_terminal_while_request_reply_paces_forever() { let now = Instant::now(); let window = Duration::from_secs(4); - let blocked = - DispatchOutcome::Failed("stream 9 subscriber busy: prior subscriber still draining".into()); + let blocked = DispatchOutcome::Failed( + "stream 9 subscriber busy: prior subscriber still draining".into(), + ); let registry = Some(StreamFamily::Registry); // Strikes 1..budget-1 requeue on the breaker window, counting. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1760: // At the budget: TERMINAL + physical terminal-retire, loudly. let (s_out, r_out) = outcome_transition(&blocked, registry, ONEWAY_POISON_STRIKES - 1, now, window); - assert_eq!(s_out, ClaimState::Terminal, "budget spent -> terminal claim"); + assert_eq!( + s_out, + ClaimState::Terminal, + "budget spent -> terminal claim" + ); assert!(r_out, "budget spent -> the row itself retires terminal"); // The identical failure at the identical count on a request/reply Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1784: let (s_t, r_t) = outcome_transition(&transient, registry, MAX_DISPATCH_ATTEMPTS - 1, now, window); assert_eq!(s_t, ClaimState::Terminal); - assert!(r_t, "a one-way row spent on transients retires terminal too"); + assert!( + r_t, + "a one-way row spent on transients retires terminal too" + ); // family_is_one_way is Registry-exactly: feed-shaped transports that // carry durable rows/replies (Notif, WanMsg) are NOT one-way here. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1832: // Pre-classification events name the family honestly. let unclassified = dispatch_event(1, 2, None, 0, 3, "breaker-trip", "window_ms=2000"); - assert!(unclassified.contains("family=unclassified"), "{unclassified:?}"); + assert!( + unclassified.contains("family=unclassified"), + "{unclassified:?}" + ); } // [unit->REQ-DISPATCH-HYGIENE-TELEMETRY] the pool bound under a cold Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1868: fn line_endpoint_resolves_each_family_identity_key() { use serde_json::json; let cases = [ - (StreamFamily::Attach, json!({"endpoint_id": "webbie"}), Some("webbie")), - (StreamFamily::Rest, json!({"endpoint": "ling"}), Some("ling")), + ( + StreamFamily::Attach, + json!({"endpoint_id": "webbie"}), + Some("webbie"), + ), + ( + StreamFamily::Rest, + json!({"endpoint": "ling"}), + Some("ling"), + ), (StreamFamily::Xfer, json!({"endpoint": "oak"}), Some("oak")), - (StreamFamily::ShellLink, json!({"owner": "doyle"}), Some("doyle")), - (StreamFamily::WanMsg, json!({"target": "todlando"}), Some("todlando")), + ( + StreamFamily::ShellLink, + json!({"owner": "doyle"}), + Some("doyle"), + ), + ( + StreamFamily::WanMsg, + json!({"target": "todlando"}), + Some("todlando"), + ), // No endpoint concept -> honest None. - (StreamFamily::Sync, json!({"endpoint_id": "x", "endpoint": "x"}), None), + ( + StreamFamily::Sync, + json!({"endpoint_id": "x", "endpoint": "x"}), + None, + ), (StreamFamily::Registry, json!({"target": "x"}), None), // The right family with a blank/missing field -> None, not "". (StreamFamily::Attach, json!({"endpoint_id": ""}), None), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1899: // An unfinished attach is the live-reconstruction path and must serve. #[test] fn finished_is_terminal_for_attach_only() { - assert!(finished_row_is_terminal(StreamFamily::Attach, true), "detached attach: terminal"); - assert!(!finished_row_is_terminal(StreamFamily::Attach, false), "live attach: reconstruction serves"); + assert!( + finished_row_is_terminal(StreamFamily::Attach, true), + "detached attach: terminal" + ); + assert!( + !finished_row_is_terminal(StreamFamily::Attach, false), + "live attach: reconstruction serves" + ); for family in [ StreamFamily::Sync, StreamFamily::Update, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1962: // Under the bound: N chunks accumulate, ZERO commits before EOF; the // finish batch carries every record, kind-split. let mut acc = FeedAccumulator::new(10); - assert!(acc.push(vec![inst("a"), lbl()]).is_none(), "chunk 1: pooled"); + assert!( + acc.push(vec![inst("a"), lbl()]).is_none(), + "chunk 1: pooled" + ); assert!(acc.push(vec![]).is_none(), "an empty chunk commits nothing"); assert!(acc.push(vec![inst("b")]).is_none(), "chunk 3: pooled"); let batch = acc.finish().expect("EOF hands back the one batch"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\dispatch.rs:1969: assert_eq!((batch.updates.len(), batch.labels.len()), (2, 1)); - assert!(acc.finish().is_none(), "nothing pending after the EOF batch"); + assert!( + acc.finish().is_none(), + "nothing pending after the EOF batch" + ); // Oversized feed: the bound trips mid-stream — ceil(records/bound) // batches, memory stays bounded. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\docshost.rs:218: /// caller's loud log); `[::1]:port` is best-effort where the stack offers it. /// Returns the bound v4 address (the resolved-port source for tests binding /// port 0). -async fn bind_loopback(port: u16) -> io::Result<(tokio::net::TcpListener, Option)> { +async fn bind_loopback( + port: u16, +) -> io::Result<(tokio::net::TcpListener, Option)> { let v4 = tokio::net::TcpListener::bind(SocketAddr::from(([127, 0, 0, 1], port))).await?; let actual = v4.local_addr()?.port(); let v6 = tokio::net::TcpListener::bind(("::1", actual)).await.ok(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\docshost.rs:322: "/a/%00", "/%zz", ] { - assert!( - sanitize_request_path(bad).is_none(), - "must reject {bad:?}" - ); + assert!(sanitize_request_path(bad).is_none(), "must reject {bad:?}"); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\docshost.rs:347: content_type_for(Path::new("manifest.schema.json")), "application/json" ); - assert_eq!(content_type_for(Path::new("css/chrome.css")), "text/css; charset=utf-8"); assert_eq!( + content_type_for(Path::new("css/chrome.css")), + "text/css; charset=utf-8" + ); + assert_eq!( content_type_for(Path::new("unknown.bin")), "application/octet-stream" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\docshost.rs:359: assert_eq!(resolve_docs_port(None, None), DEFAULT_DOCS_PORT); assert_eq!(resolve_docs_port(Some(8080), None), 8080); assert_eq!(resolve_docs_port(Some(8080), Some("9999")), 9999); - assert_eq!(resolve_docs_port(Some(8080), Some("not-a-port")), 8080, "malformed env degrades to config"); - assert_eq!(resolve_docs_port(None, Some("0")), DEFAULT_DOCS_PORT, "0 is not a real override"); + assert_eq!( + resolve_docs_port(Some(8080), Some("not-a-port")), + 8080, + "malformed env degrades to config" + ); + assert_eq!( + resolve_docs_port(None, Some("0")), + DEFAULT_DOCS_PORT, + "0 is not a real override" + ); assert_eq!(docs_url(DEFAULT_DOCS_PORT), "http://localhost:5474"); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\drivehub.rs:842: /// on the daemon regardless. // [impl->REQ-SHELL-3] // [impl->REQ-ACTIVITY-LINK-PUSH] -pub fn drive_take( - name: &str, - owner: &str, - shell_id: &str, - token: &str, -) -> io::Result { +pub fn drive_take(name: &str, owner: &str, shell_id: &str, token: &str) -> io::Result { let mut conn = connect(name)?; let req = DriveTakeReq { owner: owner.to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\drivehub.rs:1244: foreign.starts_with("LAUNCH_REFUSED_FOREIGN_HOME:"), "{foreign}" ); - assert!(no_daemon.starts_with("LAUNCH_ROUTE_NO_DAEMON:"), "{no_daemon}"); assert!( + no_daemon.starts_with("LAUNCH_ROUTE_NO_DAEMON:"), + "{no_daemon}" + ); + assert!( unanswered.starts_with("LAUNCH_ROUTE_UNANSWERED:"), "a daemon that reads the op and answers nothing must be its own diagnosis, \ never 'no daemon': {unanswered}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\drivehub.rs:1314: let ack: ShellLaunchAck = serde_json::from_str(r#"{"accepted":true}"#).expect("a bare accept decodes"); assert!(ack.accepted && ack.reason.is_none()); - let refused: ShellLaunchAck = serde_json::from_str(r#"{"accepted":false,"reason":"x"}"#) - .expect("a refusal decodes"); + let refused: ShellLaunchAck = + serde_json::from_str(r#"{"accepted":false,"reason":"x"}"#).expect("a refusal decodes"); assert!(!refused.accepted && refused.reason.as_deref() == Some("x")); let res: ShellLaunchResult = serde_json::from_str(r#"{"pid":42}"#).expect("a pid-only outcome decodes"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:465: /// Whether `key`'s effect has already been applied + recorded. pub fn is_applied(&self, key: EffectKey) -> bool { - self.lock_recover() - .applied - .contains(&key) + self.lock_recover().applied.contains(&key) } /// A snapshot of the applied-set (for introspection / tests). Unordered. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:474: pub fn applied_keys(&self) -> Vec { - self.lock_recover() - .applied - .iter() - .copied() - .collect() + self.lock_recover().applied.iter().copied().collect() } /// Count of distinct effects applied. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:483: pub fn applied_count(&self) -> usize { - self.lock_recover() - .applied - .len() + self.lock_recover().applied.len() } /// Keys with an unfinished `PENDING` (broker crashed mid-effect). Empty on the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:490: /// brain-crash path; surfaced for the future broker-restart recovery. pub fn pending_keys(&self) -> Vec { - self.lock_recover() - .pending - .iter() - .copied() - .collect() + self.lock_recover().pending.iter().copied().collect() } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:895: let net_key = k(1, 2); assert_eq!( - j.apply_once(pty_key, EffectKind::PtyWrite, || Ok(())).unwrap(), + j.apply_once(pty_key, EffectKind::PtyWrite, || Ok(())) + .unwrap(), Outcome::Applied ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:902: - j.apply_once(net_key, EffectKind::NetSend, || Ok(())).unwrap(), + j.apply_once(net_key, EffectKind::NetSend, || Ok(())) + .unwrap(), Outcome::Applied ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:930: // PtyWrite is not. Keys are written as "sid op" tokens on the journal line. let text = std::fs::read_to_string(j.path()).expect("read journal file"); // New line shape carries the minter tag: "PENDING 1 cli 2 net-send". - let net_token = format!("{} {} {}", net_key.class, net_key.minter.as_tag(), net_key.op); - let pty_token = format!("{} {} {}", pty_key.class, pty_key.minter.as_tag(), pty_key.op); + let net_token = format!( + "{} {} {}", + net_key.class, + net_key.minter.as_tag(), + net_key.op + ); + let pty_token = format!( + "{} {} {}", + pty_key.class, + pty_key.minter.as_tag(), + pty_key.op + ); assert!( text.lines().any(|l| { - (l.starts_with("PENDING ") || l.starts_with("DONE ")) - && l.contains(&net_token) + (l.starts_with("PENDING ") || l.starts_with("DONE ")) && l.contains(&net_token) }), "the durable NetSend effect must be journaled to disk; file was: {text:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:942: assert!( !text.lines().any(|l| { - (l.starts_with("PENDING ") || l.starts_with("DONE ")) - && l.contains(&pty_token) + (l.starts_with("PENDING ") || l.starts_with("DONE ")) && l.contains(&pty_token) }), "an ephemeral PtyWrite must NOT pay the durable journal write (no per-\ keystroke fsync) — REQ-HAZARD-EFFECT-JOURNAL-PTY-WEDGE. File was: {text:?}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1068: minter: Minter::Rc, op: 3, }; - assert!(j_new.is_applied(rc_key), "new line recovers to the tagged key"); assert!( + j_new.is_applied(rc_key), + "new line recovers to the tagged key" + ); + assert!( !j_new.is_applied(legacy_key), "a new rc line is not a legacy key" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1083: .unwrap(); let j_mixed = EffectJournal::open(&mixed_path).unwrap(); assert!(j_mixed.is_applied(legacy_key), "mixed: legacy key present"); - assert!(j_mixed.is_applied(new_producer_key), "mixed: cli key present"); + assert!( + j_mixed.is_applied(new_producer_key), + "mixed: cli key present" + ); assert_eq!( j_mixed.applied_count(), 2, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1139: op: OP, }; assert_eq!( - j.apply_once(replay, EffectKind::NetDial, || Ok(())).unwrap(), + j.apply_once(replay, EffectKind::NetDial, || Ok(())) + .unwrap(), Outcome::Deduped, "a same-minter same-op replay is still deduped" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1169: minter: Minter::Rc, op: colliding_int, }; - assert_ne!(shell_key, rc_key, "same session+int, different minter = distinct key"); + assert_ne!( + shell_key, rc_key, + "same session+int, different minter = distinct key" + ); // Spool delivery lands first (Spool is durable — a real journal write). assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1176: - j.apply_once(shell_key, EffectKind::Spool, || Ok(())).unwrap(), + j.apply_once(shell_key, EffectKind::Spool, || Ok(())) + .unwrap(), Outcome::Applied, "the shell spool delivery applies" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1180: // The rc operator's identically-numbered op must ALSO apply, not dedupe. assert_eq!( - j.apply_once(rc_key, EffectKind::PtyWrite, || Ok(())).unwrap(), + j.apply_once(rc_key, EffectKind::PtyWrite, || Ok(())) + .unwrap(), Outcome::Applied, "the rc operator op must NOT be swallowed by the shell op's key (the bug)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\effect.rs:1224: assert_eq!(out, "healed"); let ops = minted.borrow(); - assert_eq!(ops.len(), 2, "run invoked exactly twice (initial + ONE retry)"); + assert_eq!( + ops.len(), + 2, + "run invoked exactly twice (initial + ONE retry)" + ); assert_eq!(ops[0].minter, Minter::Rc); assert_eq!( ops[1].minter, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:151: ); // [impl->REQ-HAZARD-TEMPLATE-ARGV-FILL] tokenize the template then fill each // token so a multi-word/quote/semicolon {key} value is one argv element. - let tokens = - spt_runtime::runtime::fill_template_tokens(&role.command, &keys).map_err(|e| e.to_string())?; + let tokens = spt_runtime::runtime::fill_template_tokens(&role.command, &keys) + .map_err(|e| e.to_string())?; if tokens.is_empty() { return Err("empty session command".into()); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:391: // A freshly minted id round-trips as provisional. assert!(is_provisional_session_id(&mint_session_id())); assert!(is_provisional_session_id("70b5bfa40901b7d4")); // the triage leak sid - // A Claude UUID is NOT provisional (dashes + length). - assert!(!is_provisional_session_id("b4421cf9-1234-5678-9abc-def012345678")); + // A Claude UUID is NOT provisional (dashes + length). + assert!(!is_provisional_session_id( + "b4421cf9-1234-5678-9abc-def012345678" + )); // Length / charset guards. assert!(!is_provisional_session_id("70b5bfa40901b7d")); // 15 chars assert!(!is_provisional_session_id("70b5bfa40901b7d40")); // 17 chars Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:408: #[test] fn prepare_fills_id_and_session_into_self_command() { let m = harness_manifest("mock-session --id {id} --session-id {session_id}"); - let prepared = prepare_harness_spawn("doyle", "mock", "sess-abc", &m, false, None, None).unwrap(); + let prepared = + prepare_harness_spawn("doyle", "mock", "sess-abc", &m, false, None, None).unwrap(); assert_eq!( prepared.tokens, vec![ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:433: ) .unwrap(); let prepared = - prepare_harness_spawn("hall-a", "mock", "s", &m, false, None, Some("ENLYZEAM")).unwrap(); + prepare_harness_spawn("hall-a", "mock", "s", &m, false, None, Some("ENLYZEAM")) + .unwrap(); assert_eq!( prepared.tokens, vec![ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:497: .unwrap(); // Shipped + install_dir → single-element argv = absolute resolved path. - let prepared = prepare_harness_spawn("e", "cc", "s", &m, false, Some(&dir_str), None).unwrap(); + let prepared = + prepare_harness_spawn("e", "cc", "s", &m, false, Some(&dir_str), None).unwrap(); assert_eq!( prepared.translation_binary.as_deref(), Some([shipped.to_string_lossy().into_owned()].as_slice()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:513: // install_dir present but file absent → bare fallback (PATH). let empty = tempfile::tempdir().unwrap(); let empty_str = empty.path().to_string_lossy().into_owned(); - let prepared = prepare_harness_spawn("e", "cc", "s", &m, false, Some(&empty_str), None).unwrap(); + let prepared = + prepare_harness_spawn("e", "cc", "s", &m, false, Some(&empty_str), None).unwrap(); assert_eq!( prepared.translation_binary.as_deref(), Some([bare.to_string()].as_slice()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:534: [env.SPT_READ_ONLY]\ndirection = \"read\"\n", ) .unwrap(); - let prepared = prepare_harness_spawn("wall-b", "mock", "abc", &m, false, None, None).unwrap(); - assert_eq!(prepared.env.get("SPT_ENDPOINT_ID").map(String::as_str), Some("wall-b")); - assert_eq!(prepared.env.get("SPT_SESSION").map(String::as_str), Some("sess-abc")); + let prepared = + prepare_harness_spawn("wall-b", "mock", "abc", &m, false, None, None).unwrap(); + assert_eq!( + prepared.env.get("SPT_ENDPOINT_ID").map(String::as_str), + Some("wall-b") + ); + assert_eq!( + prepared.env.get("SPT_SESSION").map(String::as_str), + Some("sess-abc") + ); // A `read` directive injects nothing. assert!(!prepared.env.contains_key("SPT_READ_ONLY")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:557: [message-idle-translation-binary]\npath = \"cc-spt-idle-translate\"\n", ) .unwrap(); - let prepared = prepare_harness_spawn("wall-a", "cc", "s", &with, false, None, None).unwrap(); + let prepared = + prepare_harness_spawn("wall-a", "cc", "s", &with, false, None, None).unwrap(); assert_eq!( prepared.translation_binary.as_deref(), Some(["cc-spt-idle-translate".to_string()].as_slice()) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:575: prepare_harness_spawn("wall-a", "cc", "s", &cmd, false, Some("/opt/cc"), None).unwrap(); let argv = prepared.translation_binary.expect("command argv"); assert_eq!(argv.len(), 2, "program + one arg: {argv:?}"); - assert!(argv[0].ends_with("claude-spt"), "{{adapter_dir}} filled: {argv:?}"); + assert!( + argv[0].ends_with("claude-spt"), + "{{adapter_dir}} filled: {argv:?}" + ); assert!(argv[0].contains("/opt/cc"), "into install_dir: {argv:?}"); assert_eq!(argv[1], "translate"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:582: // absent → None. let without = harness_manifest("claude"); - let prepared = prepare_harness_spawn("wall-a", "mock", "s", &without, false, None, None).unwrap(); + let prepared = + prepare_harness_spawn("wall-a", "mock", "s", &without, false, None, None).unwrap(); assert!(prepared.translation_binary.is_none()); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:597: min_spt_core_version = \"0\"\n\n[shell]\nspawn = 'sh'\n", ) .unwrap(); - assert!(prepare_harness_spawn("e", "sh", "s", &shell, false, None, None) - .unwrap_err() - .contains("not a harness")); + assert!( + prepare_harness_spawn("e", "sh", "s", &shell, false, None, None) + .unwrap_err() + .contains("not a harness") + ); // Harness with no [session.self] refused. let no_self = spt_runtime::Manifest::from_toml_str( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:607: min_spt_core_version = \"0\"\n", ) .unwrap(); - assert!(prepare_harness_spawn("e", "h", "s", &no_self, false, None, None) - .unwrap_err() - .contains("no [session.self]")); + assert!( + prepare_harness_spawn("e", "h", "s", &no_self, false, None, None) + .unwrap_err() + .contains("no [session.self]") + ); // Unknown {placeholder} errs naming the key. let bad = harness_manifest("mock-session --id {id} --boom {not_a_key}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:616: - assert!(prepare_harness_spawn("e", "mock", "s", &bad, false, None, None) - .unwrap_err() - .contains("not_a_key")); + assert!( + prepare_harness_spawn("e", "mock", "s", &bad, false, None, None) + .unwrap_err() + .contains("not_a_key") + ); } /// A harness manifest declaring BOTH `[session.self]` and a DISTINCT Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:644: ); // is_resume=true → the RESUME template (`--resume`), filled with the id. - let resumed = - prepare_harness_spawn("doyle", "mock", "sess-abc", &m, true, None, None).expect("resume prepares"); + let resumed = prepare_harness_spawn("doyle", "mock", "sess-abc", &m, true, None, None) + .expect("resume prepares"); assert_eq!( resumed.tokens, vec![ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\harnesshost.rs:659: ); // is_resume=false → the SELF template (`--session-id`), same catalog. - let fresh = - prepare_harness_spawn("doyle", "mock", "sess-abc", &m, false, None, None).expect("self prepares"); + let fresh = prepare_harness_spawn("doyle", "mock", "sess-abc", &m, false, None, None) + .expect("self prepares"); assert_eq!( fresh.tokens, vec![ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\inject.rs:109: if !is_spt_hosted_no_relay(id, owlery) { return 0; } - let perch_path = - spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); + let perch_path = spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); // [impl->REQ-SPOOL-TAKE-AUDIT] idle-inject leg — stamp the claim's provenance. let audit = spt_store::spool::TakerAudit::new( spt_store::spool::TakerLeg::IdleInject, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\inject.rs:140: } release_ids.extend(rest.map(|(msg_id, _, _)| msg_id)); if delivered > 0 { - eprintln!("IDLE_PARKED_DRAIN:{id}: injected {delivered} parked message(s) via translation binary"); + eprintln!( + "IDLE_PARKED_DRAIN:{id}: injected {delivered} parked message(s) via translation binary" + ); } if !release_ids.is_empty() { let _ = spt_store::spool::release_at(&perch_path, &release_ids); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\inject.rs:164: if !is_spt_hosted_no_relay(id, owlery) { return false; } - let perch_path = - spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); + let perch_path = spt_store::perch::resolve_perch_path(id, spt_store::perch::ParentHint::Infer); if !spt_store::perch::resolve_idle_file(id, spt_store::perch::ParentHint::Infer).exists() { return false; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:123: pub mod digest; pub mod digesthub; pub mod digestlink; -pub mod docshost; pub mod dispatch; +pub mod docshost; pub mod drivehub; pub mod effect; pub mod endpoint; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:153: pub mod relay; pub mod relcache; pub mod release; -pub mod rollback_compat; pub mod resthost; pub mod resting; +pub mod rollback_compat; pub mod seedmap; pub mod seedproofx; pub mod serveprobe; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:199: digest_to_json, follow, pull_snapshot, render_digest, render_update, reproject, serve_digest_control, update_to_json, DigestHub, }; -pub use effect::{ - with_tracing_retry, EffectJournal, EffectKey, EffectKind, Outcome, OP_NO_LONGER_HELD_MARKER, -}; pub use drivehub::{ activity_write, drive_clear, drive_take, drive_write, serve_drive_control, shell_launch, DriveHub, LaunchRouteError, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:208: }; -pub use tunnelhub::{ - serve_tunnel_control, tunnel_clear, tunnel_ensure, tunnel_recv, tunnel_resolve, tunnel_send, - TunnelEnd, TunnelHub, +pub use effect::{ + with_tracing_retry, EffectJournal, EffectKey, EffectKind, Outcome, OP_NO_LONGER_HELD_MARKER, }; pub use endpoint::{ broker_socket_name, daemon_pid_path, digest_socket_name, drive_socket_name, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:215: pump_heartbeat_path, read_pump_health, read_pump_heartbeat, seed_socket_name, tunnel_socket_name, }; -pub use inject::{is_spt_hosted_no_relay, try_spt_hosted_inject}; pub use frame::{ accept_hello, Envelope, HandshakeError, Hello, Role, IPC_PROTOCOL_VERSION, MIN_COMPATIBLE_VERSION, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:222: }; +pub use inject::{is_spt_hosted_no_relay, try_spt_hosted_inject}; pub use lifecycle::{BrainLifecycle, TickReport}; pub use linkhost::{ drive_channel_write, drive_shell, ensure_shell_tunnel, launch_shell_daemon_side, relink_shell, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:227: wake_if_offline_persistent_from, DriveDelivery, ShellLinkError, ShellLinkRequestOutcome, }; pub use nethost::{NetConfig, NetHost, NET_EFFECT_SESSION}; -pub use serveprobe::{ - is_serving_subnet, request_subnet_probe, serve_subnet_probe, ServeProbeServeOutcome, -}; pub use notif::{ first_fire, most_recently_active_visible, produce_and_first_fire, produce_consent_notif, produce_rollback_notif, resurface_at_boundary, FirstFireOutcome, NotifSurfacePolicy, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:236: - ResurfaceOutcome, NOTIF_KIND_AGENT, NOTIF_KIND_CONSENT, NOTIF_KIND_PSYCHE, - NOTIF_KIND_ROLLBACK, SUPPRESSION_WINDOW_MS, + ResurfaceOutcome, NOTIF_KIND_AGENT, NOTIF_KIND_CONSENT, NOTIF_KIND_PSYCHE, NOTIF_KIND_ROLLBACK, + SUPPRESSION_WINDOW_MS, }; pub use notifsync::{apply_notif_feed, emit_notif_feed, NotifApplyVerdict, NotifPolicy}; pub use propagate::{request_update, serve_update, UpdatePullOutcome, UpdateServeOutcome}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:243: }; pub use relay::Relay; pub use relcache::{ReleaseCache, StagedUpdate}; -pub use rollback_compat::PRE_READY_DURABLE_FILES; pub use release::{ current_platform, parse_verifying_key, sha256_hex, verify_artifact, verify_detached, verify_metadata, verify_signature, verify_update_set_artifact, verify_update_set_docs, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:250: - verify_update_set_metadata, - RejectReason, - ReleaseMetadata, SignedRelease, SignedUpdateSet, UpdateArtifactMetadata, UpdateDocsMetadata, - UpdateSetMetadata, UpdateSetProvenance, VerifyPolicy, + verify_update_set_metadata, RejectReason, ReleaseMetadata, SignedRelease, SignedUpdateSet, + UpdateArtifactMetadata, UpdateDocsMetadata, UpdateSetMetadata, UpdateSetProvenance, + VerifyPolicy, }; pub use resthost::{request_rest, serve_rest, RestRequestOutcome, RestServeOutcome}; pub use resting::{ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:257: apply_event, arm_transition_echo, daemon_rest_event, daemon_rest_event_with_liveness, - effective_auto_suspend, fire_wake_effects, - read_rest, request_freshness_pull, route_rest_event, take_freshness_pull, transition, - write_rest, EdgeReport, RestEvent, RestRecord, RestRoute, RestState, - NOT_A_HOSTED_PERCH_MARKER, PULL_MARKER_FILE, + effective_auto_suspend, fire_wake_effects, read_rest, request_freshness_pull, route_rest_event, + take_freshness_pull, transition, write_rest, EdgeReport, RestEvent, RestRecord, RestRoute, + RestState, NOT_A_HOSTED_PERCH_MARKER, PULL_MARKER_FILE, }; +pub use rollback_compat::PRE_READY_DURABLE_FILES; pub use seedmap::{put_seed, take_seed, SeedRegistry}; +pub use serveprobe::{ + is_serving_subnet, request_subnet_probe, serve_subnet_probe, ServeProbeServeOutcome, +}; pub use sync::{ reconcile_after_sync, request_sync, select_refs, serve_sync, ReconcileWiring, SyncPolicy, SyncPullReport, SyncServeOutcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lib.rs:267: }; pub use transport::{DaemonTransport, LocalSocketTransport}; +pub use tunnelhub::{ + serve_tunnel_control, tunnel_clear, tunnel_ensure, tunnel_recv, tunnel_resolve, tunnel_send, + TunnelEnd, TunnelHub, +}; pub use update::{ apply_brain_only, classify, plan_update, plan_verified, plan_verified_update_set, ApplyError, BrokerAbi, ReleaseSpec, UpdateClass, UpdatePlan, BROKER_RESOURCE_ABI, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:331: /// never holds the read lock across the spawn/blocking call — a concurrent /// [`refresh`](Self::refresh) is never blocked by a long spawn. fn runtime_snapshot(&self) -> ManifestRuntime { - self.runtime.read().unwrap_or_else(|p| p.into_inner()).clone() + self.runtime + .read() + .unwrap_or_else(|p| p.into_inner()) + .clone() } /// A snapshot **clone** of the manifest (guard dropped on return, as above). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:338: fn manifest_snapshot(&self) -> Manifest { - self.manifest.read().unwrap_or_else(|p| p.into_inner()).clone() + self.manifest + .read() + .unwrap_or_else(|p| p.into_inner()) + .clone() } /// Swap BOTH the manifest and its runtime to the freshly-installed on-disk Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:633: for raw in self.drop_dirs() { match resolve_endpoint_drop_dir(&raw, cwd_path) { Some(dir) => { - let mut got = - ingest_drops(&dir, &self.id, &project_id, now, self.cfg.protection_window_ms) - .map_err(|e| e.to_string())?; + let mut got = ingest_drops( + &dir, + &self.id, + &project_id, + now, + self.cfg.protection_window_ms, + ) + .map_err(|e| e.to_string())?; ingested.append(&mut got); } None => warn_no_cwd_once(&self.id, &raw), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:710: let interval_ms = self.cfg.pulse_period.as_millis() as u64; // A disk error must not stop the pulse: degrade to an in-memory anchor at // `now` (fresh-phase, unpersisted) so cadence continues regardless. - let anchor = DeadlineAnchor::open(key, interval_ms, reason, now_ms()) - .unwrap_or(DeadlineAnchor { + let anchor = + DeadlineAnchor::open(key, interval_ms, reason, now_ms()).unwrap_or(DeadlineAnchor { anchor_ms: now_ms(), interval_ms: interval_ms.max(1), }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1017: // psyche lands in the DEFAULT account root → headless "Not logged in" → strike // loop (flynn's field death). Harness-agnostic: whatever was captured is // forwarded verbatim; core knows no var by name. - let parent_read_env = spt_store::info::read_info(&perch::resolve_perch_path( - &self.id, - ParentHint::Infer, - )) - .map(|r| r.read_env) - .unwrap_or_default(); + let parent_read_env = + spt_store::info::read_info(&perch::resolve_perch_path(&self.id, ParentHint::Infer)) + .map(|r| r.read_env) + .unwrap_or_default(); let runtime = self.cell.runtime_snapshot().with_spawn_env(parent_read_env); let psyche_id = format!("{}-psyche", self.id); // The psyche's OWN nested perch — where its custody sid lives (never the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1063: } None => { let minted = spt_store::psyche_custody::mint_uuid_v4(); - if let Err(e) = spt_store::psyche_custody::write_psyche_sid(&psyche_perch, &minted) { + if let Err(e) = spt_store::psyche_custody::write_psyche_sid(&psyche_perch, &minted) + { // Loud but non-fatal: the turn still runs on the minted id; a next // fire re-mints (custody still None). No first-ever-mint PSYCHE_RESEED — // that marker fires ONLY at a real reseed (custody-clear on Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1201: Err(reason) => { *strikes += 1; let budget = psyche_turn_strike_budget(); - eprintln!("PSYCHE_TURN_FAIL:{} (strike {strikes}/{budget}): {reason}", self.id); + eprintln!( + "PSYCHE_TURN_FAIL:{} (strike {strikes}/{budget}): {reason}", + self.id + ); if psyche_turn_strikes_exhausted(*strikes, budget) { let stamp = format!("psyche per-event turn failed {strikes}x consecutively: {reason}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1620: #[test] fn psyche_turn_strikes_exhausted_boundary() { assert!(!psyche_turn_strikes_exhausted(0, 3)); - assert!(!psyche_turn_strikes_exhausted(2, 3), "under budget → tolerated"); + assert!( + !psyche_turn_strikes_exhausted(2, 3), + "under budget → tolerated" + ); assert!(psyche_turn_strikes_exhausted(3, 3), "AT budget → fault"); assert!(psyche_turn_strikes_exhausted(4, 3), "past budget → fault"); // Budget of 1 (the forced-fault int knob): the first failure is the fault. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1663: host.note_turn_outcome(&mut strikes, &fail); assert_eq!(strikes, 0, "counter resets after the give-up stamp"); let s = stamp().expect("exhaustion stamps psyche_host_error"); - assert!(s.reason.contains("3x consecutively"), "stamp names the rate: {}", s.reason); + assert!( + s.reason.contains("3x consecutively"), + "stamp names the rate: {}", + s.reason + ); // A clean fire clears the stamp and keeps the counter at 0. host.note_turn_outcome(&mut strikes, &Ok(())); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1670: assert_eq!(strikes, 0); - assert!(stamp().is_none(), "a successful turn clears the prior fault stamp"); + assert!( + stamp().is_none(), + "a successful turn clears the prior fault stamp" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1772: !first.contains_key("psyche_context"), "the W3 {{psyche_context}} body key is REPLACED by {{psyche_context_file}}" ); - assert_eq!(first.get("id").map(String::as_str), Some("doyle"), "base keys kept"); + assert_eq!( + first.get("id").map(String::as_str), + Some("doyle"), + "base keys kept" + ); assert_eq!(first.get("node").map(String::as_str), Some("kitsubito")); // A continue turn carries the SAME path key (the discriminator is the file Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1779: // content, not the key) — the sid stays the psyche's own. let later = psyche_turn_keys(base(), Some("parent-sid"), "psyche-uuid", ctx); - assert_eq!(later.get("session_id").map(String::as_str), Some("psyche-uuid")); assert_eq!( + later.get("session_id").map(String::as_str), + Some("psyche-uuid") + ); + assert_eq!( later.get("psyche_context_file").map(String::as_str), Some(ctx.to_string_lossy().as_ref()) ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1851: ); // FRESH with a real mind: the composed body, non-empty. - let fresh = write_psyche_context_file(&perch, first_turn_psyche_context(Some("MIND"))).unwrap(); + let fresh = + write_psyche_context_file(&perch, first_turn_psyche_context(Some("MIND"))).unwrap(); assert_eq!(std::fs::read_to_string(&fresh).unwrap(), "MIND"); assert!(std::fs::metadata(&fresh).unwrap().len() > 0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1858: // FRESH with a zero-context agent: the NON-EMPTY marker (never // 0-byte — else it would masquerade as continue). Overwrite-in-place: same path. let marker = write_psyche_context_file(&perch, first_turn_psyche_context(None)).unwrap(); - assert_eq!(marker, cont, "overwrite in place — same nested-perch path each turn"); - assert_eq!(std::fs::read_to_string(&marker).unwrap(), PSYCHE_FRESH_MARKER); + assert_eq!( + marker, cont, + "overwrite in place — same nested-perch path each turn" + ); + assert_eq!( + std::fs::read_to_string(&marker).unwrap(), + PSYCHE_FRESH_MARKER + ); assert!(std::fs::metadata(&marker).unwrap().len() > 0); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1938: std::fs::create_dir_all(&parent).unwrap(); write_info( &parent, - &InfoJson::new("doyle", "t", std::process::id(), "parent-sid-1", "live_agent"), + &InfoJson::new( + "doyle", + "t", + std::process::id(), + "parent-sid-1", + "live_agent", + ), ) .unwrap(); let psyche_perch = Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1948: assert_eq!(custody::read_psyche_sid(&psyche_perch), None); let minted = custody::mint_uuid_v4(); custody::write_psyche_sid(&psyche_perch, &minted).unwrap(); - assert_eq!(custody::read_psyche_sid(&psyche_perch).as_deref(), Some(minted.as_str())); + assert_eq!( + custody::read_psyche_sid(&psyche_perch).as_deref(), + Some(minted.as_str()) + ); // A parent /clear boundary rotates ONLY the parent perch's sid (exactly // cmd_boundary's core mutation) — the nested custody sid is untouched. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:1985: "/home/x/projects/spt-core" }); // Absolute passes through unchanged, cwd irrelevant. - let abs = Path::new(if cfg!(windows) { "C:/abs/drop" } else { "/abs/drop" }); - assert_eq!(resolve_endpoint_drop_dir(abs, Some(cwd)).as_deref(), Some(abs)); + let abs = Path::new(if cfg!(windows) { + "C:/abs/drop" + } else { + "/abs/drop" + }); + assert_eq!( + resolve_endpoint_drop_dir(abs, Some(cwd)).as_deref(), + Some(abs) + ); assert_eq!(resolve_endpoint_drop_dir(abs, None).as_deref(), Some(abs)); // Relative resolves UNDER the endpoint cwd (the manifest's ".claude"). assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2007: Path::new("C:/Users/x/spt-core/owlery/hall-a/nested/hall-a-psyche"), owlery )); - assert!(is_owlery_internal(Path::new("c:\\users\\x\\spt-core\\owlery\\doyle"), owlery)); - assert!(!is_owlery_internal(Path::new("C:/Users/x/Documents/projects/spt-core"), owlery)); - assert!(!is_owlery_internal(Path::new("C:/Users/x/spt-core/owleryXYZ"), owlery)); + assert!(is_owlery_internal( + Path::new("c:\\users\\x\\spt-core\\owlery\\doyle"), + owlery + )); + assert!(!is_owlery_internal( + Path::new("C:/Users/x/Documents/projects/spt-core"), + owlery + )); + assert!(!is_owlery_internal( + Path::new("C:/Users/x/spt-core/owleryXYZ"), + owlery + )); } // [int->REQ-STORE-CONTEXT-BRANCH-FILL] use-it-like-a-human: a REAL pulse tick with Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2175: #[cfg(windows)] let command = { let script = home.join("mark.bat"); - std::fs::write(&script, format!("@echo ran>\"{}\"\r\n", marker.display())) - .unwrap(); + std::fs::write(&script, format!("@echo ran>\"{}\"\r\n", marker.display())).unwrap(); format!("cmd /C \"{}\"", script.display()) }; #[cfg(unix)] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2183: let command = { let script = home.join("mark.sh"); - std::fs::write(&script, format!("echo ran > \"{}\"\n", marker.display())) - .unwrap(); + std::fs::write(&script, format!("echo ran > \"{}\"\n", marker.display())).unwrap(); format!("sh {}", script.display()) }; let toml = format!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2388: }; let anchor_of = || { let raw = std::fs::read_to_string(crate::deadline::anchor_path("pulse")).unwrap(); - serde_json::from_str::(&raw).unwrap().anchor_ms + serde_json::from_str::(&raw) + .unwrap() + .anchor_ms }; run(StartReason::Cold); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2396: // Update keeps the same grid phase (no re-base) even across a restart. run(StartReason::Update); - assert_eq!(anchor_of(), cold_phase, "Update must preserve the grid phase"); + assert_eq!( + anchor_of(), + cold_phase, + "Update must preserve the grid phase" + ); // A crash restart re-bases the anchor to a fresh instant. std::thread::sleep(Duration::from_millis(5)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2881: "2", "after a transient garbage write, the next valid publish still reloads" ); - assert_eq!(last, host.manifest_disk_hash(), "and `last` finally advances"); + assert_eq!( + last, + host.manifest_disk_hash(), + "and `last` finally advances" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\lifecycle.rs:2905: let mut last: Option = None; host.reload_manifest_if_changed(&mut last); - assert_eq!(last, None, "no install dir ⇒ `last` stays None (clean no-op)"); + assert_eq!( + last, None, + "no install dir ⇒ `last` stays None (clean no-op)" + ); assert_eq!( host.cell.manifest_snapshot().adapter.version, "1", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:146: // `always` prompts unconditionally with allow-always suppressed. let persist_allowed = cap.require_approval == ShellApproval::Remembered; if persist_allowed { - if let GrantDecision::Allowed = - grants::decide(store, &capability, owner, node, qualifier.as_deref(), target) - { + if let GrantDecision::Allowed = grants::decide( + store, + &capability, + owner, + node, + qualifier.as_deref(), + target, + ) { return None; } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:996: DEAD_PID.to_string(), ) .unwrap(); - let (relinked, _pid) = - relink_shell(&owlery, "doyle", &id).expect("a corpse must not block its own relink"); + let (relinked, _pid) = relink_shell(&owlery, "doyle", &id) + .expect("a corpse must not block its own relink"); assert_eq!(relinked, id, "recovery keeps the canonical id — no churn"); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1092: // gateway-A spawns + owns the shell. let id = shellinfo::spawn_record(&owlery, "playdate-gw-a", "Trivial", Some("Scout")) .expect("mint"); - let (out, _) = - run_action(&owlery, "playdate-gw-a", "Scout", SHELL_LINK_RELINK, &[], "op1"); - assert!(matches!(out, ShellLinkServeOutcome::Ok(_)), "relink: {out:?}"); + let (out, _) = run_action( + &owlery, + "playdate-gw-a", + "Scout", + SHELL_LINK_RELINK, + &[], + "op1", + ); + assert!( + matches!(out, ShellLinkServeOutcome::Ok(_)), + "relink: {out:?}" + ); // resolve_link_target — the shared front half of cmd/drive/tunnel/ // relink — resolves the gateway owner's shell opaquely (no type gate). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1104: // ...and drives a command through identically to an agent owner. let args = vec!["note".to_string(), "hi".to_string()]; - let (out, _) = - run_action(&owlery, "playdate-gw-a", "Scout", SHELL_LINK_CMD, &args, "op2"); - assert!(matches!(out, ShellLinkServeOutcome::Ok(_)), "gateway cmd: {out:?}"); + let (out, _) = run_action( + &owlery, + "playdate-gw-a", + "Scout", + SHELL_LINK_CMD, + &args, + "op2", + ); + assert!( + matches!(out, ShellLinkServeOutcome::Ok(_)), + "gateway cmd: {out:?}" + ); // Exclusivity keys on the owner ENDPOINT-ID, not the type: gateway-B // (same type="gateway", different id) resolves NOTHING for the same Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1118: ), "a same-type different-id owner resolves no shell (id-scoped, not type-scoped)" ); - let (out, reply) = - run_action(&owlery, "playdate-gw-b", "Scout", SHELL_LINK_CMD, &args, "op3"); + let (out, reply) = run_action( + &owlery, + "playdate-gw-b", + "Scout", + SHELL_LINK_CMD, + &args, + "op3", + ); assert!(matches!(out, ShellLinkServeOutcome::Failed(_)), "{out:?}"); assert!( matches!(reply, ShellLinkRecord::Reply { outcome, .. } if outcome == "no_shell"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1135: let spawn = "cmd /C exit 0"; #[cfg(unix)] let spawn = "true"; - let p = if persistent { "persistent = true\n" } else { "" }; + let p = if persistent { + "persistent = true\n" + } else { + "" + }; let src = perch::spt_home().join("srcs").join(name); std::fs::create_dir_all(&src).unwrap(); std::fs::write( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1170: other => panic!("offline must drop, got {other:?}"), } assert!( - spt_store::spool::peek_all_at(&perch_path).unwrap().is_empty(), + spt_store::spool::peek_all_at(&perch_path) + .unwrap() + .is_empty(), "an offline drive drop never spools" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1194: ) .unwrap(); match prepare_drive(&owlery, "doyle", "Stick", "stick", "x=0.7,y=-0.2").unwrap() { - DrivePrep::Deliver { id: d, token, frame } => { + DrivePrep::Deliver { + id: d, + token, + frame, + } => { assert_eq!(d, id); assert!(!token.is_empty(), "the parked link token is the stamp"); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1201: - frame.starts_with(""), + frame.starts_with( + "" + ), "{frame}" ); assert!(frame.contains("x=0.7,y=-0.2")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1241: ); let args = vec!["stick".to_string(), "x=0.5".to_string()]; - let (out, reply) = run_action(&owlery, "doyle", "Stick", SHELL_LINK_DRIVE, &args, "op1"); + let (out, reply) = + run_action(&owlery, "doyle", "Stick", SHELL_LINK_DRIVE, &args, "op1"); let ShellLinkServeOutcome::Ok(detail) = &out else { panic!("offline drive is a defined drop (ok), got {out:?}") }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1248: - assert!(detail.contains("dropped") && detail.contains("offline"), "{detail}"); + assert!( + detail.contains("dropped") && detail.contains("offline"), + "{detail}" + ); assert!(matches!(reply, ShellLinkRecord::Reply { outcome, .. } if outcome == "ok")); // D1: NOT woken — no relink fired, so still no token parked. assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1254: ); // D3: never spooled. assert!( - spt_store::spool::peek_all_at(&perch_path).unwrap().is_empty(), + spt_store::spool::peek_all_at(&perch_path) + .unwrap() + .is_empty(), "the remote drive path makes zero spool call" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1262: let (out, reply) = run_action(&owlery, "mallory", "Stick", SHELL_LINK_DRIVE, &args, "op2"); assert!(matches!(out, ShellLinkServeOutcome::Failed(_)), "{out:?}"); - assert!(matches!(reply, ShellLinkRecord::Reply { outcome, .. } if outcome == "no_shell")); + assert!( + matches!(reply, ShellLinkRecord::Reply { outcome, .. } if outcome == "no_shell") + ); // A drive request with no args is a bad request (needs type+payload). let (out, _) = run_action(&owlery, "doyle", "Stick", SHELL_LINK_DRIVE, &[], "op3"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1269: - assert!(matches!(out, ShellLinkServeOutcome::BadRequest(_)), "{out:?}"); + assert!( + matches!(out, ShellLinkServeOutcome::BadRequest(_)), + "{out:?}" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\linkhost.rs:1298: let node = "nodehex"; // Ungated `list` → proceed. - assert!(act_gate_decide(&GrantStore::default(), &shell, "list", "gw", node, None).is_none()); + assert!( + act_gate_decide(&GrantStore::default(), &shell, "list", "gw", node, None).is_none() + ); // `remembered` `attach`, no grant → blocked, ask names the scope, and // allow-always may persist (remembered). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:206: let Some(adapter) = info.adapter.as_deref() else { continue; // adapterless endpoint — never live-capable }; - let manifest = match spt_runtime::registry::resolve_option_in(registered, adapters_dir, adapter) - { - Ok(m) => m, - Err(_) => { - // FOLD-IN (A-2, REQ-WAKE-RESUME-LEG): a deregistered adapter on an - // online endpoint was silently skipped — the SAME silent host-failure - // class the resume leg fixes. Stamp the loud host_error REPORT (never - // status — the field is a report, not a liveness input). - // [impl->REQ-WAKE-RESUME-LEG] - let _ = spt_store::info::set_host_error( - &perch, - Some(&format!( - "adapter '{adapter}' is not a registered/active adapter on this \ + let manifest = + match spt_runtime::registry::resolve_option_in(registered, adapters_dir, adapter) { + Ok(m) => m, + Err(_) => { + // FOLD-IN (A-2, REQ-WAKE-RESUME-LEG): a deregistered adapter on an + // online endpoint was silently skipped — the SAME silent host-failure + // class the resume leg fixes. Stamp the loud host_error REPORT (never + // status — the field is a report, not a liveness input). + // [impl->REQ-WAKE-RESUME-LEG] + let _ = spt_store::info::set_host_error( + &perch, + Some(&format!( + "adapter '{adapter}' is not a registered/active adapter on this \ node — register it (spt adapter add)" - )), - ); - continue; - } - }; + )), + ); + continue; + } + }; // [impl->REQ-INSTALL-11] resolve the Psyche role program against the // adapter install dir — the registry record's precise `source_dir`, the // same dir Feature E's api seam uses (mod.rs::resolve_ctx_manifest). The Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:376: // [impl->REQ-RESUME-CUSTODY-IDENTITY] the PAIR test, not a bare-pid probe. let pid_alive = resume_in_flight(perch); // The newest ledger row carries the session to resume + its recorded adapter (D-2). - let last = spt_store::sessions::last_k(perch, 1).into_iter().next_back(); + let last = spt_store::sessions::last_k(perch, 1) + .into_iter() + .next_back(); let last_sid = last.as_ref().map(|e| e.session_id.as_str()); let recorded_adapter = last .as_ref() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:385: let registered_ok = recorded_adapter.is_some_and(|a| { spt_runtime::registry::resolve_option_in(registered, adapters_dir, a).is_ok() }); - match decide_resume(rest_state, pid_alive, last_sid, recorded_adapter, registered_ok) { + match decide_resume( + rest_state, + pid_alive, + last_sid, + recorded_adapter, + registered_ok, + ) { ResumeAction::Skip | ResumeAction::StandDown => {} ResumeAction::NoResumeMaterial => { eprintln!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:438: reason_tag: &str, ) { let parent = adapter.split(':').next().unwrap_or(adapter); - let manifest = match spt_runtime::registry::resolve_option_in(registered, adapters_dir, adapter) { + let manifest = match spt_runtime::registry::resolve_option_in(registered, adapters_dir, adapter) + { Ok(m) => m, Err(_) => return, // adapter not registered/active — the caller gated on this }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:484: Err(e) => { let _ = spt_store::info::set_host_error( perch, - Some(&format!("{reason_tag}-resume could not launch the harness: {e}")), + Some(&format!( + "{reason_tag}-resume could not launch the harness: {e}" + )), ); eprintln!("{reason_tag}_RESUME_FAIL:{id}: {e}"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:598: } RestartResume::Resume => { // Resume material from the newest ledger row (session + adapter + cwd). - let Some(last) = spt_store::sessions::last_k(&perch, 1).into_iter().next_back() + let Some(last) = spt_store::sessions::last_k(&perch, 1) + .into_iter() + .next_back() else { eprintln!( "DAEMON_RESTART_RESUME_SKIP:{id}: online spt-hosted but no ledger \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:607: continue; }; let Some(adapter) = last.adapter.as_deref().or(info.adapter.as_deref()) else { - eprintln!("DAEMON_RESTART_RESUME_SKIP:{id}: no adapter recorded to resume under"); + eprintln!( + "DAEMON_RESTART_RESUME_SKIP:{id}: no adapter recorded to resume under" + ); continue; }; launch_ledger_resume( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:654: lifecycle.run_pulse_loop(Some(&session_id), &stop, reason, |_report| {}); }) }; - set.insert(id, HostedLife { stop, thread: handle }); + set.insert( + id, + HostedLife { + stop, + thread: handle, + }, + ); } /// B2 KEYSTONE — PULL liveness reconcile (REQ-HAZARD-HOSTED-LIVENESS-RECONCILE): Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:864: // `process_exists` is deliberately NOT used: it answers from the // process table, which is EMPTY on snapshot-less platforms, so it // would regress self-heal to "never guess" there. See its doc. - let pid_alive = spt_store::info::read_pid(&perch) - .map(spt_store::proc::is_process_alive); - if hybrid_self_heal_due( - info.status.as_deref(), - info.controllable, - pid_alive, - ) { + let pid_alive = + spt_store::info::read_pid(&perch).map(spt_store::proc::is_process_alive); + if hybrid_self_heal_due(info.status.as_deref(), info.controllable, pid_alive) { BrainLifecycle::mark_offline(&perch, Some(&info.session_id)); eprintln!( "HYBRID_SELFHEAL_OFFLINE:{id}: non-live-agent row was online with a dead pid" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1136: // Pin 3 residue: clear the stale ready registration the wrapper wrote (info.json + // `ready` marker) so no dead-pid phantom ready perch is left behind. let _ = std::fs::remove_file(psyche_perch.join("info.json")); - let _ = std::fs::remove_file(perch::resolve_ready_file(&psyche_id, ParentHint::Explicit(id))); + let _ = std::fs::remove_file(perch::resolve_ready_file( + &psyche_id, + ParentHint::Explicit(id), + )); eprintln!( "LEGACY_PSYCHE_SWEEP_REAP:{id} pid={pid}: reaped stranded pre-W3 resident psyche \ + cleared its stale `{psyche_id}` ready registration" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1340: fn seed_live_perch(id: &str, adapter: &str, status: &str) { let perch = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-1", "live_agent"); + let mut rec = + spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-1", "live_agent"); rec.adapter = Some(adapter.to_string()); spt_store::info::write_info(&perch, &rec).unwrap(); spt_store::info::set_status(&perch, status).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1442: }; seed("held"); // a listener holds it seed("gone"); // nothing holds it - // The listener's registered address — the relay evidence itself. + // The listener's registered address — the relay evidence itself. spt_store::registry::register_address( "held", &"127.0.0.1:65000".parse().expect("addr"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1460: !offlined.contains(&"held".to_string()), "a relay-held endpoint is live — demoted, not offlined (offlined: {offlined:?})" ); - assert_eq!(claim("held"), None, "…and its stale broker-PTY claim is retired"); + assert_eq!( + claim("held"), + None, + "…and its stale broker-PTY claim is retired" + ); assert!( offlined.contains(&"gone".to_string()), "the B2 keystone is untouched: sessionless with nothing holding it → OFFLINE" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1517: Some(spt_store::liveness::STATUS_OFFLINE), "dead harness (no session) → offline" ); - assert_eq!(status("alive").as_deref(), Some(STATUS_ONLINE), "session present → stays"); - assert_eq!(status("relay").as_deref(), Some(STATUS_ONLINE), "relay exempt"); - assert_eq!(status("legacy").as_deref(), Some(STATUS_ONLINE), "legacy None exempt"); assert_eq!( + status("alive").as_deref(), + Some(STATUS_ONLINE), + "session present → stays" + ); + assert_eq!( + status("relay").as_deref(), + Some(STATUS_ONLINE), + "relay exempt" + ); + assert_eq!( + status("legacy").as_deref(), + Some(STATUS_ONLINE), + "legacy None exempt" + ); + assert_eq!( status("ready").as_deref(), Some(STATUS_ONLINE), "a ready_agent PID-model listener (controllable=false, live pid) stays online" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1568: .map(|i| i.controlled) .unwrap_or(false) }; - assert!(!controlled("dead"), "B3: sessionless perch → controlled CLEARED"); + assert!( + !controlled("dead"), + "B3: sessionless perch → controlled CLEARED" + ); assert!(controlled("alive"), "live session → controlled untouched"); assert!( !controlled("relay"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1614: let after = spt_store::info::read_info(&perch).unwrap(); assert!(!after.controlled, "controlled cleared on the quirk row"); assert_eq!(after.driven_by, None, "driven_by cleared on the quirk row"); - assert_eq!(after.viewer_count, None, "viewer_count cleared on the quirk row"); assert_eq!( + after.viewer_count, None, + "viewer_count cleared on the quirk row" + ); + assert_eq!( after.status.as_deref(), Some(STATUS_ONLINE), "presence untouched — its pid is alive, the self-heal is not due" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1631: #[test] fn hybrid_self_heal_due_table() { // The one due shape. - assert!(hybrid_self_heal_due(Some(STATUS_ONLINE), Some(false), Some(false))); + assert!(hybrid_self_heal_due( + Some(STATUS_ONLINE), + Some(false), + Some(false) + )); // Live pid → not due. - assert!(!hybrid_self_heal_due(Some(STATUS_ONLINE), Some(false), Some(true))); + assert!(!hybrid_self_heal_due( + Some(STATUS_ONLINE), + Some(false), + Some(true) + )); // BUSY/absent pid → never guessed. - assert!(!hybrid_self_heal_due(Some(STATUS_ONLINE), Some(false), None)); + assert!(!hybrid_self_heal_due( + Some(STATUS_ONLINE), + Some(false), + None + )); // Not online → nothing to heal. - assert!(!hybrid_self_heal_due(Some("offline"), Some(false), Some(false))); + assert!(!hybrid_self_heal_due( + Some("offline"), + Some(false), + Some(false) + )); assert!(!hybrid_self_heal_due(None, Some(false), Some(false))); // Gateway (None) / daemon-hosted (Some(true)) → exempt. - assert!(!hybrid_self_heal_due(Some(STATUS_ONLINE), None, Some(false))); - assert!(!hybrid_self_heal_due(Some(STATUS_ONLINE), Some(true), Some(false))); + assert!(!hybrid_self_heal_due( + Some(STATUS_ONLINE), + None, + Some(false) + )); + assert!(!hybrid_self_heal_due( + Some(STATUS_ONLINE), + Some(true), + Some(false) + )); } // [unit->REQ-ENDPOINT-ONLINE-TRUTH] broker-failure never mass-offlines: the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1671: reconcile_hosted_liveness(&perch::owlery_dir(), &live); } assert_eq!( - spt_store::info::read_info(&perch).and_then(|i| i.status).as_deref(), + spt_store::info::read_info(&perch) + .and_then(|i| i.status) + .as_deref(), Some(STATUS_ONLINE), "broker unreachable → the pass never ran, nothing offlined" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1694: with_home(|_| { let perch = perch::resolve_perch_path("hallb", ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = - spt_store::info::InfoJson::new("hallb", "t", std::process::id(), "sid", "live_agent"); + let mut rec = spt_store::info::InfoJson::new( + "hallb", + "t", + std::process::id(), + "sid", + "live_agent", + ); rec.controllable = Some(true); spt_store::info::write_info(&perch, &rec).unwrap(); // Already OFFLINE (the dead endpoint), yet still stamped controlled + Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1712: ); let after = spt_store::info::read_info(&perch).unwrap(); - assert!(!after.controlled, "sticky controlled reaped on the already-offline dead perch"); + assert!( + !after.controlled, + "sticky controlled reaped on the already-offline dead perch" + ); assert_eq!(after.driven_by, None, "sticky driven_by reaped too"); assert_eq!( after.status.as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1741: let seed_ctrl = |id: &str| { let perch = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = - spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-1", "live_agent"); + let mut rec = spt_store::info::InfoJson::new( + id, + "t", + std::process::id(), + "sid-1", + "live_agent", + ); rec.adapter = Some("mock".to_string()); rec.controllable = Some(true); spt_store::info::write_info(&perch, &rec).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1779: "sessionless controllable perch is offlined at boot, not hosted" ); // The live, session-backed perch stays online and IS hosted. - assert_eq!(status("livee").as_deref(), Some(STATUS_ONLINE), "session-backed stays online"); - assert_eq!(set.len(), 1, "only the session-backed endpoint is hosted (no phantom revival)"); + assert_eq!( + status("livee").as_deref(), + Some(STATUS_ONLINE), + "session-backed stays online" + ); + assert_eq!( + set.len(), + 1, + "only the session-backed endpoint is hosted (no phantom revival)" + ); set.stop_host("livee"); // teardown the driver thread }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1815: std::fs::create_dir_all(&lp).unwrap(); spt_store::info::write_info( &lp, - &spt_store::info::InfoJson::new("liveparent", "0", std::process::id(), "sid", "live_agent"), + &spt_store::info::InfoJson::new( + "liveparent", + "0", + std::process::id(), + "sid", + "live_agent", + ), ) .unwrap(); spt_store::info::set_status(&lp, STATUS_ONLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1871: let perch = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); // controllable NOT set (bind has not run yet — this is the skeleton). - let rec = spt_store::info::InfoJson::new( - id, "t", std::process::id(), "", "live_agent", - ); + let rec = + spt_store::info::InfoJson::new(id, "t", std::process::id(), "", "live_agent"); spt_store::info::write_info(&perch, &rec).unwrap(); spt_store::info::set_status(&perch, STATUS_UNBOUND).unwrap(); }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1923: fn reconcile_converges_a_dead_relay_and_spares_a_live_or_unproven_one() { with_home(|_| { let owlery = perch::owlery_dir(); - let addr = |port: u16| { - std::net::SocketAddr::from(([127, 0, 0, 1], port)) - }; + let addr = |port: u16| std::net::SocketAddr::from(([127, 0, 0, 1], port)); // A harness-hosted live-agent row: status=online (stamped by its own // `api listen`), controllable NOT Some(true) (no broker PTY), a // registered relay address and a ready marker — the full ONLINE Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:1952: }; const DEAD_PID: u32 = 2_000_000_000; // never a real allocation - seed_relay("relay-dead", spt_store::info::PidValue::Numeric(DEAD_PID), 51001); seed_relay( + "relay-dead", + spt_store::info::PidValue::Numeric(DEAD_PID), + 51001, + ); + seed_relay( "relay-live", spt_store::info::PidValue::Numeric(std::process::id()), 51002, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2007: Some(STATUS_ONLINE), "{spared}: a relay that is not PROVABLY gone stays online" ); - assert_eq!(rest.as_deref(), Some("active"), "{spared}: rest intent untouched"); + assert_eq!( + rest.as_deref(), + Some("active"), + "{spared}: rest intent untouched" + ); assert!(ready, "{spared}: ready marker preserved"); assert!(address, "{spared}: relay address preserved"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2025: // The spt-hosted perch on disk (online-latched, controllable). let perch = perch::resolve_perch_path("wallb", ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = - spt_store::info::InfoJson::new("wallb", "t", std::process::id(), "sid", "live_agent"); + let mut rec = spt_store::info::InfoJson::new( + "wallb", + "t", + std::process::id(), + "sid", + "live_agent", + ); rec.controllable = Some(true); spt_store::info::write_info(&perch, &rec).unwrap(); spt_store::info::set_status(&perch, STATUS_ONLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2092: // Kill the session; wait for the exit-waiter to reap it from the table. brain.kill_session().unwrap(); assert!( - wait_until(Duration::from_secs(5), || !session_set(&mut brain).contains("wallb")), + wait_until(Duration::from_secs(5), || !session_set(&mut brain) + .contains("wallb")), "killed session leaves the broker table" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2099: // Now the pull reconcile clears the latch → offline. let live2 = session_set(&mut brain); let offlined = reconcile_hosted_liveness(&perch::owlery_dir(), &live2); - assert_eq!(offlined, vec!["wallb".to_string()], "dead-session perch offlined"); assert_eq!( + offlined, + vec!["wallb".to_string()], + "dead-session perch offlined" + ); + assert_eq!( status("wallb").as_deref(), Some(spt_store::liveness::STATUS_OFFLINE), "the status=online latch is cleared once the broker session is gone" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2236: &cfg, StartReason::Crash, ); - assert_eq!(second.len(), 1, "a fresh brain re-hosts the online endpoint"); + assert_eq!( + second.len(), + 1, + "a fresh brain re-hosts the online endpoint" + ); set_then_teardown(&second); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2337: } std::thread::sleep(std::time::Duration::from_millis(20)); } - assert!(removed, "could not remove the perch dir for the torn-down case"); + assert!( + removed, + "could not remove the perch dir for the torn-down case" + ); run(); assert!(set.is_empty(), "a gone perch dir un-hosts the driver"); }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2398: let _ = sibling.kill(); let _ = sibling.wait(); - assert!(real, "the real {{id}} legacy wrapper (basename + cmdline match) is reapable"); assert!( + real, + "the real {{id}} legacy wrapper (basename + cmdline match) is reapable" + ); + assert!( spared, "a same-basename sibling with a DIFFERENT id is SPARED — no wrong-kill on a shared box" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2429: seed(".live-bin"); seed(".live-bin.old-0"); gc_live_bin_dirs(owlery.path()); - assert!(!perch.join(".live-bin").exists(), "the stranded .live-bin own-copy is GC'd at brain start"); - assert!(!perch.join(".live-bin.old-0").exists(), "prior displaced .live-bin.old litter is swept too"); - assert!(perch.join("info.json").is_file(), "the perch + its info.json are untouched"); + assert!( + !perch.join(".live-bin").exists(), + "the stranded .live-bin own-copy is GC'd at brain start" + ); + assert!( + !perch.join(".live-bin.old-0").exists(), + "prior displaced .live-bin.old litter is swept too" + ); + assert!( + perch.join("info.json").is_file(), + "the perch + its info.json are untouched" + ); // ── Image-locked path: an injected remove that ALWAYS fails → the `.live-bin` is // DISPLACED to a fresh `.live-bin.old*` sibling (not deleted, not errored). ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2438: seed(".live-bin"); gc_live_bin_dirs_with(owlery.path(), &|_| { - Err(std::io::Error::new(std::io::ErrorKind::PermissionDenied, "locked")) + Err(std::io::Error::new( + std::io::ErrorKind::PermissionDenied, + "locked", + )) }); assert!( !perch.join(".live-bin").exists(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2448: .flatten() .filter(|e| e.file_name().to_string_lossy().starts_with(".live-bin.old")) .collect(); - assert_eq!(displaced.len(), 1, "the locked own-copy is renamed to exactly one fresh .live-bin.old*"); + assert_eq!( + displaced.len(), + 1, + "the locked own-copy is renamed to exactly one fresh .live-bin.old*" + ); // fresh_live_bin_old never renames OVER a still-mapped prior `.old`. let fresh = fresh_live_bin_old(&perch.join(".live-bin")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2516: ); // Woken + registered → Resume{sid,adapter}. assert_eq!( - decide_resume(Some(RestState::Active), false, Some("sid9"), Some("mock"), true), + decide_resume( + Some(RestState::Active), + false, + Some("sid9"), + Some("mock"), + true + ), ResumeAction::Resume { session_id: "sid9".into(), adapter: "mock".into() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2523: } ); // Woken + UNREGISTERED recorded adapter → Refuse naming it + the next action. - match decide_resume(Some(RestState::Active), false, Some("sid9"), Some("ghost"), false) { + match decide_resume( + Some(RestState::Active), + false, + Some("sid9"), + Some("ghost"), + false, + ) { ResumeAction::Refuse(msg) => assert!( msg.contains("ghost") && msg.contains("spt adapter add"), "F-1 refuse names the adapter + next action: {msg}" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2557: "F-1 host_error: {err}" ); assert!(info.status.is_none(), "the resume leg NEVER stamps status"); - assert!(!perch.join(spt_store::resume_custody::RESUME_CUSTODY_FILE).exists(), "refused → no spawn → no resume pid"); + assert!( + !perch + .join(spt_store::resume_custody::RESUME_CUSTODY_FILE) + .exists(), + "refused → no spawn → no resume pid" + ); assert_eq!(set.len(), 0, "nothing hosted"); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2569: with_home(|_| { let perch = perch::resolve_perch_path("cold", ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = - spt_store::info::InfoJson::new("cold", "t", std::process::id(), "sid", "live_agent"); + let mut rec = spt_store::info::InfoJson::new( + "cold", + "t", + std::process::id(), + "sid", + "live_agent", + ); rec.adapter = Some("mock".into()); spt_store::info::write_info(&perch, &rec).unwrap(); crate::resting::write_rest(&perch, RestState::Active, 0).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2585: StartReason::Cold, ); let info = spt_store::info::read_info(&perch).unwrap(); - assert!(info.host_error.is_none(), "no material → benign, not an error"); - assert!(!perch.join(spt_store::resume_custody::RESUME_CUSTODY_FILE).exists(), "no spawn"); + assert!( + info.host_error.is_none(), + "no material → benign, not an error" + ); + assert!( + !perch + .join(spt_store::resume_custody::RESUME_CUSTODY_FILE) + .exists(), + "no spawn" + ); assert_eq!(set.len(), 0); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2609: StartReason::Cold, ); let info = spt_store::info::read_info(&perch).unwrap(); - assert!(info.host_error.is_none(), "not woken → no attempt, no error"); - assert!(!perch.join(spt_store::resume_custody::RESUME_CUSTODY_FILE).exists(), "no spawn"); + assert!( + info.host_error.is_none(), + "not woken → no attempt, no error" + ); + assert!( + !perch + .join(spt_store::resume_custody::RESUME_CUSTODY_FILE) + .exists(), + "no spawn" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\livehost.rs:2722: let pid_model = |state: &str, controllable: Option| { state != LIVE_AGENT_STATE && controllable != Some(true) }; - assert!(pid_model("ready_agent", Some(false)), "listen-born ready listener → PID model"); - assert!(pid_model("ready_agent", None), "legacy None ready row → PID model"); - assert!(pid_model("gateway", Some(false)), "a gateway capability stamp → PID model"); + assert!( + pid_model("ready_agent", Some(false)), + "listen-born ready listener → PID model" + ); + assert!( + pid_model("ready_agent", None), + "legacy None ready row → PID model" + ); + assert!( + pid_model("gateway", Some(false)), + "a gateway capability stamp → PID model" + ); // Broker-session-truth rows: controllable==Some(true) (ANY state) → fall through. assert!( !pid_model("ready_agent", Some(true)), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1475: #[test] fn stream_lifetime_is_additive_and_defaults_durable() { // N-1 payload: no lifetime key → Durable. - let legacy: NetStreamOpenReq = - serde_json::from_value(json!({ "conn_id": 7 })).unwrap(); - assert_eq!(legacy.lifetime, StreamLifetime::Durable, "absent = Durable (N-1)"); + let legacy: NetStreamOpenReq = serde_json::from_value(json!({ "conn_id": 7 })).unwrap(); + assert_eq!( + legacy.lifetime, + StreamLifetime::Durable, + "absent = Durable (N-1)" + ); // Durable encodes with the key ABSENT (byte-identical to N-1). let durable = serde_json::to_value(NetStreamOpenReq { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1648: let back: EndpointInputReq = serde_json::from_value(serde_json::to_value(&req).unwrap()).unwrap(); assert_eq!(back.endpoint, "wall-b"); - assert_eq!(decode_bytes(&back.data_b64).unwrap(), decode_bytes(&req.data_b64).unwrap()); + assert_eq!( + decode_bytes(&back.data_b64).unwrap(), + decode_bytes(&req.data_b64).unwrap() + ); let env = endpoint_injected_envelope("wall-b", true, false); assert_eq!(env.kind, KIND_ENDPOINT_INJECTED); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1752: serde_json::from_value(endpoint_injected_envelope("wall-b", false, false).payload) .unwrap(); assert!(!idle.delivered); - assert!(!idle.spool_deferred, "an IDLE-window spool hint is non-deferred (relay wakes)"); + assert!( + !idle.spool_deferred, + "an IDLE-window spool hint is non-deferred (relay wakes)" + ); // Delivered: delivered=true (spool_deferred ignored). let delivered: EndpointInjected = Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1759: serde_json::from_value(endpoint_injected_envelope("wall-b", true, false).payload) .unwrap(); - assert!(delivered.delivered, "a binary-delivered reply carries delivered=true"); + assert!( + delivered.delivered, + "a binary-delivered reply carries delivered=true" + ); // N-1: an old broker omits `spool_deferred` → serde-defaults to false. let n1: EndpointInjected = Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1799: // An EVEN older brain (pre-op_id too — only the two original fields). let oldest = json!({ "session_id": 1, "data_b64": encode_bytes(b"x") }); let req: InputReq = serde_json::from_value(oldest).unwrap(); - assert!(req.ack, "the oldest `input` shape still defaults to ack=true"); + assert!( + req.ack, + "the oldest `input` shape still defaults to ack=true" + ); assert_eq!(req.op_id, None); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1829: "ack=false must be serialized explicitly" ); let back: InputReq = serde_json::from_value(wire).unwrap(); - assert!(!back.ack, "ack=false survives the round-trip (no default clobber)"); + assert!( + !back.ack, + "ack=false survives the round-trip (no default clobber)" + ); assert_eq!(back.op_id, Some(42)); // And the acked direction round-trips as `true`. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\msg.rs:1840: minter: None, ack: true, }; - let back: InputReq = - serde_json::from_value(serde_json::to_value(&acked).unwrap()).unwrap(); + let back: InputReq = serde_json::from_value(serde_json::to_value(&acked).unwrap()).unwrap(); assert!(back.ack, "ack=true round-trips as true"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:44: use crate::broker::SharedSend; use crate::effect::Minter; -use crate::seedproofx::{prove_membership, MembershipSource, RosterExchange}; use crate::frame::Envelope; use crate::msg::{ net_presence_event_envelope, net_stream_data_envelope, net_stream_eof_envelope, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:51: - NetPresenceEvent, NetStreamInfo, PRESENCE_CONNECTED, PRESENCE_DIAL_FAILED, PRESENCE_DISCONNECTED, + NetPresenceEvent, NetStreamInfo, PRESENCE_CONNECTED, PRESENCE_DIAL_FAILED, + PRESENCE_DISCONNECTED, }; +use crate::seedproofx::{prove_membership, MembershipSource, RosterExchange}; /// The reserved [`crate::effect::EffectKey`] session namespace for net-scoped /// effects (a dial has no PTY session). Broker session ids are minted from 1 Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:674: /// reply used to carry — now it rides the presence stream so the pump seeds /// `peer-addrs.json` from a non-blocking dial the same way. // [impl->REQ-CONV-1] - fn append_connected(&mut self, conn_id: u64, remote_id_hex: &str, remote_addr: serde_json::Value) { + fn append_connected( + &mut self, + conn_id: u64, + remote_id_hex: &str, + remote_addr: serde_json::Value, + ) { self.push(NetPresenceEvent { seq: 0, kind: PRESENCE_CONNECTED.to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:946: stage, ) .await - .ok_or_else(|| { - io::Error::other("seed-proof failed: peer is not a subnet member") - })? + .ok_or_else(|| io::Error::other("seed-proof failed: peer is not a subnet member"))? } None => HashSet::new(), }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:1573: .presence .lock() .unwrap() - .append_dial_failed( - &remote_id_hex, - format!("stage={}: {e}", stage.current()), - ); + .append_dial_failed(&remote_id_hex, format!("stage={}: {e}", stage.current())); } }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:1602: /// the `apply_once` closure, so a concurrent deduped replay always finds it). /// The `minter` matches the journal key the broker built (ADR-0034 namespacing). pub fn record_dial_op(&self, minter: Minter, op_id: u64, conn_id: u64) { - self.dial_ops.lock().unwrap().insert((minter, op_id), conn_id); + self.dial_ops + .lock() + .unwrap() + .insert((minter, op_id), conn_id); } /// The connection a journaled dial `(minter, op_id)` opened, if this broker Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2113: // A replay write failure poisons the seat writer-side; the next // producer enqueue halt-and-removes it (the T1 discipline). // [impl->REQ-STREAMLOG-SUBSCRIBER-DISCIPLINE] - log.lock().unwrap().begin_attach(Arc::clone(&sub), from_seq)?; + log.lock() + .unwrap() + .begin_attach(Arc::clone(&sub), from_seq)?; Ok(()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2358: assert_eq!(host.conn_count(), 1, "one loopback conn held"); // open_stream mints the cross-wired pair: operator row + peer row. - let op_stream = host.open_stream(c1, crate::msg::StreamLifetime::Durable).expect("open loopback stream"); + let op_stream = host + .open_stream(c1, crate::msg::StreamLifetime::Durable) + .expect("open loopback stream"); let infos = host.stream_infos(); assert_eq!(infos.len(), 2, "operator + peer rows"); let op = infos Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2461: ret.append(&[i]); } let (bytes, finished) = ret.drain(); - assert_eq!(bytes, (0..8u8).collect::>(), "retentive loses nothing, in order"); + assert_eq!( + bytes, + (0..8u8).collect::>(), + "retentive loses nothing, in order" + ); assert!(!finished); // …and a second drain is empty (the cursor consumed them exactly once). assert_eq!(ret.drain().0, Vec::::new()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2472: for i in 0..8u8 { ord.append(&[i]); } - assert_eq!(ord.drain().0, vec![5, 6, 7], "ordinary keeps only the last cap chunks"); + assert_eq!( + ord.drain().0, + vec![5, 6, 7], + "ordinary keeps only the last cap chunks" + ); } // [unit->REQ-SHELL-4] the loopback tunnel pair under BACKPRESSURE (M11-W3, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2602: assert_eq!(log.opener_line(), None, "no newline yet: not pinned"); log.append(b"est\",\"session_id\":3}\n{\"kind\":\"input\"}\n"); let want = &b"{\"kind\":\"request\",\"session_id\":3}"[..]; - assert_eq!(log.opener_line().as_deref(), Some(want), "split line reassembled + pinned"); + assert_eq!( + log.opener_line().as_deref(), + Some(want), + "split line reassembled + pinned" + ); for i in 0..64u32 { log.append(format!("{{\"kind\":\"input\",\"n\":{i}}}\n").as_bytes()); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2609: - assert!(log.floor_seq() > 0, "the bounded ring rolled: seq 0 evicted"); + assert!( + log.floor_seq() > 0, + "the bounded ring rolled: seq 0 evicted" + ); assert_eq!( log.opener_line().as_deref(), Some(want), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2622: fn opener_capture_gives_up_bounded_on_a_newline_less_stream() { let mut log = StreamLog::new(8, 4); log.append(&vec![b'x'; OPENER_PIN_MAX + 1]); - assert_eq!(log.opener_line(), None, "over the cap without a newline: gave up"); + assert_eq!( + log.opener_line(), + None, + "over the cap without a newline: gave up" + ); log.append(b"late-line\n"); assert_eq!(log.opener_line(), None, "Oversize is terminal"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2709: String::from_utf8_lossy(&got).contains("\"outcome\":\"edge\""), "the reply flushed through the retired row (got {got:?})" ); - assert!(finished, "the reply's FIN reached the requester side (clean end, not torn)"); + assert!( + finished, + "the reply's FIN reached the requester side (clean end, not torn)" + ); } // [unit->REQ-REDISPATCH-FINISHED-RETIRE] a dead CONNECTION retires its Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2721: let a = NetHost::start(hermetic(&Identity::generate())).expect("host a"); let b = NetHost::start(hermetic(&Identity::generate())).expect("host b"); let (conn_id, _) = a.dial(b.addr()).expect("dial"); - let sid = a.open_stream(conn_id, crate::msg::StreamLifetime::Durable).expect("open stream"); + let sid = a + .open_stream(conn_id, crate::msg::StreamLifetime::Durable) + .expect("open stream"); a.send_stream(sid, b"{\"hello\":1}\n", false).expect("send"); // B's acceptor registers the peer row (async — poll). let mut saw = false; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2744: } std::thread::sleep(Duration::from_millis(10)); } - assert!(swept, "the closed-watcher swept the dead conn's stream rows"); + assert!( + swept, + "the closed-watcher swept the dead conn's stream rows" + ); } // ── ADR-0038 Amendment fixes 2+3+4 — the subscriber-seat discipline at Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2820: // The next producer append sees the poisoned seat: halt-and-remove + // lease cancel — never another write attempt against the dead conn. log.append(b"two"); - assert!(log.subscriber.is_none(), "halt-and-remove at the append site"); - assert!(lease.is_canceled(), "poison cancels the serve lease (fix 4)"); + assert!( + log.subscriber.is_none(), + "halt-and-remove at the append site" + ); + assert!( + lease.is_canceled(), + "poison cancels the serve lease (fix 4)" + ); // Later appends stay seatless (no reinstall, no panic, no re-feed). log.append(b"three"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2831: // RENEWS the lease — the old worker's handle stays canceled, fresh // sends serve again. One poison never permanently dead-ends a stream. let (fresh, _cf, _rf) = seat_socket_pair(Duration::from_secs(5)); - log.begin_attach(Arc::clone(&fresh), 0).expect("new generation attaches"); + log.begin_attach(Arc::clone(&fresh), 0) + .expect("new generation attaches"); assert!( !log.lease.is_canceled(), "a new subscriber generation renews the serve lease" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2863: log.finish(); assert!(log.finished, "the read side still records its clean end"); - assert!(log.subscriber.is_none(), "halt-and-remove at the finish site"); - assert!(lease.is_canceled(), "poison at finish cancels the lease too"); + assert!( + log.subscriber.is_none(), + "halt-and-remove at the finish site" + ); + assert!( + lease.is_canceled(), + "poison at finish cancels the lease too" + ); } // [unit->REQ-STREAMLOG-SUBSCRIBER-DISCIPLINE] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2885: log.begin_attach(Arc::clone(&a), 0).expect("first attach"); // Healthy prior → displaced (the legit brain-swap path). - log.begin_attach(Arc::clone(&b), 0).expect("healthy displacement"); + log.begin_attach(Arc::clone(&b), 0) + .expect("healthy displacement"); assert!(log.subscriber.as_ref().unwrap().is(&b)); // Poisoned but NOT gone (writer still draining) → refuse WouldBlock. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2898: assert!(err.to_string().contains("subscriber busy"), "{err}"); // Fully gone → the replacement installs. - log.subscriber.as_ref().unwrap().done.store(true, Ordering::Release); - log.begin_attach(Arc::clone(&a), 0).expect("gone prior admits the replacement"); + log.subscriber + .as_ref() + .unwrap() + .done + .store(true, Ordering::Release); + log.begin_attach(Arc::clone(&a), 0) + .expect("gone prior admits the replacement"); assert!(log.subscriber.as_ref().unwrap().is(&a)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2971: // Pin the wire: nothing the writer does lands until we release. let pin = sub.pin_gate_for_test(); - log.begin_attach(Arc::clone(&sub), 0).expect("attach with a pending replay"); + log.begin_attach(Arc::clone(&sub), 0) + .expect("attach with a pending replay"); // Live appends land while the replay is still entirely undrained. for i in 6..10u8 { log.append(&[i]); // live seqs 6..=9 Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:2983: for want in 0u64..10 { let env = crate::codec::read_frame(&mut client).expect("frame on the wire"); assert_eq!(env.kind, crate::msg::KIND_NET_STREAM_DATA); - let seq = env.payload.get("seq").and_then(|v| v.as_u64()).expect("seq"); + let seq = env + .payload + .get("seq") + .and_then(|v| v.as_u64()) + .expect("seq"); assert_eq!( seq, want, "replay-then-live seq order must be structural; a live frame \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:3016: log.append(b"queued-for-the-displaced-writer"); // HEALTHY displacement: B takes the seat (the brain-swap contract). - log.begin_attach(Arc::clone(&b), 0).expect("healthy displacement"); + log.begin_attach(Arc::clone(&b), 0) + .expect("healthy displacement"); let lease_b = Arc::clone(&log.lease); assert!( !Arc::ptr_eq(&lease_a, &lease_b), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:3097: let (owner, _shell) = host.open_loopback_pair().expect("open pair"); let lease = host.stream_lease(owner).expect("lease handle"); assert!(!lease.is_canceled()); - host.send_stream(owner, b"ok", false).expect("a live lease serves"); + host.send_stream(owner, b"ok", false) + .expect("a live lease serves"); lease.cancel(); let err = host Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:3158: let _ = shell; let (a, _ca, _ra) = seat_socket_pair(Duration::from_secs(5)); - host.subscribe_stream(owner, Arc::clone(&a), 0).expect("A subscribes"); + host.subscribe_stream(owner, Arc::clone(&a), 0) + .expect("A subscribes"); let (_, seats) = host.stream_counts(); assert_eq!(seats, 1, "A's seat installed"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:3178: // Identity rule: B displaces A; A's late unsubscribe must NOT evict B. let (a2, _ca2, _ra2) = seat_socket_pair(Duration::from_secs(5)); let (b, _cb, _rb) = seat_socket_pair(Duration::from_secs(5)); - host.subscribe_stream(owner, Arc::clone(&a2), 0).expect("A2 subscribes"); - host.subscribe_stream(owner, Arc::clone(&b), 0).expect("B displaces A2"); + host.subscribe_stream(owner, Arc::clone(&a2), 0) + .expect("A2 subscribes"); + host.subscribe_stream(owner, Arc::clone(&b), 0) + .expect("B displaces A2"); assert!( !host.unsubscribe_stream(owner, &a2), "a displaced caller's release is a no-op" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\nethost.rs:3202: // the retired_row_still_flushes_a_late_reply contract above). let (owner, shell) = host.open_loopback_pair().expect("pair 1"); let (sub, _c, _r) = seat_socket_pair(Duration::from_secs(5)); - host.subscribe_stream(shell, Arc::clone(&sub), 0).expect("subscribe"); + host.subscribe_stream(shell, Arc::clone(&sub), 0) + .expect("subscribe"); let (rows_before, seats_before) = host.stream_counts(); assert_eq!(seats_before, 1); assert!(host.retire_stream(shell)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:280: crate::presence::most_recently_active_on_node(owlery, local_node, policy, &row.subnet) } NotifScope::Subnet => crate::presence::most_recently_active_in_subnet( - owlery, regs, local_node, policy, &row.subnet, + owlery, + regs, + local_node, + policy, + &row.subnet, ), }; let Some(target) = target else { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1135: // [unit->REQ-NOTIF-SCOPE] [unit->REQ-NOTIF-COALESCE] assert_eq!(row.scope, spt_store::notif::NotifScope::Node); assert_eq!(row.coalesce_key.as_deref(), Some(NOTIF_KEY_ROLLBACK)); - assert!(row.body.contains("v9 failed"), "names the quarantined version"); - assert!(row.body.contains("rolled back to v8"), "names the running version"); + assert!( + row.body.contains("v9 failed"), + "names the quarantined version" + ); + assert!( + row.body.contains("rolled back to v8"), + "names the running version" + ); assert_eq!( fired, FirstFireOutcome::Fired { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1342: let s = store(home); let mut e = epochs(home); let (_row, fired) = produce_and_first_fire( - &s, "cafe", &mut e, "home", NOTIF_KIND_AGENT, "issuer", "quiet", - &home_policy(), &owlery, 1_000, + &s, + "cafe", + &mut e, + "home", + NOTIF_KIND_AGENT, + "issuer", + "quiet", + &home_policy(), + &owlery, + 1_000, ) .unwrap(); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1350: - matches!(fired, FirstFireOutcome::Fired { delivery: SendOutcome::Queued, .. }), + matches!( + fired, + FirstFireOutcome::Fired { + delivery: SendOutcome::Queued, + .. + } + ), "quiet delivery is always Queued (spool), never a live Sent: {fired:?}" ); // The live event-stream drain sees NOTHING (active_only never rides Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1357: "active_only notif is not on the live stream — no PTY interrupt" ); // ...but the hook-channel drain surfaces it at the boundary. - assert_eq!(spool::drain_all_at(&ling).unwrap().len(), 1, "surfaces at drain"); + assert_eq!( + spool::drain_all_at(&ling).unwrap().len(), + 1, + "surfaces at drain" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1402: let mut e = epochs(home); let row = s .produce_scoped( - "cafe", &mut e, "home", NOTIF_KIND_CONSENT, "spt-update", "staged", - spt_store::notif::NotifScope::Node, Some(NOTIF_KEY_UPDATE_STAGED), None, + "cafe", + &mut e, + "home", + NOTIF_KIND_CONSENT, + "spt-update", + "staged", + spt_store::notif::NotifScope::Node, + Some(NOTIF_KEY_UPDATE_STAGED), + None, ) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1417: }, "node-scoped fires to the local endpoint, never RemoteTarget" ); - assert_eq!(spool::drain_all_at(&ling).unwrap().len(), 1, "delivered locally"); + assert_eq!( + spool::drain_all_at(&ling).unwrap().len(), + 1, + "delivered locally" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1435: let mut e = epochs(home); let expired = s .produce_scoped( - "cafe", &mut e, "home", NOTIF_KIND_AGENT, "issuer", "stale", - spt_store::notif::NotifScope::Subnet, None, Some(1_000), + "cafe", + &mut e, + "home", + NOTIF_KIND_AGENT, + "issuer", + "stale", + spt_store::notif::NotifScope::Subnet, + None, + Some(1_000), ) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1443: // now_ms past the expiry: the per-subnet sweep dismisses it, so the // undismissed working set is empty and nothing surfaces. - let out = - resurface_at_boundary(&s, "doyle", &home_policy(), &owlery, 5_000, SUPPRESSION_WINDOW_MS) - .unwrap(); + let out = resurface_at_boundary( + &s, + "doyle", + &home_policy(), + &owlery, + 5_000, + SUPPRESSION_WINDOW_MS, + ) + .unwrap(); assert!(out.is_empty(), "expired row swept before undismissed read"); assert!( s.get(&expired.notif_id).unwrap().unwrap().dismissed, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notif.rs:1470: let mut e = epochs(home); let row = s .produce_scoped( - "cafe", &mut e, "home", NOTIF_KIND_AGENT, "issuer", "stale", - spt_store::notif::NotifScope::Subnet, None, Some(1_000), + "cafe", + &mut e, + "home", + NOTIF_KIND_AGENT, + "issuer", + "stale", + spt_store::notif::NotifScope::Subnet, + None, + Some(1_000), ) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notifgate.rs:234: fn distinct_notifs_both_deliver() { let mut seen = HashSet::new(); let live = |_: &str| true; - assert_eq!(classify(¬ify("a:1", "one"), &mut seen, live), Verdict::Deliver); - assert_eq!(classify(¬ify("b:2", "two"), &mut seen, live), Verdict::Deliver); + assert_eq!( + classify(¬ify("a:1", "one"), &mut seen, live), + Verdict::Deliver + ); + assert_eq!( + classify(¬ify("b:2", "two"), &mut seen, live), + Verdict::Deliver + ); } // [unit->REQ-NOTIF-DRAIN-ROW-VALIDITY] retain_deliverable keeps ORDER and Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notifsync.rs:266: let mut epochs = EpochSource::load_from(&dir.path().join("a-epoch")); let subnet_row = a - .produce("nodea", &mut epochs, "home", "agent", "doyle", "subnet-fact") + .produce( + "nodea", + &mut epochs, + "home", + "agent", + "doyle", + "subnet-fact", + ) .unwrap(); let node_row = a .produce_scoped( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notifsync.rs:273: - "nodea", &mut epochs, "home", "consent", "spt-update", "node-fact", - NotifScope::Node, Some("spt-core:update-staged"), None, + "nodea", + &mut epochs, + "home", + "consent", + "spt-update", + "node-fact", + NotifScope::Node, + Some("spt-core:update-staged"), + None, ) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notifsync.rs:280: .iter() .map(|NotifRecord::Row { row }| row.notif_id.as_str()) .collect(); - assert_eq!(ids, vec![subnet_row.notif_id.as_str()], "only the subnet-scoped row"); - assert!(!ids.contains(&node_row.notif_id.as_str()), "node-scoped excluded"); + assert_eq!( + ids, + vec![subnet_row.notif_id.as_str()], + "only the subnet-scoped row" + ); + assert!( + !ids.contains(&node_row.notif_id.as_str()), + "node-scoped excluded" + ); // And it truly never materializes at a peer that applies the feed. let b = store(dir.path(), "b.db"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\notifsync.rs:288: let policy_b = trusting(&["home"], "nodea-hex"); apply_notif_feed(&b, "nodea-hex", &records, &policy_b).unwrap(); - assert!(b.get(&node_row.notif_id).unwrap().is_none(), "peer never sees it"); + assert!( + b.get(&node_row.notif_id).unwrap().is_none(), + "peer never sees it" + ); assert_eq!(b.list("home").unwrap().len(), 1); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pairhost.rs:762: let v = meet_failure_detail("IPv4-only", "meet probe timed out", 4, 75, 75, clock, true); assert!(v.contains("4 rendezvous attempt"), "attempt count: {v}"); assert!(v.contains("75s"), "elapsed/deadline: {v}"); - assert!(v.contains("bound families: IPv4-only"), "families (ties W1): {v}"); - assert!(v.contains("last error: meet probe timed out"), "last error kept: {v}"); + assert!( + v.contains("bound families: IPv4-only"), + "families (ties W1): {v}" + ); + assert!( + v.contains("last error: meet probe timed out"), + "last error kept: {v}" + ); // REQ-JOIN-VERBOSE-CLOCK: the joiner's step, signed offset, and // correction state all carried in the verbose block. assert!(v.contains("joiner clock:"), "clock line present: {v}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pairhost.rs:853: ) .await; assert_eq!(got, Ok(7u32), "the post-refresh final sweep lands"); - assert_eq!(calls.get(), 2, "one exhausting probe + one post-refresh retry"); - assert!(refreshed.get(), "the refresh hook fired between the two probes"); + assert_eq!( + calls.get(), + 2, + "one exhausting probe + one post-refresh retry" + ); + assert!( + refreshed.get(), + "the refresh hook fired between the two probes" + ); } // [unit->REQ-HAZARD-CEREMONY-CLOCK-STEP] and if the final post-refresh sweep Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pairhost.rs:878: ) .await; assert_eq!(got, Err("dead subnet"), "exhaustion error preserved"); - assert_eq!(calls.get(), 2, "exhausting probe + one final retry, then stop"); + assert_eq!( + calls.get(), + 2, + "exhausting probe + one final retry, then stop" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:244: generated_ms: current.as_ref().map(|i| i.generated_ms).unwrap_or(0), source_generation: last_fingerprint.clone(), pending_refresh: true, // the boot reconcile is queued by definition - endpoints: current.as_ref().map(|i| i.endpoints.len() as u64).unwrap_or(0), + endpoints: current + .as_ref() + .map(|i| i.endpoints.len() as u64) + .unwrap_or(0), ..IndexWriterStats::default() }; stats.projects = current Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:280: // re-derives them exactly once. // [impl->REQ-PROJECT-INDEX-INVALIDATION] for cwd in &req.cwds { - self.cwd_cache.remove(&projderive::normalize_path(Path::new(cwd))); + self.cwd_cache + .remove(&projderive::normalize_path(Path::new(cwd))); } // ── 1. ONE branch enumeration → fingerprint ────────────────────── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:311: && req.cwds.is_empty() && self.current.is_some() { - let report = CycleReport { counters, published: false, skipped_unchanged: true }; + let report = CycleReport { + counters, + published: false, + skipped_unchanged: true, + }; self.finish_cycle(&report, now, started.elapsed()); return Ok(report); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:322: .filter_map(|(b, _)| b.strip_prefix("p-").map(|p| (p.to_string(), b.clone()))) .collect(); if let (false, Some(store)) = (self.branch_order.is_empty(), &store) { - let live: BTreeSet<&str> = - self.branch_order.iter().map(|(_, b)| b.as_str()).collect(); + let live: BTreeSet<&str> = self.branch_order.iter().map(|(_, b)| b.as_str()).collect(); self.branch_cache.retain(|b, _| live.contains(b.as_str())); for (branch, tip) in tips.iter().filter(|(b, _)| b.starts_with("p-")) { let cached = self.branch_cache.get(branch); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:341: (rest == PROJECT_CONTEXT_FILE).then(|| id.to_string()) }) .collect(); - self.branch_cache - .insert(branch.clone(), BranchScan { tip: tip.clone(), members }); + self.branch_cache.insert( + branch.clone(), + BranchScan { + tip: tip.clone(), + members, + }, + ); } } else { self.branch_cache.clear(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:364: req.endpoints .iter() .filter_map(|id| { - by_id.get(id).map(|(p, c)| (id.clone(), p.clone(), c.clone())) + by_id + .get(id) + .map(|(p, c)| (id.clone(), p.clone(), c.clone())) }) .collect() }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:392: let (id, display) = spt_store::project::project_id_and_display_for_dir(dir); cache.insert( key, - CwdDerivation { id: id.clone(), display: display.clone(), marker, stamp }, + CwdDerivation { + id: id.clone(), + display: display.clone(), + marker, + stamp, + }, ); (id, display) }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:400: let mut endpoints: BTreeMap = if full { BTreeMap::new() } else { - self.current.as_ref().map(|i| i.endpoints.clone()).unwrap_or_default() + self.current + .as_ref() + .map(|i| i.endpoints.clone()) + .unwrap_or_default() }; if !full { // A scoped id whose perch vanished (purge) drops its row — the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:472: let mut cwds: BTreeMap = if full { BTreeMap::new() } else { - self.current.as_ref().map(|i| i.cwds.clone()).unwrap_or_default() + self.current + .as_ref() + .map(|i| i.cwds.clone()) + .unwrap_or_default() }; for (norm, entry) in self.cwd_cache.iter() { if !entry.id.is_empty() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:479: cwds.insert( norm.clone(), - projindex::CwdProject { id: entry.id.clone(), display: entry.display.clone() }, + projindex::CwdProject { + id: entry.id.clone(), + display: entry.display.clone(), + }, ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:504: self.stats.projects = distinct_projects(&index) as u64; self.current = Some(index); - let report = CycleReport { counters, published: true, skipped_unchanged: false }; + let report = CycleReport { + counters, + published: true, + skipped_unchanged: false, + }; self.finish_cycle(&report, now, started.elapsed()); Ok(report) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:637: // Boot reconcile: global but NOT forced — a warm start over an // unchanged store exits without a scan (the cold/warm start gate). let boot = projinval::coalesce(projinval::drain_at(&engine.paths.invalidations_dir)); - let boot = Coalesced { global: true, ..boot }; + let boot = Coalesced { + global: true, + ..boot + }; if let Err(e) = engine.reconcile(&boot, false) { engine.record_failure(e); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:674: if due_periodic { since_periodic = Duration::ZERO; } - let req = if due_periodic { Coalesced { global: true, ..req } } else { req }; + let req = if due_periodic { + Coalesced { + global: true, + ..req + } + } else { + req + }; if req.is_empty() && !due_periodic { continue; // a racer consumed it (never happens in production) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:713: invalidations_dir: home.join("index").join("invalidations"), }; std::fs::create_dir_all(&paths.owlery).unwrap(); - Fixture { _tmp: tmp, home, paths } + Fixture { + _tmp: tmp, + home, + paths, + } } fn store(&self) -> ContextStore { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:748: let cs = self.store(); let file = cs.project_context_path(project, id).unwrap(); std::fs::write(&file, format!("{id} in {project}")).unwrap(); - cs.commit_project(project, &format!("{id} slice")).unwrap().unwrap(); + cs.commit_project(project, &format!("{id} slice")) + .unwrap() + .unwrap(); } /// A plain (non-git) project dir whose folder name becomes the id. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:760: } fn global() -> Coalesced { - Coalesced { global: true, ..Coalesced::default() } + Coalesced { + global: true, + ..Coalesced::default() + } } // [unit->REQ-PROJECT-INDEX-WRITER] THE complexity-counter gate (the CI gate Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:787: assert!(r1.published); assert_eq!( r1.counters, - CycleCounters { branch_enumerations: 1, tree_scans: 2, derivations: 2 }, + CycleCounters { + branch_enumerations: 1, + tree_scans: 2, + derivations: 2 + }, "cold cycle: one enumeration, one scan per p-* branch, one derivation per distinct cwd" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:797: assert!(r2.published); assert_eq!( r2.counters, - CycleCounters { branch_enumerations: 1, tree_scans: 0, derivations: 0 }, + CycleCounters { + branch_enumerations: 1, + tree_scans: 0, + derivations: 0 + }, "warm full cycle: caches absorb every scan and derivation" ); - assert_eq!(engine.stats.cwd_cache_hits, 2, "both cwds re-answered from cache"); + assert_eq!( + engine.stats.cwd_cache_hits, 2, + "both cwds re-answered from cache" + ); // One branch moves → exactly ONE rescan (≤1 tree scan per CHANGED branch). fx.membership("alpha", "ep3"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:848: // The restarted brain: fresh engine, warm disk. let mut warm = WriterEngine::new(fx.paths.clone()); let r = warm.reconcile(&global(), false).unwrap(); - assert!(r.skipped_unchanged, "unchanged generation → the boot reconcile is a no-op"); + assert!( + r.skipped_unchanged, + "unchanged generation → the boot reconcile is a no-op" + ); assert!(!r.published); assert_eq!( r.counters, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:855: - CycleCounters { branch_enumerations: 1, tree_scans: 0, derivations: 0 } + CycleCounters { + branch_enumerations: 1, + tree_scans: 0, + derivations: 0 + } ); assert_eq!( std::fs::read(&fx.paths.index_path).unwrap(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:891: assert_eq!(engine.stats.stale_reads, 1); assert!(engine.stats.last_error.is_some()); let stats = read_stats_at(&fx.paths.stats_path).expect("stats sidecar"); - assert!(stats.last_error.is_some(), "the failure is an observable fact"); + assert!( + stats.last_error.is_some(), + "the failure is an observable fact" + ); assert!(stats.pending_refresh, "the owed work stays visible"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:930: req.endpoints.insert("gone".to_string()); let r = engine.reconcile(&req, false).unwrap(); assert!(r.published); - assert_eq!(r.counters.tree_scans, 0, "unchanged generation: a row patch scans nothing"); - assert_eq!(r.counters.derivations, 0, "proj-a was already in the cwd cache"); + assert_eq!( + r.counters.tree_scans, 0, + "unchanged generation: a row patch scans nothing" + ); + assert_eq!( + r.counters.derivations, 0, + "proj-a was already in the cwd cache" + ); let idx = match projindex::read_index_at(&fx.paths.index_path) { IndexRead::Snapshot(i) => i, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:961: let mut engine = WriterEngine::new(fx.paths.clone()); let r = engine.reconcile(&global(), false).unwrap(); assert!(r.published); - assert_eq!(engine.stats.repairs, 1, "the publish over a torn file is a repair"); + assert_eq!( + engine.stats.repairs, 1, + "the publish over a torn file is a repair" + ); assert!(matches!( projindex::read_index_at(&fx.paths.index_path), IndexRead::Snapshot(_) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1017: ) .unwrap(); let r3 = engine.reconcile(&global(), true).unwrap(); - assert_eq!(r3.counters.derivations, 1, "a .git/config change re-derives exactly once"); + assert_eq!( + r3.counters.derivations, 1, + "a .git/config change re-derives exactly once" + ); let idx = match projindex::read_index_at(&fx.paths.index_path) { IndexRead::Snapshot(i) => i, other => panic!("{other:?}"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1038: let dir_a = fx.project_dir("proj-a"); fx.perch("ep1", None, Some(&dir_a)); let mut engine = WriterEngine::new(fx.paths.clone()); - assert_eq!(engine.reconcile(&global(), false).unwrap().counters.derivations, 1); + assert_eq!( + engine + .reconcile(&global(), false) + .unwrap() + .counters + .derivations, + 1 + ); let mut req = Coalesced::default(); req.endpoints.insert("ep1".to_string()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1078: let stats = || read_stats_at(&stats_path()); let deadline = Instant::now() + Duration::from_secs(10); // Wait for the boot cycle to settle. - while stats().map(|s| s.pending_refresh || s.generated_ms == 0).unwrap_or(true) { + while stats() + .map(|s| s.pending_refresh || s.generated_ms == 0) + .unwrap_or(true) + { assert!(Instant::now() < deadline, "boot cycle never settled"); std::thread::sleep(Duration::from_millis(25)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1133: let repo = fx.project_dir("parity-checkout"); spt_store::gitrun::run_git_ok(&["init", &repo.to_string_lossy()], None, None).unwrap(); spt_store::gitrun::run_git_ok( - &["-C", &repo.to_string_lossy(), "remote", "add", "origin", - "git@example.com:Team/Parity.git"], + &[ + "-C", + &repo.to_string_lossy(), + "remote", + "add", + "origin", + "git@example.com:Team/Parity.git", + ], None, None, ) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1178: .filter_map(|b| { let project = b.strip_prefix("p-")?.to_string(); let rel = format!("{id}/{PROJECT_CONTEXT_FILE}"); - matches!(store.read_at_tip(&b, &rel), Ok(Some(_))) - .then_some(project) + matches!(store.read_at_tip(&b, &rel), Ok(Some(_))).then_some(project) }) .collect() }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1219: .collect() }; - assert_eq!(indexed("ep-a"), oracle_a, "ep-a: full ordered history parity"); + assert_eq!( + indexed("ep-a"), + oracle_a, + "ep-a: full ordered history parity" + ); assert_eq!(indexed("ep-b"), oracle_b, "ep-b: branch-only parity"); assert_eq!(indexed("ep-c"), oracle_c, "ep-c: empty parity"); assert!(oracle_c.is_empty()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1236: // Per-cwd map parity (the resume pane's source): every ledger/origin // cwd resolves to EXACTLY what the legacy per-row derivation rendered. for cwd in [&repo, &plain, &origin_dir] { - let (want_id, want_display) = - spt_store::project::project_id_and_display_for_dir(cwd); + let (want_id, want_display) = spt_store::project::project_id_and_display_for_dir(cwd); let got = idx .project_for_cwd(cwd) .unwrap_or_else(|| panic!("cwd map must hold {cwd:?}")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\projwriter.rs:1244: - assert_eq!((got.id.as_str(), got.display.as_str()), (want_id.as_str(), want_display.as_str())); + assert_eq!( + (got.id.as_str(), got.display.as_str()), + (want_id.as_str(), want_display.as_str()) + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\propagate.rs:354: let opened = brain.net_open_stream(conn_id, Some(open_op))?; let stream_id = opened.stream_id; let out = request_update_on( - brain, stream_id, open_op, running, policy, cache, scratch_dir, + brain, + stream_id, + open_op, + running, + policy, + cache, + scratch_dir, ); // Requester-side lifetime bound (ADR-0040 decisions 1+5) — the // request_sync twin: release the seat + the physical row when the pull Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\psyrelay.rs:347: }] ); assert_eq!(rows[0].from, "doyle-psyche"); - assert!(!rows[0].from.contains("evil-imposter") && !rows[0].body.contains("evil-imposter")); + assert!( + !rows[0].from.contains("evil-imposter") && !rows[0].body.contains("evil-imposter") + ); // The Psyche-addressed target received nothing. assert!(spool::drain_all_at(&victim).unwrap().is_empty()); }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:217: parse_stage("stage=quic-connect: submit-dial exceeded the 10s bound"), "quic-connect" ); - assert_eq!(parse_stage("stage=seed-proof-recv: peer is not a member"), "seed-proof-recv"); + assert_eq!( + parse_stage("stage=seed-proof-recv: peer is not a member"), + "seed-proof-recv" + ); assert_eq!(parse_stage("stage=alpn: connection refused"), "alpn"); assert_eq!(parse_stage("dial failed"), "unknown"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:234: h.set_targets(["a".to_string(), "b".to_string()], 1_000); assert_eq!(h.verdict(), HealthVerdict::Connecting, "nothing failed yet"); - assert!(h.note_failed("a", "quic-connect", 0, 2_000), "new failure logs"); - assert_eq!(h.verdict(), HealthVerdict::Connecting, "one of two failing: not yet the fingerprint"); + assert!( + h.note_failed("a", "quic-connect", 0, 2_000), + "new failure logs" + ); + assert_eq!( + h.verdict(), + HealthVerdict::Connecting, + "one of two failing: not yet the fingerprint" + ); assert!(h.note_failed("b", "quic-connect", 0, 3_000)); match h.verdict() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:242: - HealthVerdict::Degraded { failing, total, stage, since_ms } => { + HealthVerdict::Degraded { + failing, + total, + stage, + since_ms, + } => { assert_eq!((failing, total), (2, 2)); assert_eq!(stage, "quic-connect", "the verdict names the stage"); - assert_eq!(since_ms, Some(3_000), "the window opened at the closing failure"); + assert_eq!( + since_ms, + Some(3_000), + "the window opened at the closing failure" + ); } v => panic!("expected degraded, got {v:?}"), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:249: // Repeated same-stage failures: still degraded, window start UNCHANGED // (duration accumulates), and the repeat is not transition-newsy. - assert!(!h.note_failed("a", "quic-connect", 0, 9_000), "same stage: quiet repeat"); - assert!(matches!(h.verdict(), HealthVerdict::Degraded { since_ms: Some(3_000), .. })); + assert!( + !h.note_failed("a", "quic-connect", 0, 9_000), + "same stage: quiet repeat" + ); + assert!(matches!( + h.verdict(), + HealthVerdict::Degraded { + since_ms: Some(3_000), + .. + } + )); // A stage CHANGE is newsy (the operator learns where it dies now). assert!(h.note_failed("a", "seed-proof-recv", 0, 10_000)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:291: for _ in 0..3 { h.note_registry_admit(None); } - assert_eq!(h.last_registry_admit_ms, Some(1_000), "None keeps the last-good stamp"); + assert_eq!( + h.last_registry_admit_ms, + Some(1_000), + "None keeps the last-good stamp" + ); h.save_to(&path); assert_eq!( PumpHealth::load_from(&path).last_registry_admit_ms, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:301: // A real new admit advances it; an older stamp never regresses it. h.note_registry_admit(Some(2_000)); - assert_eq!(h.last_registry_admit_ms, Some(2_000), "a fresh admit advances"); + assert_eq!( + h.last_registry_admit_ms, + Some(2_000), + "a fresh admit advances" + ); h.note_registry_admit(Some(500)); - assert_eq!(h.last_registry_admit_ms, Some(2_000), "an older stamp never regresses"); + assert_eq!( + h.last_registry_admit_ms, + Some(2_000), + "an older stamp never regresses" + ); } // [unit->REQ-PUMP-STAGE-TRUTH] the snapshot round-trips through disk and Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:312: fn health_file_roundtrip_and_degrade() { let dir = tempfile::tempdir().unwrap(); let path = dir.path().join("pump-health.json"); - assert_eq!(PumpHealth::load_from(&path), PumpHealth::default(), "absent = default"); + assert_eq!( + PumpHealth::load_from(&path), + PumpHealth::default(), + "absent = default" + ); let mut h = PumpHealth::default(); h.set_targets(["a".to_string()], 1); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\health.rs:322: assert_eq!(PumpHealth::load_from(&path), h, "roundtrip"); std::fs::write(&path, "garbage{{{").unwrap(); - assert_eq!(PumpHealth::load_from(&path), PumpHealth::default(), "corrupt = default"); + assert_eq!( + PumpHealth::load_from(&path), + PumpHealth::default(), + "corrupt = default" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:75: use crate::brain::{Brain, BrokerEvent, PEER_REPLY_READ_BUDGET}; use crate::config::DaemonConfig; -use crate::effect::{Minter, MintedOp}; +use crate::effect::{MintedOp, Minter}; use crate::msg::{ NetPresenceEvent, PRESENCE_CONNECTED, PRESENCE_DIAL_FAILED, PRESENCE_DISCONNECTED, }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:89: mod registry; mod sync; mod update; +use notif::NotifWorker; +use registry::RegistryWorker; +use sync::SyncWorker; /// The update-staged notif catch-up dismissal seam (ADR-0046 decision 3) — /// exposed for the seam-dismissal integration test. pub use update::dismiss_staged_notif_if_caught_up; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:95: /// The version-grounded retirement sweep for KEYLESS legacy update rows (W2 /// rider) — the sibling of the key path above, exposed for its rig. pub use update::retire_update_rows_the_running_image_has_passed; -use notif::NotifWorker; -use registry::RegistryWorker; -use sync::SyncWorker; use update::UpdateWorker; /// The pump's tick granularity — each cadence fires when its period elapsed. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:589: let mut registry_worker = RegistryWorker::new(Arc::clone(®istry), paths, &cadence); let mut notif_worker = NotifWorker::new(paths, &cadence); let mut sync_worker = SyncWorker::new(Arc::clone(®istry), paths, &cadence, hooks); - let mut update_worker = UpdateWorker::new(Arc::clone(®istry), paths, &cadence, full_auto_update); + let mut update_worker = + UpdateWorker::new(Arc::clone(®istry), paths, &cadence, full_auto_update); let mut workers: [&mut dyn PumpWorker; 4] = [ &mut registry_worker, &mut notif_worker, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:655: for (peer_hex, subs) in &peer_subnets { if let Some(&conn_id) = conns.get(peer_hex) { run_peer_subnets( - &mut brain, &mut ops, &mut workers, &due_flags, &mut conns, &mut sched, - conn_id, subs, peer_hex, &ctx, round_start, + &mut brain, + &mut ops, + &mut workers, + &due_flags, + &mut conns, + &mut sched, + conn_id, + subs, + peer_hex, + &ctx, + round_start, )?; } else if peer_eligible(&sched, peer_hex, round_start) { if let Some(addr) = Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:722: }; match classify_drain_read(events.read_event_until(Some(read_deadline))) { DrainStep::Apply(ev) => handle_presence_event( - ev, &mut brain, &mut ops, &mut workers, &due_flags, &mut conns, &mut sched, - &mut pending, &peer_subnets, &ctx, &paths.peer_addrs, &mut health, round_start, + ev, + &mut brain, + &mut ops, + &mut workers, + &due_flags, + &mut conns, + &mut sched, + &mut pending, + &peer_subnets, + &ctx, + &paths.peer_addrs, + &mut health, + round_start, )?, DrainStep::Skip => continue, // the event carrier only carries presence DrainStep::RoundDone => break, // quiet (TimedOut) — drain done Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:882: now: Instant, ) -> io::Result<()> { let is_target = peer_subnets.contains_key(&ev.remote_id_hex); - if presence_state_effect(&ev, conns, sched, pending, peer_addrs, health, is_target, now) { + if presence_state_effect( + &ev, conns, sched, pending, peer_addrs, health, is_target, now, + ) { // A CONNECTED peer that is a fan target this round → advertise NOW. if let Some(subs) = peer_subnets.get(&ev.remote_id_hex) { run_peer_subnets( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1438: } } - fn rec(cadence: Duration, wake: bool, log: &Rc>>, tag: char) -> RecordingWorker { + fn rec( + cadence: Duration, + wake: bool, + log: &Rc>>, + tag: char, + ) -> RecordingWorker { RecordingWorker { cadence, wake, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1507: // pre_round once each for the two due workers, never for the not-due one. assert_eq!(l.iter().filter(|e| e.as_str() == "pre:a").count(), 1); assert_eq!(l.iter().filter(|e| e.as_str() == "pre:c").count(), 1); - assert!(!l.iter().any(|e| e == "pre:b"), "not-due leg never pre_rounds"); + assert!( + !l.iter().any(|e| e == "pre:b"), + "not-due leg never pre_rounds" + ); // All pre_rounds precede all peer_steps. let first_step = l.iter().position(|e| e.starts_with("step:")).unwrap(); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1516: ); // peer_step runs for due indices only (0 and 2), once per peer (×2). assert_eq!(l.iter().filter(|e| e.as_str() == "step:0").count(), 2); - assert_eq!(l.iter().filter(|e| e.as_str() == "step:1").count(), 0, "not-due skipped"); + assert_eq!( + l.iter().filter(|e| e.as_str() == "step:1").count(), + 0, + "not-due skipped" + ); assert_eq!(l.iter().filter(|e| e.as_str() == "step:2").count(), 2); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1535: Ok(()) } }); - assert!(res.is_err(), "the failure propagates so the shell drops the conn"); + assert!( + res.is_err(), + "the failure propagates so the shell drops the conn" + ); assert_eq!(seen, vec![0, 1], "aborted before the remaining due worker"); // Skip: a not-due index is never stepped. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1627: // Ordinary error → conn dropped + peer backed off, round continues (Ok). let ordinary = io::Error::other("peer refused the stream"); assert!(peer_leg_outcome(Err(ordinary), "bb", &mut conns, &mut sched, now).is_ok()); - assert!(!conns.contains_key("bb"), "an ordinary failure drops the conn"); assert!( + !conns.contains_key("bb"), + "an ordinary failure drops the conn" + ); + assert!( !peer_eligible(&sched, "bb", now), "and backs the peer off (not eligible until next_due)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1640: "peer never answered the Query", )); assert!(peer_leg_outcome(Err(silent), "aa", &mut conns, &mut sched, now).is_ok()); - assert!(!conns.contains_key("aa"), "a silent peer drops without a round abort"); + assert!( + !conns.contains_key("aa"), + "a silent peer drops without a round abort" + ); // A genuine carrier-op raw TimedOut STILL poisons → supervised restart. let carrier = io::Error::new(io::ErrorKind::TimedOut, "brain IPC carrier desync"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1647: let bubbled = peer_leg_outcome(Err(carrier), "cc", &mut conns, &mut sched, now); - assert!(bubbled.is_err(), "a real carrier desync still restarts the pump"); + assert!( + bubbled.is_err(), + "a real carrier desync still restarts the pump" + ); assert_eq!(bubbled.unwrap_err().kind(), io::ErrorKind::TimedOut); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1674: // Eligibility: no entry = eligible; in-backoff = not until next_due passes. let mut sched: HashMap = HashMap::new(); - assert!(peer_eligible(&sched, "fresh", now), "never-failed peer is eligible"); + assert!( + peer_eligible(&sched, "fresh", now), + "never-failed peer is eligible" + ); sched.insert("dead".into(), next_peer_backoff(None, now)); - assert!(!peer_eligible(&sched, "dead", now), "in backoff → not eligible"); assert!( - peer_eligible(&sched, "dead", now + PEER_BACKOFF_BASE + Duration::from_millis(1)), + !peer_eligible(&sched, "dead", now), + "in backoff → not eligible" + ); + assert!( + peer_eligible( + &sched, + "dead", + now + PEER_BACKOFF_BASE + Duration::from_millis(1) + ), "eligible again once next_due elapses" ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1695: let seeds = dir.path().join("peer-addrs.json"); let mut conns: HashMap = HashMap::new(); let mut sched: HashMap = HashMap::new(); - let mut pending: HashSet = - ["live".to_string(), "dead".to_string()].into_iter().collect(); + let mut pending: HashSet = ["live".to_string(), "dead".to_string()] + .into_iter() + .collect(); let mut health = PumpHealth::default(); let ev = |kind: &str, conn_id: u64, hex: &str| NetPresenceEvent { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1711: // DIAL_FAILED for "dead" → back off, clear pending, no conn, no legs. assert!(!presence_state_effect( &ev(PRESENCE_DIAL_FAILED, 0, "dead"), - &mut conns, &mut sched, &mut pending, &seeds, &mut health, false, now, + &mut conns, + &mut sched, + &mut pending, + &seeds, + &mut health, + false, + now, )); assert!(!peer_eligible(&sched, "dead", now), "dead peer backed off"); assert!(!pending.contains("dead"), "its pending flag cleared"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1718: assert!(!conns.contains_key("dead")); // CONNECTED for "live" that IS a target → cache conn, reset, run legs. - assert!(presence_state_effect( - &ev(PRESENCE_CONNECTED, 9, "live"), - &mut conns, &mut sched, &mut pending, &seeds, &mut health, true, now, - ), "a connected fan-target signals legs-to-run"); + assert!( + presence_state_effect( + &ev(PRESENCE_CONNECTED, 9, "live"), + &mut conns, + &mut sched, + &mut pending, + &seeds, + &mut health, + true, + now, + ), + "a connected fan-target signals legs-to-run" + ); assert_eq!(conns.get("live"), Some(&9), "conn cached under its hex"); assert!(!sched.contains_key("live"), "backoff reset on connect"); assert!(!pending.contains("live")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1728: // CONNECTED for a peer that is NOT a target → cache but DON'T run legs. - assert!(!presence_state_effect( - &ev(PRESENCE_CONNECTED, 5, "bystander"), - &mut conns, &mut sched, &mut pending, &seeds, &mut health, false, now, - ), "a non-target connect caches without running legs"); + assert!( + !presence_state_effect( + &ev(PRESENCE_CONNECTED, 5, "bystander"), + &mut conns, + &mut sched, + &mut pending, + &seeds, + &mut health, + false, + now, + ), + "a non-target connect caches without running legs" + ); assert_eq!(conns.get("bystander"), Some(&5)); // A stale-backoff peer that CONNECTS is immediately hot again (reset). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1737: sched.insert("returner".into(), next_peer_backoff(None, now)); presence_state_effect( &ev(PRESENCE_CONNECTED, 7, "returner"), - &mut conns, &mut sched, &mut pending, &seeds, &mut health, false, now, + &mut conns, + &mut sched, + &mut pending, + &seeds, + &mut health, + false, + now, ); - assert!(peer_eligible(&sched, "returner", now), "a returning peer re-dials promptly"); + assert!( + peer_eligible(&sched, "returner", now), + "a returning peer re-dials promptly" + ); // DISCONNECTED for conn 9 → drop "live"'s conn, NO backoff (redial-eligible). presence_state_effect( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1746: &ev(PRESENCE_DISCONNECTED, 9, "live"), - &mut conns, &mut sched, &mut pending, &seeds, &mut health, false, now, + &mut conns, + &mut sched, + &mut pending, + &seeds, + &mut health, + false, + now, ); assert!(!conns.contains_key("live"), "disconnected conn dropped"); - assert!(peer_eligible(&sched, "live", now), "disconnect → no backoff (Q3)"); + assert!( + peer_eligible(&sched, "live", now), + "disconnect → no backoff (Q3)" + ); } // [unit->REQ-HAZARD-PUMP-IPC-DEADLINE] [unit->REQ-PUMP-PEER-ISOLATION] the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1763: fn drain_read_classifies_dead_carrier_as_restart_timeout_as_quiet() { // A quiet TimedOut closes the round — it is NEVER a restart. assert!(matches!( - classify_drain_read(Err(io::Error::new(io::ErrorKind::TimedOut, "read deadline"))), + classify_drain_read(Err(io::Error::new( + io::ErrorKind::TimedOut, + "read deadline" + ))), DrainStep::RoundDone )); // A dead broker mid-drain: the reader thread ended → UnexpectedEof (or a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:1776: DrainStep::Restart(_) )); assert!(matches!( - classify_drain_read(Err(io::Error::new(io::ErrorKind::BrokenPipe, "broker gone"))), + classify_drain_read(Err(io::Error::new( + io::ErrorKind::BrokenPipe, + "broker gone" + ))), DrainStep::Restart(_) )); // A presence event applies; any other frame kind is skipped. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:2008: // Cache: ab = stale + suspect (the strand shape); cc = valid healthy // (must be untouched); 5f = poison with no roster repair (must drop). let mut pa = PeerAddrStore::default(); - pa.put("ab", serde_json::json!({"id": "ab", "addrs": ["192.168.1.7:1"]})); + pa.put( + "ab", + serde_json::json!({"id": "ab", "addrs": ["192.168.1.7:1"]}), + ); pa.mark_suspect("ab"); let cc_addr = serde_json::json!({"id": "cc", "addrs": ["10.0.0.3:7"]}); pa.put("cc", cc_addr.clone()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:2015: - pa.addrs - .insert("5f".into(), serde_json::json!({"id": "ec", "addrs": ["10.0.0.9:1"]})); + pa.addrs.insert( + "5f".into(), + serde_json::json!({"id": "ec", "addrs": ["10.0.0.9:1"]}), + ); pa.save_to(&paths.peer_addrs).unwrap(); startup_reconcile_peeraddrs(&paths, "self"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\mod.rs:2024: Some(&serde_json::json!({"id": "ab", "addrs": ["10.0.0.2:4711"]})), "the suspect strand healed from the roster, connection-free" ); - assert_eq!(healed.get("cc"), Some(&cc_addr), "valid row untouched by migration"); - assert!(healed.get("5f").is_none(), "unrepairable poison row dropped"); + assert_eq!( + healed.get("cc"), + Some(&cc_addr), + "valid row untouched by migration" + ); + assert!( + healed.get("5f").is_none(), + "unrepairable poison row dropped" + ); } // [unit->REQ-ONEWAY-STREAM-TERMINAL] the sender retires its OWN feed row Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\registry.rs:31: /// handle needed): the daemon re-reads `subnet.json` per connect, so the bump /// takes effect without a restart. // [impl->REQ-MESH-4] -fn fire_due_rotations(subnets_path: &std::path::Path, rotations_path: &std::path::Path, now_ms: u64) { +fn fire_due_rotations( + subnets_path: &std::path::Path, + rotations_path: &std::path::Path, + now_ms: u64, +) { let mut pending = spt_store::rotation::RotationPending::load_from(rotations_path); let due = pending.due_subnets(now_ms); if due.is_empty() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\registry.rs:42: for sub in &due { match subnets.rotate_seed(sub) { Ok(rec) => { - eprintln!("SEED_ROTATED:{sub}:epoch={} (revoke window closed)", rec.epoch); + eprintln!( + "SEED_ROTATED:{sub}:epoch={} (revoke window closed)", + rec.epoch + ); rotated = true; } // The subnet may have been left/renamed since the revoke — drop the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\registry.rs:214: Some(before_home.seed_hex.as_str()), "prior seed retained for the grace" ); - assert_eq!(after.find("work").unwrap().epoch, 1, "not-due subnet untouched"); + assert_eq!( + after.find("work").unwrap().epoch, + 1, + "not-due subnet untouched" + ); let pend = spt_store::rotation::RotationPending::load_from(&rotations_path); assert!(!pend.subnets.contains_key("home"), "fired entry cleared"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\registry.rs:266: spt_store::perch::ParentHint::Infer, ); std::fs::create_dir_all(&p).unwrap(); - let rec = spt_store::info::InfoJson::new( - id, - "now", - std::process::id(), - "s", - "ready_agent", - ); + let rec = + spt_store::info::InfoJson::new(id, "now", std::process::id(), "s", "ready_agent"); spt_store::info::write_info(&p, &rec).unwrap(); let subnets_path = home.join("subnet.json"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\sync.rs:104: } if !want.is_empty() { let open_op = io.open_op()?; - let report = request_sync(&mut *io.brain, io.conn_id, &want, open_op, &cs, &self.scratch)?; + let report = request_sync( + &mut *io.brain, + io.conn_id, + &want, + open_op, + &cs, + &self.scratch, + )?; (self.hooks.on_pull)(peer_hex, &report); } Ok(()) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\update.rs:181: let core = tok.trim_start_matches('v'); core.contains('.') && core.split('.').count() >= 2 - && core.split('.').all(|p| !p.is_empty() && p.chars().all(|c| c.is_ascii_digit())) + && core + .split('.') + .all(|p| !p.is_empty() && p.chars().all(|c| c.is_ascii_digit())) }) .map(str::to_string) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\update.rs:229: retire_update_rows_the_running_image_has_passed(&store, subnet); } let base_policy = VerifyPolicy::load_from(&self.release_keys, 0, now_ms()); - let current = if cache.staged_channel().as_deref() - == Some(base_policy.pinned_channel.as_str()) - { - cache.staged_version().unwrap_or(0) - } else { - 0 - }; + let current = + if cache.staged_channel().as_deref() == Some(base_policy.pinned_channel.as_str()) { + cache.staged_version().unwrap_or(0) + } else { + 0 + }; let policy = VerifyPolicy { current_version: current, ..base_policy Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\update.rs:258: .staged_version() .map(|v| v.to_string()) .unwrap_or_else(|| "?".to_string()); - eprintln!("UPDATE_STAGED:{version}:{:?} (from {})", plan.class, peer_hex); + eprintln!( + "UPDATE_STAGED:{version}:{:?} (from {})", + plan.class, peer_hex + ); // The operator-facing version label: the signed metadata's // semver (`product_version`) when present, else the monotonic // counter — never a bare counter in the consent notif. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\update.rs:398: ); } - // [unit->REQ-NOTIF-SEAM-DISMISS] running-image vs staged product_version: // equal/ahead ⇒ caught up; behind ⇒ not; a leading `v` and a missing patch // parse; garbage on either side is conservatively `false` (never dismiss a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\pump\update.rs:412: assert!(version_ge("0.40", "0.40.0"), "missing patch = .0"); assert!(!version_ge("0.39.4", "0.40.0"), "behind"); assert!(!version_ge("0.39.4", ""), "empty staged pv false"); - assert!(!version_ge("not-a-version", "0.40.0"), "garbage running false"); + assert!( + !version_ge("not-a-version", "0.40.0"), + "garbage running false" + ); assert!(!version_ge("0.40.0", "garbage"), "garbage staged false"); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\reap.rs:307: assert!(matches!(child.try_wait(), Ok(None)), "child starts alive"); assert!(is_process_alive(gc), "grandchild starts alive"); reaper.reap(); - assert!(wait_exit(&mut child), "reap must terminate the enrolled child"); - assert!(wait_dead(gc), "reap must terminate the inherited grandchild"); + assert!( + wait_exit(&mut child), + "reap must terminate the enrolled child" + ); + assert!( + wait_dead(gc), + "reap must terminate the inherited grandchild" + ); let _ = std::fs::remove_file(&pidfile); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\reap.rs:340: assert!(matches!(child.try_wait(), Ok(None)), "child starts alive"); assert!(is_process_alive(gc), "grandchild starts alive"); reaper.reap(); - assert!(wait_exit(&mut child), "reap must terminate the enrolled child"); - assert!(wait_dead(gc), "reap must terminate the inherited grandchild"); + assert!( + wait_exit(&mut child), + "reap must terminate the enrolled child" + ); + assert!( + wait_dead(gc), + "reap must terminate the inherited grandchild" + ); let _ = std::fs::remove_file(&pidfile); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:263: let mut flips: Vec = Vec::new(); let verdicts = { let mut regs = self.regs.lock().unwrap(); - self.merge_instances_locked(&mut regs, origin_node, updates, policy, &mut admitted_any, &mut flips) + self.merge_instances_locked( + &mut regs, + origin_node, + updates, + policy, + &mut admitted_any, + &mut flips, + ) }; // Gossip-recency stamp (M7 D2): an ADMITTED feed proves the origin // node is up right now — even a Stale merge verdict is a liveness Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:570: info.as_ref().is_some_and(|i| i.controlled), &self.node_hex, ); - let harness_only = info.as_ref().is_some_and(|i| { - i.state == "live_agent" && i.controllable != Some(true) - }); + let harness_only = info + .as_ref() + .is_some_and(|i| i.state == "live_agent" && i.controllable != Some(true)); // The #4 de-faking datums (REQ-GOSSIP-ADAPTER-PROJECTS): the endpoint's // real harness adapter + its recent projects + the EXPLICIT any-controller // truth, gossiped so `from_resource_row` stops faking remote rows. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:697: endpoint_id: id, instance, })); - eprintln!("ROSTER_GHOST_HEAL:{}: erased perch advertised offline", sub.name); + eprintln!( + "ROSTER_GHOST_HEAL:{}: erased perch advertised offline", + sub.name + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1337: dir.file_name().unwrap().to_string_lossy().into_owned() }); // Newest 8 projects win despite every cwd having a duplicate row. - let want: Vec = (0..MAX_GOSSIPED_PROJECTS).map(|k| format!("p{:02}", 11 - k)).collect(); + let want: Vec = (0..MAX_GOSSIPED_PROJECTS) + .map(|k| format!("p{:02}", 11 - k)) + .collect(); assert_eq!(got, want, "got {got:?}"); // Scan stopped at the cap: 8 derivations, not 12 (and never 24). - assert_eq!(derivations, MAX_GOSSIPED_PROJECTS, "derivations {derivations}"); + assert_eq!( + derivations, MAX_GOSSIPED_PROJECTS, + "derivations {derivations}" + ); } // [unit->REQ-GOSSIP-CONTROLLED-ANY] bug #3: a locally-controlled endpoint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1542: label: "BOX".into(), machine_id: "mid-1".into(), }; - let notices = - repair_evict_superseded(&mut roster, "home", "new-key", &intro, &snap_dir); + let notices = repair_evict_superseded(&mut roster, "home", "new-key", &intro, &snap_dir); // The demoted warn-on-change: one machine_id-anchored notice K1→K2. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1594: }; let none = repair_evict_superseded(&mut r2, "home", "new-key", &other, &snap_dir); assert!(none.is_empty(), "no-match raises no rekey notice"); - assert!(r2.is_member("home", "unrelated"), "no-match leaves roster intact"); + assert!( + r2.is_member("home", "unrelated"), + "no-match leaves roster intact" + ); assert!(!RegistryHost::repair_evict_path(&snap_dir).exists()); // Absent machine id: a FRESH gossip snapshot with a labeled identity; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1624: }; let silent = repair_evict_superseded(&mut r3, "home", "new-key", &no_id, &snap2); assert!(silent.is_empty(), "absent machine id → no false notice"); - assert!(r3.is_member("home", "old2"), "absent-id leaves roster intact"); + assert!( + r3.is_member("home", "old2"), + "absent-id leaves roster intact" + ); } // [unit->REQ-INST-7] inbound feeds gate fail-closed: non-member subnet Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1898: ); // The label landed and is the only carrier — no endpoint row created. let snap = RegistryHost::snapshot_path(&dir.path().join("registry"), "home"); - let reg: SubnetRegistry = - serde_json::from_slice(&std::fs::read(&snap).unwrap()).unwrap(); - assert_eq!(reg.node_labels().collect::>(), vec![("bb22", "RENAMED")]); - assert!(reg.endpoint_ids().next().is_none(), "no phantom endpoint row"); + let reg: SubnetRegistry = serde_json::from_slice(&std::fs::read(&snap).unwrap()).unwrap(); + assert_eq!( + reg.node_labels().collect::>(), + vec![("bb22", "RENAMED")] + ); + assert!( + reg.endpoint_ids().next().is_none(), + "no phantom endpoint row" + ); } // [unit->REQ-REGISTRY-APPLY-TRANSACTIONAL] the transactional batch apply Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1965: 1, "one batch = one snapshot write, never per record-kind" ); - assert_eq!(merged, 4, "every record judged (refusals count as verdicts)"); + assert_eq!( + merged, 4, + "every record judged (refusals count as verdicts)" + ); assert!(flips.is_empty(), "inserts are not attention flips"); // Parity: the twin applies the SAME records through the per-kind Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1985: ); // The refused record never landed on either host. assert!( - snap(&h, &dir.path().join("batch")).instances("ghost").is_empty(), + snap(&h, &dir.path().join("batch")) + .instances("ghost") + .is_empty(), "the per-record gate refused inside the batch" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:1997: // Flip parity too: a Dormant→Active transition observed through the // BATCH path reports the flip exactly like the per-kind path. let (_, flips) = h.apply_feed_batch("bb22", &[], &[inst("doyle", Status::Active, 3)], &p); - assert_eq!(flips, vec!["doyle".to_string()], "flip detection rides the batch"); + assert_eq!( + flips, + vec!["doyle".to_string()], + "flip detection rides the batch" + ); } // [unit->REQ-INST-3] registry advertisement FOLLOWS the resting-state Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:2163: &InfoJson::new("live", "now", std::process::id(), "s", "live_agent"), ) .unwrap(); - assert_eq!(advertised_status(&p), Status::Active, "baseline: bound+alive ⇒ Active"); + assert_eq!( + advertised_status(&p), + Status::Active, + "baseline: bound+alive ⇒ Active" + ); // Stamp a host-level failure report — the derivation must not change. - info::set_host_error(&p, Some("wake-resume: adapter 'ghost' is not registered")).unwrap(); + info::set_host_error(&p, Some("wake-resume: adapter 'ghost' is not registered")) + .unwrap(); assert_eq!( advertised_status(&p), Status::Active, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:2218: "offline heal advertised to peers: {out:?}" ); // No longer a routable (Active) resource → resource_projection drops it. - let rows = spt_net::net::registry::resource_projection( - &h.regs.lock().unwrap()["adv"], - |_| false, - ); + let rows = + spt_net::net::registry::resource_projection(&h.regs.lock().unwrap()["adv"], |_| { + false + }); assert!( rows.iter().all(|r| r.endpoint_id != "ghost-ag"), "erased endpoint no longer projects as a live resource" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:2416: // the ghost survives (eviction must not race a row that just went Offline). assert_eq!(h.evict_aged_offline_rows_at(grace, 1_000), 0); assert_eq!(h.evict_aged_offline_rows_at(grace, 1_000 + 299_000), 0); - assert_eq!(h.rows("home", "ghost").len(), 1, "within grace the ghost survives"); + assert_eq!( + h.rows("home", "ghost").len(), + 1, + "within grace the ghost survives" + ); // Past the grace the aged Offline ghost evicts and the snapshot is rewritten. let later = 1_000 + 300_000 + 1; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\registryhost.rs:2423: assert_eq!(h.evict_aged_offline_rows_at(grace, later), 1); - assert!(h.rows("home", "ghost").is_empty(), "aged Offline ghost evicted"); + assert!( + h.rows("home", "ghost").is_empty(), + "aged Offline ghost evicted" + ); let snap = RegistryHost::snapshot_path(&dir.path().join("registry"), "home"); let parsed: SubnetRegistry = serde_json::from_slice(&std::fs::read(&snap).unwrap()).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\relay.rs:62: /// killed one left behind. Returns the number of messages forwarded. pub fn drain_backlog(&self, mut sink: F) -> usize { // [impl->REQ-SPOOL-TAKE-AUDIT] relay-backlog leg — stamp who drained the row. - let audit = - spool::TakerAudit::new(spool::TakerLeg::RelayBacklog, None, Some(std::process::id())); + let audit = spool::TakerAudit::new( + spool::TakerLeg::RelayBacklog, + None, + Some(std::process::id()), + ); // DRAIN-TIME NOTIF VALIDITY (ADR-0046 Amendment 1, KH 7.53): this is the // INJECTING presentation — a stale spooled notice here wakes the agent // with a fact that is no longer true (perri's field report). The gate is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\release.rs:618: /// adapter's declared `signing_key`. **Fail-closed:** any malformed signature or /// mismatch returns an error and the bytes are never trusted (REQ-UPD-9). // [impl->REQ-UPD-9] -pub fn verify_detached(bytes: &[u8], signature_hex: &str, key: &VerifyingKey) -> Result<(), RejectReason> { +pub fn verify_detached( + bytes: &[u8], + signature_hex: &str, + key: &VerifyingKey, +) -> Result<(), RejectReason> { let sig_bytes = hex_decode(signature_hex).map_err(RejectReason::Malformed)?; let sig_arr: [u8; 64] = sig_bytes.as_slice().try_into().map_err(|_| { RejectReason::Malformed(format!("signature is {} bytes, want 64", sig_bytes.len())) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\release.rs:659: /// update set. The caller treats a mismatch as SKIP-the-docs, never as a /// release rejection (ADR-0036 §4 failure isolation). // [impl->REQ-DOCS-RELEASE-ASSET] -pub fn verify_update_set_docs( - meta: &UpdateSetMetadata, - bundle: &[u8], -) -> Result<(), RejectReason> { +pub fn verify_update_set_docs(meta: &UpdateSetMetadata, bundle: &[u8]) -> Result<(), RejectReason> { let Some(docs) = &meta.docs else { return Err(RejectReason::Malformed("set carries no docs entry".into())); }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\resting.rs:594: Ok(report) => RestRoute::Local(report), Err(e) if allow_remote_fallback && e.contains(NOT_A_HOSTED_PERCH_MARKER) => { let goal = match event { - RestEvent::Wake => RestGoal { target: Status::Active, kind: GoalKind::Exists }, - RestEvent::Suspend => { - RestGoal { target: Status::Suspended, kind: GoalKind::Forall } - } + RestEvent::Wake => RestGoal { + target: Status::Active, + kind: GoalKind::Exists, + }, + RestEvent::Suspend => RestGoal { + target: Status::Suspended, + kind: GoalKind::Forall, + }, _ => return RestRoute::NoRemoteArm, }; match select_rest_target(&load_candidates(), goal) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\resting.rs:627: fn route_rest_event_contract_table() { use spt_net::net::registry::Status; let miss = || Err(format!("info.json absent — {NOT_A_HOSTED_PERCH_MARKER}")); - let no_candidates_expected = || -> Vec<(String, Status)> { - panic!("load_candidates must not run on a local path") - }; + let no_candidates_expected = + || -> Vec<(String, Status)> { panic!("load_candidates must not run on a local path") }; // Local edge + local no-edge pass through, candidates never loaded. assert!(matches!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\resting.rs:956: assert_eq!(effective_rest_state(true, false, None), Active); assert_eq!(effective_rest_state(true, false, Some(Active)), Active); assert_eq!(effective_rest_state(true, false, Some(Dormant)), Dormant); - assert_eq!(effective_rest_state(true, false, Some(Suspended)), Suspended); + assert_eq!( + effective_rest_state(true, false, Some(Suspended)), + Suspended + ); // unbound (warm skeleton): Dormant for EVERY intent, incl. void. for intent in [None, Some(Active), Some(Dormant), Some(Suspended)] { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\resting.rs:1045: // idempotent answer when no live session exists). let report = apply_event(d.path(), RestEvent::Suspend, None, 1_000, || Ok(()), || {}) .expect("apply ok"); - assert!(report.is_none(), "no hint + cold perch ⇒ idempotent NO_EDGE"); + assert!( + report.is_none(), + "no hint + cold perch ⇒ idempotent NO_EDGE" + ); // WITH the broker-truth hint (a live non-zombie session exists): the // Suspend is a REAL edge — shutdown answers from the same authority Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\rollback_compat.rs:125: candidate_started_ms: 1_234, prior_version: Some(6), }, - &["phase", "version", "rollback_binary", "candidate_started_ms"], + &[ + "phase", + "version", + "rollback_binary", + "candidate_started_ms", + ], ); - assert_additive_n1_readable(&AppliedRecord::Applied { version: 7 }, &["phase", "version"]); assert_additive_n1_readable( + &AppliedRecord::Applied { version: 7 }, + &["phase", "version"], + ); + assert_additive_n1_readable( &AppliedRecord::RolledBack { quarantine_version: 7, running_version: 6, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\rollback_compat.rs:135: rollback_binary: "/opt/spt/spt.old-6".to_string(), }, - &["phase", "quarantine_version", "running_version", "rollback_binary"], + &[ + "phase", + "quarantine_version", + "running_version", + "rollback_binary", + ], ); // D6-1b + D7-1: brain.ready (`{pid, generation, exe_hash}`) — no struct; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\rollback_compat.rs:145: let ready = serde_json::json!({ "pid": 4321, "generation": 9, "exe_hash": "ab12" }); let obj = ready.as_object().unwrap(); assert!( - obj.contains_key("pid") && obj.contains_key("generation") && obj.contains_key("exe_hash") + obj.contains_key("pid") + && obj.contains_key("generation") + && obj.contains_key("exe_hash") ); let with_extra = serde_json::json!({ "pid": 4321, "generation": 9, "exe_hash": "ab12", "spt_future_additive_field": "x" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedmap.rs:447: }); for _ in 0..400 { if ping(&name).is_ok() { - return SeedServer { name, stopped: false }; + return SeedServer { + name, + stopped: false, + }; } std::thread::sleep(Duration::from_millis(5)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:271: ProofRole::Dialer => (local_id, remote), ProofRole::Acceptor => (remote, local_id), }; - let by_name: HashMap<&str, &SubnetCred> = - creds.iter().map(|c| (c.name.as_str(), c)).collect(); + let by_name: HashMap<&str, &SubnetCred> = creds.iter().map(|c| (c.name.as_str(), c)).collect(); match role { ProofRole::Dialer => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:329: /// The `(epoch, tag)` set this node sends for the subnet, proving each /// generation it holds in role `mine` (current first). fn outbound(&self, mine: ProofRole) -> Vec<(u64, [u8; 32])> { - let mut out = vec![(self.current.epoch, self.current.transcript.tag(&self.current.mk, mine))]; + let mut out = vec![( + self.current.epoch, + self.current.transcript.tag(&self.current.mk, mine), + )]; if let Some(p) = &self.prev { out.push((p.epoch, p.transcript.tag(&p.mk, mine))); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:393: for name in shared { let cred = by_name.get(name.as_str())?; let current = gen_proof( - &cred.seed, name, cred.epoch, dialer_pub, acceptor_pub, nonce_d, nonce_a, + &cred.seed, + name, + cred.epoch, + dialer_pub, + acceptor_pub, + nonce_d, + nonce_a, ); let prev = cred.prev.as_ref().map(|(seed, epoch)| { - gen_proof(seed, name, *epoch, dialer_pub, acceptor_pub, nonce_d, nonce_a) + gen_proof( + seed, + name, + *epoch, + dialer_pub, + acceptor_pub, + nonce_d, + nonce_a, + ) }); out.push(LocalGens { name: name.clone(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:409: /// This peer's roster status for a subnet, via the (opt-in) roster seam. `None` /// when no seam is wired — the mechanics-only path grades on epoch alone. -fn peer_status(roster: Option<&RosterExchange>, subnet: &str, peer_hex: &str) -> Option { +fn peer_status( + roster: Option<&RosterExchange>, + subnet: &str, + peer_hex: &str, +) -> Option { roster.map(|rx| (rx.member_status)(subnet, peer_hex)) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:460: ) -> Option> { let nonce_d = fresh_nonce(); let my_names: Vec = creds.iter().map(|c| c.name.clone()).collect(); - write_frame(send, &SeedProofFrame::Hello { nonce: nonce_d, subnets: my_names }.encode()) - .await?; + write_frame( + send, + &SeedProofFrame::Hello { + nonce: nonce_d, + subnets: my_names, + } + .encode(), + ) + .await?; // Acceptor replies with the intersection (in its order) + its nonce. stage.enter(STAGE_PROOF_RECV); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:468: - let (nonce_a, shared) = match read_frame(recv, MAX_FRAME).await.and_then(|b| SeedProofFrame::decode(&b)) { + let (nonce_a, shared) = match read_frame(recv, MAX_FRAME) + .await + .and_then(|b| SeedProofFrame::decode(&b)) + { Some(SeedProofFrame::Hello { nonce, subnets }) => (nonce, subnets), _ => return None, }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:482: // They buffer while the acceptor reads, so the ping-pong never deadlocks. stage.enter(STAGE_PROOF_SEND); for g in &gens { - write_frame(send, &SeedProofFrame::ProofSet { proofs: g.outbound(ProofRole::Dialer) }.encode()) - .await?; + write_frame( + send, + &SeedProofFrame::ProofSet { + proofs: g.outbound(ProofRole::Dialer), + } + .encode(), + ) + .await?; } // Then read the acceptor's proof sets (no early abort — grade after the full // read so the legs below stay symmetric with the acceptor; tombstone grading Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:491: stage.enter(STAGE_PROOF_RECV); let mut peer_sets = Vec::with_capacity(gens.len()); for _ in &gens { - match read_frame(recv, MAX_FRAME).await.and_then(|b| SeedProofFrame::decode(&b)) { + match read_frame(recv, MAX_FRAME) + .await + .and_then(|b| SeedProofFrame::decode(&b)) + { Some(SeedProofFrame::ProofSet { proofs }) => peer_sets.push(proofs), _ => return None, } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:536: roster: Option<&RosterExchange>, self_addr: &serde_json::Value, ) -> Option> { - let (nonce_d, dialer_names) = match read_frame(recv, MAX_FRAME).await.and_then(|b| SeedProofFrame::decode(&b)) { + let (nonce_d, dialer_names) = match read_frame(recv, MAX_FRAME) + .await + .and_then(|b| SeedProofFrame::decode(&b)) + { Some(SeedProofFrame::Hello { nonce, subnets }) => (nonce, subnets), _ => return None, }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:551: let nonce_a = fresh_nonce(); write_frame( send, - &SeedProofFrame::Hello { nonce: nonce_a, subnets: shared.clone() }.encode(), + &SeedProofFrame::Hello { + nonce: nonce_a, + subnets: shared.clone(), + } + .encode(), ) .await?; if shared.is_empty() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:565: // send-then-read, so the ping-pong stays deadlock-free). let mut peer_sets = Vec::with_capacity(gens.len()); for _ in &gens { - match read_frame(recv, MAX_FRAME).await.and_then(|b| SeedProofFrame::decode(&b)) { + match read_frame(recv, MAX_FRAME) + .await + .and_then(|b| SeedProofFrame::decode(&b)) + { Some(SeedProofFrame::ProofSet { proofs }) => peer_sets.push(proofs), _ => return None, } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:572: } for g in &gens { - write_frame(send, &SeedProofFrame::ProofSet { proofs: g.outbound(ProofRole::Acceptor) }.encode()) - .await?; + write_frame( + send, + &SeedProofFrame::ProofSet { + proofs: g.outbound(ProofRole::Acceptor), + } + .encode(), + ) + .await?; } let graded = grade_all(&gens, &peer_sets, ProofRole::Dialer, remote_hex, roster); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:585: /// Write a length-delimited frame (`u32` BE length prefix + body). async fn write_frame(send: &mut SendStream, body: &[u8]) -> Option<()> { - send.write_all(&(body.len() as u32).to_be_bytes()).await.ok()?; + send.write_all(&(body.len() as u32).to_be_bytes()) + .await + .ok()?; send.write_all(body).await.ok()?; Some(()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:619: /// live address (`self_addr`) onto its advertised self-entry so peers learn how /// to reach it. `proven` is the set both sides verified; `self_addr` is the /// opaque dialable-address JSON (`Null` ⇒ advertise no address). -pub type RosterProvider = - Arc, &serde_json::Value) -> (Vec, Vec) + Send + Sync>; +pub type RosterProvider = Arc< + dyn Fn(&HashSet, &serde_json::Value) -> (Vec, Vec) + + Send + + Sync, +>; /// Merges a received roster slice into the durable store and reconciles the dial /// cache (gap-fill). Receives the peer's advertised entries + tombstones. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:667: // desyncs against a peer that does. `proven` is empty ⇒ an empty slice. let Some(rx) = roster else { return }; let (entries, tombstones) = (rx.provider)(proven, self_addr); - if write_frame(send, &enc_roster(&entries, &tombstones)).await.is_none() { + if write_frame(send, &enc_roster(&entries, &tombstones)) + .await + .is_none() + { return; } if let Some(body) = read_frame(recv, MAX_FRAME).await { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:715: fn seed_pushes(reseed: &[String], by_name: &HashMap<&str, &SubnetCred>) -> Vec { reseed .iter() - .filter_map(|n| by_name.get(n.as_str()).map(|c| (n.clone(), c.seed.clone(), c.epoch))) + .filter_map(|n| { + by_name + .get(n.as_str()) + .map(|c| (n.clone(), c.seed.clone(), c.epoch)) + }) .collect() } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:934: // [impl->REQ-MESH-2] // [impl->REQ-PEER-ROUTE-CHAIN] // [impl->REQ-PEERADDR-INVARIANT] -pub fn reconcile_peeraddrs(pa: &mut PeerAddrStore, self_hex: &str, entries: &[RosterEntry]) -> bool { +pub fn reconcile_peeraddrs( + pa: &mut PeerAddrStore, + self_hex: &str, + entries: &[RosterEntry], +) -> bool { let mut changed = false; for e in entries { if e.pubkey_hex == self_hex { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:979: .unwrap_or_default(); let provider_hex = self_hex.clone(); RosterExchange { - provider: Arc::new(move |proven: &HashSet, self_addr: &serde_json::Value| { - let mut store = RosterStore::load(); - let label = spt_store::hostlabel::os_hostname().unwrap_or_default(); - let machine_id = crate::machineid::machine_id_hash().unwrap_or_default(); - // Peek, never consume: roster propagation must not disturb the - // registry lease counter (the D3 rule). - let lease = spt_store::epoch::EpochSource::load().current(); - let now = now_secs().to_string(); - let addr = if self_addr.is_null() { - None - } else { - Some(self_addr.clone()) - }; - for s in proven { - store.upsert_self(s, &provider_hex, &label, &machine_id, addr.clone(), &now, lease); - } - let _ = store.save(); - let mut entries = Vec::new(); - let mut tombstones = Vec::new(); - for s in proven { - let (m, t) = store.roster_for(s); - entries.extend(m); - tombstones.extend(t); - } - (entries, tombstones) - }), - sink: Arc::new(move |entries: Vec, tombstones: Vec| { - let mut store = RosterStore::load(); - for e in &entries { - store.merge_entry(e.clone()); - } - for t in &tombstones { - store.tombstone(&t.subnet, &t.pubkey_hex, &t.stamp); - } - let _ = store.save(); - // Roster-merge reconcile (ADR-0039 Decision 3): every learned - // slice re-runs the validated reconcile, so a demoted (suspect) - // route heals from ANY peer's roster — connection-independent - // recovery, not just first-fill. - let path = spt_store::peeraddrs::peer_addrs_file(); - let mut pa = PeerAddrStore::load_from(&path); - if reconcile_peeraddrs(&mut pa, &self_hex, &entries) { - let _ = pa.save_to(&path); - } - }), + provider: Arc::new( + move |proven: &HashSet, self_addr: &serde_json::Value| { + let mut store = RosterStore::load(); + let label = spt_store::hostlabel::os_hostname().unwrap_or_default(); + let machine_id = crate::machineid::machine_id_hash().unwrap_or_default(); + // Peek, never consume: roster propagation must not disturb the + // registry lease counter (the D3 rule). + let lease = spt_store::epoch::EpochSource::load().current(); + let now = now_secs().to_string(); + let addr = if self_addr.is_null() { + None + } else { + Some(self_addr.clone()) + }; + for s in proven { + store.upsert_self( + s, + &provider_hex, + &label, + &machine_id, + addr.clone(), + &now, + lease, + ); + } + let _ = store.save(); + let mut entries = Vec::new(); + let mut tombstones = Vec::new(); + for s in proven { + let (m, t) = store.roster_for(s); + entries.extend(m); + tombstones.extend(t); + } + (entries, tombstones) + }, + ), + sink: Arc::new( + move |entries: Vec, tombstones: Vec| { + let mut store = RosterStore::load(); + for e in &entries { + store.merge_entry(e.clone()); + } + for t in &tombstones { + store.tombstone(&t.subnet, &t.pubkey_hex, &t.stamp); + } + let _ = store.save(); + // Roster-merge reconcile (ADR-0039 Decision 3): every learned + // slice re-runs the validated reconcile, so a demoted (suspect) + // route heals from ANY peer's roster — connection-independent + // recovery, not just first-fill. + let path = spt_store::peeraddrs::peer_addrs_file(); + let mut pa = PeerAddrStore::load_from(&path); + if reconcile_peeraddrs(&mut pa, &self_hex, &entries) { + let _ = pa.save_to(&path); + } + }, + ), // Mesh-D7 (REQ-MESH-4): the peer's roster status gates the grace — // tombstoned ⇒ revoked ⇒ denied; listed ⇒ present; otherwise absent. // Re-read per call so a just-propagated tombstone takes effect at once. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1090: #[test] fn roster_frame_round_trips() { let entries = vec![ - entry("aa", "home", Some(serde_json::json!({"id": "aa", "addrs": ["10.0.0.1:7"]})), 3), + entry( + "aa", + "home", + Some(serde_json::json!({"id": "aa", "addrs": ["10.0.0.1:7"]})), + 3, + ), entry("bb", "home", None, 1), entry("cc", "work", Some(serde_json::json!({"id": "cc"})), 9), ]; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1097: let tombstones = vec![tomb("dd", "home")]; let buf = enc_roster(&entries, &tombstones); let (de, dt) = dec_roster(&buf).expect("round-trip"); - assert_eq!(de, entries, "entries (incl. explicit subnet + address) survive"); + assert_eq!( + de, entries, + "entries (incl. explicit subnet + address) survive" + ); assert_eq!(dt, tombstones, "tombstones survive"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1148: let entries = vec![ entry("self", "home", Some(serde_json::json!({"id": "self"})), 1), // skipped entry("cc", "home", Some(addr_c.clone()), 1), // absent ⇒ fill - entry("bb", "home", Some(advertised_b), 1), // present ⇒ keep observed + entry("bb", "home", Some(advertised_b), 1), // present ⇒ keep observed ]; - assert!(reconcile_peeraddrs(&mut pa, "self", &entries), "C was filled"); - assert_eq!(pa.get("cc"), Some(&addr_c), "absent member filled from roster"); - assert_eq!(pa.get("bb"), Some(&observed_b), "observed addr not clobbered"); + assert!( + reconcile_peeraddrs(&mut pa, "self", &entries), + "C was filled" + ); + assert_eq!( + pa.get("cc"), + Some(&addr_c), + "absent member filled from roster" + ); + assert_eq!( + pa.get("bb"), + Some(&observed_b), + "observed addr not clobbered" + ); assert_eq!(pa.get("self"), None, "own entry skipped"); // Idempotent: a second pass with the same input changes nothing. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1159: - assert!(!reconcile_peeraddrs(&mut pa, "self", &entries), "no further change"); + assert!( + !reconcile_peeraddrs(&mut pa, "self", &entries), + "no further change" + ); } // [unit->REQ-PEER-ROUTE-CHAIN] reconcile REPLACES a suspect row with the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1172: pa.mark_suspect("bb"); // the failed-dial demotion let entries = vec![entry("bb", "home", Some(rostered.clone()), 1)]; - assert!(reconcile_peeraddrs(&mut pa, "self", &entries), "suspect replaced"); + assert!( + reconcile_peeraddrs(&mut pa, "self", &entries), + "suspect replaced" + ); assert!(!pa.is_suspect("bb"), "suspect mark cleared"); - assert_eq!(pa.valid_route("bb"), Some(&rostered), "route restored from roster"); + assert_eq!( + pa.valid_route("bb"), + Some(&rostered), + "route restored from roster" + ); } // [unit->REQ-PEERADDR-INVARIANT] reconcile REFUSES a roster entry whose Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1185: fn reconcile_refuses_mismatch_and_repairs_invalid_rows() { // Refusal: entry for "cc" advertising an address claiming "zz". let mut pa = PeerAddrStore::default(); - let wrong = vec![entry("cc", "home", Some(serde_json::json!({"id": "zz"})), 1)]; - assert!(!reconcile_peeraddrs(&mut pa, "self", &wrong), "mismatch refused"); - assert!(pa.get("cc").is_none(), "nothing seeded from the poison entry"); + let wrong = vec![entry( + "cc", + "home", + Some(serde_json::json!({"id": "zz"})), + 1, + )]; + assert!( + !reconcile_peeraddrs(&mut pa, "self", &wrong), + "mismatch refused" + ); + assert!( + pa.get("cc").is_none(), + "nothing seeded from the poison entry" + ); // Repair: a historical poison row under cc's key is replaced by the // validated roster address. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1197: ); let good = serde_json::json!({"id": "cc", "addrs": ["10.0.0.3:7"]}); let entries = vec![entry("cc", "home", Some(good.clone()), 1)]; - assert!(reconcile_peeraddrs(&mut pa, "self", &entries), "invalid row repaired"); + assert!( + reconcile_peeraddrs(&mut pa, "self", &entries), + "invalid row repaired" + ); assert_eq!(pa.valid_route("cc"), Some(&good), "repaired row routes"); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1218: // exact-epoch (matched_current = true) assert_eq!(grade_subnet(true, false, Some(Present)), Full); - assert_eq!(grade_subnet(true, false, Some(Absent)), Full, "unknown member, current seed ⇒ admit"); - assert_eq!(grade_subnet(true, false, Some(Tombstoned)), Denied, "revokee denied even exact"); + assert_eq!( + grade_subnet(true, false, Some(Absent)), + Full, + "unknown member, current seed ⇒ admit" + ); + assert_eq!( + grade_subnet(true, false, Some(Tombstoned)), + Denied, + "revokee denied even exact" + ); // prior-epoch only (matched_prev = true, matched_current = false) - assert_eq!(grade_subnet(false, true, Some(Present)), ReseedOnly, "benign offliner ⇒ grace"); - assert_eq!(grade_subnet(false, true, Some(Tombstoned)), Denied, "revoked N-1 ⇒ denied"); - assert_eq!(grade_subnet(false, true, Some(Absent)), Denied, "off-roster N-1 ⇒ never re-seeded"); + assert_eq!( + grade_subnet(false, true, Some(Present)), + ReseedOnly, + "benign offliner ⇒ grace" + ); + assert_eq!( + grade_subnet(false, true, Some(Tombstoned)), + Denied, + "revoked N-1 ⇒ denied" + ); + assert_eq!( + grade_subnet(false, true, Some(Absent)), + Denied, + "off-roster N-1 ⇒ never re-seeded" + ); // ≥2 stale / forged (no match at any held generation) assert_eq!(grade_subnet(false, false, Some(Present)), Denied); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1247: ]; let buf = enc_seedxfer(&items); assert_eq!(dec_seedxfer(&buf), Some(items.clone()), "round-trip"); - assert_eq!(dec_seedxfer(&enc_seedxfer(&[])), Some(vec![]), "empty round-trip"); + assert_eq!( + dec_seedxfer(&enc_seedxfer(&[])), + Some(vec![]), + "empty round-trip" + ); assert_eq!(dec_seedxfer(&[]), None, "empty buffer (no count)"); assert_eq!(dec_seedxfer(&[0, 0, 0, 1]), None, "count claims 1, no item"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\seedproofx.rs:1280: // ...but it IS present in the confidential transfer leg (proving that is // the only channel it travels). let xfer = enc_seedxfer(&[("home".to_string(), seed.clone(), 2)]); - assert!(contains_subslice(&xfer, &seed), "the seed rides the transfer leg"); + assert!( + contains_subslice(&xfer, &seed), + "the seed rides the transfer leg" + ); } fn contains_subslice(hay: &[u8], needle: &[u8]) -> bool { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\serveprobe.rs:67: /// request runs. No gate (module docs): the answer is public serve-state, the /// QUIC handshake is the only subject that matters. // [impl->REQ-SUBNET-5] -pub fn serve_subnet_probe( - brain: &mut Brain, - stream_id: u64, -) -> io::Result { +pub fn serve_subnet_probe(brain: &mut Brain, stream_id: u64) -> io::Result { brain.net_stream_subscribe(stream_id, 0)?; let mut decoder = ServeProbeDecoder::new(); loop { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\service.rs:428: None => std::env::remove_var("SPT_HOME"), } assert!(!overridden, "SPT_HOME set ⇒ not the service's home"); - assert!(default, "no SPT_HOME ⇒ the default home the service manages"); + assert!( + default, + "no SPT_HOME ⇒ the default home the service manages" + ); } // [unit->REQ-DAEMON-6] the systemd unit path is the install.sh target: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\service.rs:442: ); assert_eq!( systemd_unit_path_from(None, Some("/home/u")), - Some(PathBuf::from("/home/u/.config/systemd/user/spt-daemon.service")) + Some(PathBuf::from( + "/home/u/.config/systemd/user/spt-daemon.service" + )) ); assert_eq!( systemd_unit_path_from(Some(""), Some("/home/u")), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\service.rs:449: - Some(PathBuf::from("/home/u/.config/systemd/user/spt-daemon.service")) + Some(PathBuf::from( + "/home/u/.config/systemd/user/spt-daemon.service" + )) ); assert_eq!(systemd_unit_path_from(None, None), None); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:414: /// …and the CLI capability: where `spt` is and which home it must speak to, so /// `spt send` from a supervised service is a declared capability rather than a /// property of whatever `PATH` and profile the daemon happened to inherit. -fn service_env_at( - home: &Path, - option: &str, - service_dir: &Path, -) -> Vec<(String, String)> { +fn service_env_at(home: &Path, option: &str, service_dir: &Path) -> Vec<(String, String)> { let mut env = vec![ (ENV_SERVICE_OPTION.to_string(), option.to_string()), ( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:425: ENV_SERVICE_DIR.to_string(), service_dir.display().to_string(), ), - ( - ENV_SERVICE_SPT_HOME.to_string(), - home.display().to_string(), - ), + (ENV_SERVICE_SPT_HOME.to_string(), home.display().to_string()), ]; // Best-effort by necessity: `current_exe` can fail (a deleted or unreadable // image). An ABSENT var is the honest answer there — an adapter can then say Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:435: // so. A var pointing at a guess would make every downstream failure look like // the adapter's. if let Ok(exe) = std::env::current_exe() { - env.push(( - ENV_SERVICE_SPT_BIN.to_string(), - exe.display().to_string(), - )); + env.push((ENV_SERVICE_SPT_BIN.to_string(), exe.display().to_string())); } env } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:482: ) -> Result, String> { let keys = std::collections::BTreeMap::from([ ("adapter_name".to_string(), adapter_name.to_string()), - ( - "adapter_dir".to_string(), - install_dir.display().to_string(), - ), + ("adapter_dir".to_string(), install_dir.display().to_string()), ]); // [impl->REQ-HAZARD-TEMPLATE-ARGV-FILL] tokenize-template-then-fill-each: a // multi-word/quote/semicolon {key} value is exactly one argv element. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:615: /// previous instance is PROVEN gone (or provably never was): an unresolved /// sweep blocks the spawn rather than risking two live instances. pub fn clear_to_spawn(&self) -> bool { - matches!(self, Self::NoRecord | Self::AlreadyDead | Self::Killed | Self::NotOurs(_)) + matches!( + self, + Self::NoRecord | Self::AlreadyDead | Self::Killed | Self::NotOurs(_) + ) } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:776: // Each run gets a clean sheet: a fault must be explained by THIS run's // output, never by a previous one's still sitting in the file. reclaim_capture(&capture); - let mut child = - match crate::daemon::detached_no_inherit_env( - program, - args, - &env, - SERVICE_ENV_SCRUB, - Some(&capture), - ) { - Ok(c) => c, - Err(e) => { - let e = format!("spawn {program}: {e}"); - eprintln!("SERVICE_STARTUP_FAULT:{option}: {e}"); - return Some(StandDown { - latch: Latch::StartupFault, - detail: Some(e), - }); - } - }; + let mut child = match crate::daemon::detached_no_inherit_env( + program, + args, + &env, + SERVICE_ENV_SCRUB, + Some(&capture), + ) { + Ok(c) => c, + Err(e) => { + let e = format!("spawn {program}: {e}"); + eprintln!("SERVICE_STARTUP_FAULT:{option}: {e}"); + return Some(StandDown { + latch: Latch::StartupFault, + detail: Some(e), + }); + } + }; // Park the kill handle BEFORE the wait: a daemon that dies mid-run must // leave its successor something path-verifiable to reap. let image = spt_store::proc::exe_path(child.pid()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1037: /// The latch currently suppressing this option, [`Latch::None`] if none. // [impl->REQ-RESIDENT-SERVICE] pub fn latch(&self, option: &str) -> Latch { - self.stand_down(option) - .map(|s| s.latch) - .unwrap_or_default() + self.stand_down(option).map(|s| s.latch).unwrap_or_default() } /// The whole stand-down record — the latch AND the evidence for it. This is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1083: pub fn is_held(&self, option: &str) -> bool { let key = spt_store::perch::encode_adapter_option(option); let map = self.holds.lock().unwrap_or_else(|p| p.into_inner()); - map.get(&key) - .is_some_and(|f| f.load(Ordering::SeqCst)) + map.get(&key).is_some_and(|f| f.load(Ordering::SeqCst)) } /// Engage the hold. Step 1 of [`quiesce_order`], and it must land BEFORE the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1299: // Resolve through the OPTION seam even for a bare name, so this path is // option-general by construction rather than adapter-only with an // option-shaped signature bolted on later. - let Ok(manifest) = spt_runtime::registry::resolve_option_in(registered, adapters_dir, &option) + let Ok(manifest) = + spt_runtime::registry::resolve_option_in(registered, adapters_dir, &option) else { continue; // unresolvable manifest: not a service question }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1328: // and the operator asking "why will my service not start" would get the // fault's name and nothing else. let mut detail = match decision.outcome { - ServiceOutcome::StartupFault | ServiceOutcome::Latched => { - stood.and_then(|s| s.detail) - } + ServiceOutcome::StartupFault | ServiceOutcome::Latched => stood.and_then(|s| s.detail), _ => None, }; let outcome = match decision.outcome { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2299: }; std::fs::write(dir.join(shipped), b"").unwrap(); - let tokens = fill_service_command("cc", dir, &svc("svcbin --serve {adapter_name}")).unwrap(); + let tokens = + fill_service_command("cc", dir, &svc("svcbin --serve {adapter_name}")).unwrap(); assert_eq!( tokens[0], dir.join(shipped).display().to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2339: let home = Path::new("/spt-home"); let a_dir = spt_store::perch::resolve_service_dir_in(home, "cc:dev"); let b_dir = spt_store::perch::resolve_service_dir_in(home, "cc_dev"); - assert_ne!(a_dir, b_dir, "the collision-adversarial pair must stay apart"); + assert_ne!( + a_dir, b_dir, + "the collision-adversarial pair must stay apart" + ); let env = service_env_at(home, "cc:dev", &a_dir); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2487: let tmp = tempfile::tempdir().unwrap(); let tokens: Vec = long_running().split(' ').map(String::from).collect(); let (program, args) = tokens.split_first().unwrap(); - let child = - crate::daemon::detached_no_inherit_env(program, args, &[], &[], None).expect("spawn orphan"); + let child = crate::daemon::detached_no_inherit_env(program, args, &[], &[], None) + .expect("spawn orphan"); let pid = child.pid(); // Park exactly what a supervisor parks, then FORGET the handle — this is // a dead daemon's orphan, which nobody holds a handle to. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2495: let image = spt_store::proc::exe_path(pid); - assert!(image.is_some(), "the image oracle must answer for our own child"); + assert!( + image.is_some(), + "the image oracle must answer for our own child" + ); park_identity(tmp.path(), pid, image.as_deref()); drop(child); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2500: - assert_eq!(kill_orphan_service_at(tmp.path(), "cc"), OrphanSweep::Killed); + assert_eq!( + kill_orphan_service_at(tmp.path(), "cc"), + OrphanSweep::Killed + ); assert!( !spt_store::proc::is_process_alive(pid), "Killed is only reported when the post-kill read says so" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2511: #[test] fn empty_and_dead_orphan_records_read_apart() { let tmp = tempfile::tempdir().unwrap(); - assert_eq!(kill_orphan_service_at(tmp.path(), "cc"), OrphanSweep::NoRecord); + assert_eq!( + kill_orphan_service_at(tmp.path(), "cc"), + OrphanSweep::NoRecord + ); park_identity(tmp.path(), 0, None); assert_eq!( kill_orphan_service_at(tmp.path(), "cc"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2679: }) }; assert!( - wait_until(|| read_parked_identity(&dir).is_some_and(|(pid, _)| { - pid != 0 && spt_store::proc::is_process_alive(pid) - })), + wait_until(|| read_parked_identity(&dir) + .is_some_and(|(pid, _)| { pid != 0 && spt_store::proc::is_process_alive(pid) })), "the supervised child never came up" ); let pid = read_parked_identity(&dir).unwrap().0; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2900: let set = ServiceSet::new(); let params = ServiceParams::default(); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); - assert_eq!(out.len(), 1, "one candidate per registered adapter: {out:?}"); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); + assert_eq!( + out.len(), + 1, + "one candidate per registered adapter: {out:?}" + ); assert_eq!(out[0].option, "a", "the RAW option is what is reported"); assert_eq!(out[0].outcome, ServiceOutcome::Started); - assert_eq!(out[0].detail, None, "a plain Started invents no reassurance"); + assert_eq!( + out[0].detail, None, + "a plain Started invents no reassurance" + ); assert!(set.contains("a")); let dir = spt_store::perch::resolve_service_dir("a"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2914: ); let first = read_parked_identity(&dir).expect("parked").0; - let again = - reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let again = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!(again[0].outcome, ServiceOutcome::AlreadyRunning); assert_eq!(set.len(), 1, "one supervisor per option"); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2945: let set = ServiceSet::new(); let params = ServiceParams::default(); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::BindDeferred); assert!( set.is_empty(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2952: "a deferred service is reported, never supervised" ); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Bind, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Bind, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::Started); assert!(set.contains("a")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2982: let set = ServiceSet::new(); let params = fast_latch_params(); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::Started); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2997: ); // A NON-clearing opportunity: report the suppression, raise nothing. - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Bind, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Bind, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::StartupFault); assert_eq!( out[0].detail, None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:3263: assert!(!set.contains("a")); // THE ASSERTION: a clearing opportunity does not start a held option. - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!( out.iter().map(|o| o.outcome).collect::>(), [ServiceOutcome::Held], Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:3749: )]; let set = ServiceSet::new(); let params = fast_latch_params(); - reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert!( wait_until(|| set.latch("a") == Latch::StartupFault), "the fixture never latched" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:3810: crate::test_home::with_home(|home| { let (adapters, install) = sweep_dirs(home); let registered = vec![ - reg("a", &install, true, Some((long_running(), ServiceStart::Boot))), - reg("b", &install, false, Some((long_running(), ServiceStart::Bind))), + reg( + "a", + &install, + true, + Some((long_running(), ServiceStart::Boot)), + ), + reg( + "b", + &install, + false, + Some((long_running(), ServiceStart::Bind)), + ), reg("c", &install, true, None), ]; let set = ServiceSet::new(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellchan.rs:35: use spt_runtime::manifest::Shell; use crate::brain::{now_ms, Brain, BrokerEvent}; -use crate::effect::{Minter, MintedOp}; +use crate::effect::{MintedOp, Minter}; use crate::shellhost::{self, frame_mac, verify_frame_mac}; /// The broker session label for a stdin-hosted shell instance — path-shaped so Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellchan.rs:414: spt_store::spool::spool_message_at(perch, "", &stamp_frame(&new, &frame_new)).unwrap(); spt_store::spool::spool_message_at(perch, "", "garbage no-mac row").unwrap(); - assert_eq!(restamp_pending_at(perch, &old, &new), 1, "only the old-key row"); + assert_eq!( + restamp_pending_at(perch, &old, &new), + 1, + "only the old-key row" + ); let bodies: Vec = spt_store::spool::peek_all_at(perch) .unwrap() .into_iter() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellchan.rs:431: "already-new row untouched" ); assert_eq!(bodies[2], "garbage no-mac row", "foreign row untouched"); - assert_eq!(restamp_pending_at(perch, &old, &new), 0, "idempotent — second walk is a no-op"); + assert_eq!( + restamp_pending_at(perch, &old, &new), + 0, + "idempotent — second walk is a no-op" + ); // The drain-time second chance: a straggler stamped under the retired // stash re-stamps at delivery; current-key and foreign bodies pass through. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellchan.rs:447: "straggler re-stamps at drain" ); let current = stamp_frame(&new, &frame_new); - assert_eq!(restamp_for_drain(perch, &new, ¤t), current, "current passes through"); assert_eq!( + restamp_for_drain(perch, &new, ¤t), + current, + "current passes through" + ); + assert_eq!( restamp_for_drain(perch, &new, "garbage no-mac row"), "garbage no-mac row", "foreign passes through for the shell to refuse" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellchan.rs:520: Some(1_753_372_800_123), "since decodes as epoch ms (the value edge arithmetic anchors to)" ); - assert!(ev.body.is_empty(), "the body is empty and reserved: {frame}"); + assert!( + ev.body.is_empty(), + "the body is empty and reserved: {frame}" + ); // Attr ORDER is part of the published shape. assert_eq!( ev.attrs.iter().map(|(k, _)| k.as_str()).collect::>(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:193: // token snapshot (the D-2 stale-snapshot class). // [impl->REQ-HAZARD-SHELL-STALE-ONLINE] let new_key = link_key(&token); - for old in [&parked_before_mint, &retired_before_mint].into_iter().flatten() { + for old in [&parked_before_mint, &retired_before_mint] + .into_iter() + .flatten() + { crate::shellchan::restamp_pending_at(&perch, &link_key(old), &new_key); } // Stash the just-rotated-out token for the drain's second chance; a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:229: }; // [impl->REQ-HAZARD-TEMPLATE-ARGV-FILL] tokenize-template-then-fill-each: a // multi-word/quote/semicolon {key} value is exactly one argv element. - let mut tokens = - spt_runtime::runtime::fill_template_tokens(&shell.spawn, &keys).map_err(|e| e.to_string())?; + let mut tokens = spt_runtime::runtime::fill_template_tokens(&shell.spawn, &keys) + .map_err(|e| e.to_string())?; let Some(program) = tokens.first_mut() else { return Err("empty spawn command".into()); }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:757: // [impl->REQ-HAZARD-SHELL-STALE-ONLINE] // (remove-then-rename: Windows rename refuses an existing destination.) let _ = std::fs::remove_file(perch.join(RETIRED_TOKEN_FILE)); - let _ = std::fs::rename( - perch.join(LINK_TOKEN_FILE), - perch.join(RETIRED_TOKEN_FILE), - ); + let _ = std::fs::rename(perch.join(LINK_TOKEN_FILE), perch.join(RETIRED_TOKEN_FILE)); // Clear any pending drive frame (M11-W2, REQ-SHELL-3): the link credential // is now retired, so a relink will mint a fresh token — but eagerly evict the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:984: #[test] fn a_post_ack_silence_is_indeterminate_not_failure() { let (out, spawned_here) = route(Err(LaunchRouteError::Indeterminate("hung up".into()))); - assert!(!spawned_here, "an unknown outcome must never be re-attempted"); + assert!( + !spawned_here, + "an unknown outcome must never be re-attempted" + ); let err = out.expect_err("silence after the ack is not a success"); assert!( err.is_indeterminate(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:1132: e.fallback_allowed(), "nothing was spawned, so the caller keeps its in-process path: {e}" ); - assert!(!e.is_indeterminate(), "an unreached daemon launched nothing"); + assert!( + !e.is_indeterminate(), + "an unreached daemon launched nothing" + ); } // [unit->REQ-EP-6] a GATEWAY-typed owner spawns + owns a shell identically Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:1263: let owlery = tmp.path().join("owl space"); // spaces: the argv-fill hazard shape std::fs::create_dir_all(&owlery).unwrap(); let id = spawn_record(&owlery, "doyle", "mock-shell", None).unwrap(); - let shell = shell_section(&format!("{NOOP} --root {{perch_dir}} --link {{link_token}}")); + let shell = shell_section(&format!( + "{NOOP} --root {{perch_dir}} --link {{link_token}}" + )); let tokens = fill_spawn_command(&owlery, "doyle", &id, "mock-shell", None, &shell) .expect("perch_dir is a spawn substitution key"); let perch = spt_store::perch::resolve_shell_perch_path_in(&owlery, "doyle", &id); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellhost.rs:1294: // token — the release shape, and the argv-fill hazard shape at once. let install = tmp.path().join("adapter dir"); std::fs::create_dir_all(&install).unwrap(); - let shipped = if cfg!(windows) { "runner.exe" } else { "runner" }; + let shipped = if cfg!(windows) { + "runner.exe" + } else { + "runner" + }; std::fs::write(install.join(shipped), b"").unwrap(); let id = spawn_record(&owlery, "doyle", "mock-shell", None).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellwake.rs:390: // The wake-forward rest op's seq source is a fresh `now_ms()` — its OWN // minting source, distinct from shellchan's spool-row counter (doyle ruling: // the tag names the seq source, not the subsystem), so it stamps `wake`. - || Ok(crate::effect::MintedOp::new(crate::effect::Minter::Wake, now_ms())), + || { + Ok(crate::effect::MintedOp::new( + crate::effect::Minter::Wake, + now_ms(), + )) + }, |op| { let conn = brain.net_dial(addr.clone(), None)?; // Keep the tracing string's seq consistent with the (possibly re-minted) op. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellwake.rs:479: } // [impl->REQ-HAZARD-TEMPLATE-ARGV-FILL] tokenize-template-then-fill-each: a // multi-word/quote/semicolon {key} value is exactly one argv element. - let mut tokens = - spt_runtime::runtime::fill_template_tokens(wake_command, &keys).map_err(|e| e.to_string())?; + let mut tokens = spt_runtime::runtime::fill_template_tokens(wake_command, &keys) + .map_err(|e| e.to_string())?; let Some(program) = tokens.first_mut() else { return Err("empty wake_command".into()); }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellwake.rs:663: let shipped = if cfg!(windows) { "waker.exe" } else { "waker" }; std::fs::write(install.join(shipped), b"").unwrap(); - let tokens = - fill_wake_command("sh-1", "mock-shell", Some(&install), "waker --root {adapter_dir}") - .expect("adapter_dir is a wake substitution key"); + let tokens = fill_wake_command( + "sh-1", + "mock-shell", + Some(&install), + "waker --root {adapter_dir}", + ) + .expect("adapter_dir is a wake substitution key"); assert_eq!( tokens[0], install.join(shipped).display().to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellwake.rs:1042: // above is the derivation policy, not a broken rig. let off = spawn_record(owlery, "doyle", "mock-wake", None).unwrap(); reconcile_once(owlery, ®istered, &adapters_dir, &set, ¶ms); - assert_eq!(set.len(), 1, "the offline sibling {off} still gets a watcher"); + assert_eq!( + set.len(), + 1, + "the offline sibling {off} still gets a watcher" + ); set.stop_watcher(owlery, "doyle", &off); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\shellwake.rs:1230: 1, "only the profiled instance (overlay adds wake_command) gets a watcher" ); - assert!(set.contains("doyle", &pid), "the profiled instance is the one watched"); + assert!( + set.contains("doyle", &pid), + "the profiled instance is the one watched" + ); set.stop_watcher(owlery, "doyle", &pid); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:136: pub fn install(role: &str, generation: u64) -> Option { let dir = stderr_log_dir(); if let Err(e) = std::fs::create_dir_all(&dir) { - eprintln!("STDERR_PERSIST_SKIP: could not create {}: {e}", dir.display()); + eprintln!( + "STDERR_PERSIST_SKIP: could not create {}: {e}", + dir.display() + ); return None; } let path = stderr_log_path(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:145: if should_roll(size, STDERR_LOG_CAP) { roll_files(&dir, STDERR_LOG_KEEP); } - let mut file = match std::fs::OpenOptions::new().create(true).append(true).open(&path) { + let mut file = match std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(&path) + { Ok(f) => f, Err(e) => { - eprintln!("STDERR_PERSIST_SKIP: could not open {}: {e}", path.display()); + eprintln!( + "STDERR_PERSIST_SKIP: could not open {}: {e}", + path.display() + ); return None; } }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:169: #[test] fn should_roll_at_or_over_cap_only() { assert!(!should_roll(0, STDERR_LOG_CAP), "empty never rolls"); - assert!(!should_roll(STDERR_LOG_CAP - 1, STDERR_LOG_CAP), "just under never rolls"); - assert!(should_roll(STDERR_LOG_CAP, STDERR_LOG_CAP), "exactly at cap rolls"); - assert!(should_roll(STDERR_LOG_CAP + 1, STDERR_LOG_CAP), "over cap rolls"); + assert!( + !should_roll(STDERR_LOG_CAP - 1, STDERR_LOG_CAP), + "just under never rolls" + ); + assert!( + should_roll(STDERR_LOG_CAP, STDERR_LOG_CAP), + "exactly at cap rolls" + ); + assert!( + should_roll(STDERR_LOG_CAP + 1, STDERR_LOG_CAP), + "over cap rolls" + ); assert!(!should_roll(u64::MAX, 0), "cap 0 disables rotation"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:190: roll_files(dir.path(), STDERR_LOG_KEEP); // The old backup is dropped; the current became the new .1. - assert!(!cur.exists(), "current was rolled away (fresh install reopens it)"); + assert!( + !cur.exists(), + "current was rolled away (fresh install reopens it)" + ); assert_eq!( std::fs::read(&bak).unwrap(), b"CURRENT-A", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:197: "the current file's content is preserved as the .1 backup" ); // No .2 accumulates (KEEP=2 keeps only current + .1). - assert!(!rolled_path(dir.path(), 2).exists(), "no unbounded accumulation"); + assert!( + !rolled_path(dir.path(), 2).exists(), + "no unbounded accumulation" + ); } // [unit->REQ-DAEMON-STDERR-PERSIST] KEEP<=1 keeps NO backup — the current file is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:210: std::fs::write(&cur, b"CURRENT").unwrap(); roll_files(dir.path(), 1); assert!(!cur.exists(), "keep=1 clears the current file"); - assert!(!rolled_path(dir.path(), 1).exists(), "keep=1 makes no backup"); + assert!( + !rolled_path(dir.path(), 1).exists(), + "keep=1 makes no backup" + ); } // [unit->REQ-DAEMON-STDERR-PERSIST] the log path derivation sits under SPT_HOME Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\stderrlog.rs:225: assert!(p.parent().unwrap().ends_with("logs")); }); let stamp = stamp_line("broker", 7); - assert!(stamp.contains("broker") && stamp.contains("generation 7"), "got {stamp}"); + assert!( + stamp.contains("broker") && stamp.contains("generation 7"), + "got {stamp}" + ); assert!(!stamp.contains("REQ-"), "no internal tag leaks: {stamp}"); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\sync.rs:555: // literal, not merely a matter of role conflicts being rare (REQ-EP-7). // [impl->REQ-EP-7] if std::path::Path::new(&file).file_name() - == Some(std::ffi::OsStr::new(spt_store::contextstore::LIVE_ROLE_FILE)) + == Some(std::ffi::OsStr::new( + spt_store::contextstore::LIVE_ROLE_FILE, + )) { outcomes.push((branch, file, ReconcileOutcome::RoleExcluded)); continue; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\sync.rs:692: b"\nREMOTE role", ) .unwrap(); - assert_eq!(cs.list_conflicts(&wt, Some("live-role.md")).unwrap().len(), 1); + assert_eq!( + cs.list_conflicts(&wt, Some("live-role.md")).unwrap().len(), + 1 + ); let report = SyncPullReport { applied: vec![ApplyReport { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\sync.rs:716: "[adapter]\nname=\"mock\"\nversion=\"1\"\nmin_spt_core_version=\"1\"\n\n\ [session.psyche_resume]\ncommand='{cmd}'\n" ); - let rt = spt_runtime::ManifestRuntime::new( - spt_runtime::Manifest::from_toml_str(&toml).unwrap(), - ); + let rt = + spt_runtime::ManifestRuntime::new(spt_runtime::Manifest::from_toml_str(&toml).unwrap()); let outcomes = reconcile_after_sync( &rt, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:113: _ => { // ctrl+: a control byte. `ctrl+s` → 0x13, `ctrl+space` → NUL, // `ctrl+[` → ESC, etc. Only single-char chords are mapped. - if let Some(rest) = lower.strip_prefix("ctrl+").or_else(|| lower.strip_prefix("c-")) { + if let Some(rest) = lower + .strip_prefix("ctrl+") + .or_else(|| lower.strip_prefix("c-")) + { return ctrl_byte(rest).map(|b| vec![b]); } // A single literal character → its own bytes (e.g. `{key:"y"}`). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:265: } let mut child = command.spawn()?; let pid = child.id().into(); - let stdout = child - .stdout - .take() - .expect("stdout piped at spawn"); + let stdout = child.stdout.take().expect("stdout piped at spawn"); let stdin = child.stdin.take().expect("stdin piped at spawn"); let reader = thread::spawn(move || { let buf = BufReader::new(stdout); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:416: let (tx, _rx) = std::sync::mpsc::channel::(); match TranslationChild::spawn(&[prog.to_string()], tx) { Ok(child) => child.terminate(), // bounded no-zombie reap - Err(e) => panic!( - "CREATE_NO_WINDOW must not break the spawn (error-87 flag-combo class): {e}" - ), + Err(e) => { + panic!("CREATE_NO_WINDOW must not break the spawn (error-87 flag-combo class): {e}") + } } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:429: fn key_cmd_parses_each_wire_shape() { assert_eq!( serde_json::from_str::(r#"{"key":"ctrl+s"}"#).unwrap(), - KeyCmd::Key { key: "ctrl+s".into() } + KeyCmd::Key { + key: "ctrl+s".into() + } ); assert_eq!( serde_json::from_str::(r#"{"text":"hello"}"#).unwrap(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:436: - KeyCmd::Text { text: "hello".into() } + KeyCmd::Text { + text: "hello".into() + } ); assert_eq!( serde_json::from_str::(r#"{"delay_ms":50}"#).unwrap(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:446: // forward-compat: an unknown field alongside a known shape still parses. assert_eq!( serde_json::from_str::(r#"{"key":"enter","repeat":3}"#).unwrap(), - KeyCmd::Key { key: "enter".into() } + KeyCmd::Key { + key: "enter".into() + } ); // a line matching no shape is an error. assert!(serde_json::from_str::(r#"{"bogus":1}"#).is_err()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:471: // flush step 1 takes the buffered bytes (floor STAYS held) ... assert_eq!(f.take_or_release(), Some(b"hello".to_vec())); - assert!(f.is_held(), "floor stays held mid-flush so order is preserved"); + assert!( + f.is_held(), + "floor stays held mid-flush so order is preserved" + ); // ... input arriving mid-flush keeps buffering ... assert!(f.buffer_if_held(b"!"), "mid-flush input still buffers"); assert_eq!(f.take_or_release(), Some(b"!".to_vec())); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:478: // ... and the empty step RELEASES the floor. assert_eq!(f.take_or_release(), None); assert!(!f.is_held(), "drained empty → floor released"); - assert!(!f.buffer_if_held(b"z"), "released floor passes through again"); + assert!( + !f.buffer_if_held(b"z"), + "released floor passes through again" + ); } // [unit->REQ-MSG-IDLE-TRANSLATION-BINARY] the send-keys byte map: named keys, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\translation.rs:494: assert_eq!(key_to_bytes("ctrl+s"), Some(vec![0x13])); assert_eq!(key_to_bytes("ctrl+a"), Some(vec![0x01])); assert_eq!(key_to_bytes("ctrl+b"), Some(vec![0x02])); // the rc detach byte - // arrows as xterm CSI. + // arrows as xterm CSI. assert_eq!(key_to_bytes("up"), Some(b"\x1b[A".to_vec())); assert_eq!(key_to_bytes("left"), Some(b"\x1b[D".to_vec())); // a single literal char passes through. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\tunnelhub.rs:206: /// `token`. A second open (a relink) replaces the prior entry — the old stream /// ids are no longer referenced under the fresh token. // [impl->REQ-SHELL-4] - pub fn open(&self, owner: &str, shell_id: &str, token: &str, owner_stream: u64, shell_stream: u64) { + pub fn open( + &self, + owner: &str, + shell_id: &str, + token: &str, + owner_stream: u64, + shell_stream: u64, + ) { let mut map = self.map.lock().unwrap(); map.insert( slot_key(owner, shell_id), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\tunnelhub.rs:270: /// dispatch change, no brain serve loop). Thread-per-connection (mirroring the /// digest / drive control channels). // [impl->REQ-SHELL-4] -pub fn serve_tunnel_control(name: &str, hub: Arc, broker: Arc) -> io::Result<()> { +pub fn serve_tunnel_control( + name: &str, + hub: Arc, + broker: Arc, +) -> io::Result<()> { let listener = LocalSocketTransport::bind(name)?; loop { let conn = listener.accept()?; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\tunnelhub.rs:447: let env = read_frame(&mut conn)?; let res: TunnelRecvResult = serde_json::from_value(env.payload) .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; - let bytes = decode_bytes(&res.data_b64) - .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; + let bytes = + decode_bytes(&res.data_b64).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; Ok((bytes, res.finished)) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\tunnelhub.rs:535: let hub = TunnelHub::new(); hub.open("doyle", "mock-shell-0", "old-token", 7, 8); hub.open("doyle", "mock-shell-0", "new-token", 11, 12); - assert_eq!(hub.owner_stream("doyle", "mock-shell-0", "new-token"), Some(11)); - assert_eq!(hub.shell_stream("doyle", "mock-shell-0", "new-token"), Some(12)); + assert_eq!( + hub.owner_stream("doyle", "mock-shell-0", "new-token"), + Some(11) + ); + assert_eq!( + hub.shell_stream("doyle", "mock-shell-0", "new-token"), + Some(12) + ); assert_eq!(hub.owner_stream("doyle", "mock-shell-0", "old-token"), None); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\wan.rs:312: // broker's dispatch_endpoint_input). // [impl->REQ-WAN-SPT-HOSTED-DELIVERY] // [impl->REQ-HAZARD-DELIVERY-STARVATION] - if let Some((true, _)) = - crate::inject::try_spt_hosted_inject(&msg.target, &delivered_from, &delivered_body, owlery, false) - { + if let Some((true, _)) = crate::inject::try_spt_hosted_inject( + &msg.target, + &delivered_from, + &delivered_body, + owlery, + false, + ) { let _ = spool::wan_mark_seen_at(&perch_path, &msg.op_id); return WanOutcome::DeliveredInject; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\wan.rs:341: // Empty from → the origin node's display (node_label_display(origin, None)) — // never blank, and it identifies the QUIC-proven origin node. let rendered = render_delivered_from("", origin); - assert!(!rendered.is_empty(), "an empty from must NEVER render blank"); + assert!( + !rendered.is_empty(), + "an empty from must NEVER render blank" + ); assert_eq!(rendered, node_label_display(origin, None)); // A non-empty from is untouched (the identity gate + reply routing keep it). assert_eq!(render_delivered_from("peer-x", origin), "peer-x"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\wan.rs:348: - assert_eq!(render_delivered_from("cli@ENLYZEAM", origin), "cli@ENLYZEAM"); + assert_eq!( + render_delivered_from("cli@ENLYZEAM", origin), + "cli@ENLYZEAM" + ); } // [unit->REQ-WAN-SEND-DELIVERY] the reply-leg token vocabulary round-trips: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\wan.rs:374: WanRequestOutcome::from_token("some_future_verb"), WanRequestOutcome::NoReply ); - assert_eq!(WanRequestOutcome::from_token(""), WanRequestOutcome::NoReply); + assert_eq!( + WanRequestOutcome::from_token(""), + WanRequestOutcome::NoReply + ); } // [unit->REQ-MSG-5] WAN-ingress re-stamp (KH 7.5): a user-msg body from an Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\wan.rs:434: let proven = "aa11node"; // (1) Gateway-typed, hosted on the proven node → honored. - assert!(origin_user_backed(&[row(proven, Some(GATEWAY_TAG))], proven)); + assert!(origin_user_backed( + &[row(proven, Some(GATEWAY_TAG))], + proven + )); // (2) A non-Gateway (agent / other) type → re-stamped. - assert!(!origin_user_backed(&[row(proven, Some("live_agent"))], proven)); - assert!(!origin_user_backed(&[row(proven, Some("ready_agent"))], proven)); + assert!(!origin_user_backed( + &[row(proven, Some("live_agent"))], + proven + )); + assert!(!origin_user_backed( + &[row(proven, Some("ready_agent"))], + proven + )); // (3) No endpoint_type advertised (an N-1 node) → re-stamped (rollout grace). assert!(!origin_user_backed(&[row(proven, None)], proven)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\wan.rs:445: // (4) A Gateway row exists, but on a DIFFERENT node than the proven // origin — keying is on the proven node, never the wire `from`. - assert!(!origin_user_backed(&[row("bb22other", Some(GATEWAY_TAG))], proven)); + assert!(!origin_user_backed( + &[row("bb22other", Some(GATEWAY_TAG))], + proven + )); // …and a mix where the proven node is agent-typed while another node is // the gateway → still re-stamped (the proven node's own type governs). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\attach.rs:180: None, None, ) - .expect("serve"); + .expect("serve"); (outcome, target) }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\attach.rs:711: Some(sid), None, ) - .expect("serve") + .expect("serve") }); // Render the operator's received bytes; the repaint must carry the alt viewport. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\attach.rs:938: None, None, ) - .expect("re-serve"); + .expect("re-serve"); (outcome, life2) }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\attach.rs:1073: None, None, ) - .expect("serve"); + .expect("serve"); (outcome, target) }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\attach.rs:1389: spt_daemon::brain::PumpTrace::Stderr, ) .expect("controller pump conn"); - ctrl.attach_as(sid, 0, AttachIntent::Control, 0, Some("node-A")).expect("control"); + ctrl.attach_as(sid, 0, AttachIntent::Control, 0, Some("node-A")) + .expect("control"); assert_eq!(read_outcome(&mut ctrl), SubscribeOutcome::Controller); // A viewer attaches but then NEVER reads — its writer thread blocks on the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\attach.rs:1507: } } Ok(BrokerEvent::Displaced { .. }) => panic!("a viewer must NEVER receive Displaced"), - Ok(_) => continue, // Size / other — keep reading - Err(_) => continue, // slice timeout — keep waiting until the deadline + Ok(_) => continue, // Size / other — keep reading + Err(_) => continue, // slice timeout — keep waiting until the deadline } } false Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:345: #[cfg(unix)] let (program, args) = ( "sh".to_string(), - vec!["-c".to_string(), "echo ENVCHECK=$SPT_ENDPOINT_ID".to_string()], + vec![ + "-c".to_string(), + "echo ENVCHECK=$SPT_ENDPOINT_ID".to_string(), + ], ); #[cfg(windows)] let (program, args) = ( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:352: "cmd".to_string(), - vec!["/c".to_string(), "echo ENVCHECK=%SPT_ENDPOINT_ID%".to_string()], + vec![ + "/c".to_string(), + "echo ENVCHECK=%SPT_ENDPOINT_ID%".to_string(), + ], ); let mut env = std::collections::BTreeMap::new(); env.insert("SPT_ENDPOINT_ID".to_string(), "wall-b".to_string()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:452: // A child that exits immediately. #[cfg(unix)] - let (program, args) = ("sh".to_string(), vec!["-c".to_string(), "exit 0".to_string()]); + let (program, args) = ( + "sh".to_string(), + vec!["-c".to_string(), "exit 0".to_string()], + ); #[cfg(windows)] - let (program, args) = ("cmd".to_string(), vec!["/c".to_string(), "exit".to_string()]); + let (program, args) = ( + "cmd".to_string(), + vec!["/c".to_string(), "exit".to_string()], + ); send( &mut conn, KIND_SPAWN, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:476: for _ in 0..200 { match read_frame(&mut conn) { Ok(f) if f.kind == KIND_SPAWNED => { - sid = Some(serde_json::from_value::(f.payload).unwrap().session_id); + sid = Some( + serde_json::from_value::(f.payload) + .unwrap() + .session_id, + ); break; } Ok(_) => {} Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:581: [env.SPT_ENDPOINT_ID]\ndirection = \"inject\"\nvalue = \"{{id}}\"\n" ); let manifest = spt_runtime::Manifest::from_toml_str(&manifest_toml).unwrap(); - let prepared = - spt_daemon::harnesshost::prepare_harness_spawn( - "wall-b", "mock", "sid-1", &manifest, false, None, None, - ) - .expect("prepare"); + let prepared = spt_daemon::harnesshost::prepare_harness_spawn( + "wall-b", "mock", "sid-1", &manifest, false, None, None, + ) + .expect("prepare"); // F-013: the id is filled into the env value (not empty). assert_eq!( prepared.env.get("SPT_ENDPOINT_ID").map(String::as_str), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:709: /// Spawn the long-lived echo child and return its session id (draining any /// interleaved early output into `out`). fn spawn_echo(conn: &mut Stream, out: &mut Vec) -> u64 { - send(conn, KIND_SPAWN, serde_json::to_value(echo_spawn_req()).unwrap()); + send( + conn, + KIND_SPAWN, + serde_json::to_value(echo_spawn_req()).unwrap(), + ); loop { let f = read_frame(conn).expect("frame before spawned"); match f.kind.as_str() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:1031: let sid = loop { let f = read_frame(&mut conn).expect("frame before spawned"); if f.kind == KIND_SPAWNED { - break serde_json::from_value::(f.payload).unwrap().session_id; + break serde_json::from_value::(f.payload) + .unwrap() + .session_id; } }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:1101: } } } - let last_live_seq = *dedup.accepted_seqs.last().expect("at least one chunk accepted"); + let last_live_seq = *dedup + .accepted_seqs + .last() + .expect("at least one chunk accepted"); assert!( last_live_seq >= 1, "the ring must hold at least seqs 0 and 1 before the double-subscribe \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\broker.rs:1208: } fn contains(haystack: &[u8], needle: &[u8]) -> bool { - haystack - .windows(needle.len()) - .any(|w| w == needle) + haystack.windows(needle.len()).any(|w| w == needle) } // [int->REQ-HAZARD-CONTROLLER-WRITER-REORDER] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\daemon_e2e.rs:102: } } - /// The cross-OS echo child: reads stdin, writes each line back to stdout. fn echo_req() -> SpawnReq { #[cfg(unix)] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\daemon_lifecycle_real_brain.rs:66: let id = "agent9"; let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch_path).unwrap(); - let mut rec = spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-9", "live_agent"); + let mut rec = + spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-9", "live_agent"); rec.adapter = Some("mock".to_string()); spt_store::info::write_info(&perch_path, &rec).unwrap(); spt_store::info::set_status(&perch_path, STATUS_ONLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\digest.rs:31: static SEQ: AtomicU32 = AtomicU32::new(0); fn unique(prefix: &str) -> String { let n = SEQ.fetch_add(1, Ordering::Relaxed); - format!("spt-daemon-digest-{prefix}-{}-{}.sock", std::process::id(), n) + format!( + "spt-daemon-digest-{prefix}-{}-{}.sock", + std::process::id(), + n + ) } /// A stdin pass-through "extractor": the source bytes (piped in) round-trip to Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\digest.rs:57: PASSTHROUGH, fixture.display(), ); - let src = perch::spt_home().join("srcs").join(format!("{adapter}-src")); + let src = perch::spt_home() + .join("srcs") + .join(format!("{adapter}-src")); std::fs::create_dir_all(&src).unwrap(); std::fs::write(src.join("manifest.toml"), manifest).unwrap(); spt_runtime::registry::register(&perch::adapters_dir(), &src, 1000).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\digest.rs:118: pull_snapshot(&digest_name, "cc", DigestOverride::default()) }) .expect("pull ok") - .expect("a digest projects for the harness-hosted endpoint"); + .expect("a digest projects for the harness-hosted endpoint"); assert!(version >= 1, "the projection has a version"); assert_eq!(digest.turns.len(), 1, "one user turn: {digest:?}"); assert_eq!(digest.turns[0].input.as_deref(), Some("add a file")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\digest.rs:174: reproject(&digest_name, "cc2").expect("nudge a re-projection"); let got = wait_recv(&rx, Duration::from_secs(5)); - assert!(got.is_some(), "the subscriber received the push-driven delta"); + assert!( + got.is_some(), + "the subscriber received the push-driven delta" + ); } /// Block up to `dur` for one value on `rx`. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\digest_cross_node.rs:140: /// serving node's own hub rather than reimplementing a projection on the wire. /// Each scoped test home has its own canonical socket, so every test starts its own hub. fn ensure_digest_hub() { - let name = spt_daemon::digest_socket_name(); - let hub = Arc::new(spt_daemon::DigestHub::new()); - thread::spawn(move || { - let _ = spt_daemon::serve_digest_control(&name, hub); - }); - // Wait for the listener to accept rather than guessing at a sleep. - let deadline = Instant::now() + Duration::from_secs(5); - while Instant::now() < deadline { - if spt_daemon::pull_snapshot( - &spt_daemon::digest_socket_name(), - "no-such-endpoint", - Default::default(), - ) - .is_ok() - { - return; - } - thread::sleep(Duration::from_millis(20)); + let name = spt_daemon::digest_socket_name(); + let hub = Arc::new(spt_daemon::DigestHub::new()); + thread::spawn(move || { + let _ = spt_daemon::serve_digest_control(&name, hub); + }); + // Wait for the listener to accept rather than guessing at a sleep. + let deadline = Instant::now() + Duration::from_secs(5); + while Instant::now() < deadline { + if spt_daemon::pull_snapshot( + &spt_daemon::digest_socket_name(), + "no-such-endpoint", + Default::default(), + ) + .is_ok() + { + return; } - panic!("PRECONDITION: the digest hub never accepted a connection"); + thread::sleep(Duration::from_millis(20)); + } + panic!("PRECONDITION: the digest hub never accepted a connection"); } /// Seed a **log-less** endpoint on the serving node: a perch with no adapter (so Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\dispatch.rs:493: MintedOp::new(Minter::Rc, op()), spt_net::net::attach::AttachIntent::Control, ) - .expect("open refused viewport"); + .expect("open refused viewport"); a.net_stream_subscribe(refused, 0).expect("subscribe"); loop { match a.read_event().expect("event") { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\dispatch.rs:520: MintedOp::new(Minter::Rc, op()), spt_net::net::attach::AttachIntent::Control, ) - .expect("open viewport"); + .expect("open viewport"); a.net_stream_subscribe(viewport, 0).expect("subscribe"); spt_daemon::attach::send_attach_input(&mut a, viewport, b"dispatch-driven\r\n", op()) .expect("type"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\docs_server_e2e.rs:44: std::fs::create_dir_all(root.join("cli")).unwrap(); std::fs::write(root.join("index.html"), b"the book index").unwrap(); std::fs::write(root.join("llms-full.txt"), b"# full docs export bytes").unwrap(); - std::fs::write(root.join("cli").join("reference.md"), b"# CLI reference raw md").unwrap(); + std::fs::write( + root.join("cli").join("reference.md"), + b"# CLI reference raw md", + ) + .unwrap(); std::fs::write(root.join("manifest.schema.json"), b"{\"$id\":\"schema\"}").unwrap(); // A file OUTSIDE the docs root — the traversal target that must stay // unreachable. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\docs_server_e2e.rs:62: // The published URL surface, byte-true (llms contract verbatim). let (status, head, body) = get(port, "/"); assert!(status.contains("200"), "{status}"); - assert!(head.to_lowercase().contains("content-type: text/html"), "{head}"); + assert!( + head.to_lowercase().contains("content-type: text/html"), + "{head}" + ); assert_eq!(body, b"the book index", "index byte-true"); let (status, _, body) = get(port, "/llms-full.txt"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\docs_server_e2e.rs:71: let (status, head, body) = get(port, "/cli/reference.md"); assert!(status.contains("200"), "{status}"); - assert!(head.to_lowercase().contains("text/plain"), "raw md is plain: {head}"); + assert!( + head.to_lowercase().contains("text/plain"), + "raw md is plain: {head}" + ); assert_eq!(body, b"# CLI reference raw md", "append-.md twin byte-true"); let (status, head, _) = get(port, "/manifest.schema.json"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\docs_server_e2e.rs:79: assert!(head.to_lowercase().contains("application/json"), "{head}"); // Traversal shapes: rejected, and the outside file never leaks. - for bad in ["/../secret.txt", "/%2e%2e/secret.txt", "/cli/../../secret.txt"] { + for bad in [ + "/../secret.txt", + "/%2e%2e/secret.txt", + "/cli/../../secret.txt", + ] { let (status, _, body) = get(port, bad); assert!( status.contains("400") || status.contains("404"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\endpoint_lifecycle.rs:291: let mut rec = spt_store::info::InfoJson::new(&dead, "t", relay_pid, "sid-relay", "live_agent"); rec.pid_started_at = relay_birth; rec.parent_pid = Some(std::process::id()); // the OWNER outlives the relay - // The recorded pid HOLDS this endpoint — an `api listen` relay. Convergence is - // role-gated (REQ-PID-ROLE-EVIDENCE), so without this the row would be spared as - // "no knowledge" and this test would pass for the WRONG REASON. + // The recorded pid HOLDS this endpoint — an `api listen` relay. Convergence is + // role-gated (REQ-PID-ROLE-EVIDENCE), so without this the row would be spared as + // "no knowledge" and this test would pass for the WRONG REASON. rec.pid_role = Some(spt_store::info::PidRole::Relay); // controllable stays None: harness-hosted, no broker PTY — the exempt row. spt_store::info::write_info(&dead_perch, &rec).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\endpoint_lifecycle.rs:321: let live = format!("relaylive-{}", std::process::id()); let live_perch = perch::resolve_perch_path(&live, ParentHint::Infer); std::fs::create_dir_all(&live_perch).unwrap(); - let mut rec = spt_store::info::InfoJson::new( - &live, - "t", - std::process::id(), - "sid-sibling", - "live_agent", - ); + let mut rec = + spt_store::info::InfoJson::new(&live, "t", std::process::id(), "sid-sibling", "live_agent"); rec.pid_started_at = spt_store::proc::process_started_at(std::process::id()); spt_store::info::write_info(&live_perch, &rec).unwrap(); spt_store::info::set_status(&live_perch, spt_store::liveness::STATUS_ONLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\endpoint_lifecycle.rs:376: ); // ── Sibling probe: delivery to the LIVE relay still works, after all that. ── - assert_eq!(read_info(&live).status.as_deref(), Some("online"), "sibling untouched"); + assert_eq!( + read_info(&live).status.as_deref(), + Some("online"), + "sibling untouched" + ); let outcome = spt_msg::deliver::send(&live, "prober", "still-here", &owlery); assert_eq!( outcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\endpoint_lifecycle.rs:507: converges — got {offlined:?}" ); let after = read_info(&ghost); - assert_eq!(after.status.as_deref(), Some("offline"), "ghost status converged"); + assert_eq!( + after.status.as_deref(), + Some("offline"), + "ghost status converged" + ); assert!( !perch::resolve_ready_file(&ghost, ParentHint::Infer).exists(), "ready marker cleared — the projection agrees with itself again" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\fixtures\dispatch_fixture.rs:12: use std::time::Duration; fn main() { - let broker = std::env::args().nth(1).expect("usage: dispatch_fixture "); + let broker = std::env::args() + .nth(1) + .expect("usage: dispatch_fixture "); let registry = Arc::new(spt_daemon::registryhost::RegistryHost::new_at( "fixturenode", spt_store::epoch::EpochSource::load_from(&spt_store::perch::epoch_file()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\fixtures\service_fixture.rs:145: return; }; let mut cmd = std::process::Command::new(&bin); - cmd.args(["send", &target]).stdin(std::process::Stdio::piped()); + cmd.args(["send", &target]) + .stdin(std::process::Stdio::piped()); let Ok(mut child) = cmd .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\fixtures\service_fixture.rs:206: write(&dir, BEACON, &std::process::id().to_string()); dump_env(&dir); - write(&dir, STATUS_ADVISORY, "mock advisory: serving\nsecond line must never be read\n"); + write( + &dir, + STATUS_ADVISORY, + "mock advisory: serving\nsecond line must never be read\n", + ); match mode.as_str() { // Ignores the stop marker entirely — the wedged service the grace Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\fixtures\service_fixture.rs:235: _ => serve(&dir, true, Duration::ZERO), } } - Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\idempotent.rs:32: use std::time::Duration; use spt_daemon::brain::{Brain, BrainState, BrokerEvent}; -use spt_daemon::effect::{EffectKey, Minter, MintedOp}; +use spt_daemon::effect::{EffectKey, MintedOp, Minter}; use spt_daemon::msg::SpawnReq; use spt_daemon::Broker; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\inject_control_wedge.rs:534: /// touch a real home). fn init_wedge_home() -> TestHome { let home = TestHome::new(); - // F-036 env-inheritance scrub (doyle RCA, REDISPATCH-STALL gate round - // 1): a live-agent dev shell exports SPT_INJECT_VERIFY_ECHO, the - // in-process test broker inherits it, Layer-2 echo-verify force- - // enables host-wide, and the mock PTY children here never re-render - // typed input → echo-verify miss → respool-once = a spurious - // delivered-plus-spool-row red on exactly the boxes developers run - // gates on. The runtime spawns already scrub these - // (spt_runtime::INJECT_ECHO_ENV_VARS); the test rigs must too. The - // opt-in echo-miss test sets them itself AFTER this init → its set - // wins (the SPT_INJECT_SETTLE_MS precedent above). - for var in spt_runtime::INJECT_ECHO_ENV_VARS { - std::env::remove_var(var); - } + // F-036 env-inheritance scrub (doyle RCA, REDISPATCH-STALL gate round + // 1): a live-agent dev shell exports SPT_INJECT_VERIFY_ECHO, the + // in-process test broker inherits it, Layer-2 echo-verify force- + // enables host-wide, and the mock PTY children here never re-render + // typed input → echo-verify miss → respool-once = a spurious + // delivered-plus-spool-row red on exactly the boxes developers run + // gates on. The runtime spawns already scrub these + // (spt_runtime::INJECT_ECHO_ENV_VARS); the test rigs must too. The + // opt-in echo-miss test sets them itself AFTER this init → its set + // wins (the SPT_INJECT_SETTLE_MS precedent above). + for var in spt_runtime::INJECT_ECHO_ENV_VARS { + std::env::remove_var(var); + } // W5-A: shrink the settle-gate timeout for each test. The mock PTY children here - // (findstr/cat) never answer the DSR readiness probe, so the settle-gate always - // elapses its bounded wait once per worker — its PRESENCE is the invariant, not - // the length, so 80ms keeps the suite fast and removes the fixed-sleep timing - // perturbation the default 400ms introduced (a test that needs a specific value - // sets `SPT_INJECT_SETTLE_MS` itself, AFTER this init → its set wins). - std::env::set_var("SPT_INJECT_SETTLE_MS", "80"); + // (findstr/cat) never answer the DSR readiness probe, so the settle-gate always + // elapses its bounded wait once per worker — its PRESENCE is the invariant, not + // the length, so 80ms keeps the suite fast and removes the fixed-sleep timing + // perturbation the default 400ms introduced (a test that needs a specific value + // sets `SPT_INJECT_SETTLE_MS` itself, AFTER this init → its set wins). + std::env::set_var("SPT_INJECT_SETTLE_MS", "80"); home } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\input_ack_deadlock.rs:396: // return direction and wedge the broker's per-conn handler. for op in 1..=FLOOD_N { let line = format!("FLOODINPUT-{op}\r"); - if let Err(error) = - send_attach_input(&mut operator, stream, line.as_bytes(), op) - { + if let Err(error) = send_attach_input(&mut operator, stream, line.as_bytes(), op) { let _ = flood_tx.send(FloodVerdict::SendFailed { op, error: format!("{error:#}"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\input_ack_deadlock.rs:425: let flood_verdict = match flood_rx.recv_timeout(Duration::from_secs(20)) { Ok(verdict) => verdict, Err(std::sync::mpsc::RecvTimeoutError::Timeout) => FloodVerdict::WatchdogTimeout, - Err(std::sync::mpsc::RecvTimeoutError::Disconnected) => { - FloodVerdict::HelperDisconnected - } + Err(std::sync::mpsc::RecvTimeoutError::Disconnected) => FloodVerdict::HelperDisconnected, }; let (flood_sent, flood_detail) = match &flood_verdict { FloodVerdict::Sent => (true, "Sent".to_string()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\legacy_resident_sweep_e2e.rs:157: // SWEPT: the positive-match legacy wrapper is reaped ... assert!( - wait_until(Duration::from_secs(5), || !spt_store::proc::is_process_alive(mock_pid)), + wait_until(Duration::from_secs(5), || { + !spt_store::proc::is_process_alive(mock_pid) + }), "the matching legacy wrapper must be SWEPT (RED if the kill is bypassed)" ); // ... and its residue (the stale `-psyche` ready registration) is CLEARED. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\legacy_resident_sweep_e2e.rs:166: "the stale `legacyhost-psyche` ready registration (info.json) must be cleared (pin 3)" ); assert!( - !perch::resolve_ready_file("legacyhost-psyche", ParentHint::Explicit("legacyhost")).exists(), + !perch::resolve_ready_file("legacyhost-psyche", ParentHint::Explicit("legacyhost")) + .exists(), "the stale `legacyhost-psyche` `ready` marker must be cleared (pin 3)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\mesh.rs:59: static LOCK: Mutex<()> = Mutex::new(()); fn init_home() -> TestHome { let home = TestHome::new(); - std::env::set_var("SPT_NTP_SERVER", "off"); + std::env::set_var("SPT_NTP_SERVER", "off"); home } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\net_worker_starve.rs:79: /// via `broker.net()`. fn served_broker(name: &str, cfg: NetConfig, dir: &std::path::Path) -> Arc { let host = NetHost::start(cfg).expect("net host start"); - let broker = Broker::bind_in_with_net(name, dir.join("effects.log"), Some(host)) - .expect("bind broker"); + let broker = + Broker::bind_in_with_net(name, dir.join("effects.log"), Some(host)).expect("bind broker"); let serve = Arc::clone(&broker); thread::spawn(move || { let _ = serve.serve(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\net_worker_starve.rs:120: host_a.set_quic_op_timeout(Duration::from_millis(3000)); // B: the black hole — accepts the handshake, never runs the proof responder. - let broker_b = served_broker(&name_b, hermetic(Identity::generate()), &dir.path().join("b")); + let broker_b = served_broker( + &name_b, + hermetic(Identity::generate()), + &dir.path().join("b"), + ); let host_b = broker_b.net().expect("host b"); let b_addr = host_b.addr(); let b_hex = host_b.node_id_hex(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\net_worker_starve.rs:132: base_canary < 250, "baseline canary should be fresh (<250ms), got {base_canary}ms — probe broken?" ); - eprintln!("UW3 baseline: canary_age={base_canary}ms tasks={}", host_a.active_dial_tasks()); + eprintln!( + "UW3 baseline: canary_age={base_canary}ms tasks={}", + host_a.active_dial_tasks() + ); // Fire the burst: K concurrent dead-peer dials straight onto A's NetHost (the // exact pump path). K far exceeds the 2 workers so IF connects hold workers, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\net_worker_starve.rs:197: thread::sleep(Duration::from_millis(80)); let base_canary = host_a.net_canary_age_ms(); - assert!(base_canary < 250, "baseline canary fresh, got {base_canary}ms"); + assert!( + base_canary < 250, + "baseline canary fresh, got {base_canary}ms" + ); eprintln!("UW3-unreach baseline: canary_age={base_canary}ms"); const K: usize = 12; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netbroker.rs:22: use std::time::Duration; use spt_daemon::brain::Brain; -use spt_daemon::effect::{EffectKey, Minter, MintedOp}; +use spt_daemon::effect::{EffectKey, MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost, NET_EFFECT_SESSION}; use spt_daemon::Broker; use spt_net::net::endpoint::{BindScope, LocalDiscovery, RelayPolicy}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netbroker.rs:164: const OP: u64 = 42; // Life 1: journaled dial, then "crash" (connection drop). let mut life1 = connect_retry(&name_a); - let first = life1.net_dial(addr.clone(), Some(MintedOp::new(Minter::Cli, OP))).expect("dial"); + let first = life1 + .net_dial(addr.clone(), Some(MintedOp::new(Minter::Cli, OP))) + .expect("dial"); assert!(first.applied_now, "first delivery runs the dial"); drop(life1); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netbroker.rs:171: // Life 2: re-drives the same durable op (the brain never learned it landed). let mut life2 = connect_retry(&name_a); - let replay = life2.net_dial(addr, Some(MintedOp::new(Minter::Cli, OP))).expect("replayed dial"); + let replay = life2 + .net_dial(addr, Some(MintedOp::new(Minter::Cli, OP))) + .expect("replayed dial"); assert!(!replay.applied_now, "replay is deduped, not re-dialed"); assert_eq!( replay.conn_id, first.conn_id, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netbroker.rs:311: // Re-driving the SAME durable op still ATTEMPTS (errors again) rather than // dedup-succeeding into a phantom — the un-applied key means a clean retry. brain_a - .net_dial(brain_b.net_status().expect("b status").addr, Some(MintedOp::new(Minter::Cli, OP))) + .net_dial( + brain_b.net_status().expect("b status").addr, + Some(MintedOp::new(Minter::Cli, OP)), + ) .expect_err("the un-applied op re-dials (re-times-out), never a phantom dedup"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:21: use std::time::Duration; use spt_daemon::brain::{Brain, BrokerEvent}; -use spt_daemon::effect::{EffectKey, Minter, MintedOp}; +use spt_daemon::effect::{EffectKey, MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost, NET_EFFECT_SESSION}; use spt_daemon::Broker; use spt_net::net::endpoint::{BindScope, LocalDiscovery, RelayPolicy}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:155: let mut sender = connect_retry(&name_a); let mut b_probe = connect_retry(&name_b); let addr = b_probe.net_status().expect("b status").addr; - let conn = sender.net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))).expect("dial"); - let opened = sender.net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))).expect("open"); + let conn = sender + .net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))) + .expect("dial"); + let opened = sender + .net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))) + .expect("open"); for n in 0..KILL_AT { sender - .net_stream_send(opened.stream_id, &chunk_for(n), Some(MintedOp::new(Minter::Cli, 100 + n)), false) + .net_stream_send( + opened.stream_id, + &chunk_for(n), + Some(MintedOp::new(Minter::Cli, 100 + n)), + false, + ) .expect("send"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:182: // broker-owned conn/stream are untouched by the receiver's brain death. for n in KILL_AT..TOTAL { sender - .net_stream_send(opened.stream_id, &chunk_for(n), Some(MintedOp::new(Minter::Cli, 100 + n)), false) + .net_stream_send( + opened.stream_id, + &chunk_for(n), + Some(MintedOp::new(Minter::Cli, 100 + n)), + false, + ) .expect("send into the dead window"); } sender Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:189: - .net_stream_send(opened.stream_id, &[], Some(MintedOp::new(Minter::Cli, 100 + TOTAL)), true) + .net_stream_send( + opened.stream_id, + &[], + Some(MintedOp::new(Minter::Cli, 100 + TOTAL)), + true, + ) .expect("finish"); // Receiver life 2: re-attach, resubscribe from the durable cursor — the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:232: // Sender life 1: dial(1) + open(2) + sends 100..100+CRASH_AFTER, then crash. let mut life1 = connect_retry(&name_a); - let conn = life1.net_dial(addr.clone(), Some(MintedOp::new(Minter::Cli, 1))).expect("dial"); - let opened1 = life1.net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))).expect("open"); + let conn = life1 + .net_dial(addr.clone(), Some(MintedOp::new(Minter::Cli, 1))) + .expect("dial"); + let opened1 = life1 + .net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))) + .expect("open"); for n in 0..CRASH_AFTER { life1 - .net_stream_send(opened1.stream_id, &chunk_for(n), Some(MintedOp::new(Minter::Cli, 100 + n)), false) + .net_stream_send( + opened1.stream_id, + &chunk_for(n), + Some(MintedOp::new(Minter::Cli, 100 + n)), + false, + ) .expect("send"); } drop(life1); // crash before retiring anything from the durable source Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:243: // Sender life 2: re-drive the WHOLE durable sequence with the same op ids. let mut life2 = connect_retry(&name_a); - let conn2 = life2.net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))).expect("redial"); + let conn2 = life2 + .net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))) + .expect("redial"); assert!(!conn2.applied_now, "dial replay deduped"); assert_eq!( conn2.conn_id, conn.conn_id, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:260: let mut deduped = 0; for n in 0..TOTAL { let ack = life2 - .net_stream_send(opened2.stream_id, &chunk_for(n), Some(MintedOp::new(Minter::Cli, 100 + n)), false) + .net_stream_send( + opened2.stream_id, + &chunk_for(n), + Some(MintedOp::new(Minter::Cli, 100 + n)), + false, + ) .expect("re-driven send") .expect("acked"); if !ack.applied_now { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\netstream.rs:272: "exactly the pre-crash sends dedup" ); life2 - .net_stream_send(opened2.stream_id, &[], Some(MintedOp::new(Minter::Cli, 100 + TOTAL)), true) + .net_stream_send( + opened2.stream_id, + &[], + Some(MintedOp::new(Minter::Cli, 100 + TOTAL)), + true, + ) .expect("finish"); // The journal holds each net op exactly once. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notif_drain_validity.rs:61: let store = NotifStore::open().expect("notif store"); let mut epochs = EpochSource::load(); let row = store - .produce("beef", &mut epochs, "home", "update", "doyle", "update available: v0.41.0") + .produce( + "beef", + &mut epochs, + "home", + "update", + "doyle", + "update available: v0.41.0", + ) .expect("produce the notif row"); // The quiet-delivery copy: the composed notify envelope, spooled active_only. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notif_drain_validity.rs:108: // The apply seam dismisses the ROW — the copy in the spool is untouched by // that (it is a detached snapshot), which is the whole defect. let store = NotifStore::open().expect("notif store"); - assert!(store.dismiss(¬if_id).expect("dismiss"), "the row was dismissed"); + assert!( + store.dismiss(¬if_id).expect("dismiss"), + "the row was dismissed" + ); assert_eq!( spool::pending_count_at(&perch).unwrap(), 1, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notif_quiet_delivery.rs:113: &owlery, 2_000, ) - .expect("produce rollback notif"); + .expect("produce rollback notif"); assert!( matches!( rb_fired, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:21: use std::time::Duration; use spt_daemon::brain::{Brain, BrokerEvent}; -use spt_daemon::effect::{Minter, MintedOp}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost}; use spt_daemon::notifsync::{apply_notif_feed, emit_notif_feed, NotifApplyVerdict, NotifPolicy}; use spt_daemon::Broker; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:175: .node_id_hex .expect("node id"); let addr = b_probe.net_status().expect("b status").addr; - let conn = sender.net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))).expect("dial"); - let opened = sender.net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))).expect("open"); + let conn = sender + .net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))) + .expect("dial"); + let opened = sender + .net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))) + .expect("open"); let wire = emit_notif_feed(&store_a, "home").expect("emit"); let split = wire.len() / 2; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:256: .map(|s| s.stream_id) .collect(); let conn_back = b_probe - .net_dial(sender.net_status().expect("a").addr, Some(MintedOp::new(Minter::Cli, 3))) + .net_dial( + sender.net_status().expect("a").addr, + Some(MintedOp::new(Minter::Cli, 3)), + ) .expect("dial back"); let opened_back = b_probe .net_open_stream(conn_back.conn_id, Some(MintedOp::new(Minter::Cli, 4))) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:350: // as a pre-0046 peer would still carry it). let node_row = store_a .produce_scoped( - &a_node, &mut epochs, "home", "consent", "spt-update", "staged", - NotifScope::Node, Some("spt-core:update-staged"), None, + &a_node, + &mut epochs, + "home", + "consent", + "spt-update", + "staged", + NotifScope::Node, + Some("spt-core:update-staged"), + None, ) .unwrap(); let subnet_row = store_a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:359: .unwrap(); let stale_update = store_a .produce_scoped( - &a_node, &mut epochs, "home", "consent", "spt-update", "old prompt", - NotifScope::Subnet, None, None, + &a_node, + &mut epochs, + "home", + "consent", + "spt-update", + "old prompt", + NotifScope::Subnet, + None, + None, ) .unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:386: store_b.get(&node_row.notif_id).unwrap().is_none(), "peer never materializes the node-scoped row" ); - assert!(!store_b.get(&stale_update.notif_id).unwrap().unwrap().dismissed); + assert!( + !store_b + .get(&stale_update.notif_id) + .unwrap() + .unwrap() + .dismissed + ); // A upgrades and runs the one-shot migration: every spt-update consent row // is auto-dismissed locally — both the stale subnet row AND the node-scoped Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:393: // one (both carry from_id=spt-update, kind=consent). The node row's // dismissal stays home (never feeds); the subnet row's replicates. - assert_eq!(store_a.dismiss_stale_update_rows().unwrap(), 2, "both spt-update consent rows"); + assert_eq!( + store_a.dismiss_stale_update_rows().unwrap(), + 2, + "both spt-update consent rows" + ); // Feed 2: the dismissal replicates — B's copy latches dismissed. let records2 = feed_over_wire(&mut sender, &mut b_probe, &store_a, "home", 3, 4); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:399: apply_notif_feed(&store_b, &a_node, &records2, &policy_b).expect("apply 2"); assert!( - store_b.get(&stale_update.notif_id).unwrap().unwrap().dismissed, + store_b + .get(&stale_update.notif_id) + .unwrap() + .unwrap() + .dismissed, "migration dismissal reached the not-yet-upgraded peer" ); // The migration left the agent row untouched. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\notifsync.rs:405: - assert!(!store_b.get(&subnet_row.notif_id).unwrap().unwrap().dismissed); + assert!( + !store_b + .get(&subnet_row.notif_id) + .unwrap() + .unwrap() + .dismissed + ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:15: use std::time::Duration; use ed25519_dalek::{Signer, SigningKey}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost}; use spt_daemon::propagate::{ classify_status, request_update, request_update_status, serve_update, ConvergeState, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:21: UpdatePullOutcome, UpdateServeOutcome, UpdateStatusReport, }; -use spt_daemon::effect::{Minter, MintedOp}; use spt_daemon::relcache::ReleaseCache; -use spt_store::epoch::EpochSource; -use spt_store::notif::{NotifScope, NotifStore}; use spt_daemon::release::{ current_platform, RejectReason, ReleaseMetadata, SignedRelease, SignedUpdateSet, UpdateArtifactMetadata, UpdateSetMetadata, VerifyPolicy, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:30: }; -use spt_daemon::update::{ - plan_verified_update_set, BrokerAbi, UpdateClass, BROKER_RESOURCE_ABI, -}; +use spt_daemon::update::{plan_verified_update_set, BrokerAbi, UpdateClass, BROKER_RESOURCE_ABI}; use spt_daemon::{Brain, Broker}; use spt_net::net::endpoint::{BindScope, LocalDiscovery, RelayPolicy}; use spt_net::net::update::UpdRecord; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:37: use spt_proto::identity::Identity; +use spt_store::epoch::EpochSource; +use spt_store::notif::{NotifScope, NotifStore}; use spt_store::roster::{RosterEntry, RosterStore}; use std::collections::{BTreeMap, BTreeSet}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:226: // A musl node fetches + verifies its OWN artifact — the W3 field gap closed // (before W3 a musl node hit NoArtifactForPlatform: no release carried musl). - let musl_plan = - plan_verified_update_set(&running, &signed, "x86_64-unknown-linux-musl", musl_bytes, &pol) - .expect("musl artifact must select + verify — no NoArtifactForPlatform"); + let musl_plan = plan_verified_update_set( + &running, + &signed, + "x86_64-unknown-linux-musl", + musl_bytes, + &pol, + ) + .expect("musl artifact must select + verify — no NoArtifactForPlatform"); assert_eq!(musl_plan.class, UpdateClass::BrainOnly); // The signature covers the musl bytes: tampered musl bytes are rejected. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:245: ); // gnu default-Linux path unchanged: a gnu node still selects the gnu artifact. - let gnu_plan = - plan_verified_update_set(&running, &signed, "x86_64-unknown-linux-gnu", gnu_bytes, &pol) - .expect("gnu artifact still selects + verifies"); + let gnu_plan = plan_verified_update_set( + &running, + &signed, + "x86_64-unknown-linux-gnu", + gnu_bytes, + &pol, + ) + .expect("gnu artifact still selects + verifies"); assert_eq!(gnu_plan.class, UpdateClass::BrainOnly); // Selection stays exact: a platform absent from the set is rejected loudly. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:337: .collect(); let mut req_brain = connect_retry(&requester.name); - let conn = req_brain.net_dial(addr, Some(MintedOp::new(Minter::Cli, op()))).expect("dial"); + let conn = req_brain + .net_dial(addr, Some(MintedOp::new(Minter::Cli, op()))) + .expect("dial"); let open_op = op(); let running = BrokerAbi::current(); let req_cache = requester.cache.clone(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:557: .collect(); let mut req_brain = connect_retry(&v.name); - let conn = req_brain.net_dial(addr, Some(MintedOp::new(Minter::Cli, op()))).expect("dial"); + let conn = req_brain + .net_dial(addr, Some(MintedOp::new(Minter::Cli, op()))) + .expect("dial"); let open_op = op(); let running = BrokerAbi::current(); let pol = policy(5); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:644: .collect(); let mut req_brain = connect_retry(&requester.name); - let conn = req_brain.net_dial(addr, Some(MintedOp::new(Minter::Cli, op()))).expect("dial"); + let conn = req_brain + .net_dial(addr, Some(MintedOp::new(Minter::Cli, op()))) + .expect("dial"); let asker = thread::spawn(move || request_update_status(&mut req_brain, conn.conn_id)); let (stream, origin) = wait_for_stream_except(&mut serve_brain, &skip); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:834: fn stage_notif(store: &NotifStore, epochs: &mut EpochSource) -> String { store .produce_scoped( - "cafe", epochs, "home", "consent", "spt-update", - "An spt-core update is available", NotifScope::Node, - Some("spt-core:update-staged"), None, + "cafe", + epochs, + "home", + "consent", + "spt-update", + "An spt-core update is available", + NotifScope::Node, + Some("spt-core:update-staged"), + None, ) .expect("produce update-staged notif") .notif_id Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:861: // ── IN-BAND leg: applied-version counter. ─────────────────────────────── let cache = ReleaseCache::open(&dir.path().join("in-band")); - cache.stage(&signed_release(6, &artifact), &artifact).expect("stage v6"); + cache + .stage(&signed_release(6, &artifact), &artifact) + .expect("stage v6"); let store = NotifStore::open_at(&dir.path().join("in-band-notifs.db")).expect("store"); let mut epochs = EpochSource::load_from(&dir.path().join("in-band-epoch")); let id = stage_notif(&store, &mut epochs); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:868: // No applied record, empty product_version → neither signal fires → live. spt_daemon::pump::dismiss_staged_notif_if_caught_up(&cache, &store, "home"); - assert!(!store.get(&id).unwrap().unwrap().dismissed, "behind → stays live"); + assert!( + !store.get(&id).unwrap().unwrap().dismissed, + "behind → stays live" + ); // Recorded apply catches the counter up → dismissed by key. cache.record_applied(6).expect("record applied"); spt_daemon::pump::dismiss_staged_notif_if_caught_up(&cache, &store, "home"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:874: - assert!(store.get(&id).unwrap().unwrap().dismissed, "in-band applied → dismissed"); + assert!( + store.get(&id).unwrap().unwrap().dismissed, + "in-band applied → dismissed" + ); // ── OUT-OF-BAND leg: running image vs staged product_version, applied // record ABSENT throughout. ──────────────────────────────────────────── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\propagate.rs:884: let store_p = NotifStore::open_at(&dir.path().join("oob-past-notifs.db")).expect("store"); let mut ep_p = EpochSource::load_from(&dir.path().join("oob-past-epoch")); let id_p = stage_notif(&store_p, &mut ep_p); - assert_eq!(cache_past.applied_version(), None, "no applied record — out of band"); + assert_eq!( + cache_past.applied_version(), + None, + "no applied record — out of band" + ); spt_daemon::pump::dismiss_staged_notif_if_caught_up(&cache_past, &store_p, "home"); assert!( store_p.get(&id_p).unwrap().unwrap().dismissed, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_context_file_e2e.rs:110: fn seed_bound_perch(id: &str, session_id: &str) { let path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&path).unwrap(); - let mut rec = InfoJson::new(id, "2026-06-01T00:00:00Z", std::process::id(), session_id, "live_agent"); + let mut rec = InfoJson::new( + id, + "2026-06-01T00:00:00Z", + std::process::id(), + session_id, + "live_agent", + ); rec.status = Some(STATUS_ONLINE.to_string()); rec.controllable = Some(true); info::write_info(&path, &rec).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_context_file_e2e.rs:166: std::fs::write(&gate, "").unwrap(); let report = host.pulse_tick(Some(sid)).expect("first pulse tick"); assert!(report.echo_fired, "the armed gate fired the first turn"); - assert_eq!(report.turn_outcome, Some(Ok(())), "the first turn ran cleanly (non-empty stdout)"); + assert_eq!( + report.turn_outcome, + Some(Ok(())), + "the first turn ran cleanly (non-empty stdout)" + ); assert!( wait_until(Duration::from_secs(10), || proof.exists()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_event_turn_e2e.rs:133: // ephemeral model does not). This is the structural "no resident" discriminator // (`is_perch_alive` reads an ABSENT perch as alive — interim parity — so it is // NOT the probe here). - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); assert!( !psyche_perch.join("info.json").exists(), "no {{id}}-psyche perch is bound by a per-event turn (RED if a resident spawn is re-added)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_event_turn_e2e.rs:164: // An online live_agent perch with the adapter set — reconcile hosts it. let perch_path = perch::resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch_path).unwrap(); - let mut rec = spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-1", "live_agent"); + let mut rec = + spt_store::info::InfoJson::new(id, "t", std::process::id(), "sid-1", "live_agent"); rec.adapter = Some("mock".to_string()); spt_store::info::write_info(&perch_path, &rec).unwrap(); spt_store::info::set_status(&perch_path, STATUS_ONLINE).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_event_turn_e2e.rs:184: &cfg, StartReason::Cold, ); - assert_eq!(set.len(), 1, "the online live endpoint is hosted (pulse loop started)"); + assert_eq!( + set.len(), + 1, + "the online live endpoint is hosted (pulse loop started)" + ); // The host spawned NO resident psyche: the nested perch is never a live process. // (RED if host_one re-adds the retired spawn_psyche_owned resident spawn.) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_event_turn_e2e.rs:191: - let psyche_perch = - perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); + let psyche_perch = perch::resolve_perch_path(&format!("{id}-psyche"), ParentHint::Explicit(id)); // Give any (erroneously re-added) resident spawn a moment to bind its perch, then // assert none was bound (info.json absent = no resident — see leg 1's note). - let never_resident = - !wait_until(Duration::from_secs(2), || psyche_perch.join("info.json").exists()); + let never_resident = !wait_until(Duration::from_secs(2), || { + psyche_perch.join("info.json").exists() + }); // Tear down the driver thread via the public un-host path (flip offline → // reconcile un-hosts + joins) so the tempdir cleanup does not race a live loop. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_residency_expectation_e2e.rs:177: ) }; run_reconcile(); - assert_eq!(set.len(), 1, "the online live endpoint is hosted (pulse driver started)"); + assert_eq!( + set.len(), + 1, + "the online live endpoint is hosted (pulse driver started)" + ); // Drive the failing turns: re-arm the echo gate repeatedly (the driver consumes it // each fire), until several turns have fired AND the fault stamp has landed. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_residency_expectation_e2e.rs:214: ); // The budget stamped the fault on the PARENT — psyche fields only. - assert!(stamped, "the turn-failure budget must stamp psyche_host_error on the parent"); + assert!( + stamped, + "the turn-failure budget must stamp psyche_host_error on the parent" + ); let info = spt_store::info::read_info(&perch_path).expect("parent perch readable"); assert!( info.psyche_host_error.is_some(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_residency_expectation_e2e.rs:234: // (1) still HOSTED (no un-host churn), (2) still ONLINE (deliverable), (3) ready // marker still PRESENT. A resident-model teardown (the deleted v0.13.2 shape) would // fail all three — that is the RED-first guard-revert. - assert_eq!(set.len(), 1, "the endpoint is NOT un-hosted (no rehost churn)"); assert_eq!( + set.len(), + 1, + "the endpoint is NOT un-hosted (no rehost churn)" + ); + assert_eq!( info.status.as_deref(), Some(STATUS_ONLINE), "the parent stays ONLINE (deliverable) — psyche trouble never de-stamps status" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\psyche_residency_expectation_e2e.rs:250: // FAILING PSYCHE never triggered it above). spt_store::info::set_status(&perch_path, spt_store::liveness::STATUS_OFFLINE).unwrap(); run_reconcile(); - assert!(set.is_empty(), "an offline-transitioned endpoint IS un-hosted (the legit path)"); + assert!( + set.is_empty(), + "an offline-transitioned endpoint IS un-hosted (the legit path)" + ); std::env::remove_var("SPT_PSYCHE_TURN_STRIKE_BUDGET"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\pump.rs:807: converge( "this node advertised to the live peer in the same round", || { - live_probe - .net_streams() - .map(|r| r.streams.iter().any(|s| s.remote_id_hex == a_hex)) - .unwrap_or(false) + live_probe + .net_streams() + .map(|r| r.streams.iter().any(|s| s.remote_id_hex == a_hex)) + .unwrap_or(false) }, ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\pumpdeadline.rs:18: use spt_daemon::brain::Brain; use spt_daemon::codec::read_frame; -use spt_daemon::transport::{recv_hello, DaemonTransport, LocalSocketTransport}; use spt_daemon::frame::Role; +use spt_daemon::transport::{recv_hello, DaemonTransport, LocalSocketTransport}; static SEQ: AtomicU32 = AtomicU32::new(0); fn unique_name() -> String { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\pumpdeadline.rs:58: // then drop it (unblocking the client's reader thread to exit cleanly). thread::sleep(timeout * 3); }); - let mut brain = - Brain::cold_start_pump(&name, 0, timeout, spt_daemon::brain::PumpTrace::Stderr).expect("connect pump-mode brain"); + let mut brain = Brain::cold_start_pump(&name, 0, timeout, spt_daemon::brain::PumpTrace::Stderr) + .expect("connect pump-mode brain"); let started = Instant::now(); let err = brain Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\pumpdeadline.rs:148: recv_hello(&mut conn, Role::Brain).expect("hello handshake"); thread::sleep(timeout * 3); }); - let mut brain = - Brain::cold_start_pump(&name, 0, timeout, spt_daemon::brain::PumpTrace::Stderr).expect("connect pump-mode brain"); + let mut brain = Brain::cold_start_pump(&name, 0, timeout, spt_daemon::brain::PumpTrace::Stderr) + .expect("connect pump-mode brain"); // reply_read_deadline = now + min(io_timeout, 10s) = the 200ms test budget. let deadline = brain.reply_read_deadline(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\redispatch_stall.rs:519: Ok(_) => break true, Err(e) if e.to_string().contains("lease canceled") - || e.to_string().contains("subscriber busy") => + || e.to_string().contains("subscriber busy") => { thread::sleep(Duration::from_millis(300)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\registry_lifecycle.rs:446: // direction — more time only gives a replaying gen-2 more chance to be // CAUGHT, so a slow box cannot manufacture a false pass. thread::sleep(Duration::from_millis(1500)); // ~60 polls of the fresh generation - // A STORM BOUND, not an equality — and the distinction is load-bearing. - // - // This assertion used to be `== writes_before`, and it was INVALID rather - // than merely flaky: `snapshot_write_count` is a GLOBAL counter on B's - // registry, so it charges to gen-2 any write from ANY source landing in - // this window. Proven by experiment, not inferred — with gen-2 NEVER - // STARTED the equality still failed 8 of 15 runs, and `writes_before` - // itself is nondeterministic run to run (observed 6 and 7) because the - // pump's own late work can land either side of the sample. A claim keyed - // on a proxy (total writes on the box) instead of on its subject (writes - // CAUSED BY gen-2). - // - // WHAT THIS CAN AND CANNOT DO, stated plainly so nobody re-tightens it: - // it catches a replay STORM — the v0.34/v0.36 regression re-applied ~4361 - // rows per generation, and here a storm would re-apply the whole history, - // roughly DOUBLING the count. It CANNOT attribute a single write to a - // generation. Exact attribution needs per-generation write accounting, - // which does not exist yet (seeded separately) — and the rig cannot - // manufacture it, because the PRODUCT has no generation boundary to - // observe: `run_dispatch_loop` returns while its spawned workers are still - // applying, so gen-1's writes can land after gen-2 has started. - // - // The bound is derived from the rig's own scale rather than hardcoded: a - // storm re-applies the history the pump built, so that history IS the - // storm's size. - // - // NO PRECONDITION FLOOR on the history size, and the reason is structural - // rather than a tolerance: this bound gets STRICTER as the history shrinks, - // not weaker. A storm re-applies the whole history, so it adds ~scale - // writes while the bound permits scale/2 — the storm is caught for ANY - // scale >= 1, and at scale 0 the bound demands growth 0 outright. Vacuity - // would come from a LARGE scale (which permits proportionally more), never - // a small one. An earlier draft guarded `scale >= 4` because the observed - // values happened to run 4-7; that was a threshold keyed on a MEASUREMENT - // rather than on the thing, it protected the direction that was never at - // risk, and on a slow box it would have produced a confusing red from the - // guard itself. + // A STORM BOUND, not an equality — and the distinction is load-bearing. + // + // This assertion used to be `== writes_before`, and it was INVALID rather + // than merely flaky: `snapshot_write_count` is a GLOBAL counter on B's + // registry, so it charges to gen-2 any write from ANY source landing in + // this window. Proven by experiment, not inferred — with gen-2 NEVER + // STARTED the equality still failed 8 of 15 runs, and `writes_before` + // itself is nondeterministic run to run (observed 6 and 7) because the + // pump's own late work can land either side of the sample. A claim keyed + // on a proxy (total writes on the box) instead of on its subject (writes + // CAUSED BY gen-2). + // + // WHAT THIS CAN AND CANNOT DO, stated plainly so nobody re-tightens it: + // it catches a replay STORM — the v0.34/v0.36 regression re-applied ~4361 + // rows per generation, and here a storm would re-apply the whole history, + // roughly DOUBLING the count. It CANNOT attribute a single write to a + // generation. Exact attribution needs per-generation write accounting, + // which does not exist yet (seeded separately) — and the rig cannot + // manufacture it, because the PRODUCT has no generation boundary to + // observe: `run_dispatch_loop` returns while its spawned workers are still + // applying, so gen-1's writes can land after gen-2 has started. + // + // The bound is derived from the rig's own scale rather than hardcoded: a + // storm re-applies the history the pump built, so that history IS the + // storm's size. + // + // NO PRECONDITION FLOOR on the history size, and the reason is structural + // rather than a tolerance: this bound gets STRICTER as the history shrinks, + // not weaker. A storm re-applies the whole history, so it adds ~scale + // writes while the bound permits scale/2 — the storm is caught for ANY + // scale >= 1, and at scale 0 the bound demands growth 0 outright. Vacuity + // would come from a LARGE scale (which permits proportionally more), never + // a small one. An earlier draft guarded `scale >= 4` because the observed + // values happened to run 4-7; that was a threshold keyed on a MEASUREMENT + // rather than on the thing, it protected the direction that was never at + // risk, and on a slow box it would have produced a confusing red from the + // guard itself. let storm_scale = writes_before; let growth = b_registry.snapshot_write_count() - writes_before; assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\replicate.rs:21: use std::time::Duration; use spt_daemon::brain::{Brain, BrokerEvent}; -use spt_daemon::effect::{Minter, MintedOp}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost}; use spt_daemon::Broker; use spt_net::net::endpoint::{BindScope, LocalDiscovery, RelayPolicy}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\replicate.rs:174: // ── The wire: dial B, open a stream, send the feed (journaled ops). ───── let mut b_probe = connect_retry(&name_b); let addr = b_probe.net_status().expect("b status").addr; - let conn = sender.net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))).expect("dial"); - let opened = sender.net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))).expect("open"); + let conn = sender + .net_dial(addr, Some(MintedOp::new(Minter::Cli, 1))) + .expect("dial"); + let opened = sender + .net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, 2))) + .expect("open"); // Send 1: the Active row, split MID-RECORD across two separate sends — // the receiver's decoder, not QUIC chunk shape, owns record framing. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\replicate.rs:182: let line = update_active.encode_line(); let split = line.len() / 2; sender - .net_stream_send(opened.stream_id, &line[..split], Some(MintedOp::new(Minter::Cli, 100)), false) + .net_stream_send( + opened.stream_id, + &line[..split], + Some(MintedOp::new(Minter::Cli, 100)), + false, + ) .expect("send first half"); sender - .net_stream_send(opened.stream_id, &line[split..], Some(MintedOp::new(Minter::Cli, 101)), false) + .net_stream_send( + opened.stream_id, + &line[split..], + Some(MintedOp::new(Minter::Cli, 101)), + false, + ) .expect("send second half"); // Send 2: the newer Offline. Send 3: the e1 Active REPLAYED (a lagging // duplicate arriving late) — the lease must drop it at B. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\reseed.rs:14: use std::time::Duration; use spt_daemon::nethost::{NetConfig, NetHost}; -use spt_daemon::seedproofx::{ - MemberStatus, MembershipSource, RosterExchange, SubnetCred, -}; +use spt_daemon::seedproofx::{MemberStatus, MembershipSource, RosterExchange, SubnetCred}; use spt_net::net::endpoint::{BindScope, LocalDiscovery, RelayPolicy}; use spt_proto::identity::Identity; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\reseed.rs:59: } }), adopt_seed: Arc::new(move |subnet: &str, s: &[u8], epoch: u64| { - adopted.lock().unwrap().push((subnet.to_string(), s.to_vec(), epoch)); + adopted + .lock() + .unwrap() + .push((subnet.to_string(), s.to_vec(), epoch)); true }), } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\reseed.rs:123: "the offliner received a seed push" ); let pushed = b_adopt.lock().unwrap().clone(); - assert_eq!(pushed, vec![("home".to_string(), seed(2), 2)], "current seed adopted"); + assert_eq!( + pushed, + vec![("home".to_string(), seed(2), 2)], + "current seed adopted" + ); // A re-seeds, it does not pull one (it is the fresh side): nothing adopted. - assert!(a_adopt.lock().unwrap().is_empty(), "the fresh node adopts nothing"); + assert!( + a_adopt.lock().unwrap().is_empty(), + "the fresh node adopts nothing" + ); // A registered the conn only to deliver the seed — it is re-seed-only, so it // proves NO subnet (it serves nothing; it is replaced when B reconnects full). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\reseed.rs:133: - assert!(wait_until(|| a.conn_count() == 1), "conn kept alive for delivery"); + assert!( + wait_until(|| a.conn_count() == 1), + "conn kept alive for delivery" + ); assert!( a.conn_proven_subnets(1).is_empty(), "a re-seed-only conn carries no proven subnet" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\resume_custody_aba.rs:92: fn seed_online_sessionless_endpoint(id: &str) -> std::path::PathBuf { let perch = resolve_perch_path(id, ParentHint::Infer); std::fs::create_dir_all(&perch).unwrap(); - let mut rec = spt_store::info::InfoJson::new(id, "0", std::process::id(), "sid-prev", "live_agent"); + let mut rec = + spt_store::info::InfoJson::new(id, "0", std::process::id(), "sid-prev", "live_agent"); rec.adapter = Some("mockresume".to_string()); rec.controllable = Some(true); spt_store::info::write_info(&perch, &rec).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\resume_custody_aba.rs:201: must DEFER, never normalize the seat out from under it. got offlined={offlined:?}" ); assert_eq!( - spt_store::info::read_info(&perch).unwrap().status.as_deref(), + spt_store::info::read_info(&perch) + .unwrap() + .status + .as_deref(), Some("online"), "the deferred row keeps its online record for the incoming bind" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\rosterprop.rs:48: let sink_store = Arc::clone(&store); let status_store = Arc::clone(&store); RosterExchange { - provider: Arc::new(move |proven: &HashSet, self_addr: &serde_json::Value| { - let mut s = prov_store.lock().unwrap(); - let addr = if self_addr.is_null() { - None - } else { - Some(self_addr.clone()) - }; - for subnet in proven { - s.upsert_self(subnet, &self_hex, "lbl", "mid", addr.clone(), "1700000000", 5); - } - let mut entries = Vec::new(); - let mut tombs = Vec::new(); - for subnet in proven { - let (m, t) = s.roster_for(subnet); - entries.extend(m); - tombs.extend(t); - } - (entries, tombs) - }), + provider: Arc::new( + move |proven: &HashSet, self_addr: &serde_json::Value| { + let mut s = prov_store.lock().unwrap(); + let addr = if self_addr.is_null() { + None + } else { + Some(self_addr.clone()) + }; + for subnet in proven { + s.upsert_self( + subnet, + &self_hex, + "lbl", + "mid", + addr.clone(), + "1700000000", + 5, + ); + } + let mut entries = Vec::new(); + let mut tombs = Vec::new(); + for subnet in proven { + let (m, t) = s.roster_for(subnet); + entries.extend(m); + tombs.extend(t); + } + (entries, tombs) + }, + ), sink: Arc::new(move |entries, tombs| { let mut s = sink_store.lock().unwrap(); for e in &entries { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\servicehost_supervision_e2e.rs:29: use std::time::{Duration, Instant}; use spt_daemon::servicehost::{ - quiesce_for_update, reconcile_registered, release_hold_and_reconcile, status_registered, - Latch, Opportunity, QuiesceOutcome, ServiceOutcome, ServiceParams, ServiceSet, + quiesce_for_update, reconcile_registered, release_hold_and_reconcile, status_registered, Latch, + Opportunity, QuiesceOutcome, ServiceOutcome, ServiceParams, ServiceSet, }; use spt_runtime::manifest::{Service, ServiceStart}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\servicehost_supervision_e2e.rs:216: ); assert!(gone, "the cooperative exit must leave no process behind"); assert!( - !dir.join(spt_daemon::servicehost::SERVICE_STOP_MARKER).exists(), + !dir.join(spt_daemon::servicehost::SERVICE_STOP_MARKER) + .exists(), "the marker is retired with the ceremony — a marker left behind would \ stop the service again the moment it came back" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\servicehost_supervision_e2e.rs:375: keep suppressing it" ); assert!( - row.detail.is_some_and(|d| d.contains("MOCK_STARTUP_DIAGNOSTIC")), + row.detail + .is_some_and(|d| d.contains("MOCK_STARTUP_DIAGNOSTIC")), "and the operator-facing outcome carries the same evidence, not just \ the fault's name" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\two_origin_spanning.rs:129: }; let mut keys = BTreeMap::new(); keys.insert("session_id".to_string(), "A".to_string()); - let echo = fetch_history(&history, &keys, "cc", ParentHint::Infer, Duration::from_secs(10)) - .expect("history fetch"); + let echo = fetch_history( + &history, + &keys, + "cc", + ParentHint::Infer, + Duration::from_secs(10), + ) + .expect("history fetch"); assert_eq!(echo.len(), 1); assert!( echo[0].raw.contains("FULL-FIDELITY-A"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\two_origin_spanning.rs:140: // ── Consumer 2: the digest reads [digest] CONTRACT, spanned + merged ──────── let digest = project_endpoint_digest("cc", &DigestOverride::default()); - let inputs: Vec<_> = digest.turns.iter().filter_map(|t| t.input.as_deref()).collect(); + let inputs: Vec<_> = digest + .turns + .iter() + .filter_map(|t| t.input.as_deref()) + .collect(); assert_eq!( inputs, vec!["before clear", "after clear"], Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\two_origin_spanning.rs:149: // A /clear boundary divider separates the sessions (REQ-TERM-6). assert!( - digest.turns.iter().any(|t| t.entries.iter().any(|e| matches!( - e, - DigestEntry::Boundary { kind, .. } if kind == "clear" - ))), + digest + .turns + .iter() + .any(|t| t.entries.iter().any(|e| matches!( + e, + DigestEntry::Boundary { kind, .. } if kind == "clear" + ))), "a /clear boundary marker is present" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\two_origin_spanning.rs:184: !rendered.contains("FULL-FIDELITY"), "the digest is contract-typed (extra adapter fields ignored): {rendered}" ); - assert!(rendered.contains("── /clear ──"), "boundary renders distinctively: {rendered}"); + assert!( + rendered.contains("── /clear ──"), + "boundary renders distinctively: {rendered}" + ); } // [int->REQ-DIGEST-GENERATION-SUPERSEDE] the flynn digest gen-union rig, end to Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\two_origin_spanning.rs:265: // windowing: without supersede the span carries FIVE input turns // (a-one, a-two, [clear], a-one, a-two, b-tail) and all survive the window — // RED. With supersede the ancestor's two rows collapse into B's generation. - let over = DigestOverride { window_turns: Some(10), ..Default::default() }; + let over = DigestOverride { + window_turns: Some(10), + ..Default::default() + }; let digest = project_endpoint_digest("ccgen", &over); - let inputs: Vec<_> = digest.turns.iter().filter_map(|t| t.input.as_deref()).collect(); + let inputs: Vec<_> = digest + .turns + .iter() + .filter_map(|t| t.input.as_deref()) + .collect(); assert_eq!( inputs, vec!["a-one", "a-two", "b-tail"], Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\two_origin_spanning.rs:276: // Gen A fully superseded (all rows replayed into B) → its /clear divider is // orphaned and trimmed (rule 5: a divider sits only between ≥1-row sessions). assert!( - !digest - .turns + !digest.turns.iter().any(|t| t + .entries .iter() - .any(|t| t.entries.iter().any(|e| matches!( - e, - DigestEntry::Boundary { .. } - ))), + .any(|e| matches!(e, DigestEntry::Boundary { .. }))), "no orphaned /clear divider once the replayed ancestor is emptied: {:?}", digest.turns ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:60: use spt_daemon::brain::Brain; use spt_daemon::broker::Broker; -use spt_daemon::effect::{Minter, MintedOp}; use spt_daemon::dispatch::{run_dispatch_loop, DispatchPaths}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost}; use spt_daemon::pump::{ run_peer_pump, PeerResolver, PumpCadence, PumpConfig, PumpHooks, PumpPaths, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:81: use spt_store::info::{self, InfoJson}; use spt_store::notif::{NotifRow, NotifStore}; use spt_store::perch::{self, ParentHint}; +use spt_store::roster::RosterStore; use spt_store::spool; use spt_store::subnet::SubnetStore; -use spt_store::roster::RosterStore; use spt_store::visibility::VisibilityStore; use tempfile::TempDir; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:596: Some(DRIVE_TGT_ALIAS), ) .expect("mint agent-owned offdrive"); - let g = - spt_store::shellinfo::spawn_record(&perch::owlery_dir(), GW_OWNER, "offdrive", Some(GW_ALIAS)) - .expect("mint gateway-owned offdrive"); + let g = spt_store::shellinfo::spawn_record( + &perch::owlery_dir(), + GW_OWNER, + "offdrive", + Some(GW_ALIAS), + ) + .expect("mint gateway-owned offdrive"); println!("TWOHOST role B: offline drive shells minted — {ID_B}/{a}, {GW_OWNER}/{g}"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:888: rig.wait, || { spool::peek_all_at(&gw_perch) - .map(|rows| rows.iter().any(|(_, _, body, _)| body.contains("op=\"press\""))) + .map(|rows| { + rows.iter() + .any(|(_, _, body, _)| body.contains("op=\"press\"")) + }) .unwrap_or(false) }, ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:906: // ordinary wire rest op. The durable rest record is the same observable // rung 8 proved; what is NEW is the bare-id ROUTE that produced the wake // (A asserts the routing decision on its side). - rig_wait("A-3: A's setup suspend landed (B suspended)", rig.wait, || { - spt_daemon::resting::read_rest(&perch_b) - .map(|r| r.state == spt_daemon::resting::RestState::Suspended) - .unwrap_or(false) - }); + rig_wait( + "A-3: A's setup suspend landed (B suspended)", + rig.wait, + || { + spt_daemon::resting::read_rest(&perch_b) + .map(|r| r.state == spt_daemon::resting::RestState::Suspended) + .unwrap_or(false) + }, + ); // [int->REQ-REST-VERB-ROUTING] - rig_wait("A-3: A's bare-id ROUTED wake landed (B active)", rig.wait, || { - spt_daemon::resting::read_rest(&perch_b) - .map(|r| r.state == spt_daemon::resting::RestState::Active) - .unwrap_or(false) - }); + rig_wait( + "A-3: A's bare-id ROUTED wake landed (B active)", + rig.wait, + || { + spt_daemon::resting::read_rest(&perch_b) + .map(|r| r.state == spt_daemon::resting::RestState::Active) + .unwrap_or(false) + }, + ); info::set_last_active(&perch_b, now_ms()).expect("re-stamp B's recency post-A-3"); println!("TWOHOST OK: A-3 bare-id wake (serve side)"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:963: // The child's control attach stamps the perch on this broker's sessions-poll // converge (KH 7.29) — polling in the probe IS the production trigger (the // reconcile tick's query_live_session_endpoints). - rig_wait("B-2: the attacher child's control stamps landed", rig.wait, || { - let _ = host_brain.sessions(); - info::read_info(&perch_b2).is_some_and(|i| i.controlled && i.driven_by.is_some()) - }); + rig_wait( + "B-2: the attacher child's control stamps landed", + rig.wait, + || { + let _ = host_brain.sessions(); + info::read_info(&perch_b2).is_some_and(|i| i.controlled && i.driven_by.is_some()) + }, + ); // Signal A (store-state, the rung-7 replication pattern): stamps seen — // A kills the child on this row's arrival. store_b Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:989: // sink is reaped on a sessions poll and the stamps CLEAR — the exact field // outcome B-2 exists for (a stale ONLINE+CONTROLLED that never healed). // [int->REQ-CONTROLLER-LIVENESS-REAP] - rig_wait("B-2: the severed controller's stamps CLEAR (reap + converge)", rig.wait, || { - let _ = host_brain.sessions(); - info::read_info(&perch_b2).is_some_and(|i| !i.controlled && i.driven_by.is_none()) - }); + rig_wait( + "B-2: the severed controller's stamps CLEAR (reap + converge)", + rig.wait, + || { + let _ = host_brain.sessions(); + info::read_info(&perch_b2).is_some_and(|i| !i.controlled && i.driven_by.is_none()) + }, + ); println!("TWOHOST OK: B-2 dead-controller reap cleared the stamps"); // ── Hold until A finishes its side (it pushes the done-file as its last Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1128: // [int->REQ-NET-1] let mut a = connect_retry(&broker_name); let conn = a - .net_dial(rig.peer_broker_addr("a"), Some(MintedOp::new(Minter::Cli, op()))) + .net_dial( + rig.peer_broker_addr("a"), + Some(MintedOp::new(Minter::Cli, op())), + ) .expect("dial B"); let opened = a .net_open_stream(conn.conn_id, Some(MintedOp::new(Minter::Cli, op()))) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1181: println!("TWOHOST OK: file fetch (sid {sid})"); // [int->REQ-INST-8] - let viewport = - spt_daemon::attach::request_attach(&mut a, conn.conn_id, sid, 0, MintedOp::new(Minter::Rc, op()), spt_net::net::attach::AttachIntent::Control).expect("attach"); + let viewport = spt_daemon::attach::request_attach( + &mut a, + conn.conn_id, + sid, + 0, + MintedOp::new(Minter::Rc, op()), + spt_net::net::attach::AttachIntent::Control, + ) + .expect("attach"); a.net_stream_subscribe(viewport, 0) .expect("subscribe viewport"); spt_daemon::attach::send_attach_input( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1555: "A-3 setup suspend applied an edge at B: {out:?}" ); rig_wait("A-3: B advertises Suspended at A", rig.wait, || { - registry.rows(&rig.subnet, ID_B).iter().any(|i| { - i.node == rig.b_hex() && i.status == spt_net::net::registry::Status::Suspended - }) + registry + .rows(&rig.subnet, ID_B) + .iter() + .any(|i| i.node == rig.b_hex() && i.status == spt_net::net::registry::Status::Suspended) }); // The PRODUCTION routing decision (red = the pre-fix local-only WOKE_FAIL). // [int->REQ-REST-VERB-ROUTING] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1599: "A-3 routed wake applied an edge at B: {out:?}" ); rig_wait("A-3: B advertises Active again at A", rig.wait, || { - registry.rows(&rig.subnet, ID_B).iter().any(|i| { - i.node == rig.b_hex() && i.status == spt_net::net::registry::Status::Active - }) + registry + .rows(&rig.subnet, ID_B) + .iter() + .any(|i| i.node == rig.b_hex() && i.status == spt_net::net::registry::Status::Active) }); println!("TWOHOST OK: A-3 bare-id wake routed via the production assembly"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1719: b.expect("digest-pull pump brain could not connect") }; let dig_conn = dig_a - .net_dial(rig.peer_broker_addr("a"), Some(MintedOp::new(Minter::Cli, op()))) + .net_dial( + rig.peer_broker_addr("a"), + Some(MintedOp::new(Minter::Cli, op())), + ) .expect("dial B for the digest pull"); // Poll until B's buffer answers — the rig's barrier discipline (observable Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1753: // B's CONTENT crossed — not an empty shell, and not A's own store. assert!(version >= 1, "the remote projection carries a version"); - assert_eq!(digest.turns.len(), 1, "B's one finished turn crossed: {digest:?}"); + assert_eq!( + digest.turns.len(), + 1, + "B's one finished turn crossed: {digest:?}" + ); let turn = &digest.turns[0]; assert_eq!( turn.input.as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1769: "REQ-DIGEST-SEAL-ON-IDLE: B's idle endpoint must send a SEALED trailing \ turn across the wire: {turn:?}" ); - let sealed_seq = turn.input_seq.expect("a sealed turn carries its stable seq"); + let sealed_seq = turn + .input_seq + .expect("a sealed turn carries its stable seq"); assert_eq!( sealed_seq, 0, "log-less sink: the sealed seq is the source line index B assigned" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\twohost.rs:1779: | spt_term::DigestEntry::ToolSprint { seq, .. } => *seq, _ => None, }); - assert_eq!(entry_seq, Some(1), "B's agent reply sealed at its own line index"); + assert_eq!( + entry_seq, + Some(1), + "B's agent reply sealed at its own line index" + ); // SEQ STABILITY ACROSS A REAL WAN ROUND TRIP: pull again; an unchanged idle // endpoint must return the identical digest. This is the property that makes Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\wake_single_flight.rs:47: static SEQ: AtomicU32 = AtomicU32::new(0); fn unique_name() -> String { let n = SEQ.fetch_add(1, Ordering::Relaxed); - format!("spt-daemon-wakesingleflight-{}-{}.sock", std::process::id(), n) + format!( + "spt-daemon-wakesingleflight-{}-{}.sock", + std::process::id(), + n + ) } fn kill_pid(pid: u32) { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\wake_single_flight.rs:109: let mut c = connect(name); let req = sleeper_spawn_req(endpoint); barrier.wait(); // both wakes cross this line together → concurrent dispatch_spawn - write_frame(&mut c, &Envelope::new(KIND_SPAWN, serde_json::to_value(req).unwrap())) - .expect("send spawn"); + write_frame( + &mut c, + &Envelope::new(KIND_SPAWN, serde_json::to_value(req).unwrap()), + ) + .expect("send spawn"); let sid = loop { match read_frame(&mut c) { Ok(f) if f.kind == KIND_SPAWNED => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\wake_single_flight.rs:117: - break serde_json::from_value::(f.payload).unwrap().session_id + break serde_json::from_value::(f.payload) + .unwrap() + .session_id } Ok(_) => continue, Err(e) => panic!("wake read failed: {e}"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\wake_single_flight.rs:157: } } - eprintln!("=== W4 SINGLE-FLIGHT WAKE: sid1={sid1} sid2={sid2} session_count={session_count} ==="); + eprintln!( + "=== W4 SINGLE-FLIGHT WAKE: sid1={sid1} sid2={sid2} session_count={session_count} ===" + ); // Exactly one launch tree: both wakes resolved to the SAME session (the second // deduped to the first), and the broker holds exactly one session. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\xfer.rs:22: use std::time::Duration; use spt_daemon::brain::{Brain, BrokerEvent}; -use spt_daemon::effect::{Minter, MintedOp}; +use spt_daemon::effect::{MintedOp, Minter}; use spt_daemon::nethost::{NetConfig, NetHost}; use spt_daemon::xfer::{fetch_file, push_file, serve_xfer, XferServeOutcome}; use spt_daemon::Broker; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\xfer.rs:120: .expect("b status") .node_id_hex .expect("node id"); - let conn = operator.net_dial(a_addr, Some(MintedOp::new(Minter::Cli, 1))).expect("dial"); + let conn = operator + .net_dial(a_addr, Some(MintedOp::new(Minter::Cli, 1))) + .expect("dial"); let dest = dir.path().join("fetched").join("plan.md"); let dest_clone = dest.clone(); let progress_b_clone = progress_b.clone(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\xfer.rs:186: // Confinement: a traversal fetch is refused with an Err record (the // operator's fetch errors; nothing outside the root is served). let conn2 = operator - .net_dial(target.net_status().expect("a").addr, Some(MintedOp::new(Minter::Cli, 3))) + .net_dial( + target.net_status().expect("a").addr, + Some(MintedOp::new(Minter::Cli, 3)), + ) .expect("dial2"); let dest2 = dir.path().join("stolen.txt"); let fetcher2 = thread::spawn(move || { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\xfer.rs:252: // Operator B: push on its own thread; it blocks until the commit echo — // which only the successor brain will send. let mut operator = connect_retry(&name_b); - let conn = operator.net_dial(a_addr, Some(MintedOp::new(Minter::Cli, 1))).expect("dial"); + let conn = operator + .net_dial(a_addr, Some(MintedOp::new(Minter::Cli, 1))) + .expect("dial"); let total = bytes.len() as u64; let pusher = thread::spawn(move || { push_file( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\digest.rs:68: /// The `[digest]` `source` template, or `[history]`'s `locate_template` as the /// DRY default. `None` when neither is declared. -pub fn resolve_source_template<'a>(digest: &'a Digest, history: Option<&'a History>) -> Option<&'a str> { +pub fn resolve_source_template<'a>( + digest: &'a Digest, + history: Option<&'a History>, +) -> Option<&'a str> { digest .source .as_deref() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\digest.rs:222: resolve_source_template(&d, Some(&history)), Some(history.locate_template.as_deref().unwrap()) ); - let lines = extract_digest(&d, Some(&history), &no_keys(), Duration::from_secs(10), None) - .expect("extract"); + let lines = extract_digest( + &d, + Some(&history), + &no_keys(), + Duration::from_secs(10), + None, + ) + .expect("extract"); assert_eq!(lines.len(), 1); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\digest.rs:312: matches!(e, DigestExtractError::Runtime(RuntimeError::Timeout { .. })), "got {e}" ); - assert!(start.elapsed() < Duration::from_secs(5), "must return promptly"); + assert!( + start.elapsed() < Duration::from_secs(5), + "must return promptly" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\echo.rs:304: Err(Error::new(ErrorKind::PermissionDenied, "os error 5")) }); assert_eq!(out.unwrap_err().kind(), ErrorKind::PermissionDenied); - assert_eq!(calls, ACCESS_DENIED_ATTEMPTS, "bounded: budget attempts, then loud"); + assert_eq!( + calls, ACCESS_DENIED_ATTEMPTS, + "bounded: budget attempts, then loud" + ); // A non-denied kind never retries. let mut calls = 0; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:361: ) .expect("route"); let live = read_live("doyle"); - assert!(!live.contains("!!checkpoint!!"), "sentinel stripped from durable live tier"); + assert!( + !live.contains("!!checkpoint!!"), + "sentinel stripped from durable live tier" + ); assert!(live.contains("do the thing"), "inter-marker text kept"); assert!(live.contains("brief")); }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:400: "doyle", )) .unwrap(); - assert_eq!(role, "ORIGINAL ROLE", "no automated writer touches live-role.md"); + assert_eq!( + role, "ORIGINAL ROLE", + "no automated writer touches live-role.md" + ); assert!(read_live("doyle").contains("the brief")); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:453: ) .expect("route"); let tiers: Vec = writes.iter().map(|w| w.tier).collect(); - assert_eq!(tiers, vec![Tier::Live], "live commits; project tier skipped on empty id"); + assert_eq!( + tiers, + vec![Tier::Live], + "live commits; project tier skipped on empty id" + ); let cs = ContextStore::open_or_init().unwrap(); - assert!(cs.branch_store().tip("a-doyle").unwrap().is_some(), "a- committed"); assert!( + cs.branch_store().tip("a-doyle").unwrap().is_some(), + "a- committed" + ); + assert!( cs.branch_store().tip("p-").unwrap().is_none(), "no p- branch minted for an owlery-internal / unresolved anchor" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:535: ) .unwrap(); - let ingested = - ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); + let ingested = ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); assert_eq!(ingested.len(), 1); // Live tier committed this pass (the slice that CAN be written). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:543: assert!(read_live("doyle").contains("who I am")); let tiers: Vec = ingested[0].writes.iter().map(|w| w.tier).collect(); assert_eq!(tiers, vec![Tier::Live], "only the live tier is written"); - assert!(ingested[0].preserved, "un-committable project slice ⇒ preserved"); + assert!( + ingested[0].preserved, + "un-committable project slice ⇒ preserved" + ); // The drop was NOT deleted — it survives for a later resolvable ingest. assert!(drop.exists(), "preserved drop must remain on disk"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:610: assert!( matches!( third[0].writes.as_slice(), - [TierWrite { tier: Tier::Project, outcome: WriteOutcome::Written { .. } }] + [TierWrite { + tier: Tier::Project, + outcome: WriteOutcome::Written { .. } + }] ), "the project slice finally lands" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:617: - assert!(!drop.exists(), "drop deleted once its project slice is durable"); + assert!( + !drop.exists(), + "drop deleted once its project slice is durable" + ); assert!(read_project("proj-x", "doyle").contains("what I do here")); // Nothing lost: both texts durably present across the cycle. assert!(read_live("doyle").contains("who I am")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:635: let untagged = drops.path().join("doyle-commune.md"); std::fs::write(&untagged, "just an operator note, no tags").unwrap(); let ing = ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); - assert!(!ing[0].preserved, "untagged fallback is not a project slice"); + assert!( + !ing[0].preserved, + "untagged fallback is not a project slice" + ); assert!(!untagged.exists(), "untagged drop consumed"); assert!(read_live("doyle").contains("just an operator note")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:673: ) .unwrap(); - let ingested = - ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); + let ingested = ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); assert!( !ingested[0].preserved, "marker-only project slice carries no content ⇒ not deferred" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:681: ); - assert!(!drop.exists(), "contentless-project drop is deleted, not stranded"); + assert!( + !drop.exists(), + "contentless-project drop is deleted, not stranded" + ); assert!(read_live("doyle").contains("real live text")); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:705: .unwrap(); // Ingest under an EMPTY project_id: live commits, project defers. - let ingested = - ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); + let ingested = ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); assert_eq!(ingested.len(), 1); assert_eq!(ingested[0].kind, DropKind::Signoff); - assert!(ingested[0].preserved, "un-committable project slice ⇒ preserved"); + assert!( + ingested[0].preserved, + "un-committable project slice ⇒ preserved" + ); // Live slice committed this pass. assert!(read_live("doyle").contains("signing off now")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:718: // The signoff sentinel is GONE — it must never linger (the sweep // rationale); the pending was carried to the COMMUNE suffix instead. - assert!(!signoff.exists(), "signoff sentinel deleted, never left to be swept"); - assert!(commune.exists(), "deferred pending carried under the commune suffix"); + assert!( + !signoff.exists(), + "signoff sentinel deleted, never left to be swept" + ); + assert!( + commune.exists(), + "deferred pending carried under the commune suffix" + ); // The commune-suffix pending is the project-only form. let pending = std::fs::read_to_string(&commune).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:733: // Simulate the listener-start sweep: nothing to reap (no signoff file), // and the commune pending must survive it intact. - let swept = crate::signoff::sweep_stale_signoff(drops.path(), "doyle") - .expect("sweep"); - assert!(!swept, "no stale signoff to reap — the pending is not signoff-named"); - assert!(commune.exists(), "sweep must not touch the commune-suffix pending"); + let swept = crate::signoff::sweep_stale_signoff(drops.path(), "doyle").expect("sweep"); + assert!( + !swept, + "no stale signoff to reap — the pending is not signoff-named" + ); + assert!( + commune.exists(), + "sweep must not touch the commune-suffix pending" + ); assert_eq!( std::fs::read_to_string(&commune).unwrap(), pending, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:747: let resolved = ingest_drops(drops.path(), "doyle", "proj-x", 2000, 60_000).expect("ingest"); assert_eq!(resolved.len(), 1); - assert!(!resolved[0].preserved, "resolved ingest consumes the pending"); assert!( + !resolved[0].preserved, + "resolved ingest consumes the pending" + ); + assert!( matches!( resolved[0].writes.as_slice(), - [TierWrite { tier: Tier::Project, outcome: WriteOutcome::Written { .. } }] + [TierWrite { + tier: Tier::Project, + outcome: WriteOutcome::Written { .. } + }] ), "the project slice finally lands" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:758: - assert!(!commune.exists(), "pending deleted once its project slice is durable"); + assert!( + !commune.exists(), + "pending deleted once its project slice is durable" + ); assert!(read_project("proj-x", "doyle").contains("the project brief")); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\ingest.rs:784: ) .unwrap(); - let ingested = - ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); + let ingested = ingest_drops(drops.path(), "doyle", "", 1000, 60_000).expect("ingest"); assert_eq!(ingested.len(), 2, "both drops processed in one pass"); assert!( ingested.iter().all(|i| i.preserved), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\inject.rs:65: record_context_injection("doyle", KIND_OWL_MESSAGE, "from todlando: hi there"); let log = std::fs::read_to_string(perch.join("digest.log")).unwrap(); let line = log.lines().next().unwrap(); - assert!(line.contains(r#""context_kind":"owl_message""#), "discriminator: {line}"); assert!( + line.contains(r#""context_kind":"owl_message""#), + "discriminator: {line}" + ); + assert!( line.contains(r#""body":"from todlando: hi there""#), "whitespace-normalized body: {line}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\inject.rs:73: - assert!(line.contains(r#""ts":"#) && line.contains("Z\"}"), "rfc3339-utc ts: {line}"); + assert!( + line.contains(r#""ts":"#) && line.contains("Z\"}"), + "rfc3339-utc ts: {line}" + ); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\lib.rs:28: pub mod digest; pub mod echo; pub mod history; -pub mod inject; pub mod ingest; +pub mod inject; pub mod outbound; pub mod psyche; pub mod pulse; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\lib.rs:45: pub use digest::{extract_digest, resolve_source_template, DigestExtractError}; pub use echo::{run_echo_commune, stamp_provenance, EchoError, EchoResult}; pub use history::{fetch_history, HistoryError, HistoryRecord}; -pub use inject::{ - record_context_injection, KIND_ECHO_MIRROR, KIND_OWL_MESSAGE, KIND_PSYCHE_DOWNLOAD, -}; pub use ingest::{ ingest_drops, route_slices, route_two_slice, DropKind, Ingested, Tier, TierWrite, +}; +pub use inject::{ + record_context_injection, KIND_ECHO_MIRROR, KIND_OWL_MESSAGE, KIND_PSYCHE_DOWNLOAD, }; pub use outbound::{parse_psyche_intents, PsycheIntent}; pub use psyche::{PsycheError, PsycheHandle}; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\pulse.rs:190: ) .expect("tick"); assert_eq!(t1.ingested.len(), 1); - assert!(t1.ingested[0].preserved, "unresolved project slice is preserved"); + assert!( + t1.ingested[0].preserved, + "unresolved project slice is preserved" + ); assert!(drop.exists(), "preserved drop remains for a later pulse"); let live_path = live_context_file(&tracked_dir(), "perri"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\pulse.rs:212: ) .expect("tick"); assert_eq!(t2.ingested.len(), 1); - assert!(!t2.ingested[0].preserved, "resolved pulse consumes the drop"); - assert!(!drop.exists(), "drop gone once the project slice is durable"); + assert!( + !t2.ingested[0].preserved, + "resolved pulse consumes the drop" + ); + assert!( + !drop.exists(), + "drop gone once the project slice is durable" + ); let project_path = project_context_file(&tracked_dir(), "perri-proj", "perri"); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:108: // [impl->REQ-RESUME-CONTEXT-PULL] fn append_pending(out: &mut String, tag: &str, file: Option<&std::path::Path>) { let Some(path) = file else { return }; - let Ok(body) = std::fs::read_to_string(path) else { return }; + let Ok(body) = std::fs::read_to_string(path) else { + return; + }; // Strip the checkpoint sentinel before presenting (pre-synthesis strip point): // the marker is spt-core control metadata, never agent context. The inter-marker // text is kept. [impl->REQ-RESUME-CONTEXT-PULL] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:156: assert_eq!(slices.project.as_deref(), Some("project mind")); // A different project sees the live tier only (no cross-project leak). - let other = download_psyche_context("doyle", "other-proj", None, None).expect("live only"); + let other = + download_psyche_context("doyle", "other-proj", None, None).expect("live only"); let slices = spt_proto::envelope::parse_two_slice(&other); assert_eq!(slices.live.as_deref(), Some("live mind")); assert_eq!(slices.project, None); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:187: let live_at = got.find("").expect("live slice"); let proj_at = got.find("").expect("project slice"); assert!(role_at < live_at, "role renders before live-context"); - assert!(live_at < proj_at, "live-context renders before project-context"); + assert!( + live_at < proj_at, + "live-context renders before project-context" + ); // The inbound two-slice grammar ignores the injected role. let slices = spt_proto::envelope::parse_two_slice(&got); assert_eq!(slices.live.as_deref(), Some("live mind")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:196: // A role-only mind still renders (role first, nothing else). assert!(download_psyche_context("solo", "proj-x", None, None).is_none()); std::fs::write(cs.live_role_path("solo").unwrap(), "just a role").unwrap(); - let got = download_psyche_context("solo", "proj-x", None, None).expect("role-only composes"); + let got = + download_psyche_context("solo", "proj-x", None, None).expect("role-only composes"); assert!(got.contains("\njust a role\n")); assert!(!got.contains(""), "no live tier yet"); }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:216: let commune = drops.path().join("doyle-commune.md"); // Absent drop → no pending slice. - let got = download_psyche_context("doyle", "proj-x", Some(&commune), None) - .expect("composed"); - assert!(!got.contains(""), "absent drop adds nothing"); + let got = + download_psyche_context("doyle", "proj-x", Some(&commune), None).expect("composed"); + assert!( + !got.contains(""), + "absent drop adds nothing" + ); // Present drop → appended AFTER the durable tiers, body verbatim. std::fs::write(&commune, "\nfresh brief\n").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:225: - let got = download_psyche_context("doyle", "proj-x", Some(&commune), None) - .expect("composed"); + let got = + download_psyche_context("doyle", "proj-x", Some(&commune), None).expect("composed"); assert!(got.contains( "\n\nfresh brief\n\n" )); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:252: with_home(|_| { let drops = tempfile::tempdir().unwrap(); let commune = drops.path().join("ckpt-commune.md"); - std::fs::write(&commune, "live brief !!checkpoint!! wake up and ship !!checkpoint!! tail") - .unwrap(); + std::fs::write( + &commune, + "live brief !!checkpoint!! wake up and ship !!checkpoint!! tail", + ) + .unwrap(); let got = download_psyche_context("ckpt", "proj-x", Some(&commune), None) .expect("pending-only composes"); assert!(got.contains("")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\resume.rs:261: !got.contains("!!checkpoint!!"), "the sentinel must be stripped from presented context" ); - assert!(got.contains("wake up and ship"), "inter-marker wake text is kept"); + assert!( + got.contains("wake up and ship"), + "inter-marker wake text is kept" + ); assert!(got.contains("live brief")); }); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-live\src\turn.rs:103: .chars() .map(|c| if c == '\n' || c == '\r' { ' ' } else { c }) .collect(); - if cut > 0 { format!("…{tail}") } else { tail } + if cut > 0 { + format!("…{tail}") + } else { + tail + } } /// Run one bounded live-Psyche turn: feed `stdin` to the `psyche_resume` role, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\emit.rs:105: // structural from ignored. The subtle no-double-wrap invariant doyle gates. #[test] fn typed_body_from_wins_over_structural_from_no_double_wrap() { - let typed = - r#"build done"#; + let typed = r#"build done"#; // Structural from deliberately DIFFERS from the body's own from. let lines = render_event_lines("structfrom", typed); assert_eq!(lines, vec![typed.to_string()], "verbatim, single envelope"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\emit.rs:113: let whole = render_event_whole("structfrom", typed); - assert_eq!(whole, typed, "whole-render passes the same typed body verbatim"); + assert_eq!( + whole, typed, + "whole-render passes the same typed body verbatim" + ); // Parses as ONE notify with the body's from — structfrom nowhere. let p = parse_event(&lines[0]).unwrap(); assert_eq!(p.event_type.as_deref(), Some("notify")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\emit.rs:118: assert_eq!(p.from(), Some("bodyfrom")); - assert!(!lines[0].contains("structfrom"), "structural from must not leak in"); + assert!( + !lines[0].contains("structfrom"), + "structural from must not leak in" + ); } // [unit->REQ-MSG-5] the delivery surface RENDERS the user-msg type: a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ready.rs:150: ); let backlog: Vec<(String, String)> = spool::drain_non_deferred_audited_at(&perch_path, &audit) - .map_err(|e| format!("Failed to drain spool backlog: {}", e))? - .into_iter() - .map(|m| (m.from, m.body)) - .collect(); + .map_err(|e| format!("Failed to drain spool backlog: {}", e))? + .into_iter() + .map(|m| (m.from, m.body)) + .collect(); Ok(( ReadyAgent { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:406: let info_before = fs::read(perch::resolve_info_file(&from, ParentHint::Infer)).unwrap(); let spool_before = fs::read(perch::resolve_spool_db(&from, ParentHint::Infer)).unwrap(); - let outcome = ring(&target, &from, "anyone?", Duration::from_millis(200), &owlery); + let outcome = ring( + &target, + &from, + "anyone?", + Duration::from_millis(200), + &owlery, + ); assert_eq!( outcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:416: }, "an existing perch must be refused, not adopted" ); - assert!(perch_path.exists(), "ring deleted a perch it did not create"); + assert!( + perch_path.exists(), + "ring deleted a perch it did not create" + ); assert_eq!( fs::read(perch::resolve_info_file(&from, ParentHint::Infer)).unwrap(), info_before, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:448: let victim = unique_id("test-ring-disclose-victim"); let (_agent, _) = ReadyAgent::start(&target).unwrap(); // online, silent - // The victim: a live-shaped perch (marker down) holding mail from a - // THIRD id — not from the ringer, and not for the ringer. + // The victim: a live-shaped perch (marker down) holding mail from a + // THIRD id — not from the ringer, and not for the ringer. let perch_path = perch::resolve_perch_path(&victim, ParentHint::Infer); fs::create_dir_all(&perch_path).unwrap(); let rec = InfoJson::new(&victim, "earlier", std::process::id(), "sess", "live_agent"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:459: // A SECOND id rings, presenting itself as the victim's from-id — the // adoption path's entry condition. - let outcome = ring(&target, &victim, "you up?", Duration::from_millis(200), &owlery); + let outcome = ring( + &target, + &victim, + "you up?", + Duration::from_millis(200), + &owlery, + ); match &outcome { RingOutcome::Replied { from, body } => panic!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:499: let info_file = perch::resolve_info_file(&from, ParentHint::Infer); fs::write(&info_file, b"{\"id\": \"trunca").unwrap(); - let outcome = ring(&target, &from, "hello?", Duration::from_millis(200), &owlery); + let outcome = ring( + &target, + &from, + "hello?", + Duration::from_millis(200), + &owlery, + ); assert_eq!( outcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:529: let spool_file = perch::resolve_spool_db(&from, ParentHint::Infer); let spool_before = fs::read(&spool_file).unwrap(); - let outcome = ring(&target, &from, "hello?", Duration::from_millis(200), &owlery); + let outcome = ring( + &target, + &from, + "hello?", + Duration::from_millis(200), + &owlery, + ); assert_eq!( outcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\ring.rs:556: let perch_path = perch::resolve_perch_path(&from, ParentHint::Infer); fs::create_dir_all(&perch_path).unwrap(); - let outcome = ring(&target, &from, "hello?", Duration::from_millis(200), &owlery); + let outcome = ring( + &target, + &from, + "hello?", + Duration::from_millis(200), + &owlery, + ); assert_eq!( outcome, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\wire.rs:100: #[test] fn encode_decode_round_trips_structural() { let payload = encode_frame("alice", "hi\nbob"); - assert_eq!(decode_frame(&payload).unwrap(), ("alice".to_string(), "hi\nbob".to_string())); + assert_eq!( + decode_frame(&payload).unwrap(), + ("alice".to_string(), "hi\nbob".to_string()) + ); } // [unit->REQ-MSG-ENVELOPE] empty from => anonymous (len-0 from prefix), body intact. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-msg\src\wire.rs:107: #[test] fn encode_empty_from_is_anonymous() { let payload = encode_frame("", "no reply"); - assert_eq!(decode_frame(&payload).unwrap(), ("".to_string(), "no reply".to_string())); + assert_eq!( + decode_frame(&payload).unwrap(), + ("".to_string(), "no reply".to_string()) + ); } // [unit->REQ-MSG-ENVELOPE] a typed body rides the wire verbatim — the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:152: from_seq: 0, intent: AttachIntent::Control, endpoint_id: None, - gen: 0, }, + gen: 0, + }, AttachRecord::Output { seq: 3, data_b64: "aGk=".into(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:161: data_b64: "bHM=".into(), op_id: 42, }, - AttachRecord::Resize { rows: 40, cols: 120 }, - AttachRecord::Size { rows: 40, cols: 120 }, + AttachRecord::Resize { + rows: 40, + cols: 120, + }, + AttachRecord::Size { + rows: 40, + cols: 120, + }, AttachRecord::Exit { code: Some(0) }, - AttachRecord::Displaced { by: "hfenduleam".into() }, + AttachRecord::Displaced { + by: "hfenduleam".into(), + }, ]; let mut wire = Vec::new(); for r in &records { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:216: from_seq: 0, intent: AttachIntent::Control, endpoint_id: None, - gen: 0, }], + gen: 0, + }], "omitted intent defaults to Control (N-1 operator)" ); assert_eq!(AttachIntent::default(), AttachIntent::Control); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:235: from_seq: 0, intent: AttachIntent::Control, endpoint_id: Some("ling@gravity".into()), - gen: 0, }; + gen: 0, + }; let mut dec = AttachDecoder::new(); assert_eq!(dec.push(&remote.encode_line()), vec![remote.clone()]); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:249: from_seq: 0, intent: AttachIntent::Control, endpoint_id: None, - gen: 0, }; + gen: 0, + }; assert!( !String::from_utf8_lossy(&local.encode_line()).contains("endpoint_id"), "local wire omits endpoint_id (N-1 byte-identity)" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:262: // [unit->REQ-RCVIEW-1] the three intents round-trip distinctly on the wire. #[test] fn attach_intents_round_trip() { - for intent in [AttachIntent::Viewer, AttachIntent::Control, AttachIntent::Take] { - let r = AttachRecord::Request { session_id: 1, from_seq: 0, intent, endpoint_id: None , gen: 0 }; + for intent in [ + AttachIntent::Viewer, + AttachIntent::Control, + AttachIntent::Take, + ] { + let r = AttachRecord::Request { + session_id: 1, + from_seq: 0, + intent, + endpoint_id: None, + gen: 0, + }; let mut dec = AttachDecoder::new(); assert_eq!(dec.push(&r.encode_line()), vec![r]); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\attach.rs:279: from_seq: 0, intent: AttachIntent::Take, endpoint_id: None, - gen: 0, }; - let displaced = AttachRecord::Displaced { by: "hfenduleam".into() }; + gen: 0, + }; + let displaced = AttachRecord::Displaced { + by: "hfenduleam".into(), + }; for r in [take, displaced] { let mut dec = AttachDecoder::new(); assert_eq!(dec.push(&r.encode_line()), vec![r]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\mesh\seedproof.rs:141: /// between the two tags. // [impl->REQ-MESH-1] pub fn tag(&self, mk: &MembershipKey, prover: ProofRole) -> [u8; PROOF_TAG_LEN] { - let mut mac = HmacSha256::new_from_slice(mk.key_bytes()) - .expect("HMAC accepts any key length"); + let mut mac = + HmacSha256::new_from_slice(mk.key_bytes()).expect("HMAC accepts any key length"); mac.update(PROOF_DOMAIN); mac.update(prover.label()); // subnet_id is variable-length → length-prefix it. The rest are Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\mesh\seedproof.rs:509: let mutual = |dt: &[u8], at: &[u8]| { t.verify(&good, ProofRole::Dialer, dt) && t.verify(&good, ProofRole::Acceptor, at) }; - assert!(mutual(&dialer_tag, &acceptor_tag_good), "both prove → admit"); assert!( + mutual(&dialer_tag, &acceptor_tag_good), + "both prove → admit" + ); + assert!( !mutual(&dialer_tag, &acceptor_tag_bad), "one impostor → reject" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\mesh\seedproof.rs:613: let f = SeedProofFrame::ProofSet { proofs: proofs.clone(), }; - assert_eq!(SeedProofFrame::decode(&f.encode()), Some(f), "round-trip {proofs:?}"); + assert_eq!( + SeedProofFrame::decode(&f.encode()), + Some(f), + "round-trip {proofs:?}" + ); } // Over the generation cap. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\notif.rs:137: \"kind\":\"agent\",\"from_id\":\"ling\",\"body\":\"build done\",\"created_ms\":1000,\ \"dismissed\":true,\"seen\":[\"doyle\"],\"last_surfaced_ms\":5000}}\n"; let got = NotifDecoder::new().push(old); - assert_eq!(got, vec![NotifRecord::Row { row: r }], "old shape → defaults"); + assert_eq!( + got, + vec![NotifRecord::Row { row: r }], + "old shape → defaults" + ); } // [unit->REQ-HAZARD-WAN-ORIGIN-AUTH] records carry no origin field: a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\ntp.rs:403: let dead_v6_b: SocketAddr = "[2001:db8::1]:9".parse().unwrap(); let addrs = vec![dead_v6_a, dead_v6_b, v4_mock]; let got = query_first_reachable(addrs, Duration::from_millis(300)); - assert_eq!(got, Some(want), "iteration past dead v6 reaches the v4 answer"); + assert_eq!( + got, + Some(want), + "iteration past dead v6 reaches the v4 answer" + ); server.join().unwrap(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\ntp.rs:461: #[test] fn loud_fail_logs_only_on_transitions() { // ok -> fail: log UNCORRECTED - assert_eq!( - ntp_transition(false, None), - (true, Transition::Uncorrected) - ); + assert_eq!(ntp_transition(false, None), (true, Transition::Uncorrected)); // fail -> fail: silent (no spam) assert_eq!(ntp_transition(true, None), (true, Transition::Silent)); // fail -> ok: log RECOVERED Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\ntp.rs:471: - assert_eq!(ntp_transition(true, Some(5)), (false, Transition::Recovered)); + assert_eq!( + ntp_transition(true, Some(5)), + (false, Transition::Recovered) + ); // ok -> ok (corrected or agree): silent assert_eq!(ntp_transition(false, Some(5)), (false, Transition::Silent)); assert_eq!(ntp_transition(false, Some(0)), (false, Transition::Silent)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1033: // The joiner ADOPTED the seed-holder's roster (REQ-MESH-2): the live // member is now its member, the tombstone propagated, and both were // stamped into the subnet it joined (not the empty wire subnet). - assert!(init_roster.is_member("home", "alpha"), "adopted live member"); - assert!(init_roster.is_tombstoned("home", "ghost"), "adopted tombstone"); - assert!(!init_roster.is_member("home", "ghost"), "tombstone dominates"); + assert!( + init_roster.is_member("home", "alpha"), + "adopted live member" + ); + assert!( + init_roster.is_tombstoned("home", "ghost"), + "adopted tombstone" + ); + assert!( + !init_roster.is_member("home", "ghost"), + "tombstone dominates" + ); assert_eq!( init_roster.find("home", "alpha").unwrap().label, "host-a", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1069: .expect("connecting"); let subnets = subnet_store("home", seed, 1); let mut rate = PairingRateLimiter::new(); - let result = run_responder(&conn, resp_pub, &subnets, &RosterStore::default(), &mut rate, NOW).await; + let result = run_responder( + &conn, + resp_pub, + &subnets, + &RosterStore::default(), + &mut rate, + NOW, + ) + .await; conn.closed().await; // After a failed ceremony the slot is backed off (charged a failure). let retry = rate.begin("home", NOW); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1141: let mut rate = PairingRateLimiter::new(); // A different ceremony already holds the slot. rate.begin("home", NOW).expect("pre-occupy slot"); - let result = run_responder(&conn, resp_pub, &subnets, &RosterStore::default(), &mut rate, NOW).await; + let result = run_responder( + &conn, + resp_pub, + &subnets, + &RosterStore::default(), + &mut rate, + NOW, + ) + .await; conn.closed().await; result }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1201: .expect("connecting"); let subnets = subnet_store("home", seed, 1); let mut rate = PairingRateLimiter::new(); - let result = run_responder(&conn, resp_pub, &subnets, &RosterStore::default(), &mut rate, NOW).await; + let result = run_responder( + &conn, + resp_pub, + &subnets, + &RosterStore::default(), + &mut rate, + NOW, + ) + .await; conn.closed().await; result }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1256: .expect("connecting"); let subnets = subnet_store("home", seed, 1); // only "home" exists let mut rate = PairingRateLimiter::new(); - let result = run_responder(&conn, resp_pub, &subnets, &RosterStore::default(), &mut rate, NOW).await; + let result = run_responder( + &conn, + resp_pub, + &subnets, + &RosterStore::default(), + &mut rate, + NOW, + ) + .await; conn.closed().await; result }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1319: .await .expect("connecting"); let mut rate = PairingRateLimiter::new(); - run_responder(&conn, resp_pub, &subnets, &RosterStore::default(), &mut rate, NOW) - .await - .expect("responder pairs"); + run_responder( + &conn, + resp_pub, + &subnets, + &RosterStore::default(), + &mut rate, + NOW, + ) + .await + .expect("responder pairs"); conn.closed().await; }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1375: .expect("connecting"); let subnets = subnet_store("home", seed, 2); let mut rate = PairingRateLimiter::new(); - let outcome = run_responder(&conn, resp_pub, &subnets, &RosterStore::default(), &mut rate, NOW) - .await - .expect("responder pairs"); + let outcome = run_responder( + &conn, + resp_pub, + &subnets, + &RosterStore::default(), + &mut rate, + NOW, + ) + .await + .expect("responder pairs"); conn.closed().await; outcome }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1542: assert_eq!(roster[0].subnet, "", "subnet implicit on the wire"); assert_eq!(roster[0].pubkey_hex, "aa"); assert_eq!(roster[0].label, "host-a"); - assert_eq!(roster[0].address, Some(serde_json::json!({"addr": "1.2.3.4:5"}))); + assert_eq!( + roster[0].address, + Some(serde_json::json!({"addr": "1.2.3.4:5"})) + ); assert_eq!(roster[0].lease_epoch, 7); assert_eq!(roster[1].address, None, "absent address stays None"); assert_eq!(tombstones.len(), 1); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\pairing\wire.rs:1579: bad.extend_from_slice(&[4u8; TOTP_SEED_LEN]); bad.extend_from_slice(&1u64.to_be_bytes()); bad.extend_from_slice(&1u32.to_be_bytes()); - assert!(matches!(decode_frame(&bad), Err(PairWireError::Protocol(_)))); + assert!(matches!( + decode_frame(&bad), + Err(PairWireError::Protocol(_)) + )); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:585: if !instance.status.routable() { continue; } - let node_label = instance - .node_label - .clone() - .or_else(|| node_labels.get(instance.node.as_str()).map(|l| l.to_string())); + let node_label = instance.node_label.clone().or_else(|| { + node_labels + .get(instance.node.as_str()) + .map(|l| l.to_string()) + }); out.push(ResourceRow { endpoint_id: id.to_string(), node: instance.node.clone(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1097: /// operator's override when the advisory is wrong. // [impl->REQ-REST-VERB-ROUTING] pub fn select_rest_target(candidates: &[(String, Status)], goal: RestGoal) -> RestTarget { - let live: Vec<&(String, Status)> = - candidates.iter().filter(|(_, s)| s.routable()).collect(); + let live: Vec<&(String, Status)> = candidates.iter().filter(|(_, s)| s.routable()).collect(); if live.is_empty() { return RestTarget::NotFound; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1205: // the silent-wire-skew guard. let old: Instance = serde_json::from_str(r#"{"node":"n1","status":"Active","epoch":1}"#).unwrap(); - assert!(old.bound, "an N-1 row defaults to BOUND (no phantom unbound)"); + assert!( + old.bound, + "an N-1 row defaults to BOUND (no phantom unbound)" + ); assert_eq!(old.controller_node, None, "N-1 → no controller"); assert!(!old.harness_only, "N-1 → not harness-only"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1219: ..full.clone() }; let pjson = serde_json::to_string(&plain).unwrap(); - assert!(!pjson.contains("controller_node"), "None controller skip-serializes"); - assert!(!pjson.contains("harness_only"), "false harness_only skip-serializes"); + assert!( + !pjson.contains("controller_node"), + "None controller skip-serializes" + ); + assert!( + !pjson.contains("harness_only"), + "false harness_only skip-serializes" + ); } // [unit->REQ-GOSSIP-ADAPTER-PROJECTS] #4: the de-faking gossip fields Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1253: let plain = inst("n1", Status::Active, 1); let pjson = serde_json::to_string(&plain).unwrap(); assert!(!pjson.contains("adapter"), "None adapter skip-serializes"); - assert!(!pjson.contains("recent_projects"), "empty projects skip-serializes"); - assert!(!pjson.contains("controlled"), "false controlled skip-serializes"); + assert!( + !pjson.contains("recent_projects"), + "empty projects skip-serializes" + ); + assert!( + !pjson.contains("controlled"), + "false controlled skip-serializes" + ); } // [unit->REQ-INST-7] distinct nodes for one id coexist as separate instances. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1385: 1, "only the aged remote Offline row evicts" ); - let nodes: Vec<&str> = reg.instances("ling").iter().map(|i| i.node.as_str()).collect(); - assert!(!nodes.contains(&"faraway"), "aged remote Offline ghost evicted"); - assert!(nodes.contains(&"recent"), "fresh remote Offline row survives its grace"); + let nodes: Vec<&str> = reg + .instances("ling") + .iter() + .map(|i| i.node.as_str()) + .collect(); + assert!( + !nodes.contains(&"faraway"), + "aged remote Offline ghost evicted" + ); + assert!( + nodes.contains(&"recent"), + "fresh remote Offline row survives its grace" + ); assert!(nodes.contains(&own), "own Offline row never decays"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1413: "a revived (routable) row is never evicted" ); assert!( - reg.instances("ling").iter().any(|i| i.node == "peer" && i.status == Status::Active), + reg.instances("ling") + .iter() + .any(|i| i.node == "peer" && i.status == Status::Active), "the revived row survives" ); - assert!(reg.offline_since.is_empty(), "the revived row's offline_since stamp cleared"); + assert!( + reg.offline_since.is_empty(), + "the revived row's offline_since stamp cleared" + ); } // The receiver-observed offline_since side-map is SELF-PRUNING: it stays a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1433: ("c", own, Status::Offline), // own — never stamped ]); reg.evict_aged_offline(1_000, GRACE, own); - assert_eq!(reg.offline_since.len(), 2, "both REMOTE Offline rows stamped, own excluded"); + assert_eq!( + reg.offline_since.len(), + 2, + "both REMOTE Offline rows stamped, own excluded" + ); // n1 revives → its stamp prunes on the next sweep. reg.merge_instance("a", inst("n1", Status::Active, 2)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1440: reg.evict_aged_offline(1_500, GRACE, own); - assert_eq!(reg.offline_since.len(), 1, "a revived row's stamp is pruned"); + assert_eq!( + reg.offline_since.len(), + 1, + "a revived row's stamp is pruned" + ); // Whole-node eviction (node-silence trigger (a)) removes n2's row; the next // Offline sweep drops its stamp for free — no explicit side-map purge needed. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1470: ("ghost3", "farm", Status::Offline), ]); let routable_before = count_routable(®); - assert_eq!(routable_before, 1, "one routable row (keep); three Offline ghosts"); + assert_eq!( + routable_before, 1, + "one routable row (keep); three Offline ghosts" + ); // First sweep stamps the ghosts; churn continues (a fresh-epoch ghost-heal // re-advertise keeps them Offline — the sticky stamp must NOT reset). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1485: // Past the grace: every aged Offline ghost evicts; the routable row stays. let evicted = reg.evict_aged_offline(1_000 + GRACE + 1, GRACE, own); - assert_eq!(evicted, 3, "all three aged Offline ghosts evicted (bounded snapshot)"); + assert_eq!( + evicted, 3, + "all three aged Offline ghosts evicted (bounded snapshot)" + ); assert!( - reg.instances("keep").iter().any(|i| i.node == "farm" && i.status == Status::Active), + reg.instances("keep") + .iter() + .any(|i| i.node == "farm" && i.status == Status::Active), "the live routable row is untouched" ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1496: "the routable count is unchanged by Offline-ghost eviction — composes with \ REQ-SUBNET-COUNT-ROUTABLE" ); - assert!(reg.offline_since.is_empty(), "no residual stamps after the ghosts are reaped"); + assert!( + reg.offline_since.is_empty(), + "no residual stamps after the ghosts are reaped" + ); } fn count_routable(reg: &SubnetRegistry) -> usize { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1666: reg.endpoint_ids().next().is_none(), "a node label creates no endpoint row" ); - assert_eq!(reg.node_labels().collect::>(), vec![("n1", "OLDHOST")]); + assert_eq!( + reg.node_labels().collect::>(), + vec![("n1", "OLDHOST")] + ); // Lease: strictly-greater epoch wins; a lagging epoch is stale. assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1677: reg.merge_node_label("n1", "OLDHOST".into(), 1), MergeOutcome::Stale ); - assert_eq!(reg.node_labels().collect::>(), vec![("n1", "NEWHOST")]); + assert_eq!( + reg.node_labels().collect::>(), + vec![("n1", "NEWHOST")] + ); // Silence ghost-decay does NOT drop the label — an offline-but-trusted // member keeps its NAME (evict_nodes touches routable instance rows only). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1693: ); // Explicit prune DOES forget the label. - assert_eq!(reg.evict_node_labels(|node| node == "n1"), 1, "prune forgets"); + assert_eq!( + reg.evict_node_labels(|node| node == "n1"), + 1, + "prune forgets" + ); assert!(reg.node_labels().next().is_none()); // Serde: roundtrips; a pre-M8 snapshot (no node_labels key) parses clean. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1900: let rows = resource_projection(®, |_| false); let by = |id: &str| rows.iter().find(|r| r.endpoint_id == id).unwrap(); - assert_eq!(by("ling").node_label.as_deref(), Some("HOST1"), "instance label"); + assert_eq!( + by("ling").node_label.as_deref(), + Some("HOST1"), + "instance label" + ); assert_eq!(by("oak").node_label.as_deref(), Some("HOST2"), "map fill"); assert_eq!(by("bare").node_label, None, "no label known"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1910: "HOST1 (n1deadbe…)" ); assert_eq!(node_label_display("n3face", None), "n3face…"); - assert_eq!(node_label_display("n3face", Some(" ")), "n3face…", "blank → bare"); + assert_eq!( + node_label_display("n3face", Some(" ")), + "n3face…", + "blank → bare" + ); } // [unit->REQ-ENDPOINT-LIST-NODE-GROUPED] the advertised endpoint_type rides the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1945: let rows = resource_projection(®, |_| false); let by = |id: &str| rows.iter().find(|r| r.endpoint_id == id).unwrap(); - assert_eq!(by("agent").endpoint_type.as_deref(), Some("live_agent"), "gossiped type threaded"); - assert_eq!(by("legacy").endpoint_type, None, "pre-field row stays None (renders '-')"); + assert_eq!( + by("agent").endpoint_type.as_deref(), + Some("live_agent"), + "gossiped type threaded" + ); + assert_eq!( + by("legacy").endpoint_type, + None, + "pre-field row stays None (renders '-')" + ); } // [unit->REQ-GOSSIP-ADAPTER-PROJECTS] #4: the de-faking datums ride the projection Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:1970: let rows = resource_projection(®, |_| false); let by = |id: &str| rows.iter().find(|r| r.endpoint_id == id).unwrap(); - assert_eq!(by("agent").adapter.as_deref(), Some("claude-spt:doyle"), "adapter threaded"); - assert_eq!(by("agent").recent_projects, vec!["spt-core", "owl"], "projects threaded"); + assert_eq!( + by("agent").adapter.as_deref(), + Some("claude-spt:doyle"), + "adapter threaded" + ); + assert_eq!( + by("agent").recent_projects, + vec!["spt-core", "owl"], + "projects threaded" + ); assert!(by("agent").controlled, "controlled threaded"); - assert_eq!(by("legacy").adapter, None, "pre-field adapter None (renders '-')"); - assert!(by("legacy").recent_projects.is_empty(), "pre-field projects empty"); + assert_eq!( + by("legacy").adapter, + None, + "pre-field adapter None (renders '-')" + ); + assert!( + by("legacy").recent_projects.is_empty(), + "pre-field projects empty" + ); assert!(!by("legacy").controlled, "pre-field not controlled"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:2463: rows.iter().map(|(n, s)| (n.to_string(), *s)).collect() } fn wake_goal() -> RestGoal { - RestGoal { target: Status::Active, kind: GoalKind::Exists } + RestGoal { + target: Status::Active, + kind: GoalKind::Exists, + } } fn suspend_goal() -> RestGoal { - RestGoal { target: Status::Suspended, kind: GoalKind::Forall } + RestGoal { + target: Status::Suspended, + kind: GoalKind::Forall, + } } // [unit->REQ-REST-VERB-ROUTING] WAKE (∃-goal, target=Active): the full table. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\registry.rs:2473: #[test] fn select_rest_target_wake_goal_satisfaction() { // 0 candidates -> NotFound. - assert_eq!(select_rest_target(&cands(&[]), wake_goal()), RestTarget::NotFound); + assert_eq!( + select_rest_target(&cands(&[]), wake_goal()), + RestTarget::NotFound + ); // 1 Active -> already satisfied -> NoOp naming it. assert_eq!( select_rest_target(&cands(&[("a", Status::Active)]), wake_goal()), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\replicate.rs:264: let inst_line = inst.encode_line(); let label_line = label.encode_line(); assert_eq!( - serde_json::from_slice::(&inst_line[..inst_line.len() - 1]).unwrap(), + serde_json::from_slice::(&inst_line[..inst_line.len() - 1]) + .unwrap(), inst ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-net\src\net\replicate.rs:283: // skips the node-label row (an older fleet node never wedges). let mut old = LineDecoder::new(); let got = old.push(&wire); - assert_eq!(got.len(), 1, "only the instance row decodes for an old peer"); + assert_eq!( + got.len(), + 1, + "only the instance row decodes for an old peer" + ); assert_eq!(got[0].endpoint_id, "doyle"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-proto\src\envelope.rs:186: #[test] fn body_escape_is_cr_linesafe() { let escaped = event_body_escape("hey\r\nthere\rworld"); - assert!(!escaped.contains('\r'), "no raw CR survives into the EVENT line"); + assert!( + !escaped.contains('\r'), + "no raw CR survives into the EVENT line" + ); assert_eq!(escaped, "hey
there
world"); assert_eq!(event_body_unescape(&escaped), "hey\nthere\nworld"); // A trailing CRLF (the `echo | spt send` case) doesn't leave a stray CR. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:121: // [impl->REQ-ADAPTER-FLOOR-ENFORCE] pub fn version_meets_floor(core: &str, floor: &str) -> bool { let parts = |s: &str| -> Vec { - s.split('.').map(|c| c.trim().parse::().unwrap_or(0)).collect() + s.split('.') + .map(|c| c.trim().parse::().unwrap_or(0)) + .collect() }; let (c, f) = (parts(core), parts(floor)); let n = c.len().max(f.len()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:128: for i in 0..n { - let (cv, fv) = (c.get(i).copied().unwrap_or(0), f.get(i).copied().unwrap_or(0)); + let (cv, fv) = ( + c.get(i).copied().unwrap_or(0), + f.get(i).copied().unwrap_or(0), + ); if cv != fv { return cv > fv; // core > floor at the first differing component ⇒ satisfied } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1241: // Dead config: warn on an unfillable key, refuse nothing. let dead: Vec = crate::runtime::placeholder_keys(&role.command) .into_iter() - .chain(role.cwd.iter().flat_map(|c| crate::runtime::placeholder_keys(c))) + .chain( + role.cwd + .iter() + .flat_map(|c| crate::runtime::placeholder_keys(c)), + ) .chain(role.keys.iter().cloned()) .filter(|k| !crate::runtime::is_fillable_key_for_role(role_name, k)) .collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1443: assert_eq!(m.env["OWL_SESSION_ID"].direction, EnvDirection::Inject); // digest: the extractor seam with own source + presentation defaults let dig = m.digest.as_ref().unwrap(); - assert_eq!(dig.extractor, "claude-spt-digest --session {session_id} --in {source}"); + assert_eq!( + dig.extractor, + "claude-spt-digest --session {session_id} --in {source}" + ); assert_eq!(dig.window_turns, Some(5)); assert_eq!(dig.arg_truncation, Some(40)); assert_eq!(dig.sprint_collapse, Some(true)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1507: let u = m.update.clone().unwrap(); assert_eq!(u.avenue, UpdateAvenue::GhRelease); assert_eq!(u.repo.as_deref(), Some("user/repo")); - assert!(u.asset.is_none(), "asset is optional (defaults to adapter.spt)"); - assert!(u.signing_key.is_none(), "signing_key is optional for gh_release"); + assert!( + u.asset.is_none(), + "asset is optional (defaults to adapter.spt)" + ); + assert!( + u.signing_key.is_none(), + "signing_key is optional for gh_release" + ); let reparsed = Manifest::from_toml_str(&m.to_toml_string().unwrap()).unwrap(); assert_eq!(m.update, reparsed.update, "gh_release round-trips"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1577: // tunnel's opaque wire). #[test] fn shell_tunnel_opt_in() { - let base = "[adapter]\nname=\"u\"\nkind=\"shell\"\nversion=\"1\"\nmin_spt_core_version=\"1\"\n\n\ + let base = + "[adapter]\nname=\"u\"\nkind=\"shell\"\nversion=\"1\"\nmin_spt_core_version=\"1\"\n\n\ [shell]\nspawn=\"usbip-shell --link {link_token}\"\n"; // enabled + labelled → parses, fields preserved, round-trips. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1649: .contains("message-idle-translation-binary")); // declared with an empty path → refused at validate. - let empty = - format!("{base}\n[message-idle-translation-binary]\npath = \"\"\n"); + let empty = format!("{base}\n[message-idle-translation-binary]\npath = \"\"\n"); let err = Manifest::from_toml_str(&empty).unwrap_err().to_string(); assert!( err.contains("message-idle-translation-binary") && err.contains("non-empty"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1684: \n[shell]\nspawn = 'gw-shell'\n"; // start = "boot", grace unstated ⇒ the 30s default. - let boot = format!("{base}\n[service]\ncommand = '{{adapter_dir}}/gw-hub serve'\nstart = \"boot\"\n"); + let boot = format!( + "{base}\n[service]\ncommand = '{{adapter_dir}}/gw-hub serve'\nstart = \"boot\"\n" + ); let m = Manifest::from_toml_str(&boot).expect("[service] boot parses"); let svc = m.service.as_ref().expect("service present"); assert_eq!(svc.command, "{adapter_dir}/gw-hub serve"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1738: "an empty command has nothing to spawn: {err}" ); - let zero = format!( - "{base}\n[service]\ncommand = 'gw-hub'\nstart = \"boot\"\nstop_grace_ms = 0\n" - ); + let zero = + format!("{base}\n[service]\ncommand = 'gw-hub'\nstart = \"boot\"\nstop_grace_ms = 0\n"); let err = Manifest::from_toml_str(&zero).unwrap_err().to_string(); assert!( err.contains("stop_grace_ms must be > 0"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1801: ); // empty command → refused. - let empty = - format!("{base}\n[message-idle-translation-binary]\ncommand = \"\"\n"); + let empty = format!("{base}\n[message-idle-translation-binary]\ncommand = \"\"\n"); let err = Manifest::from_toml_str(&empty).unwrap_err().to_string(); assert!( err.contains("`command` must be non-empty"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1853: ); // is_empty() is false when ONLY resume is declared (no self, no dirs). - let resume_only = format!( - "{base}\n[session.resume]\ncommand = 'claude -r {{session_id}}'\n" - ); + let resume_only = + format!("{base}\n[session.resume]\ncommand = 'claude -r {{session_id}}'\n"); let mr = Manifest::from_toml_str(&resume_only).expect("resume-only parses"); assert!( !mr.session.is_empty(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1866: // Round-trip: parse → emit → reparse is stable for the resume role. let reparsed = Manifest::from_toml_str(&m.to_toml_string().unwrap()).unwrap(); - assert_eq!(m.session.resume, reparsed.session.resume, "resume round-trips"); + assert_eq!( + m.session.resume, reparsed.session.resume, + "resume round-trips" + ); let emitted = m.to_toml_string().unwrap(); assert!( emitted.contains("[session.resume]"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:1875: // BACK-COMPAT: a manifest with [session.self] but NO [session.resume] // parses with resume == None (an old adapter is unaffected). - let no_resume = format!( - "{base}\n[session.self]\ncommand = 'claude --session-id {{session_id}}'\n" - ); + let no_resume = + format!("{base}\n[session.self]\ncommand = 'claude --session-id {{session_id}}'\n"); let m0 = Manifest::from_toml_str(&no_resume).expect("no-resume parses"); assert!(m0.session.self_.is_some()); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2022: regex: false, }; // Case-insensitive substring; returns the matched keyword. - assert_eq!(literal.matched_keyword("how do i spt send a msg"), Some("SPT send")); + assert_eq!( + literal.matched_keyword("how do i spt send a msg"), + Some("SPT send") + ); assert_eq!(literal.matched_keyword("the OWL hoots"), Some("owl")); assert_eq!(literal.matched_keyword("nothing here"), None); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2033: regex: true, }; assert_eq!(re.matched_keyword("run spt send now"), Some(r"spt\s+\w+")); - assert!(re.matched_keyword("sptsend").is_none(), "regex needs the whitespace"); + assert!( + re.matched_keyword("sptsend").is_none(), + "regex needs the whitespace" + ); // An invalid regex matches nothing (best-effort, never panics). let bad = Hint { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2057: .expect("parses"); assert_eq!(parent.hints.len(), 1); let merged = crate::profile::resolve(&parent, "p").expect("resolves"); - assert_eq!(merged.hints.len(), 1, "array replaced wholesale, not spliced"); + assert_eq!( + merged.hints.len(), + 1, + "array replaced wholesale, not spliced" + ); assert_eq!(merged.hints[0].text, "profile hint"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2209: "#; let e = Manifest::from_toml_str(no_src).unwrap_err(); assert!(matches!(e, ManifestError::Validation(_))); - assert!(e.to_string().contains("source") || e.to_string().contains("locate_template"), "{e}"); + assert!( + e.to_string().contains("source") || e.to_string().contains("locate_template"), + "{e}" + ); // Zero window. let zero = r#" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2352: #[test] fn version_meets_floor_numeric_not_lexical() { // Equal boundary ⇒ satisfied (floor is at-LEAST, not strictly-newer). - assert!(version_meets_floor("0.25.0", "0.25.0"), "equal meets the floor"); + assert!( + version_meets_floor("0.25.0", "0.25.0"), + "equal meets the floor" + ); // Core strictly above the floor ⇒ satisfied. - assert!(version_meets_floor("0.26.0", "0.25.0"), "core > floor passes"); - assert!(version_meets_floor("1.0.0", "0.9.9"), "major bump clears any minor"); + assert!( + version_meets_floor("0.26.0", "0.25.0"), + "core > floor passes" + ); + assert!( + version_meets_floor("1.0.0", "0.9.9"), + "major bump clears any minor" + ); // Core below the floor ⇒ refused. - assert!(!version_meets_floor("0.24.9", "0.25.0"), "core < floor refused"); + assert!( + !version_meets_floor("0.24.9", "0.25.0"), + "core < floor refused" + ); // The 0.9 < 0.25 trap: a LEXICAL compare says "0.9.0" > "0.25.0" (because '9' > // '2'), which would wrongly PASS a 0.25.0 floor on a 0.9.0 core. Numeric compare Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2374: ); // Zero-pad equivalence: a shorter version is right-padded with zeros. - assert!(version_meets_floor("1.0", "1.0.0"), "1.0 == 1.0.0 after zero-pad"); - assert!(version_meets_floor("1.0.0", "1.0"), "and the reverse padding"); + assert!( + version_meets_floor("1.0", "1.0.0"), + "1.0 == 1.0.0 after zero-pad" + ); + assert!( + version_meets_floor("1.0.0", "1.0"), + "and the reverse padding" + ); // The perri repro: a fresh floor bump refuses the older shipped core. assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2426: #[test] fn role_template_is_role_aware_for_notif_extras() { let ok = role_manifest("[session.notif]\ncommand = 'toast {notif_id} {notif_body} {id}'\n"); - assert!(ok.validate_role_templates().is_ok(), "notif extras + base keys fill"); + assert!( + ok.validate_role_templates().is_ok(), + "notif extras + base keys fill" + ); let bad = role_manifest("[session.self]\ncommand = 'run {notif_body}'\n"); let msg = bad.validate_role_templates().unwrap_err().to_string(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2433: - assert!(msg.contains("notif_body"), "a notif-only key is unfillable outside notif: {msg}"); + assert!( + msg.contains("notif_body"), + "a notif-only key is unfillable outside notif: {msg}" + ); } // [unit->REQ-ADAPTER-TEMPLATE-KEY-VALIDATION] a var declared in BOTH a spawned Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\manifest.rs:2483: [session.self]\ncommand = 'run'\n", ); let msg = bad.validate_role_templates().unwrap_err().to_string(); - assert!(msg.contains("gone_key"), "an [env] inject value's dead key refuses: {msg}"); + assert!( + msg.contains("gone_key"), + "an [env] inject value's dead key refuses: {msg}" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:289: // [unit->REQ-MANIFEST-2] #[test] fn deep_nested_leaf_replace() { - let base = v("[shell.capabilities.run]\nargs = [\"cmd\"]\n[shell]\nrequire_approval = \"none\""); + let base = + v("[shell.capabilities.run]\nargs = [\"cmd\"]\n[shell]\nrequire_approval = \"none\""); let overlay = v("[shell]\nrequire_approval = \"always\""); let merged = merge_leaf_replace(&base, &overlay); // The capabilities sub-table is untouched; only require_approval flips. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:333: let parent = Manifest::from_toml_str(PROFILED_SHELL).expect("parent parses"); let merged = resolve(&parent, "work").expect("work resolves"); let shell = merged.shell.expect("merged has shell"); - assert_eq!(shell.require_approval, ShellApproval::Always, "floor tightened"); - assert_eq!(shell.spawn, "run --thing", "untouched leaf survives the merge"); - assert!(merged.profiles.is_empty(), "resolved view drops the profile catalogue"); + assert_eq!( + shell.require_approval, + ShellApproval::Always, + "floor tightened" + ); + assert_eq!( + shell.spawn, "run --thing", + "untouched leaf survives the merge" + ); + assert!( + merged.profiles.is_empty(), + "resolved view drops the profile catalogue" + ); } /// An undeclared profile name is a distinct, typed error. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:354: #[test] fn tighten_only_allows_tightening() { let parent = Manifest::from_toml_str(PROFILED_SHELL).expect("parent parses"); - assert!(resolve(&parent, "work").is_ok(), "remembered -> always is a tighten"); + assert!( + resolve(&parent, "work").is_ok(), + "remembered -> always is a tighten" + ); } /// Tighten-only: a profile that *lowers* the approval floor is refused at Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:388: // [unit->REQ-MANIFEST-3] #[test] fn string_dot_path_read_write() { - let mut t: toml::Table = toml::from_str( - "greeting = \"hi\"\n[hook]\nadditionalContext = \"ctx\"\n", - ) - .unwrap(); + let mut t: toml::Table = + toml::from_str("greeting = \"hi\"\n[hook]\nadditionalContext = \"ctx\"\n").unwrap(); // Read: top-level leaf, nested leaf, and a miss. - assert_eq!(string_at(&t, "greeting").and_then(|v| v.as_str()), Some("hi")); assert_eq!( + string_at(&t, "greeting").and_then(|v| v.as_str()), + Some("hi") + ); + assert_eq!( string_at(&t, "hook.additionalContext").and_then(|v| v.as_str()), Some("ctx") ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:407: // Write: overwrite a leaf, and create an intermediate table. set_string_at(&mut t, "greeting", Value::String("yo".into())).unwrap(); set_string_at(&mut t, "deep.nest.key", Value::String("v".into())).unwrap(); - assert_eq!(string_at(&t, "greeting").and_then(|v| v.as_str()), Some("yo")); - assert_eq!(string_at(&t, "deep.nest.key").and_then(|v| v.as_str()), Some("v")); + assert_eq!( + string_at(&t, "greeting").and_then(|v| v.as_str()), + Some("yo") + ); + assert_eq!( + string_at(&t, "deep.nest.key").and_then(|v| v.as_str()), + Some("v") + ); // Writing through an existing non-table leaf errs (no clobber). assert!(set_string_at(&mut t, "greeting.x", Value::String("z".into())).is_err()); // An empty segment errs. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:453: ) .expect("parses"); let merged = resolve(&parent, "p").expect("resolves"); - assert_eq!(merged.strings.get("kept").and_then(|v| v.as_str()), Some("base")); - assert_eq!(merged.strings.get("flip").and_then(|v| v.as_str()), Some("profile")); + assert_eq!( + merged.strings.get("kept").and_then(|v| v.as_str()), + Some("base") + ); + assert_eq!( + merged.strings.get("flip").and_then(|v| v.as_str()), + Some("profile") + ); } /// Composite addressing splits on the first `:`; a bare name has no profile. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\profile.rs:462: #[test] fn split_option_first_colon() { assert_eq!(split_option("claude-spt"), ("claude-spt", None)); - assert_eq!(split_option("claude-spt:work"), ("claude-spt", Some("work"))); + assert_eq!( + split_option("claude-spt:work"), + ("claude-spt", Some("work")) + ); // A profile name may contain '-'; the split is on the first ':' only. assert_eq!( split_option("spt-usbip-driver:hid-only"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:98: /// verbs (add + update) BEFORE anything is installed or the registry is written. /// The `Display` is the F-1 operator refusal (names the installed core, the /// floor, and the next action) — the ONE message shape both verbs surface. - CoreFloor { adapter: String, core: String, floor: String }, + CoreFloor { + adapter: String, + core: String, + floor: String, + }, } impl std::fmt::Display for RegistryError { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:109: RegistryError::NotRegistered(n) => write!(f, "adapter not registered: {n}"), RegistryError::BadRecord(n) => write!(f, "corrupt adapter record: {n}"), RegistryError::InvalidProfileName(n) => { - write!(f, "invalid profile name '{n}' (no ':', path separators, or whitespace)") + write!( + f, + "invalid profile name '{n}' (no ':', path separators, or whitespace)" + ) } RegistryError::ProfileShadowsShipped(n) => { - write!(f, "local profile '{n}' would shadow a shipped profile of the same name") + write!( + f, + "local profile '{n}' would shadow a shipped profile of the same name" + ) } RegistryError::ProfileNotFound(n) => write!(f, "local profile not found: {n}"), RegistryError::ShippedProfileImmutable(n) => { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:119: - write!(f, "profile '{n}' is shipped (adapter-owned); only local profiles are editable") + write!( + f, + "profile '{n}' is shipped (adapter-owned); only local profiles are editable" + ) } RegistryError::BadStringPointer(m) => { write!(f, "invalid [strings] file pointer: {m}") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:128: extracted/downloaded. Complete the install (e.g. re-run the installer or \ `spt adapter add`) so the source tree exists, then retry." ), - RegistryError::CoreFloor { adapter, core, floor } => write!( + RegistryError::CoreFloor { + adapter, + core, + floor, + } => write!( f, "adapter '{adapter}' requires spt-core {floor} or newer, but this machine \ runs spt-core {core}. Update spt-core first (`spt update`), then retry." Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:400: // post-copy and survive the source going away (adapter updates overwrite // this — REQ-MANIFEST-5). Pointer mode reads strings/ live from source. if src_strings_dir.is_dir() { - copy_dir_all(&src_strings_dir, &shipped_strings_dir(adapters_dir, &record)) - .map_err(RegistryError::Io)?; + copy_dir_all( + &src_strings_dir, + &shipped_strings_dir(adapters_dir, &record), + ) + .map_err(RegistryError::Io)?; } } save_record(adapters_dir, &record)?; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:605: profile::resolve_overlay(&parent, &overlay).map_err(RegistryError::Manifest)?; let dir = local_profiles_dir(adapters_dir, adapter); std::fs::create_dir_all(&dir)?; - atomic_write_string(&local_profile_file(adapters_dir, adapter, profile), overlay_toml)?; + atomic_write_string( + &local_profile_file(adapters_dir, adapter, profile), + overlay_toml, + )?; Ok(()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:654: // the file's contents (REQ-MANIFEST-5), lazily — so live edits reflect. let Some(rel) = profile::as_file_pointer(value) else { // [impl->REQ-MANIFEST-SUBST] lazy adapter-static substitution at read time. - return Ok(Some(subst_string_value(value.clone(), &record, node.as_deref()))); + return Ok(Some(subst_string_value( + value.clone(), + &record, + node.as_deref(), + ))); }; // Provenance (the update-safety guard): if this key is supplied as a file // pointer by a LOCAL profile, resolve against its user-owned dir (survives Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:688: node, )), Value::Array(arr) => Value::Array( - arr.into_iter().map(|v| subst_string_value(v, record, node)).collect(), + arr.into_iter() + .map(|v| subst_string_value(v, record, node)) + .collect(), ), Value::Table(tbl) => Value::Table( tbl.into_iter() Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:748: let strings = overlay_table .entry("strings".to_string()) .or_insert_with(|| Value::Table(toml::Table::new())); - let strings_table = strings - .as_table_mut() - .ok_or_else(|| RegistryError::BadRecord(format!("profiles/{profile}: [strings] not a table")))?; + let strings_table = strings.as_table_mut().ok_or_else(|| { + RegistryError::BadRecord(format!("profiles/{profile}: [strings] not a table")) + })?; profile::set_string_at(strings_table, key_path, Value::String(value.to_string())) .map_err(RegistryError::Manifest)?; - let overlay_toml = toml::to_string_pretty(&overlay) - .map_err(|e| RegistryError::Manifest(crate::manifest::ManifestError::Validation(e.to_string())))?; + let overlay_toml = toml::to_string_pretty(&overlay).map_err(|e| { + RegistryError::Manifest(crate::manifest::ManifestError::Validation(e.to_string())) + })?; // Re-validate + write atomically through the create-time guards. create_local_profile(adapters_dir, adapter, profile, &overlay_toml) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1010: let err = register_with_core(&adapters, &src, 1000, "0.25.0") .expect_err("a below-floor core must be refused"); match err { - RegistryError::CoreFloor { adapter, core, floor } => { + RegistryError::CoreFloor { + adapter, + core, + floor, + } => { assert_eq!(adapter, "highfloor"); assert_eq!(core, "0.25.0"); assert_eq!(floor, "9.9.9"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1147: // registered() skips it (not in the active set), never panics/crashes. assert!( - registered(&adapters).iter().all(|(r, _)| r.name != rec.name), + registered(&adapters) + .iter() + .all(|(r, _)| r.name != rec.name), "a deferred-manifest adapter is skipped from the active set, not crashed" ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1178: // Shipped profile. let (_, shipped) = resolve_option(&adapters, "mock-shell:locked").unwrap(); - assert_eq!(approval(&shipped), ShellApproval::Always, "shipped resolves"); + assert_eq!( + approval(&shipped), + ShellApproval::Always, + "shipped resolves" + ); // Local profile (tightens further-or-equal — always over remembered). - create_local_profile(&adapters, "mock-shell", "work", "[shell]\nrequire_approval = \"always\"\n") - .unwrap(); + create_local_profile( + &adapters, + "mock-shell", + "work", + "[shell]\nrequire_approval = \"always\"\n", + ) + .unwrap(); let (_, local) = resolve_option(&adapters, "mock-shell:work").unwrap(); assert_eq!(approval(&local), ShellApproval::Always, "local resolves"); assert_eq!(local_profile_names(&adapters, "mock-shell"), vec!["work"]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1197: use crate::manifest::ShellApproval; let tmp = tempfile::tempdir().unwrap(); let adapters = registered_shell(tmp.path()); - create_local_profile(&adapters, "mock-shell", "work", "[shell]\nrequire_approval = \"always\"\n") - .unwrap(); + create_local_profile( + &adapters, + "mock-shell", + "work", + "[shell]\nrequire_approval = \"always\"\n", + ) + .unwrap(); let set = registered(&adapters); let bare = resolve_option_in(&set, &adapters, "mock-shell").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1205: assert_eq!(approval(&bare), ShellApproval::Remembered, "bare = parent"); let shipped = resolve_option_in(&set, &adapters, "mock-shell:locked").unwrap(); - assert_eq!(approval(&shipped), ShellApproval::Always, "shipped overlays"); + assert_eq!( + approval(&shipped), + ShellApproval::Always, + "shipped overlays" + ); let local = resolve_option_in(&set, &adapters, "mock-shell:work").unwrap(); assert_eq!(approval(&local), ShellApproval::Always, "local overlays"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1220: fn local_profile_survives_readd() { let tmp = tempfile::tempdir().unwrap(); let adapters = registered_shell(tmp.path()); - create_local_profile(&adapters, "mock-shell", "work", "[shell]\nrequire_approval = \"always\"\n") - .unwrap(); + create_local_profile( + &adapters, + "mock-shell", + "work", + "[shell]\nrequire_approval = \"always\"\n", + ) + .unwrap(); // Re-register the adapter (adapter update / re-add). let src = seed_source(tmp.path(), "ms-src2", SHELL_COPY_PROFILED); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1248: // Loosen the consent floor (remembered -> none). assert!(matches!( - create_local_profile(&adapters, "mock-shell", "loose", "[shell]\nrequire_approval = \"none\"\n"), + create_local_profile( + &adapters, + "mock-shell", + "loose", + "[shell]\nrequire_approval = \"none\"\n" + ), Err(RegistryError::Manifest(_)) )); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1255: // Invalid name (contains the address separator). assert!(matches!( - create_local_profile(&adapters, "mock-shell", "a:b", "[shell]\nrequire_approval = \"always\"\n"), + create_local_profile( + &adapters, + "mock-shell", + "a:b", + "[shell]\nrequire_approval = \"always\"\n" + ), Err(RegistryError::InvalidProfileName(_)) )); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1270: fn delete_local_profile_rules() { let tmp = tempfile::tempdir().unwrap(); let adapters = registered_shell(tmp.path()); - create_local_profile(&adapters, "mock-shell", "work", "[shell]\nrequire_approval = \"always\"\n") - .unwrap(); + create_local_profile( + &adapters, + "mock-shell", + "work", + "[shell]\nrequire_approval = \"always\"\n", + ) + .unwrap(); assert!(matches!( delete_local_profile(&adapters, "mock-shell", "locked"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1305: // Bare option reads the base string; a missing key is None. assert_eq!( - get_string(&adapters, "mock-shell", "base").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-shell", "base") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("parent".to_string()) ); - assert!(get_string(&adapters, "mock-shell", "absent").unwrap().is_none()); + assert!(get_string(&adapters, "mock-shell", "absent") + .unwrap() + .is_none()); // set-string requires a LOCAL profile to exist first. create_local_profile(&adapters, "mock-shell", "work", "").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1316: set_local_string(&adapters, "mock-shell", "work", "hook.ctx", "deep").unwrap(); // The composite reads the overlaid value; the bare option is unchanged. assert_eq!( - get_string(&adapters, "mock-shell:work", "base").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-shell:work", "base") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("overridden".to_string()) ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1323: - get_string(&adapters, "mock-shell:work", "hook.ctx").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-shell:work", "hook.ctx") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("deep".to_string()) ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1327: - get_string(&adapters, "mock-shell", "base").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-shell", "base") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("parent".to_string()), "the bare parent is untouched" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1353: ); let src = seed_source(tmp, "cc-src", &toml_src); let strings_dir = src.join("strings"); - std::fs::create_dir_all(strings_dir.join(Path::new(file_rel).parent().unwrap_or(Path::new("")))) - .unwrap(); + std::fs::create_dir_all( + strings_dir.join(Path::new(file_rel).parent().unwrap_or(Path::new(""))), + ) + .unwrap(); std::fs::write(strings_dir.join(file_rel), body).unwrap(); let adapters = tmp.join("adapters"); register(&adapters, &src, 1000).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1371: // Pointer → file contents; the inline literal still reads as itself. assert_eq!( - get_string(&adapters, "mock-cc", "body").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-cc", "body") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("SKILL BODY".to_string()) ); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1378: - get_string(&adapters, "mock-cc", "inline").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-cc", "inline") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("literal".to_string()) ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1382: // Lazy: edit the (copied) file; get-string reflects it without re-register. let copied = adapters.join("mock-cc").join("strings").join("skill.md"); - assert!(copied.exists(), "shipped strings/ copied into the held copy"); + assert!( + copied.exists(), + "shipped strings/ copied into the held copy" + ); std::fs::write(&copied, "EDITED BODY").unwrap(); assert_eq!( - get_string(&adapters, "mock-cc", "body").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-cc", "body") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("EDITED BODY".to_string()), "lazy read reflects the live file edit" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1410: register(&adapters, &traverse, 1), Err(RegistryError::BadStringPointer(_)) )); - assert!(!adapters.join("esc1").exists(), "escaping pointer records nothing"); + assert!( + !adapters.join("esc1").exists(), + "escaping pointer records nothing" + ); // Absolute path. - let abs_path = if cfg!(windows) { "C:\\\\windows\\\\system32\\\\x" } else { "/etc/passwd" }; + let abs_path = if cfg!(windows) { + "C:\\\\windows\\\\system32\\\\x" + } else { + "/etc/passwd" + }; let absolute = seed_source( tmp.path(), "esc2", Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1427: register(&adapters, &absolute, 2), Err(RegistryError::BadStringPointer(_)) )); - assert!(!adapters.join("esc2").exists(), "absolute pointer records nothing"); + assert!( + !adapters.join("esc2").exists(), + "absolute pointer records nothing" + ); } // [unit->REQ-MANIFEST-5] a missing-at-READ file (deleted after a valid Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1456: set_local_string(&adapters, "mock-cc", "work", "body", "LOCAL OVERRIDE").unwrap(); assert_eq!( - get_string(&adapters, "mock-cc:work", "body").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-cc:work", "body") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("LOCAL OVERRIDE".to_string()), "local literal leaf-replaces the shipped pointer" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1463: assert_eq!( - get_string(&adapters, "mock-cc", "body").unwrap().and_then(|v| v.as_str().map(str::to_string)), + get_string(&adapters, "mock-cc", "body") + .unwrap() + .and_then(|v| v.as_str().map(str::to_string)), Some("SHIPPED BODY".to_string()), "the bare parent still resolves the shipped file" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\registry.rs:1489: "an : fallback target resolves" ); // A local profile target too. - create_local_profile(&adapters, "mock-shell", "work", "[shell]\nrequire_approval = \"always\"\n") - .unwrap(); + create_local_profile( + &adapters, + "mock-shell", + "work", + "[shell]\nrequire_approval = \"always\"\n", + ) + .unwrap(); assert!( resolve_option(&adapters, "mock-shell:work").is_ok(), "an : fallback target resolves" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:176: pub fn clear_active(adapters_dir: &Path, target: &str) -> Vec { let mut ap = load(adapters_dir); let key = normalize_basename(target); - let removed: Vec = ap - .0 - .iter() - .filter(|(k, v)| **k == key || crate::profile::split_option(v).0 == target) - .map(|(k, _)| k.clone()) - .collect(); + let removed: Vec = + ap.0.iter() + .filter(|(k, v)| **k == key || crate::profile::split_option(v).0 == target) + .map(|(k, _)| k.clone()) + .collect(); for k in &removed { ap.0.remove(k); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:196: /// Returns the removed keys. (A thin alias for [`clear_active`] by adapter name.) pub fn prune_adapter(adapters_dir: &Path, adapter: &str) -> Vec { let mut ap = load(adapters_dir); - let removed: Vec = ap - .0 - .iter() - .filter(|(_, v)| crate::profile::split_option(v).0 == adapter) - .map(|(k, _)| k.clone()) - .collect(); + let removed: Vec = + ap.0.iter() + .filter(|(_, v)| crate::profile::split_option(v).0 == adapter) + .map(|(k, _)| k.clone()) + .collect(); for k in &removed { ap.0.remove(k); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:413: "[profiles.live]\n[profiles.live.adapter]\nhostable_types = [\"LiveAgent\"]\n", ); // Without a pointer, the freshest (newer-spt) would win. - assert_eq!(resolve_from_basename(&adapters, "claude").unwrap(), "newer-spt"); + assert_eq!( + resolve_from_basename(&adapters, "claude").unwrap(), + "newer-spt" + ); // Pin claude-spt:live; now it wins for the `claude` binary. let keys = set_active(&adapters, "claude-spt:live").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:432: let adapters = register_harness(tmp.path(), "claude-spt", &["claude"], 1000, ""); register_harness(tmp.path(), "other-spt", &["claude"], 2000, ""); set_active(&adapters, "claude-spt").unwrap(); - assert_eq!(resolve_from_basename(&adapters, "claude").unwrap(), "claude-spt"); + assert_eq!( + resolve_from_basename(&adapters, "claude").unwrap(), + "claude-spt" + ); // Soft-deregister the pinned adapter; the pointer is now stale. registry::deregister(&adapters, "claude-spt").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:449: #[test] fn set_clear_prune_rules() { let tmp = tempfile::tempdir().unwrap(); - let adapters = register_harness(tmp.path(), "claude-spt", &["claude", "claude-cli"], 1000, ""); + let adapters = register_harness( + tmp.path(), + "claude-spt", + &["claude", "claude-cli"], + 1000, + "", + ); let keys = set_active(&adapters, "claude-spt").unwrap(); assert_eq!(keys, vec!["claude".to_string(), "claude-cli".to_string()]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:467: assert_eq!(load(&adapters).0.len(), 1, "the other binding remains"); // Prune by adapter drops what is left. - assert_eq!(prune_adapter(&adapters, "claude-spt"), vec!["claude-cli".to_string()]); + assert_eq!( + prune_adapter(&adapters, "claude-spt"), + vec!["claude-cli".to_string()] + ); assert!(load(&adapters).0.is_empty()); // An adapter with no host_binaries cannot be set active. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\resolve.rs:520: let tmp = tempfile::tempdir().unwrap(); let adapters = register_harness(tmp.path(), "claude-spt", &["claude"], 1000, ""); set_active(&adapters, "claude-spt").unwrap(); - assert_eq!(pointer_file(&adapters), adapters.join("active-profiles.toml")); + assert_eq!( + pointer_file(&adapters), + adapters.join("active-profiles.toml") + ); assert!(pointer_file(&adapters).exists()); - assert!(adapters.join("claude-spt").is_dir(), "adapter dir is a sibling"); + assert!( + adapters.join("claude-spt").is_dir(), + "adapter dir is a sibling" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:59: // [impl->REQ-LIVE-AGENT-NO-INJECT-DELIVERY] F-033 leg (b) closure: the operator's // typed-unsubmitted garbage was this echo-verify re-drive, force-armed host-wide by // ambient env — this scrub is the fix (the raw payload+CR path was proven dead). -pub const INJECT_ECHO_ENV_VARS: [&str; 2] = ["SPT_INJECT_VERIFY_ECHO", "SPT_INJECT_FORCE_ECHO_MISS"]; +pub const INJECT_ECHO_ENV_VARS: [&str; 2] = + ["SPT_INJECT_VERIFY_ECHO", "SPT_INJECT_FORCE_ECHO_MISS"]; /// TEST-RIG TIMING knobs that must never arm from AMBIENT env — the same /// inheritance class as [`INJECT_ECHO_ENV_VARS`], third payload. These widen a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:412: if var.direction != EnvDirection::Read { continue; } - let resolved = captured - .get(name) - .cloned() - .or_else(|| var.value.clone()); + let resolved = captured.get(name).cloned().or_else(|| var.value.clone()); if let Some(value) = resolved { keys.entry(name.clone()) .or_insert_with(|| expand_tilde(&value)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:434: let rest = if value == "~" { Some("") } else { - value.strip_prefix("~/").or_else(|| value.strip_prefix("~\\")) + value + .strip_prefix("~/") + .or_else(|| value.strip_prefix("~\\")) }; let Some(rest) = rest else { return value.to_string(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:714: /// psyche in the parent's captured account root, not the default. A stamped var /// overrides the ambient value. No-op when the map is empty. // [impl->REQ-PSYCHE-SPAWN-ENV-PARITY] - pub fn with_spawn_env( - mut self, - spawn_env: std::collections::BTreeMap, - ) -> Self { + pub fn with_spawn_env(mut self, spawn_env: std::collections::BTreeMap) -> Self { self.spawn_env = spawn_env; self } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1215: .command_for(rt.role("echo_commune").unwrap(), &BTreeMap::new()) .unwrap(); assert_eq!( - cmd.get_current_dir().map(|p| p.to_string_lossy().replace('\\', "/")), + cmd.get_current_dir() + .map(|p| p.to_string_lossy().replace('\\', "/")), Some(role_dir_toml), "an adapter-declared role cwd always wins over the caller default" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1265: // Stamp it → the captured value is threaded onto the spawn. let mut stamps = BTreeMap::new(); - stamps.insert("CLAUDE_CONFIG_DIR".to_string(), "/relocated/root".to_string()); + stamps.insert( + "CLAUDE_CONFIG_DIR".to_string(), + "/relocated/root".to_string(), + ); let rt = ManifestRuntime::new(m).with_spawn_env(stamps); let role = rt.role("psyche_resume").unwrap(); let cmd = rt.command_for(role, &BTreeMap::new()).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1285: fn stamp_survives_env_remove() { let m = psyche_manifest("env_remove = [\"CLAUDE_CONFIG_DIR\"]\n"); let mut stamps = BTreeMap::new(); - stamps.insert("CLAUDE_CONFIG_DIR".to_string(), "/relocated/root".to_string()); + stamps.insert( + "CLAUDE_CONFIG_DIR".to_string(), + "/relocated/root".to_string(), + ); let rt = ManifestRuntime::new(m).with_spawn_env(stamps); let role = rt.role("psyche_resume").unwrap(); let cmd = rt.command_for(role, &BTreeMap::new()).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1375: fn expand_tilde_expands_leading_home_only() { assert_eq!(expand_tilde("/abs/path"), "/abs/path"); assert_eq!(expand_tilde("plain"), "plain"); - assert_eq!(expand_tilde("a/~/b"), "a/~/b", "a mid-path ~ is not expanded"); + assert_eq!( + expand_tilde("a/~/b"), + "a/~/b", + "a mid-path ~ is not expanded" + ); let home = if cfg!(windows) { std::env::var("USERPROFILE") } else { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1419: let q = keys(&[("psyche_prompt", r#"a "quoted" b"#)]); let argv_q = fill_template_tokens("runner --prompt {psyche_prompt}", &q).unwrap(); assert_eq!(argv_q, vec!["runner", "--prompt", r#"a "quoted" b"#]); - assert_eq!(argv_q.len(), 3, "a value with a quote injects no extra token"); + assert_eq!( + argv_q.len(), + 3, + "a value with a quote injects no extra token" + ); let s = keys(&[("psyche_prompt", "a; rm -rf b")]); let argv_s = fill_template_tokens("runner --prompt {psyche_prompt}", &s).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1426: assert_eq!(argv_s, vec!["runner", "--prompt", "a; rm -rf b"]); - assert_eq!(argv_s.len(), 3, "a value with a semicolon injects no extra token"); + assert_eq!( + argv_s.len(), + 3, + "a value with a semicolon injects no extra token" + ); } // [unit->REQ-MANIFEST-SUBST] the adapter-static substitution primitives Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1448: let mut k2 = BTreeMap::new(); inject_adapter_keys(&mut k2, None, Some("only-name")); assert!(!k2.contains_key("adapter_dir")); - assert_eq!(k2.get("adapter_name").map(String::as_str), Some("only-name")); + assert_eq!( + k2.get("adapter_name").map(String::as_str), + Some("only-name") + ); // subst: fills the adapter-static keys + node-static {node}, passes the // session-scoped placeholders through verbatim. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1458: Some("claude-spt"), Some("HOSTX"), ); - assert_eq!(out, "/opt/cc/claude-spt hook {id} {session_id} claude-spt @HOSTX"); + assert_eq!( + out, + "/opt/cc/claude-spt hook {id} {session_id} claude-spt @HOSTX" + ); // an unavailable key (None source) passes through, never errors — {node} too. assert_eq!( subst_adapter_static("{adapter_dir}/x {node}", None, Some("n"), None), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-runtime\src\runtime.rs:1465: "{adapter_dir}/x {node}" ); // an unterminated brace passes through verbatim. - assert_eq!(subst_adapter_static("a{b", Some("d"), Some("n"), None), "a{b"); + assert_eq!( + subst_adapter_static("a{b", Some("d"), Some("n"), None), + "a{b" + ); // command_for resolves {adapter_dir} from the runtime's pinned dir + name. let m = Manifest::from_toml_str( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\atomic.rs:215: .filter_map(|e| e.file_name().into_string().ok()) .filter(|n| n.contains(".tmp")) .collect(); - assert!(leftover.is_empty(), "no *.tmp* sibling may remain: {leftover:?}"); + assert!( + leftover.is_empty(), + "no *.tmp* sibling may remain: {leftover:?}" + ); } fn sharing_violation() -> io::Error { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\atomic.rs:269: let s_target = dir.path().join("rec.json"); atomic_write_string_durable(&s_target, "{\"id\":\"hall-a\"}").unwrap(); - assert_eq!(fs::read_to_string(&s_target).unwrap(), "{\"id\":\"hall-a\"}"); + assert_eq!( + fs::read_to_string(&s_target).unwrap(), + "{\"id\":\"hall-a\"}" + ); no_tmp_sibling_remains(dir.path()); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:650: // Already set (a racer won)? Skip the write — this cuts the herd so N // racers don't all pile onto the shared config under contention. A // transient read failure here is ignored (fall through to the write). - if let Ok(out) = run_git(&["-C", dir, "config", "--get", key], None, None, GIT_TIMEOUT) { + if let Ok(out) = run_git( + &["-C", dir, "config", "--get", key], + None, + None, + GIT_TIMEOUT, + ) { if out.success() && out.stdout_trimmed() == value { return Ok(()); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:705: "warning: unable to access 'config'\n\ fatal: unknown error occurred while reading the configuration files" )); - assert!(config_error_is_retryable("fatal: could not read config file config")); + assert!(config_error_is_retryable( + "fatal: could not read config file config" + )); // Case-insensitive. assert!(config_error_is_retryable("COULD NOT LOCK CONFIG FILE")); // Genuine, non-transient errors fail fast (NOT retryable). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:712: - assert!(!config_error_is_retryable("fatal: bad config line 1 in file config")); assert!(!config_error_is_retryable( + "fatal: bad config line 1 in file config" + )); + assert!(!config_error_is_retryable( "error: key does not contain a section: foo" )); assert!(!config_error_is_retryable("fatal: not in a git directory")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:728: // Isolation guard: the fixture MUST be an absolute path UNDER the TempDir // and NEVER resolve under cwd — a store path that defaults to cwd would // `git init` the working tree (droppings at the project root). - assert!(git_dir.is_absolute(), "fixture must be absolute: {git_dir:?}"); assert!( + git_dir.is_absolute(), + "fixture must be absolute: {git_dir:?}" + ); + assert!( git_dir.starts_with(dir.path()), "fixture must live under the TempDir: {git_dir:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:896: let wt_old = tmp.path().join("wt-old"); s.ensure_worktree("p-old", &wt_old).unwrap(); std::fs::write(wt_old.join("f.md"), "old").unwrap(); - s.commit_in_worktree(&wt_old, &["f.md"], "old").unwrap().unwrap(); + s.commit_in_worktree(&wt_old, &["f.md"], "old") + .unwrap() + .unwrap(); std::thread::sleep(std::time::Duration::from_millis(1100)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:904: let wt_new = tmp.path().join("wt-new"); s.ensure_worktree("p-new", &wt_new).unwrap(); std::fs::write(wt_new.join("f.md"), "new").unwrap(); - s.commit_in_worktree(&wt_new, &["f.md"], "new").unwrap().unwrap(); + s.commit_in_worktree(&wt_new, &["f.md"], "new") + .unwrap() + .unwrap(); let order = s.branches_by_recency().unwrap(); let p_new = order.iter().position(|b| b == "p-new").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:911: let p_old = order.iter().position(|b| b == "p-old").unwrap(); - assert!(p_new < p_old, "newest-committed branch sorts first: {order:?}"); + assert!( + p_new < p_old, + "newest-committed branch sorts first: {order:?}" + ); // Same membership as the unsorted enumeration. let mut a = order.clone(); let mut b = s.branches().unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\branchstore.rs:934: let pairs = s.branch_tips_by_recency().unwrap(); let names: Vec = pairs.iter().map(|(b, _)| b.clone()).collect(); - assert_eq!(names, s.branches_by_recency().unwrap(), "same recency order"); + assert_eq!( + names, + s.branches_by_recency().unwrap(), + "same recency order" + ); for (branch, tip) in &pairs { assert_eq!( s.tip(branch).unwrap().as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\daemon_inhibit.rs:166: assert!(stop_inhibited_at(home.path())); clear_stop_inhibit_at(home.path()).unwrap(); - assert!( - !stop_inhibited_at(home.path()), - "the intent verb clears it" - ); + assert!(!stop_inhibited_at(home.path()), "the intent verb clears it"); clear_stop_inhibit_at(home.path()).unwrap(); // idempotent } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\daemon_inhibit.rs:222: ); drop(held); t.join().unwrap(); - assert!(entered.load(Ordering::SeqCst), "and it proceeds once released"); + assert!( + entered.load(Ordering::SeqCst), + "and it proceeds once released" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\home.rs:439: // (1) Incoming BARE parent (ADR-0021 agnostic hook-bind resolution) → KEEP // the prior composite (this used to clobber to `claude-spt` — the bug). let mut r = InfoJson::new("ep", "t2", 2, "sid2", "live_agent"); - stamp_creation_fields(&mut r, Some(&prior), &sole, &mut vis, None, Some("claude-spt")) - .unwrap(); + stamp_creation_fields( + &mut r, + Some(&prior), + &sole, + &mut vis, + None, + Some("claude-spt"), + ) + .unwrap(); assert_eq!( r.adapter.as_deref(), Some("claude-spt:ccs"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\home.rs:449: // (2) Genuinely different adapter → replaced (resume-under-new). let mut r2 = InfoJson::new("ep", "t2", 2, "sid2", "live_agent"); - stamp_creation_fields(&mut r2, Some(&prior), &sole, &mut vis, None, Some("other-adapter")) - .unwrap(); - assert_eq!(r2.adapter.as_deref(), Some("other-adapter"), "different adapter replaces"); + stamp_creation_fields( + &mut r2, + Some(&prior), + &sole, + &mut vis, + None, + Some("other-adapter"), + ) + .unwrap(); + assert_eq!( + r2.adapter.as_deref(), + Some("other-adapter"), + "different adapter replaces" + ); // (3) A different EXPLICIT profile on the same parent still wins (a real // profile change, NOT the agnostic bare-parent bind). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\home.rs:458: let mut r3 = InfoJson::new("ep", "t2", 2, "sid2", "live_agent"); - stamp_creation_fields(&mut r3, Some(&prior), &sole, &mut vis, None, Some("claude-spt:fast")) - .unwrap(); + stamp_creation_fields( + &mut r3, + Some(&prior), + &sole, + &mut vis, + None, + Some("claude-spt:fast"), + ) + .unwrap(); assert_eq!( r3.adapter.as_deref(), Some("claude-spt:fast"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\home.rs:467: // (4) No incoming adapter → prior carries forward unchanged. let mut r4 = InfoJson::new("ep", "t2", 2, "sid2", "live_agent"); stamp_creation_fields(&mut r4, Some(&prior), &sole, &mut vis, None, None).unwrap(); - assert_eq!(r4.adapter.as_deref(), Some("claude-spt:ccs"), "no incoming → prior carries"); + assert_eq!( + r4.adapter.as_deref(), + Some("claude-spt:ccs"), + "no incoming → prior carries" + ); // (5) A BARE prior has no profile to protect → the incoming (equal) bare // value is used, unchanged behavior. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\home.rs:474: let mut bare_prior = prior.clone(); bare_prior.adapter = Some("claude-spt".to_string()); let mut r5 = InfoJson::new("ep", "t2", 2, "sid2", "live_agent"); - stamp_creation_fields(&mut r5, Some(&bare_prior), &sole, &mut vis, None, Some("claude-spt")) - .unwrap(); - assert_eq!(r5.adapter.as_deref(), Some("claude-spt"), "bare prior + bare incoming"); + stamp_creation_fields( + &mut r5, + Some(&bare_prior), + &sole, + &mut vis, + None, + Some("claude-spt"), + ) + .unwrap(); + assert_eq!( + r5.adapter.as_deref(), + Some("claude-spt"), + "bare prior + bare incoming" + ); } // [unit->REQ-INST-15] first-join adoption: with exactly one subnet, an Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:383: // Hold the stable per-perch sentinel across the whole read→mutate→write RMW. let _lock = lock_perch_sentinel(perch_path)?; let mut rec = read_info(perch_path).ok_or_else(|| { - std::io::Error::new(std::io::ErrorKind::NotFound, "info.json absent or unreadable") + std::io::Error::new( + std::io::ErrorKind::NotFound, + "info.json absent or unreadable", + ) })?; mutate(&mut rec); // Already holding the lock — use the UNLOCKED writer (re-locking would deadlock). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:880: // A stamped value round-trips; absent is omitted on serialize. let mut rec = InfoJson::new("a", "t", 7, "s", "live_agent"); - assert!(!serde_json::to_string(&rec).unwrap().contains("controllable")); + assert!(!serde_json::to_string(&rec) + .unwrap() + .contains("controllable")); rec.controllable = Some(false); write_info(d.path(), &rec).unwrap(); assert_eq!(read_info(d.path()).unwrap().controllable, Some(false)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:1186: // Verdict against a DIFFERENT pid (the relay re-launched): nothing written. assert!(!converge_dead_relay(d.path(), "sid-1", 9999).unwrap()); - assert_eq!(read_info(d.path()).unwrap().status.as_deref(), Some("online")); + assert_eq!( + read_info(d.path()).unwrap().status.as_deref(), + Some("online") + ); // Verdict against an old session (a newer bind rotated it): nothing written. assert!(!converge_dead_relay(d.path(), "sid-old", 4242).unwrap()); - assert_eq!(read_info(d.path()).unwrap().status.as_deref(), Some("online")); + assert_eq!( + read_info(d.path()).unwrap().status.as_deref(), + Some("online") + ); // The matching pair applies the whole terminal triple in one write. assert!(converge_dead_relay(d.path(), "sid-1", 4242).unwrap()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:1398: let e = read_info(d.path()).unwrap().psyche_host_error.unwrap(); assert_eq!(e.attempts, 1); assert_eq!(e.reason, "psychebin: program not found"); - assert!(!e.ts.is_empty() && e.ts.ends_with('Z'), "RFC3339-UTC ts: {}", e.ts); + assert!( + !e.ts.is_empty() && e.ts.ends_with('Z'), + "RFC3339-UTC ts: {}", + e.ts + ); // Retry → OVERWRITES reason + ts, INCREMENTS attempts (current-state, not a log). set_psyche_host_error(d.path(), Some("psychebin: still missing")).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:1419: // [unit->REQ-WAKE-RESUME-LEG] set_status(d.path(), crate::liveness::STATUS_ONLINE).unwrap(); let raw = std::fs::read_to_string(d.path().join("info.json")).unwrap(); - assert!(!raw.contains("host_error"), "host_error absent by default: {raw}"); + assert!( + !raw.contains("host_error"), + "host_error absent by default: {raw}" + ); assert_eq!(read_info(d.path()).unwrap().host_error, None); // Stamp a host-level failure report. - set_host_error(d.path(), Some("wake-resume: adapter 'ghost' is not registered")).unwrap(); + set_host_error( + d.path(), + Some("wake-resume: adapter 'ghost' is not registered"), + ) + .unwrap(); let rec = read_info(d.path()).unwrap(); assert_eq!( rec.host_error.as_deref(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:1429: Some("wake-resume: adapter 'ghost' is not registered") ); // status UNTOUCHED — host_error is a report, never a liveness input. - assert_eq!(rec.status.as_deref(), Some(crate::liveness::STATUS_ONLINE), "host_error must not touch status"); + assert_eq!( + rec.status.as_deref(), + Some(crate::liveness::STATUS_ONLINE), + "host_error must not touch status" + ); // Overwrite = current-state stamp (not a log). set_host_error(d.path(), Some("wake-resume: adapter 'ghost' still missing")).unwrap(); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:1503: // A healthy respawn clears it. set_translation_fault(d.path(), None).unwrap(); assert_eq!( - read_info(d.path()).unwrap().translation_fault, None, + read_info(d.path()).unwrap().translation_fault, + None, "a healthy respawn shows clean" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\info.rs:1618: let b = std::thread::spawn(move || { bb.wait(); // B: bind writes the full record (state=live_agent + controllable=true). - let mut rec = - InfoJson::new("hall-a", "t", std::process::id(), "sid", "live_agent"); + let mut rec = InfoJson::new("hall-a", "t", std::process::id(), "sid", "live_agent"); rec.controllable = Some(true); write_info(&pb, &rec).unwrap(); }); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\lib.rs:33: pub mod peeraddrs; pub mod perch; pub mod proc; -pub mod project; pub mod projderive; +pub mod project; pub mod projindex; pub mod projinval; pub mod psyche_custody; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\liveness.rs:371: ); let owlery = perch(); - let ep_perch = - perch::resolve_perch_path_in(owlery.path(), "ep", ParentHint::Infer); + let ep_perch = perch::resolve_perch_path_in(owlery.path(), "ep", ParentHint::Infer); std::fs::create_dir_all(&ep_perch).unwrap(); write_info( &ep_perch, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:260: expires_ms: Option, ) -> rusqlite::Result { self.produce_full( - node_hex, epochs, subnet, kind, from_id, body, scope, coalesce_key, expires_ms, + node_hex, + epochs, + subnet, + kind, + from_id, + body, + scope, + coalesce_key, + expires_ms, ) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:850: for bad in ["update-staged", ":no-owner", "no-key:", ""] { let err = s .produce_scoped( - "cafe", &mut e, "home", "update", "spt-update", "x", - NotifScope::Node, Some(bad), None, + "cafe", + &mut e, + "home", + "update", + "spt-update", + "x", + NotifScope::Node, + Some(bad), + None, ) .unwrap_err(); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:859: "bare key {bad:?} rejected with the pinned copy: {err}" ); } - assert!(s.list("home").unwrap().is_empty(), "no row written on reject"); + assert!( + s.list("home").unwrap().is_empty(), + "no row written on reject" + ); let ok = s .produce_scoped( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:866: - "cafe", &mut e, "home", "update", "spt-update", "x", - NotifScope::Node, Some("spt-core:update-staged"), None, + "cafe", + &mut e, + "home", + "update", + "spt-update", + "x", + NotifScope::Node, + Some("spt-core:update-staged"), + None, ) .unwrap(); assert_eq!(ok.coalesce_key.as_deref(), Some("spt-core:update-staged")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:884: let key = Some("spt-core:update-staged"); let first = s - .produce_scoped("cafe", &mut e, "home", "consent", "spt-update", "v1", - NotifScope::Node, key, None) + .produce_scoped( + "cafe", + &mut e, + "home", + "consent", + "spt-update", + "v1", + NotifScope::Node, + key, + None, + ) .unwrap(); // Same tuple: supersedes the first (latest-wins). let second = s Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:892: - .produce_scoped("cafe", &mut e, "home", "consent", "spt-update", "v2", - NotifScope::Node, key, None) + .produce_scoped( + "cafe", + &mut e, + "home", + "consent", + "spt-update", + "v2", + NotifScope::Node, + key, + None, + ) .unwrap(); - assert!(s.get(&first.notif_id).unwrap().unwrap().dismissed, "prior superseded"); - assert!(!s.get(&second.notif_id).unwrap().unwrap().dismissed, "latest lives"); + assert!( + s.get(&first.notif_id).unwrap().unwrap().dismissed, + "prior superseded" + ); + assert!( + !s.get(&second.notif_id).unwrap().unwrap().dismissed, + "latest lives" + ); // Same key, different KIND: does not touch the live consent row. - s.produce_scoped("cafe", &mut e, "home", "rollback", "spt-update", "r", - NotifScope::Node, key, None) - .unwrap(); - assert!(!s.get(&second.notif_id).unwrap().unwrap().dismissed, "different kind spared"); + s.produce_scoped( + "cafe", + &mut e, + "home", + "rollback", + "spt-update", + "r", + NotifScope::Node, + key, + None, + ) + .unwrap(); + assert!( + !s.get(&second.notif_id).unwrap().unwrap().dismissed, + "different kind spared" + ); // Same key + kind, different SCOPE: does not supersede the node row. - s.produce_scoped("cafe", &mut e, "home", "consent", "spt-update", "sub", - NotifScope::Subnet, key, None) - .unwrap(); - assert!(!s.get(&second.notif_id).unwrap().unwrap().dismissed, "different scope spared"); + s.produce_scoped( + "cafe", + &mut e, + "home", + "consent", + "spt-update", + "sub", + NotifScope::Subnet, + key, + None, + ) + .unwrap(); + assert!( + !s.get(&second.notif_id).unwrap().unwrap().dismissed, + "different scope spared" + ); // A keyless produce supersedes nothing. let live: Vec<_> = s Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:912: - .undismissed("home").unwrap().iter().map(|r| r.notif_id.clone()).collect(); - s.produce("cafe", &mut e, "home", "consent", "spt-update", "keyless").unwrap(); + .undismissed("home") + .unwrap() + .iter() + .map(|r| r.notif_id.clone()) + .collect(); + s.produce("cafe", &mut e, "home", "consent", "spt-update", "keyless") + .unwrap(); for id in &live { - assert!(!s.get(id).unwrap().unwrap().dismissed, "keyless supersedes nothing"); + assert!( + !s.get(id).unwrap().unwrap().dismissed, + "keyless supersedes nothing" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:927: let mut e = epochs(dir.path()); let expired = s - .produce_scoped("cafe", &mut e, "home", "agent", "ling", "gone", - NotifScope::Subnet, None, Some(1_000)) + .produce_scoped( + "cafe", + &mut e, + "home", + "agent", + "ling", + "gone", + NotifScope::Subnet, + None, + Some(1_000), + ) .unwrap(); // Seen everywhere — expiry must not care. s.mark_seen(&expired.notif_id, "doyle").unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:935: let future = s - .produce_scoped("cafe", &mut e, "home", "agent", "ling", "fresh", - NotifScope::Subnet, None, Some(9_000)) + .produce_scoped( + "cafe", + &mut e, + "home", + "agent", + "ling", + "fresh", + NotifScope::Subnet, + None, + Some(9_000), + ) .unwrap(); let no_ttl = s .produce("cafe", &mut e, "home", "agent", "ling", "forever") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:941: .unwrap(); - assert_eq!(s.expire_due("home", 5_000).unwrap(), 1, "only the expired one"); - assert!(s.get(&expired.notif_id).unwrap().unwrap().dismissed, "expired despite seen"); - assert!(!s.get(&future.notif_id).unwrap().unwrap().dismissed, "not yet due"); - assert!(!s.get(&no_ttl.notif_id).unwrap().unwrap().dismissed, "no ttl, never expires"); - assert_eq!(s.expire_due("home", 5_000).unwrap(), 0, "idempotent — nothing new"); + assert_eq!( + s.expire_due("home", 5_000).unwrap(), + 1, + "only the expired one" + ); + assert!( + s.get(&expired.notif_id).unwrap().unwrap().dismissed, + "expired despite seen" + ); + assert!( + !s.get(&future.notif_id).unwrap().unwrap().dismissed, + "not yet due" + ); + assert!( + !s.get(&no_ttl.notif_id).unwrap().unwrap().dismissed, + "no ttl, never expires" + ); + assert_eq!( + s.expire_due("home", 5_000).unwrap(), + 0, + "idempotent — nothing new" + ); } // [unit->REQ-NOTIF-MIGRATE] the one-shot migration dismisses ONLY the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:957: let s = store(dir.path()); let mut e = epochs(dir.path()); - let consent = s.produce("cafe", &mut e, "home", "consent", "spt-update", "u").unwrap(); - let rollback = s.produce("cafe", &mut e, "home", "rollback", "spt-update", "r").unwrap(); - let agent = s.produce("cafe", &mut e, "home", "agent", "ling", "build").unwrap(); - let psyche = s.produce("cafe", &mut e, "home", "psyche", "ling", "sync").unwrap(); + let consent = s + .produce("cafe", &mut e, "home", "consent", "spt-update", "u") + .unwrap(); + let rollback = s + .produce("cafe", &mut e, "home", "rollback", "spt-update", "r") + .unwrap(); + let agent = s + .produce("cafe", &mut e, "home", "agent", "ling", "build") + .unwrap(); + let psyche = s + .produce("cafe", &mut e, "home", "psyche", "ling", "sync") + .unwrap(); // An update-kind row from some other issuer is not the known-stale class. - let other = s.produce("cafe", &mut e, "home", "consent", "someone-else", "x").unwrap(); + let other = s + .produce("cafe", &mut e, "home", "consent", "someone-else", "x") + .unwrap(); - assert_eq!(s.dismiss_stale_update_rows().unwrap(), 2, "consent + rollback"); + assert_eq!( + s.dismiss_stale_update_rows().unwrap(), + 2, + "consent + rollback" + ); assert!(s.get(&consent.notif_id).unwrap().unwrap().dismissed); assert!(s.get(&rollback.notif_id).unwrap().unwrap().dismissed); - assert!(!s.get(&agent.notif_id).unwrap().unwrap().dismissed, "agent untouched"); - assert!(!s.get(&psyche.notif_id).unwrap().unwrap().dismissed, "psyche untouched"); - assert!(!s.get(&other.notif_id).unwrap().unwrap().dismissed, "other issuer untouched"); + assert!( + !s.get(&agent.notif_id).unwrap().unwrap().dismissed, + "agent untouched" + ); + assert!( + !s.get(&psyche.notif_id).unwrap().unwrap().dismissed, + "psyche untouched" + ); + assert!( + !s.get(&other.notif_id).unwrap().unwrap().dismissed, + "other issuer untouched" + ); assert_eq!(s.dismiss_stale_update_rows().unwrap(), 0, "idempotent"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:984: let key = Some("spt-core:update-staged"); let staged = s - .produce_scoped("cafe", &mut e, "home", "consent", "spt-update", "u", - NotifScope::Node, key, None) + .produce_scoped( + "cafe", + &mut e, + "home", + "consent", + "spt-update", + "u", + NotifScope::Node, + key, + None, + ) .unwrap(); let other_key = s - .produce_scoped("cafe", &mut e, "home", "rollback", "spt-update", "r", - NotifScope::Node, Some("spt-core:rollback"), None) + .produce_scoped( + "cafe", + &mut e, + "home", + "rollback", + "spt-update", + "r", + NotifScope::Node, + Some("spt-core:rollback"), + None, + ) .unwrap(); // Same key, different subnet: untouched. let other_subnet = s Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\notif.rs:996: - .produce_scoped("cafe", &mut e, "work", "consent", "spt-update", "w", - NotifScope::Node, key, None) + .produce_scoped( + "cafe", + &mut e, + "work", + "consent", + "spt-update", + "w", + NotifScope::Node, + key, + None, + ) .unwrap(); - assert_eq!(s.dismiss_by_coalesce_key("home", "spt-core:update-staged").unwrap(), 1); - assert!(s.get(&staged.notif_id).unwrap().unwrap().dismissed, "keyed row latched"); - assert!(!s.get(&other_key.notif_id).unwrap().unwrap().dismissed, "different key spared"); - assert!(!s.get(&other_subnet.notif_id).unwrap().unwrap().dismissed, "different subnet spared"); assert_eq!( - s.dismiss_by_coalesce_key("home", "spt-core:update-staged").unwrap(), + s.dismiss_by_coalesce_key("home", "spt-core:update-staged") + .unwrap(), + 1 + ); + assert!( + s.get(&staged.notif_id).unwrap().unwrap().dismissed, + "keyed row latched" + ); + assert!( + !s.get(&other_key.notif_id).unwrap().unwrap().dismissed, + "different key spared" + ); + assert!( + !s.get(&other_subnet.notif_id).unwrap().unwrap().dismissed, + "different subnet spared" + ); + assert_eq!( + s.dismiss_by_coalesce_key("home", "spt-core:update-staged") + .unwrap(), 0, "idempotent" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\obstap.rs:62: if at_cap(&path) { return; } - if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(&path) { + if let Ok(mut f) = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(&path) + { let _ = writeln!(f, "t={} {line}", now_ms()); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\obstap.rs:95: use std::fmt::Write as _; let _ = write!(hex, "{b:02x}"); } - if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open(&path) { + if let Ok(mut f) = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(&path) + { let _ = writeln!(f, "t={} n={} {hex}", now_ms(), bytes.len()); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\peeraddrs.rs:287: for _ in 0..5 { PeerAddrStore::demote_seed(&path, "ab12").unwrap(); let s = PeerAddrStore::load_from(&path); - assert_eq!(s.get("ab12"), Some(&addr), "the address survives the failure"); + assert_eq!( + s.get("ab12"), + Some(&addr), + "the address survives the failure" + ); assert!(s.is_suspect("ab12"), "and is marked suspect"); - assert!(s.valid_route("ab12").is_none(), "a suspect row is not a route"); + assert!( + s.valid_route("ab12").is_none(), + "a suspect row is not a route" + ); } // A validated fresher address supersedes: mark cleared, route live. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\peeraddrs.rs:296: let fresher = serde_json::json!({"id": "ab12", "addrs": ["10.0.0.9:4711"]}); let mut s = PeerAddrStore::load_from(&path); assert!(s.put("ab12", fresher.clone()), "supersede is a change"); - assert!(!s.is_suspect("ab12"), "suspect cleared by the validated put"); + assert!( + !s.is_suspect("ab12"), + "suspect cleared by the validated put" + ); assert_eq!(s.valid_route("ab12"), Some(&fresher), "route restored"); // Re-putting the SAME addr on a suspect row also un-suspects (a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\peeraddrs.rs:304: let mut s2 = PeerAddrStore::default(); assert!(s2.put("ab12", addr.clone())); s2.mark_suspect("ab12"); - assert!(s2.put("ab12", addr), "same-addr put on a suspect row = a change (the mark)"); + assert!( + s2.put("ab12", addr), + "same-addr put on a suspect row = a change (the mark)" + ); assert!(!s2.is_suspect("ab12")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\peeraddrs.rs:320: "5ff50e75".to_string(), serde_json::json!({"id": "ecb39aaa", "addrs": ["10.0.0.2:4711"]}), ); - assert!(store.valid_route("5ff50e75").is_none(), "poison row is not a route"); - assert!(store.get("5ff50e75").is_some(), "but stays readable for repair"); + assert!( + store.valid_route("5ff50e75").is_none(), + "poison row is not a route" + ); + assert!( + store.get("5ff50e75").is_some(), + "but stays readable for repair" + ); } // [unit->REQ-PEER-ROUTE-CHAIN] suspect state round-trips through disk Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\perch.rs:1004: // Bulk injectivity over a set containing every adversarial neighbour. let options = [ - "cc", "cc:dev", "cc_dev", "cc:dev:extra", "cc%3Adev", "cc.dev", "cc dev", "cc/dev", - r"cc\dev", "CC", "cc:", ":cc", "", "cc:DEV", + "cc", + "cc:dev", + "cc_dev", + "cc:dev:extra", + "cc%3Adev", + "cc.dev", + "cc dev", + "cc/dev", + r"cc\dev", + "CC", + "cc:", + ":cc", + "", + "cc:DEV", ]; let mut seen = std::collections::BTreeMap::new(); for o in options { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:215: &mut needed, ) }; - if probe == STATUS_INFO_LENGTH_MISMATCH && needed >= core::mem::size_of::() as u32 { + if probe == STATUS_INFO_LENGTH_MISMATCH + && needed >= core::mem::size_of::() as u32 + { let mut buf = vec![0u8; needed as usize]; let status = unsafe { NtQueryInformationProcess( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:616: return None; } let mut created = FileTime::default(); - let (mut exit, mut kernel, mut user) = - (FileTime::default(), FileTime::default(), FileTime::default()); - let ok = unsafe { - GetProcessTimes(handle, &mut created, &mut exit, &mut kernel, &mut user) - }; + let (mut exit, mut kernel, mut user) = ( + FileTime::default(), + FileTime::default(), + FileTime::default(), + ); + let ok = + unsafe { GetProcessTimes(handle, &mut created, &mut exit, &mut kernel, &mut user) }; unsafe { CloseHandle(handle); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:955: .and_then(|p| p.file_name().map(|s| s.to_string_lossy().into_owned())); let got = exe_basename(std::process::id()); assert!(got.is_some(), "the current process's exe basename resolves"); - assert!(!got.as_deref().unwrap_or("").is_empty(), "basename non-empty"); + assert!( + !got.as_deref().unwrap_or("").is_empty(), + "basename non-empty" + ); assert_eq!(got, want, "matches current_exe's basename"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:964: #[test] fn exe_basename_dead_pid_is_none() { const DEAD_PID: u32 = 2_000_000_000; - assert!(exe_basename(DEAD_PID).is_none(), "no basename for a dead pid"); + assert!( + exe_basename(DEAD_PID).is_none(), + "no basename for a dead pid" + ); assert!(exe_basename(0).is_none(), "pid 0 is never probe-able"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:1007: } let _ = child.kill(); let _ = child.wait(); - assert!(found, "process_cmdline must read a live child's argv marker"); assert!( + found, + "process_cmdline must read a live child's argv marker" + ); + assert!( process_cmdline(2_000_000_000).is_none(), "a dead pid yields no cmdline (fail-safe → caller declines to reap)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:1072: .spawn() .expect("spawn a real child to make a corpse of"); let pid = child.id(); - assert_eq!(process_exists(pid), Some(true), "precondition: it is running"); + assert_eq!( + process_exists(pid), + Some(true), + "precondition: it is running" + ); child.kill().expect("kill the child"); - child.wait().expect("reap it — it is genuinely terminated now"); + child + .wait() + .expect("reap it — it is genuinely terminated now"); // `child` is deliberately NOT dropped: the handle stays open below. assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\proc.rs:1253: } let _ = child.kill(); let _ = child.wait(); - assert!(found, "a spawned child must be found in the descendant subtree"); + assert!( + found, + "a spawned child must be found in the descendant subtree" + ); // Root/0 guards: never claim descendants for the never-probe-able pid. - assert!(process_descendants(0).is_empty(), "pid 0 has no descendants"); + assert!( + process_descendants(0).is_empty(), + "pid 0 has no descendants" + ); } /// A 2-LEVEL tree: a resident parent (`cmd`/`sh`) that itself spawns a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projderive.rs:118: continue; } if seen_id.insert(pid.clone()) { - refs.push(DerivedRef { id: pid, dir: cwd.to_string(), display, source }); + refs.push(DerivedRef { + id: pid, + dir: cwd.to_string(), + display, + source, + }); } } // UNION the committed-context branches (project ids only; no session dir → the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projderive.rs:184: let origin = refs.iter().find(|r| r.id == "origin").expect("origin ref"); assert_eq!(origin.source, SourceLeg::OriginCwd); // Branch-only membership appends last, display = id verbatim. - let store = refs.iter().find(|r| r.id == "store-proj").expect("store ref"); + let store = refs + .iter() + .find(|r| r.id == "store-proj") + .expect("store ref"); assert_eq!(store.source, SourceLeg::ContextRecency); assert_eq!(store.display, "store-proj"); assert_eq!(store.dir, ""); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projderive.rs:194: assert_eq!(refs[0].source, SourceLeg::OriginCwd); // Nothing but branches → context recency decides the head. - let refs = - project_refs_from(&[], None, vec!["only-store".to_string()], owlery, stub_derive); + let refs = project_refs_from( + &[], + None, + vec!["only-store".to_string()], + owlery, + stub_derive, + ); assert_eq!(refs[0].source, SourceLeg::ContextRecency); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projderive.rs:214: entry(Some("/p/proj-a")), entry(Some("/home/owlery/x/nested/x-psyche")), // owlery-internal: excluded entry(Some("/p/proj-a")), // repeat cwd: one derivation - entry(Some("/other/PROJ-A")), // same id, different dir: newest dir kept + entry(Some("/other/PROJ-A")), // same id, different dir: newest dir kept ]; let refs = project_refs_from(&entries, None, vec![], owlery, counting); assert_eq!(refs.len(), 1, "one project id → one ref: {refs:?}"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projderive.rs:235: // owlery-exclusion prefix test rides the same normalization. #[test] fn normalization_and_path_under() { - assert_eq!(normalize_path(Path::new("C:\\Users\\X\\Proj\\")), "c:/users/x/proj"); + assert_eq!( + normalize_path(Path::new("C:\\Users\\X\\Proj\\")), + "c:/users/x/proj" + ); assert!(path_under( Path::new("C:\\home\\OWLERY\\a\\nested"), Path::new("c:/home/owlery") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projderive.rs:242: )); - assert!(!path_under(Path::new("/home/owl"), Path::new("/home/owlery"))); + assert!(!path_under( + Path::new("/home/owl"), + Path::new("/home/owlery") + )); assert!(!path_under(Path::new("/anything"), Path::new(""))); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\project.rs:134: .file_name() .map(|n| n.to_string_lossy().to_string()) .unwrap_or_default(); - let id = if name.is_empty() { String::new() } else { slug(&name) }; + let id = if name.is_empty() { + String::new() + } else { + slug(&name) + }; if id.is_empty() { ("unnamed-project".to_string(), "unnamed-project".to_string()) } else { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\project.rs:194: #[test] // [unit->REQ-PICKER-PROJECT-DISPLAY-NAME] display = URL tail / folder name, case preserved, never parsed out of the lossy slug. fn display_derivation() { // display_from_url: last path segment, `.git` + trailing slash stripped. - assert_eq!(display_from_url("https://github.com/SaberMage/spt-core.git"), "spt-core"); - assert_eq!(display_from_url("git@github.com:SaberMage/spt-core.git"), "spt-core"); + assert_eq!( + display_from_url("https://github.com/SaberMage/spt-core.git"), + "spt-core" + ); + assert_eq!( + display_from_url("git@github.com:SaberMage/spt-core.git"), + "spt-core" + ); assert_eq!(display_from_url("https://example.com/Team/Repo/"), "Repo"); // One-pass derivation: id keys on the slug, display stays recognizable. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\project.rs:208: assert_eq!((id.as_str(), disp.as_str()), ("proj-x", "proj-x")); // With a remote → id slugged, display = URL tail (case preserved). run_git_ok( - &["-C", &root.to_string_lossy(), "remote", "add", "origin", "git@example.com:Team/CoolRepo.git"], + &[ + "-C", + &root.to_string_lossy(), + "remote", + "add", + "origin", + "git@example.com:Team/CoolRepo.git", + ], None, None, ) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\project.rs:215: .unwrap(); let (id, disp) = project_id_and_display_for_dir(&root.join("nested")); - assert_eq!((id.as_str(), disp.as_str()), ("example-com-team-coolrepo", "CoolRepo")); + assert_eq!( + (id.as_str(), disp.as_str()), + ("example-com-team-coolrepo", "CoolRepo") + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projinval.rs:174: nudge_at(&dir, &InvalScope::Global).unwrap(); nudge_at( &dir, - &InvalScope::Endpoint { id: "todlando".into(), cwd: Some("C:/p/spt-core".into()) }, + &InvalScope::Endpoint { + id: "todlando".into(), + cwd: Some("C:/p/spt-core".into()), + }, ) .unwrap(); - nudge_at(&dir, &InvalScope::Endpoint { id: "perri".into(), cwd: None }).unwrap(); + nudge_at( + &dir, + &InvalScope::Endpoint { + id: "perri".into(), + cwd: None, + }, + ) + .unwrap(); assert!(pending_at(&dir)); let drained = drain_at(&dir); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projinval.rs:193: #[test] fn burst_coalesces_into_one_refresh() { let batch = vec![ - InvalScope::Endpoint { id: "a".into(), cwd: Some("/p/x".into()) }, + InvalScope::Endpoint { + id: "a".into(), + cwd: Some("/p/x".into()), + }, InvalScope::Global, - InvalScope::Endpoint { id: "a".into(), cwd: Some("/p/x".into()) }, - InvalScope::Endpoint { id: "b".into(), cwd: None }, + InvalScope::Endpoint { + id: "a".into(), + cwd: Some("/p/x".into()), + }, + InvalScope::Endpoint { + id: "b".into(), + cwd: None, + }, InvalScope::Global, ]; let one = coalesce(batch); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\projinval.rs:223: let drained = drain_at(&dir); assert_eq!(drained, vec![InvalScope::Global]); - assert!(!pending_at(&dir), "garbage is consumed too, not left to wedge"); + assert!( + !pending_at(&dir), + "garbage is consumed too, not left to wedge" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\recent_home.rs:118: #[test] fn node_global_moves_to_front() { let d = tempfile::tempdir().unwrap(); - assert!(mru_preference_in(d.path(), None).is_empty(), "unset → empty"); + assert!( + mru_preference_in(d.path(), None).is_empty(), + "unset → empty" + ); record_home_in(d.path(), None, "bignet"); record_home_in(d.path(), None, "homenet"); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\recent_home.rs:175: let d = tempfile::tempdir().unwrap(); record_home_in(d.path(), Some("proj-x"), "workv"); assert_eq!( - mru_preference_in(d.path(), Some("proj-x")).first().map(String::as_str), + mru_preference_in(d.path(), Some("proj-x")) + .first() + .map(String::as_str), Some("workv"), "project list recorded" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\recent_home.rs:182: assert_eq!( - mru_preference_in(d.path(), Some("other")).first().map(String::as_str), + mru_preference_in(d.path(), Some("other")) + .first() + .map(String::as_str), Some("workv"), "node-global fallback recorded for an unrelated project" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\recent_home.rs:192: fn blank_name_is_noop() { let d = tempfile::tempdir().unwrap(); record_home_in(d.path(), None, " "); - assert!(mru_preference_in(d.path(), None).is_empty(), "whitespace-only → no record"); + assert!( + mru_preference_in(d.path(), None).is_empty(), + "whitespace-only → no record" + ); } // [unit->REQ-RUN-MULTISUBNET-HOME] a pre-W3 single-value `recent_home` file Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\resume_custody.rs:234: let mut child = spawn_sleeper(); let pid = child.id(); mint(perch, pid).unwrap(); - assert_eq!(read_custody(perch), Custody::Ours(pid), "pair matches → OURS"); + assert_eq!( + read_custody(perch), + Custody::Ours(pid), + "pair matches → OURS" + ); assert!(resume_in_flight(perch)); clear(perch).unwrap(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\resume_custody.rs:348: ) .unwrap(); - assert_eq!(read_custody(perch), Custody::None, "a bare pid is not custody"); + assert_eq!( + read_custody(perch), + Custody::None, + "a bare pid is not custody" + ); assert!( !perch.join(LEGACY_RESUME_PID_FILE).exists(), "and it is deleted on sight" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\roster.rs:160: if let Some(parent) = path.parent() { std::fs::create_dir_all(parent).map_err(|e| RosterError::Io(e.to_string()))?; } - let json = serde_json::to_string_pretty(self).map_err(|e| RosterError::Io(e.to_string()))?; + let json = + serde_json::to_string_pretty(self).map_err(|e| RosterError::Io(e.to_string()))?; atomic_write_string(path, &json).map_err(|e| RosterError::Io(e.to_string())) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\roster.rs:350: #[test] fn merge_entry_is_strictly_greater_lease_wins() { let mut r = RosterStore::default(); - assert_eq!(r.merge_entry(entry("home", "aa", 5)), MergeOutcome::Inserted); + assert_eq!( + r.merge_entry(entry("home", "aa", 5)), + MergeOutcome::Inserted + ); // Lower lease loses (Stale) — the stored lease stays at 5. assert_eq!(r.merge_entry(entry("home", "aa", 3)), MergeOutcome::Stale); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\roster.rs:393: "{pk} converges" ); } - assert_eq!(ab.find("home", "bb").unwrap().lease_epoch, 9, "newer bb wins"); + assert_eq!( + ab.find("home", "bb").unwrap().lease_epoch, + 9, + "newer bb wins" + ); // Idempotent: merging b again changes nothing. let before = ab.members.len(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\roster.rs:424: r.save_to(&path).unwrap(); let reloaded = RosterStore::load_from(&path); - assert!(reloaded.find("home", "offline").is_some(), "survives reload"); + assert!( + reloaded.find("home", "offline").is_some(), + "survives reload" + ); assert_eq!(reloaded.find("home", "online").unwrap().lease_epoch, 2); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\roster.rs:456: // Clears on re-pair: membership restored. assert!(r.clear_tombstone("home", "aa")); assert!(r.is_member("home", "aa"), "re-pair restores membership"); - assert!(!r.clear_tombstone("home", "aa"), "second clear is no-op false"); + assert!( + !r.clear_tombstone("home", "aa"), + "second clear is no-op false" + ); } // [unit->REQ-MESH-5] is_member_any: a node present in ≥1 subnet passes the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\rotation.rs:84: if let Some(parent) = path.parent() { std::fs::create_dir_all(parent)?; } - let json = serde_json::to_string_pretty(self) - .map_err(|e| std::io::Error::other(e.to_string()))?; + let json = + serde_json::to_string_pretty(self).map_err(|e| std::io::Error::other(e.to_string()))?; atomic_write_string(path, &json).map_err(std::io::Error::other) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\rotation.rs:187: p.coalesce("now", &hexes(&["bb"]), 500); // force-rotate (deadline=now=500) assert_eq!(p.due_subnets(499), Vec::::new(), "nothing due yet"); - assert_eq!(p.due_subnets(500), vec!["now".to_string()], "force fires at deadline"); assert_eq!( + p.due_subnets(500), + vec!["now".to_string()], + "force fires at deadline" + ); + assert_eq!( p.due_subnets(1_000), vec!["home".to_string(), "now".to_string()], "both due once the window closes" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\rotation.rs:196: assert!(p.clear("now")); assert!(!p.clear("now"), "second clear is a no-op false"); - assert_eq!(p.due_subnets(1_000), vec!["home".to_string()], "only home remains"); + assert_eq!( + p.due_subnets(1_000), + vec!["home".to_string()], + "only home remains" + ); } // [unit->REQ-MESH-4] the schedule round-trips atomically, and an absent or Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\sessions.rs:423: "the oldest survivor keeps its STAMPED ordinal (no renumber on prune)" ); let newest = rows.last().unwrap(); - assert_eq!(newest.ordinal, Some((n - 1) as u64), "newest keeps its stamp"); + assert_eq!( + newest.ordinal, + Some((n - 1) as u64), + "newest keeps its stamp" + ); // The whole survivor window is contiguous and monotonic. let ords: Vec = rows.iter().map(|e| e.ordinal.unwrap()).collect(); let expected: Vec = ((n - MAX_LEDGER) as u64..n as u64).collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\sessions.rs:430: - assert_eq!(ords, expected, "ordinals survive contiguous, never renumbered"); + assert_eq!( + ords, expected, + "ordinals survive contiguous, never renumbered" + ); } // [unit->REQ-DIGEST-CURSOR] a pre-migration ledger (rows with no `ordinal` key) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\shellinfo.rs:389: let live = online_perch(Some(&std::process::id().to_string())); assert!(!shell_pid_provably_dead(live.path())); - assert_eq!(status_of(&live), SHELL_STATUS_ONLINE, "a live pid is online"); + assert_eq!( + status_of(&live), + SHELL_STATUS_ONLINE, + "a live pid is online" + ); // The fail-toward-alive arms — none of these is EVIDENCE of a corpse. for (label, pid) in [ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\shellinfo.rs:471: assert_eq!(id0, "claude-spt-0", "id minted off the parent, no ':'"); assert!(!id0.contains(':'), "reserved delimiter never in the id"); let info0 = resolve_shell_ref(owlery, "doyle", &id0).unwrap().1; - assert_eq!(info0.adapter_name, "claude-spt:work", "composite carried verbatim"); + assert_eq!( + info0.adapter_name, "claude-spt:work", + "composite carried verbatim" + ); // A different profile of the SAME parent shares the ordinal space… let id1 = spawn(owlery, "doyle", "claude-spt:play", None); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\shellinfo.rs:478: - assert_eq!(id1, "claude-spt-1", "profiles of one parent share -"); + assert_eq!( + id1, "claude-spt-1", + "profiles of one parent share -" + ); // …and a bare-parent spawn occupies the same space too. let id2 = spawn(owlery, "doyle", "claude-spt", None); assert_eq!(id2, "claude-spt-2"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:124: // The `deferred` column is retained and kept in sync (deferred=1 IFF // window='active_only') so the existing deferred-keyed reads are unaffected. // `window` is a SQLite keyword (window functions) — always double-quoted in SQL. - let _ = conn - .execute_batch("ALTER TABLE messages ADD COLUMN \"window\" TEXT NOT NULL DEFAULT 'default'"); + let _ = conn.execute_batch( + "ALTER TABLE messages ADD COLUMN \"window\" TEXT NOT NULL DEFAULT 'default'", + ); let _ = conn.execute_batch("ALTER TABLE messages ADD COLUMN channel TEXT NOT NULL DEFAULT 'any'"); - let _ = conn - .execute_batch("ALTER TABLE messages ADD COLUMN ephemeral INTEGER NOT NULL DEFAULT 0"); + let _ = + conn.execute_batch("ALTER TABLE messages ADD COLUMN ephemeral INTEGER NOT NULL DEFAULT 0"); // W5 (REQ-SPOOL-TAKE-AUDIT) taker-audit columns — additive + NULLABLE (no schema // break; delivered rows are already retained, never deleted). Stamped in the SAME // UPDATE that flips `delivered = 1`, so a taken row records WHO took it: the leg Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:252: impl TakerAudit { /// A fresh audit stamp for `leg`, wall-clock `at_ms` set to now. pub fn new(leg: TakerLeg, sid: Option, pid: Option) -> Self { - Self { leg, sid, pid, at_ms: now_ms_u64() } + Self { + leg, + sid, + pid, + at_ms: now_ms_u64(), + } } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:293: taken_pid = ?4, taken_at_ms = ?5 WHERE id = ?1", params![id, a.leg.as_str(), a.sid, a.pid, a.at_ms as i64], ), - None => conn.execute("UPDATE messages SET delivered = 1 WHERE id = ?1", params![id]), + None => conn.execute( + "UPDATE messages SET delivered = 1 WHERE id = ?1", + params![id], + ), } .map(|_| ()) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:762: )?; let rows = stmt .query_map([], |row| { - Ok((row.get::<_, i64>(0)?, row.get::<_, String>(1)?, row.get::<_, String>(2)?)) + Ok(( + row.get::<_, i64>(0)?, + row.get::<_, String>(1)?, + row.get::<_, String>(2)?, + )) })? .filter_map(|r| r.ok()) .collect(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:868: spool_message_at(p, "bob", "unaudited").unwrap(); // Audited drain of the first row (relay-backlog leg with a sid + pid). - let audit = TakerAudit::new(TakerLeg::RelayBacklog, Some("sess-xyz".to_string()), Some(4242)); + let audit = TakerAudit::new( + TakerLeg::RelayBacklog, + Some("sess-xyz".to_string()), + Some(4242), + ); let got = drain_non_deferred_audited_at(p, &audit).unwrap(); assert_eq!(got.len(), 2, "both undelivered rows drain"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:892: let rows2 = audit_rows_at(p2).unwrap(); assert_eq!(rows2.len(), 1); assert!(rows2[0].delivered, "delivered flips"); - assert_eq!(rows2[0].taken_leg, None, "unaudited take stamps no provenance"); + assert_eq!( + rows2[0].taken_leg, None, + "unaudited take stamps no provenance" + ); assert_eq!(rows2[0].taken_pid, None); assert_eq!(rows2[0].taken_at_ms, None); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:1184: let n = evaporate_ephemeral_non_deferred_at(p).unwrap(); assert_eq!(n, 2, "both ephemeral non-deferred rows evaporate"); - let remaining: Vec = - peek_all_at(p).unwrap().into_iter().map(|r| r.2).collect(); - assert!(remaining.contains(&"D-idle".to_string()), "durable idle row survives"); + let remaining: Vec = peek_all_at(p).unwrap().into_iter().map(|r| r.2).collect(); assert!( + remaining.contains(&"D-idle".to_string()), + "durable idle row survives" + ); + assert!( remaining.contains(&"E-act".to_string()), "ephemeral active_only (deferred) row survives evaporation (hook-channel persistence)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:1221: // include_deferred: default + active_only, STILL never idle_only. let with_def = drain_active_window_at(p, true).unwrap(); let bodies: Vec<&str> = with_def.iter().map(|m| m.body.as_str()).collect(); - assert!(bodies.contains(&"A"), "active_only drains with include_deferred"); + assert!( + bodies.contains(&"A"), + "active_only drains with include_deferred" + ); assert!(bodies.contains(&"D2") && bodies.contains(&"A2")); assert!( !bodies.contains(&"I"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:1255: let claimed = claim_idle_edge_at(p).unwrap(); assert_eq!( - claimed.iter().map(|(_, _, b)| b.as_str()).collect::>(), + claimed + .iter() + .map(|(_, _, b)| b.as_str()) + .collect::>(), vec!["D", "I"], "the idle edge claims non-deferred only, oldest-first — active_only is not offered" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:1292: // Idle-edge claims the row (take → delivered=1). let claimed = claim_idle_edge_at(p).unwrap(); assert_eq!( - claimed.iter().map(|(_, _, b)| b.as_str()).collect::>(), + claimed + .iter() + .map(|(_, _, b)| b.as_str()) + .collect::>(), vec!["D"] ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:1309: // The hook-poll drain now sees it again — exactly once, id/body preserved. let redrained = drain_active_window_at(p, true).unwrap(); assert_eq!( - redrained.iter().map(|m| m.body.as_str()).collect::>(), + redrained + .iter() + .map(|m| m.body.as_str()) + .collect::>(), vec!["D"], "a released row surfaces again for a later drain (exactly once)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\spool.rs:1547: let idle_audit2 = TakerAudit::new(TakerLeg::IdleInject, None, Some(2)); let claimed = claim_idle_edge_audited_at(p2, &idle_audit2).unwrap(); assert_eq!( - claimed.iter().map(|(_, _, b)| b.as_str()).collect::>(), + claimed + .iter() + .map(|(_, _, b)| b.as_str()) + .collect::>(), vec!["parked"], "an untaken parked row is still delivered by the idle-edge (F-023 class stays green)" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\subnet.rs:230: // offliner still holds, and the rotator must be able to verify that // `N-1` proof to re-seed it across the rotation (Mesh-D7 grace). // [impl->REQ-MESH-4] - rec.prev_seed_hex = Some(std::mem::replace(&mut rec.seed_hex, encode_hex(&random_seed()))); + rec.prev_seed_hex = Some(std::mem::replace( + &mut rec.seed_hex, + encode_hex(&random_seed()), + )); rec.epoch += 1; Ok(rec) } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\subnet.rs:394: ); // A re-delivered (equal) or older push changes nothing. - assert!(!store.adopt_rotation("home", [0u8; TOTP_SEED_LEN], 2).expect("idem")); - assert!(!store.adopt_rotation("home", [0u8; TOTP_SEED_LEN], 1).expect("older")); + assert!(!store + .adopt_rotation("home", [0u8; TOTP_SEED_LEN], 2) + .expect("idem")); + assert!(!store + .adopt_rotation("home", [0u8; TOTP_SEED_LEN], 1) + .expect("older")); assert_eq!(store.find("home").unwrap().seed_bytes(), Some(new_seed)); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\subnet.rs:410: fn no_prior_generation_before_rotation() { let mut store = SubnetStore::default(); let rec = store.create_subnet("home").expect("create"); - assert!(rec.prev_seed_hex.is_none(), "fresh subnet has no prior seed"); + assert!( + rec.prev_seed_hex.is_none(), + "fresh subnet has no prior seed" + ); assert!(rec.prev_seed_bytes().is_none()); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:57: /// Reap a parent's REAPABLE nested WORKER perches against the process-global owlery. // [impl->REQ-WORKER-REAP] -pub fn reap_workers(parent_id: &str, parent_alive: bool, ttl_secs: u64, now_secs: u64) -> Vec { - reap_workers_in(&perch::owlery_dir(), parent_id, parent_alive, ttl_secs, now_secs) +pub fn reap_workers( + parent_id: &str, + parent_alive: bool, + ttl_secs: u64, + now_secs: u64, +) -> Vec { + reap_workers_in( + &perch::owlery_dir(), + parent_id, + parent_alive, + ttl_secs, + now_secs, + ) } /// [`reap_workers`] against an explicit owlery root. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:111: } let ready = child.join("ready").exists(); // Age drives BOTH the TTL floor and the orphan boot-race grace. - let age = rec.started.parse::().ok().map(|s| now_secs.saturating_sub(s)); + let age = rec + .started + .parse::() + .ok() + .map(|s| now_secs.saturating_sub(s)); let expired = ttl_secs > 0 && matches!(age, Some(a) if a > ttl_secs); let young = matches!(age, Some(a) if a < ORPHAN_GRACE_SECS); let pending = spool::pending_count_at(&child).unwrap_or(0); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:140: fn establish_parent(owlery: &Path, id: &str) { let p = perch::resolve_perch_path_in(owlery, id, ParentHint::Infer); std::fs::create_dir_all(&p).unwrap(); - info::write_info(&p, &InfoJson::new(id, "0", std::process::id(), "psid", "live_agent")).unwrap(); + info::write_info( + &p, + &InfoJson::new(id, "0", std::process::id(), "psid", "live_agent"), + ) + .unwrap(); } /// Seed a worker perch with a controllable `started` (epoch secs) + ready marker. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:147: - fn seed_worker(owlery: &Path, parent: &str, wid: &str, started: u64, ready: bool) -> std::path::PathBuf { + fn seed_worker( + owlery: &Path, + parent: &str, + wid: &str, + started: u64, + ready: bool, + ) -> std::path::PathBuf { let p = perch::resolve_perch_path_in(owlery, wid, ParentHint::Explicit(parent)); std::fs::create_dir_all(&p).unwrap(); - info::write_info(&p, &InfoJson::new(wid, &started.to_string(), 2_000_000_000, "psid", "worker")).unwrap(); + info::write_info( + &p, + &InfoJson::new(wid, &started.to_string(), 2_000_000_000, "psid", "worker"), + ) + .unwrap(); if ready { std::fs::write(p.join("ready"), "").unwrap(); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:165: #[test] fn clamp_ttl_floors_fat_finger_but_allows_disable() { assert_eq!(clamp_reap_ttl(0), 0, "0 = explicit disable"); - assert_eq!(clamp_reap_ttl(10), MIN_REAP_TTL_SECS, "a fat-fingered 10s is floored"); + assert_eq!( + clamp_reap_ttl(10), + MIN_REAP_TTL_SECS, + "a fat-fingered 10s is floored" + ); assert_eq!(clamp_reap_ttl(MIN_REAP_TTL_SECS - 1), MIN_REAP_TTL_SECS); assert_eq!(clamp_reap_ttl(7_200), 7_200, "a sane value passes through"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:185: assert_eq!(reaped, vec!["alice-w2".to_string()]); assert!(exists(o.path(), "alice-w1"), "in-flight kept"); assert!(!exists(o.path(), "alice-w2"), "drained soft-stop reaped"); - assert!(exists(o.path(), "alice-w3"), "pending results kept (awaiting drain)"); + assert!( + exists(o.path(), "alice-w3"), + "pending results kept (awaiting drain)" + ); } // [unit->REQ-WORKER-REAP] ORPHANED (parent not alive): an aged worker reaps; a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:194: fn orphaned_respects_boot_race_grace() { let o = owlery(); establish_parent(o.path(), "alice"); - seed_worker(o.path(), "alice", "alice-w1", NOW - (ORPHAN_GRACE_SECS + 30), true); // aged + seed_worker( + o.path(), + "alice", + "alice-w1", + NOW - (ORPHAN_GRACE_SECS + 30), + true, + ); // aged seed_worker(o.path(), "alice", "alice-w2", NOW - 5, true); // young let reaped = reap_workers_in(o.path(), "alice", false, TTL, NOW); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:201: assert_eq!(reaped, vec!["alice-w1".to_string()]); assert!(!exists(o.path(), "alice-w1"), "an aged orphan reaps"); - assert!(exists(o.path(), "alice-w2"), "a just-started worker survives the boot-race grace"); + assert!( + exists(o.path(), "alice-w2"), + "a just-started worker survives the boot-race grace" + ); } // [unit->REQ-WORKER-REAP] the TTL floor OVERRIDES a live ready marker DELIBERATELY Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:214: let reaped = reap_workers_in(o.path(), "alice", true, TTL, NOW); assert_eq!(reaped, vec!["alice-w1".to_string()]); - assert!(!exists(o.path(), "alice-w1"), "expired ready worker reaps (TTL overrides ready)"); - assert!(exists(o.path(), "alice-w2"), "fresh ready worker under a live parent stays"); + assert!( + !exists(o.path(), "alice-w1"), + "expired ready worker reaps (TTL overrides ready)" + ); + assert!( + exists(o.path(), "alice-w2"), + "fresh ready worker under a live parent stays" + ); seed_worker(o.path(), "alice", "alice-w3", NOW - (TTL + 100), true); - assert!(reap_workers_in(o.path(), "alice", true, 0, NOW).is_empty(), "ttl=0 disables"); + assert!( + reap_workers_in(o.path(), "alice", true, 0, NOW).is_empty(), + "ttl=0 disables" + ); assert!(exists(o.path(), "alice-w3")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:227: fn never_touches_a_psyche() { let o = owlery(); establish_parent(o.path(), "alice"); - let psyche = perch::resolve_perch_path_in(o.path(), "alice-psyche", ParentHint::Explicit("alice")); + let psyche = + perch::resolve_perch_path_in(o.path(), "alice-psyche", ParentHint::Explicit("alice")); std::fs::create_dir_all(&psyche).unwrap(); info::write_info( &psyche, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:234: - &InfoJson::new("alice-psyche", &(NOW - 999_999).to_string(), 2_000_000_000, "psid", "psyche"), + &InfoJson::new( + "alice-psyche", + &(NOW - 999_999).to_string(), + 2_000_000_000, + "psid", + "psyche", + ), ) .unwrap(); assert!(reap_workers_in(o.path(), "alice", false, TTL, NOW).is_empty()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_reap.rs:238: - assert!(psyche.join("info.json").exists(), "the nested psyche survives the worker GC"); + assert!( + psyche.join("info.json").exists(), + "the nested psyche survives the worker GC" + ); } // [unit->REQ-WORKER-REAP] the WIRED-reap twin of worker_seq::counter_survives_reap: Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\worker_seq.rs:128: } let ids: Vec = handles.into_iter().map(|h| h.join().unwrap()).collect(); let unique: HashSet<&String> = ids.iter().collect(); - assert_eq!(unique.len(), N, "every concurrent mint must be a distinct id"); + assert_eq!( + unique.len(), + N, + "every concurrent mint must be a distinct id" + ); // The set is exactly {alice-w1 .. alice-wN} — contiguous, no gap, no dupe. for n in 1..=N { assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\tests\carrier_claim_int.rs:117: let mut taken: Vec = Vec::new(); let deadline = Instant::now() + Duration::from_secs(30); loop { - let audit = - TakerAudit::new(leg, Some(format!("sid-{}", leg.as_str())), Some(std::process::id())); + let audit = TakerAudit::new( + leg, + Some(format!("sid-{}", leg.as_str())), + Some(std::process::id()), + ); // A DatabaseBusy take is an EXPECTED adversarial-contention outcome // (busy budget exhausted; delivered=0 untouched → safe retry), NOT an // invariant breach — yield+retry under the same deadline guard. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\tests\carrier_claim_int.rs:125: let batch: Vec = match leg { - TakerLeg::HookPoll => { - retrying_busy(deadline, leg.as_str(), || { - drain_active_window_audited_at(&cp, false, &audit) - }) - .into_iter() - .map(|m| m.body) - .collect() - } + TakerLeg::HookPoll => retrying_busy(deadline, leg.as_str(), || { + drain_active_window_audited_at(&cp, false, &audit) + }) + .into_iter() + .map(|m| m.body) + .collect(), _ => retrying_busy(deadline, leg.as_str(), || { claim_idle_edge_audited_at(&cp, &audit) }) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\tests\carrier_claim_int.rs:189: let expected: HashSet = (0..N).map(|i| format!("msg-{i}")).collect(); let got: HashSet = all.into_iter().collect(); - assert_eq!(got, expected, "the exact produced set was delivered, nothing else"); + assert_eq!( + got, expected, + "the exact produced set was delivered, nothing else" + ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\lib.rs:45: mod winprog; pub use digest::{Digest, DigestConfig, DigestEntry, ToolUse, Turn}; +pub use portable_pty::CommandBuilder; pub use projection::{ parse_context_record, project, project_lines, project_lines_diagnosed, project_timeline, record_to_tagged, record_to_tagged_result, window_input_turns, ContextRecord, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\lib.rs:51: DigestDiagnostics, DigestRecord, DigestRole, DropReason, DroppedLine, TimelineItem, ToolRef, }; -pub use portable_pty::CommandBuilder; pub use pty::PtySession; pub use reader::Drain; // [impl->REQ-BROKER-SCREEN-GRID] the server-side render grid + clean repaint on Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:304: /// (REQ-DIGEST-CURSOR) — `(ledger_ordinal << 32) | per_session_line_idx`, /// computed by the daemon when it builds the timeline. The seq is the stable /// cursor key threaded onto the folded entry/turn. - Activity { - record: DigestRecord, - seq: u64, - }, + Activity { record: DigestRecord, seq: u64 }, /// An spt-injected context entry (`kind`, `body`, `ts`). Context { kind: String, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:548: assert_eq!(d.turns.len(), 1); let t = &d.turns[0]; assert_eq!(t.input.as_deref(), Some("add a file")); - assert_eq!(t.entries[0], DigestEntry::agent("sure, doing it".to_string())); + assert_eq!( + t.entries[0], + DigestEntry::agent("sure, doing it".to_string()) + ); match &t.entries[1] { DigestEntry::ToolSprint { tools: s, .. } => { assert_eq!(s.len(), 2, "consecutive tools collapse into one sprint"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:618: }) .expect("a sprint"); assert_eq!(sprint[0].name, "Bash"); - assert_eq!(sprint[0].arg, "this-is-a-…", "arg truncated to width with ellipsis"); + assert_eq!( + sprint[0].arg, "this-is-a-…", + "arg truncated to width with ellipsis" + ); } // [unit->REQ-TERM-4] forward-compat: a malformed line, an unknown role, and a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:662: let d = project_lines(lines, &cfg(3)); assert_eq!(d.turns.len(), 2); assert_eq!(d.turns[0].input, None, "preamble turn has no input"); - assert_eq!(d.turns[0].entries[0], DigestEntry::agent("booting".to_string())); + assert_eq!( + d.turns[0].entries[0], + DigestEntry::agent("booting".to_string()) + ); assert_eq!(d.turns[1].input.as_deref(), Some("first")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:734: // absent — backward-compat with pre-ADR-0019 records that carry no timestamp. #[test] fn ts_ordering_key_parses_and_is_optional() { - let with_ts = record_to_tagged( - r#"{"role":"input","text":"hi","ts":"2026-06-13T21:00:00Z"}"#, - ) - .expect("a valid record"); + let with_ts = + record_to_tagged(r#"{"role":"input","text":"hi","ts":"2026-06-13T21:00:00Z"}"#) + .expect("a valid record"); assert_eq!(with_ts.ts.as_deref(), Some("2026-06-13T21:00:00Z")); let without_ts = record_to_tagged(r#"{"role":"agent","text":"no clock"}"#).expect("a valid record"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:820: ]; let d = project_timeline(&items, &cfg(3)); let inputs: Vec<_> = d.turns.iter().filter_map(|t| t.input.as_deref()).collect(); - assert_eq!(inputs, vec!["before", "after"], "window bridges the boundary"); - assert!(d - .turns + assert_eq!( + inputs, + vec!["before", "after"], + "window bridges the boundary" + ); + assert!(d.turns.iter().any(|t| t + .entries .iter() - .any(|t| t.entries.iter().any(|e| matches!(e, DigestEntry::Boundary { .. })))); + .any(|e| matches!(e, DigestEntry::Boundary { .. })))); } // [unit->REQ-TERM-6] window_input_turns counts only input-bearing turns, keeps Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:848: let win = window_input_turns(vec![t("a"), t("b"), bound(), t("c")], 2); let inputs: Vec<_> = win.iter().filter_map(|x| x.input.as_deref()).collect(); assert_eq!(inputs, vec!["b", "c"]); - assert!(win.iter().any(|x| matches!( - x.entries.first(), - Some(DigestEntry::Boundary { .. }) - ))); + assert!(win + .iter() + .any(|x| matches!(x.entries.first(), Some(DigestEntry::Boundary { .. })))); // window 1 orphans the leading divider → trimmed. let win = window_input_turns(vec![t("a"), bound(), t("c")], 1); assert_eq!(win.len(), 1); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:889: } for e in &t.entries { match e { - DigestEntry::Agent { text, seq: Some(s), .. } => { + DigestEntry::Agent { + text, seq: Some(s), .. + } => { out.push((format!("agent:{text}"), *s)); } - DigestEntry::ToolSprint { tools, seq: Some(s), .. } => { + DigestEntry::ToolSprint { + tools, + seq: Some(s), + .. + } => { out.push((format!("tools:{}", tools.len()), *s)); } _ => {} Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:923: let before_committed = committed_seqs(&before); // t2 is the trailing OPEN turn → partial, no committed seqs; t0/t1 committed. assert!( - before_committed.iter().any(|(k, s)| k == "input:t1" && *s == 200), + before_committed + .iter() + .any(|(k, s)| k == "input:t1" && *s == 200), "t1 is committed with its source seq before the slide: {before_committed:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:932: extended.push(act_seq(DigestRole::Input, "t3", 400)); extended.push(act_seq(DigestRole::Agent, "r3", 401)); let after = project_timeline(&extended, &cfg(3)); - let inputs: Vec<_> = after.turns.iter().filter_map(|t| t.input.as_deref()).collect(); - assert_eq!(inputs, vec!["t1", "t2", "t3"], "the window slid: t0 dropped"); + let inputs: Vec<_> = after + .turns + .iter() + .filter_map(|t| t.input.as_deref()) + .collect(); + assert_eq!( + inputs, + vec!["t1", "t2", "t3"], + "the window slid: t0 dropped" + ); // Every committed entry present in BOTH projections has the SAME seq. let after_committed = committed_seqs(&after); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:947: } // Concretely: t1's input + reply kept their source seqs (200/201) even though // t1 moved from window-index 1 to window-index 0 under the slide. - assert!(after_committed.iter().any(|(k, s)| k == "input:t1" && *s == 200)); - assert!(after_committed.iter().any(|(k, s)| k == "agent:r1" && *s == 201)); + assert!(after_committed + .iter() + .any(|(k, s)| k == "input:t1" && *s == 200)); + assert!(after_committed + .iter() + .any(|(k, s)| k == "agent:r1" && *s == 201)); // And t2 (open before) is now committed with its OWN original source seqs. - assert!(after_committed.iter().any(|(k, s)| k == "input:t2" && *s == 300)); + assert!(after_committed + .iter() + .any(|(k, s)| k == "input:t2" && *s == 300)); } // [unit->REQ-DIGEST-CURSOR] seq encoding ordering at the daemon's Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:996: "the collapsed sprint carries its LAST record's seq (12, not 11)" ); // Sanity: the partial single-turn projection blanked the sprint seq. - let partial_sprint = d.turns.last().unwrap().entries.iter().find_map(|e| match e { - DigestEntry::ToolSprint { seq, .. } => Some(*seq), - _ => None, - }); - assert_eq!(partial_sprint, Some(None), "the open turn's sprint seq is blanked"); + let partial_sprint = d + .turns + .last() + .unwrap() + .entries + .iter() + .find_map(|e| match e { + DigestEntry::ToolSprint { seq, .. } => Some(*seq), + _ => None, + }); + assert_eq!( + partial_sprint, + Some(None), + "the open turn's sprint seq is blanked" + ); } // [unit->REQ-DIGEST-CURSOR] the trailing OPEN turn is partial:true with NO seqs Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1074: #[test] fn idle_seals_the_trailing_turn_while_busy_leaves_it_partial() { let items = finished_turn_timeline(); - let busy = project_timeline(&items, &DigestConfig { endpoint_idle: false, ..cfg(3) }); - let idle = project_timeline(&items, &DigestConfig { endpoint_idle: true, ..cfg(3) }); + let busy = project_timeline( + &items, + &DigestConfig { + endpoint_idle: false, + ..cfg(3) + }, + ); + let idle = project_timeline( + &items, + &DigestConfig { + endpoint_idle: true, + ..cfg(3) + }, + ); // BUSY: today's behavior, unchanged. assert_eq!(busy.turns.len(), 2); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1082: - assert!(busy.turns[1].partial, "a busy endpoint's trailing turn stays partial"); + assert!( + busy.turns[1].partial, + "a busy endpoint's trailing turn stays partial" + ); assert_eq!( trailing_seqs(&busy), (None, None), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1120: fn the_sealed_seq_equals_what_the_next_input_fallback_would_assign() { let idle = project_timeline( &finished_turn_timeline(), - &DigestConfig { endpoint_idle: true, ..cfg(3) }, + &DigestConfig { + endpoint_idle: true, + ..cfg(3) + }, ); // The fallback shape: the owner WAS prompted again, so the turn closed // structurally — still busy, no idle signal needed. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1127: let mut prompted = finished_turn_timeline(); prompted.push(act_seq(DigestRole::Input, "next ask", 70)); - let fallback = project_timeline(&prompted, &DigestConfig { endpoint_idle: false, ..cfg(3) }); + let fallback = project_timeline( + &prompted, + &DigestConfig { + endpoint_idle: false, + ..cfg(3) + }, + ); let sealed = idle.turns.last().expect("the sealed turn"); let closed = &fallback.turns[1]; // same turn, closed by the later input Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1146: #[test] fn re_projecting_a_sealed_idle_timeline_is_identical() { let items = finished_turn_timeline(); - let cfg = DigestConfig { endpoint_idle: true, ..cfg(3) }; + let cfg = DigestConfig { + endpoint_idle: true, + ..cfg(3) + }; let first = project_timeline(&items, &cfg); let second = project_timeline(&items, &cfg); - assert_eq!(first, second, "seal is idempotent — a re-pull is byte-identical"); + assert_eq!( + first, second, + "seal is idempotent — a re-pull is byte-identical" + ); // And spelled out at the level a consumer keys on, so a future regression // names the seq rather than dumping a whole struct diff. assert_eq!(trailing_seqs(&first), trailing_seqs(&second)); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1163: // may add rows past a poller's cursor, never renumber rows behind it. #[test] fn a_post_seal_straggler_folds_in_without_moving_a_published_seq() { - let cfg = DigestConfig { endpoint_idle: true, ..cfg(3) }; + let cfg = DigestConfig { + endpoint_idle: true, + ..cfg(3) + }; let before = project_timeline(&finished_turn_timeline(), &cfg); let published = trailing_seqs(&before); - assert_eq!(published, (Some(60), Some(61)), "PRECONDITION: the seal published 60/61"); + assert_eq!( + published, + (Some(60), Some(61)), + "PRECONDITION: the seal published 60/61" + ); // The straggler: a later agent line flushed after the idle report. Higher // line index ⇒ higher seq, by construction. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1175: let after = project_timeline(&late, &cfg); let sealed = after.turns.last().expect("still one trailing turn"); - assert_eq!(after.turns.len(), 2, "the straggler folded IN — it did not open a turn"); - assert!(!sealed.partial, "the turn stays sealed (the endpoint is still idle)"); assert_eq!( + after.turns.len(), + 2, + "the straggler folded IN — it did not open a turn" + ); + assert!( + !sealed.partial, + "the turn stays sealed (the endpoint is still idle)" + ); + assert_eq!( trailing_seqs(&after), published, "the input seq and the first entry's seq must NOT move when a straggler lands" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1184: ); // The straggler is visible, past the published cursor — a poller at 61 sees // exactly the new row and nothing it already read. - assert_eq!(sealed.entries.len(), 2, "the late row is present: {:?}", sealed.entries); + assert_eq!( + sealed.entries.len(), + 2, + "the late row is present: {:?}", + sealed.entries + ); assert!( matches!(&sealed.entries[1], DigestEntry::Agent { text, seq: Some(62), .. } if text == "…and pushed the tag"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1200: // phantom sealed turn), and a single finished turn seals as the only turn. #[test] fn idle_on_an_empty_or_single_turn_timeline_invents_nothing() { - let cfg = DigestConfig { endpoint_idle: true, ..cfg(3) }; + let cfg = DigestConfig { + endpoint_idle: true, + ..cfg(3) + }; assert!( project_timeline(&[], &cfg).turns.is_empty(), "an idle endpoint with no records has no turn to seal" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1222: // turn, not of a window position, and the surviving turns keep their seqs. #[test] fn sealing_survives_a_window_slide() { - let cfg = DigestConfig { endpoint_idle: true, ..cfg(2) }; + let cfg = DigestConfig { + endpoint_idle: true, + ..cfg(2) + }; let mut items = vec![ act_seq(DigestRole::Input, "t0", 100), act_seq(DigestRole::Agent, "r0", 101), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1235: items.push(act_seq(DigestRole::Input, "t2", 300)); items.push(act_seq(DigestRole::Agent, "r2", 301)); let after = project_timeline(&items, &cfg); - let inputs: Vec<_> = after.turns.iter().filter_map(|t| t.input.as_deref()).collect(); - assert_eq!(inputs, vec!["t1", "t2"], "PRECONDITION: the window slid, t0 dropped"); - assert_eq!(trailing_seqs(&after), (Some(300), Some(301)), "the NEW trailing turn seals"); + let inputs: Vec<_> = after + .turns + .iter() + .filter_map(|t| t.input.as_deref()) + .collect(); + assert_eq!( + inputs, + vec!["t1", "t2"], + "PRECONDITION: the window slid, t0 dropped" + ); + assert_eq!( + trailing_seqs(&after), + (Some(300), Some(301)), + "the NEW trailing turn seals" + ); // t1 slid from trailing to committed and kept the seq it was sealed with. - assert_eq!(after.turns[0].input_seq, Some(200), "a sealed seq survives the slide"); + assert_eq!( + after.turns[0].input_seq, + Some(200), + "a sealed seq survives the slide" + ); assert!(!after.turns[0].partial); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1257: // value skip the appended tool entirely (it would EAT stragglers). #[test] fn a_sealed_sprint_grows_forward_only_keeping_the_turn_anchor_stable() { - let cfg = DigestConfig { endpoint_idle: true, ..cfg(3) }; + let cfg = DigestConfig { + endpoint_idle: true, + ..cfg(3) + }; let base = vec![ act_seq(DigestRole::Input, "run the build", 10), tool_seq("Bash", 11), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1264: ]; let before = project_timeline(&base, &cfg); - assert_eq!(trailing_seqs(&before), (Some(10), Some(11)), "PRECONDITION: sealed at 10/11"); + assert_eq!( + trailing_seqs(&before), + (Some(10), Some(11)), + "PRECONDITION: sealed at 10/11" + ); let mut late = base.clone(); late.push(tool_seq("Read", 12)); // a straggler TOOL, adjacent to the sprint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1280: // (2) Forward only. let (_, before_sprint) = trailing_seqs(&before); let (_, after_sprint) = trailing_seqs(&after); - let (before_sprint, after_sprint) = - (before_sprint.expect("sealed sprint seq"), after_sprint.expect("grown sprint seq")); + let (before_sprint, after_sprint) = ( + before_sprint.expect("sealed sprint seq"), + after_sprint.expect("grown sprint seq"), + ); assert!( after_sprint > before_sprint, "an entry seq may only advance FORWARD on sprint growth ({before_sprint} -> \ Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\projection.rs:1311: _ => None, }) .expect("a sprint"); - assert_eq!(tools, 2, "and the re-delivered sprint carries BOTH tools, so nothing is lost"); + assert_eq!( + tools, 2, + "and the re-delivered sprint carries BOTH tools, so nothing is lost" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\reader.rs:313: // Split `\x1b[6n` across two feeds: one answer, query stripped. let (fwd, answers) = split_all(&[b"output\x1b[", b"6nmore"]); assert_eq!(answers, 1); - assert_eq!(fwd, b"outputmore", "the query is stripped, everything else forwards"); + assert_eq!( + fwd, b"outputmore", + "the query is stripped, everything else forwards" + ); // A lone ESC that restarts a match mid-stream, then completes — the // withheld non-query ESC still forwards. let (fwd, answers) = split_all(&[b"\x1b\x1b[6n"]); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:555: self.buf_mut()[row][col] = Cell { ch: c, marks: Vec::new(), - kind: if wide { CellKind::WideLead } else { CellKind::Narrow }, + kind: if wide { + CellKind::WideLead + } else { + CellKind::Narrow + }, pen, }; if wide { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1272: return; } match byte { - b'c' => self.full_reset(), // RIS + b'c' => self.full_reset(), // RIS b'7' => self.saved = Some((self.row, self.col)), // DECSC b'8' => { // DECRC Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1340: let out = repaint(&[b"\x1b[5;10r"], 24, 80); let stbm = out.find("\x1b[5;10r").expect("tracked DECSTBM replayed"); let cursor = out.rfind("H").expect("final cursor placement"); - assert!(stbm < cursor, "DECSTBM precedes the final cursor placement:\n{out:?}"); + assert!( + stbm < cursor, + "DECSTBM precedes the final cursor placement:\n{out:?}" + ); // Default region → explicit reset, never an omitted mode. let out = repaint(&[b"plain"], 24, 80); - assert!(out.contains("\x1b[r"), "default region resets explicitly:\n{out:?}"); + assert!( + out.contains("\x1b[r"), + "default region resets explicitly:\n{out:?}" + ); assert!(!out.contains(";24r"), "no spurious tracked-region emit"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1381: #[test] fn main_screen_repaint_paints_text_no_alt_enter() { let out = repaint(&[b"hello world"], 24, 80); - assert!(out.contains("hello world"), "repaint paints the text: {out:?}"); + assert!( + out.contains("hello world"), + "repaint paints the text: {out:?}" + ); assert!(out.contains("\x1b[?1049l"), "client stays on main buffer"); - assert!(!out.contains("\x1b[?1049h"), "no alt-screen enter for a main screen"); + assert!( + !out.contains("\x1b[?1049h"), + "no alt-screen enter for a main screen" + ); // Cursor ends after the 11 printed columns (col 12, 1-based). - assert!(out.contains("\x1b[1;12H"), "cursor at live position: {out:?}"); + assert!( + out.contains("\x1b[1;12H"), + "cursor at live position: {out:?}" + ); } // The #6 CORE: after entering the alt screen, the repaint paints ONLY the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1396: fn alt_screen_repaint_excludes_main_scrollback() { let out = repaint( &[ - b"MAIN-SCROLLBACK-LINE\r\n", // main screen history - b"\x1b[?1049h", // enter alt screen - b"\x1b[2J\x1b[HTUI-VIEWPORT", // paint the TUI + b"MAIN-SCROLLBACK-LINE\r\n", // main screen history + b"\x1b[?1049h", // enter alt screen + b"\x1b[2J\x1b[HTUI-VIEWPORT", // paint the TUI ], 24, 80, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1405: ); - assert!(out.contains("\x1b[?1049h"), "repaint puts the client in the alt screen"); - assert!(out.contains("TUI-VIEWPORT"), "alt content is painted: {out:?}"); assert!( + out.contains("\x1b[?1049h"), + "repaint puts the client in the alt screen" + ); + assert!( + out.contains("TUI-VIEWPORT"), + "alt content is painted: {out:?}" + ); + assert!( !out.contains("MAIN-SCROLLBACK-LINE"), "main scrollback must NOT appear in an alt repaint (the #6 corruption): {out:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1426: 80, ); assert!(out.contains("\x1b[?1049l"), "client returned to main"); - assert!(out.contains("back-on-main"), "main content restored: {out:?}"); - assert!(!out.contains("alt-only"), "alt content gone after leaving: {out:?}"); + assert!( + out.contains("back-on-main"), + "main content restored: {out:?}" + ); + assert!( + !out.contains("alt-only"), + "alt content gone after leaving: {out:?}" + ); } // SGR pen state is reconstructed in the repaint (colour + bold), and the reset Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1437: fn sgr_pen_reconstructed_in_repaint() { let out = repaint(&[b"\x1b[1;31mRED\x1b[0m plain"], 24, 80); assert!(out.contains("RED"), "text painted"); - assert!(out.contains("\x1b[0;1;31m"), "bold-red SGR reconstructed: {out:?}"); + assert!( + out.contains("\x1b[0;1;31m"), + "bold-red SGR reconstructed: {out:?}" + ); assert!(out.contains("plain"), "trailing plain text painted"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1475: let out = repaint(&[b"\x1b]2;doomed\x07", b"\x1bc"], 24, 80); assert!(!out.contains("\x1b]2;"), "RIS cleared the title: {out:?}"); let out = repaint(&[b"plain"], 24, 80); - assert!(!out.contains("\x1b]2;"), "no title ever set → none replayed"); + assert!( + !out.contains("\x1b]2;"), + "no title ever set → none replayed" + ); } // E-2: a resize does not drop the title (only buffers reflow). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1486: g.advance(b"\x1b]2;sticky\x07"); g.resize(10, 40); let out = String::from_utf8(g.render_repaint()).unwrap(); - assert!(out.contains("\x1b]2;sticky\x07"), "title survives resize: {out:?}"); + assert!( + out.contains("\x1b]2;sticky\x07"), + "title survives resize: {out:?}" + ); } // A resize preserves the visible top-left content. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1515: #[test] fn cursor_visibility_hidden_emitted() { let out = repaint(&[b"\x1b[?25l"], 24, 80); - assert!(out.contains("\x1b[?25l"), "hidden cursor reflected: {out:?}"); + assert!( + out.contains("\x1b[?25l"), + "hidden cursor reflected: {out:?}" + ); } // An empty grid (nothing produced) repaints to a clean clear with no cell rows. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1537: #[test] fn wide_glyph_advances_two_display_columns() { let out = repaint(&["世A".as_bytes()], 24, 80); - assert!(out.contains("世A"), "lead emitted once, no continuation debris: {out:?}"); assert!( + out.contains("世A"), + "lead emitted once, no continuation debris: {out:?}" + ); + assert!( out.contains("\x1b[1;4H"), "cursor at display col 4 after a wide glyph + narrow (not scalar col 3): {out:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1551: fn cursor_position_reports_display_columns() { let mut g = ScreenGrid::new(24, 80); g.advance("世".as_bytes()); - assert_eq!(g.cursor_position(), (1, 3), "wide glyph consumes 2 display columns"); + assert_eq!( + g.cursor_position(), + (1, 3), + "wide glyph consumes 2 display columns" + ); g.advance(b"X"); assert_eq!(g.cursor_position(), (1, 4)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1564: // 3-col grid: `AB` fills cols 1-2, `世` needs 2 cols but only col 3 // remains → whole glyph wraps to row 2. let out = repaint(&["AB世".as_bytes()], 4, 3); - assert!(out.contains("\x1b[1;1HAB"), "row 1 keeps the narrow prefix: {out:?}"); - assert!(out.contains("\x1b[2;1H世"), "the wide glyph wrapped WHOLE to row 2: {out:?}"); + assert!( + out.contains("\x1b[1;1HAB"), + "row 1 keeps the narrow prefix: {out:?}" + ); + assert!( + out.contains("\x1b[2;1H世"), + "the wide glyph wrapped WHOLE to row 2: {out:?}" + ); } // Overwriting EITHER half of a wide glyph clears the whole glyph — no Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1576: fn overwriting_either_half_clears_the_whole_wide_glyph() { // Overwrite the CONTINUATION (col 2): the lead must die with it. let out = repaint(&["世".as_bytes(), b"\x1b[1;2HX"], 24, 80); - assert!(!out.contains('世'), "lead cleared when its continuation is overwritten: {out:?}"); + assert!( + !out.contains('世'), + "lead cleared when its continuation is overwritten: {out:?}" + ); assert!(out.contains('X'), "the overwriting char landed: {out:?}"); // Overwrite the LEAD (col 1): the continuation must die with it. let out = repaint(&["世Z".as_bytes(), b"\x1b[1;1HY"], 24, 80); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1583: - assert!(!out.contains('世'), "glyph cleared when its lead is overwritten: {out:?}"); + assert!( + !out.contains('世'), + "glyph cleared when its lead is overwritten: {out:?}" + ); // Y at col 1, old continuation at col 2 is now a blank, Z still at col 3. - assert!(out.contains("\x1b[1;1HY Z"), "continuation became a real blank: {out:?}"); + assert!( + out.contains("\x1b[1;1HY Z"), + "continuation became a real blank: {out:?}" + ); } // ECH/EL landing on one half of a wide pair heals both halves. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1591: fn erase_across_a_wide_half_leaves_no_orphan() { // ECH 1 on the lead: continuation must not survive as phantom content. let out = repaint(&["世".as_bytes(), b"\x1b[1;1H\x1b[1X"], 24, 80); - assert!(!out.contains('世'), "ECH on the lead clears the pair: {out:?}"); + assert!( + !out.contains('世'), + "ECH on the lead clears the pair: {out:?}" + ); // EL from the continuation column: the lead (left of the erase range) // must not survive as a half-glyph. let out = repaint(&["世AB".as_bytes(), b"\x1b[1;2H\x1b[0K"], 24, 80); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1598: - assert!(!out.contains('世'), "EL starting on the continuation clears the lead too: {out:?}"); + assert!( + !out.contains('世'), + "EL starting on the continuation clears the lead too: {out:?}" + ); } // ICH/DCH shift in display cells and never leave a mispaired half. The Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1606: fn dch_ich_heal_wide_pairs_at_the_boundaries() { let out = repaint(&["世界".as_bytes(), b"\x1b[1;1H\x1b[1P"], 24, 80); assert!(!out.contains('世'), "deleted wide glyph is gone: {out:?}"); - assert!(out.contains('界'), "the following wide glyph shifted intact: {out:?}"); + assert!( + out.contains('界'), + "the following wide glyph shifted intact: {out:?}" + ); // ICH at the continuation column of 世: the pair heals, then blanks // are inserted — 界 must survive intact further right. let out = repaint(&["世界".as_bytes(), b"\x1b[1;2H\x1b[2@"], 24, 80); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1613: - assert!(!out.contains('世'), "ICH on a continuation heals the pair: {out:?}"); - assert!(out.contains('界'), "the neighbouring glyph shifted whole: {out:?}"); + assert!( + !out.contains('世'), + "ICH on a continuation heals the pair: {out:?}" + ); + assert!( + out.contains('界'), + "the neighbouring glyph shifted whole: {out:?}" + ); } // Width-0 combining marks attach to the preceding grapheme without Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1620: #[test] fn combining_mark_attaches_without_advancing() { let out = repaint(&["e\u{0301}Z".as_bytes()], 24, 80); - assert!(out.contains("e\u{0301}Z"), "mark rides its base in the repaint: {out:?}"); assert!( + out.contains("e\u{0301}Z"), + "mark rides its base in the repaint: {out:?}" + ); + assert!( out.contains("\x1b[1;3H"), "cursor advanced 2 columns for 3 scalars (the mark is width-0): {out:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1632: g.advance("\u{0301}".as_bytes()); assert_eq!(g.cursor_position(), (1, 3), "width-0 mark did not advance"); let out = String::from_utf8(g.render_repaint()).unwrap(); - assert!(out.contains("世\u{0301}"), "mark attached to the wide lead: {out:?}"); + assert!( + out.contains("世\u{0301}"), + "mark attached to the wide lead: {out:?}" + ); } // A resize that truncates THROUGH a wide pair heals the cut lead — a Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1644: g.advance("AB世".as_bytes()); // AB at cols 1-2, 世 at cols 3-4 g.resize(4, 3); // cut at col 4: 世's continuation is gone let out = String::from_utf8(g.render_repaint()).unwrap(); - assert!(!out.contains('世'), "the cut lead healed to a blank: {out:?}"); - assert!(out.contains("AB"), "untouched content survives the resize: {out:?}"); + assert!( + !out.contains('世'), + "the cut lead healed to a blank: {out:?}" + ); + assert!( + out.contains("AB"), + "untouched content survives the resize: {out:?}" + ); } // ── REQ-RC-RESIZE-PRESENTATION-BARRIER leg 5: capture-mode disposition ── Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1682: } // The grid still consumed the printable text at full fidelity. let out = String::from_utf8(g.render_repaint()).unwrap(); - assert!(out.contains("hello world"), "text advanced the grid: {out:?}"); + assert!( + out.contains("hello world"), + "text advanced the grid: {out:?}" + ); } // TRACKED state (title, cursor visibility, DECSTBM, alt screen, pen, cursor) Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1701: ); let out = String::from_utf8(g.render_repaint()).unwrap(); assert!(out.contains("\x1b]2;t\x07"), "title tracked: {out:?}"); - assert!(out.contains("\x1b[?25l"), "cursor visibility tracked: {out:?}"); + assert!( + out.contains("\x1b[?25l"), + "cursor visibility tracked: {out:?}" + ); assert!(out.contains("\x1b[?1049h"), "alt screen tracked: {out:?}"); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1735: let mut g = ScreenGrid::new(6, 40); let cap = g.advance_captured(b"\x1b]10;?\x07\x1b]11;rgb:1a/2b/3c\x1b\\"); let cap = String::from_utf8(cap).unwrap(); - assert!(cap.contains("\x1b]10;?\x07"), "BEL-terminated query kept BEL: {cap:?}"); assert!( + cap.contains("\x1b]10;?\x07"), + "BEL-terminated query kept BEL: {cap:?}" + ); + assert!( cap.contains("\x1b]11;rgb:1a/2b/3c\x1b\\"), "ST-terminated set kept ST: {cap:?}" ); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1768: let mut g = ScreenGrid::new(6, 40); let cap = g.advance_captured(b"\x1b[?2004h\x1bc\x1b[?1000h"); let cap = String::from_utf8(cap).unwrap(); - assert!(cap.contains("\x1b[?2004h"), "pre-RIS deferred bytes survive: {cap:?}"); - assert!(cap.contains("\x1b[?1000h"), "post-RIS bytes keep deferring: {cap:?}"); + assert!( + cap.contains("\x1b[?2004h"), + "pre-RIS deferred bytes survive: {cap:?}" + ); + assert!( + cap.contains("\x1b[?1000h"), + "post-RIS bytes keep deferring: {cap:?}" + ); } // The LIVE path is untouched: plain `advance` defers nothing and ignores Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\screen.rs:1783: assert!(cap.is_empty(), "nothing latent leaks into a later capture"); let out = String::from_utf8(g.render_repaint()).unwrap(); assert!(out.contains("plain")); - assert!(!out.contains("\x1b[?2004h"), "untracked mode is not in the repaint"); + assert!( + !out.contains("\x1b[?2004h"), + "untracked mode is not in the repaint" + ); } // The field-repro shape (hertz RCA): wide glyphs + row-addressed redraw. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\src\winprog.rs:283: fn unresolvable_passes_through() { let dirs = vec![PathBuf::from("C:/tools")]; let none = exists_set(&[]); - assert_eq!(resolve_in("nope", &dirs, &exts(), none), Launch::Passthrough); + assert_eq!( + resolve_in("nope", &dirs, &exts(), none), + Launch::Passthrough + ); } // First PATH dir with a match wins (search order honoured). Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\capture_vehicle_fidelity.rs:51: fn fixture() -> std::path::PathBuf { let p = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) .join("../spt-daemon/tests/fixtures/enlyzeam/tap-1-raw.log"); - assert!(p.exists(), "the ENLYZEAM capture must be committed at {p:?}"); + assert!( + p.exists(), + "the ENLYZEAM capture must be committed at {p:?}" + ); p } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\capture_vehicle_fidelity.rs:134: std::thread::sleep(std::time::Duration::from_secs(5)); let got = acc.lock().expect("lock").clone(); let _ = pty.kill(); - assert!(!got.is_empty(), "precondition: the vehicle emitted something"); + assert!( + !got.is_empty(), + "precondition: the vehicle emitted something" + ); got } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\rc_console_newline_presentation.rs:102: std::thread::sleep(std::time::Duration::from_secs(3)); let got = acc.lock().expect("lock").clone(); let _ = pty.kill(); - assert!(!got.is_empty(), "precondition: the player emitted something"); + assert!( + !got.is_empty(), + "precondition: the player emitted something" + ); got } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\resize_console_mode_integrity.rs:297: // ...and the SYMPTOM leg's observable must move too, or that leg is passing // for reasons unrelated to echo. Typed bytes must now come back as output. let before = rig.text(); - rig.pty.write_input(b"zqxjv\r").expect("type into the child"); + rig.pty + .write_input(b"zqxjv\r") + .expect("type into the child"); let deadline = Instant::now() + Duration::from_secs(5); let mut echoed = false; while Instant::now() < deadline && !echoed { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\resize_console_mode_integrity.rs:350: // Not a report at all — must not be mistaken for one. assert!(parse("\u{1b}[8;60;131t").is_none()); - assert!(parse("MODE tag=broken in=0x1").is_none(), "a partial report is refused"); + assert!( + parse("MODE tag=broken in=0x1").is_none(), + "a partial report is refused" + ); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\screengrid_width_oracle.rs:81: let raw = "世界Today\x1b[1;5HNEW"; assert_matches_authority(raw, 2, 20, "CUP overwrite after wide glyphs"); let auth = authoritative(raw, 2, 20); - assert_eq!(auth[0], "世界NEWay", "NEW lands at display cols 5-7 over Today"); + assert_eq!( + auth[0], "世界NEWay", + "NEW lands at display cols 5-7 over Today" + ); } // Case 3: a zero-width combining mark survives the synthesized repaint Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-term\tests\winspawn.rs:41: pid.is_some(), "the cmd.exe wrapper child has a real pid (it actually launched)" ), - Err(e) => panic!( - "a .cmd must spawn under a PTY via the cmd.exe wrap, never os error 193: {e}" - ), + Err(e) => { + panic!("a .cmd must spawn under a PTY via the cmd.exe wrap, never os error 193: {e}") + } } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:325: if entry.components().any(|c| c.as_os_str() == "tests") { continue; } - let Ok(src) = std::fs::read_to_string(&entry) else { continue }; + let Ok(src) = std::fs::read_to_string(&entry) else { + continue; + }; if !binds_real_broker_in_tests(&src) { continue; } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:335: } else { entry.file_stem() }; - let Some(module) = stem.and_then(|s| s.to_str()) else { continue }; + let Some(module) = stem.and_then(|s| s.to_str()) else { + continue; + }; if !filter_classifies(&nextest, module) { unclassified.push(format!("{} (module `{module}`)", entry.display())); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:434: /// would serialize units that never touch a broker. // [impl->REQ-HEAVY-UNIT-CLASSIFICATION] fn binds_real_broker_in_tests(src: &str) -> bool { - let Some(tests_at) = src.find("\nmod tests {").or_else(|| src.find("\nmod tests{")) else { + let Some(tests_at) = src + .find("\nmod tests {") + .or_else(|| src.find("\nmod tests{")) + else { return false; }; src[tests_at..].contains("Broker::bind") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:464: /// Every `.rs` file under `dir`, recursively. fn walk_rs_files(dir: &Path) -> Vec { let mut out = Vec::new(); - let Ok(entries) = std::fs::read_dir(dir) else { return out }; + let Ok(entries) = std::fs::read_dir(dir) else { + return out; + }; for entry in entries.flatten() { let path = entry.path(); if path.is_dir() { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:780: .iter() .find(|p| p.asset_name == asset_name) .map(|p| p.triple) - .unwrap_or_else(|| panic!("unknown release asset {asset_name:?} — no target-triple mapping")) + .unwrap_or_else(|| { + panic!("unknown release asset {asset_name:?} — no target-triple mapping") + }) } /// Build, sign, verify, and write `update-set.json`: the signed multi-platform Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:1702: Path::new("/repo/throwaway-target/debug") ); // An absolute override is used verbatim. - let abs = if cfg!(windows) { - "C:/tmp/t" - } else { - "/tmp/t" - }; + let abs = if cfg!(windows) { "C:/tmp/t" } else { "/tmp/t" }; assert_eq!( target_debug_dir(root, Some(abs)), Path::new(abs).join("debug") Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:1766: let in_production = "fn run() { Broker::bind(&s); }\n\nmod tests {\n assert!(true);\n}\n"; let neither = "fn run() {}\n\nmod tests {\n assert!(true);\n}\n"; assert!(binds_real_broker_in_tests(in_tests)); - assert!(!binds_real_broker_in_tests(in_production), "production bind is not a heavy unit"); + assert!( + !binds_real_broker_in_tests(in_production), + "production bind is not a heavy unit" + ); assert!(!binds_real_broker_in_tests(neither)); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:1780: filter = 'package(spt-daemon) & kind(lib) & test(/^(applyhost|livehost|pump)::tests::/)'\n\ test-group = 'heavy-broker-pty'\n"; for module in ["applyhost", "livehost", "pump"] { - assert!(filter_classifies(cfg, module), "{module} is named in the group"); + assert!( + filter_classifies(cfg, module), + "{module} is named in the group" + ); } - assert!(!filter_classifies(cfg, "wansend"), "a module absent from every filter is unclassified"); + assert!( + !filter_classifies(cfg, "wansend"), + "a module absent from every filter is unclassified" + ); } // [unit->REQ-HEAVY-UNIT-CLASSIFICATION] a filter that groups by BINARY (the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:1790: // lib module — those cover `kind(test)` binaries, a different escape. #[test] fn a_by_binary_filter_does_not_classify_a_lib_module() { - let cfg = "filter = 'package(spt-daemon) & kind(test) & binary(/^(attach|digest|pump)$/)'\n"; - assert!(!filter_classifies(cfg, "pump"), "binary(...) is not a ::tests classification"); + let cfg = + "filter = 'package(spt-daemon) & kind(test) & binary(/^(attach|digest|pump)$/)'\n"; + assert!( + !filter_classifies(cfg, "pump"), + "binary(...) is not a ::tests classification" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:1823: fn an_unmirrored_phase_a_override_is_reported() { let cfg = format!("{UNIT_OVERRIDE}\n[profile.ci-windows]\ntest-threads = 8\n"); let missing = phase_a_overrides_missing_from_ci_windows(&cfg); - assert_eq!(missing.len(), 1, "the kind(bin) unit override is unmirrored"); + assert_eq!( + missing.len(), + 1, + "the kind(bin) unit override is unmirrored" + ); assert!(missing[0].contains("wansend")); } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\xtask\src\main.rs:1860: fn the_checked_in_config_is_in_parity() { let cfg = include_str!("../../../.config/nextest.toml"); let missing = phase_a_overrides_missing_from_ci_windows(cfg); - assert!(missing.is_empty(), "unmirrored Phase-A overrides: {missing:?}"); + assert!( + missing.is_empty(), + "unmirrored Phase-A overrides: {missing:?}" + ); } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:414: /// …and the CLI capability: where `spt` is and which home it must speak to, so /// `spt send` from a supervised service is a declared capability rather than a /// property of whatever `PATH` and profile the daemon happened to inherit. -fn service_env_at( - home: &Path, - option: &str, - service_dir: &Path, -) -> Vec<(String, String)> { +fn service_env_at(home: &Path, option: &str, service_dir: &Path) -> Vec<(String, String)> { let mut env = vec![ (ENV_SERVICE_OPTION.to_string(), option.to_string()), ( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:425: ENV_SERVICE_DIR.to_string(), service_dir.display().to_string(), ), - ( - ENV_SERVICE_SPT_HOME.to_string(), - home.display().to_string(), - ), + (ENV_SERVICE_SPT_HOME.to_string(), home.display().to_string()), ]; // Best-effort by necessity: `current_exe` can fail (a deleted or unreadable // image). An ABSENT var is the honest answer there — an adapter can then say Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:435: // so. A var pointing at a guess would make every downstream failure look like // the adapter's. if let Ok(exe) = std::env::current_exe() { - env.push(( - ENV_SERVICE_SPT_BIN.to_string(), - exe.display().to_string(), - )); + env.push((ENV_SERVICE_SPT_BIN.to_string(), exe.display().to_string())); } env } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:482: ) -> Result, String> { let keys = std::collections::BTreeMap::from([ ("adapter_name".to_string(), adapter_name.to_string()), - ( - "adapter_dir".to_string(), - install_dir.display().to_string(), - ), + ("adapter_dir".to_string(), install_dir.display().to_string()), ]); // [impl->REQ-HAZARD-TEMPLATE-ARGV-FILL] tokenize-template-then-fill-each: a // multi-word/quote/semicolon {key} value is exactly one argv element. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:615: /// previous instance is PROVEN gone (or provably never was): an unresolved /// sweep blocks the spawn rather than risking two live instances. pub fn clear_to_spawn(&self) -> bool { - matches!(self, Self::NoRecord | Self::AlreadyDead | Self::Killed | Self::NotOurs(_)) + matches!( + self, + Self::NoRecord | Self::AlreadyDead | Self::Killed | Self::NotOurs(_) + ) } } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:776: // Each run gets a clean sheet: a fault must be explained by THIS run's // output, never by a previous one's still sitting in the file. reclaim_capture(&capture); - let mut child = - match crate::daemon::detached_no_inherit_env( - program, - args, - &env, - SERVICE_ENV_SCRUB, - Some(&capture), - ) { - Ok(c) => c, - Err(e) => { - let e = format!("spawn {program}: {e}"); - eprintln!("SERVICE_STARTUP_FAULT:{option}: {e}"); - return Some(StandDown { - latch: Latch::StartupFault, - detail: Some(e), - }); - } - }; + let mut child = match crate::daemon::detached_no_inherit_env( + program, + args, + &env, + SERVICE_ENV_SCRUB, + Some(&capture), + ) { + Ok(c) => c, + Err(e) => { + let e = format!("spawn {program}: {e}"); + eprintln!("SERVICE_STARTUP_FAULT:{option}: {e}"); + return Some(StandDown { + latch: Latch::StartupFault, + detail: Some(e), + }); + } + }; // Park the kill handle BEFORE the wait: a daemon that dies mid-run must // leave its successor something path-verifiable to reap. let image = spt_store::proc::exe_path(child.pid()); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1037: /// The latch currently suppressing this option, [`Latch::None`] if none. // [impl->REQ-RESIDENT-SERVICE] pub fn latch(&self, option: &str) -> Latch { - self.stand_down(option) - .map(|s| s.latch) - .unwrap_or_default() + self.stand_down(option).map(|s| s.latch).unwrap_or_default() } /// The whole stand-down record — the latch AND the evidence for it. This is Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1083: pub fn is_held(&self, option: &str) -> bool { let key = spt_store::perch::encode_adapter_option(option); let map = self.holds.lock().unwrap_or_else(|p| p.into_inner()); - map.get(&key) - .is_some_and(|f| f.load(Ordering::SeqCst)) + map.get(&key).is_some_and(|f| f.load(Ordering::SeqCst)) } /// Engage the hold. Step 1 of [`quiesce_order`], and it must land BEFORE the Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1299: // Resolve through the OPTION seam even for a bare name, so this path is // option-general by construction rather than adapter-only with an // option-shaped signature bolted on later. - let Ok(manifest) = spt_runtime::registry::resolve_option_in(registered, adapters_dir, &option) + let Ok(manifest) = + spt_runtime::registry::resolve_option_in(registered, adapters_dir, &option) else { continue; // unresolvable manifest: not a service question }; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:1328: // and the operator asking "why will my service not start" would get the // fault's name and nothing else. let mut detail = match decision.outcome { - ServiceOutcome::StartupFault | ServiceOutcome::Latched => { - stood.and_then(|s| s.detail) - } + ServiceOutcome::StartupFault | ServiceOutcome::Latched => stood.and_then(|s| s.detail), _ => None, }; let outcome = match decision.outcome { Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2299: }; std::fs::write(dir.join(shipped), b"").unwrap(); - let tokens = fill_service_command("cc", dir, &svc("svcbin --serve {adapter_name}")).unwrap(); + let tokens = + fill_service_command("cc", dir, &svc("svcbin --serve {adapter_name}")).unwrap(); assert_eq!( tokens[0], dir.join(shipped).display().to_string(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2339: let home = Path::new("/spt-home"); let a_dir = spt_store::perch::resolve_service_dir_in(home, "cc:dev"); let b_dir = spt_store::perch::resolve_service_dir_in(home, "cc_dev"); - assert_ne!(a_dir, b_dir, "the collision-adversarial pair must stay apart"); + assert_ne!( + a_dir, b_dir, + "the collision-adversarial pair must stay apart" + ); let env = service_env_at(home, "cc:dev", &a_dir); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2487: let tmp = tempfile::tempdir().unwrap(); let tokens: Vec = long_running().split(' ').map(String::from).collect(); let (program, args) = tokens.split_first().unwrap(); - let child = - crate::daemon::detached_no_inherit_env(program, args, &[], &[], None).expect("spawn orphan"); + let child = crate::daemon::detached_no_inherit_env(program, args, &[], &[], None) + .expect("spawn orphan"); let pid = child.pid(); // Park exactly what a supervisor parks, then FORGET the handle — this is // a dead daemon's orphan, which nobody holds a handle to. Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2495: let image = spt_store::proc::exe_path(pid); - assert!(image.is_some(), "the image oracle must answer for our own child"); + assert!( + image.is_some(), + "the image oracle must answer for our own child" + ); park_identity(tmp.path(), pid, image.as_deref()); drop(child); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2500: - assert_eq!(kill_orphan_service_at(tmp.path(), "cc"), OrphanSweep::Killed); + assert_eq!( + kill_orphan_service_at(tmp.path(), "cc"), + OrphanSweep::Killed + ); assert!( !spt_store::proc::is_process_alive(pid), "Killed is only reported when the post-kill read says so" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2511: #[test] fn empty_and_dead_orphan_records_read_apart() { let tmp = tempfile::tempdir().unwrap(); - assert_eq!(kill_orphan_service_at(tmp.path(), "cc"), OrphanSweep::NoRecord); + assert_eq!( + kill_orphan_service_at(tmp.path(), "cc"), + OrphanSweep::NoRecord + ); park_identity(tmp.path(), 0, None); assert_eq!( kill_orphan_service_at(tmp.path(), "cc"), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2679: }) }; assert!( - wait_until(|| read_parked_identity(&dir).is_some_and(|(pid, _)| { - pid != 0 && spt_store::proc::is_process_alive(pid) - })), + wait_until(|| read_parked_identity(&dir) + .is_some_and(|(pid, _)| { pid != 0 && spt_store::proc::is_process_alive(pid) })), "the supervised child never came up" ); let pid = read_parked_identity(&dir).unwrap().0; Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2900: let set = ServiceSet::new(); let params = ServiceParams::default(); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); - assert_eq!(out.len(), 1, "one candidate per registered adapter: {out:?}"); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); + assert_eq!( + out.len(), + 1, + "one candidate per registered adapter: {out:?}" + ); assert_eq!(out[0].option, "a", "the RAW option is what is reported"); assert_eq!(out[0].outcome, ServiceOutcome::Started); - assert_eq!(out[0].detail, None, "a plain Started invents no reassurance"); + assert_eq!( + out[0].detail, None, + "a plain Started invents no reassurance" + ); assert!(set.contains("a")); let dir = spt_store::perch::resolve_service_dir("a"); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2914: ); let first = read_parked_identity(&dir).expect("parked").0; - let again = - reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let again = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!(again[0].outcome, ServiceOutcome::AlreadyRunning); assert_eq!(set.len(), 1, "one supervisor per option"); assert_eq!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2945: let set = ServiceSet::new(); let params = ServiceParams::default(); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::BindDeferred); assert!( set.is_empty(), Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2952: "a deferred service is reported, never supervised" ); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Bind, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Bind, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::Started); assert!(set.contains("a")); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2982: let set = ServiceSet::new(); let params = fast_latch_params(); - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::Started); assert!( Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:2997: ); // A NON-clearing opportunity: report the suppression, raise nothing. - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Bind, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Bind, + None, + ¶ms, + ); assert_eq!(out[0].outcome, ServiceOutcome::StartupFault); assert_eq!( out[0].detail, None, Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:3263: assert!(!set.contains("a")); // THE ASSERTION: a clearing opportunity does not start a held option. - let out = reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + let out = reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert_eq!( out.iter().map(|o| o.outcome).collect::>(), [ServiceOutcome::Held], Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:3749: )]; let set = ServiceSet::new(); let params = fast_latch_params(); - reconcile_once(&adapters, ®istered, &set, Opportunity::Boot, None, ¶ms); + reconcile_once( + &adapters, + ®istered, + &set, + Opportunity::Boot, + None, + ¶ms, + ); assert!( wait_until(|| set.latch("a") == Latch::StartupFault), "the fixture never latched" Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\src\servicehost.rs:3810: crate::test_home::with_home(|home| { let (adapters, install) = sweep_dirs(home); let registered = vec![ - reg("a", &install, true, Some((long_running(), ServiceStart::Boot))), - reg("b", &install, false, Some((long_running(), ServiceStart::Bind))), + reg( + "a", + &install, + true, + Some((long_running(), ServiceStart::Boot)), + ), + reg( + "b", + &install, + false, + Some((long_running(), ServiceStart::Bind)), + ), reg("c", &install, true, None), ]; let set = ServiceSet::new(); Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-daemon\tests\daemon_e2e.rs:102: } } - /// The cross-OS echo child: reads stdin, writes each line back to stdout. fn echo_req() -> SpawnReq { #[cfg(unix)] Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\daemon_inhibit.rs:166: assert!(stop_inhibited_at(home.path())); clear_stop_inhibit_at(home.path()).unwrap(); - assert!( - !stop_inhibited_at(home.path()), - "the intent verb clears it" - ); + assert!(!stop_inhibited_at(home.path()), "the intent verb clears it"); clear_stop_inhibit_at(home.path()).unwrap(); // idempotent } Diff in \\?\C:\Users\decid\Documents\projects\spt-core\.worktrees\probe-cap-count-not-clock\crates\spt-store\src\daemon_inhibit.rs:222: ); drop(held); t.join().unwrap(); - assert!(entered.load(Ordering::SeqCst), "and it proceeds once released"); + assert!( + entered.load(Ordering::SeqCst), + "and it proceeds once released" + ); } } [raw output: artifact://170]