Skip to content

fix: enforce the shared Measure integer contract in generated schemas - #71

Open
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/measure-integer-constraints
Open

fix: enforce the shared Measure integer contract in generated schemas#71
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/measure-integer-constraints

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

common/types/measure.json in the SDK's pinned 2026-08-25 source defines
value as an integer:

"value": {
  "type": "integer",
  "minimum": -9007199254740991,
  "maximum": 9007199254740991
}

The constraint injector still carried a contextual split from the previous
unit-price shape. It unconditionally changed the shared generated measure back
to z.number() and replaced selected aliases with hardcoded positive-integer
objects. That produced two opposite schema errors:

MeasureSchema(... value: 0.5)                    -> accepted
AdjustmentLineItemSchema(... measure.value: 0)   -> rejected

The first payload violates the shared integer contract. The second is valid for
an adjustment because adjustment.json references the shared Measure directly
without the unit-price-specific minimum: 1 narrowing.

Fix: remove the obsolete contextual split so the generic constraint pass
restores the shared integer bounds, regenerate the schemas, and replace the old
fractional-value acceptance assertion with regressions covering both shared and
unit-price measure contexts.

Category (Required)

  • Core Protocol: Changes to the UCP protocol itself. (Requires Technical Council approval)
  • Governance/Contributing: Changes to governance or contribution processes. (Requires Governance Council approval)
  • Capability: Changes to an existing UCP capability. (Requires Maintainer approval)
  • Documentation: Documentation-only changes. (Requires Maintainer approval)
  • Infrastructure: Changes to CI/CD or infrastructure. (Requires DevOps Maintainer approval)
  • Maintenance: Dependency updates or routine maintenance. (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. (Requires Maintainer approval)
  • Community Health (.github): Changes to shared GitHub configuration. (Requires DevOps Maintainer approval)

Related Issues

N/A

Checklist

  • I have followed the Contributing Guide and Code of Conduct.
  • 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.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated the generated TypeScript schemas with ./generate_models.sh 2026-08-25.

Screenshots / Logs (if applicable)

  • npm test — 147/147 passed
  • npm run build:noEmit — passed
  • npm run build — passed
  • ./generate_models.sh 2026-08-25 — regenerated output matches the committed model diff
  • uvx pre-commit run --all-files — all hooks passed, including ShellCheck v0.10.0
  • git diff --check — passed

🤖 Generated with Claude Code

@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Signal that the PR is ready for human triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants