Private
Public Access
test(gui_2): add 2 Phase 10 invariant tests + Phase 10 checkpoint
TIER-2 READ conductor/code_styleguides/error_handling.md end-to-end before Phase 10. ANTI-SLIMING VERIFIED: 13 INTERNAL_SILENT_SWALLOW sites migrated to Result[T]. logging NOT a drain per the user's principle 2026-06-17. Invariant tests: 1. test_phase_10_invariant_silent_swallow_count_zero: verifies audit shows 0 INTERNAL_SILENT_SWALLOW sites in src/gui_2.py (was 13). 2. test_phase_10_invariant_all_13_sites_have_tests: verifies all 13 sites have success and failure tests (>= 2 tests per site). State updates: - phase_10 = completed (was pending) - silent_swallow_count_zero = true (was false) - All 13 site tasks (t10_1 through t10_13) marked completed with SHAs - t10_14 (this checkpoint commit) marked in_progress 29 Phase 10 tests pass: 27 site tests + 2 invariant tests.
This commit is contained in:
@@ -28,7 +28,7 @@ phase_6 = { status = "completed", checkpointsha = "c574393", name = "Signal hand
|
||||
phase_7 = { status = "completed", checkpointsha = "50ee495", name = "Worker / background sites (<=5 sites; thread-safety) — 1 site migrated (L4321)" }
|
||||
phase_8 = { status = "completed", checkpointsha = "7ec512c", name = "Property setter / state sites (<=5 sites) — 2 sites migrated (L591, L897)" }
|
||||
phase_9 = { status = "completed", checkpointsha = "6b02f49", name = "Helper / utility sites (<=5 sites) — 0 sites in this track (L1398 is SILENT_SWALLOW, Phase 10)" }
|
||||
phase_10 = { status = "pending", checkpointsha = "", name = "INTERNAL_SILENT_SWALLOW migrations (<=13 sites; logging NOT a drain)" }
|
||||
phase_10 = { status = "completed", 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)" }
|
||||
phase_12 = { status = "pending", checkpointsha = "", name = "UNCLEAR classification (<=2 sites)" }
|
||||
phase_13 = { status = "pending", checkpointsha = "", name = "Audit gate + end-of-track report (5 tasks; --strict exits 0; 11/11 tiers PASS)" }
|
||||
@@ -129,21 +129,21 @@ t9_5 = { status = "pending", commit_sha = "", description = "Migrate helper site
|
||||
t9_6 = { status = "pending", commit_sha = "", description = "Add Phase 9 invariant test; Phase 9 checkpoint" }
|
||||
|
||||
# Phase 10: INTERNAL_SILENT_SWALLOW migrations (<=13) — CRITICAL anti-sliming phase
|
||||
t10_0 = { status = "pending", commit_sha = "", description = "Phase 10 styleguide re-read (lines 462-540 logging NOT a drain) + ack commit (explicit sliming risk)" }
|
||||
t10_1 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 1 (NO narrowing+logging; full Result[T] propagation)" }
|
||||
t10_2 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 2" }
|
||||
t10_3 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 3" }
|
||||
t10_4 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 4" }
|
||||
t10_5 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 5" }
|
||||
t10_6 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 6" }
|
||||
t10_7 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 7" }
|
||||
t10_8 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 8" }
|
||||
t10_9 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 9" }
|
||||
t10_10 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 10" }
|
||||
t10_11 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 11" }
|
||||
t10_12 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 12" }
|
||||
t10_13 = { status = "pending", commit_sha = "", description = "Migrate silent-swallow site 13" }
|
||||
t10_14 = { status = "pending", commit_sha = "", description = "Add Phase 10 invariant test (silent_swallow_count_zero); Phase 10 checkpoint" }
|
||||
t10_0 = { status = "completed", commit_sha = "11d33123", description = "Phase 10 styleguide re-read (lines 462-540 logging NOT a drain) + ack commit (explicit sliming risk)" }
|
||||
t10_1 = { status = "completed", commit_sha = "c7303838", description = "Migrate silent-swallow site 1 (NO narrowing+logging; full Result[T] propagation)" }
|
||||
t10_2 = { status = "completed", commit_sha = "6585cdc5", description = "Migrate silent-swallow site 2" }
|
||||
t10_3 = { status = "completed", commit_sha = "e761244c", description = "Migrate silent-swallow site 3" }
|
||||
t10_4 = { status = "completed", commit_sha = "ad702f7e", description = "Migrate silent-swallow site 4" }
|
||||
t10_5 = { status = "completed", commit_sha = "cab4548f", description = "Migrate silent-swallow site 5" }
|
||||
t10_6 = { status = "completed", commit_sha = "96886772", description = "Migrate silent-swallow site 6" }
|
||||
t10_7 = { status = "completed", commit_sha = "24191c82", description = "Migrate silent-swallow site 7" }
|
||||
t10_8 = { status = "completed", commit_sha = "9188e548", description = "Migrate silent-swallow site 8" }
|
||||
t10_9 = { status = "completed", commit_sha = "1e5a7428", description = "Migrate silent-swallow site 9" }
|
||||
t10_10 = { status = "completed", commit_sha = "602c1b48", description = "Migrate silent-swallow site 10" }
|
||||
t10_11 = { status = "completed", commit_sha = "e2d2105b", description = "Migrate silent-swallow site 11" }
|
||||
t10_12 = { status = "completed", commit_sha = "b4a6ebc1", description = "Migrate silent-swallow site 12" }
|
||||
t10_13 = { status = "completed", commit_sha = "3c752eb2", description = "Migrate silent-swallow site 13" }
|
||||
t10_14 = { status = "in_progress", commit_sha = "", description = "Add Phase 10 invariant test (silent_swallow_count_zero); Phase 10 checkpoint" }
|
||||
|
||||
# Phase 11: INTERNAL_RETHROW classification (<=2)
|
||||
t11_0 = { status = "pending", commit_sha = "", description = "Phase 11 styleguide re-read (Re-Raise Patterns lines 625-690) + ack commit" }
|
||||
@@ -175,7 +175,7 @@ phase_6_complete = false
|
||||
phase_7_complete = false
|
||||
phase_8_complete = false
|
||||
phase_9_complete = false
|
||||
phase_10_complete = false
|
||||
phase_10_complete = true
|
||||
phase_11_complete = false
|
||||
phase_12_complete = false
|
||||
phase_13_complete = false
|
||||
@@ -183,7 +183,7 @@ audit_strict_exits_0 = false
|
||||
batched_suite_11_of_11_pass = false
|
||||
site_inventory_has_42_rows = true
|
||||
drain_plane_render_functions_exist = true
|
||||
silent_swallow_count_zero = false
|
||||
silent_swallow_count_zero = true
|
||||
rethrow_count_zero = false
|
||||
unclear_count_zero = false
|
||||
broad_catch_count_zero = false
|
||||
@@ -2300,4 +2300,97 @@ def test_phase_10_l7315_ticket_id_max_int_result_failure():
|
||||
assert "invalid literal" in err.message or "T-abc" in err.message
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Phase 10 Invariant Tests (result_migration_gui_2_20260619)
|
||||
# Lock the per-phase progress: 13 INTERNAL_SILENT_SWALLOW sites migrated to
|
||||
# Result[T] with full propagation (NO narrowing+logging, NO pass-after-log).
|
||||
# logging NOT a drain per the user's principle 2026-06-17.
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def test_phase_10_invariant_silent_swallow_count_zero():
|
||||
"""
|
||||
Phase 10 invariant: the audit's INTERNAL_SILENT_SWALLOW count for src/gui_2.py
|
||||
is now 0. All 13 sites in the inventory have been migrated to Result[T]
|
||||
propagation. The new helpers are classified as INTERNAL_COMPLIANT (or
|
||||
BOUNDARY_CONVERSION for the dispatcher wrappers), not as SILENT_SWALLOW.
|
||||
|
||||
Per the user's principle 2026-06-17 (logging NOT a drain), the
|
||||
migration replaced each site with a full Result[T] pattern:
|
||||
- Helper: returns Result(data=X, errors=[ErrorInfo]) on exception
|
||||
- Wrapper: calls helper, drains errors to the appropriate data plane
|
||||
(NOT silent swallow)
|
||||
- Tests: 2 tests per site verify success + failure paths
|
||||
|
||||
Pre-Phase 10 baseline: 13. Post-Phase 10 baseline: 0. This test pins
|
||||
the count to 0.
|
||||
"""
|
||||
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]
|
||||
silent_swallows = [f for f in gui2.get("findings", []) if f.get("category") == "INTERNAL_SILENT_SWALLOW"]
|
||||
assert len(silent_swallows) == 0, (
|
||||
f"Phase 10 invariant: expected 0 INTERNAL_SILENT_SWALLOW sites in src/gui_2.py "
|
||||
f"(post-Phase 10 baseline; all 13 sites migrated to Result[T]); "
|
||||
f"found {len(silent_swallows)}. Lines: {[f.get('line') for f in silent_swallows]}"
|
||||
)
|
||||
|
||||
|
||||
def test_phase_10_invariant_all_13_sites_have_tests():
|
||||
"""
|
||||
Phase 10 invariant: all 13 INTERNAL_SILENT_SWALLOW migration sites have
|
||||
success and failure tests in this test file. Verifies the test coverage
|
||||
for Phase 10 is complete.
|
||||
|
||||
The 13 sites (from PHASE1_SITE_INVENTORY.md):
|
||||
- L216 _detect_refresh_rate_win32
|
||||
- L241 _resolve_font_path
|
||||
- L567 _post_init
|
||||
- L683 run
|
||||
- L974 shutdown
|
||||
- L1074 _gui_func
|
||||
- L1348 _close_vscode_diff
|
||||
- L1504 render_main_interface (focus_response)
|
||||
- L1530 render_main_interface (autosave)
|
||||
- L4742 _on_warmup_complete_callback
|
||||
- L6694 render_tier_stream_panel
|
||||
- L7029 render_task_dag_panel (cycle_check)
|
||||
- L7045 render_task_dag_panel (ticket_id_parse)
|
||||
"""
|
||||
import re
|
||||
text = Path(__file__).read_text(encoding="utf-8")
|
||||
sites = [
|
||||
("L216", "detect_refresh_rate_win32"),
|
||||
("L264", "resolve_font_path"),
|
||||
("L612", "post_init_callback"),
|
||||
("L728", "run_immapp"),
|
||||
("L1052", "shutdown_save_ini"),
|
||||
("L1152", "gui_func_entry_log"),
|
||||
("L1466", "close_vscode_diff_terminate"),
|
||||
("L1647", "focus_response_window"),
|
||||
("L1693", "autosave_flush"),
|
||||
("L4911", "on_warmup_complete_callback"),
|
||||
("L6908", "tier_stream_scroll_sync"),
|
||||
("L7271", "dag_cycle_check"),
|
||||
("L7315", "ticket_id_max_int"),
|
||||
]
|
||||
for line, site in sites:
|
||||
# Allow either _result_success/_result_failure OR descriptive suffixes
|
||||
pattern = rf"def test_phase_10_{line.lower()}_{site}_result_(\w+)\("
|
||||
matches = re.findall(pattern, text)
|
||||
assert len(matches) >= 2, (
|
||||
f"Phase 10 invariant: missing tests for {line} {site}. "
|
||||
f"Found {len(matches)} tests matching {pattern}. "
|
||||
f"Need at least 2 (one success-like, one failure-like)."
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user