Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,15 @@ fn build_fixture_root(tag: &str) -> PathBuf {
r#"{"type":"user.message","data":{"content":"junk"},"id":"j1","timestamp":"2026-07-29T08:00:00.000Z","parentId":null}"#,
],
);
// Junk: draft placeholder dir.
fs::create_dir_all(root.join("pending-session:draft:1966e2f4-b455-4969-a6ed-bcbc28a59056"))
.expect("create draft junk dir");
// Junk: draft placeholder dir. The exact macOS shape uses ':', which NTFS
// cannot create (it denotes an alternate data stream), so Windows
// exercises the same not-a-plain-session-id rejection with a legal
// separator while unix keeps the literal provider shape.
#[cfg(unix)]
let draft_junk = "pending-session:draft:1966e2f4-b455-4969-a6ed-bcbc28a59056";
#[cfg(not(unix))]
let draft_junk = "pending-session-draft-1966e2f4-b455-4969-a6ed-bcbc28a59056";
fs::create_dir_all(root.join(draft_junk)).expect("create draft junk dir");
// Metadata-only dir (aborted/help invocation): plain id, no events.jsonl.
let aborted = root.join("3c3c3c3c-1234-4123-8123-123412341234");
fs::create_dir_all(&aborted).expect("create aborted dir");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;
use std::fs;
use std::path::{Path, PathBuf};
use std::time::{Duration, UNIX_EPOCH};
use std::time::Duration;

use rusqlite::Connection;

Expand Down Expand Up @@ -209,6 +209,9 @@ fn bounded_walker_does_not_follow_symlinked_files_or_directories() {
#[test]
fn bounded_walker_does_not_follow_a_symlink_from_a_reused_snapshot() {
use std::os::unix::fs::symlink;
// Only this unix-gated test needs it; a top-level import is an unused
// import under `-D warnings` on Windows.
use std::time::UNIX_EPOCH;

let root = temp_tree("bounded-reused-symlink");
let outside = temp_tree("bounded-reused-symlink-outside");
Expand Down
18 changes: 12 additions & 6 deletions src-tauri/crates/orgtrack-core/src/sources/kimi/history_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,22 +528,28 @@ fn failed_core_projection_keeps_the_record_retry_eligible() {

#[test]
fn kimi_code_home_override_stays_inside_external_history_identity() {
let home = Path::new("/isolated/history-home");
assert_eq!(kimi_code_home_for(home, None), home.join(".kimi-code"));
// Absolute fixtures must be platform-absolute: a unix-rooted "/x" is not
// absolute on Windows (`is_absolute` needs a drive prefix there), which
// silently routed the inside-home case through the fallback branch.
let base = std::env::temp_dir().join("orgii-kimi-home-identity-test");
let home = base.join("history-home");
assert_eq!(kimi_code_home_for(&home, None), home.join(".kimi-code"));
assert_eq!(
kimi_code_home_for(home, Some(OsStr::new("custom-kimi"))),
kimi_code_home_for(&home, Some(OsStr::new("custom-kimi"))),
home.join("custom-kimi")
);
let inside = home.join("custom-kimi");
assert_eq!(
kimi_code_home_for(home, Some(OsStr::new("/isolated/history-home/custom-kimi"))),
kimi_code_home_for(&home, Some(inside.as_os_str())),
home.join("custom-kimi")
);
let outside = base.join("primary-user").join(".kimi-code");
assert_eq!(
kimi_code_home_for(home, Some(OsStr::new("/primary-user/.kimi-code"))),
kimi_code_home_for(&home, Some(outside.as_os_str())),
home.join(".kimi-code")
);
assert_eq!(
kimi_code_home_for(home, Some(OsStr::new("../escape"))),
kimi_code_home_for(&home, Some(OsStr::new("../escape"))),
home.join(".kimi-code")
);
}
Expand Down
Loading