Skip to content

Commit 4ce63c5

Browse files
committed
Adding a counter to conflicting requirements.
1 parent da10f63 commit 4ce63c5

3 files changed

Lines changed: 33 additions & 3 deletions

File tree

codeplain_REST_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ def fix_conformance_tests_issue(
345345
implementation_fix_count,
346346
conformance_tests_folder_name,
347347
current_testing_frid_high_level_implementation_plan: Optional[str],
348+
conflicting_requirements_count: int,
348349
run_state: RunState,
349350
):
350351
endpoint_url = f"{self.api_url}/fix_conformance_tests_issue"
@@ -366,6 +367,7 @@ def fix_conformance_tests_issue(
366367
"implementation_fix_count": implementation_fix_count,
367368
"conformance_tests_folder_name": conformance_tests_folder_name,
368369
"current_testing_frid_high_level_implementation_plan": current_testing_frid_high_level_implementation_plan,
370+
"conflicting_requirements_count": conflicting_requirements_count,
369371
}
370372

371373
if acceptance_tests is not None:

render_machine/actions/fix_conformance_test.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class FixConformanceTest(BaseAction):
1515
IMPLEMENTATION_CODE_NOT_UPDATED = "implementation_code_not_updated"
1616
IMPLEMENTATION_CODE_UPDATED = "implementation_code_updated"
1717

18+
ISSUE_REASON_CODE_CONFORMANCE_TESTS = 0
19+
ISSUE_REASON_CODE_IMPLEMENTATION_CODE = 1
20+
ISSUE_REASON_CODE_CONFLICTING_REQUIREMENTS = 2
21+
1822
def execute(self, render_context: RenderContext, previous_action_payload: Any | None):
1923
console.info(
2024
f"Fixing conformance test for functionality {render_context.conformance_tests_running_context.current_testing_frid} in module {render_context.conformance_tests_running_context.current_testing_module_name}."
@@ -53,6 +57,15 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any |
5357
render_context.build_folder, render_context.plain_source_tree, render_context.frid_context.frid
5458
)
5559

60+
conflicting_module_name = render_context.conformance_tests_running_context.conflicting_module_name
61+
conflicting_frid = render_context.conformance_tests_running_context.conflicting_frid
62+
current_testing_module_name = render_context.conformance_tests_running_context.current_testing_module_name
63+
current_testing_frid = render_context.conformance_tests_running_context.current_testing_frid
64+
65+
# Reset the conflicting requirement count if the current testing functionality is not the same as the previously conflicting functionality
66+
if conflicting_module_name != current_testing_module_name or conflicting_frid != current_testing_frid:
67+
render_context.conformance_tests_running_context.conflicting_requirement_count = 0
68+
5669
if render_context.verbose:
5770
tmp_resources_list = []
5871
plain_spec.collect_linked_resources(
@@ -79,7 +92,7 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any |
7992
)
8093

8194
with console.status(console_message):
82-
[conformance_tests_fixed, response_files] = render_context.codeplain_api.fix_conformance_tests_issue(
95+
[issue_reason_code, response_files] = render_context.codeplain_api.fix_conformance_tests_issue(
8396
render_context.frid_context.frid,
8497
render_context.conformance_tests_running_context.current_testing_frid,
8598
render_context.plain_source_tree,
@@ -96,11 +109,21 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any |
96109
render_context.conformance_tests_running_context.fix_attempts,
97110
render_context.conformance_tests_running_context.get_current_conformance_test_folder_name(),
98111
render_context.conformance_tests_running_context.current_testing_frid_high_level_implementation_plan,
112+
render_context.conformance_tests_running_context.conflicting_requirement_count,
99113
run_state=render_context.run_state,
100114
)
101115
code_diff_files_content = {}
102116

103-
if conformance_tests_fixed:
117+
if issue_reason_code == self.ISSUE_REASON_CODE_CONFLICTING_REQUIREMENTS:
118+
render_context.conformance_tests_running_context.conflicting_requirement_count += 1
119+
console.info(
120+
f"Conflicting requirements detected. Conflicting requirement count: {render_context.conformance_tests_running_context.conflicting_requirement_count}"
121+
)
122+
123+
if (
124+
issue_reason_code == self.ISSUE_REASON_CODE_CONFORMANCE_TESTS
125+
or issue_reason_code == self.ISSUE_REASON_CODE_CONFLICTING_REQUIREMENTS
126+
):
104127
render_context.conformance_tests.store_conformance_tests_files(
105128
render_context.module_name,
106129
render_context.required_modules,

render_machine/render_types.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def __init__(
3232
current_testing_frid_specifications: Optional[dict[str, list]],
3333
conformance_test_phase_index: int,
3434
should_prepare_testing_environment: bool,
35+
conflicting_requirement_count: int = 0,
36+
conflicting_module_name: Optional[str] = None,
37+
conflicting_frid: Optional[str] = None,
3538
):
3639
self.current_testing_module_name = current_testing_module_name
3740
self.current_testing_frid = current_testing_frid
@@ -41,7 +44,9 @@ def __init__(
4144
self.current_testing_frid_specifications = current_testing_frid_specifications
4245
self.conformance_test_phase_index = conformance_test_phase_index
4346
self.should_prepare_testing_environment = should_prepare_testing_environment
44-
47+
self.conflicting_requirement_count = conflicting_requirement_count
48+
self.conflicting_module_name = conflicting_module_name
49+
self.conflicting_frid = conflicting_frid
4550
# will be propagated only when:
4651
# - current_testing_frid == frid noqa: E800
4752
# - conformance_test_phase_index == 0 (conformance tests phase)

0 commit comments

Comments
 (0)