2.0 KiB
2.0 KiB
Implementation Plan: Hook API & Test Harness Hardening
Phase 1: Dynamic Port Allocation
- Task: Modify
src/api_hooks.pyto attempt binding to port8999. If unsuccessful, iterate up to9010. - Task: Upon successful binding, write the selected port to a temporary artifact file (e.g.,
.mcp_port). - Task: Update the
live_guifixture intests/conftest.pyto read the assigned port from the artifact file and use it for allApiHookClientrequests. - Task: Conductor - User Manual Verification 'Phase 1: Dynamic Port Allocation' (Protocol in workflow.md)
Phase 2: Graceful Teardown
- Task: Implement a
/api/shutdownPOST endpoint insrc/api_hooks.py. - Task: Ensure the
/api/shutdownendpoint correctly signals theAppControllerandAppto perform a clean exit (e.g., joining threads, writing pending saves). - Task: Update the
live_guifixture to call/api/shutdownduring teardown, relying ontaskkillonly as a last resort if the process fails to exit gracefully within a timeout. - Task: Conductor - User Manual Verification 'Phase 2: Graceful Teardown' (Protocol in workflow.md)
Phase 3: State Serialization Audit
- Task: Audit
src/app_controller.pyto identify all GUI-related state variables that should be exposed to tests (e.g.,show_windows, individual window toggles). - Task: Update
_gettable_fieldsto ensure all necessary state is mapped. - Task: Refine
_serialize_for_apiinsrc/api_hooks.py(or introduce lightweight dataclass parsing) to handle complex nested objects predictably. - Task: Conductor - User Manual Verification 'Phase 3: State Serialization Audit' (Protocol in workflow.md)
Phase 4: Verification
- Task: Write Tests: Create a concurrency test verifying multiple
live_guiinstances can launch simultaneously without port conflicts. - Task: Run the entire test suite to ensure the new dynamic port and graceful shutdown logic has not introduced regressions.
- Task: Conductor - User Manual Verification 'Phase 4: Verification' (Protocol in workflow.md)