fix(test_sandbox): redirect session logs to tests/artifacts via autouse fixture

Per FR1 of test_sandbox_hardening_20260619 spec, all writes must be under
<project_root>/tests/. Tests that create an AppController + call init_state()
trigger session_logger.open_session() at src/session_logger.py:85 which
writes to paths.get_logs_dir() - by default logs/ at project root, outside
tests/. This was triggered by tests/test_context_composition_decoupled.py
and surfaced in the latest batched test run.

Add a function-scoped autouse fixture in tests/conftest.py that monkeypatches
src.paths.get_logs_dir to return a per-run tests/-allowed path. Per-run
subdirectory prevents log_registry.toml collisions across test runs.

Skips test_paths.py, test_test_sandbox.py, and test_app_controller_offloading.py
which directly assert on paths.get_logs_dir() behavior or set up their own
session via tmp_session_dir (overriding get_logs_dir at the module level
breaks those tests' assertions). No production code is modified.
This commit is contained in:
ed
2026-06-21 11:59:51 -04:00
parent 69b7ab670d
commit e2411e5c54
7 changed files with 172 additions and 86 deletions
+6 -6
View File
@@ -50,8 +50,8 @@ Collapsed=0
DockId=0x00000001,4
[Window][Response]
Pos=1137,28
Size=529,1172
Pos=1146,28
Size=534,1172
Collapsed=0
DockId=0x00000002,0
@@ -88,7 +88,7 @@ Collapsed=0
[Window][Diagnostics]
Pos=34,28
Size=1101,1172
Size=1110,1172
Collapsed=0
DockId=0x00000001,2
@@ -106,7 +106,7 @@ DockId=0x0000000D,0
[Window][Discussion Hub]
Pos=34,28
Size=1101,1172
Size=1110,1172
Collapsed=0
DockId=0x00000001,0
@@ -141,7 +141,7 @@ DockId=0x00000001,2
[Window][Log Management]
Pos=34,28
Size=1101,1172
Size=1110,1172
Collapsed=0
DockId=0x00000001,1
@@ -923,7 +923,7 @@ Column 2 Width=70
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,28 Size=1666,1172 Split=X
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,28 Size=1680,1172 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2357,1183 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
DockNode ID=0x00000005 Parent=0x0000000B SizeRef=820,1681 Split=Y Selected=0x3F1379AF