feat(training): expose curriculum parameters (depth_slope and max_depth) at training time#139
Conversation
Move parameter validation into a dedicated helper function to reduce branching. This refactor resolves Ruff warning: PLR0912 Too many branches (14 > 12) --> qiskit-gym-mcp-server/src/qiskit_gym_mcp_server/training.py:248:11
Code reviewOverall this is a clean, well-structured feature addition. Two items worth discussing: 1. Dead assertions in The config-dict assertions on lines 175-179 and 186-189 never execute. mcp-servers/qiskit-gym-mcp-server/tests/test_training.py Lines 174 to 179 in 9cffb50 One fix: set up the mock with a real config dict before calling mock_instance = mock_permutation_gym.return_value
mock_instance.config = {}
mock_instance._raw_env.config = {}2. If the gym instance doesn't already have mcp-servers/qiskit-gym-mcp-server/src/qiskit_gym_mcp_server/training.py Lines 224 to 227 in 9cffb50 🤖 Generated with Claude Code |
cbjuan
left a comment
There was a problem hiding this comment.
Both review items addressed. Tests now properly cover all override paths (attributes, config dicts, _raw_env), and the warning log improves debuggability. LGTM.
Description
This PR extends start_training to support curriculum parameters configuration by exposing
depth_slopeandmax_depthas optional parameters.Linked Issue(s)
Fixes #130
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
test_start_training_applies_curriculum_overrides: Test that depth_slope and max_depth overrides are applied to the environment instance before RLSynthesis is instantiated.test_start_training_invalid_depth_slope: Test error when depth_slope is less than 1.test_start_training_invalid_max_depth: Test error when max_depth is less than 1.Test Configuration:
Checklist: