-
Notifications
You must be signed in to change notification settings - Fork 93
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
remove product bundles json from repo, and fetch it dynamically, add helper function to get valid item types and bundles in cli #1094
Merged
Conversation
This file contains 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
… item type for maintainability
Here's a way to replace the module import side-effect:
I feel like we might want to introduce minimal retry (mostly to avoid a potential network hiccup) and clearer handling of unexpected conditions as this could be a source of confusion ... |
ischneider
reviewed
Jan 22, 2025
ischneider
reviewed
Jan 22, 2025
charcey
changed the title
Remove product bundles json from repo, fetch it dynamically
remove product bundles json from repo, and fetch it dynamically, add helper function to get valid item types and bundles in cli
Jan 27, 2025
asonnenschein
approved these changes
Jan 28, 2025
ischneider
reviewed
Jan 28, 2025
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.
Description
Currently we have a copy of the orders product bundle spec in this repository. When there is an update to the bundles spec someone ends up having to update the spec here. This can cause headaches for users who might expect to be able to order a new item type but can't until the spec is updated.
Recently, a new endpoint was added to the Orders API that serves the spec. This presents a great opportunity to dynamically grab the spec instead of managing a version of it statically.
(editors note: removed old text here, and just laying out the implemented path after internal discussions)
The bundles spec information is lazily loaded into an envvar PRODUCT_BUNDLES. The first time the variable is accessed, the spec is fetched from the previously mentioned public endpoint, and every subsequent access (within the same runtime) will use the previously loaded information. It tries twice to get the spec and since we expect the spec endpoint to be highly available there is no work around if the spec cannot be accessed.
Side effects:
Previously the spec was loaded in (from a static file) on any data, orders, or subscriptions cli help command (e.g.
planet data --help
). This was to list the valid item types which is pulled from the bundles spec (there are other issues around this, but not solving that here). In addition, for orders help commands the bundle names were loaded in. Because having to reach out to the internet to run --help is not a good practice, this information is now available through new commands :planet data show-item-types
,planet orders show-item-types
,planet orders show-bundles
,planet subscriptions show-item-types
. These changes plus the lazy loading ensures we are only reaching out to the internet for the spec when absolutely necessary. 🥳Examples:
Related Issue(s):
Closes #734
Proposed Changes:
For inclusion in changelog (if applicable):
planet data show-item-types
to show valid item types for data requestsplanet orders show-bundles
to show valid bundle names andplanet orders show-item-types
to show valid item typesplanet subscriptions show-item-types
to show valid bundle names for scene subscriptionsNot intended for changelog:
Diff of User Interface
Old behavior: N/A
New behavior: N/A
User behavior is the exact same.
However, if the spec cannot be reached, an error will surface to the user.
Example:
PR Checklist:
(Optional) @mentions for Notifications: