Files
javis_bot/tests/test_config_db_path.py
javis-bot 5c510bb602 feat(app): start Strata from the data folder and point the brain at it
M5 step 4, second part. The services start the LLM first: the installed
Strata with the M0 kit's model and normal placement (models in
models/llm, parallel 1, or 2 when a chat channel answers every message,
pictures off, --restart), wait until /v1/models lists the model, and stop
it last. The first start downloads the model; the dashboard shows
Strata's last line and percentage, and stop also cancels a start (the
server is cleared). llm.url uses a server the app does not start.

On every start the app writes config/brain.json (Strata's /v1, the
listed model id, memory/jarvis.db) and hands it to the worker as
JARVIS_CONFIG_PATH. Loading a config with its own db_path no longer
creates ~/.local/share/jarvis.

service_start/service_restart run in the background. Settings gain
llm.context and llm.port (model screen) and llm.url (file only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:45:38 +09:00

29 lines
985 B
Python

"""A config that names its own database writes nothing to the home folder.
The v2 app gives the brain a config (``JARVIS_CONFIG_PATH``) whose ``db_path`` is inside the app's
data folder (app/src/admin.spec.md, "LLM"); loading it must not create the default
``~/.local/share/jarvis`` folder as a side effect.
"""
import json
from jarvis.config import load_settings
def test_an_own_db_path_leaves_the_home_folder_alone(tmp_path, monkeypatch):
home = tmp_path / "home"
home.mkdir()
monkeypatch.setenv("HOME", str(home))
monkeypatch.setenv("USERPROFILE", str(home))
data = tmp_path / "data"
cfg = data / "config" / "brain.json"
cfg.parent.mkdir(parents=True)
db = data / "memory" / "jarvis.db"
cfg.write_text(json.dumps({"db_path": str(db), "_config_version": 1}), encoding="utf-8")
monkeypatch.setenv("JARVIS_CONFIG_PATH", str(cfg))
settings = load_settings()
assert settings.db_path == str(db)
assert list(home.iterdir()) == []