Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

test(agentic-ide): pin the one path comparison that differs between systems

Ruben Lütke30a8de66daf8
diff --git a/tests/unit/agentic_ide/test_agent_sessions.py b/tests/unit/agentic_ide/test_agent_sessions.py
index 0caf7b329f..c3855b35b3 100644
--- a/tests/unit/agentic_ide/test_agent_sessions.py
+++ b/tests/unit/agentic_ide/test_agent_sessions.py
@@ -8,6 +8,7 @@ machine in any timezone, which is where the interesting failure lives.
from __future__ import annotations
import json
+import os
from datetime import datetime
from pathlib import Path
@@ -280,6 +281,54 @@ def test_claude_needs_no_discovery(tmp_path: Path) -> None:
assert sessions.discover("claude", str(tmp_path), 0.0) is None
+# ------------------------------------------------------- cross-platform paths
+def test_a_folder_matches_itself_however_it_was_spelled(tmp_path: Path) -> None:
+ """The one line in this module whose behaviour differs between systems.
+
+ A pane's folder comes from the user's own selection and the CLI's record
+ comes from its process, so the two can be spelled differently: forward
+ slashes against backslashes, a trailing separator, a relative segment. On
+ Windows the drive letter's case can differ too, and there a mismatch would
+ silently hide a pane's own conversation from it.
+ """
+ from jarvis.agentic_ide.agent_sessions import _same_folder
+
+ native = str(tmp_path)
+ assert _same_folder(native, native)
+ assert _same_folder(native, native.replace("\\", "/"))
+ assert _same_folder(native, native + os.sep)
+ assert _same_folder(native, str(tmp_path / "sub" / ".."))
+ assert not _same_folder(native, str(tmp_path / "elsewhere"))
+
+
+def test_case_differences_only_matter_where_the_system_says_so(
+ tmp_path: Path,
+) -> None:
+ """Windows treats paths case-insensitively; POSIX does not. Follow the host."""
+ from jarvis.agentic_ide.agent_sessions import _same_folder
+
+ swapped = str(tmp_path).upper()
+ expected = os.path.normcase(swapped) == os.path.normcase(str(tmp_path))
+ assert _same_folder(str(tmp_path), swapped) is expected
+
+
+def test_each_cli_home_follows_its_own_environment_variable(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """A managed install can move either history; both must be followed."""
+ from jarvis.agentic_ide.agent_sessions import _claude_home, _codex_home
+
+ monkeypatch.setenv("CLAUDE_CONFIG_DIR", str(tmp_path / "claude-elsewhere"))
+ monkeypatch.setenv("CODEX_HOME", str(tmp_path / "codex-elsewhere"))
+ assert _claude_home() == tmp_path / "claude-elsewhere"
+ assert _codex_home() == tmp_path / "codex-elsewhere"
+
+ monkeypatch.delenv("CLAUDE_CONFIG_DIR")
+ monkeypatch.delenv("CODEX_HOME")
+ assert _claude_home() == Path.home() / ".claude"
+ assert _codex_home() == Path.home() / ".codex"
+
+
# ------------------------------------------------------------------ storage
def test_handle_round_trips_through_a_dict() -> None:
handle = sessions.ResumeHandle(kind="claude_session", id="u", captured_at=3.5)