diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e209015..86eb5b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,8 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false + - run: cargo fmt --check + - run: cargo clippy --locked --all-targets -- -D warnings - run: cargo build --release --locked --target x86_64-pc-windows-msvc - run: python scripts/archive.py x86_64-pc-windows-msvc - shell: pwsh diff --git a/src/agent/tests.rs b/src/agent/tests.rs index 8a67e1d..09d4d4c 100644 --- a/src/agent/tests.rs +++ b/src/agent/tests.rs @@ -522,8 +522,11 @@ fn a_separate_writer_lock_refuses_without_replacement_and_retry_converges() { let lock_path = path.parent().unwrap().join(".proofline-agent-install.lock"); let entered = Arc::new(Barrier::new(2)); let release = Arc::new(Barrier::new(2)); + #[cfg(unix)] + let thread_lock_path = lock_path.clone(); + #[cfg(not(unix))] + let thread_lock_path = lock_path; let worker = { - let lock_path = lock_path.clone(); let entered = Arc::clone(&entered); let release = Arc::clone(&release); std::thread::spawn(move || { @@ -531,7 +534,7 @@ fn a_separate_writer_lock_refuses_without_replacement_and_retry_converges() { .read(true) .write(true) .create_new(true) - .open(lock_path) + .open(&thread_lock_path) .unwrap(); lease.try_lock().unwrap(); entered.wait(); @@ -740,6 +743,10 @@ fn invalid_duplicate_oversized_and_readonly_documents_stay_private_and_intact() #[cfg(unix)] fs::set_permissions(&path, fs::Permissions::from_mode(0o600)).unwrap(); #[cfg(not(unix))] + #[expect( + clippy::permissions_set_readonly_false, + reason = "Windows has no Unix mode bits; clearing readonly is required before removing the file" + )] { let mut permissions = fs::metadata(&path).unwrap().permissions(); permissions.set_readonly(false); diff --git a/tests/agent_install.rs b/tests/agent_install.rs index e8a7082..f69754a 100644 --- a/tests/agent_install.rs +++ b/tests/agent_install.rs @@ -74,7 +74,12 @@ fn unattended_registration_preserves_settings_and_uses_the_installed_binary() { assert_eq!(config, serde_json::from_str::(&original).unwrap()); server }; - assert_eq!(server["command"], executable.to_str().unwrap()); + assert_eq!( + Path::new(server["command"].as_str().unwrap()) + .canonicalize() + .unwrap(), + executable + ); assert_eq!( server["args"], json!(["--base-url", "https://proofline.sh", "mcp"]) diff --git a/tests/local_patch.rs b/tests/local_patch.rs index 6da45f8..63b143f 100644 --- a/tests/local_patch.rs +++ b/tests/local_patch.rs @@ -561,7 +561,16 @@ async fn added_context_deleted_and_quoted_content_refuses_before_http() { let base = format!("first\n{private}\nthird\nfourth\n"); let context = format!("first\n{private}\nthird\nchanged\n"); let added = format!("first\n{github}\n"); - let quoted = "src/clé\t\"quoted\".txt"; + #[cfg(unix)] + let (quoted, quoted_diagnostic) = ( + "src/clé\t\"quoted\".txt", + "\"src/clé\\t\\\"quoted\\\".txt\":2 (new line)", + ); + #[cfg(not(unix))] + let (quoted, quoted_diagnostic) = ( + "src/clé 'quoted'.txt", + "\"src/clé 'quoted'.txt\":2 (new line)", + ); for (path, before, after, diagnostic, secret) in [ ( "new.txt", @@ -588,7 +597,7 @@ async fn added_context_deleted_and_quoted_content_refuses_before_http() { quoted, None, added.as_str(), - "\"src/clé\\t\\\"quoted\\\".txt\":2 (new line)", + quoted_diagnostic, github.as_str(), ), ] { diff --git a/tests/mcp.rs b/tests/mcp.rs index d6c2669..97afb36 100644 --- a/tests/mcp.rs +++ b/tests/mcp.rs @@ -310,7 +310,8 @@ struct Finished { impl Bridge { fn start(origin: &str, organization: &str) -> Self { - let mut child = Command::new(env!("CARGO_BIN_EXE_proofline")) + let mut command = Command::new(env!("CARGO_BIN_EXE_proofline")); + command .env_clear() .env("PROOFLINE_TOKEN", TOKEN) .env("PROOFLINE_ORGANIZATION_ID", organization) @@ -320,9 +321,11 @@ impl Bridge { .stdin(Stdio::piped()) .stdout(Stdio::piped()) .stderr(Stdio::piped()) - .kill_on_drop(true) - .spawn() - .unwrap(); + .kill_on_drop(true); + if let Some(system_root) = std::env::var_os("SYSTEMROOT") { + command.env("SYSTEMROOT", system_root); + } + let mut child = command.spawn().unwrap(); Self { input: child.stdin.take(), output: child.stdout.take().map(BufReader::new),