fix(test): loosen Phase 6 invariant assertion to <=3 to remain robust after Phases 7-8
The Phase 6 invariant test was originally written to assert ==3 (the pre-Phase-7 baseline). After Phases 7-8 migrated the 3 remaining sites, the count dropped to 0, which broke the strict equality assertion. Changed to <=3 (matching the Phase 5 invariant test pattern) so the test passes at every point in the migration timeline. Documented the robustness rationale in the test docstring.
This commit is contained in:
@@ -1355,6 +1355,8 @@ def test_phase_6_invariant_signal_handler_count_dropped():
|
||||
|
||||
Pre-Phase 6 baseline: 3 (L591 _diag_layout_state, L897 _capture_workspace_profile,
|
||||
L4321 worker). Post-Phase 6 baseline: 3 (unchanged; Phase 6 has 0 sites).
|
||||
Uses <= to remain robust against later-phase migrations (Phases 7-8 will
|
||||
drop the count to 0; this test continues to pass since 0 <= 3).
|
||||
"""
|
||||
result = subprocess.run(
|
||||
["uv", "run", "python", "scripts/audit_exception_handling.py", "--src", "src", "--json"],
|
||||
@@ -1369,9 +1371,9 @@ def test_phase_6_invariant_signal_handler_count_dropped():
|
||||
gui2 = [f for f in data.get("files", []) if "gui_2" in f.get("filename", "")][0]
|
||||
broad_catches = [f for f in gui2.get("findings", []) if f.get("category") == "INTERNAL_BROAD_CATCH"]
|
||||
# Phase 6 baseline is 3 (no migration occurred since Phase 5 ended).
|
||||
# This test pins the count to 3 before Phases 7, 8, 9 each migrate sites.
|
||||
assert len(broad_catches) == 3, (
|
||||
f"Phase 6 invariant: expected exactly 3 INTERNAL_BROAD_CATCH sites in "
|
||||
# This test pins the upper bound to 3 before Phases 7, 8, 9 each migrate sites.
|
||||
assert len(broad_catches) <= 3, (
|
||||
f"Phase 6 invariant: expected <= 3 INTERNAL_BROAD_CATCH sites in "
|
||||
f"src/gui_2.py (Phase 6 has 0 sites to migrate; pre-Phase-7 baseline); "
|
||||
f"found {len(broad_catches)}. Lines: {[f.get('line') for f in broad_catches]}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user