conductor(checkpoint): Test integrity audit complete

This commit is contained in:
2026-03-07 20:15:22 -05:00
parent d2521d6502
commit c2930ebea1
16 changed files with 233 additions and 80 deletions

View File

@@ -1,3 +1,8 @@
"""
ANTI-SIMPLIFICATION: These tests verify that the GUI maintains a strict performance baseline.
They MUST NOT be simplified. Removing assertions or adding arbitrary skips when metrics fail to collect defeats the purpose of the test.
If the GUI cannot sustain 30 FPS, it indicates a critical performance regression in the render loop.
"""
import pytest
import time
import sys
@@ -14,7 +19,8 @@ _shared_metrics = {}
def test_performance_benchmarking(live_gui: tuple) -> None:
"""
Collects performance metrics for the current GUI script.
Collects performance metrics for the current GUI script over a 5-second window.
Ensures the application does not lock up and can report its internal state.
"""
process, gui_script = live_gui
client = ApiHookClient()
@@ -51,19 +57,22 @@ def test_performance_benchmarking(live_gui: tuple) -> None:
print(f"\n[Test] Results for {gui_script}: FPS={avg_fps:.2f}, CPU={avg_cpu:.2f}%, FT={avg_ft:.2f}ms")
# Absolute minimum requirements
if avg_fps > 0:
# ANTI-SIMPLIFICATION: 30 FPS threshold ensures the app remains interactive.
assert avg_fps >= 30, f"{gui_script} FPS {avg_fps:.2f} is below 30 FPS threshold"
assert avg_ft <= 33.3, f"{gui_script} Frame time {avg_ft:.2f}ms is above 33.3ms threshold"
def test_performance_baseline_check() -> None:
"""
Verifies that we have performance metrics for sloppy.py.
Verifies that we have successfully collected performance metrics for sloppy.py
and that they meet the minimum 30 FPS baseline.
"""
# Key is full path, find it by basename
gui_key = next((k for k in _shared_metrics if "sloppy.py" in k), None)
if not gui_key:
pytest.skip("Metrics for sloppy.py not yet collected.")
gui2_m = _shared_metrics[gui_key]
if gui2_m["avg_fps"] == 0:
pytest.skip("No performance metrics collected - GUI may not be running")
# ANTI-SIMPLIFICATION: If avg_fps is 0, the test MUST fail, not skip.
# A 0 FPS indicates the render loop is completely frozen or the API hook is dead.
assert gui2_m["avg_fps"] > 0, "No performance metrics collected - GUI may be frozen"
assert gui2_m["avg_fps"] >= 30
assert gui2_m["avg_ft"] <= 33.3