GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — wasi: add support for version when creating WASI by mhdawson · Pull Request #46469 · nodejs/node

Conversation

@mhdawson

@mhdawson mhdawson commented Feb 1, 2023

Copy link
Copy Markdown
Member

Refs: #46254

  • add version to options when creating WASI object
  • add convenience function to return importObject

Signed-off-by: Michael Dawson [email protected]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@mhdawson
wasi: add support for version when creating WASI
97ef606
Refs: nodejs#46254

- add version to options when creating WASI object
- add convenience function to return importObject

Signed-off-by: Michael Dawson <[email protected]>
@nodejs-github-bot

nodejs-github-bot commented Feb 1, 2023

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/wasi
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson mhdawson added the wasi Issues and PRs related to the WebAssembly System Interface. label Feb 1, 2023
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Feb 1, 2023
@richardlau richardlau added the semver-minor PRs that contain new features and should be released in the next minor version. label Feb 1, 2023
@mhdawson
squash: add pr-url for doc section
53c7fa1
@devsnek

devsnek commented Feb 1, 2023

Copy link
Copy Markdown
Member

why do we need to explicitly pass a version? each version already has its own import namespace, so they can just coexist right?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson

mhdawson commented Feb 1, 2023

Copy link
Copy Markdown
Member Author

@devsnek you can read some of the discussion suggestion for a version in #46254

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

guybedford
guybedford approved these changes Feb 2, 2023
View reviewed changes

@guybedford guybedford left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for working on this @mhdawson. Looks good to me and the importObject seems useful, although I was hoping we could discuss some more API changes before removing the flag as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
guybedford
guybedford reviewed Feb 2, 2023
View reviewed changes
Comment thread doc/api/wasi.md Outdated
import { argv, env } from 'node:process';

const wasi = new WASI({
version: 'wasi_snapshot_preview1',

@guybedford guybedford Feb 2, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It might be worth considering making this just preview1. The current expectation for WASI itself is that preview1 is effectively being moved to be considered stable at this point, even if that hasn't been properly announced yet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@guybedford guybedford Feb 2, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

At the very least, snapshot-preview1 may be a bit briefer.

Apparently, the shapshot part isn't expected to change, so that preview1 may well be sufficient.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhdawson mhdawson Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@cjihrig I'd defer to you on how to best name the versions. I just used exactly what was documented as that makes it obvious what it maps to.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cjihrig cjihrig Feb 3, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@guybedford probably has better access to the folks that are determining the names of the versions. I'd be in favor of at least dropping the "wasi_" prefix though.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhdawson mhdawson Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ok, will update to 'preview1'

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhdawson mhdawson Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

As I started doing that I realised that the other thing is it means that the mapping between the version requested and what goes into the import object is not as clear. In terms of the discussion about documenting { wasi_unstable: wasi.wasiImport } adding it as a version that could be requested would make less sense if we don't have a 1 to 1 mapping between the version requested and the name of the field in the import object.

I'll wait until next week to give a bit more time for you two to comment on that aspect. If we still think usigin preview1 is better I'll document the { wasi_unstable: wasi.wasiImport } some other way.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhdawson mhdawson Feb 6, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Talked with @guybedford seems like for preview2 the binding between the version and the imports is not direct anyway so my reasoning for keeping them in line would no longer make sense. Updating to 'preview1'

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jasnell
jasnell approved these changes Feb 3, 2023
View reviewed changes
cjihrig
cjihrig reviewed Feb 3, 2023
View reviewed changes
Comment thread doc/api/wasi.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/api/wasi.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/api/wasi.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/api/wasi.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/api/wasi.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread doc/api/wasi.md
Comment on lines -26 to -29
// Some WASI binaries require:
// const importObject = { wasi_unstable: wasi.wasiImport };
const importObject = { wasi_snapshot_preview1: wasi.wasiImport };

@cjihrig cjihrig Feb 3, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We appear to be losing this information, which could be important to some users. I think we either need to keep this somewhere in the docs, or support passing in "wasi_unstable" as a version which would return the same API as wasi_snapshot_preview1, but with a different version string.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhdawson mhdawson Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm happy to either add it back to the doc or add to "wasi_unstable" to what can be passed in as a version depending on what people think is best.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@cjihrig cjihrig Feb 3, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It seems like a pretty easy thing to support since it would be an alias for preview1, so I'd suggest supporting it and removing this note from the docs (but we would need to document that "wasi_unstable" is a valid version).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mhdawson mhdawson Feb 3, 2023

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

will do

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread lib/wasi.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread lib/wasi.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@cjihrig

cjihrig commented Feb 3, 2023

Copy link
Copy Markdown
Contributor

although I was hoping we could discuss some more API changes before removing the flag as well.

@guybedford what else did you have in mind? Maybe open another issue. I'd hate for us to remove the flag and have something slip through the cracks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhdawson and others added 9 commits February 3, 2023 14:42
@mhdawson @cjihrig
Update lib/wasi.js
1397b38
Co-authored-by: Colin Ihrig <[email protected]>
@mhdawson @cjihrig
Update doc/api/wasi.md
954a984
Co-authored-by: Colin Ihrig <[email protected]>
@mhdawson @cjihrig
Update doc/api/wasi.md
848373c
Co-authored-by: Colin Ihrig <[email protected]>
@mhdawson @cjihrig
Update doc/api/wasi.md
388dc3f
Co-authored-by: Colin Ihrig <[email protected]>
@mhdawson
squash: address comments
3cab1f5
@mhdawson
squash: address comments
61dca0b
Signed-off-by: Michael Dawson <[email protected]>
@mhdawson
squash: address comments
9f07256
Signed-off-by: Michael Dawson <[email protected]>
@mhdawson
squash: address comments
fc34053
Signed-off-by: Michael Dawson <[email protected]>
@mhdawson
squash: address comments
ad25e59
Signed-off-by: Michael Dawson <[email protected]>
@mhdawson

mhdawson commented Feb 6, 2023

Copy link
Copy Markdown
Member Author

@cjihrig, @guybedford I think I've addressed all the comments so far.

The one outstanding thing is that the tests are not run for 'unstable' since they were compiled against 'wasi_snapshot_preview1'. I think we would need a new set of the compiled wasm test files. Does that need to be handled in this PR or is it ok since there seems to have been no prior testing of unstable anyway?

cjihrig reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@guybedford

guybedford commented Feb 7, 2023

Copy link
Copy Markdown
Contributor

The unstable import interface is very old at this point so I think it is fine to treat that as a legacy path that we can support but that we don't need to explicitly test.

mhdawson and cjihrig reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson
squash: remove test code related to unstable
9107570
Signed-off-by: Michael Dawson <[email protected]>
@mhdawson

mhdawson commented Feb 7, 2023

Copy link
Copy Markdown
Member Author

Pushed commit to remove disabled testing related to unstable version. Should be ready to go at this point.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson mhdawson added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 7, 2023
@github-actions github-actions Bot added request-ci-failed Starting CI with the request-ci label failed and requires manual intervention. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Feb 7, 2023
@github-actions

github-actions Bot commented Feb 7, 2023

Copy link
Copy Markdown
Contributor
Failed to start CI
- Validating Jenkins credentials
✖  Jenkins credentials invalid
https://github.com/nodejs/node/actions/runs/4118977794
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cjihrig
cjihrig approved these changes Feb 8, 2023
View reviewed changes

@cjihrig cjihrig left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. Thanks for doing this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mhdawson mhdawson added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 17, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 17, 2023
@nodejs-github-bot

nodejs-github-bot commented Feb 17, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/49651/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson mhdawson mentioned this pull request Feb 17, 2023
uvwasi team working tasks nodejs/uvwasi#187
Closed
This was referenced Feb 18, 2023
CI Reliability 2023-02-18 nodejs/reliability#499
Open
CI Reliability 2023-02-19 nodejs/reliability#500
Open
@nodejs-github-bot

nodejs-github-bot commented Feb 21, 2023

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/49861/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson

mhdawson commented Feb 22, 2023

Copy link
Copy Markdown
Member Author

Looks like status from CI did not post correct. CI is complete and passed, going to land.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mhdawson added a commit that referenced this pull request Feb 22, 2023
@mhdawson
wasi: add support for version when creating WASI
2d35f66
Refs: #46254

- add version to options when creating WASI object
- add convenience function to return importObject

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #46469
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@mhdawson

mhdawson commented Feb 22, 2023

Copy link
Copy Markdown
Member Author

Landed in 2d35f66

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mhdawson mhdawson closed this Feb 22, 2023
toyobayashi added a commit to toyobayashi/wasm-util that referenced this pull request Feb 26, 2023
@toyobayashi
add support for version when creating WASI (nodejs/node#46469)
2311766
@juanarbol juanarbol added the backport-requested-v18.x label Mar 1, 2023
@juanarbol

juanarbol commented Mar 1, 2023

Copy link
Copy Markdown
Member

Would you mind backporting this to v18.x?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Mar 13, 2023
@mhdawson @targos
wasi: add support for version when creating WASI
60e5f45
Refs: #46254

- add version to options when creating WASI object
- add convenience function to return importObject

Signed-off-by: Michael Dawson <[email protected]>

PR-URL: #46469
Reviewed-By: Guy Bedford <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@targos targos mentioned this pull request Mar 14, 2023
v19.8.0 release proposal #47087
Merged
targos added a commit that referenced this pull request Mar 14, 2023
@targos
2023-03-14, Version 19.8.0 (Current)
4221dce
Notable changes:

buffer:
  * (SEMVER-MINOR) add Buffer.copyBytesFrom(...) (James M Snell) #46500
doc:
  * add marco-ippolito to collaborators (Marco Ippolito) #46816
events:
  * (SEMVER-MINOR) add listener argument to listenerCount (Paolo Insogna) #46523
lib:
  * (SEMVER-MINOR) add AsyncLocalStorage.bind() and .snapshot() (flakey5) #46387
src:
  * (SEMVER-MINOR) add `fs.openAsBlob` to support File-backed Blobs (James M Snell) #45258
tls:
  * (SEMVER-MINOR) support automatic DHE (Tobias Nießen) #46978
url:
  * (SEMVER-MINOR) implement URLSearchParams size getter (James M Snell) #46308
wasi:
  * (SEMVER-MINOR) add support for version when creating WASI (Michael Dawson) #46469
worker:
  * (SEMVER-MINOR) add support for worker name in inspector and trace_events (Debadree Chatterjee) #46832

PR-URL: #47087
targos added a commit that referenced this pull request Mar 14, 2023
@targos
2023-03-14, Version 19.8.0 (Current)
115c9ac
Notable changes:

buffer:
  * (SEMVER-MINOR) add Buffer.copyBytesFrom(...) (James M Snell) #46500
doc:
  * add marco-ippolito to collaborators (Marco Ippolito) #46816
events:
  * (SEMVER-MINOR) add listener argument to listenerCount (Paolo Insogna) #46523
lib:
  * (SEMVER-MINOR) add AsyncLocalStorage.bind() and .snapshot() (flakey5) #46387
src:
  * (SEMVER-MINOR) add `fs.openAsBlob` to support File-backed Blobs (James M Snell) #45258
tls:
  * (SEMVER-MINOR) support automatic DHE (Tobias Nießen) #46978
url:
  * (SEMVER-MINOR) implement URLSearchParams size getter (James M Snell) #46308
wasi:
  * (SEMVER-MINOR) add support for version when creating WASI (Michael Dawson) #46469
worker:
  * (SEMVER-MINOR) add support for worker name in inspector and trace_events (Debadree Chatterjee) #46832

PR-URL: #47087
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@guybedford guybedford guybedford approved these changes
@jasnell jasnell jasnell approved these changes
@cjihrig cjihrig cjihrig approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. request-ci-failed Starting CI with the request-ci label failed and requires manual intervention. semver-minor PRs that contain new features and should be released in the next minor version. wasi Issues and PRs related to the WebAssembly System Interface.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@mhdawson @nodejs-github-bot @devsnek @cjihrig @guybedford @juanarbol @jasnell @richardlau
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.