From ad51d553fc5de1dc8482cb7e9951869f5f5711e1 Mon Sep 17 00:00:00 2001 From: ares <285551516+New1Direction@users.noreply.github.com> Date: Thu, 4 Jun 2026 15:48:35 -0700 Subject: [PATCH] chore: cargo fmt --all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-existing rustfmt debt on main — formatting only, no logic changes. The CI 'Check formatting' step is red on origin/main (b91bb50) and on every PR cut from it; this clears it so PRs can go green. --- crates/korg-runtime/src/execution/dag.rs | 10 +- crates/korg-runtime/src/execution/recovery.rs | 5 +- crates/korg-runtime/src/identity.rs | 6 +- crates/korg-server/src/lib.rs | 15 ++- crates/korg-tui/src/lib.rs | 94 ++++++++++++++----- src/introspect.rs | 6 +- 6 files changed, 105 insertions(+), 31 deletions(-) diff --git a/crates/korg-runtime/src/execution/dag.rs b/crates/korg-runtime/src/execution/dag.rs index c597638..f7065c4 100644 --- a/crates/korg-runtime/src/execution/dag.rs +++ b/crates/korg-runtime/src/execution/dag.rs @@ -493,7 +493,10 @@ mod tests { #[tokio::test] async fn run_command_reflects_real_exit_status() { assert!(run_command("true").await, "`true` exits 0 → success"); - assert!(!run_command("false").await, "`false` exits non-zero → failure"); + assert!( + !run_command("false").await, + "`false` exits non-zero → failure" + ); } #[tokio::test] @@ -522,7 +525,10 @@ mod tests { let key = ed25519_dalek::SigningKey::generate(&mut rand::rngs::OsRng); let mut scheduler = SpeculativeScheduler::new(dag, key); let summary = scheduler.run(None).await.unwrap(); - assert!(!summary.overall_success, "a real non-zero exit must fail the DAG"); + assert!( + !summary.overall_success, + "a real non-zero exit must fail the DAG" + ); } #[test] diff --git a/crates/korg-runtime/src/execution/recovery.rs b/crates/korg-runtime/src/execution/recovery.rs index 59d5a5e..1ea95c5 100644 --- a/crates/korg-runtime/src/execution/recovery.rs +++ b/crates/korg-runtime/src/execution/recovery.rs @@ -459,7 +459,10 @@ mod tests { // Without compiler stderr + a worktree path there is nothing real to // repair, so heal_node must report that honestly — no fake "healed". let healed = heal_node("thump test --fail", Some(tx)).await.unwrap(); - assert!(!healed, "heal_node with no error/worktree context cannot heal"); + assert!( + !healed, + "heal_node with no error/worktree context cannot heal" + ); let mut logs = Vec::new(); while let Ok(log) = rx.try_recv() { logs.push(log); diff --git a/crates/korg-runtime/src/identity.rs b/crates/korg-runtime/src/identity.rs index e38f04d..1fd9ce7 100644 --- a/crates/korg-runtime/src/identity.rs +++ b/crates/korg-runtime/src/identity.rs @@ -97,6 +97,10 @@ mod tests { load_or_create_identity_at(&path).unwrap(); assert!(path.exists(), "the key file must be created"); let mode = std::fs::metadata(&path).unwrap().permissions().mode(); - assert_eq!(mode & 0o777, 0o600, "the private key file must be mode 0o600"); + assert_eq!( + mode & 0o777, + 0o600, + "the private key file must be mode 0o600" + ); } } diff --git a/crates/korg-server/src/lib.rs b/crates/korg-server/src/lib.rs index 62eed08..3cfcb02 100644 --- a/crates/korg-server/src/lib.rs +++ b/crates/korg-server/src/lib.rs @@ -2862,14 +2862,23 @@ mod tests { // 0.0.0.0, which exposed the (mostly unauthenticated) control + telemetry // routes to the whole local network. let addr = resolve_bind_addr(None); - assert!(addr.starts_with("127.0.0.1"), "default must be loopback, got {addr}"); - assert!(!addr.starts_with("0.0.0.0"), "default must not bind all interfaces"); + assert!( + addr.starts_with("127.0.0.1"), + "default must be loopback, got {addr}" + ); + assert!( + !addr.starts_with("0.0.0.0"), + "default must not bind all interfaces" + ); } #[test] fn bind_addr_honors_explicit_override() { // Intentional network exposure stays possible, but only by explicit opt-in. - assert_eq!(resolve_bind_addr(Some("0.0.0.0:9000".into())), "0.0.0.0:9000"); + assert_eq!( + resolve_bind_addr(Some("0.0.0.0:9000".into())), + "0.0.0.0:9000" + ); } #[tokio::test] diff --git a/crates/korg-tui/src/lib.rs b/crates/korg-tui/src/lib.rs index 33d210b..72c7f83 100644 --- a/crates/korg-tui/src/lib.rs +++ b/crates/korg-tui/src/lib.rs @@ -1710,21 +1710,40 @@ async fn run_tui_event_loop( // Reset the working tree to HEAD. let terminal_tx_clone = terminal_tx.clone(); tokio::spawn(async move { - let _ = terminal_tx_clone.send("[System] Resetting working tree to HEAD...".to_string()).await; + let _ = terminal_tx_clone + .send( + "[System] Resetting working tree to HEAD..." + .to_string(), + ) + .await; let output = tokio::process::Command::new("git") .args(["read-tree", "--reset", "-u", "HEAD"]) .output() .await; match output { Ok(out) if out.status.success() => { - let _ = terminal_tx_clone.send("[System] Working tree reset to HEAD.".to_string()).await; + let _ = terminal_tx_clone + .send( + "[System] Working tree reset to HEAD." + .to_string(), + ) + .await; } Ok(out) => { let err = String::from_utf8_lossy(&out.stderr); - let _ = terminal_tx_clone.send(format!("[System] git reversion failed: {}", err.trim())).await; + let _ = terminal_tx_clone + .send(format!( + "[System] git reversion failed: {}", + err.trim() + )) + .await; } Err(e) => { - let _ = terminal_tx_clone.send(format!("[System] git reversion failed: {e}")).await; + let _ = terminal_tx_clone + .send(format!( + "[System] git reversion failed: {e}" + )) + .await; } } }); @@ -2448,21 +2467,40 @@ async fn run_tui_event_loop( let terminal_tx_clone = terminal_tx.clone(); tokio::spawn(async move { - let _ = terminal_tx_clone.send("[System] Resetting working tree to HEAD...".to_string()).await; + let _ = terminal_tx_clone + .send( + "[System] Resetting working tree to HEAD..." + .to_string(), + ) + .await; let output = tokio::process::Command::new("git") .args(["read-tree", "--reset", "-u", "HEAD"]) .output() .await; match output { Ok(out) if out.status.success() => { - let _ = terminal_tx_clone.send("[System] Working tree reset to HEAD.".to_string()).await; + let _ = terminal_tx_clone + .send( + "[System] Working tree reset to HEAD." + .to_string(), + ) + .await; } Ok(out) => { let err = String::from_utf8_lossy(&out.stderr); - let _ = terminal_tx_clone.send(format!("[System] git reversion failed: {}", err.trim())).await; + let _ = terminal_tx_clone + .send(format!( + "[System] git reversion failed: {}", + err.trim() + )) + .await; } Err(e) => { - let _ = terminal_tx_clone.send(format!("[System] git reversion failed: {e}")).await; + let _ = terminal_tx_clone + .send(format!( + "[System] git reversion failed: {e}" + )) + .await; } } }); @@ -3174,14 +3212,16 @@ fn draw_dashboard(f: &mut Frame, app: &KorgTui) { } else { let last_idx = app.workers.len() - 1; for (i, w) in app.workers.iter().enumerate() { - let branch = if i == last_idx { " └─ " } else { " ├─ " }; + let branch = if i == last_idx { + " └─ " + } else { + " ├─ " + }; let (glyph, glyph_color) = match w.state { - WorkerLifecycle::Spawning => { - ("\u{22ef}", Color::Rgb(128, 142, 162)) - } // ⋯ - WorkerLifecycle::Running => ("\u{25b8}", Color::Rgb(0, 180, 216)), // ▸ - WorkerLifecycle::Ok => ("\u{2713}", Color::Rgb(165, 222, 103)), // ✓ - WorkerLifecycle::Crashed => ("\u{2717}", Color::Rgb(247, 37, 133)), // ✗ + WorkerLifecycle::Spawning => ("\u{22ef}", Color::Rgb(128, 142, 162)), // ⋯ + WorkerLifecycle::Running => ("\u{25b8}", Color::Rgb(0, 180, 216)), // ▸ + WorkerLifecycle::Ok => ("\u{2713}", Color::Rgb(165, 222, 103)), // ✓ + WorkerLifecycle::Crashed => ("\u{2717}", Color::Rgb(247, 37, 133)), // ✗ WorkerLifecycle::TimedOut => ("\u{23f1}", Color::Rgb(255, 198, 109)), // ⏱ WorkerLifecycle::SpawnError => ("!", Color::Rgb(247, 37, 133)), }; @@ -3201,10 +3241,7 @@ fn draw_dashboard(f: &mut Frame, app: &KorgTui) { format!("{} ", w.persona), Style::default().fg(Color::Rgb(255, 255, 255)), ), - Span::styled( - format!("[{}] ", short_id), - Style::default().fg(fg_slate), - ), + Span::styled(format!("[{}] ", short_id), Style::default().fg(fg_slate)), Span::styled( format!("{}ms", w.elapsed_ms), Style::default().fg(Color::Rgb(180, 180, 180)), @@ -3278,12 +3315,16 @@ fn draw_dashboard(f: &mut Frame, app: &KorgTui) { // Derive state from the same fields TuiUpdate::Verdict writes — never claims. let goal_state = derive_goal_state(&app.current_verdict, &app.rubric_status, app.progress); - let met = app.rubric_status.iter().filter(|(_, passed)| *passed).count(); + let met = app + .rubric_status + .iter() + .filter(|(_, passed)| *passed) + .count(); let total = app.rubric_status.len(); // Pill color: only Verified earns green; a claim with failing criteria is amber. let pill_color = match goal_state { GoalState::Awaiting => Color::Rgb(100, 110, 125), // dim grey - GoalState::InProgress => Color::Rgb(0, 180, 216), // cyan + GoalState::InProgress => Color::Rgb(0, 180, 216), // cyan GoalState::ClaimedUnverified => Color::Rgb(255, 198, 109), // amber GoalState::Verified => Color::Rgb(165, 222, 103), // green }; @@ -4674,7 +4715,11 @@ mod tests { WorkerLifecycle::Crashed, 999, ); - assert_eq!(app.workers.len(), 2, "distinct node_ids create distinct rows"); + assert_eq!( + app.workers.len(), + 2, + "distinct node_ids create distinct rows" + ); // The first row stays at its latest values; the new row carries its own. let benjamin = app @@ -4857,7 +4902,10 @@ mod tests { #[test] fn test_goal_state_label_strings() { - assert_eq!(goal_state_label(&GoalState::Awaiting), "Awaiting first round"); + assert_eq!( + goal_state_label(&GoalState::Awaiting), + "Awaiting first round" + ); assert_eq!(goal_state_label(&GoalState::InProgress), "In progress"); assert_eq!( goal_state_label(&GoalState::ClaimedUnverified), diff --git a/src/introspect.rs b/src/introspect.rs index 2ce2142..11cde0f 100644 --- a/src/introspect.rs +++ b/src/introspect.rs @@ -480,7 +480,11 @@ mod tests { let codes = exit_codes(); assert_eq!(codes.get("0").map(|s| s.as_str()), Some("success")); for key in codes.keys() { - assert!(key.parse::().is_ok(), "non-numeric exit-code key: {}", key); + assert!( + key.parse::().is_ok(), + "non-numeric exit-code key: {}", + key + ); } }