docs(reports): add Phase 7 addendum to TRACK_COMPLETION (Strict Enforcement Cleanup)
Documents Phase 7 (added post-review with Tier 1): - 4 strict-violation sites migrated to Result[T] - Audit heuristic tightened (BOUNDARY_FASTAPI requires HTTPException or Result) - 5 regression-guard tests in tests/test_audit_heuristics.py Audit metrics before/after: - BOUNDARY_FASTAPI: 17 -> 13 (4 over-applied eliminated) - INTERNAL_SILENT_SWALLOW: 0 -> 0 (no regression) - INTERNAL_BROAD_CATCH: 0 -> 0 (no regression) Test verification: - Tier 1 (254 tests): ALL 5 PASS - Tier 2 (35 tests): ALL 5 PASS - 61 targeted tests pass; 2 xfailed (existing) Total strict-violation sites eliminated: 4. Total silent-swallow sites eliminated (Phase 6+7 combined): 30 + 4 = 34. TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end.
This commit is contained in:
@@ -223,7 +223,78 @@ Pre-Phase-6 (Phases 1-5) commits visible in `git log --oneline`; all merged to m
|
||||
|
||||
---
|
||||
|
||||
## 8. Post-Completion Regression Fix (added 2026-06-19)
|
||||
## 8. Phase 7 Addendum: Strict Enforcement Cleanup (added 2026-06-19, post-review with Tier 1)
|
||||
|
||||
### 8.1 Background
|
||||
|
||||
Phase 6 reduced `INTERNAL_SILENT_SWALLOW` from 30 to 0 per `audit_exception_handling.py`. However, 4 sites in `src/app_controller.py` were classified as compliant by the audit via heuristic over-application, but strictly per `error_handling.md:530` ("logging is NOT a drain") they remain silent-swallow violations:
|
||||
|
||||
| Line | Function | Pre-Phase-7 audit class | Strict status | Migration |
|
||||
|---|---|---|---|---|
|
||||
| L242 | `_api_generate` (RAG) | BOUNDARY_FASTAPI (over-applied) | violation - sys.stderr.write only | commit `9bba317d` |
|
||||
| L256 | `_api_generate` (symbols) | BOUNDARY_FASTAPI (over-applied) | violation - sys.stderr.write only | commit `9bba317d` |
|
||||
| L5064 | `_push_mma_state_update` | INTERNAL_COMPLIANT (logging+print) | violation - no Result | commit `bab5d212` |
|
||||
| L5093 | `_load_active_tickets.beads` inner | INTERNAL_COMPLIANT (logging+print) | violation - no Result | commit `bab5d212` |
|
||||
|
||||
### 8.2 Audit Heuristic Over-Application (Task 7.1)
|
||||
|
||||
The audit heuristic at `scripts/audit_exception_handling.py:393-397` over-applied `BOUNDARY_FASTAPI` to ALL `try/except` inside `_api_*` handlers regardless of whether the except body raised HTTPException. Per `error_handling.md:534`, BOUNDARY_FASTAPI only applies to actual HTTPException raises. This was the same laundering pattern that sub-track 2 Phase 10 to 11 redo addressed.
|
||||
|
||||
### 8.3 Migration Pattern
|
||||
|
||||
All 4 sites were migrated to proper `Result[T]` propagation using the Phase 6 helpers already in the file (`_rag_search_result`, `_symbol_resolution_result`, `_report_worker_error`) plus new `_result` helpers for `_push_mma_state_update` and `_load_beads_from_path_result`.
|
||||
|
||||
### 8.4 Audit Heuristic Tightening (Task 7.6, commit `2752b5a8`)
|
||||
|
||||
Added 2 new helper methods:
|
||||
- `_except_body_drains_via_http_exception_or_result(handler)`: returns True only if except body contains `raise HTTPException(...)` OR `return Result(...)`
|
||||
- `_except_body_has_logging(body)`: returns True if body has `logging.*` / `print` / `sys.stderr.write`
|
||||
|
||||
Modified classification at line 393-397:
|
||||
- If `_api_*` + broad catch + body raises HTTPException/Result → BOUNDARY_FASTAPI (unchanged)
|
||||
- If `_api_*` + broad catch + body has logging → **INTERNAL_SILENT_SWALLOW** (strict violation flagged)
|
||||
- If `_api_*` + broad catch + body returns Result → INTERNAL_COMPLIANT
|
||||
|
||||
### 8.5 Regression Tests (Task 7.8, commit `2752b5a8`)
|
||||
|
||||
5 tests in new `tests/test_audit_heuristics.py` lock the behavior:
|
||||
- `test_is_api_handler_requires_http_exception_in_body` — logging-only body is NOT BOUNDARY_FASTAPI
|
||||
- `test_api_handler_with_http_exception_raise_is_boundary_fastapi` — HTTPException raise IS BOUNDARY_FASTAPI
|
||||
- `test_non_api_handler_with_logging_is_still_internal_compliant` — non-_api_* handlers unaffected
|
||||
- `test_15_existing_fastapi_sites_remain_classified` — 13 BOUNDARY_FASTAPI sites in app_controller.py remain (verify each has HTTPException or Result in window)
|
||||
- `test_phase7_migrated_sites_no_longer_silent_swallow` — L242/L256/L5064/L5093 not classified INTERNAL_SILENT_SWALLOW
|
||||
|
||||
### 8.6 Audit Metrics: Before vs After Phase 7
|
||||
|
||||
| Metric | Post-Phase 6 (b72f291c) | Post-Phase 7 (c99df4b0) |
|
||||
|---|---|---|
|
||||
| INTERNAL_SILENT_SWALLOW | 0 | 0 |
|
||||
| INTERNAL_BROAD_CATCH | 0 | 0 |
|
||||
| BOUNDARY_FASTAPI (app_controller.py) | 17 | 13 |
|
||||
| Strict-violation sites (L242/L256/L5064/L5093) | 4 (over-classified) | 0 (migrated) |
|
||||
|
||||
### 8.7 Test Verification
|
||||
|
||||
- Tier 1 (254 tests): ALL 5 batches PASS
|
||||
- Tier 2 (35 tests): ALL 5 batches PASS
|
||||
- 27 Phase 6 unit tests + 6 Phase 7 unit tests in `test_app_controller_result.py` PASS
|
||||
- 5 Phase 7 regression-guard tests in `test_audit_heuristics.py` PASS
|
||||
- 20 existing heuristic tests in `test_audit_exception_handling_heuristics.py` PASS
|
||||
- Total: 61 targeted tests pass; 2 xfailed (existing)
|
||||
|
||||
### 8.8 Phase 7 Commits
|
||||
|
||||
- `9bba317d` — refactor(app_controller): migrate L242 (RAG) + L256 (symbols) to Result helpers
|
||||
- `bab5d212` — refactor(app_controller): migrate _push_mma_state_update + _load_beads to Result helpers
|
||||
- `2752b5a8` — fix(audit): tighten _is_fastapi_handler BOUNDARY_FASTAPI heuristic
|
||||
- `c99df4b0` — conductor(plan): mark Phase 7 complete
|
||||
|
||||
Total strict-violation sites eliminated: 4 (L242, L256, L5064, L5093).
|
||||
Total silent-swallow sites eliminated (Phase 6 + Phase 7 combined): 30 + 4 = 34.
|
||||
|
||||
---
|
||||
|
||||
## 9. Post-Completion Regression Fix (added 2026-06-19)
|
||||
|
||||
**Reported by user:** `test_context_sim_live` (live_gui sim) failed after applying Phase 6 final commit (b72f291c) to user's main repo (manual_slop). Status stuck at "sending..." for 60 seconds; AI never responded.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user