Private
Public Access
0
0
Files
manual_slop/tests
ed 2752b5a82c fix(audit): tighten _is_fastapi_handler BOUNDARY_FASTAPI heuristic (Phase 7 Task 7.6+7.8)
The previous heuristic over-applied BOUNDARY_FASTAPI to ALL try/except
inside _api_* handlers, regardless of whether the except body actually
raises HTTPException. This was the laundering pattern that allowed L242
and L256 in _api_generate to be classified compliant while only doing
sys.stderr.write.

Per Phase 7 spec 22.5.5 (FR5), BOUNDARY_FASTAPI now requires:
- The except body contains ast.Raise(exc=HTTPException(...)), OR
- The except body contains return Result(...)

Otherwise:
- INTERNAL_SILENT_SWALLOW if the body has logging (the strict-violation
  case per error_handling.md:530 'logging is NOT a drain')
- INTERNAL_COMPLIANT if the body returns Result

New helpers:
- _except_body_drains_via_http_exception_or_result(handler)
- _except_body_has_logging(body)

5 regression-guard tests in tests/test_audit_heuristics.py lock the
behavior so the heuristic does not regress the 13 BOUNDARY_FASTAPI
sites in src/app_controller.py.

TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end
before this commit.
2026-06-19 19:21:18 -04:00
..