codeplain 0.4.3.dev64__py3-none-any.whl → 0.4.3.dev66__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 (37) hide show
  1. {codeplain-0.4.3.dev64.dist-info → codeplain-0.4.3.dev66.dist-info}/METADATA +1 -1
  2. {codeplain-0.4.3.dev64.dist-info → codeplain-0.4.3.dev66.dist-info}/RECORD +37 -33
  3. codeplain_REST_api.py +12 -0
  4. git_utils.py +66 -0
  5. module_renderer.py +23 -5
  6. partial_rendering.py +34 -10
  7. plain2code.py +18 -4
  8. plain2code_arguments.py +6 -0
  9. plain_modules.py +95 -13
  10. render_machine/actions/commit_conformance_tests_changes.py +7 -3
  11. render_machine/actions/exit_with_error.py +7 -6
  12. render_machine/actions/finish_functional_requirement.py +16 -4
  13. render_machine/actions/fix_unit_tests.py +19 -0
  14. render_machine/actions/prepare_repositories.py +68 -0
  15. render_machine/actions/render_conformance_tests.py +20 -2
  16. render_machine/actions/render_functional_requirement.py +3 -0
  17. render_machine/render_context.py +63 -17
  18. render_machine/render_types.py +4 -1
  19. render_machine/render_utils.py +6 -0
  20. render_machine/state_machine_config.py +2 -4
  21. tests/test_conformance_fix_conversation.py +1 -0
  22. tests/test_conformance_tests_json_order.py +37 -0
  23. tests/test_fix_unit_tests_action.py +35 -0
  24. tests/test_fix_unit_tests_conformance_context.py +1 -0
  25. tests/test_git_utils.py +26 -0
  26. tests/test_partial_rendering.py +3 -0
  27. tests/test_plain_modules.py +240 -0
  28. tests/test_prepare_repositories_layout.py +2 -1
  29. tests/test_regenerate_checks.py +173 -0
  30. tests/test_regenerate_reset.py +167 -0
  31. tests/test_render_context_conformance_regression.py +198 -0
  32. tests/test_render_stop_reason.py +27 -2
  33. tests/test_terminal_attachment.py +1 -0
  34. tui/plain_module_render_choice_tui.py +7 -0
  35. {codeplain-0.4.3.dev64.dist-info → codeplain-0.4.3.dev66.dist-info}/WHEEL +0 -0
  36. {codeplain-0.4.3.dev64.dist-info → codeplain-0.4.3.dev66.dist-info}/entry_points.txt +0 -0
  37. {codeplain-0.4.3.dev64.dist-info → codeplain-0.4.3.dev66.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,167 @@
1
+ """A regeneration starts from the last finished functionality.
2
+
3
+ An interrupted regeneration, or a failed attempt inside one render, leaves commits and changes on
4
+ top of the last "fully implemented" or "fully regenerated" commit. The next attempt must not start
5
+ from that code.
6
+ """
7
+
8
+ import os
9
+ from pathlib import Path
10
+ from types import SimpleNamespace
11
+
12
+ import pytest
13
+ from git import Repo
14
+
15
+ import git_utils
16
+ from plain2code_exceptions import InvalidGitRepositoryError
17
+ from render_machine import render_utils
18
+ from render_machine.actions.prepare_repositories import PrepareRepositories
19
+
20
+ MODULE = "ledger"
21
+ FRIDS = ["ledger-storage", "add-expense", "list-expenses"]
22
+
23
+
24
+ def _commit(repo_path, message, frid, files, module_name=MODULE):
25
+ for name, text in files.items():
26
+ path = Path(repo_path) / name
27
+ path.parent.mkdir(parents=True, exist_ok=True)
28
+ path.write_text(text)
29
+ git_utils.add_all_files_and_commit(repo_path, message.format(frid), module_name, frid, "render-id")
30
+
31
+
32
+ def _rendered_repo(repo_path):
33
+ git_utils.init_git_repo(repo_path, MODULE, "render-id")
34
+ for frid in FRIDS:
35
+ _commit(repo_path, git_utils.FUNCTIONAL_REQUIREMENT_FINISHED_COMMIT_MESSAGE, frid, {f"{frid}.py": "v1\n"})
36
+
37
+
38
+ def _interrupted_regeneration(repo_path):
39
+ """A finished regeneration of add-expense, then a second one that was interrupted."""
40
+ _commit(
41
+ repo_path,
42
+ git_utils.FUNCTIONAL_REQUIREMENT_REGENERATED_COMMIT_MESSAGE,
43
+ "add-expense",
44
+ {"add-expense.py": "v2\n"},
45
+ )
46
+ finished = Repo(repo_path).head.commit.hexsha
47
+ _commit(
48
+ repo_path,
49
+ git_utils.FUNCTIONAL_REQUIREMENT_IMPLEMENTED_COMMIT_MESSAGE,
50
+ "add-expense",
51
+ {"add-expense.py": "interrupted\n"},
52
+ )
53
+ (Path(repo_path) / "add-expense.py").write_text("interrupted, not committed\n")
54
+ (Path(repo_path) / "new_file.py").write_text("not committed\n")
55
+ return finished
56
+
57
+
58
+ def test_reset_goes_to_the_newest_finished_commit(tmp_path):
59
+ _rendered_repo(tmp_path)
60
+ finished = _interrupted_regeneration(tmp_path)
61
+
62
+ git_utils.revert_to_last_finished_commit(tmp_path, MODULE)
63
+
64
+ assert Repo(tmp_path).head.commit.hexsha == finished
65
+ assert (tmp_path / "add-expense.py").read_text() == "v2\n"
66
+ # The functionalities after the regenerated one keep their code.
67
+ assert (tmp_path / "list-expenses.py").read_text() == "v1\n"
68
+ assert not (tmp_path / "new_file.py").exists()
69
+
70
+
71
+ def test_reset_without_a_regeneration_goes_to_the_last_implemented_commit(tmp_path):
72
+ _rendered_repo(tmp_path)
73
+ finished = Repo(tmp_path).head.commit.hexsha
74
+ _commit(
75
+ tmp_path, git_utils.FUNCTIONAL_REQUIREMENT_IMPLEMENTED_COMMIT_MESSAGE, "add-expense", {"add-expense.py": "x\n"}
76
+ )
77
+
78
+ git_utils.revert_to_last_finished_commit(tmp_path, MODULE)
79
+
80
+ assert Repo(tmp_path).head.commit.hexsha == finished
81
+
82
+
83
+ def test_reset_ignores_the_commits_of_another_module(tmp_path):
84
+ git_utils.init_git_repo(tmp_path, "base", "render-id")
85
+ _commit(tmp_path, git_utils.FUNCTIONAL_REQUIREMENT_FINISHED_COMMIT_MESSAGE, "base-fr", {"a.py": "a\n"}, "base")
86
+
87
+ with pytest.raises(InvalidGitRepositoryError):
88
+ git_utils.revert_to_last_finished_commit(tmp_path, MODULE)
89
+
90
+
91
+ def _render_context(code, tests, conformance_tests_json):
92
+ store = {"json": conformance_tests_json}
93
+ conformance_tests = SimpleNamespace(
94
+ get_conformance_tests_json=lambda module_name: dict(store["json"]),
95
+ dump_conformance_tests_json=lambda module_name, data: store.update(json=data),
96
+ get_module_conformance_tests_folder=lambda module_name: str(tests),
97
+ )
98
+ metadata = {"functionalities": [{"id": frid, "markdown": f"- {frid}"} for frid in FRIDS]}
99
+ return SimpleNamespace(
100
+ is_regenerate=True,
101
+ render_range=["add-expense"],
102
+ build_folder=str(code),
103
+ module_name=MODULE,
104
+ plain_module=SimpleNamespace(load_module_metadata=lambda: metadata),
105
+ render_conformance_tests=True,
106
+ conformance_tests=conformance_tests,
107
+ starting_frid=None,
108
+ old_frid_spec=None,
109
+ code_functional_requirements=None,
110
+ )
111
+
112
+
113
+ def test_regeneration_after_an_interrupted_one_starts_from_finished_code_and_tests(tmp_path):
114
+ code, tests = tmp_path / "code", tmp_path / "tests"
115
+ _rendered_repo(code)
116
+ finished_code = _interrupted_regeneration(code)
117
+ _rendered_repo(tests)
118
+ finished_tests = Repo(tests).head.commit.hexsha
119
+ # The interrupted regeneration removed the old tests of add-expense and did not commit.
120
+ os.remove(tests / "add-expense.py")
121
+ render_context = _render_context(code, tests, {"add-expense": {"folder_name": str(tests / "tests_add_expense")}})
122
+
123
+ outcome, _ = PrepareRepositories().execute(render_context, None)
124
+
125
+ assert outcome == PrepareRepositories.SUCCESSFUL_OUTCOME
126
+ assert Repo(code).head.commit.hexsha == finished_code
127
+ assert (code / "add-expense.py").read_text() == "v2\n"
128
+ assert not Repo(code).is_dirty(untracked_files=True)
129
+ assert Repo(tests).head.commit.hexsha == finished_tests
130
+
131
+
132
+ def test_retry_inside_a_regeneration_removes_only_the_failed_attempt(tmp_path):
133
+ _rendered_repo(tmp_path)
134
+ finished = _interrupted_regeneration(tmp_path)
135
+ render_context = SimpleNamespace(is_regenerate=True, build_folder=str(tmp_path), module_name=MODULE)
136
+
137
+ render_utils.revert_changes_for_frid(render_context)
138
+
139
+ assert Repo(tmp_path).head.commit.hexsha == finished
140
+ assert (tmp_path / "list-expenses.py").read_text() == "v1\n"
141
+
142
+
143
+ def test_reset_ignores_a_module_whose_name_starts_with_the_module_name(tmp_path):
144
+ git_utils.init_git_repo(tmp_path, "ledger_base", "render-id")
145
+ _commit(
146
+ tmp_path,
147
+ git_utils.FUNCTIONAL_REQUIREMENT_FINISHED_COMMIT_MESSAGE,
148
+ "storage",
149
+ {"storage.py": "v1\n"},
150
+ module_name="ledger_base",
151
+ )
152
+
153
+ with pytest.raises(InvalidGitRepositoryError):
154
+ git_utils.revert_to_last_finished_commit(tmp_path, MODULE)
155
+
156
+
157
+ def test_regenerated_frids_ignore_a_module_whose_name_starts_with_the_module_name(tmp_path):
158
+ _rendered_repo(tmp_path)
159
+ _commit(
160
+ tmp_path,
161
+ git_utils.FUNCTIONAL_REQUIREMENT_REGENERATED_COMMIT_MESSAGE,
162
+ "list-expenses",
163
+ {"list-expenses.py": "v2\n"},
164
+ module_name="ledger_base",
165
+ )
166
+
167
+ assert git_utils.get_frids_regenerated_after_frid(tmp_path, "add-expense", MODULE) == []
@@ -0,0 +1,198 @@
1
+ """Regression testing loop of the conformance tests, for a regenerated functionality.
2
+
3
+ The regenerated functionality is tested in the initial phase, so the regression loop moves past it.
4
+ Getting the next test moves the frid of the running context in place, and there is no frid after the
5
+ last one, so the loop must not advance when the regenerated functionality is the last one.
6
+ """
7
+
8
+ import plain_spec
9
+ from render_machine import triggers
10
+ from render_machine.render_context import RenderContext
11
+ from render_machine.render_types import ConformanceTestsRunningContext
12
+ from render_machine.render_types import TestExecutionPhase as ExecutionPhase
13
+
14
+ FRIDS = ("fr-one", "fr-two", "fr-three", "fr-four")
15
+ PLAIN_SOURCE_TREE = {"functional specs": [{"id": frid, "markdown": f"- {frid}"} for frid in FRIDS]}
16
+
17
+
18
+ class _RecordingMachine:
19
+ def __init__(self):
20
+ self.dispatched = []
21
+
22
+ def dispatch(self, trigger):
23
+ self.dispatched.append(trigger)
24
+
25
+
26
+ def _render_context(current_frid, frid_being_implemented, frids_with_tests, testing_module_name="cli"):
27
+ """A RenderContext carrying only what _handle_regression_testing reads.
28
+
29
+ _get_next_test_to_run is deliberately NOT stubbed: the real one moves the frid of the running
30
+ context in place, which is the behaviour these tests need to cover.
31
+ """
32
+ context = ConformanceTestsRunningContext(
33
+ current_testing_module_name=testing_module_name,
34
+ current_testing_frid=current_frid,
35
+ fix_attempts=0,
36
+ conformance_tests_json={
37
+ frid: {"folder_name": f"tests_{frid}", "functional_requirement": f"- {frid}"} for frid in frids_with_tests
38
+ },
39
+ conformance_tests_render_attempts=0,
40
+ current_testing_frid_specifications=None,
41
+ should_prepare_testing_environment=False,
42
+ frid_being_implemented=frid_being_implemented,
43
+ )
44
+ context.execution_phase = ExecutionPhase.RUNNING_REGRESSION
45
+
46
+ render_context = RenderContext.__new__(RenderContext)
47
+ render_context.is_regenerate = True
48
+ render_context.module_name = "cli"
49
+ render_context.required_modules = []
50
+ render_context.plain_source_tree = PLAIN_SOURCE_TREE
51
+ render_context.machine = _RecordingMachine()
52
+ render_context.conformance_tests_running_context = context
53
+ return render_context
54
+
55
+
56
+ def test_regenerate_of_last_functionality_ends_the_regression_run():
57
+ """The regression loop reaches the regenerated last functionality. It must complete there and keep
58
+ the frid, because the postprocessing steps look their folder up by it."""
59
+ render_context = _render_context(
60
+ current_frid="fr-three", frid_being_implemented="fr-four", frids_with_tests=["fr-three", "fr-four"]
61
+ )
62
+
63
+ render_context._handle_regression_testing()
64
+
65
+ context = render_context.conformance_tests_running_context
66
+ assert render_context.machine.dispatched == [triggers.MARK_ALL_CONFORMANCE_TESTS_PASSED]
67
+ assert context.execution_phase is ExecutionPhase.COMPLETED
68
+ # The frid must survive. Moving past the last functionality would leave it as None, and the
69
+ # conformance test folder lookup would then raise a KeyError of None.
70
+ assert context.current_testing_frid == "fr-four"
71
+
72
+
73
+ def test_regenerate_of_earlier_functionality_advances_past_it():
74
+ """When the regenerated functionality is not the last one, the loop moves on to the next test."""
75
+ render_context = _render_context(
76
+ current_frid="fr-one", frid_being_implemented="fr-two", frids_with_tests=["fr-one", "fr-two", "fr-three"]
77
+ )
78
+
79
+ render_context._handle_regression_testing()
80
+
81
+ context = render_context.conformance_tests_running_context
82
+ assert context.current_testing_frid == "fr-three"
83
+ assert context.current_testing_frid_specifications is not None
84
+ assert render_context.machine.dispatched == [triggers.MARK_CONFORMANCE_TESTS_READY]
85
+
86
+
87
+ def test_regenerate_runs_the_tests_of_the_last_functionality():
88
+ """The functionalities after the regenerated one keep their code, so their tests are run as a
89
+ regression check. This includes the last functionality in the spec file."""
90
+ render_context = _render_context(
91
+ current_frid="fr-three", frid_being_implemented="fr-two", frids_with_tests=list(FRIDS)
92
+ )
93
+
94
+ render_context._handle_regression_testing()
95
+
96
+ context = render_context.conformance_tests_running_context
97
+ assert render_context.machine.dispatched == [triggers.MARK_CONFORMANCE_TESTS_READY]
98
+ assert context.execution_phase is ExecutionPhase.RUNNING_REGRESSION
99
+ assert context.current_testing_frid == "fr-four"
100
+
101
+
102
+ def test_regenerate_ends_the_regression_run_on_the_regenerated_functionality():
103
+ """After the last functionality, the run ends on the regenerated functionality, because the
104
+ postprocessing steps look their conformance test folder up by it."""
105
+ render_context = _render_context(
106
+ current_frid="fr-four", frid_being_implemented="fr-two", frids_with_tests=list(FRIDS)
107
+ )
108
+
109
+ render_context._handle_regression_testing()
110
+
111
+ context = render_context.conformance_tests_running_context
112
+ assert render_context.machine.dispatched == [triggers.MARK_ALL_CONFORMANCE_TESTS_PASSED]
113
+ assert context.execution_phase is ExecutionPhase.COMPLETED
114
+ assert context.current_testing_frid == "fr-two"
115
+ assert context.current_testing_frid_specifications is not None
116
+
117
+
118
+ def test_regenerate_tests_the_regenerated_functionality_again_when_code_changed():
119
+ """When the code changed during the run, the regenerated functionality is tested once more, not the
120
+ last functionality in the spec file."""
121
+ render_context = _render_context(
122
+ current_frid="fr-four", frid_being_implemented="fr-two", frids_with_tests=list(FRIDS)
123
+ )
124
+ render_context.conformance_tests_running_context.code_changed_during_regression = True
125
+
126
+ render_context._handle_regression_testing()
127
+
128
+ context = render_context.conformance_tests_running_context
129
+ assert render_context.machine.dispatched == [triggers.MARK_CONFORMANCE_TESTS_READY]
130
+ assert context.execution_phase is ExecutionPhase.COMPLETED
131
+ assert context.current_testing_frid == "fr-two"
132
+
133
+
134
+ def test_regenerated_functionality_number_of_a_required_module_still_runs():
135
+ """Only the module that owns the regenerated functionality skips it in the regression run. A
136
+ required module that happens to have a functionality with the same number must still be tested."""
137
+ render_context = _render_context(
138
+ current_frid="fr-one",
139
+ frid_being_implemented="fr-two",
140
+ frids_with_tests=["fr-one", "fr-two", "fr-three"],
141
+ testing_module_name="ledger",
142
+ )
143
+
144
+ render_context._handle_regression_testing()
145
+
146
+ context = render_context.conformance_tests_running_context
147
+ assert context.current_testing_module_name == "ledger"
148
+ assert context.current_testing_frid == "fr-two"
149
+ assert render_context.machine.dispatched == [triggers.MARK_CONFORMANCE_TESTS_READY]
150
+
151
+
152
+ def test_regression_run_ends_when_the_next_functionality_has_no_conformance_tests():
153
+ """A project that was rendered only in part has functionalities without conformance tests. The
154
+ regression run must end there, on the functionality being implemented, and report that all
155
+ conformance tests passed."""
156
+ # The spec file holds four functionalities, but only 1, 2 and 3 were ever given conformance
157
+ # tests. Functionality 2 is the regenerated one, and 3 has just been tested.
158
+ render_context = _render_context(
159
+ current_frid="fr-three", frid_being_implemented="fr-two", frids_with_tests=["fr-one", "fr-three", "fr-two"]
160
+ )
161
+
162
+ render_context._handle_regression_testing()
163
+
164
+ context = render_context.conformance_tests_running_context
165
+ assert render_context.machine.dispatched == [triggers.MARK_ALL_CONFORMANCE_TESTS_PASSED]
166
+ assert context.execution_phase is ExecutionPhase.COMPLETED
167
+ # The postprocessing steps look the conformance test folder up by this frid, so it must be the
168
+ # functionality being implemented and not the one without conformance tests.
169
+ assert context.current_testing_frid == "fr-two"
170
+ assert context.current_testing_frid_specifications is not None
171
+
172
+
173
+ def test_regression_run_tests_the_implemented_functionality_again_when_code_changed():
174
+ """When the implementation code changed during the run, the functionality being implemented is
175
+ tested once more before the run ends."""
176
+ render_context = _render_context(
177
+ current_frid="fr-three", frid_being_implemented="fr-two", frids_with_tests=["fr-one", "fr-three", "fr-two"]
178
+ )
179
+ render_context.conformance_tests_running_context.code_changed_during_regression = True
180
+
181
+ render_context._handle_regression_testing()
182
+
183
+ context = render_context.conformance_tests_running_context
184
+ assert render_context.machine.dispatched == [triggers.MARK_CONFORMANCE_TESTS_READY]
185
+ assert context.execution_phase is ExecutionPhase.COMPLETED
186
+ assert context.current_testing_frid == "fr-two"
187
+
188
+
189
+ def test_acceptance_test_of_another_functionality_is_not_read_past_its_end():
190
+ """The completed count belongs to the functionality being implemented. Another functionality can
191
+ have fewer acceptance tests, so the count is not a valid position in its list."""
192
+ context = _render_context(
193
+ current_frid="fr-one", frid_being_implemented="fr-two", frids_with_tests=["fr-one"]
194
+ ).conformance_tests_running_context
195
+ context.current_testing_frid_specifications = {plain_spec.ACCEPTANCE_TESTS: ["- the only acceptance test"]}
196
+ context.acceptance_tests_completed = 2
197
+
198
+ assert context.get_current_acceptance_scenario() is None
@@ -14,6 +14,7 @@ from types import SimpleNamespace
14
14
 
15
15
  import pytest
16
16
 
17
+ import git_utils
17
18
  import plain2code_logger
18
19
  from event_bus import EventBus
19
20
  from memory_management import MemoryManager
@@ -53,7 +54,7 @@ def workspace():
53
54
  yield build_folder, unittests_script
54
55
 
55
56
 
56
- def make_render_context(api, build_folder, unittests_script, fixtures_dir):
57
+ def make_render_context(api, build_folder, unittests_script, fixtures_dir, render_range=None, is_regenerate=False):
57
58
  plain_module = PlainModule("pr_solo.plain", build_folder, [fixtures_dir])
58
59
  os.makedirs(plain_module.module_build_folder, exist_ok=True)
59
60
  return RenderContext(
@@ -68,12 +69,13 @@ def make_render_context(api, build_folder, unittests_script, fixtures_dir):
68
69
  prepare_environment_script=None,
69
70
  copy_build=False,
70
71
  copy_conformance_tests=False,
71
- render_range=None,
72
+ render_range=render_range,
72
73
  render_conformance_tests=False,
73
74
  base_folder=fixtures_dir,
74
75
  run_state=RunState(spec_filename="pr_solo.plain"),
75
76
  event_bus=EventBus(),
76
77
  enter_pause_event=threading.Event(),
78
+ is_regenerate=is_regenerate,
77
79
  )
78
80
 
79
81
 
@@ -208,3 +210,26 @@ class TestExitWithErrorMessage:
208
210
  assert len(messages) == 1
209
211
  assert "None" not in messages[0]
210
212
  assert render_context.last_error_message == messages[0]
213
+
214
+
215
+ def test_regenerating_a_functionality_that_was_not_rendered_names_the_cause(workspace, fixtures_dir, caplog):
216
+ build_folder, unittests_script = workspace
217
+ api = FakeCodeplainAPI()
218
+ render_context = make_render_context(
219
+ api, build_folder, unittests_script, fixtures_dir, render_range=["solo-two"], is_regenerate=True
220
+ )
221
+ # A module repository with no functionality rendered yet.
222
+ git_utils.init_git_repo(render_context.build_folder, "pr_solo")
223
+ code_renderer = CodeRenderer(render_context)
224
+
225
+ with caplog.at_level(logging.DEBUG, logger=plain2code_logger.LOGGER_NAME):
226
+ code_renderer.run()
227
+
228
+ expected_message = (
229
+ "Cannot regenerate functionality solo-two because it has not been fully rendered yet. "
230
+ "Please render all functionalities first by running: codeplain pr_solo.plain"
231
+ )
232
+ assert render_context.state == States.RENDER_FAILED.value
233
+ assert error_log_messages(caplog) == [expected_message]
234
+ # The TUI shows the same stop reason as the log.
235
+ assert render_context.last_error_message == expected_message
@@ -82,6 +82,7 @@ def make_args():
82
82
  build_folder="build",
83
83
  render_range=None,
84
84
  render_from=None,
85
+ regenerate=None,
85
86
  force_render=False,
86
87
  headless=False,
87
88
  exit_when_done=False,
@@ -58,6 +58,13 @@ class PlainModuleRenderChoiceTUI(App):
58
58
  f" in module [#5593FF]{render_choice.module.module_name}[/]"
59
59
  f": [#888]{quote}[/]"
60
60
  )
61
+ elif render_choice.choice_type == "render_from_regenerated":
62
+ assert render_choice.module is not None
63
+ assert render_choice.render_range is not None
64
+ return (
65
+ f"Render from regenerated functionality [#5593FF]{render_choice.render_range[0]}[/]"
66
+ f" in module [#5593FF]{render_choice.module.module_name}[/]"
67
+ )
61
68
  elif render_choice.choice_type == "rerender_affected" and self.plain_module_render_state.change is not None:
62
69
  all_affected_modules = get_all_affected_modules_from_change(
63
70
  self.plain_module, self.plain_module_render_state