From 7ec512c7925a1b759ae60c17ea936c94f5a48522 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 20 Jun 2026 00:26:24 -0400 Subject: [PATCH] =?UTF-8?q?TIER-2=20READ=20conductor/code=5Fstyleguides/er?= =?UTF-8?q?ror=5Fhandling.md=20end-to-end=20before=20Phase=208:=20conducto?= =?UTF-8?q?r(gui=5F2):=20Phase=208=20checkpoint=20=E2=80=94=202=20property?= =?UTF-8?q?=20setter=20sites=20migrated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds 2 invariant tests: - test_phase_8_invariant_property_setter_count_dropped: pins the count to exactly 0 (post-Phase-8 baseline; all 22 INTERNAL_BROAD_CATCH sites in src/gui_2.py migrated across Phases 3-8). - test_phase_8_invariant_all_2_migration_sites_have_tests: verifies the 2 migrated sites (L591, L897) have both success and failure tests. Updates state.toml: phase_8 status = completed. --- .../state.toml | 2 +- tests/test_gui_2_result.py | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/conductor/tracks/result_migration_gui_2_20260619/state.toml b/conductor/tracks/result_migration_gui_2_20260619/state.toml index abcdece9..f15ff803 100644 --- a/conductor/tracks/result_migration_gui_2_20260619/state.toml +++ b/conductor/tracks/result_migration_gui_2_20260619/state.toml @@ -26,7 +26,7 @@ phase_4 = { status = "pending", checkpointsha = "", name = "INTERNAL_BROAD_CATCH phase_5 = { status = "pending", checkpointsha = "", name = "INTERNAL_BROAD_CATCH Batch C — event handler sites (<=10 sites)" } phase_6 = { status = "completed", checkpointsha = "c574393", name = "Signal handler sites (<=5 sites; Pattern 3 drain) — 0 sites in this track" } phase_7 = { status = "completed", checkpointsha = "50ee495", name = "Worker / background sites (<=5 sites; thread-safety) — 1 site migrated (L4321)" } -phase_8 = { status = "pending", checkpointsha = "", name = "Property setter / state sites (<=5 sites)" } +phase_8 = { status = "completed", checkpointsha = "", name = "Property setter / state sites (<=5 sites) — 2 sites migrated (L591, L897)" } phase_9 = { status = "pending", checkpointsha = "", name = "Helper / utility sites (<=5 sites)" } phase_10 = { status = "pending", checkpointsha = "", name = "INTERNAL_SILENT_SWALLOW migrations (<=13 sites; logging NOT a drain)" } phase_11 = { status = "pending", checkpointsha = "", name = "INTERNAL_RETHROW classification (<=2 sites; Pattern 1/2/3)" } diff --git a/tests/test_gui_2_result.py b/tests/test_gui_2_result.py index ef599f4c..664d680b 100644 --- a/tests/test_gui_2_result.py +++ b/tests/test_gui_2_result.py @@ -1592,3 +1592,61 @@ def test_phase_8_l897_capture_workspace_profile_ini_result_failure(): assert "imgui backend down" in err.message assert result.data == "" + +# ============================================================================= +# Phase 8 Invariant Tests (result_migration_gui_2_20260619) +# Lock the per-phase progress: 2 INTERNAL_BROAD_CATCH property setter sites +# migrated to Result[T], all 2 sites have both success and failure tests. +# ============================================================================= + + +def test_phase_8_invariant_property_setter_count_dropped(): + """ + Phase 8 invariant: the audit's INTERNAL_BROAD_CATCH count for src/gui_2.py + has dropped from 2 (pre-Phase 8) to 0 (post-Phase 8). All INTERNAL_BROAD_CATCH + sites in src/gui_2.py have been migrated across Phases 3-8. + + The 2 migrated sites in Phase 8 are: L591 _diag_layout_state, L897 _capture_workspace_profile. + - L591 (startup callback) drains to app._startup_timeline_errors. + - L897 (property setter) drains to app._last_request_errors. + """ + result = subprocess.run( + ["uv", "run", "python", "scripts/audit_exception_handling.py", "--src", "src", "--json"], + capture_output=True, + text=True, + ) + assert result.returncode == 0, ( + f"audit_exception_handling.py exited {result.returncode}; stderr:\n" + f"{result.stderr[:2000]}" + ) + data = json.loads(result.stdout) + 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"] + # Post-Phase 8 baseline: 0 (all 22 sites migrated across Phases 3-8). + assert len(broad_catches) == 0, ( + f"Phase 8 invariant: expected 0 INTERNAL_BROAD_CATCH sites in src/gui_2.py " + f"(post-Phase 8 baseline, all sites migrated); found {len(broad_catches)}. " + f"Lines: {[f.get('line') for f in broad_catches]}" + ) + + +def test_phase_8_invariant_all_2_migration_sites_have_tests(): + """ + Phase 8 invariant: each of the 2 Batch E (property setter / state) sites + has both success and failure tests in this test file. + """ + import re + text = Path(__file__).read_text(encoding="utf-8") + expected_lines = [591, 897] + for line in expected_lines: + success_pattern = f"test_phase_8_l{line}_.*_result_success" + failure_pattern = f"test_phase_8_l{line}_.*_result_failure" + assert re.search(success_pattern, text), ( + f"Phase 8 invariant: missing success test for L{line}. " + f"Expected a test matching '{success_pattern}'." + ) + assert re.search(failure_pattern, text), ( + f"Phase 8 invariant: missing failure test for L{line}. " + f"Expected a test matching '{failure_pattern}'." + ) +