Skip to content

Commit 69447bd

Browse files
Merge branch 'codex/hosted-review-phase-1' into codex/hosted-review-phase-2
Signed-off-by: Timothy Wayne Gregg <Timothy.Gregg@complete.tech> # Conflicts: # src-rust/crates/commands/src/lib.rs # src-rust/crates/tui/src/app.rs
2 parents 686ac66 + 61479ac commit 69447bd

4 files changed

Lines changed: 95 additions & 18 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Rust CI
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'src-rust/**'
7+
- '.github/workflows/rust-ci.yml'
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: rust-ci-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
20+
jobs:
21+
rust:
22+
name: Format, lint, and test
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 45
25+
steps:
26+
- uses: actions/checkout@v5
27+
with:
28+
persist-credentials: false
29+
30+
- name: Install Rust toolchain
31+
uses: dtolnay/rust-toolchain@stable
32+
with:
33+
components: rustfmt, clippy
34+
35+
- name: Install system dependencies
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libasound2-dev pkg-config
39+
40+
- name: Cache cargo registry and build output
41+
uses: actions/cache@v5
42+
with:
43+
path: |
44+
~/.cargo/registry
45+
~/.cargo/git
46+
src-rust/target
47+
key: rust-ci-cargo-${{ runner.os }}-${{ hashFiles('src-rust/Cargo.lock') }}
48+
restore-keys: rust-ci-cargo-${{ runner.os }}-
49+
50+
- name: Check formatting
51+
working-directory: src-rust
52+
run: cargo fmt --all -- --check
53+
54+
- name: Check workspace
55+
working-directory: src-rust
56+
run: cargo check --workspace --locked
57+
58+
- name: Run Clippy
59+
working-directory: src-rust
60+
run: cargo clippy --workspace --all-targets --locked -- -D warnings
61+
62+
- name: Run tests
63+
working-directory: src-rust
64+
run: cargo test --workspace --locked --quiet

src-rust/crates/core/src/claudemd.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ mod tests {
425425
.unwrap_or_else(|err| err.into_inner());
426426
let original_test_home = std::env::var("COVEN_CODE_TEST_HOME").ok();
427427
let original_home = std::env::var("HOME").ok();
428+
let original_userprofile = std::env::var("USERPROFILE").ok();
428429
std::env::set_var("COVEN_CODE_TEST_HOME", home.path());
429430
std::env::set_var("HOME", home.path());
431+
std::env::set_var("USERPROFILE", home.path());
430432

431433
let files =
432434
load_all_memory_files_with_options(project.path(), &MemoryLoadOptions::hosted_review());
@@ -439,6 +441,10 @@ mod tests {
439441
Some(value) => std::env::set_var("HOME", value),
440442
None => std::env::remove_var("HOME"),
441443
}
444+
match original_userprofile {
445+
Some(value) => std::env::set_var("USERPROFILE", value),
446+
None => std::env::remove_var("USERPROFILE"),
447+
}
442448

443449
assert!(files.iter().all(|file| file.scope != MemoryScope::User));
444450
assert!(files.iter().any(|file| {
@@ -506,8 +512,10 @@ mod tests {
506512
.unwrap_or_else(|err| err.into_inner());
507513
let original_test_home = std::env::var("COVEN_CODE_TEST_HOME").ok();
508514
let original_home = std::env::var("HOME").ok();
515+
let original_userprofile = std::env::var("USERPROFILE").ok();
509516
std::env::set_var("COVEN_CODE_TEST_HOME", home.path());
510517
std::env::set_var("HOME", home.path());
518+
std::env::set_var("USERPROFILE", home.path());
511519

512520
let files = load_all_memory_files_with_options(project.path(), &MemoryLoadOptions::local());
513521

@@ -519,6 +527,10 @@ mod tests {
519527
Some(value) => std::env::set_var("HOME", value),
520528
None => std::env::remove_var("HOME"),
521529
}
530+
match original_userprofile {
531+
Some(value) => std::env::set_var("USERPROFILE", value),
532+
None => std::env::remove_var("USERPROFILE"),
533+
}
522534

523535
assert!(files
524536
.iter()

src-rust/crates/tui/src/app.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7420,22 +7420,22 @@ role = "Research"
74207420

74217421
#[test]
74227422
fn windows_system_root_prefers_absolute_system_root() {
7423-
let root = windows_system_root_from_env(
7424-
Some(std::ffi::OsString::from(r"C:\Windows")),
7425-
Some(std::ffi::OsString::from(r"D:\WinDir")),
7426-
);
7423+
let system_root = std::env::temp_dir().join("windows-root").into_os_string();
7424+
let windir = std::env::temp_dir().join("windir").into_os_string();
7425+
let root = windows_system_root_from_env(Some(system_root.clone()), Some(windir));
74277426

7428-
assert_eq!(root, std::ffi::OsString::from(r"C:\Windows"));
7427+
assert_eq!(root, system_root);
74297428
}
74307429

74317430
#[test]
74327431
fn windows_system_root_falls_back_to_absolute_windir() {
7432+
let windir = std::env::temp_dir().join("windir").into_os_string();
74337433
let root = windows_system_root_from_env(
74347434
Some(std::ffi::OsString::from("relative-system-root")),
7435-
Some(std::ffi::OsString::from(r"D:\WinDir")),
7435+
Some(windir.clone()),
74367436
);
74377437

7438-
assert_eq!(root, std::ffi::OsString::from(r"D:\WinDir"));
7438+
assert_eq!(root, windir);
74397439
}
74407440

74417441
#[test]

src-rust/crates/tui/src/image_paste.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,11 @@ fn try_save_linux_image(path: &PathBuf) -> bool {
306306
.args(["-selection", "clipboard", "-t", "image/png", "-o"])
307307
.output()
308308
{
309-
if out.status.success() && !out.stdout.is_empty() {
310-
if std::fs::write(path, &out.stdout).is_ok() {
311-
return true;
312-
}
309+
if out.status.success()
310+
&& !out.stdout.is_empty()
311+
&& std::fs::write(path, &out.stdout).is_ok()
312+
{
313+
return true;
313314
}
314315
}
315316
}
@@ -320,10 +321,11 @@ fn try_save_linux_image(path: &PathBuf) -> bool {
320321
.args(["--type", "image/png"])
321322
.output()
322323
{
323-
if out.status.success() && !out.stdout.is_empty() {
324-
if std::fs::write(path, &out.stdout).is_ok() {
325-
return true;
326-
}
324+
if out.status.success()
325+
&& !out.stdout.is_empty()
326+
&& std::fs::write(path, &out.stdout).is_ok()
327+
{
328+
return true;
327329
}
328330
}
329331
}
@@ -427,14 +429,13 @@ fn write_text_windows_w(text: &str) -> bool {
427429
use std::io::Write;
428430
use std::process::Stdio;
429431
// PowerShell Set-Clipboard reads from stdin via pipe
430-
let script = "[Console]::InputEncoding = [System.Text.Encoding]::UTF8; $input | Set-Clipboard"
431-
.to_string();
432+
let script = "[Console]::InputEncoding = [System.Text.Encoding]::UTF8; $input | Set-Clipboard";
432433
let powershell = match trusted_windows_powershell() {
433434
Some(path) => path,
434435
None => return false,
435436
};
436437
let mut child = match Command::new(powershell)
437-
.args(["-NoProfile", "-Command", &script])
438+
.args(["-NoProfile", "-Command", script])
438439
.stdin(Stdio::piped())
439440
.spawn()
440441
{

0 commit comments

Comments
 (0)