@@ -35,8 +35,8 @@ class UnitTestsStateConfig:
3535 """Dataclass for unit test state configuration."""
3636
3737 unit_tests_failed_on_enter_function : Callable
38- on_enter_action : str
39- on_exit_action : str
38+ on_enter_action : Callable
39+ on_exit_action : Callable
4040
4141
4242class UnitTestsConfig :
@@ -47,26 +47,26 @@ def for_refactoring(render_context: RenderContext) -> UnitTestsStateConfig:
4747 """Configuration for unit tests during refactoring."""
4848 return UnitTestsStateConfig (
4949 unit_tests_failed_on_enter_function = render_context .start_fixing_unit_tests_in_refactoring ,
50- on_enter_action = " start_unittests_processing_in_refactoring" ,
51- on_exit_action = " finish_unittests_processing" ,
50+ on_enter_action = render_context . start_unittests_processing_in_refactoring ,
51+ on_exit_action = render_context . finish_unittests_processing ,
5252 )
5353
5454 @staticmethod
5555 def for_conformance_tests (render_context : RenderContext ) -> UnitTestsStateConfig :
5656 """Configuration for unit tests during conformance tests."""
5757 return UnitTestsStateConfig (
5858 unit_tests_failed_on_enter_function = render_context .start_fixing_unit_tests_in_conformance_tests ,
59- on_enter_action = " start_unittests_processing_in_conformance_tests" ,
60- on_exit_action = " finish_unittests_processing" ,
59+ on_enter_action = render_context . start_unittests_processing_in_conformance_tests ,
60+ on_exit_action = render_context . finish_unittests_processing ,
6161 )
6262
6363 @staticmethod
6464 def for_implementation (render_context : RenderContext ) -> UnitTestsStateConfig :
6565 """Configuration for unit tests during initial implementation."""
6666 return UnitTestsStateConfig (
6767 unit_tests_failed_on_enter_function = render_context .start_fixing_unit_tests ,
68- on_enter_action = " start_unittests_processing_in_implementation" ,
69- on_exit_action = " finish_unittests_processing_during_implementation" ,
68+ on_enter_action = render_context . start_unittests_processing_in_implementation ,
69+ on_exit_action = render_context . finish_unittests_processing_during_implementation ,
7070 )
7171
7272
@@ -174,22 +174,22 @@ def get_processing_conformance_tests_states(self, render_context: RenderContext)
174174 return {
175175 "name" : States .PROCESSING_CONFORMANCE_TESTS .value ,
176176 "initial" : States .CONFORMANCE_TESTING_INITIALISED .value ,
177- "on_enter" : " start_conformance_tests_processing" ,
178- "on_exit" : " finish_conformance_tests_processing" ,
177+ "on_enter" : render_context . start_conformance_tests_processing ,
178+ "on_exit" : render_context . finish_conformance_tests_processing ,
179179 "children" : [
180180 {
181181 "name" : States .CONFORMANCE_TESTING_INITIALISED .value ,
182- "on_enter" : " start_conformance_tests_for_frid" ,
182+ "on_enter" : render_context . start_conformance_tests_for_frid ,
183183 },
184184 {
185185 "name" : States .CONFORMANCE_TEST_GENERATED .value ,
186- "on_enter" : " start_testing_environment_preparation" ,
186+ "on_enter" : render_context . start_testing_environment_preparation ,
187187 },
188188 States .CONFORMANCE_TEST_ENV_PREPARED .value ,
189189 {
190190 "name" : States .CONFORMANCE_TEST_FAILED .value ,
191- "on_enter" : " start_fixing_conformance_tests" ,
192- "on_exit" : " finish_fixing_conformance_tests" ,
191+ "on_enter" : render_context . start_fixing_conformance_tests ,
192+ "on_exit" : render_context . finish_fixing_conformance_tests ,
193193 },
194194 self .get_processing_unit_tests_states (UnitTestsConfig .for_conformance_tests (render_context )),
195195 self .get_postprocessing_conformance_tests_states (),
@@ -208,8 +208,8 @@ def get_states(self, render_context: RenderContext) -> List[Any]:
208208 refactoring_code_states = {
209209 "name" : States .REFACTORING_CODE .value ,
210210 "initial" : States .READY_FOR_REFACTORING .value ,
211- "on_enter" : " start_refactoring_code" ,
212- "on_exit" : " finish_refactoring_code" ,
211+ "on_enter" : render_context . start_refactoring_code ,
212+ "on_exit" : render_context . finish_refactoring_code ,
213213 "children" : [
214214 States .READY_FOR_REFACTORING .value ,
215215 self .get_processing_unit_tests_states (UnitTestsConfig .for_refactoring (render_context )),
@@ -222,24 +222,30 @@ def get_states(self, render_context: RenderContext) -> List[Any]:
222222 {
223223 "name" : States .IMPLEMENTING_FRID .value ,
224224 "initial" : States .READY_FOR_FRID_IMPLEMENTATION .value ,
225- "on_enter" : " start_implementing_frid" ,
226- "on_exit" : " finish_implementing_frid" ,
225+ "on_enter" : render_context . start_implementing_frid ,
226+ "on_exit" : render_context . finish_implementing_frid ,
227227 "children" : [
228- {"name" : States .STEP_COMPLETED .value , "on_exit" : "finish_frid_implementation_step" },
229- {"name" : States .READY_FOR_FRID_IMPLEMENTATION .value , "on_enter" : "check_frid_iteration_limit" },
228+ {"name" : States .STEP_COMPLETED .value , "on_exit" : render_context .finish_frid_implementation_step },
229+ {
230+ "name" : States .READY_FOR_FRID_IMPLEMENTATION .value ,
231+ "on_enter" : render_context .check_frid_iteration_limit ,
232+ },
230233 self .get_processing_unit_tests_states (UnitTestsConfig .for_implementation (render_context )),
231234 refactoring_code_states ,
232235 self .get_processing_conformance_tests_states (render_context ),
233236 States .FRID_FULLY_IMPLEMENTED .value ,
234237 ],
235238 },
236- {"name" : States .RENDER_COMPLETED .value , "on_enter" : " start_render_completed" },
237- {"name" : States .RENDER_FAILED .value , "on_enter" : " start_render_failed" },
239+ {"name" : States .RENDER_COMPLETED .value , "on_enter" : render_context . start_render_completed },
240+ {"name" : States .RENDER_FAILED .value , "on_enter" : render_context . start_render_failed },
238241 ]
239242
240- def get_transitions (self ) -> List [Dict [str , Any ]]:
243+ def get_transitions (self , render_context : RenderContext ) -> List [Dict [str , Any ]]:
241244 """Get the complete state machine transition configuration.
242245
246+ Args:
247+ render_context: The render context object containing condition methods.
248+
243249 Returns:
244250 List of transition definitions for the hierarchical state machine.
245251 """
@@ -253,13 +259,13 @@ def get_transitions(self) -> List[Dict[str, Any]]:
253259 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .READY_FOR_FRID_IMPLEMENTATION .value } " ,
254260 "trigger" : triggers .RENDER_FUNCTIONAL_REQUIREMENT ,
255261 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_UNIT_TESTS .value } " ,
256- "conditions" : " should_run_unit_tests" ,
262+ "conditions" : render_context . should_run_unit_tests ,
257263 },
258264 {
259265 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .READY_FOR_FRID_IMPLEMENTATION .value } " ,
260266 "trigger" : triggers .RENDER_FUNCTIONAL_REQUIREMENT ,
261267 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .STEP_COMPLETED .value } " ,
262- "unless" : " should_run_unit_tests" ,
268+ "unless" : render_context . should_run_unit_tests ,
263269 },
264270 {
265271 "source" : "*" ,
@@ -295,25 +301,25 @@ def get_transitions(self) -> List[Dict[str, Any]]:
295301 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .READY_FOR_REFACTORING .value } " ,
296302 "trigger" : triggers .REFACTOR_CODE ,
297303 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .PROCESSING_UNIT_TESTS .value } " ,
298- "conditions" : " should_run_unit_tests" ,
304+ "conditions" : render_context . should_run_unit_tests ,
299305 },
300306 {
301307 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .READY_FOR_REFACTORING .value } " ,
302308 "trigger" : triggers .REFACTOR_CODE ,
303309 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .STEP_COMPLETED .value } " ,
304- "unless" : " should_run_unit_tests" ,
310+ "unless" : render_context . should_run_unit_tests ,
305311 },
306312 {
307313 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .READY_FOR_REFACTORING .value } " ,
308314 "trigger" : triggers .PROCEED_FRID_PROCESSING ,
309315 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } " ,
310- "conditions" : " should_run_conformance_tests" ,
316+ "conditions" : render_context . should_run_conformance_tests ,
311317 },
312318 {
313319 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .READY_FOR_REFACTORING .value } " ,
314320 "trigger" : triggers .PROCEED_FRID_PROCESSING ,
315321 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .FRID_FULLY_IMPLEMENTED .value } " ,
316- "unless" : " should_run_conformance_tests" ,
322+ "unless" : render_context . should_run_conformance_tests ,
317323 },
318324 {
319325 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } " ,
@@ -344,13 +350,13 @@ def get_transitions(self) -> List[Dict[str, Any]]:
344350 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .FRID_FULLY_IMPLEMENTED .value } " ,
345351 "trigger" : triggers .PROCEED_FRID_PROCESSING ,
346352 "dest" : f"{ States .IMPLEMENTING_FRID .value } " ,
347- "conditions" : " has_next_frid" ,
353+ "conditions" : render_context . has_next_frid ,
348354 },
349355 {
350356 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .FRID_FULLY_IMPLEMENTED .value } " ,
351357 "trigger" : triggers .PROCEED_FRID_PROCESSING ,
352358 "dest" : States .RENDER_COMPLETED .value ,
353- "unless" : " has_next_frid" ,
359+ "unless" : render_context . has_next_frid ,
354360 },
355361 {
356362 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .REFACTORING_CODE .value } _{ States .PROCESSING_UNIT_TESTS .value } _{ States .UNIT_TESTS_READY .value } " ,
@@ -411,13 +417,13 @@ def get_transitions(self) -> List[Dict[str, Any]]:
411417 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } _{ States .CONFORMANCE_TEST_FAILED .value } " ,
412418 "trigger" : triggers .MARK_UNIT_TESTS_READY ,
413419 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } _{ States .PROCESSING_UNIT_TESTS .value } " ,
414- "conditions" : " should_run_unit_tests" ,
420+ "conditions" : render_context . should_run_unit_tests ,
415421 },
416422 {
417423 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } _{ States .CONFORMANCE_TEST_FAILED .value } " ,
418424 "trigger" : triggers .MARK_UNIT_TESTS_READY ,
419425 "dest" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } _{ States .CONFORMANCE_TEST_ENV_PREPARED .value } " ,
420- "unless" : " should_run_unit_tests" ,
426+ "unless" : render_context . should_run_unit_tests ,
421427 },
422428 {
423429 "source" : f"{ States .IMPLEMENTING_FRID .value } _{ States .PROCESSING_CONFORMANCE_TESTS .value } _{ States .PROCESSING_UNIT_TESTS .value } _{ States .UNIT_TESTS_READY .value } " ,
0 commit comments