Repository navigation
Conversation
The click helpers' move guard tested truthiness (JS `if (x && y)`, Python `if x and y:`), so a target like leftClick(0, 100) or rightClick(0, 0) clicked at the current position instead of moving: coordinates on either axis origin were unreachable through the click helpers. The guard now checks for undefined/None, so every fully specified position is moved to. Passing exactly one of x/y is now rejected on every click method in both SDKs with the same 'Both x and y must be provided together' error. Previously three of the four methods silently skipped the move, while Python's right_click validated the pair — with its docstring placed after the raise, which turned it into a dead string expression and left __doc__ as None. The docstring now sits first, as on every other method. Offline tests drive the click methods against a stubbed commands client in both SDKs, asserting the issued xdotool commands.
|
We require contributors to sign our Contributor License Agreement, and we don't have @yjjnls on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
🦋 Changeset detectedLatest commit: fdf9772 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
TASTE.md review. I checked the changed lines against parity (T-1, T-1c, T-2), API shape (T-3, T-3a), errors (T-59, T-62, T-63) and docstrings (T-69, T-70, T-71).
3 violations, 4 inline comments:
- T-59 / T-63 (JS + Python): the new both-or-neither guard throws a bare
Error/ValueError. It should useInvalidArgumentError/InvalidArgumentExceptionwith a message that shows the correct call. - T-62 / T-69 / T-70 (JS): the click methods' JSDoc doesn't document
x/yor the new throw. - T-62 / T-69 (Python): the new docstrings don't say when the methods raise.
Not tied to a line:
- The Python unit test asserts
pytest.raises(ValueError). It needs updating if the exception class changes. - Parity is good: JS and Python now behave the same, and the desktop package has no async Python mirror to update (T-2 doesn't apply).
- I didn't flag the existing
x?, y?optional positionals (T-3 / T-3a) because this PR doesn't introduce them.
| */ | ||
| private assertClickPosition(x?: number, y?: number): void { | ||
| if ((x === undefined) !== (y === undefined)) { | ||
| throw new Error('Both x and y must be provided together') |
There was a problem hiding this comment.
T-59 — argument validation that runs before any operation starts throws InvalidArgumentError, not a bare Error (also keeps the error class in parity with Python per T-1c). T-63 — a misuse error should show the correct call rather than only restate the constraint.
InvalidArgumentError is exported from e2b; add it to the import block at the top of the file (outside this diff).
| throw new Error('Both x and y must be provided together') | |
| throw new InvalidArgumentError( | |
| 'Pass both `x` and `y` to click at a position, or neither to click at the current cursor position.' | |
| ) |
There was a problem hiding this comment.
Fixed in fdf9772 — all four click methods now throw InvalidArgumentError imported from e2b, using the suggested message that shows the correct call; the JS/Python tests assert the new error class and message.
| @@ -281,7 +281,9 @@ export class Sandbox extends SandboxBase { | |||
| * Left click on the mouse position. | |||
There was a problem hiding this comment.
T-69 / T-70 / T-62 — public methods document their parameters and failure modes with JSDoc @param / @throws. This PR adds a new throw path to all four click methods and documents the params on the Python side, but the JS JSDoc still says nothing about x/y or when it throws. Same fix applies to doubleClick, rightClick, and middleClick.
| * Left click on the mouse position. | |
| * Left click on the mouse position. | |
| * | |
| * @param x - The x coordinate to click at. Must be passed together with `y`. | |
| * @param y - The y coordinate to click at. Must be passed together with `x`. | |
| * @throws {InvalidArgumentError} If only one of `x` and `y` is passed. |
There was a problem hiding this comment.
Fixed in fdf9772 — all four JS click methods now document @param x / @param y and @throws {InvalidArgumentError} for the both-or-neither validation.
| position to move to, and silently skipping the move hides the mistake. | ||
| """ | ||
| if (x is None) != (y is None): | ||
| raise ValueError("Both x and y must be provided together") |
There was a problem hiding this comment.
T-59 — argument validation that runs before any operation starts raises InvalidArgumentException, not a bare ValueError (parity with JS InvalidArgumentError, T-1c). T-63 — a misuse error should show the correct call.
Import InvalidArgumentException from e2b in the existing import block (outside this diff), and update test_single_coordinate_is_rejected to pytest.raises(InvalidArgumentException) — it is not a ValueError subclass.
| raise ValueError("Both x and y must be provided together") | |
| raise InvalidArgumentException( | |
| "Pass both `x` and `y` to click at a position, or neither to click at the current cursor position." | |
| ) |
There was a problem hiding this comment.
Fixed in fdf9772 — the click methods now raise InvalidArgumentException imported from e2b, and test_single_coordinate_is_rejected asserts pytest.raises(InvalidArgumentException).
| Left click on the mouse position. | ||
|
|
||
| :param x: The x coordinate to click at, together with `y` | ||
| :param y: The y coordinate to click at, together with `x` |
There was a problem hiding this comment.
T-62 / T-69 — document when an error is thrown. The new both-or-neither raise is a failure mode of every click method, but the docstrings only list :param: fields. Same fix applies to double_click, right_click, and middle_click.
| :param y: The y coordinate to click at, together with `x` | |
| :param y: The y coordinate to click at, together with `x` | |
| :raises InvalidArgumentException: If only one of `x` and `y` is passed |
There was a problem hiding this comment.
Fixed in fdf9772 — all four Python click methods now document :raises InvalidArgumentException: for the both-or-neither validation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aeba132cf6
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| '@e2b/desktop': patch | ||
| '@e2b/desktop-python': patch |
There was a problem hiding this comment.
Mark the coordinate-validation releases as minor
When an existing caller supplies only x or only y, these methods previously still performed the click (for every JS method and Python left/double/middle) but now reject the promise or raise, even though the public signatures permit either optional argument. Publishing both packages as a patch therefore exposes consumers to a new runtime failure on a patch upgrade; mark these changesets as minor as required for breaking changes.
AGENTS.md reference: AGENTS.md:L7-L7
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in fdf9772 — both changesets now declare minor releases with the breaking-change rationale (single-coordinate calls previously performed the click and now reject), so consumers are not exposed to the new failure on a patch upgrade.
|
Tracked in #2122. |
…DK validation errors Review findings: - The changesets move from patch to minor: rejecting a lone coordinate turns calls that previously clicked (three of the four methods) into errors, which is a breaking change. - The both-or-neither guard now throws InvalidArgumentError (JS) / InvalidArgumentException (Python) — the SDKs' argument-validation errors — instead of a bare Error / ValueError, with a message that states the correct call. - All four click methods document the x/y parameters and the raise via JSDoc / :raises:, and the Python test asserts the new exception class.
|
We require contributors to sign our Contributor License Agreement, and we don't have @yjjnls on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check' |
|
All findings addressed in fdf9772:
Desktop JS and Python remain in parity; offline suites pass in both packages. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Friendly nudge — this PR is still open and awaiting review. All review feedback is addressed in fdf9772 (codex's latest pass on that commit came back clean), including the minor-level changesets and the InvalidArgumentError handling. Happy to provide more context or make any further adjustments if useful. |
|
Just a gentle follow-up on the click-coordinate fix — still open and happy to iterate on any feedback. Thanks! |
Problem
The desktop SDKs' click helpers cannot click at any position on an axis origin, and treat a half-specified position inconsistently.
0coordinates are dropped. The move guard tested truthiness — JSif (x && y), Pythonif x and y:— soleftClick(0, 100)/left_click(0, 100)clicked at the current position instead of moving first.xdotool mousemove --sync 0 100is a legitimate move; coordinates like(0, y),(x, 0),(0, 0)were unreachable through the click helpers.Repro without a sandbox (stub
commands.runand record what is issued):A lone coordinate is handled three different ways.
leftClick(5),doubleClick(undefined, 7)andmiddleClick(5)silently skipped the move (and still clicked), while Python'sright_clickraisedValueError("Both x and y must be provided together"). With neither coordinate the click at the current position stays correct.Python-only:
right_click.__doc__wasNone. Its docstring sat after the validation raise — a dead string expression, not a docstring — so docs tooling andhelp()showed nothing for the method.Fix
leftClick/left_click,doubleClick/double_click,rightClick/right_click,middleClick/middle_click) now moves whenever both coordinates are given,0included, and clicks at the current position when neither is.assertClickPosition/_check_click_position).right_clickdocstring moved above the guard, so__doc__is populated again.Testing
New offline tests drive the click methods against a stubbed
commandsclient and assert the issued xdotool commands — no sandbox required:packages/desktop-js/tests/clickCoordinates.test.ts(7 tests): origin-side move, no-coordinate click, per-method(0, 0)moves, lone-coordinate rejection.packages/desktop-python/tests/test_click_coordinates.py(8 tests): same coverage plus a__doc__regression check.Both suites pass locally;
tsc --noEmit, oxlint, prettier (JS) and ruff format/check (Python) are clean. The existing integration tests (tests/mouse.test.ts,tests/test_controls.py) run unchanged.A changeset patches
@e2b/desktopand@e2b/desktop-python.