codeplain 0.3.13.dev48__py3-none-any.whl → 0.3.14.dev50__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. change_detection.py +65 -94
  2. cli_output/dry_run.py +7 -3
  3. {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/METADATA +1 -1
  4. {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/RECORD +49 -43
  5. codeplain_REST_api.py +9 -14
  6. docs/generate_cli.py +3 -2
  7. partial_rendering.py +32 -2
  8. plain2code.py +42 -14
  9. plain2code_arguments.py +69 -12
  10. plain2code_telemetry.py +2 -1
  11. plain2code_utils.py +14 -0
  12. plain_modules.py +73 -14
  13. render_machine/actions/analyze_specification_ambiguity.py +5 -3
  14. render_machine/actions/distill_conformance_test_memory.py +3 -1
  15. render_machine/actions/fix_conformance_test.py +4 -4
  16. render_machine/actions/fix_unit_tests.py +3 -1
  17. render_machine/actions/refactor_code.py +6 -1
  18. render_machine/actions/render_conformance_tests.py +52 -20
  19. render_machine/actions/render_functional_requirement.py +5 -2
  20. render_machine/actions/run_conformance_tests.py +3 -2
  21. render_machine/actions/summarize_conformance_tests.py +3 -1
  22. render_machine/render_context.py +59 -20
  23. render_machine/render_types.py +6 -15
  24. standard_template_library/typescript-react-app-boilerplate.plain +2 -1
  25. tests/test_acceptance_scenario_rendered_once.py +169 -0
  26. tests/test_acceptance_scenarios_after_a_code_fix.py +110 -0
  27. tests/test_change_detection.py +138 -127
  28. tests/test_conformance_fix_journal.py +46 -46
  29. tests/test_dry_run_link_validation.py +2 -1
  30. tests/test_fix_unit_tests_action.py +1 -1
  31. tests/test_frid_arguments.py +40 -0
  32. tests/test_functionality_without_scenarios.py +88 -0
  33. tests/test_git_utils.py +13 -13
  34. tests/test_partial_rendering.py +82 -47
  35. tests/test_plain2code.py +39 -41
  36. tests/test_plain2code_utils.py +12 -1
  37. tests/test_plain_modules.py +50 -44
  38. tests/test_render_finished_report.py +2 -0
  39. tests/test_render_range.py +18 -9
  40. tests/test_render_stop_reason.py +5 -5
  41. tests/test_telemetry.py +2 -2
  42. tests/test_terminal_attachment.py +2 -1
  43. tests/test_tests_folders.py +91 -0
  44. tests/test_traceability_warnings.py +69 -0
  45. tui/plain_module_render_choice_tui.py +4 -6
  46. tui/state_handlers.py +19 -28
  47. {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/WHEEL +0 -0
  48. {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/entry_points.txt +0 -0
  49. {codeplain-0.3.13.dev48.dist-info → codeplain-0.3.14.dev50.dist-info}/licenses/LICENSE +0 -0
change_detection.py CHANGED
@@ -42,8 +42,7 @@ def determine_partial_render_start(plain_module: "PlainModule") -> PartialRender
42
42
  if not changes:
43
43
  continue
44
44
 
45
- current_fr_count = len(module._get_module_functional_requirements())
46
- earliest_frid = _get_earliest_affected_frid(changes, current_fr_count)
45
+ earliest_frid = _get_earliest_affected_frid(changes, _stored_frids(module), _current_frids(module))
47
46
  if earliest_frid is None:
48
47
  continue
49
48
  return PartialRenderStart(module=module, frid=earliest_frid)
@@ -66,125 +65,97 @@ def _non_functional_content_changed(module: "PlainModule") -> bool:
66
65
  return stored_hash != module.get_module_non_functional_source_hash()
67
66
 
68
67
 
69
- def _get_earliest_affected_frid(changes: list[FunctionalityChange], current_fr_count: int) -> str | None:
70
- """Earliest FRID (in current spec numbering) that must be re-rendered.
68
+ def _stored_functionalities(module: "PlainModule") -> list[dict[str, str]]:
69
+ metadata = module.load_module_metadata()
70
+ return metadata.get(MODULE_FUNCTIONALITIES_KEY, []) if metadata else []
71
+
72
+
73
+ def _stored_frids(module: "PlainModule") -> list[str]:
74
+ return [functionality["id"] for functionality in _stored_functionalities(module)]
75
+
76
+
77
+ def _current_frids(module: "PlainModule") -> list[str]:
78
+ return [functionality["id"] for functionality in module._get_module_functional_requirements()]
79
+
71
80
 
72
- Returns the minimum position across all changes:
73
- - added / edited: the FRID itself.
74
- - removed: the position the removal opened up (now occupied by the next FR).
75
- - moved: the FR's old position.
81
+ def _get_earliest_affected_frid(
82
+ changes: list[FunctionalityChange], old_frids: list[str], new_frids: list[str]
83
+ ) -> str | None:
84
+ """The func-id of the earliest functionality in the new order that must be re-rendered.
76
85
 
77
- Correctness does not rely on any single change type's position being individually
78
- "the" earliest (in particular, a move's old position is *not* always its earliest
79
- touched position once moves mix with adds/removes). The guarantee is structural:
80
- the first index at which the new spec diverges from the old is always emitted as
81
- some change anchored at that index — a move with that old position, or an
82
- edit/removal/addition there — so the minimum over all change FRIDs lands at or
83
- before the true first divergence. Rendering runs from this FRID to the end of the
84
- module, so an at-or-before start point is always safe (it can re-render unchanged
85
- trailing FRs, but never skips a changed one).
86
+ Rendering runs from this functionality to the end of the module, so an at-or-before start
87
+ point is always safe: it can re-render unchanged trailing functionalities, but never skips
88
+ a changed one.
86
89
 
87
- Returns None when every change is a removal beyond the current spec length
88
- (only trailing FRs were removed, so nothing needs rendering).
90
+ Returns None when every change is a removal past the end of the new order (only trailing
91
+ functionalities were removed, so nothing needs rendering).
89
92
  """
90
93
  earliest = None
91
94
  for change in changes:
92
- frid_int = int(change.frid)
93
- if change.change_type == "removed" and frid_int > current_fr_count:
95
+ position = _affected_position(change, old_frids, new_frids)
96
+ if position is None:
94
97
  continue
95
- if earliest is None or frid_int < earliest:
96
- earliest = frid_int
98
+ if earliest is None or position < earliest:
99
+ earliest = position
97
100
  if earliest is None:
98
101
  return None
99
- return str(earliest)
102
+ return new_frids[earliest]
103
+
104
+
105
+ def _affected_position(change: FunctionalityChange, old_frids: list[str], new_frids: list[str]) -> int | None:
106
+ """Where in the new order the change must be rendered from.
107
+
108
+ A removed functionality has no place in the new order, so the one that took its place is
109
+ rendered instead. A removal past the end of the new order needs no render.
110
+ """
111
+ if change.change_type == "removed":
112
+ position = old_frids.index(change.frid)
113
+ return position if position < len(new_frids) else None
114
+
115
+ return new_frids.index(change.frid)
100
116
 
101
117
 
102
118
  def _detect_module_changes(module: "PlainModule") -> list[FunctionalityChange]:
103
- metadata = module.load_module_metadata()
104
- old_frs: list[str] = metadata.get(MODULE_FUNCTIONALITIES_KEY, []) if metadata else []
105
- new_frs: list[str] = module._get_module_functional_requirements()
119
+ old_frs = _stored_functionalities(module)
120
+ new_frs = module._get_module_functional_requirements()
106
121
 
107
122
  if old_frs == new_frs:
108
123
  return []
109
124
 
110
- moves, edits, removed, added = _classify_changes(old_frs, new_frs)
125
+ old_frids = [functionality["id"] for functionality in old_frs]
126
+ new_frids = [functionality["id"] for functionality in new_frs]
127
+ old_markdown = {functionality["id"]: functionality["markdown"] for functionality in old_frs}
111
128
 
112
129
  changes: list[FunctionalityChange] = []
113
130
  name = module.module_name
114
131
 
115
- for old_idx, new_idx in moves:
116
- old_frid = _frid_from_index(old_idx)
117
- new_frid = _frid_from_index(new_idx)
118
- changes.append(FunctionalityChange(module=name, frid=old_frid, change_type="moved", detail=new_frid))
132
+ for frid in _moved_frids(old_frids, new_frids):
133
+ changes.append(FunctionalityChange(module=name, frid=frid, change_type="moved"))
119
134
 
120
- for idx in edits:
121
- changes.append(FunctionalityChange(module=name, frid=_frid_from_index(idx), change_type="edited"))
135
+ for functionality in new_frs:
136
+ frid = functionality["id"]
137
+ if frid in old_markdown and functionality["markdown"] != old_markdown[frid]:
138
+ changes.append(FunctionalityChange(module=name, frid=frid, change_type="edited"))
122
139
 
123
- for idx in removed:
124
- changes.append(FunctionalityChange(module=name, frid=_frid_from_index(idx), change_type="removed"))
140
+ for frid in old_frids:
141
+ if frid not in new_frids:
142
+ changes.append(FunctionalityChange(module=name, frid=frid, change_type="removed"))
125
143
 
126
- for idx in added:
127
- changes.append(FunctionalityChange(module=name, frid=_frid_from_index(idx), change_type="added"))
144
+ for frid in new_frids:
145
+ if frid not in old_markdown:
146
+ changes.append(FunctionalityChange(module=name, frid=frid, change_type="added"))
128
147
 
129
148
  return changes
130
149
 
131
150
 
132
- def _classify_changes(
133
- old_frs: list[str], new_frs: list[str]
134
- ) -> tuple[list[tuple[int, int]], list[int], list[int], list[int]]:
135
- matched_old: set[int] = set()
136
- matched_new: set[int] = set()
151
+ def _moved_frids(old_frids: list[str], new_frids: list[str]) -> list[str]:
152
+ """The func-ids the two orders keep but place differently, in the new order.
137
153
 
138
- for i in range(min(len(old_frs), len(new_frs))):
139
- if old_frs[i] == new_frs[i]:
140
- matched_old.add(i)
141
- matched_new.add(i)
142
-
143
- content_matches: list[tuple[int, int]] = []
144
- for old_idx in range(len(old_frs)):
145
- if old_idx in matched_old:
146
- continue
147
- for new_idx in range(len(new_frs)):
148
- if new_idx in matched_new:
149
- continue
150
- if old_frs[old_idx] == new_frs[new_idx]:
151
- content_matches.append((old_idx, new_idx))
152
- matched_old.add(old_idx)
153
- matched_new.add(new_idx)
154
- break
155
-
156
- moves: list[tuple[int, int]] = []
157
- if content_matches and _has_relative_order_change(content_matches):
158
- moves = content_matches
159
-
160
- edits: list[int] = []
161
- for i in range(min(len(old_frs), len(new_frs))):
162
- if i not in matched_old and i not in matched_new:
163
- edits.append(i)
164
- matched_old.add(i)
165
- matched_new.add(i)
166
-
167
- removed = [i for i in range(len(old_frs)) if i not in matched_old]
168
- added = [i for i in range(len(new_frs)) if i not in matched_new]
169
-
170
- return moves, edits, removed, added
171
-
172
-
173
- def _has_relative_order_change(matches: list[tuple[int, int]]) -> bool:
174
- """Check if content matches represent a true reorder (relative order changed).
175
-
176
- If all matches preserve relative order (sorted by old_idx gives same ordering
177
- as sorted by new_idx), it's just a positional shift from insertions/removals.
154
+ Only the functionalities present in both orders are compared, so an addition or a removal
155
+ alone shifts no one: it is a move only when the kept functionalities swap places.
178
156
  """
179
- if len(matches) <= 1:
180
- return False
181
- sorted_by_old = sorted(matches, key=lambda m: m[0])
182
- new_indices = [m[1] for m in sorted_by_old]
183
- for i in range(len(new_indices) - 1):
184
- if new_indices[i] > new_indices[i + 1]:
185
- return True
186
- return False
187
-
157
+ kept = set(old_frids) & set(new_frids)
158
+ old_order = [frid for frid in old_frids if frid in kept]
159
+ new_order = [frid for frid in new_frids if frid in kept]
188
160
 
189
- def _frid_from_index(index: int) -> str:
190
- return str(index + 1)
161
+ return [frid for position, frid in enumerate(new_order) if old_order[position] != frid]
cli_output/dry_run.py CHANGED
@@ -22,9 +22,13 @@ def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[st
22
22
  f"{functional_requirement_text}\n"
23
23
  "-------------------------------------\n"
24
24
  )
25
- if plain_spec.ACCEPTANCE_TESTS in specifications:
26
- for i, acceptance_test in enumerate(specifications[plain_spec.ACCEPTANCE_TESTS], 1):
27
- console.info(f"Generating acceptance test #{i}:\n\n{acceptance_test}\n")
25
+ for section, label in (
26
+ (plain_spec.CONFORMANCE_TESTS, "Conformance scenarios"),
27
+ (plain_spec.ACCEPTANCE_TESTS, "Acceptance scenarios"),
28
+ ):
29
+ scenario_ids = [scenario["id"] for scenario in specifications.get(section) or []]
30
+ if scenario_ids:
31
+ console.info(f"{label}: {', '.join(scenario_ids)}\n")
28
32
  else:
29
33
  console.info(
30
34
  "-------------------------------------\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codeplain
3
- Version: 0.3.13.dev48
3
+ Version: 0.3.14.dev50
4
4
  Summary: Transform plain language specifications into working code
5
5
  License-File: LICENSE
6
6
  Classifier: Environment :: Console
@@ -1,5 +1,5 @@
1
- change_detection.py,sha256=CazORZrezeZSw2I6VBvieN-c2SEjieZPo6pNrKwmMVA,6915
2
- codeplain_REST_api.py,sha256=KJeFKBeVqbTr3RlINqiL5Q4roooJ1ISYlix1_KxqF9w,25262
1
+ change_detection.py,sha256=Fy1qsfX13NMUFAQEWFhi4OGfswb0a-WDPIBoY1wnArA,5914
2
+ codeplain_REST_api.py,sha256=K4Sq7Ch2O5U1-Z8WgmMqxe9WgM12QqFMU1YO0jjNX5A,25056
3
3
  concept_utils.py,sha256=vzwC0_0HOZtPerDs7qPmjtyPleQNiuQ4CcmCKoIy7EM,141
4
4
  conformance_fix_journal.py,sha256=7wL3UOc3BWaUo5MCmiFbb3kIwOQ6iEpdQSyEmedo8Vk,9488
5
5
  diff_utils.py,sha256=AjiQlqo5pRos_8hVXZo5yBurl5BzSrTMGrQv4dCtRCg,1198
@@ -10,10 +10,10 @@ git_utils.py,sha256=gCUA6_9zg19f6k_0aVcRnIVlAJSBD0Vt6takx-0pKME,16547
10
10
  memory_management.py,sha256=CwIOQqF7Xo1sNfvP69zQRK_CpjinQD9dbolhRPl6lTk,2446
11
11
  metadata_utils.py,sha256=YO17o7IAma5TT1ZN0pTwrLVr_KxFQ8APv02KqKPpI5k,1641
12
12
  module_renderer.py,sha256=OvIgAorSxGwrdTZcKy4hdmNgkdJGh6z6-VzzqrTlRHs,6966
13
- partial_rendering.py,sha256=uzZc2j4d3pAXzfiHw_y1TK4yLRsLOb1Mm21570AGxJ8,13837
13
+ partial_rendering.py,sha256=7LbLE2XoQVkR2L0TQX0iOr8-GsTy2okWsYRd3P49pqU,15205
14
14
  path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
15
- plain2code.py,sha256=M4Z2qIHjk9fEYlxINyeKrpCbbv6NpZ5kmTDbGvDLXtc,22840
16
- plain2code_arguments.py,sha256=7TS2P351jmmyi-l8QKCHG732O3TtQ0kh4qbh14_4oLw,18634
15
+ plain2code.py,sha256=HYhUaZK37kMUHRX2LnuJfBDDLgTZWo0t7lOXzu5Yui4,23814
16
+ plain2code_arguments.py,sha256=3PvJg1otzH5GtQGkaP4LQD6xzsCAFtq2-Ohv82hOz3Q,20515
17
17
  plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
18
18
  plain2code_events.py,sha256=rgDF5PDtNr_lEPvJmd1tIQXZrzwgzZW5b-_pykugqe4,1587
19
19
  plain2code_exceptions.py,sha256=zlszHIhaPWPN4fvYQibMIDM7f1xsW5J8sEWTOosIUGc,2068
@@ -21,88 +21,94 @@ plain2code_logger.py,sha256=YQ-ENYBHKXROVv6Q52xh7eXrFkj_3Lex__N9zfxlw9Y,5729
21
21
  plain2code_nodes.py,sha256=QCC9RYBBfHycahvYovcN414sRlGL-dqRV3Baeu7KPkw,140
22
22
  plain2code_read_config.py,sha256=D5CxnmTRjddupecWvstcUm0kIJWWzq5-Zmk6sU0wbIg,2235
23
23
  plain2code_state.py,sha256=jIo4knKI99C1xkX1E_OaD3pdS9pczI2h9wofDjifMvE,3348
24
- plain2code_telemetry.py,sha256=e4UCAoFklJMDWGQsL50i7nTLiOBy8gs86A0XO4WLgPo,4597
25
- plain2code_utils.py,sha256=-MOISy5nwu9szDasckFYe6wOTkEeEAkLaq6deprRg78,1095
24
+ plain2code_telemetry.py,sha256=NO8zw1i3ucM6Z9xQoSCeWqC5Hr-9Oql58YtgEOhBnaQ,4683
25
+ plain2code_utils.py,sha256=GKAUA0sGfYsMAge81hJotPLsfB2akCVN70Bpw_0qrH0,1615
26
26
  plain_file.py,sha256=50CevjRihjddXbc3WzKKJF_kaVcMHUJ1FH2HJUZawT8,138
27
- plain_modules.py,sha256=nXlmw0J2rKkuU1Y3A68LVtZ1Ffdc-D5iMjxaXSaSHTQ,25963
27
+ plain_modules.py,sha256=3xc6tYbWB17YWIG9SfZ_SKYX3hnoC5y_n5RyaN9Lec0,28903
28
28
  plain_spec.py,sha256=AhDbw4GSQ95wC8fkFSPG66MsCu-37Kcz8Skcj66fQhA,1262
29
29
  system_config.py,sha256=sA8wiPmBMtRsLwSQ40U5pVdLazAafbV-1Z19Yp0HiSQ,5314
30
30
  usage_summary.py,sha256=MA4WcVaAwz6IWCN4k_rgxVcwO4I157wN7BZlFi3h0R4,1282
31
31
  cli_output/__init__.py,sha256=MBKl0YbVpWE-tBa3V5_aVbB7vbaqlIK2NsHTjRUZqis,284
32
- cli_output/dry_run.py,sha256=6NKhNWPtD0CBK_QHSsSqIKLTzibTwxS9d8ltP9d1bgU,1473
32
+ cli_output/dry_run.py,sha256=HYhgUtmRl3BC0ZJ0DRFsMiT_3eCPgtH_LCTqLjdAXQw,1617
33
33
  cli_output/render_summary.py,sha256=-yRoI7ZZTS9IHyp1vd-sFleGXTVbxlrCkvuM5TX0Mp4,1168
34
34
  cli_output/status.py,sha256=TrRo-BYUJmzjVzPlMUDpE76FUSpSsN_JdsKigKMrdmg,6294
35
35
  config/__init__.py,sha256=beYSsJWmBNHDP5rYmVDouqgEeP3t1lkkepbXJ-oq0F8,37
36
36
  config/system_config.yaml,sha256=of5R9vukSohU9AlkGJOcAVQA1UJgxYmDy6islU6iFuE,508
37
- docs/generate_cli.py,sha256=0FHVhICbM8g7ahdInTNih3hNKpty1wbV5rdGECMJj48,656
37
+ docs/generate_cli.py,sha256=MyzIgjtT7SXURgHLyc7VldccQdILZi9i49xpuqEoJU4,740
38
38
  examples/example_hello_world_python/harness_tests/hello_world_display/test_hello_world.py,sha256=dwTowrHiVKKbrDv21v8xJC30Q57AXZkQasdGOO5JsBE,470
39
39
  render_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  render_machine/agent_tools.py,sha256=Kp2g9GphV7oA9MbOHctKp0UJJJUOgcfCz2SeW9NL6jg,12305
41
41
  render_machine/code_renderer.py,sha256=ZmisVQHVtI1rBN1qdywW-H_hNeUzVELkHUdApGReYjY,3795
42
42
  render_machine/conformance_tests.py,sha256=PNTCnJNd_xNIhpTPPS8vlx8qws3cTgQSTLdADRab2YM,9617
43
43
  render_machine/implementation_code_helpers.py,sha256=Fxm-IInoZjAIZn41_-WXWj7VIYczpW4yH44Gt8CYMAQ,2378
44
- render_machine/render_context.py,sha256=3lPieD5Rq5wlZUTwFiC4fl5hqruLYOJ0xiZlWcT0dL8,26817
45
- render_machine/render_types.py,sha256=Z7dNKd4TKyFV214k6nrdXvYPZPfX82FU3qM7iqbYkY8,11552
44
+ render_machine/render_context.py,sha256=lDhDb7trL8_WeWXznxpNr2SFxAzfk9oo9f_AE7Get10,28690
45
+ render_machine/render_types.py,sha256=JFROBuTxxDfoSzZpGbucJUYQWa_55HsaOoWIZuZSJ3k,11413
46
46
  render_machine/render_utils.py,sha256=yA3X15E_Lebk_-MxkSz9rM_qy-Pes8EQ9Ye-smkHCDw,9320
47
47
  render_machine/state_machine_config.py,sha256=0pL4PyrZ5F2UumvHLMRfhyh64M4pDvf-9zEs-5OAEU8,27866
48
48
  render_machine/states.py,sha256=Lu-7upbs9_bjJsy0P738qx5IiN0DzVcFdhF2-m6YjnQ,2067
49
49
  render_machine/triggers.py,sha256=VekNhHGR-u5JXIboqc_Eyqf73LNH7wezLK7r3WWtodk,1269
50
- render_machine/actions/analyze_specification_ambiguity.py,sha256=SykZAozGvr1jySxbpKCgt11nMpZhOK0sN-J66M42T5Y,2847
50
+ render_machine/actions/analyze_specification_ambiguity.py,sha256=goXxvsxvWO6d5SB06Zd8-v1wPaSizhQ0DKzk8E_zlj8,2946
51
51
  render_machine/actions/base_action.py,sha256=vVzMp-LanrZyq-jamHyWaQxpRl-pLqtTdtiEzUBhfyE,534
52
52
  render_machine/actions/commit_conformance_tests_changes.py,sha256=08yxCPCpf5TlrzLPsEh5SJXVVvnLfwdNKSr7BlzlYxo,2589
53
53
  render_machine/actions/commit_implementation_code_changes.py,sha256=yi51oAArLCgWcmFbynes-BK2IGnZwA7wygrTJGoL8dY,826
54
54
  render_machine/actions/create_dist.py,sha256=ykER7i2OvWAXjrlAZnkQHpiNl00vSMF8WDxNhlWKfsA,1088
55
- render_machine/actions/distill_conformance_test_memory.py,sha256=ENjfhTWqRLePHeRF4t8zNRhWKDV2rU4pLYuU_CZhhmo,2639
55
+ render_machine/actions/distill_conformance_test_memory.py,sha256=LFonI7Lwk6V-KqSi-R7BZhGEiUw41ihVlBwaTekc72A,2765
56
56
  render_machine/actions/exit_with_error.py,sha256=bw7seapQg5gE5Ag233SJkjnVW4B-JjHPr50XzG0v1P8,1570
57
57
  render_machine/actions/finish_functional_requirement.py,sha256=usQgPSg6PHpBOR1RhK7lPz9zjY-2VJJDqi3T0nlqdLw,841
58
- render_machine/actions/fix_conformance_test.py,sha256=Yy6niLefPIyR3vSxyyX4NUi3NJ4dVc0aEAH9JBCBYX4,11572
59
- render_machine/actions/fix_unit_tests.py,sha256=NgfoqCI4XANrA9muAT9bygEEuvqnwTTZGJS4nfsy0WM,13540
58
+ render_machine/actions/fix_conformance_test.py,sha256=OJ3QBjnSSVYUs5Nwq0C5ishT1VVrF4O1rTLk-mdYcZw,11337
59
+ render_machine/actions/fix_unit_tests.py,sha256=Gcd78kzDJ7cjyh34vofj9WEe17PYbO9S25w2gDyQKrQ,13704
60
60
  render_machine/actions/prepare_repositories.py,sha256=HyZ1R6E3H5V-G4WDSGfhxl_arskmW9FcaxNdQr6JjVs,3867
61
61
  render_machine/actions/prepare_testing_environment.py,sha256=kIsXgV6-jOlqp-04cimPgTQoHPrVIu0zW-H_Jj-jowE,2106
62
- render_machine/actions/refactor_code.py,sha256=gyPsnqgHseL2bkENu4WeGCRyV0R18_GH3JOrPdoxKvg,2609
63
- render_machine/actions/render_conformance_tests.py,sha256=5gOQn-G1T9UWEI8sDfALcVdArk0ln9DgUprOPjccS-U,9268
64
- render_machine/actions/render_functional_requirement.py,sha256=byfASfohbeKNHqyRD5NFJCg6U7q6OVtOF8ocWtjbsws,5110
65
- render_machine/actions/run_conformance_tests.py,sha256=yUG6buqp75EOmJYxdM6MmCNF5_G4TUxA-QSTKx7EzxA,3760
62
+ render_machine/actions/refactor_code.py,sha256=G2GSJ-xg8ducbcy2wlAKzxyJ-2vAq8rRftRQksjJLZY,2792
63
+ render_machine/actions/render_conformance_tests.py,sha256=XHJLZrqU-mf2rbMCqHtBTnkcXLIkHJ6Eztnk1X3K7ws,10819
64
+ render_machine/actions/render_functional_requirement.py,sha256=DXmwfelfQsq_AY5gudzm9T55wzneb1zP4nG40acmD_s,5304
65
+ render_machine/actions/run_conformance_tests.py,sha256=hjIkqySveY50Xo3Kdb4zchyqxFdKyuMSHsEH9yLZj9E,3764
66
66
  render_machine/actions/run_unit_tests.py,sha256=j0qsHMLy49I_DX5QLlH0OdPT6bPMc0icmVg2N5MYm9U,2711
67
- render_machine/actions/summarize_conformance_tests.py,sha256=Vy1kRK8vyazK_BbsKuz1MLDN_TQWVxxzkwEEm-50byc,1639
67
+ render_machine/actions/summarize_conformance_tests.py,sha256=4ldc5JAjQXvxEVBshw07ZOboE3SIWb_DjPFKgfyzuZc,1765
68
68
  standard_template_library/golang-console-app-template.plain,sha256=JOusEjCj7jagnXUzaI-SdIr3hj1wTo2uShK017aNtVM,949
69
69
  standard_template_library/python-console-app-template.plain,sha256=HW-REeF8Crk0r_w4-MxnleVHeW6PdOB2C8gO8FDG61g,931
70
- standard_template_library/typescript-react-app-boilerplate.plain,sha256=6LFxhEOzWnDHdVpFj-XBTq6s4_2dy7LKV3lVkCzv8i4,114
70
+ standard_template_library/typescript-react-app-boilerplate.plain,sha256=XTmkOBXBQHOnI3kxhtpcLh-bXM71bM6Q6b38_7NraM8,115
71
71
  standard_template_library/typescript-react-app-template.plain,sha256=DN5wEJcT8ZqQTf0vFKi9Z1isi9cin2UVNOZb3r28d3M,715
72
72
  tests/__init__.py,sha256=Wk73Io62J15BtlLVIzxmASDWaaJkQLevS4BLK5LDAQg,16
73
73
  tests/conftest.py,sha256=QZcp08htUlJGgmHDlRWFgsWXZ8o8IBWTD5QqJaUMlU8,790
74
+ tests/test_acceptance_scenario_rendered_once.py,sha256=uH8pchI2wMBDY4qSTourMI825JdUmf0x63grn5vjZfY,7002
75
+ tests/test_acceptance_scenarios_after_a_code_fix.py,sha256=MHJltqgPsZV9UY3sdPLsMNrbMjIAXwB9CreWa6n1orA,4676
74
76
  tests/test_agent_tools.py,sha256=1WQjKlDd1kna5D4fvlLJ1o5DxyjW0wy-9tx8tRPv6Sw,7840
75
77
  tests/test_arg_provenance.py,sha256=kUqTcaCxMgbwY0-k_aHf40X1TN-5p7DhLHYrfcgX9N0,4252
76
- tests/test_change_detection.py,sha256=jH8SEhndX400DNqIKmcYLzxHqq9WFdgmuvY3XPq-ZFc,13534
78
+ tests/test_change_detection.py,sha256=jGSBuMFHFiZxe14kB6PucH3Aw0dh5RsKpvQgxhmUdEo,14413
77
79
  tests/test_cli_output.py,sha256=9yTk0pD2w6vkiSdSkYwneUmEtNqX4x64F6PzYShUEcw,19331
78
- tests/test_conformance_fix_journal.py,sha256=olTeAuxXgFwQ8LSQyt0FqtBy9_XY_gK-Ei_pUuJ0C3M,10389
80
+ tests/test_conformance_fix_journal.py,sha256=6IDSMKTSRLB-iWb6jzGvG3TwJomzg0S0SlyG4IbAZdg,10729
79
81
  tests/test_console_log_styles.py,sha256=sxlhynMAP-kmqhBn1-pKvZXdCnlKSyCGJqwYKrh6sQ0,6468
80
82
  tests/test_distill_conformance_test_memory.py,sha256=Tftw9l-gLVwIU6QttY03h2VedvuFxpIsCmZIzvWfxMA,5481
81
- tests/test_dry_run_link_validation.py,sha256=ivvYXQPqUkQ8glbFyUrdCninCxF2mg-rAsDcfjcB7MM,2140
83
+ tests/test_dry_run_link_validation.py,sha256=0Ca7v4DHMPBVmmBLWr2AHk4xVHzdOS2PHiPdumgpWkM,2154
82
84
  tests/test_file_utils.py,sha256=RPab1wBsbE7XAPGync56WveFVnRvafFVRia1a2mMQhk,4490
83
- tests/test_fix_unit_tests_action.py,sha256=0xY94BFbYa528LBXmO7_gfVNbQEqdzXsDHPjQV5qfy0,11410
85
+ tests/test_fix_unit_tests_action.py,sha256=sNLpg1T586TSPyvhjJcTe-4C9P8iHEkt8zx5z4MJ7po,11446
84
86
  tests/test_fix_unit_tests_conformance_context.py,sha256=G6-_YMhN5BY1sJ7cAx3BDnf_McgFcRpyP0iP6mwJ1eA,13154
85
87
  tests/test_folder_path_resolution.py,sha256=K9v684xkPE0HOAsovg8uDixpZmaIk7ho-Wd3rTjKLF0,6560
88
+ tests/test_frid_arguments.py,sha256=zIEU2HGgJU4YOY2DXkjO9MmTlIUk4Iu5dfEU9OwKbak,1264
89
+ tests/test_functionality_without_scenarios.py,sha256=kFBqu9UQ7JdIJCs6z5Hu0xsv9YskBXhkEKBKcdN0tvI,2832
86
90
  tests/test_git_preflight.py,sha256=6aQqInDzpk03pS-6UfkGQWjErrIXTEdHs5oeq3ZYzTw,3186
87
- tests/test_git_utils.py,sha256=h3rWhhs4XVRYqzVzdmj51siF_AYD-GkbZiefK2iGfWo,15614
91
+ tests/test_git_utils.py,sha256=hvNzIYNSFXF4nWpN6HIo4h21zLDCUx8ZmrFp1GR_S70,15721
88
92
  tests/test_headless_logging.py,sha256=soNESeotKQaU-SQyxtjpq35l-dLVsauZ_lJ-wk9i2mI,6419
89
93
  tests/test_log_file_name_resolution.py,sha256=99g9NgPF-BZ98CvNyqDcltBAx4sLBE8gpQPAAieKiPc,3619
90
94
  tests/test_logging_config_path_resolution.py,sha256=avz_ehRd18INwIXvAy1AwVzNNUz0vS8eu1nRe0bra8g,2650
91
- tests/test_partial_rendering.py,sha256=r0RUUd1pI4-2ZkRrM1j8_kUqv-70hrOGjuKBhZoRmH0,22758
95
+ tests/test_partial_rendering.py,sha256=_dOWnedG8iUB-Kj9r8hqRIRSUux3PNsSNVA1ta2Ull0,23800
92
96
  tests/test_path_resolution.py,sha256=yQpd-Unq1lwNv0wkRPwVs5pDT8JmyyDgbpiTQsyt--Y,2615
93
- tests/test_plain2code.py,sha256=lyb7iYK8XHu1dmTFh9Q31YgX0faNlCHiyI5M35VQwOg,3780
97
+ tests/test_plain2code.py,sha256=BKLIBOc3tON2fODm1ETdPZZkZMbSrvbIG54EWJcKcmE,3411
94
98
  tests/test_plain2code_state.py,sha256=O-sDt4F_lF6XtanWKWfh5IsNmDdfuJP_JoGagujzdfM,1440
95
- tests/test_plain2code_utils.py,sha256=-W8a7FquMJQ_pTdBoBF1XprzNL2G555QhdtXCy6BDyQ,1237
96
- tests/test_plain_modules.py,sha256=Fn3FeH-M4exnyFJDZzc9YWaLEfBmiqPH5TpiBT9jgAs,33033
99
+ tests/test_plain2code_utils.py,sha256=MXAYsWMY_7Vb4im2ZJK46Gsq1ApIjuGkQAEmUz0ISOY,1665
100
+ tests/test_plain_modules.py,sha256=fc7__5jSfr6CLh92IQDUdkOS9qkS1XRFmGXPj76v4Xs,33698
97
101
  tests/test_prepare_repositories_layout.py,sha256=PhJQLnHfjfjo6CTWoicyEKgL0_GtjwB2OKYAWSBVHtk,14638
98
- tests/test_render_finished_report.py,sha256=1OaL6S4LSRJ0JwDFu8HFEM02o4ZEn6oPtDpXPasNEVo,7670
99
- tests/test_render_range.py,sha256=G6gsJfVQ12N487X2VxVmvSOhtWvfYXCKrP2CAKYzgzU,1496
100
- tests/test_render_stop_reason.py,sha256=13oRRGrZKNyJFD2iDxDrD7VFvmobbtfAFcnKKdiCJT8,8550
102
+ tests/test_render_finished_report.py,sha256=Z7FFQ1uiHkZubr4ElFq2KXEYT9niXVq1fSlehnJJwRE,7735
103
+ tests/test_render_range.py,sha256=N4XS6zQbQmDlQmUvl6vhqLL7VcczET65GG1DWypP-k0,1832
104
+ tests/test_render_stop_reason.py,sha256=jBofHzbEQFZlPcczT_7azsCnzh9hnEsLmxbB1IGhGxQ,8602
101
105
  tests/test_resolve_config_file.py,sha256=b87tDOvyzbsnE-QRWbZ97ou7NuyaAgskv-dbYBum31c,2830
102
106
  tests/test_script_path_resolution.py,sha256=tiEqMevQRXr9YpfHN0xldOOQpLAUgnSqTzeZWkKHaUY,4156
103
107
  tests/test_system_config.py,sha256=gH5qs9q4lh5CljAdz28HUrJzuKqCvkZherFuv7enMak,2787
104
- tests/test_telemetry.py,sha256=LINvx1_Oz1OJ3ho2RcIcAA29IsNfUbkVVCbFaQcrBaA,8133
105
- tests/test_terminal_attachment.py,sha256=mAJIKr0rXFytytZZm1XENV0T9kPYblhwkRTTtT4SzPs,10485
108
+ tests/test_telemetry.py,sha256=lRm-Z7g2-33CFEkTJHLSUsOpltSnD47gyUoPCRD9SHQ,8153
109
+ tests/test_terminal_attachment.py,sha256=AnQzBI3IcxL3f7z_V4XzrzeihVJ1qWKj43Wh7Mue_pk,10503
110
+ tests/test_tests_folders.py,sha256=o_6GMObbqweEDi1cfx6V8UFOGCafbUQcEVu_DSfW1Ns,3249
111
+ tests/test_traceability_warnings.py,sha256=dqaDrzEaGgYFYdxkcJvdTjaLdP5qkl2YdIgTby7Uq9I,2304
106
112
  tests/test_tui_components.py,sha256=O_PB6z_Xt7YWebsD21b99PVgFtqq5c03lVtYytIT5Ps,6200
107
113
  tests/test_tui_usage.py,sha256=sfiAGTpRrT3MRr0-8DH3qjuECSxjODVgwzrK_K3iPXs,7959
108
114
  tests/test_usage_summary.py,sha256=Ps0kVzvmdZYeXrBR-cqkn3szTV5neYKs1PmmURngeIc,1079
@@ -114,13 +120,13 @@ tui/__init__.py,sha256=_fy7FowY0RkWdn4kC7XV2jgvQPCj-2gE8fNUb-Mny0A,60
114
120
  tui/components.py,sha256=tAgP7paI8bR6XAWOWyiUsKexRurEx1CNz_4z81Ty0G4,27195
115
121
  tui/models.py,sha256=KMjlWubmPD41GA-BjgiqkaV9v7tLJ0fuWKBDPmZj4JA,1493
116
122
  tui/plain2code_tui.py,sha256=b6FOEXt_dcVhpfOrAHvg-Rvn0bSH18moy5zmUaz3NS4,17552
117
- tui/plain_module_render_choice_tui.py,sha256=XwBMMzyDat9FYqMkKdIV7kmIevddfwGA5Qk9kgy5sYY,12112
123
+ tui/plain_module_render_choice_tui.py,sha256=dWmgpEEKlKijTDK-WQ3ks4EgZqICyQ73_BWDTASzEBk,12116
118
124
  tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
119
- tui/state_handlers.py,sha256=zbUS_D9eU8qIwVpaxPEp9zL9bpg8gXsWNoUaqg9TLrQ,16664
125
+ tui/state_handlers.py,sha256=SCAcBXLgGhpVFBLrTL76g7Z507q4fLgSwYkGiwAMLRc,16067
120
126
  tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
121
127
  tui/widget_helpers.py,sha256=jitm2WHiKj-NVFL-hULxWzckPreRbUTl9OIZLN31-ek,6997
122
- codeplain-0.3.13.dev48.dist-info/METADATA,sha256=-hiRltDLNdA-m9rOJVeYrsPD3WTFxHVj69t4nNiJyyA,7261
123
- codeplain-0.3.13.dev48.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
124
- codeplain-0.3.13.dev48.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
125
- codeplain-0.3.13.dev48.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
126
- codeplain-0.3.13.dev48.dist-info/RECORD,,
128
+ codeplain-0.3.14.dev50.dist-info/METADATA,sha256=ZgG_XPrS0KK8YMMWP7LLcx-QO1Lphx6NkHQrLPqt2lQ,7261
129
+ codeplain-0.3.14.dev50.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
130
+ codeplain-0.3.14.dev50.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
131
+ codeplain-0.3.14.dev50.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
132
+ codeplain-0.3.14.dev50.dist-info/RECORD,,
codeplain_REST_api.py CHANGED
@@ -82,6 +82,7 @@ ERROR_CODE_EXCEPTIONS = {
82
82
  "MissingResource": plain2code_exceptions.MissingResource,
83
83
  "PlainSyntaxError": plain2code_exceptions.PlainSyntaxError,
84
84
  "InternalServerError": plain2code_exceptions.InternalServerError,
85
+ "OutdatedClient": plain2code_exceptions.OutdatedClientVersion,
85
86
  }
86
87
 
87
88
 
@@ -363,7 +364,6 @@ class CodeplainAPI:
363
364
  required_modules,
364
365
  conformance_tests_folder_name,
365
366
  conformance_tests_json,
366
- all_acceptance_tests,
367
367
  run_state: RunState,
368
368
  ):
369
369
  endpoint_url = f"{self.api_url}/render_conformance_tests"
@@ -380,11 +380,10 @@ class CodeplainAPI:
380
380
  "required_modules": required_modules,
381
381
  "conformance_tests_folder_name": conformance_tests_folder_name,
382
382
  "conformance_tests_json": conformance_tests_json,
383
- "all_acceptance_tests": all_acceptance_tests,
384
383
  }
385
384
 
386
385
  response = self.post_request(endpoint_url, headers, payload, run_state)
387
- return response["patched_response_files"], response["conformance_tests_plan_summary_string"]
386
+ return response["patched_response_files"], response["traceability"]
388
387
 
389
388
  def generate_folder_name_from_functional_requirement(
390
389
  self,
@@ -419,11 +418,9 @@ class CodeplainAPI:
419
418
  required_modules,
420
419
  code_diff,
421
420
  conformance_tests_files,
422
- acceptance_tests,
423
421
  conformance_tests_issue,
424
422
  implementation_fix_count,
425
423
  conformance_tests_folder_name,
426
- current_testing_frid_high_level_implementation_plan: Optional[str],
427
424
  conflicting_requirements_count: int,
428
425
  fix_attempts_journal: list,
429
426
  run_state: RunState,
@@ -446,14 +443,10 @@ class CodeplainAPI:
446
443
  "conformance_tests_issue": conformance_tests_issue,
447
444
  "implementation_fix_count": implementation_fix_count,
448
445
  "conformance_tests_folder_name": conformance_tests_folder_name,
449
- "current_testing_frid_high_level_implementation_plan": current_testing_frid_high_level_implementation_plan,
450
446
  "conflicting_requirements_count": conflicting_requirements_count,
451
447
  "fix_attempts_journal": fix_attempts_journal,
452
448
  }
453
449
 
454
- if acceptance_tests is not None:
455
- payload["acceptance_tests"] = acceptance_tests
456
-
457
450
  return self.post_request(endpoint_url, headers, payload, run_state)
458
451
 
459
452
  def render_acceptance_tests(
@@ -466,7 +459,7 @@ class CodeplainAPI:
466
459
  conformance_tests_files,
467
460
  module_name: str,
468
461
  required_modules,
469
- acceptance_test,
462
+ scenario_id,
470
463
  run_state: RunState,
471
464
  ):
472
465
  """
@@ -484,10 +477,11 @@ class CodeplainAPI:
484
477
  conformance_tests_files (dict): A dictionary containing conformance test files.
485
478
  required_modules (dict): A dictionary where the keys represent module names
486
479
  and the values are lists of functionalities implemented in those modules.
487
- acceptance_test (dict): A dictionary containing acceptance test information.
480
+ scenario_id (str): The scenario-id of the acceptance scenario to render.
488
481
 
489
482
  Returns:
490
- dict: The rendered acceptance tests.
483
+ tuple: The rendered acceptance tests, and the traceability of every scenario of the
484
+ functionality a test is due for.
491
485
 
492
486
  Raises:
493
487
  Exception: If the request fails or returns an error.
@@ -504,10 +498,11 @@ class CodeplainAPI:
504
498
  "conformance_tests_files": conformance_tests_files,
505
499
  "module_name": module_name,
506
500
  "required_modules": required_modules,
507
- "acceptance_test": acceptance_test,
501
+ "scenario_id": scenario_id,
508
502
  }
509
503
 
510
- return self.post_request(endpoint_url, headers, payload, run_state)
504
+ response = self.post_request(endpoint_url, headers, payload, run_state)
505
+ return response["patched_response_files"], response["traceability"]
511
506
 
512
507
  def analyze_rendering(
513
508
  self,
docs/generate_cli.py CHANGED
@@ -1,8 +1,9 @@
1
1
  import os
2
2
  import sys
3
3
 
4
- # Add the parent directory to the path so we can import plain2code_arguments
5
- sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
4
+ # Put the checkout first on the path so we read its plain2code_arguments, not an
5
+ # installed copy of codeplain that would reflect whatever was last released.
6
+ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
6
7
 
7
8
 
8
9
  def main():
partial_rendering.py CHANGED
@@ -3,7 +3,7 @@ from typing import Literal
3
3
 
4
4
  import plain_spec
5
5
  from change_detection import PartialRenderStart, determine_partial_render_start
6
- from plain2code_exceptions import ModuleDoesNotExistError
6
+ from plain2code_exceptions import MissingPreviousFunctionalitiesError, ModuleDoesNotExistError
7
7
  from plain_modules import PlainModule
8
8
 
9
9
 
@@ -83,6 +83,30 @@ def module_comes_before_or_equal(
83
83
  raise ValueError(f"Module {module1.module_name} and {module2.module_name} not found in {all_required_modules}")
84
84
 
85
85
 
86
+ def _check_last_rendered_frid(module: PlainModule, last_rendered_frid: str | None) -> None:
87
+ """Stop when the build folder was rendered for a functionality the module no longer has.
88
+
89
+ The resume point comes from the commit messages of the build folder. A folder rendered by a
90
+ client that numbered the functionalities names none of today's func-ids, and neither does one
91
+ whose functionality was removed from the specification. Either way the render cannot continue
92
+ from it.
93
+ """
94
+ if last_rendered_frid is None:
95
+ return
96
+
97
+ frids = list(plain_spec.get_frids(module.plain_source))
98
+ if last_rendered_frid in frids:
99
+ return
100
+
101
+ raise MissingPreviousFunctionalitiesError(
102
+ f"The build folder of module {module.module_name} was rendered for functionality "
103
+ f"'{last_rendered_frid}', which the module does not have. Its functionalities are: "
104
+ f"{', '.join(frids)}.\n\n"
105
+ "A build folder rendered by a client that numbered the functionalities cannot be continued. "
106
+ f"Remove {module.build_folder} and render again."
107
+ )
108
+
109
+
86
110
  def get_plain_module_render_state(
87
111
  plain_module: PlainModule, render_conformance_tests: bool = False
88
112
  ) -> PlainModuleRenderState | None:
@@ -114,6 +138,8 @@ def get_plain_module_render_state(
114
138
  )
115
139
  module = found_module
116
140
 
141
+ _check_last_rendered_frid(module, last_rendered_frid)
142
+
117
143
  pr = PlainModuleRenderState(
118
144
  last_render_module=module,
119
145
  last_render_frid=last_rendered_frid,
@@ -201,7 +227,11 @@ def change_is_only_future_work(
201
227
  if plain_module_render_state.last_render_frid is None:
202
228
  return True
203
229
 
204
- return int(partial_start.frid) > int(plain_module_render_state.last_render_frid)
230
+ frids = list(plain_spec.get_frids(partial_start.module.plain_source))
231
+ if plain_module_render_state.last_render_frid not in frids:
232
+ return False
233
+
234
+ return frids.index(partial_start.frid) > frids.index(plain_module_render_state.last_render_frid)
205
235
 
206
236
 
207
237
  def _resume_render_choice(