Repository navigation
Add durable snapshot and restore - #354
Open
simongdavies wants to merge 5 commits into
Open
simongdavies wants to merge 5 commits into
simongdavies wants to merge 5 commits into
Conversation
Add lifecycle-aware persistent snapshots for runtime-ready and loaded JavaScript sandboxes across the Rust and Node APIs. Restore process-local host resources through SandboxBuilder, keep captured requirements separate from available host callbacks, and prevent accidental callback sharing. BREAKING CHANGE: hyperlight_js::Snapshot now names the lifecycle-aware snapshot wrapper, LoadedJSSandbox snapshot and restore use that wrapper, HostModule is no longer cloneable, and Node ESM no longer exports internal Wrapper aliases. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Explain durable and in-memory snapshot lifecycles, host-function factories, required versus available capabilities, external and native module behavior, and the current module-loader introspection limitation. Include Rust and Node restoration examples and migration guidance for the breaking snapshot API changes. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Clarify that generated GitHub release notes use pull-request labels rather than commit-message footers, and require the breaking-change label for released API incompatibilities. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
Import the Node URL constructor explicitly now that generated-type scripts are included in the JavaScript lint gate. Update custom native-module persistence coverage to use the lifecycle-aware snapshot restorer API. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
This branch has not been deployed
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
Adds durable OCI-backed snapshot and restore support for runtime-ready and loaded JavaScript sandboxes across Rust and Node.
API changes
Rust
JSSandboxnow supportssnapshot()andrestore()before handlers are loaded.LoadedJSSandboxsnapshots preserve evaluated handlers and mutable guest state.SandboxBuilder::build_from_snapshot()creates aSandboxRestorer.SandboxRestorer::restore::<JSSandbox>()andrestore::<LoadedJSSandbox>()enforce the captured lifecycle type.SandboxBuilderfor fresh construction and restoration.Node
JSSandboxnow exposessnapshot()andrestore().SandboxBuilder.buildFromSnapshot()creates aSandboxRestorer.SandboxRestorer.restoreJsSandbox()andrestoreLoadedSandbox()restore the matching lifecycle.Snapshot.save(),Snapshot.load(), andSnapshot.loadUnverified()provide OCI persistence.Breaking changes
hyperlight_js::Snapshotnow names the lifecycle-aware snapshot wrapper instead of re-exporting Hyperlight’s raw snapshot.LoadedJSSandbox::snapshot()now returnsSnapshotinstead ofArc<hyperlight_host::Snapshot>.LoadedJSSandbox::restore()now accepts and consumes the lifecycle-awareSnapshot.hyperlight_js::Snapshotalias must migrate to either the new wrapper orhyperlight_host::sandbox::snapshot::Snapshot.*Wrapperaliases. ImportSnapshot,JSSandbox,LoadedJSSandbox,SandboxBuilder, andSandboxRestorer.Limitations
Hyperlight issue #1870 prevents complete preflight inspection of raw snapshot host requirements. Hyperlight JS records its logical host-function requirements in metadata, while module-loader requirements remain
unknownuntil upstream introspection is available.