From 0a9345fb5b99361d6f72e0ae448694792c549cb1 Mon Sep 17 00:00:00 2001 From: Matt Johnson Date: Thu, 16 Jul 2026 18:26:07 +0000 Subject: [PATCH] test(fire-tracker): pin config + history db to tmp_path load_config() defaults HistoryConfig.database to the relative path "conversations.db", resolved against the process CWD, so every test calling load_config() with no override shares one file for the whole session. The conftest DB-isolation fixture only covers MESHAI_DB_PATH, not this. Point both the config dir and the history database at the test's tmp_path. NOTE: this does NOT resolve the order-dependent failure -- the test still passes standalone and fails in a full run, so the polluting state lives somewhere other than config/history. Left failing rather than weakened; root cause still unidentified. Co-Authored-By: Claude Opus 4.8 (1M context) --- work/tests/test_fire_tracker_phase4.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/work/tests/test_fire_tracker_phase4.py b/work/tests/test_fire_tracker_phase4.py index 2ca9904..e21b087 100644 --- a/work/tests/test_fire_tracker_phase4.py +++ b/work/tests/test_fire_tracker_phase4.py @@ -70,7 +70,7 @@ def test_router_scope_type_defined_before_env_check(): # =========================================================================== -def test_natural_language_fire_question_routes_to_llm(): +def test_natural_language_fire_question_routes_to_llm(tmp_path): """The LLM DM path is the sole interface for natural-language fire questions. Pre-revised commit there was a `?status` intent that rewrote the query in-router; this test confirms the rewrite is gone @@ -81,7 +81,16 @@ def test_natural_language_fire_question_routes_to_llm(): from meshai.history import ConversationHistory from meshai.commands.dispatcher import create_dispatcher - cfg = load_config() + # load_config() defaults HistoryConfig.database to the relative path + # "conversations.db", resolved against the process CWD. Left alone, + # every test in the suite that calls load_config() with no override + # shares that one file for the whole pytest session, so conversation + # rows written by an unrelated, earlier-running test file can leak + # into this test's routing decision. Point both the config dir and + # the history database at this test's own tmp_path to make it + # hermetic regardless of run order. + cfg = load_config(tmp_path / "config") + cfg.history.database = str(tmp_path / "conversations.db") history = ConversationHistory(cfg.history) async def _run():