codeplain 0.4.3.dev57__py3-none-any.whl → 0.4.3.dev58__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.
cli_output/dry_run.py CHANGED
@@ -4,10 +4,12 @@ from typing import Optional
4
4
 
5
5
  import plain_spec
6
6
  from plain2code_console import console
7
+ from plain2code_utils import functionality_position, with_position
7
8
 
8
9
 
9
10
  def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[str]]):
10
11
  """Print dry run output showing what would be rendered."""
12
+ frids = list(plain_spec.get_frids(plain_source_tree))
11
13
  frid = plain_spec.get_first_frid(plain_source_tree)
12
14
 
13
15
  while frid is not None:
@@ -18,7 +20,7 @@ def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[st
18
20
  functional_requirement_text = specifications[plain_spec.FUNCTIONAL_REQUIREMENTS][-1]
19
21
  console.info(
20
22
  "-------------------------------------\n"
21
- f"Rendering functionality {frid}:\n"
23
+ f"Rendering functionality {with_position(frid, functionality_position(frids, frid))}:\n"
22
24
  f"{functional_requirement_text}\n"
23
25
  "-------------------------------------\n"
24
26
  )
@@ -32,7 +34,7 @@ def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[st
32
34
  else:
33
35
  console.info(
34
36
  "-------------------------------------\n"
35
- f"Skipping rendering iteration: {frid}\n"
37
+ f"Skipping rendering iteration: {with_position(frid, functionality_position(frids, frid))}\n"
36
38
  "-------------------------------------"
37
39
  )
38
40
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codeplain
3
- Version: 0.4.3.dev57
3
+ Version: 0.4.3.dev58
4
4
  Summary: Transform plain language specifications into working code
5
5
  License-File: LICENSE
6
6
  Classifier: Environment :: Console
@@ -22,14 +22,14 @@ plain2code_nodes.py,sha256=QCC9RYBBfHycahvYovcN414sRlGL-dqRV3Baeu7KPkw,140
22
22
  plain2code_read_config.py,sha256=D5CxnmTRjddupecWvstcUm0kIJWWzq5-Zmk6sU0wbIg,2235
23
23
  plain2code_state.py,sha256=Qai9kfsvQ2IYSQ31EyITkqCwlFm_rhO-sO12Y1CCOeA,3615
24
24
  plain2code_telemetry.py,sha256=NO8zw1i3ucM6Z9xQoSCeWqC5Hr-9Oql58YtgEOhBnaQ,4683
25
- plain2code_utils.py,sha256=luhiWaE0bXPQvjNDj-VYwxcGBq9vhvuqQCL_xgpq814,2093
25
+ plain2code_utils.py,sha256=lGrnGavNXjUCQoVLjNYKgLiSTVazJv2o7WByB30M2Nk,2316
26
26
  plain_file.py,sha256=50CevjRihjddXbc3WzKKJF_kaVcMHUJ1FH2HJUZawT8,138
27
- plain_modules.py,sha256=3xc6tYbWB17YWIG9SfZ_SKYX3hnoC5y_n5RyaN9Lec0,28903
27
+ plain_modules.py,sha256=9y9OmCrAqnhMOgkE_U4TZEg8VK-Cqoj8YMlkQd-nb2c,29365
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=HYhgUtmRl3BC0ZJ0DRFsMiT_3eCPgtH_LCTqLjdAXQw,1617
32
+ cli_output/dry_run.py,sha256=W2DqJju7DddTNmDGgAruE387iZGQ0Au2_0W0NUAuODQ,1846
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
@@ -41,37 +41,37 @@ render_machine/agent_tools.py,sha256=Kp2g9GphV7oA9MbOHctKp0UJJJUOgcfCz2SeW9NL6jg
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=-0Ma2DtBQRe4OwsoKi67ERfa_75fexI__vAnUy3_s2g,29133
44
+ render_machine/render_context.py,sha256=7KQQMupjkgYZSpJWJ_4HtKZ-7_CvdqXOnm-KmFsI0BM,30557
45
45
  render_machine/render_types.py,sha256=JFROBuTxxDfoSzZpGbucJUYQWa_55HsaOoWIZuZSJ3k,11413
46
- render_machine/render_utils.py,sha256=yA3X15E_Lebk_-MxkSz9rM_qy-Pes8EQ9Ye-smkHCDw,9320
46
+ render_machine/render_utils.py,sha256=4T-aN5qivUCUzF2bJiNsrVeHJ9ROnZZ4JucZkn_a73U,9472
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=goXxvsxvWO6d5SB06Zd8-v1wPaSizhQ0DKzk8E_zlj8,2946
50
+ render_machine/actions/analyze_specification_ambiguity.py,sha256=6-s2s6DUt-qyr682_5hS-URg4pyPfsnRZnM00uly770,2890
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=LFonI7Lwk6V-KqSi-R7BZhGEiUw41ihVlBwaTekc72A,2765
55
+ render_machine/actions/distill_conformance_test_memory.py,sha256=54ooMdAc79OrKfWCPsczGNx1zhUng4UNPZLo6j4eMEw,2681
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=OJ3QBjnSSVYUs5Nwq0C5ishT1VVrF4O1rTLk-mdYcZw,11337
58
+ render_machine/actions/fix_conformance_test.py,sha256=J00Kt6o0Abi32Afg6WetRuyn1eqesgdo33Y68VwRTjE,11205
59
59
  render_machine/actions/fix_unit_tests.py,sha256=Gcd78kzDJ7cjyh34vofj9WEe17PYbO9S25w2gDyQKrQ,13704
60
- render_machine/actions/prepare_repositories.py,sha256=HyZ1R6E3H5V-G4WDSGfhxl_arskmW9FcaxNdQr6JjVs,3867
60
+ render_machine/actions/prepare_repositories.py,sha256=DGDITJ1jDRHWlk48rWDaYVO6T9mbLROoncsAE44VAhs,3933
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=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=Kyi2CD7pp4Y7Albys5gFfXW3BGden8W3cvFyr-wHIBU,5660
65
- render_machine/actions/run_conformance_tests.py,sha256=hjIkqySveY50Xo3Kdb4zchyqxFdKyuMSHsEH9yLZj9E,3764
62
+ render_machine/actions/refactor_code.py,sha256=dlS0iam9bzEeUr2NFuft6TcOv6IOtzdSb1tDQ85vmII,2708
63
+ render_machine/actions/render_conformance_tests.py,sha256=n0kA0RvUkPvTeVXjtuObYolXCYwl4pG58GNQ_Abi8U8,10794
64
+ render_machine/actions/render_functional_requirement.py,sha256=f6UbhmWpaUsbqSni2Vpjf_155kZR1N3Fj5K77dL2xjU,5536
65
+ render_machine/actions/run_conformance_tests.py,sha256=GQ533_mg_3OQUb42GI7aPU9lSbXFKl6NtFtx2zvH9Qw,3731
66
66
  render_machine/actions/run_unit_tests.py,sha256=j0qsHMLy49I_DX5QLlH0OdPT6bPMc0icmVg2N5MYm9U,2711
67
- render_machine/actions/summarize_conformance_tests.py,sha256=4ldc5JAjQXvxEVBshw07ZOboE3SIWb_DjPFKgfyzuZc,1765
67
+ render_machine/actions/summarize_conformance_tests.py,sha256=5TdhZ9Mt96WAlFtJAju3iQ9fXFwHcR48Wwe9XyddTIU,1681
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
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
74
+ tests/test_acceptance_scenario_rendered_once.py,sha256=R5LE_9e9yrvhGvLuAxsINiiFrzrAvMZzwlogMyyEk5s,7098
75
75
  tests/test_acceptance_scenarios_after_a_code_fix.py,sha256=MHJltqgPsZV9UY3sdPLsMNrbMjIAXwB9CreWa6n1orA,4676
76
76
  tests/test_agent_tools.py,sha256=1WQjKlDd1kna5D4fvlLJ1o5DxyjW0wy-9tx8tRPv6Sw,7840
77
77
  tests/test_arg_provenance.py,sha256=kUqTcaCxMgbwY0-k_aHf40X1TN-5p7DhLHYrfcgX9N0,4252
@@ -80,12 +80,12 @@ tests/test_cli_output.py,sha256=9yTk0pD2w6vkiSdSkYwneUmEtNqX4x64F6PzYShUEcw,1933
80
80
  tests/test_conformance_fix_journal.py,sha256=6IDSMKTSRLB-iWb6jzGvG3TwJomzg0S0SlyG4IbAZdg,10729
81
81
  tests/test_console_log_styles.py,sha256=sxlhynMAP-kmqhBn1-pKvZXdCnlKSyCGJqwYKrh6sQ0,6468
82
82
  tests/test_dependency_pins.py,sha256=D_c5sb7ikwuV4zy8trB0DDzwNLkhAX221X67atLA-ec,1864
83
- tests/test_distill_conformance_test_memory.py,sha256=Tftw9l-gLVwIU6QttY03h2VedvuFxpIsCmZIzvWfxMA,5481
83
+ tests/test_distill_conformance_test_memory.py,sha256=6hmrzbL-1Yf7O2JgEFWi6GR-43MvFYWLLYjIYr2kN9M,5526
84
84
  tests/test_dry_run_link_validation.py,sha256=0Ca7v4DHMPBVmmBLWr2AHk4xVHzdOS2PHiPdumgpWkM,2154
85
85
  tests/test_exit_when_done.py,sha256=eQeAjZaScqw93liajuYZ1XAIhZX-NpjWMeBXKSazedU,5594
86
86
  tests/test_file_utils.py,sha256=RPab1wBsbE7XAPGync56WveFVnRvafFVRia1a2mMQhk,4490
87
87
  tests/test_fix_unit_tests_action.py,sha256=sNLpg1T586TSPyvhjJcTe-4C9P8iHEkt8zx5z4MJ7po,11446
88
- tests/test_fix_unit_tests_conformance_context.py,sha256=G6-_YMhN5BY1sJ7cAx3BDnf_McgFcRpyP0iP6mwJ1eA,13154
88
+ tests/test_fix_unit_tests_conformance_context.py,sha256=Hp27fjoo5MRjXgj43L0gx5OPOuW8ab98oTmmUBkuR2Y,13273
89
89
  tests/test_folder_path_resolution.py,sha256=K9v684xkPE0HOAsovg8uDixpZmaIk7ho-Wd3rTjKLF0,6560
90
90
  tests/test_frid_arguments.py,sha256=zIEU2HGgJU4YOY2DXkjO9MmTlIUk4Iu5dfEU9OwKbak,1264
91
91
  tests/test_functionality_position.py,sha256=QQdhIqZhRC8-30xKZPyOye6dm8kSkJnja4PB53iZkeE,3540
@@ -104,14 +104,14 @@ tests/test_plain_modules.py,sha256=fc7__5jSfr6CLh92IQDUdkOS9qkS1XRFmGXPj76v4Xs,3
104
104
  tests/test_prepare_repositories_layout.py,sha256=PhJQLnHfjfjo6CTWoicyEKgL0_GtjwB2OKYAWSBVHtk,14638
105
105
  tests/test_render_finished_report.py,sha256=aL67ygPglfkOT3sbqlP9wOgG_sKgYdTBMOfVK7is5G8,9283
106
106
  tests/test_render_range.py,sha256=N4XS6zQbQmDlQmUvl6vhqLL7VcczET65GG1DWypP-k0,1832
107
- tests/test_render_stop_reason.py,sha256=jBofHzbEQFZlPcczT_7azsCnzh9hnEsLmxbB1IGhGxQ,8602
107
+ tests/test_render_stop_reason.py,sha256=38PhTWPf-Yal8EPcH9h5BRHwVXz56roWseH4sDBQFcY,8608
108
108
  tests/test_resolve_config_file.py,sha256=b87tDOvyzbsnE-QRWbZ97ou7NuyaAgskv-dbYBum31c,2830
109
109
  tests/test_script_path_resolution.py,sha256=tiEqMevQRXr9YpfHN0xldOOQpLAUgnSqTzeZWkKHaUY,4156
110
110
  tests/test_system_config.py,sha256=gH5qs9q4lh5CljAdz28HUrJzuKqCvkZherFuv7enMak,2787
111
111
  tests/test_telemetry.py,sha256=lRm-Z7g2-33CFEkTJHLSUsOpltSnD47gyUoPCRD9SHQ,8153
112
112
  tests/test_terminal_attachment.py,sha256=-yssQKLfE-PcOnBIoNJjjXISqjjZvePb74ZwW_TvJJ4,10533
113
113
  tests/test_tests_folders.py,sha256=o_6GMObbqweEDi1cfx6V8UFOGCafbUQcEVu_DSfW1Ns,3249
114
- tests/test_traceability_warnings.py,sha256=dqaDrzEaGgYFYdxkcJvdTjaLdP5qkl2YdIgTby7Uq9I,2304
114
+ tests/test_traceability_warnings.py,sha256=Z9WFLq99mW8LDwxfmmskX0d3wuELq8cjactRFDCD-_Y,2268
115
115
  tests/test_tui_components.py,sha256=O_PB6z_Xt7YWebsD21b99PVgFtqq5c03lVtYytIT5Ps,6200
116
116
  tests/test_tui_usage.py,sha256=sfiAGTpRrT3MRr0-8DH3qjuECSxjODVgwzrK_K3iPXs,7959
117
117
  tests/test_usage_summary.py,sha256=Ps0kVzvmdZYeXrBR-cqkn3szTV5neYKs1PmmURngeIc,1079
@@ -128,8 +128,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
128
128
  tui/state_handlers.py,sha256=5FkF13mCLYAOgpYnzR932U3tYxSnMkCu5jybMFEBVe4,16264
129
129
  tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
130
130
  tui/widget_helpers.py,sha256=jitm2WHiKj-NVFL-hULxWzckPreRbUTl9OIZLN31-ek,6997
131
- codeplain-0.4.3.dev57.dist-info/METADATA,sha256=u80HvhgV1xLHro4rLStzHhDLrrdIv_Ejzj_WTsNyudM,7260
132
- codeplain-0.4.3.dev57.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
133
- codeplain-0.4.3.dev57.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
134
- codeplain-0.4.3.dev57.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
135
- codeplain-0.4.3.dev57.dist-info/RECORD,,
131
+ codeplain-0.4.3.dev58.dist-info/METADATA,sha256=Ij8LL1H51W4vzTBR6OpcGtxGICxh90F70dU7fqDdlE8,7260
132
+ codeplain-0.4.3.dev58.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
133
+ codeplain-0.4.3.dev58.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
134
+ codeplain-0.4.3.dev58.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
135
+ codeplain-0.4.3.dev58.dist-info/RECORD,,
plain2code_utils.py CHANGED
@@ -43,6 +43,11 @@ def functionality_position(frids: list[str], frid: Optional[str]) -> Optional[st
43
43
  return f"{frids.index(frid) + 1}/{len(frids)}"
44
44
 
45
45
 
46
+ def with_position(name: Optional[str], position: Optional[str]) -> Optional[str]:
47
+ """A functionality name followed by its position, as "list-expenses (1/3)"."""
48
+ return f"{name} ({position})" if position else name
49
+
50
+
46
51
  def qualified_frid(module_name: Optional[str], frid: Optional[str]) -> Optional[str]:
47
52
  """A functionality named as `<module>:<func-id>`.
48
53
 
plain_modules.py CHANGED
@@ -31,6 +31,7 @@ from metadata_utils import (
31
31
  REQUIRED_MODULES_FUNCTIONALITIES,
32
32
  )
33
33
  from plain2code_console import console
34
+ from plain2code_utils import functionality_position, with_position
34
35
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
35
36
 
36
37
  CODEPLAIN_MEMORY_SUBFOLDER = ".memory"
@@ -516,18 +517,22 @@ class PlainModule:
516
517
 
517
518
  if not os.path.exists(self.module_build_folder):
518
519
  raise MissingPreviousFunctionalitiesError(
519
- f"Cannot start rendering from functionality {first_render_frid} for module '{self.module_name}' because the source code folder does not exist.\n\n"
520
+ f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the source code folder does not exist.\n\n"
520
521
  f"To fix this, please render the module from the beginning by running:\n"
521
522
  f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION}"
522
523
  )
523
524
 
524
525
  if not os.path.exists(self.module_conformance_tests_folder) and render_conformance_tests:
525
526
  raise MissingPreviousFunctionalitiesError(
526
- f"Cannot start rendering from functionality {first_render_frid} for module '{self.module_name}' because the conformance tests folder does not exist.\n\n"
527
+ f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the conformance tests folder does not exist.\n\n"
527
528
  f"To fix this, please render the module from the beginning by running:\n"
528
529
  f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION}"
529
530
  )
530
531
 
532
+ def _frid_label(self, frid: str) -> str | None:
533
+ """A functionality of this module named for the logs, as "func-id (3/12)"."""
534
+ return with_position(frid, functionality_position(list(plain_spec.get_frids(self.plain_source)), frid))
535
+
531
536
  def _ensure_frid_commit_exists(
532
537
  self,
533
538
  frid: str,
@@ -548,8 +553,8 @@ class PlainModule:
548
553
  # Check in build folder
549
554
  if not git_utils.has_commit_for_frid(self.module_build_folder, frid, self.module_name):
550
555
  raise MissingPreviousFunctionalitiesError(
551
- f"Cannot start rendering from functionality {first_render_frid} for module '{self.module_name}' because the implementation of the previous functionality ({frid}) hasn't been completed yet.\n\n"
552
- f"To fix this, please render the missing functionality ({frid}) first by running:\n"
556
+ f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the implementation of the previous functionality ({self._frid_label(frid)}) hasn't been completed yet.\n\n"
557
+ f"To fix this, please render the missing functionality ({self._frid_label(frid)}) first by running:\n"
553
558
  f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION} --render-from {frid}"
554
559
  )
555
560
 
@@ -557,8 +562,8 @@ class PlainModule:
557
562
  if render_conformance_tests:
558
563
  if not git_utils.has_commit_for_frid(self.module_conformance_tests_folder, frid, self.module_name):
559
564
  raise MissingPreviousFunctionalitiesError(
560
- f"Cannot start rendering from functionality {first_render_frid} for module '{self.module_name}' because the conformance tests for the previous functionality ({frid}) haven't been completed yet.\n\n"
561
- f"To fix this, please render the missing functionality ({frid}) first by running:\n"
565
+ f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the conformance tests for the previous functionality ({self._frid_label(frid)}) haven't been completed yet.\n\n"
566
+ f"To fix this, please render the missing functionality ({self._frid_label(frid)}) first by running:\n"
562
567
  f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION} --render-from {frid}"
563
568
  )
564
569
 
@@ -5,7 +5,7 @@ import git_utils
5
5
  import plain_spec
6
6
  from plain2code_console import console
7
7
  from plain2code_exceptions import InternalClientError
8
- from plain2code_utils import AMBIGUITY_CAUSES, qualified_frid
8
+ from plain2code_utils import AMBIGUITY_CAUSES
9
9
  from render_machine.actions.base_action import BaseAction
10
10
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
11
11
  from render_machine.render_context import RenderContext
@@ -43,7 +43,7 @@ class AnalyzeSpecificationAmbiguity(BaseAction):
43
43
  fixed_implementation_code_diff,
44
44
  run_state=render_context.run_state,
45
45
  )
46
- functionality = qualified_frid(render_context.module_name, render_context.frid_context.frid)
46
+ functionality = render_context.functionality_label()
47
47
  if rendering_analysis:
48
48
  # TODO: Before this output is exposed to the user, we should check the 'guidance' field using LLM in the same way as we do conflicting requirements.
49
49
  console.info(
@@ -1,7 +1,6 @@
1
1
  from typing import Any
2
2
 
3
3
  from plain2code_console import console
4
- from plain2code_utils import qualified_frid
5
4
  from render_machine.actions.base_action import BaseAction
6
5
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
7
6
  from render_machine.render_context import RenderContext
@@ -27,7 +26,7 @@ class DistillConformanceTestMemory(BaseAction):
27
26
  if not fix_journals:
28
27
  return self.SUCCESSFUL_OUTCOME, None
29
28
 
30
- functionality = qualified_frid(render_context.module_name, render_context.frid_context.frid)
29
+ functionality = render_context.functionality_label()
31
30
  console.info(f"Distilling conformance test fix learnings for functionality {functionality}.")
32
31
 
33
32
  try:
@@ -6,7 +6,6 @@ import plain_spec
6
6
  from memory_management import MemoryManager
7
7
  from plain2code_console import RETRY_COLOR, console
8
8
  from plain2code_exceptions import InternalClientError
9
- from plain2code_utils import qualified_frid
10
9
  from render_machine.actions.base_action import BaseAction
11
10
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
12
11
  from render_machine.render_context import RenderContext
@@ -45,10 +44,7 @@ class FixConformanceTest(BaseAction):
45
44
 
46
45
  console.info(f"Running conformance tests attempt {ctx.fix_attempts + 1}.")
47
46
 
48
- console.info(
49
- f"Fixing conformance test for functionality "
50
- f"{qualified_frid(ctx.current_testing_module_name, ctx.current_testing_frid)}."
51
- )
47
+ console.info(f"Fixing conformance test for functionality {render_context.testing_functionality_label()}.")
52
48
 
53
49
  if not previous_action_payload.get("previous_conformance_tests_issue"):
54
50
  raise InternalClientError(
@@ -147,7 +143,7 @@ class FixConformanceTest(BaseAction):
147
143
  render_context.conformance_tests_running_context.conflicting_frid = current_testing_frid
148
144
  console.info(
149
145
  f"↻ Potential conflicting functionalities detected while fixing conformance tests "
150
- f"for functionality {qualified_frid(current_testing_module_name, current_testing_frid)}.",
146
+ f"for functionality {render_context.testing_functionality_label()}.",
151
147
  color=RETRY_COLOR,
152
148
  )
153
149
 
@@ -22,7 +22,9 @@ class PrepareRepositories(BaseAction):
22
22
 
23
23
  previous_frid = plain_spec.get_previous_frid(render_context.plain_source_tree, frid)
24
24
 
25
- console.debug(f"Reverting code to version implemented for {previous_frid}.")
25
+ console.debug(
26
+ f"Reverting code to version implemented for {render_context.functionality_label(previous_frid)}."
27
+ )
26
28
 
27
29
  render_context.plain_module.revert_code_to_frid(previous_frid)
28
30
  # conformance tests are still not fully implemented
@@ -2,7 +2,6 @@ from typing import Any
2
2
 
3
3
  import file_utils
4
4
  from plain2code_console import console
5
- from plain2code_utils import qualified_frid
6
5
  from render_machine.actions.base_action import BaseAction
7
6
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
8
7
  from render_machine.render_context import RenderContext
@@ -23,7 +22,7 @@ class RefactorCode(BaseAction):
23
22
  render_context.frid_context.refactoring_iteration += 1
24
23
 
25
24
  if render_context.frid_context.refactoring_iteration >= MAX_REFACTORING_ITERATIONS:
26
- functionality = qualified_frid(render_context.module_name, render_context.frid_context.frid)
25
+ functionality = render_context.functionality_label()
27
26
  error_message = (
28
27
  f"Refactoring iterations limit of {MAX_REFACTORING_ITERATIONS} reached "
29
28
  f"for functionality {functionality}."
@@ -147,7 +147,7 @@ class RenderConformanceTests(BaseAction):
147
147
  that writes a test the specification did not ask for, or leaves one it did ask for unwritten,
148
148
  must say so instead of reporting success.
149
149
  """
150
- frid = render_context.conformance_tests_running_context.current_testing_frid
150
+ frid = render_context.testing_functionality_label()
151
151
 
152
152
  missing = traceability.get("missing") or []
153
153
  if missing:
@@ -5,7 +5,6 @@ import render_machine.render_utils as render_utils
5
5
  from memory_management import MemoryManager
6
6
  from plain2code_console import RETRY_COLOR, console
7
7
  from plain2code_exceptions import FunctionalRequirementTooComplex
8
- from plain2code_utils import qualified_frid
9
8
  from render_machine.actions.base_action import BaseAction
10
9
  from render_machine.implementation_code_helpers import ImplementationCodeHelpers
11
10
  from render_machine.render_context import MAX_UNITTEST_FIX_ATTEMPTS, RenderContext
@@ -37,7 +36,7 @@ class RenderFunctionalRequirement(BaseAction):
37
36
  def execute(self, render_context: RenderContext, _previous_action_payload: Any | None):
38
37
  if render_context.frid_context.functional_requirement_render_attempts >= MAX_CODE_GENERATION_RETRIES:
39
38
  # A render attempt is only restarted once its unit tests used up every fix round.
40
- functionality = qualified_frid(render_context.module_name, render_context.frid_context.frid)
39
+ functionality = render_context.functionality_label()
41
40
  error_msg = (
42
41
  f"Functionality {functionality}: unit tests still fail after "
43
42
  f"{MAX_CODE_GENERATION_RETRIES} render attempts, {MAX_UNITTEST_FIX_ATTEMPTS} fix rounds each."
@@ -54,7 +53,7 @@ class RenderFunctionalRequirement(BaseAction):
54
53
  console.info(
55
54
  f"↻ Unittests could not be fixed after rendering the functionality. "
56
55
  f"Restarting rendering functionality "
57
- f"{qualified_frid(render_context.module_name, render_context.frid_context.frid)} from scratch.",
56
+ f"{render_context.functionality_label()} from scratch.",
58
57
  color=RETRY_COLOR,
59
58
  )
60
59
 
@@ -3,7 +3,6 @@ from typing import Any
3
3
 
4
4
  import render_machine.render_utils as render_utils
5
5
  from plain2code_console import console
6
- from plain2code_utils import qualified_frid
7
6
  from render_machine.actions.base_action import BaseAction
8
7
  from render_machine.render_context import RenderContext
9
8
  from render_machine.render_types import RenderError
@@ -34,11 +33,11 @@ class RunConformanceTests(BaseAction):
34
33
  )
35
34
  )
36
35
 
37
- ctx = render_context.conformance_tests_running_context
36
+ position = render_context.testing_functionality_position()
38
37
  console.info(
39
38
  f"Running conformance tests script {conformance_tests_script} "
40
39
  + f"for {conformance_tests_folder_name} ("
41
- + f"functionality {qualified_frid(ctx.current_testing_module_name, ctx.current_testing_frid)}"
40
+ + f"functionality {render_context.testing_functionality_label()}"
42
41
  + ")."
43
42
  )
44
43
  exit_code, conformance_tests_issue, conformance_tests_temp_log_file_path = render_utils.execute_script(
@@ -47,6 +46,7 @@ class RunConformanceTests(BaseAction):
47
46
  "Conformance Tests",
48
47
  frid=render_context.conformance_tests_running_context.current_testing_frid,
49
48
  module=render_context.conformance_tests_running_context.current_testing_module_name,
49
+ frid_position=position,
50
50
  timeout=render_context.test_script_timeout,
51
51
  stop_event=render_context.stop_event,
52
52
  )
@@ -1,7 +1,6 @@
1
1
  from typing import Any
2
2
 
3
3
  from plain2code_console import console
4
- from plain2code_utils import qualified_frid
5
4
  from render_machine.actions.base_action import BaseAction
6
5
  from render_machine.render_context import RenderContext
7
6
 
@@ -10,7 +9,7 @@ class SummarizeConformanceTests(BaseAction):
10
9
  SUCCESSFUL_OUTCOME = "conformance_tests_summarized"
11
10
 
12
11
  def execute(self, render_context: RenderContext, _previous_action_payload: Any | None):
13
- functionality = qualified_frid(render_context.module_name, render_context.frid_context.frid)
12
+ functionality = render_context.functionality_label()
14
13
  console.info(f"Summarizing conformance tests for functionality {functionality}.")
15
14
 
16
15
  _, existing_conformance_test_files_content = (
@@ -10,7 +10,7 @@ from event_bus import EventBus
10
10
  from plain2code_console import RETRY_COLOR, console
11
11
  from plain2code_events import RenderContextSnapshot
12
12
  from plain2code_state import RunState
13
- from plain2code_utils import functionality_position, qualified_frid
13
+ from plain2code_utils import functionality_position, qualified_frid, with_position
14
14
  from plain_modules import PlainModule
15
15
  from render_machine import triggers
16
16
  from render_machine.conformance_tests import CONFORMANCE_TESTS_DEFINITION_FILE_NAME, ConformanceTests
@@ -129,6 +129,37 @@ class RenderContext:
129
129
  self.frid_context.frid if self.frid_context else None,
130
130
  )
131
131
 
132
+ def testing_functionality_position(self) -> Optional[str]:
133
+ """Where the functionality under conformance test stands among those of its module, as "3/12"."""
134
+ ctx = self.conformance_tests_running_context
135
+ if ctx.current_testing_module_name == self.module_name:
136
+ plain_source_tree = self.plain_source_tree
137
+ else:
138
+ plain_source_tree = next(
139
+ module.plain_source
140
+ for module in self.required_modules
141
+ if module.module_name == ctx.current_testing_module_name
142
+ )
143
+ return functionality_position(list(plain_spec.get_frids(plain_source_tree)), ctx.current_testing_frid)
144
+
145
+ def functionality_label(self, frid: Optional[str] = None) -> Optional[str]:
146
+ """A functionality of this module named for the logs, as "module:func-id (3/12)".
147
+
148
+ Without a frid, it is the functionality being implemented.
149
+ """
150
+ if frid is None:
151
+ frid = self.frid_context.frid
152
+ position = functionality_position(list(plain_spec.get_frids(self.plain_source_tree)), frid)
153
+ return with_position(qualified_frid(self.module_name, frid), position)
154
+
155
+ def testing_functionality_label(self) -> Optional[str]:
156
+ """The functionality under conformance test named for the logs, as "module:func-id (3/12)"."""
157
+ ctx = self.conformance_tests_running_context
158
+ return with_position(
159
+ qualified_frid(ctx.current_testing_module_name, ctx.current_testing_frid),
160
+ self.testing_functionality_position(),
161
+ )
162
+
132
163
  def create_snapshot(self) -> RenderContextSnapshot:
133
164
  return RenderContextSnapshot(
134
165
  frid_context=deepcopy(self.frid_context) if self.frid_context else None,
@@ -306,11 +337,11 @@ class RenderContext:
306
337
  self.functional_requirements_render_attempts_failed_unit_during_conformance_tests
307
338
  >= MAX_FUNCTIONAL_REQUIREMENT_RENDER_ATTEMPTS_FAILED_UNIT_DURING_CONFORMANCE_TESTS
308
339
  ):
309
- functionality = qualified_frid(self.module_name, self.frid_context.frid)
340
+ functionality = self.functionality_label()
310
341
  error_msg = f"Failed to adjust the unit tests after implementation code was update while fixing the conformance tests for functionality {functionality} for the {MAX_FUNCTIONAL_REQUIREMENT_RENDER_ATTEMPTS_FAILED_UNIT_DURING_CONFORMANCE_TESTS} times."
311
342
  self.dispatch_error(error_msg)
312
343
  else:
313
- functionality = qualified_frid(self.module_name, self.frid_context.frid)
344
+ functionality = self.functionality_label()
314
345
  console.info(
315
346
  f"↻ Failed to adjust the unit tests after implementation code was updated while fixing the "
316
347
  f"conformance tests for functionality {functionality}. "
@@ -348,7 +379,7 @@ class RenderContext:
348
379
  # No scenario was written for this functionality, so no conformance test is rendered or run
349
380
  # for it. The tests of the previous functionalities still run, so a regression it causes is
350
381
  # still caught.
351
- functionality = qualified_frid(self.module_name, self.frid_context.frid)
382
+ functionality = self.functionality_label()
352
383
  if self._has_conformance_tests_to_run_in_regression():
353
384
  console.info(
354
385
  f"No conformance scenario is written for {functionality}. "
@@ -440,10 +471,7 @@ class RenderContext:
440
471
  """Handle regeneration of conformance tests after too many failures."""
441
472
  ctx = self.conformance_tests_running_context
442
473
 
443
- console.info(
444
- f"Recreating conformance tests for functionality "
445
- f"{qualified_frid(ctx.current_testing_module_name, ctx.current_testing_frid)}."
446
- )
474
+ console.info(f"Recreating conformance tests for functionality " f"{self.testing_functionality_label()}.")
447
475
 
448
476
  existing_folder = ctx.get_conformance_tests_json(ctx.current_testing_module_name).pop(ctx.current_testing_frid)
449
477
  file_utils.delete_folder(existing_folder["folder_name"])
@@ -15,6 +15,7 @@ import file_utils
15
15
  import plain_spec
16
16
  from plain2code_console import MUTED_COLOR, RETRY_COLOR, SUCCESS_COLOR, console
17
17
  from plain2code_exceptions import RenderCancelledError
18
+ from plain2code_utils import with_position
18
19
 
19
20
  SCRIPT_EXECUTION_TIMEOUT = 120
20
21
  TIMEOUT_ERROR_EXIT_CODE = 124
@@ -92,6 +93,7 @@ def execute_script( # noqa: C901
92
93
  script_type: str,
93
94
  frid: Optional[str] = None,
94
95
  module: Optional[str] = None,
96
+ frid_position: Optional[str] = None,
95
97
  timeout: Optional[int] = None,
96
98
  stop_event: Optional[threading.Event] = None,
97
99
  ) -> tuple[int, str, Optional[str]]:
@@ -179,10 +181,11 @@ def execute_script( # noqa: C901
179
181
 
180
182
  console.debug(f"{script_type} script output stored in: {temp_file_path.strip()}", color=MUTED_COLOR)
181
183
 
184
+ frid_label = with_position(frid, frid_position)
182
185
  if proc.returncode != 0:
183
186
  if frid is not None:
184
187
  console.info(
185
- f"↻ The {script_type} script for functionality ID {frid} of module {module} has failed. "
188
+ f"↻ The {script_type} script for functionality ID {frid_label} of module {module} has failed. "
186
189
  f"Initiating the patching mode to automatically correct the discrepancies.",
187
190
  color=RETRY_COLOR,
188
191
  )
@@ -195,7 +198,7 @@ def execute_script( # noqa: C901
195
198
  else:
196
199
  if frid is not None:
197
200
  console.info(
198
- f"✓ The {script_type} script for functionality ID {frid} of module {module} "
201
+ f"✓ The {script_type} script for functionality ID {frid_label} of module {module} "
199
202
  f"has passed successfully.",
200
203
  color=SUCCESS_COLOR,
201
204
  )
@@ -56,6 +56,7 @@ def render_context(tmp_path):
56
56
  frid=FRID, linked_resources={}, specifications={plain_spec.ACCEPTANCE_TESTS: SCENARIOS}
57
57
  ),
58
58
  get_required_modules_functionalities=lambda: {},
59
+ testing_functionality_label=lambda: FRID,
59
60
  )
60
61
 
61
62
 
@@ -127,6 +128,7 @@ class TestRegeneratedConformanceTests:
127
128
 
128
129
  render_context = RenderContext.__new__(RenderContext)
129
130
  render_context.module_name = MODULE
131
+ render_context.plain_source_tree = {}
130
132
  folder = tmp_path / "tests_folder"
131
133
  folder.mkdir()
132
134
 
@@ -47,6 +47,7 @@ def make_render_context(api, memory_folder, build_folder):
47
47
  frid_context=SimpleNamespace(frid="1", linked_resources={}),
48
48
  get_required_modules_functionalities=lambda: {},
49
49
  run_state=SimpleNamespace(render_id="test-render-id"),
50
+ functionality_label=lambda: "mod:1",
50
51
  )
51
52
 
52
53
 
@@ -51,6 +51,9 @@ class FakeCodeplainAPI:
51
51
  class FakeRenderContext(SimpleNamespace):
52
52
  unit_tests_agent_session = RenderContext.unit_tests_agent_session
53
53
 
54
+ def testing_functionality_label(self):
55
+ return self.conformance_tests_running_context.current_testing_frid
56
+
54
57
 
55
58
  class FakeConformanceTests:
56
59
  def fetch_existing_conformance_test_files(self, *args):
@@ -118,7 +118,7 @@ def test_unit_tests_failing_after_the_last_attempt_name_the_cause(workspace, fix
118
118
  assert last_output_path is not None and os.path.exists(last_output_path)
119
119
 
120
120
  expected_message = (
121
- f"Functionality pr_solo:solo-one: unit tests still fail after {MAX_CODE_GENERATION_RETRIES} render attempts, "
121
+ f"Functionality pr_solo:solo-one (1/3): unit tests still fail after {MAX_CODE_GENERATION_RETRIES} render attempts, "
122
122
  f"{MAX_UNITTEST_FIX_ATTEMPTS} fix rounds each. Last unit tests output: {last_output_path}"
123
123
  )
124
124
  assert error_log_messages(caplog) == [expected_message]
@@ -11,7 +11,7 @@ from render_machine.actions.render_conformance_tests import RenderConformanceTes
11
11
 
12
12
  def _render_context(frid: str = "add-task"):
13
13
  return SimpleNamespace(
14
- conformance_tests_running_context=SimpleNamespace(current_testing_frid=frid),
14
+ testing_functionality_label=lambda: frid,
15
15
  )
16
16
 
17
17