Resolve clip tool ordering in subscription requests #1207
Open
asonnenschein wants to merge 6 commits intomainfrom
Open
Resolve clip tool ordering in subscription requests #1207asonnenschein wants to merge 6 commits intomainfrom
asonnenschein wants to merge 6 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR resolves an issue where the clip tool was incorrectly placed at the end of the tool list when using clip_to_source=True in subscription requests, causing API validation errors due to incorrect tool sequencing.
Changes:
- Introduced tool processing weights to define correct ordering constraints for subscription tools
- Added validation to ensure user-provided tools are in correct order before processing
- Implemented smart insertion logic to place the clip tool at the appropriate position based on tool weights
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| planet/constants.py | Defines _SUBSCRIPTION_TOOL_WEIGHT dictionary mapping tool names to processing order weights (1-4) |
| planet/subscription_request.py | Adds _validate_tool_order() and _insert_clip_tool() helper functions; updates build_request() to validate and correctly insert clip tool |
| tests/unit/test_subscription_request.py | Adds 17 comprehensive parametrized tests covering tool order validation and clip insertion scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
HenryW95
reviewed
Feb 6, 2026
HenryW95
approved these changes
Feb 6, 2026
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.
Resolve clip tool ordering in subscription requests
GH issue #1206
Problem
When using
clip_to_source=Trueinbuild_request(), the clip tool was appended to the end of the tool list, resulting in incorrect processing order. See the documentation on creating toolchains for more information about toolchain processing order.Solution
planet/constants.pyas_SUBSCRIPTION_TOOL_WEIGHT_validate_tool_order()to validate input tool lists are in correct order_insert_clip_tool()to insert clip at the correct position based on tool weightsbuild_request()to use these helper methodsExample
Before:
After:
Testing