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 conveniences for common cases #1710

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

erights
Copy link
Contributor

@erights erights commented Aug 2, 2023

refs: Agoric/agoric-sdk#8136
refs: Agoric/agoric-sdk#8096
refs: https://github.com/Agoric/agoric-sdk/blob/master/docs/env.md#DEBUG
refs: #1922

The indirection of getEnvironmentCaptor is only needed to support getCapturedEnvironmentOptionNames
getCapturedEnvironmentOptionNames is not currently used in either endo or agoric-sdk. Thus, we have enhanced
@endo/env/options to also directly export non-capturing forms of the other functions, like getEnvironmentOption, that are made and returned by getEnvironmentCaptor.

The value of an option is often supposed to be a list of strings separated by commas (','). However
Agoric/agoric-sdk#8096 explains that sometimes our code (both in endo and in agoric-sdk) accidentally split on colon (':') instead due to confusion about what the convention was supposed to be.

So that this PR would only be a compat feat PR, this PR does not fix any of those legacy manual uses that got the convention wrong. (Though it does add a TODO that links to Agoric/agoric-sdk#8096.) Rather,
this PR does provide additional conveniences, getEnvironmentOptionsList and environmentOptionsListHas based on the correct comma option.

Later PRs (#1922) that do take the compat hit of switching to comma should also switch to using these new conveniences.

@erights erights self-assigned this Aug 2, 2023
@erights erights force-pushed the markm-options-harmony branch 3 times, most recently from b0abc60 to 11e8047 Compare August 21, 2023 23:23
@erights erights force-pushed the markm-options-harmony branch 3 times, most recently from c8cbe6f to e28ac45 Compare August 29, 2023 05:05
@erights
Copy link
Contributor Author

erights commented Aug 29, 2023

See also nodejs/node#48890

@erights erights force-pushed the markm-options-harmony branch 2 times, most recently from 8515a62 to d692fac Compare August 30, 2023 01:21
@erights erights force-pushed the markm-options-harmony branch 2 times, most recently from 2ce5dd0 to a7664ac Compare September 16, 2023 02:45
@erights erights force-pushed the markm-options-harmony branch 2 times, most recently from 695c347 to 7799061 Compare September 26, 2023 03:13
@erights erights force-pushed the markm-options-harmony branch 2 times, most recently from 7383ed9 to e1199d3 Compare November 7, 2023 19:21
@erights erights force-pushed the markm-options-harmony branch 3 times, most recently from 43ed48f to 19b3465 Compare December 31, 2023 23:51
@erights erights changed the title WIP fix(env-options)!: env-options harmony feat(env-options): env-options conveniences for common cases Dec 31, 2023
@erights erights requested a review from kriskowal January 1, 2024 00:12
@erights erights requested a review from dckc January 1, 2024 00:12
@erights erights marked this pull request as ready for review January 1, 2024 00:12
@erights erights requested a review from gibson042 January 1, 2024 00:31
@erights erights force-pushed the markm-options-harmony branch 2 times, most recently from 6926eb8 to a802aa5 Compare January 8, 2024 21:46
@dckc dckc removed their request for review January 8, 2024 22:10
@erights erights force-pushed the markm-options-harmony branch 3 times, most recently from e130e8c to ac480ad Compare January 10, 2024 00:42
Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

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

LGTM!

packages/env-options/src/env-options.js Outdated Show resolved Hide resolved
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.

LGTM after minor fixes.

packages/env-options/README.md Outdated Show resolved Hide resolved
packages/env-options/README.md Outdated Show resolved Hide resolved
packages/env-options/README.md Outdated Show resolved Hide resolved
packages/env-options/README.md Outdated Show resolved Hide resolved
packages/env-options/src/env-options.js Outdated Show resolved Hide resolved
packages/env-options/src/env-options.js Outdated Show resolved Hide resolved
@erights erights enabled auto-merge (squash) January 10, 2024 21:15
@erights erights merged commit 4c686f6 into master Jan 10, 2024
14 checks passed
@erights erights deleted the markm-options-harmony branch January 10, 2024 21:18
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.

3 participants