An agent-managed museum exhibit, built in Rust with Gajae-Code / LazyCodex — developed and maintained with no human intervention.
Rust
test(runtime): isolate session and git metadata checks
YeonGyu-Kim27acfe101446
diff --git a/rust/crates/runtime/src/session_control.rs b/rust/crates/runtime/src/session_control.rsindex 90120eff..0cd68fe1 100644--- a/rust/crates/runtime/src/session_control.rs+++ b/rust/crates/runtime/src/session_control.rs@@ -828,10 +828,40 @@ mod tests {use std::fs;use std::path::{Path, PathBuf};use std::sync::atomic::{AtomicU64, Ordering};+ use std::sync::{Mutex, OnceLock};use std::time::{SystemTime, UNIX_EPOCH};static TEMP_COUNTER: AtomicU64 = AtomicU64::new(0);+ fn env_lock() -> std::sync::MutexGuard<'static, ()> {+ static LOCK: OnceLock<Mutex<()>> = OnceLock::new();+ LOCK.get_or_init(|| Mutex::new(()))+ .lock()+ .expect("env lock")+ }++ struct EnvVarGuard {+ key: &'static str,+ previous: Option<std::ffi::OsString>,+ }++ impl EnvVarGuard {+ fn set(key: &'static str, value: &Path) -> Self {+ let previous = std::env::var_os(key);+ std::env::set_var(key, value);+ Self { key, previous }+ }+ }++ impl Drop for EnvVarGuard {+ fn drop(&mut self) {+ match &self.previous {+ Some(value) => std::env::set_var(self.key, value),+ None => std::env::remove_var(self.key),+ }+ }+ }+fn temp_dir() -> PathBuf {let nanos = SystemTime::now().duration_since(UNIX_EPOCH)@@ -1290,8 +1320,11 @@ mod tests {#[test]fn latest_session_returns_all_empty_error_when_sessions_exist_but_have_no_messages() {// given — create sessions with 0 messages (empty)+ let _env_guard = env_lock();let base = temp_dir();fs::create_dir_all(&base).expect("base dir should exist");+ let isolated_config_home = base.join("config-home");+ let _claw_config_home = EnvVarGuard::set("CLAW_CONFIG_HOME", &isolated_config_home);let store = SessionStore::from_cwd(&base).expect("store should build");let empty_handle = store.create_handle("empty-session");diff --git a/rust/crates/runtime/src/worker_boot.rs b/rust/crates/runtime/src/worker_boot.rsindex c1193db6..6b4fbfbf 100644--- a/rust/crates/runtime/src/worker_boot.rs+++ b/rust/crates/runtime/src/worker_boot.rs@@ -1644,16 +1644,13 @@ mod tests {let tmp = tempfile::tempdir().expect("tempdir");let worktree = tmp.path().join("worktree");- let git_dir = tmp.path().join("external-gitdir");fs::create_dir_all(&worktree).expect("worktree dir");- fs::create_dir_all(git_dir.join("objects")).expect("objects dir");- fs::create_dir_all(git_dir.join("refs/heads")).expect("refs dir");- fs::write(git_dir.join("HEAD"), "ref: refs/heads/main\n").expect("HEAD");- fs::write(- worktree.join(".git"),- format!("gitdir: {}\n", git_dir.display()),- )- .expect(".git file");+ Command::new("git")+ .arg("init")+ .current_dir(&worktree)+ .output()+ .expect("git init should run");+ let git_dir = worktree.join(".git");let original_permissions = fs::metadata(&git_dir).expect("gitdir metadata")