From 61a89fa30e6e6f202f602987f8ee1d65ebf29a34 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 19 Jun 2026 14:29:19 -0400 Subject: [PATCH] docs(reports): add post-completion fixes (63e91198, cb68d86f, 78256174) Appends an addendum to TRACK_COMPLETION_test_sandbox_hardening_20260619.md covering the three follow-up commits made after the initial track ship: - 63e91198: test updates for v3 paths-aware behavior (4 test files) - cb68d86f: RuntimeError catch in _load_active_project fallback save - 78256174: defensive _flush_to_project + audit script false positive + 3 MCP test updates Includes final tier-batch status table (ALL 11 PASS, 344 files, 14m25s) and a cherry-pick recipe for the user to apply these commits to the main repo at C:\projects\manual_slop. --- ...PLETION_test_sandbox_hardening_20260619.md | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/docs/reports/TRACK_COMPLETION_test_sandbox_hardening_20260619.md b/docs/reports/TRACK_COMPLETION_test_sandbox_hardening_20260619.md index d12d21bb..df059ea7 100644 --- a/docs/reports/TRACK_COMPLETION_test_sandbox_hardening_20260619.md +++ b/docs/reports/TRACK_COMPLETION_test_sandbox_hardening_20260619.md @@ -471,4 +471,72 @@ pwsh -File scripts/run_tests_sandboxed.ps1 -WhatIf # dry-run pwsh -File scripts/run_tests_sandboxed.ps1 # full pytest in restricted token ``` -End of report. \ No newline at end of file +End of report. +--- + +## Post-completion fixes (2026-06-19, same session) + +After the initial track ship, three follow-up commits addressed failures surfaced by a full batched run of the main repo: + +### 63e91198 — test(sandbox): update v3 paths-aware tests + +`tests/test_paths.py`, `tests/test_summary_cache.py`, `tests/test_orchestrator_pm_history.py`, `tests/test_gui_paths.py` were written against an earlier v1/v2 paths design (used `SLOP_CONFIG` env var, hardcoded `.test_cache/` paths, mocked `reset_paths`). Updated to v3: + +- `test_paths.py`: explicit `paths.initialize_paths()`; `restore_paths` fixture so conftest workspace init survives across tests. +- `test_summary_cache.py`: `tmp_path` instead of `Path(".test_cache")` (FR1 blocks project-root writes). +- `test_orchestrator_pm_history.py`: `tempfile.mkdtemp()` instead of `Path("test_conductor")` (FR1 blocks). +- `test_gui_paths.py::test_save_paths`: mock `src.paths.initialize_paths` (the new v3 entry point) instead of `reset_paths`. + +12 tests pass after these fixes. + +### cb68d86f — fix(app_controller): catch RuntimeError from FR1 audit hook in fallback save + +`_load_active_project`'s fallback `save_project` was wrapped in `try/except (OSError, IOError, PermissionError)` but the FR1 audit hook raises `RuntimeError("TEST_SANDBOX_VIOLATION...")` — which slipped through and crashed tests like `test_view_mode_initialization`, `test_discussion_tabs_rendered`, `test_gui_window_controls_minimize_maximize_close`, `test_app_window_is_borderless`, `test_hooks_enabled_via_cli`, etc. that do `App()` directly. + +Also fixed `tests/test_app_controller_offloading.py::tmp_session_dir` fixture which called `paths.reset_paths()` without re-initializing paths, causing `session_logger.open_session` to hit `RuntimeError("src.paths not initialized")`. + +### 78256174 — fix(app_controller): defensive _flush_to_project + RuntimeError in fallback save + +Three fixes for the FR1 RuntimeError leaking through production save paths: + +1. `_flush_to_project` was calling `save_project(proj, self.active_project_path)` with `active_project_path=""` when the fallback save had been silently skipped. Now skips the save entirely when the path is empty, with try/except for RuntimeError/IOError/OSError/PermissionError. +2. `scripts/audit_no_temp_writes.py` was matching its own docstring and regex pattern in `scripts/audit_test_sandbox_violations.py` (false positive in the strict-mode CI gate). Added to `EXCLUDE_FILES`. +3. Three MCP tests (`test_app_controller_mcp.py` × 2, `test_external_mcp_e2e.py` × 1) updated to use `paths.initialize_paths()` with a `[paths]` section pointing under `tmp_path`. The `SLOP_CONFIG` env var trick no longer works in v3, and the production `config.toml`'s `[paths]` table overrides would point the MCP code at nonexistent files. + +Also fixed `test_config_overrides_toml_has_paths_section`: it sorted workspaces by mtime and picked the latest, but the batched runner spawns one pytest per batch (each with its own `_RUN_ID`), leaving many half-created stubs. The test now filters by content (must have a `[paths]` section), not by mtime alone. + +--- + +## Final state (after this commit) + +| Tier | Batch | Status | Files | Time | +|------|-------|--------|-------|------| +| 1 | tier-1-unit-comms | PASS | 6 | 26.6s | +| 1 | tier-1-unit-core | PASS | 205 | 59.9s | +| 1 | tier-1-unit-gui | PASS | 20 | 57.2s | +| 1 | tier-1-unit-headless | PASS | 2 | 26.2s | +| 1 | tier-1-unit-mma | PASS | 20 | 27.0s | +| 2 | tier-2-mock_app-comms | PASS | 2 | 10.5s | +| 2 | tier-2-mock_app-core | PASS | 16 | 16.0s | +| 2 | tier-2-mock_app-gui | PASS | 9 | 13.5s | +| 2 | tier-2-mock_app-headless | PASS | 1 | 11.4s | +| 2 | tier-2-mock_app-mma | PASS | 7 | 15.5s | +| 3 | tier-3-live_gui | PASS | 56 | 601.4s | +| **TOTAL** | | **ALL 11 PASS** | **344** | **865.1s** | + +**Result:** The Tier 2 sandbox now ships a green test suite. The main repo (`C:\projects\manual_slop\`) needs to cherry-pick commits `63e91198`, `cb68d86f`, `78256174` (plus the earlier v3 commits) to inherit the same green state. + +## Cherry-pick recipe for the user + +In the main repo (`C:\projects\manual_slop`): + +```bash +git fetch origin tier2/test_sandbox_hardening_20260619 +git checkout -b review/test_sandbox_hardening_20260619 origin/tier2/test_sandbox_hardening_20260619 + +# OR cherry-pick individual commits: +git cherry-pick 63e91198 cb68d86f 78256174 +# (Plus the earlier v3 commits if those aren't already in master) +``` + +After the cherry-pick, `uv run .\scripts\run_tests_batched.py` from the main repo should report `ALL 11 PASS`.