Skip to content

docs: fix the fulfillment discount examples - #755

Open
alexpark20 wants to merge 1 commit into
mainfrom
docs/discount-free-shipping-totals
Open

docs: fix the fulfillment discount examples#755
alexpark20 wants to merge 1 commit into
mainfrom
docs/discount-free-shipping-totals

Conversation

@alexpark20

@alexpark20 alexpark20 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

Two totals[] examples represent one free-shipping discount twice, so their declared total is 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 fulfillment entry and emit an offsetting discount entry 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_text so the pairing is legible.

2. The allocations invariant scoped to when allocations is present. It read as unconditional, yet allocations is optional on applied_discount and the free-shipping discount in both examples omits it entirely.

3. scripts/validate_totals.py move to a separate PR

Category (Required)

Please select one or more categories that apply to this change.

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

Checklist

  • I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

@alexpark20
alexpark20 force-pushed the docs/discount-free-shipping-totals branch from d0d46a4 to 6c3e8c7 Compare August 21, 2026 01:00
@alexpark20 alexpark20 changed the title docs: fix the fullfilment discount examples docs: fix the fullfilment discount examples and add totals example validator Aug 21, 2026
@alexpark20
alexpark20 force-pushed the docs/discount-free-shipping-totals branch 2 times, most recently from 25a83cc to 5b2adcb Compare August 21, 2026 07:32
@alexpark20
alexpark20 marked this pull request as ready for review August 21, 2026 07:51
@alexpark20
alexpark20 requested review from igrigorik and wry-ry and removed request for wry-ry August 21, 2026 07:51
@alexpark20
alexpark20 force-pushed the docs/discount-free-shipping-totals branch from 5b2adcb to a0881cd Compare August 21, 2026 07:53
@alexpark20
alexpark20 requested a review from wry-ry August 21, 2026 07:54
@damaz91 damaz91 added status:needs-triage Signal that the PR is ready for human triage documentation Improvements or additions to documentation status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Aug 21, 2026
@damaz91
damaz91 requested review from jingyli and niranjanmanjunath and removed request for wry-ry August 21, 2026 11:51
@waynemak waynemak added the area:payments Issues and pull requests related to the Payments vertical label Aug 21, 2026
@alexpark20 alexpark20 changed the title docs: fix the fullfilment discount examples and add totals example validator docs: fix the fulfillment discount examples and add totals example validator Sep 10, 2026
Two `totals[]` examples represent one free-shipping discount twice: they zero
the `fulfillment` entry and also emit an offsetting `discount` entry for the
same benefit, so the declared `total` is short by the discount amount.

- Mixed discounts (item + order level): line items net to 3200 and shipping is
  free, so the total is 3200. The example declared 2601.
- Price-Impacting Benefits: same shape, declared 651 where the line items net
  to 850.

Both now show the full shipping charge alongside the offsetting discount, and
the correct total. The free-shipping discount uses its own title as
`display_text` so the pairing is legible.

The `allocations` invariant is also scoped to when `allocations` is present:
it read as unconditional, yet `allocations` is optional on `applied_discount`
and the free-shipping discount in both examples omits it.
@alexpark20
alexpark20 force-pushed the docs/discount-free-shipping-totals branch from a0881cd to bb8e595 Compare September 10, 2026 01:02
@alexpark20 alexpark20 changed the title docs: fix the fulfillment discount examples and add totals example validator docs: fix the fulfillment discount examples Sep 10, 2026
@damaz91 damaz91 added status:stale-review Applied if a PR is waiting on a reviewer for too long and removed status:under-review labels Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:payments Issues and pull requests related to the Payments vertical documentation Improvements or additions to documentation status:stale-review Applied if a PR is waiting on a reviewer for too long

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants