@@ -149,11 +149,15 @@ def _invoke_ark_start_goal_cli(
149149 return exit_code , payload
150150
151151
152- def _block_effect_runtime_startup (monkeypatch : pytest .MonkeyPatch ) -> None :
152+ def _block_effect_runtime_startup (
153+ monkeypatch : pytest .MonkeyPatch ,
154+ * ,
155+ diagnostic_code : str = "node_unavailable" ,
156+ ) -> None :
153157 def unavailable (* _args : object , ** _kwargs : object ) -> object :
154158 raise effect_runtime .EffectRuntimeStartupError (
155- "LoopX Effect runtime requires Node.js 22.6.0 or newer " ,
156- diagnostic_code = "node_unavailable" ,
159+ "TypeScript Effect runtime could not serve the request " ,
160+ diagnostic_code = diagnostic_code ,
157161 )
158162
159163 monkeypatch .setattr (
@@ -163,12 +167,31 @@ def unavailable(*_args: object, **_kwargs: object) -> object:
163167 )
164168
165169
170+ @pytest .mark .parametrize (
171+ ("diagnostic_code" , "expected_action_fragment" , "mentions_node_installation" ),
172+ [
173+ ("node_unavailable" , "Install or activate Node.js" , True ),
174+ (
175+ "startup_lock_timeout" ,
176+ "wait for the active startup to settle" ,
177+ False ,
178+ ),
179+ ("runtime_launch_failed" , "runtime still cannot start" , False ),
180+ ("runtime_exited_before_ready" , "runtime exits again" , False ),
181+ ("runtime_startup_timeout" , "startup continues to time out" , False ),
182+ ("runtime_request_failed" , "requests continue to fail" , False ),
183+ ("future_runtime_diagnostic" , "runtime remains unavailable" , False ),
184+ ],
185+ )
166186def test_cli_reports_effect_runtime_startup_failure_without_traceback (
167187 tmp_path : Path ,
168188 monkeypatch : pytest .MonkeyPatch ,
189+ diagnostic_code : str ,
190+ expected_action_fragment : str ,
191+ mentions_node_installation : bool ,
169192) -> None :
170193 project = _write_connected_project (tmp_path )
171- _block_effect_runtime_startup (monkeypatch )
194+ _block_effect_runtime_startup (monkeypatch , diagnostic_code = diagnostic_code )
172195
173196 output = io .StringIO ()
174197 with contextlib .redirect_stdout (output ):
@@ -197,9 +220,13 @@ def test_cli_reports_effect_runtime_startup_failure_without_traceback(
197220 assert payload ["ok" ] is False
198221 assert payload ["schema_version" ] == "loopx_start_goal_guided_v0"
199222 assert payload ["error" ] == "LoopX TypeScript control-plane runtime is unavailable"
200- assert payload ["diagnostic_code" ] == "node_unavailable"
223+ assert payload ["diagnostic_code" ] == diagnostic_code
201224 assert payload ["runtime_requirement" ]["minimum_node_version" ] == "22.6.0"
202225 assert "loopx doctor --deep" in payload ["recommended_action" ]
226+ assert expected_action_fragment in payload ["recommended_action" ]
227+ assert ("Node.js" in payload ["recommended_action" ]) is mentions_node_installation
228+ if not mentions_node_installation :
229+ assert "Install or activate Node.js" not in payload ["recommended_action" ]
203230 assert "Traceback" not in raw_output
204231
205232
0 commit comments