Skip to content

[eas-cli] Protect simulator environment cleanup - #4200

Open
sjchmiela wants to merge 1 commit into
stanley/appium-remote-session-actionfrom
stanley/simulator-env-reset
Open

[eas-cli] Protect simulator environment cleanup#4200
sjchmiela wants to merge 1 commit into
stanley/appium-remote-session-actionfrom
stanley/simulator-env-reset

Conversation

@sjchmiela

@sjchmiela sjchmiela commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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.

@sjchmiela
sjchmiela requested a lite review from Copilot August 14, 2026 14:51
@sjchmiela sjchmiela added the no changelog PR that doesn't require a changelog entry label Aug 14, 2026
@github-actions

Copy link
Copy Markdown

⏩ The changelog entry check has been skipped since the "no changelog" label is present.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 resetSimulatorEnvAsync by parsing the current .env.eas-simulator and returning early on mismatch.
  • Thread the expected session ID through simulator session end/stop flows (simulator command and simulator: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.

@sjchmiela
sjchmiela marked this pull request as ready for review August 14, 2026 14:54
@sjchmiela
sjchmiela requested a review from szdziedzic August 14, 2026 14:54
@github-actions

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.32%. Comparing base (70eed8a) to head (7f09d6c).

Files with missing lines Patch % Lines
packages/eas-cli/src/commands/simulator/index.ts 80.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

try {
const currentEnv = parseDotenv(await fs.readFile(simulatorDotenvFilePath, 'utf8'));
if (currentEnv[EAS_SIMULATOR_SESSION_ID] !== expectedDeviceRunSessionId) {
return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we show warn here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR that doesn't require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants