Skip to content

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

Open
simongdavies wants to merge 1 commit intohyperlight-dev:mainfrom
simongdavies:add-dispose-methods
Open

feat: add explicit dispose() methods to JSSandbox and LoadedJSSandbox NAPI Wrappers#69
simongdavies wants to merge 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

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

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

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

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

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.

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.

2 participants