Private
Public Access
fix(app_controller): catch RuntimeError from FR1 audit hook in fallback save
The _load_active_project fallback save was wrapped in try/except for
(OSError, IOError, PermissionError) only. The FR1 audit hook raises
RuntimeError('TEST_SANDBOX_VIOLATION...') when a test tries to write
outside ./tests/. Add RuntimeError to the caught exception list so tests
that do App() / AppController() directly (without setting
active_project_path) don't crash — the empty fallback is silently skipped
and the app continues operating.
Also update tests/test_app_controller_offloading.py:tmp_session_dir
fixture to re-initialize paths after reset_paths() so paths.get_logs_dir()
honors the SLOP_LOGS_DIR env var instead of raising RuntimeError.
This commit is contained in:
@@ -18,7 +18,12 @@ def tmp_session_dir(tmp_path, monkeypatch):
|
||||
|
||||
monkeypatch.setenv("SLOP_LOGS_DIR", str(logs_dir))
|
||||
monkeypatch.setenv("SLOP_SCRIPTS_DIR", str(scripts_dir))
|
||||
paths.reset_paths()
|
||||
# v3 paths.py: reset_paths() clears the singleton. Re-initialize with an
|
||||
# empty config (no [paths] section) so the SLOP_LOGS_DIR env var is honored
|
||||
# via _resolve_path. Without this, paths.get_logs_dir() raises RuntimeError.
|
||||
empty_config = tmp_path / "empty.toml"
|
||||
empty_config.write_text("# no [paths] section\n")
|
||||
paths.initialize_paths(empty_config)
|
||||
|
||||
# Ensure session_logger is clean
|
||||
with patch("src.session_logger._comms_fh", None):
|
||||
|
||||
Reference in New Issue
Block a user