[eas-cli] Protect simulator environment cleanup - #4200
Conversation
|
⏩ The changelog entry check has been skipped since the "no changelog" label is present. |
There was a problem hiding this comment.
Pull request overview
This PR hardens simulator environment cleanup in eas-cli by ensuring .env.eas-simulator is only reset when it belongs to the session that just ended/stopped, preventing one session from wiping another session’s active environment.
Changes:
- Add session-ID validation to
resetSimulatorEnvAsyncby parsing the current.env.eas-simulatorand returning early on mismatch. - Thread the expected session ID through simulator session end/stop flows (
simulatorcommand andsimulator:stop). - Update and extend unit tests to cover same-session cleanup, missing file handling, and different-session no-op behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/eas-cli/src/simulator/env.ts | Adds dotenv parsing + expected-session-id guard to protect .env.eas-simulator cleanup. |
| packages/eas-cli/src/simulator/tests/env.test.ts | Updates tests for the new guard and adds coverage for different-session behavior. |
| packages/eas-cli/src/commands/simulator/stop.ts | Calls guarded cleanup after stopping a session. |
| packages/eas-cli/src/commands/simulator/index.ts | Passes the session ID through to guarded cleanup when sessions end or are interrupted. |
| packages/eas-cli/src/commands/simulator/tests/stop.test.ts | Updates mocks/expectations for the new cleanup call signature. |
| packages/eas-cli/src/commands/simulator/tests/index.test.ts | Updates expectations so cleanup is asserted with the correct session ID. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## stanley/appium-remote-session-action #4200 +/- ##
========================================================================
- Coverage 63.34% 63.32% -0.01%
========================================================================
Files 1028 1027 -1
Lines 47017 46981 -36
Branches 9853 9841 -12
========================================================================
- Hits 29778 29746 -32
+ Misses 17137 17134 -3
+ Partials 102 101 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| try { | ||
| const currentEnv = parseDotenv(await fs.readFile(simulatorDotenvFilePath, 'utf8')); | ||
| if (currentEnv[EAS_SIMULATOR_SESSION_ID] !== expectedDeviceRunSessionId) { | ||
| return; |
There was a problem hiding this comment.
should we show warn here?
Why
Codex insists we should clean the environment up when stopping the simulator. I think we should also guard the cleanup with ID check.
How
Added reset to the stop command and an ID guard.
Test Plan
CI should pass.