88from render_machine .actions .base_action import BaseAction
99from render_machine .implementation_code_helpers import ImplementationCodeHelpers
1010from render_machine .render_context import RenderContext
11+ from render_machine .render_types import AcceptanceTestPhase , TestExecutionPhase
1112
1213
1314class RenderConformanceTests (BaseAction ):
@@ -20,19 +21,38 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any |
2021 return self ._render_acceptance_test (render_context )
2122
2223 def _should_render_conformance_tests (self , render_context : RenderContext ) -> bool :
23- return render_context . conformance_tests_running_context . conformance_test_phase_index == 0
24+ """Check if we should render full conformance tests (first time) vs just acceptance tests (incremental)."""
2425
25- def _render_conformance_tests (self , render_context : RenderContext ):
26- if render_context .verbose :
27- console .info ("Implementing test requirements:" )
28- console .print_list (
29- render_context .conformance_tests_running_context .current_testing_frid_specifications [
30- plain_spec .TEST_REQUIREMENTS
31- ],
32- style = console .INFO_STYLE ,
33- )
26+ ctx = render_context .conformance_tests_running_context
27+
28+ # If we're in regression phase, tests already exist - don't render anything new
29+ if ctx .execution_phase == TestExecutionPhase .RUNNING_REGRESSION :
30+ return True # Return True to skip rendering (conformance tests already exist)
31+
32+ # Render full conformance tests when:
33+ # 1. NOT_STARTED: First render, before acceptance tests begin
34+ if ctx .acceptance_test_phase == AcceptanceTestPhase .NOT_STARTED :
35+ return True
3436
37+ # 2. NOT_APPLICABLE: No acceptance tests defined, always use full conformance test path
38+ if ctx .acceptance_test_phase == AcceptanceTestPhase .NOT_APPLICABLE :
39+ # Return True so _render_conformance_tests() is called, which will skip if tests already exist
40+ return True
41+
42+ # 3. All other cases (IN_PROGRESS, COMPLETED): Render acceptance tests incrementally
43+ return False
44+
45+ def _render_conformance_tests (self , render_context : RenderContext ):
46+ # Check if tests already exist (e.g., during regression) - if so, skip rendering
3547 if not render_context .conformance_tests_running_context .current_conformance_tests_exist ():
48+ if render_context .verbose :
49+ console .info ("Implementing test requirements:" )
50+ console .print_list (
51+ render_context .conformance_tests_running_context .current_testing_frid_specifications [
52+ plain_spec .TEST_REQUIREMENTS
53+ ],
54+ style = console .INFO_STYLE ,
55+ )
3656 fr_subfolder_name = render_context .codeplain_api .generate_folder_name_from_functional_requirement (
3757 frid = render_context .conformance_tests_running_context .current_testing_frid ,
3858 module_name = render_context .conformance_tests_running_context .current_testing_module_name ,
@@ -128,6 +148,10 @@ def _render_conformance_tests(self, render_context: RenderContext):
128148 return self .SUCCESSFUL_OUTCOME , None
129149
130150 def _render_acceptance_test (self , render_context : RenderContext ):
151+ if plain_spec .ACCEPTANCE_TESTS not in render_context .frid_context .specifications :
152+ # If there are no acceptance tests defined, continue.
153+ return self .SUCCESSFUL_OUTCOME , None
154+
131155 _ , existing_files_content = ImplementationCodeHelpers .fetch_existing_files (render_context .build_folder )
132156 _ , memory_files_content = MemoryManager .fetch_memory_files (render_context .memory_manager .memory_folder )
133157 (
@@ -140,8 +164,9 @@ def _render_acceptance_test(self, render_context: RenderContext):
140164 render_context .conformance_tests_running_context .get_current_conformance_test_folder_name (),
141165 )
142166
167+ # Get the current acceptance test being rendered (completed count is 1-based)
143168 acceptance_test = render_context .frid_context .specifications [plain_spec .ACCEPTANCE_TESTS ][
144- render_context .conformance_tests_running_context .conformance_test_phase_index - 1
169+ render_context .conformance_tests_running_context .acceptance_tests_completed - 1
145170 ]
146171
147172 if render_context .verbose :
0 commit comments