Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(env-options): env-options as separate importable package #1585

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

erights
Copy link
Contributor

@erights erights commented May 10, 2023

Lets us do the many // TODO Use environment-options.js, rather than hand rolling process.env[name] handling each time.

@erights erights requested a review from kriskowal May 10, 2023 07:24
@erights erights self-assigned this May 10, 2023
@erights erights force-pushed the markm-env-options-package branch from 5041372 to 591b985 Compare May 10, 2023 07:29
Copy link
Contributor

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

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

Aren't there more files that should make use of this?

packages/env-options/README.md Show resolved Hide resolved
packages/env-options/package.json Outdated Show resolved Hide resolved
packages/env-options/src/environment-options.js Outdated Show resolved Hide resolved
packages/env-options/test/test-index.js Outdated Show resolved Hide resolved
@erights erights marked this pull request as draft May 11, 2023 06:32
@erights erights requested a review from gibson042 May 11, 2023 07:45
@erights erights force-pushed the markm-env-options-package branch from 6434ce9 to 763918f Compare May 11, 2023 08:18
@erights
Copy link
Contributor Author

erights commented May 11, 2023

Aren't there more files that should make use of this?

Done: track-turns.js and exo-makers.js

Also virtualObjectManager.js, but that's in agoric-sdk so will happen separately.

@michaelfig , please let me know if you'd like me to back out the changes to eventual-send because you want it to remain dependency-free. LOW URGENCY.

@erights erights marked this pull request as ready for review May 11, 2023 08:24
@erights erights force-pushed the markm-env-options-package branch from 0708f09 to 9893bd3 Compare May 11, 2023 19:24
packages/env-options/README.md Outdated Show resolved Hide resolved
packages/env-options/src/env-options.js Show resolved Hide resolved
packages/env-options/src/env-options.js Show resolved Hide resolved
packages/env-options/src/env-options.js Outdated Show resolved Hide resolved
@erights erights force-pushed the markm-env-options-package branch from 477710b to 1efb557 Compare May 12, 2023 02:14
@erights erights force-pushed the markm-env-options-package branch from 1efb557 to 00c63b1 Compare May 20, 2023 20:44
Copy link
Contributor

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

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

One small code organizational question, but LGTM no matter how it's resolved.

packages/env-options/src/env-options.js Outdated Show resolved Hide resolved
@erights
Copy link
Contributor Author

erights commented May 22, 2023

Reviewers, at https://github.com/endojs/endo/actions/runs/5034078931/jobs/9028682745?pr=1585 I get

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@endo%2fenv-options - Not found
npm ERR! 404 
npm ERR! 404  '@endo/env-options@^0.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'ses'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

This prevents me from merging. What should I do about this?

@gibson042
Copy link
Contributor

gibson042 commented May 24, 2023

I am able to reproduce the issue locally with Node.js v14. Basically, the script tries to npm pack the ses package and then install the resulting tarball, which works on master (where the ses package has no dependencies) but not on this PR (where the ses package has a dependency on @endo/env-options@^0.1.0, which does not exist in the npm registry because this PR just created it. It would probably be fixed by introducing the package in one PR and updating the ses package to use it in a second PR, but would recur with every relevant change to the env-options package. In some ways, the ses-integration-test package seems like an indirect and incomplete test that the ses package has no dependencies, which impacts efforts such as this to share robust code across ses and other Endo packages.

I think we should keep the ses package free of dependencies, and either tolerate duplication of env-options code (cf. isTypedArray in both ses and pass-style) or keep the code in ses for deep import from other packages (as it seems may have previously been the case for ses/lockdown?).

Tagging @kriskowal for an opinion.

@erights erights force-pushed the markm-env-options-package branch from 00c63b1 to 98bc341 Compare May 31, 2023 01:09
@kriskowal
Copy link
Member

I think in this case, the test might be holding us back. @michaelfig Do you recall what kind of regression the SES integration test is protecting us from, since it appears to test the published sources and not what is in the working copy? Is there a possibility that the test is misbehaving only because it uses npm instead of yarn (Was this intended to verify that npm continued to work even tho we’re using yarn?)

@erights erights force-pushed the markm-env-options-package branch from 98bc341 to a542bdc Compare May 31, 2023 05:58
@michaelfig
Copy link
Member

I think in this case, the test might be holding us back.

I think in this case the test is revealing that the current PR is making a breaking change that may affect our downstream users. We should not take that lightly.

@michaelfig Do you recall what kind of regression the SES integration test is protecting us from,

From packages/ses-integration-test/README.md:

This test folder creates a tarball of the main repository and runs the main tests in a browser context with multiple bundlers and tools. The goal is to ensure that someone downstream of the package will not have an issue when importing it.

since it appears to test the published sources and not what is in the working copy?

It certainly is testing what is in the working copy. I agree with @gibson042's assessment: it's only attempting to download an unpublished package because ses/package.json takes a hard dependency on env-options. Besides Richard's suggested workarounds we could do one of:

  • maybe make the env-options dep into a peerDependency
  • npm pack the env-options package during the ses-integration-test and use it just like we use the ses pack

Is there a possibility that the test is misbehaving only because it uses npm instead of yarn (Was this intended to verify that npm continued to work even tho we’re using yarn?)

That's a red herring. Yarn's behaviour does not differ in this regard.

@erights erights force-pushed the markm-env-options-package branch from a542bdc to 4a487fa Compare June 1, 2023 00:42
@erights erights force-pushed the markm-env-options-package branch from 4a487fa to ba266c9 Compare June 1, 2023 00:45
@erights
Copy link
Contributor Author

erights commented Jun 1, 2023

I'm going with

It would probably be fixed by introducing the package in one PR and updating the ses package to use it in a second PR, but

at least as far as this first PR, where I have reverted all changes to the ses package. Will open a second PR with only these postponed changes where we can discuss what to do with them.

@erights erights merged commit 44747dd into master Jun 1, 2023
@erights erights deleted the markm-env-options-package branch June 1, 2023 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants