Symptom
tests_py/handlers/test_consolidate.py::TestConsolidateHandler::test_empty_store_runs_clean
hangs indefinitely on any developer machine that has a populated PostgreSQL
store configured. The full suite stops at ~58% and never completes; nothing
times out, because pytest-timeout is not installed (pyproject.toml
configures timeout/timeout_method, and pytest reports both as
PytestConfigWarning: Unknown config option).
Reproduction
CORTEX_RERANKER_OFFLINE=1 python3 -m pytest \
"tests_py/handlers/test_consolidate.py::TestConsolidateHandler::test_empty_store_runs_clean" -q
# never returns
Measured 2026-07-27. Reproduces identically on main (a2f5053) and on an
unrelated feature branch, so it is not caused by any in-flight change.
Root cause — the test has no store isolation
async def test_empty_store_runs_clean(self):
from mcp_server.handlers.consolidate import handler
result = await handler()
assert result["decay"]["total_memories"] == 0
No fixture, no monkeypatch, no temp database. handler() resolves its
store through get_shared_store(settings.DB_PATH, ...), so it binds to
whatever backend the developer's environment points at — in practice the
real PostgreSQL corpus. The test then runs a full consolidation cycle (decay,
compression, CLS, causal discovery) across every production memory.
The assertion total_memories == 0 shows the intent: it was written against
an empty store. It only passes in CI because CI has no populated database.
That is coverage by accident of environment, not by construction (§13.1 G3:
tests must be deterministic and isolated).
The sibling tests in the same class (test_decay_only, test_compress_only)
share the defect.
Why it matters beyond the hang
A test that silently binds to the developer's production store can also
mutate it — consolidate decays heat, compresses memories to gist/tag,
and advances consolidation stages. Running the suite locally is currently a
write against real data.
Acceptance criteria
TestConsolidateHandler binds to an isolated temp store (fixture setting
CORTEX_MEMORY_STORE_BACKEND=sqlite + a tmp_path DB, clearing
get_memory_settings cache and reset_shared_store()), so the assertions
are true by construction rather than by environment.
- The whole class passes with a populated PostgreSQL database configured in
the environment.
pytest-timeout is installed (or the unknown timeout config keys are
removed), so a hang fails loudly instead of stalling the suite — the two
PytestConfigWarnings are themselves a seen defect.
- A test asserting that running the suite does not write to a store the test
did not create.
Symptom
tests_py/handlers/test_consolidate.py::TestConsolidateHandler::test_empty_store_runs_cleanhangs indefinitely on any developer machine that has a populated PostgreSQL
store configured. The full suite stops at ~58% and never completes; nothing
times out, because
pytest-timeoutis not installed (pyproject.tomlconfigures
timeout/timeout_method, and pytest reports both asPytestConfigWarning: Unknown config option).Reproduction
Measured 2026-07-27. Reproduces identically on
main(a2f5053) and on anunrelated feature branch, so it is not caused by any in-flight change.
Root cause — the test has no store isolation
No fixture, no
monkeypatch, no temp database.handler()resolves itsstore through
get_shared_store(settings.DB_PATH, ...), so it binds towhatever backend the developer's environment points at — in practice the
real PostgreSQL corpus. The test then runs a full consolidation cycle (decay,
compression, CLS, causal discovery) across every production memory.
The assertion
total_memories == 0shows the intent: it was written againstan empty store. It only passes in CI because CI has no populated database.
That is coverage by accident of environment, not by construction (§13.1 G3:
tests must be deterministic and isolated).
The sibling tests in the same class (
test_decay_only,test_compress_only)share the defect.
Why it matters beyond the hang
A test that silently binds to the developer's production store can also
mutate it —
consolidatedecays heat, compresses memories to gist/tag,and advances consolidation stages. Running the suite locally is currently a
write against real data.
Acceptance criteria
TestConsolidateHandlerbinds to an isolated temp store (fixture settingCORTEX_MEMORY_STORE_BACKEND=sqlite+ atmp_pathDB, clearingget_memory_settingscache andreset_shared_store()), so the assertionsare true by construction rather than by environment.
the environment.
pytest-timeoutis installed (or the unknowntimeoutconfig keys areremoved), so a hang fails loudly instead of stalling the suite — the two
PytestConfigWarnings are themselves a seen defect.did not create.