docs: fix the fullfilment discount examples and add totals example validator - #755
Open
alexpark20 wants to merge 2 commits into
Open
docs: fix the fullfilment discount examples and add totals example validator#755alexpark20 wants to merge 2 commits into
alexpark20 wants to merge 2 commits into
Conversation
alexpark20
force-pushed
the
docs/discount-free-shipping-totals
branch
from
August 21, 2026 01:00
d0d46a4 to
6c3e8c7
Compare
alexpark20
force-pushed
the
docs/discount-free-shipping-totals
branch
2 times, most recently
from
August 21, 2026 07:32
25a83cc to
5b2adcb
Compare
alexpark20
marked this pull request as ready for review
August 21, 2026 07:51
alexpark20
requested review from
igrigorik and
wry-ry
and removed request for
wry-ry
August 21, 2026 07:51
alexpark20
force-pushed
the
docs/discount-free-shipping-totals
branch
from
August 21, 2026 07:53
5b2adcb to
a0881cd
Compare
damaz91
requested review from
jingyli and
niranjanmanjunath
and removed request for
wry-ry
August 21, 2026 11:51
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.
Description
Two
totals[]examples represent one free-shipping discount twice, so their declaredtotalis short by the discount amount. This corrects both, scopes an invariant that was stated unconditionally, and adds a check so the arithmetic cannot drift again.The misleading examples.
Both examples zero the
fulfillmententry and emit an offsettingdiscountentry for the same free-shipping benefit, subtracting it twice:docs/specification/discount.md→ "Mixed discounts (item + order level)": the line items net to 3200 and shipping is free, so the total is 3200. The example declared 2601.docs/specification/loyalty.md→ "Price-Impacting Benefits": same shape, declared 651 where the line items net to 850.Changes
1. Both examples corrected — the full shipping charge plus the offsetting discount, and the right total. Each discount entry now uses its own title as
display_textso the pairing is legible.2. The
allocationsinvariant scoped to whenallocationsis present. It read as unconditional, yetallocationsis optional onapplied_discountand the free-shipping discount in both examples omits it entirely.3.
scripts/validate_totals.pyenforces the two arithmetic identities the spec states normatively: a breakdown's entries sum to itstotalentry, and an entry'slinessum to that entry. Wired into pre-commit and thelintCI job.Category (Required)
Please select one or more categories that apply to this change.
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
Checklist
!for breaking changes).Screenshots / Logs (if applicable)