fix: address Copilot review comments on PR #1219 (pause regression tests)#1222
Draft
passionworkeer wants to merge 6 commits intoe2b-dev:mainfrom
Draft
fix: address Copilot review comments on PR #1219 (pause regression tests)#1222passionworkeer wants to merge 6 commits intoe2b-dev:mainfrom
passionworkeer wants to merge 6 commits intoe2b-dev:mainfrom
Conversation
When using Sandbox.connect() with an apiKey, the pause() method was not passing the apiKey to the API call, causing auth failures. This fix ensures pause() (and deprecated betaPause()) use the same pattern as kill() - merging connectionConfig with provided opts. Fixes: e2b-dev#1215
…tion - Update @returns JSDoc: pause() returns boolean (true=paused, false=already paused) matching SandboxApi.pause semantics, not a sandbox ID - Add regression tests for apiKey propagation in Sandbox.connect(): - pause() succeeds when E2B_API_KEY is unset but apiKey is passed to connect() - pause() returns false when sandbox is already paused - pause() works on connected sandbox with apiKey in connectionConfig Refs: Copilot PR e2b-dev#1218 review comments
- Remove unused template import - Change savedApiKey truthy check to explicit undefined check - Add await before Sandbox.connect() calls (P1 - async Promise fix) - Add explicit non-null assertion after toBeDefined() for TypeScript
… Copilot review) - Remove unused 'expect' import from vitest - Use explicit if-check + throw instead of expect(apiKey).toBeDefined() - This properly narrows TypeScript type for apiKey without relying on assertion return type
- Remove redundant process.env.E2B_API_KEY read after delete (always undefined) - Update JSDoc: 'Pause a sandbox by its ID' -> 'Pause this sandbox' - PR e2b-dev#1221
🦋 Changeset detectedLatest commit: 79342bf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Author
|
Hi, checking in - this PR addresses Copilot review comments on PR #1219. The changesets for the pause-related PRs are also noted. Is there anything else needed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses Copilot review feedback on PR #1219:
Removed unused expect import - The expect import from vitest was only used for toBeDefined() assertions which don't narrow TypeScript types. Removed since it's no longer needed.
Replaced expect(apiKey).toBeDefined() with explicit type guard - Runtime assertions don't help TypeScript's type narrowing. Used explicit if (apiKey === undefined) throw new Error(...) pattern which properly narrows the type and is more explicit about the failure mode.
Remove redundant apiKey read in test - After deleting process.env.E2B_API_KEY, reading it again is always undefined. Use savedApiKey directly to make intent explicit.
Fix JSDoc for pause() - Changed 'Pause a sandbox by its ID' (sounds static) to 'Pause this sandbox' to correctly describe the instance method.
Changes
Runtime behavior
Test-only
Copilot issues addressed
Closes #1219 (as a follow-up fix)