Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

test(ui-api): isolate VIBE_REMOTE_HOME so install tests can't poison real config

cyh8005e9ea0fba
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 000000000..c2e88c0d3
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,23 @@
+"""Shared pytest fixtures for the Vibe Remote test suite.
+
+Per AGENTS.md ("Tests and probes must never mutate the current local
+environment or live user state"), every test runs against an isolated
+``VIBE_REMOTE_HOME`` so config writes, state files, and runtime markers can
+never leak into the developer's real ``~/.vibe_remote/`` directory.
+
+Historically a handful of install / upgrade tests mocked
+``resolve_cli_path`` to return fixture paths like
+``/Users/test/.nvm/.../codex`` but did not isolate the config directory.
+The post-install bookkeeping in ``vibe.api._run_install_command`` then
+called ``load_config()`` / ``cfg.save()`` against the real config.json and
+persisted the fixture path, surfacing in the UI after the next restart.
+"""
+
+from __future__ import annotations
+
+import pytest
+
+
[email protected](autouse=True)
+def _isolate_vibe_remote_home(tmp_path, monkeypatch):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index 752e35157..c31959851 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -161,7 +161,9 @@ def test_detect_cli_finds_codex_in_npm_global_prefix(monkeypatch, tmp_path):
assert result["path"] == str(codex_path)
-def test_install_agent_returns_resolved_path(monkeypatch):
+def test_install_agent_returns_resolved_path(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
+
class CompletedProcess:
returncode = 0
stdout = "installed"
@@ -181,7 +183,9 @@ def test_install_agent_returns_resolved_path(monkeypatch):
assert result["path"] == "/Users/test/.opencode/bin/opencode"
-def test_install_codex_uses_resolved_npm(monkeypatch):
+def test_install_codex_uses_resolved_npm(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
+
calls = []
class CompletedProcess:
@@ -227,6 +231,8 @@ def test_discord_list_channels_rejects_empty_guild_id(monkeypatch):
def test_install_codex_detects_binary_via_npm_prefix(monkeypatch, tmp_path):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / "vibe_remote_home"))
+
npm_path = tmp_path / "node" / "bin" / "npm"
npm_path.parent.mkdir(parents=True, exist_ok=True)
npm_path.write_text("#!/bin/sh\n")