style: removed unneccessary path prefixes and organized imports

This commit is contained in:
Dark-Alex-17 committed 2026-09-14 11:13:34 -06:00
1 parent c7ec4ed124
commit beca133082
3 files changed
+25 -21

No files matched your search

+15 -14
View File
@@ -5268,6 +5268,7 @@ mod tests {
use serial_test::serial;
use std::fs::{create_dir_all, remove_dir_all, write};
use std::path::PathBuf;
use std::process::Command;
use std::time::{Instant, SystemTime, UNIX_EPOCH};
use std::{env, mem};
@@ -8505,7 +8506,7 @@ mod tests {
#[test]
fn review_gauntlet_readme_states_retry_and_incomplete_contract() {
let readmes = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("assets/agents");
let readmes = Path::new(env!("CARGO_MANIFEST_DIR")).join("assets/agents");
// Windows checkouts carry CRLF; the paragraph assertion below spans line breaks.
let gauntlet = read_to_string(readmes.join("review-gauntlet/README.md"))
.unwrap()
@@ -9050,11 +9051,11 @@ mod tests {
// Scripts' load_state() prefers GRAPH_STATE_FILE over GRAPH_STATE, so an
// inherited live state file (adversary verifying this repo) must not win.
fn adversary_script_command(script: &str, state: &serde_json::Value) -> std::process::Command {
fn adversary_script_command(script: &str, state: &serde_json::Value) -> Command {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/adversary/scripts")
.join(script);
let mut cmd = std::process::Command::new("python3");
let mut cmd = Command::new("python3");
cmd.arg(&path)
.env("GRAPH_STATE", state.to_string())
.env_remove("GRAPH_STATE_FILE");
@@ -9591,7 +9592,7 @@ mod tests {
);
let alive = |pid: &str| {
std::process::Command::new("kill")
Command::new("kill")
.args(["-0", pid])
.output()
.unwrap()
@@ -10950,7 +10951,7 @@ mod tests {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/review-gauntlet/scripts")
.join(script);
let out = std::process::Command::new("python3")
let out = Command::new("python3")
.arg(&path)
.env("GRAPH_STATE", state.to_string())
.env_remove("GRAPH_STATE_FILE")
@@ -13246,7 +13247,7 @@ mod tests {
);
}
let adversary_verdict = read_to_string(
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/adversary/scripts/verdict.py"),
)
.unwrap();
@@ -13403,11 +13404,11 @@ mod tests {
eprintln!("skipping: python3 not available");
return;
}
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/review-gauntlet/scripts/build_items.py");
let state =
json!({"forced_lanes": ["code-review", "adversary"], "gauntlet_started_at": 5.0});
let out = std::process::Command::new("python3")
let out = Command::new("python3")
.arg(&path)
.env("GRAPH_STATE", state.to_string())
.env_remove("GRAPH_STATE_FILE")
@@ -13459,7 +13460,7 @@ mod tests {
eprintln!("skipping: python3 not available");
return;
}
let dir = utils::temp_file("-gauntlet-signals-", "");
let dir = temp_file("-gauntlet-signals-", "");
create_dir_all(&dir).unwrap();
let project_dir = dir.to_string_lossy().to_string();
let out = run_gauntlet_script(
@@ -13585,7 +13586,7 @@ mod tests {
fn gauntlet_retry_budget_fits_inside_graph_timeout() {
use crate::graph::NodeType;
const OTHER_STAGES_MARGIN_SECS: u64 = 1200;
let script = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
let script = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/review-gauntlet/scripts/retry_gate.py");
let source = read_to_string(&script).unwrap();
let line = source
@@ -13707,7 +13708,7 @@ mod tests {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/code-reviewer/scripts")
.join(script);
let out = std::process::Command::new("python3")
let out = Command::new("python3")
.arg(&path)
.env("GRAPH_STATE", raw_state)
.env_remove("GRAPH_STATE_FILE")
@@ -14517,7 +14518,7 @@ mod tests {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/finding-verifier/scripts")
.join(script);
let out = std::process::Command::new("python3")
let out = Command::new("python3")
.arg(&path)
.env("GRAPH_STATE", raw_state)
.env_remove("GRAPH_STATE_FILE")
@@ -14819,7 +14820,7 @@ mod tests {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/step-runner/scripts")
.join(script);
let out = std::process::Command::new("bash")
let out = Command::new("bash")
.arg(&path)
.env("GRAPH_STATE", state.to_string())
.env_remove("GRAPH_STATE_FILE")
@@ -15123,7 +15124,7 @@ mod tests {
let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("assets/agents/deep-research/scripts")
.join(script);
let out = std::process::Command::new("python3")
let out = Command::new("python3")
.arg(&path)
.env("GRAPH_STATE", raw_state)
.env_remove("GRAPH_STATE_FILE")
+7 -5
View File
@@ -346,6 +346,8 @@ fn parse_options(args: &Value) -> Result<Vec<String>> {
#[cfg(test)]
mod tests {
use super::*;
use std::fs;
use std::path::{Path, PathBuf};
#[test]
fn headless_select_returns_structured_json() {
@@ -431,9 +433,9 @@ mod tests {
concat!("escalation_timeout:", " 300"),
concat!("default:", " 5 minutes"),
];
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
let example = root.join("config.agent.example.yaml");
let example_text = std::fs::read_to_string(&example).unwrap();
let example_text = fs::read_to_string(&example).unwrap();
for needle in ["escalation_timeout: 0", "0 = wait indefinitely"] {
assert!(
example_text.contains(needle),
@@ -454,7 +456,7 @@ mod tests {
let mut hits = Vec::new();
for path in &files {
let text = String::from_utf8_lossy(&std::fs::read(path).unwrap()).into_owned();
let text = String::from_utf8_lossy(&fs::read(path).unwrap()).into_owned();
for needle in needles {
if text.contains(needle) {
hits.push(format!("{}: {needle:?}", path.display()));
@@ -468,8 +470,8 @@ mod tests {
);
}
fn collect_files(dir: &std::path::Path, out: &mut Vec<std::path::PathBuf>) {
for entry in std::fs::read_dir(dir).unwrap().flatten() {
fn collect_files(dir: &Path, out: &mut Vec<PathBuf>) {
for entry in fs::read_dir(dir).unwrap().flatten() {
let path = entry.path();
if path.is_dir() {
collect_files(&path, out);
+3 -2
View File
@@ -2281,6 +2281,7 @@ where
mod tests {
use super::*;
use std::path::PathBuf;
use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{SystemTime, UNIX_EPOCH};
struct TempDir {
@@ -2293,12 +2294,12 @@ mod tests {
// (coarse clocks hand the same tick to concurrent callers, so two
// tests would share a directory and overwrite each other's files);
// a process-wide counter makes every name distinct.
static SEQ: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
static SEQ: AtomicU64 = AtomicU64::new(0);
let nanos = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_nanos();
let seq = SEQ.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
let seq = SEQ.fetch_add(1, Ordering::Relaxed);
let unique = format!("{nanos}-{seq}");
let path = env::temp_dir().join(format!("coyote-rag-{tag}-{unique}"));
fs::create_dir_all(&path).unwrap();