Skip to content

feat: add explicit dispose() methods to JSSandbox and LoadedJSSandbox NAPI Wrappers#69

Merged
jprendes merged 1 commit intohyperlight-dev:mainfrom
simongdavies:add-dispose-methods
Apr 13, 2026
Merged

feat: add explicit dispose() methods to JSSandbox and LoadedJSSandbox NAPI Wrappers#69
jprendes merged 1 commit intohyperlight-dev:mainfrom
simongdavies:add-dispose-methods

Conversation

@simongdavies
Copy link
Copy Markdown
Contributor

@simongdavies simongdavies commented Mar 26, 2026

Add #[napi] dispose() methods that eagerly release underlying sandbox resources by calling take() on the inner Option. After disposal, all subsequent calls return ERR_CONSUMED. No-op on already-consumed instances.

@simongdavies simongdavies added the kind/enhancement New feature or improvement label Mar 26, 2026
@simongdavies simongdavies changed the title feat: add explicit dispose() methods to JSSandbox and LoadedJSSandbox… feat: add explicit dispose() methods to JSSandbox and LoadedJSSandbox NAPI Wrappers Mar 26, 2026
@simongdavies simongdavies requested a review from Copilot March 27, 2026 15:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds explicit dispose() methods to the NAPI-exposed JSSandbox and LoadedJSSandbox wrappers to allow deterministic release of underlying sandbox resources (by take()-ing the inner Option), instead of waiting for GC.

Changes:

  • Add JSSandboxWrapper.dispose() that drops the inner JSSandbox (no-op if already consumed).
  • Add LoadedJSSandboxWrapper.dispose() that drops the inner LoadedJSSandbox (no-op if already consumed).
  • Document the intended post-disposal behavior (ERR_CONSUMED on further use).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

… NAPI wrappers

Add #[napi] dispose() methods that eagerly release underlying sandbox
resources by calling take() on the inner Option. After disposal, all
subsequent calls return ERR_CONSUMED. No-op on already-consumed instances.

Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

I left some comments, but mostly as things we should follow up.

@jprendes jprendes merged commit 6f0fba2 into hyperlight-dev:main Apr 13, 2026
25 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement New feature or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants