Repository navigation
fix(rest/python): reject unoffered selected_option_id with 400 INVALID_REQUEST - #272
Merged
carolinerg1 merged 2 commits intoNov 18, 2026
Conversation
damaz91
approved these changes
Nov 11, 2026
damaz91
left a comment
Contributor
There was a problem hiding this comment.
Thank you @aksharprabhudesai for fixing #262 and adding clear regression and control coverage!
Validating group.selected_option_id against group.options in _enrich_and_recalculate (returning 400 INVALID_REQUEST with the offered option IDs) and tightening _has_fulfillment_selection cleanly prevents unoffered option IDs from silently pricing shipping at $0 and marking the session ready_for_complete, while keeping unit tests that do not seed ShippingRate rows working.
Optional, non-blocking notes for future follow-up:
- When
ShippingRaterows are seeded,calculated_optionscan still come back empty ([]) ifselected_destination_iddoesn't match any entry inmethod.destinationsor if no shipping rate serves the destination country — leavinggroup.optionsasNoneand bypassingif group.selected_option_id and group.options:. Validatingselected_destination_idagainstmethod.destinations(and distinguishing "no rates seeded" from "0 options available for this destination") could close that remaining corner case. - On line 1409,
if calculated_options: group.options = calculated_optionsleaves previousgroup.optionsin place if a subsequentPUTswitches to an unserved destination that yields[].
LGTM!
Contributor
Author
aksharprabhudesai
force-pushed
the
fix/python-validate-selected-option
branch
from
November 11, 2026 04:07
9660f7e to
3570961
Compare
carolinerg1
approved these changes
Nov 18, 2026
carolinerg1
merged commit Nov 18, 2026
2d08f77
into
Universal-Commerce-Protocol:main
13 checks passed
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.
Fixes #262
Rejects a checkout fulfillment group whose
selected_option_idis not in the group's offeredoptionswith400 INVALID_REQUEST(listing the offered option IDs), and checks against offered options in_has_fulfillment_selection.