5.1 KiB
5.1 KiB
Implementation Plan: Test Suite Stabilization & Consolidation (test_stabilization_20260302)
Phase 1: Infrastructure & Paradigm Consolidation
- Task: Initialize MMA Environment
activate_skill mma-orchestrator - Task: Setup Artifact Isolation Directories
- WHERE: Project root
- WHAT: Create
./tests/artifacts/and./tests/logs/directories. Add.gitignoreto both containing*and!.gitignore. - HOW: Use PowerShell
New-ItemandOut-File. - SAFETY: Do not commit artifacts.
- Task: Migrate Manual Launchers to
live_guiFixture- WHERE:
tests/visual_mma_verification.py(lines 15-40),simulation/scripts. - WHAT: Replace
subprocess.Popen(["python", "gui_2.py"])with thelive_guifixture injected intopytesttest functions. Remove manual while-loop sleeps. - HOW: Use standard pytest
def test_... (live_gui):and rely onApiHookClientwith proper timeouts. - SAFETY: Ensure
subprocessis not orphaned if test fails.
- WHERE:
- Task: Conductor - User Manual Verification 'Phase 1: Infrastructure & Consolidation' (Protocol in workflow.md)
Phase 2: Asyncio Stabilization & Logging
- Task: Audit and Fix
conftest.pyLoop Lifecycle- WHERE:
tests/conftest.py:20-50(aroundapp_instancefixture). - WHAT: Ensure the
app._loop.stop()cleanup safely cancels pending background tasks. - HOW: Use
asyncio.all_tasks(loop)andtask.cancel()before stopping the loop in the fixture teardown. - SAFETY: Thread-safety; only cancel tasks belonging to the app's loop.
- WHERE:
- Task: Resolve
Event loop is closedin Core Test Suite- WHERE:
tests/test_spawn_interception.py,tests/test_gui_streaming.py. - WHAT: Update blocking calls to use
ThreadPoolExecutororasyncio.run_coroutine_threadsafe(..., loop). - HOW: Pass the active loop from
app_instanceto the functions triggering the events. - SAFETY: Prevent event queue deadlocks.
- WHERE:
- Task: Implement Centralized Sectioned Logging Utility
- WHERE:
tests/conftest.py:50-80(VerificationLogger). - WHAT: Route
VerificationLoggeroutput to./tests/logs/instead oflogs/test/. - HOW: Update
self.logs_dir = Path(f"tests/logs/{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}"). - SAFETY: No state impact.
- WHERE:
- Task: Conductor - User Manual Verification 'Phase 2: Asyncio & Logging' (Protocol in workflow.md)
Phase 3: Assertion Implementation & Legacy Cleanup
- Task: Replace
pytest.failwith Functional Assertions (api_events,execution_engine)- WHERE:
tests/test_api_events.py:40,tests/test_execution_engine.py:45. - WHAT: Implement actual
assertstatements testing the mock calls and status updates. - HOW: Use
MagicMock.assert_called_withand checkticket.status == "completed". - SAFETY: Isolate mocks.
- WHERE:
- Task: Replace
pytest.failwith Functional Assertions (token_usage,agent_capabilities)- WHERE:
tests/test_token_usage.py,tests/test_agent_capabilities.py. - WHAT: Implement tests verifying the
usage_metadataextraction andlist_modelsoutput count. - HOW: Check for 6 models (including
gemini-2.0-flash) inlist_modelstest. - SAFETY: Isolate mocks.
- WHERE:
- Task: Resolve Simulation Entry Count Regressions
- WHERE:
tests/test_extended_sims.py:20. - WHAT: Fix
AssertionError: Expected at least 2 entries, found 0. - HOW: Update simulation flow to properly wait for the
UserandAIentries to populate the GUI history before asserting. - SAFETY: Use dynamic wait (
ApiHookClient.wait_for_event) instead of static sleeps.
- WHERE:
- Task: Remove Legacy
gui_legacyTest Imports & File- WHERE:
tests/test_gui_events.py,tests/test_gui_updates.py,tests/test_gui_diagnostics.py, and project root. - WHAT: Change
from gui_legacy import Apptofrom gui_2 import App. Fix any breaking UI locators. Then deletegui_legacy.py. - HOW: String replacement and standard
os.remove. - SAFETY: Verify no remaining imports exist across the suite using
grep_search.
- WHERE:
- Task: Conductor - User Manual Verification 'Phase 3: Assertions & Legacy Cleanup' (Protocol in workflow.md)
Phase 4: Documentation & Final Verification
- Task: Model Switch Request
- Ask the user to run the
/modelcommand to switch to a high reasoning model for the documentation phase. Wait for their confirmation before proceeding.
- Ask the user to run the
- Task: Update Core Documentation & Workflow Contract
- WHERE:
Readme.md,docs/guide_simulations.md,conductor/workflow.md. - WHAT: Document artifact locations,
live_guistandard, and the strict "Structural Testing Contract". - HOW: Markdown editing. Add sections explicitly banning arbitrary
unittest.mock.patchon core infra for Tier 3 workers. - SAFETY: Keep formatting clean.
- WHERE:
- Task: Full Suite Validation & Warning Cleanup
- Task: Final Artifact Isolation Verification
- Task: Conductor - User Manual Verification 'Phase 4: Documentation & Final Verification' (Protocol in workflow.md)