Skip to content

fix(unstable-v2): make usage_update cost a patch field - #2617

Merged
benbrandt merged 1 commit into
mainfrom
fix/usage-update-cost-patch
Oct 29, 2026
Merged

benbrandt merged 1 commit into
mainfrom
fix/usage-update-cost-patch

Conversation

@benbrandt

Copy link
Copy Markdown
Member

usage_update.cost didn't say whether an omitted cost on a later update meant unknown or unchanged. It now follows the v2 patch convention:

  • Omitted leaves the last reported cost unchanged, null clears it, and a value replaces it, including when the currency differs.
  • Rust: UsageUpdate.cost is MaybeUndefined<Cost>, and the builder takes IntoMaybeUndefined. This is an unstable API change. The test covers omitted vs null.
  • Docs: prompt-lifecycle (stable and draft) and the migration table, which now says usage_update changed instead of "Unchanged".

used and size stay required. v2 only.

@benbrandt
benbrandt requested a review from a team as a code owner October 29, 2026 14:58
@benbrandt
benbrandt enabled auto-merge (squash) October 29, 2026 14:59
@benbrandt
benbrandt merged commit 2bb9fac into main Oct 29, 2026
14 checks passed
@benbrandt
benbrandt deleted the fix/usage-update-cost-patch branch October 29, 2026 15:03
@acp-release-bot acp-release-bot Bot mentioned this pull request Oct 29, 2026
benbrandt added a commit that referenced this pull request Nov 20, 2026
`usage_update` became a patching update when `cost` turned into a patch
field (#2617), but its top-level `_meta` kept the older rule where
omitted and `null` both mean no metadata. Every other upsert update
patches stored metadata by top-level key.

Make `_meta` on `usage_update` a patch field too, and add the update to
the list in Metadata Patches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant