fix: Transition cart.id to be omitted in update requests instead of a required field - #633
Conversation
…for update. Also updated validation scripts logic to apply any transition annotations on the core schema (validation should be done against the /to/ field instead of /from/).
raginpirate
left a comment
There was a problem hiding this comment.
Good spot @jingyli, I am aligned with fixing this id advertisement and the main.py bug.
However, the immediate removal of id from all scaffolds looks wrong, as from is supposed to be the authoritative definition in the schema until a future cutoff is hit. The established sequence is #145 announce (keep the field, comment it) → #341 flip at version cut → #332 drop from docs. Unless we come up with a safe way to condense versioning, I think this blocks the PR from shipping as-is.
igrigorik
left a comment
There was a problem hiding this comment.
Agree with @raginpirate, the end state is right but the sequence is wrong. The examples must resolves against the production schema shape, not future state. Let's break this apart and follow same sequence we landed for checkout: land the transition first, then stage transition removal and concrete 'omit' with updated examples.
…R when the transition schema is finalized.
|
@raginpirate @igrigorik Good prompt and callout. Originally I was thinking whether the established sequence had areas for improvement (i.e. changing fields in docs #332 probably should have came before the version cut finalization #341 ) so draft ucp.dev always have the right documentation accompanying on the schema. But it should be done in another PR - though I do think we should do the documentation/scaffolding update in the same PR where we finalize the transition so both takes effect into the version cut. Will take a stab at it when closer to the version cut. For now, reverted back the changes on scaffolding/documentation updates and attached a screenshot on how the |
raginpirate
left a comment
There was a problem hiding this comment.
@jingyli did you want to keep deprecation markers in the docs for this interim period?
P.S. While writing this I realized we never removed the deprecated IDs with #341! Opened a doc fix: #646
I wonder if theres some simple tooling that can help us catch deprecated fields in examples and ensure they match the existing transition states.
our schema validator with --strict flag would/should have caught this. |
…ed before the next release.
|
@raginpirate PTAL at 7869d54! Although just a side note from me personally: I feel the need to add deprecation markers to be a little bit unnatural given json doesn't allow for inline comments structurally. I guess it's fine since these are just doc examples and it's better for readability (but still feel a little bit odd given these are technically json code blocks we have in our markdown files). |
raginpirate
left a comment
There was a problem hiding this comment.
🚀 Agreed, these are example payloads rather than schemas, and there's no clean way in base JSON to show this inline, so I'm personally happy with the // convention here.
Description
Transition
idfield fromrequiredtoomitin cart capability forupdaterequests.The current state presents a redundancy given the cart being updated is already identified at the transport level (e.g., via the resource path in REST
/carts/{cart_id}or via tool arguments in MCP) - this is also the pattern used in checkout capability.Also augmented logic in
main.pyto properly process schema withtransitionannotations so the rendering of the field requirement inreference.mdclarifies the transition (and allucp_request/ucp_responseannotations properly). See attached screenshot for an example of how it will look like post this change.Category (Required)
Please select one or more categories that apply to this change.
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Related Issues
N/A
Checklist
!for breaking changes).Screenshots / Logs (if applicable)