Fix issues in the MI Extension#1504
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughEnv parsing was changed to preserve '=' characters in values and only add non-empty key/value pairs; .env loading is integrated into test server startup by adding a projectRoot parameter; className validation was relaxed to allow lowercase starts; a plugin version constant was bumped. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
workspaces/mi/mi-extension/src/test-explorer/runner.ts (1)
275-277:throw errorinside anasyncPromise executor leaves the outer Promise permanently pending.In
new Promise(async (resolve, reject) => { ... }), athrowinside theasyncexecutor rejects the executor's own implicit async promise — it is not caught by thePromiseconstructor. The outerPromise<{ cp: ChildProcess }>remains pending forever, causingawait startTestServer(...)at line 103 to hang indefinitely rather than propagating the error to therunTestQueuecatch block.The new
loadEnvVariablescall adds a concrete new throw vector (e.g.,fs.readFileSyncfailing despiteexistsSyncpassing), making this pre-existing antipattern more likely to trigger.♻️ Proposed fix — call `reject` explicitly
} catch (error) { - throw error; + reject(error); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@workspaces/mi/mi-extension/src/test-explorer/runner.ts` around lines 275 - 277, The Promise executor in startTestServer (the new Promise(async (resolve, reject) => { ... })) currently uses "throw error" inside the async executor which leaves the outer Promise pending; change the executor to explicitly reject on failures instead of throwing (or remove the async keyword and use synchronous try/catch that calls reject(error)). Specifically, inside the Promise in runner.ts where the catch currently does "throw error;", replace that with a call to reject(error) (or ensure any thrown errors from loadEnvVariables and related calls are caught and passed to reject) so the outer Promise<{ cp: ChildProcess }> properly rejects and the await startTestServer(...) can handle the error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@workspaces/mi/mi-extension/src/debugger/tasks.ts`:
- Around line 195-198: The guard currently checks "if (key && value)" but value
is an array and always truthy; change the logic to produce a string value before
the guard (e.g., join value with '=' and trim into a variable like valueStr) and
then check "if (key && valueStr)" before assigning to process.env; update the
block that destructures trimmedLine (const [key, ...value]) to compute valueStr
= value.join('=').trim() and use that in the conditional and assignment to avoid
setting env vars for lines without '=' or empty values.
---
Nitpick comments:
In `@workspaces/mi/mi-extension/src/test-explorer/runner.ts`:
- Around line 275-277: The Promise executor in startTestServer (the new
Promise(async (resolve, reject) => { ... })) currently uses "throw error" inside
the async executor which leaves the outer Promise pending; change the executor
to explicitly reject on failures instead of throwing (or remove the async
keyword and use synchronous try/catch that calls reject(error)). Specifically,
inside the Promise in runner.ts where the catch currently does "throw error;",
replace that with a call to reject(error) (or ensure any thrown errors from
loadEnvVariables and related calls are caught and passed to reject) so the outer
Promise<{ cp: ChildProcess }> properly rejects and the await
startTestServer(...) can handle the error.
This PR will fix the below mentioned issues.
Summary by CodeRabbit
Bug Fixes
Chores