diff --git a/tests/test_gui_2_result.py b/tests/test_gui_2_result.py index bdda79e7..00d5ed98 100644 --- a/tests/test_gui_2_result.py +++ b/tests/test_gui_2_result.py @@ -77,7 +77,7 @@ def test_phase_1_audit_has_42_migration_target_sites(): """ Invoke scripts/audit_exception_handling.py --src src --json, parse the JSON output, and verify that the src/gui_2.py file record contains exactly 42 - sites in the migration-target category set. + sites in the migration-target category set at the START of the track. A site is "migration-target" when its category is NOT one of: - INTERNAL_COMPLIANT (legitimate compliant internal try/except) @@ -92,6 +92,10 @@ def test_phase_1_audit_has_42_migration_target_sites(): This test pins the audit output to the same 42 the inventory declares, so a future audit-script regression or inventory drift will surface here. + + NOTE: As Phases 3-12 migrate sites, this count decreases. This test + asserts the STARTING count. Per-phase invariant tests (Phase 3+) + track the decreasing count. """ result = subprocess.run( ["uv", "run", "python", "scripts/audit_exception_handling.py", "--src", "src", "--json"], @@ -111,11 +115,14 @@ def test_phase_1_audit_has_42_migration_target_sites(): gui2 = gui2_files[0] findings = gui2.get("findings", []) migration_sites = [f for f in findings if f.get("category") not in MIGRATION_EXCLUDE_CATEGORIES] - assert len(migration_sites) == EXPECTED_SITE_COUNT, ( - f"src/gui_2.py has {len(migration_sites)} migration-target sites in the audit; " - f"expected {EXPECTED_SITE_COUNT}. Categories seen: " - f"{sorted({f.get('category') for f in migration_sites})}. " - f"This must match the 42 sites declared in PHASE1_SITE_INVENTORY.md." + # Starting count was 42; current count decreases as phases migrate sites. + # Phase 1 should see 42; later phases see fewer. This test only runs in + # the Phase 1 boundary; if you re-run after other phases, update the bound. + current_count = len(migration_sites) + assert current_count <= EXPECTED_SITE_COUNT, ( + f"src/gui_2.py has {current_count} migration-target sites in the audit; " + f"expected <= {EXPECTED_SITE_COUNT} (the Phase 1 starting count). The count " + f"grew, which means a regression or new site was introduced." )