Fix decision handling and add idempotency keys to Cycles client#7
Merged
Fix decision handling and add idempotency keys to Cycles client#7
Conversation
- Fix USD_MICROCENTS conversions (off by 10x) in balances and deploy docs - Fix scope derivation example missing intermediate workspace:default scope - Fix scope derivation claim about derived scopes when only tenant+workflow given - Fix idempotency scoping to say "effective tenant" per spec - Fix decision enum terminology: "downgrade" -> "ALLOW_WITH_CAPS" - Fix test mocks: createReservation returns 200 (not 201), budget denial is 409 - Fix code examples: add required idempotency_key to commit/release/decide requests - Fix code examples: remove incorrect DENY check on 2xx for non-dry-run reservations https://claude.ai/code/session_01V4QiiG3XgZ9ALnf3gCaBUw
- events doc: add missing `custom` field to StandardMetrics listing - events doc: fix ALLOW_IF_AVAILABLE description to clarify all-or-nothing semantics (not partial charging) per spec - units doc: clarify Amount.amount has minimum: 0 (non-negative), distinguish from SignedAmount which allows negative values for overdraft state https://claude.ai/code/session_01V4QiiG3XgZ9ALnf3gCaBUw
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.
Summary
This PR corrects the Cycles client documentation and examples to align with the actual API behavior, and adds idempotency key support to all write operations as required by the protocol.
Key Changes
Decision Handling Corrections
decision=DENYin 2xx responses for non-dry-run reservations. Per the API spec, insufficient budget returns a 409 error response instead. Thedecision=DENYonly occurs in 2xx responses whendry_run=true.Idempotency Key Implementation
CommitRequest.builder()now includes.idempotencyKey("commit-" + UUID.randomUUID())ReleaseRequest.builder()now includes.idempotencyKey("release-" + UUID.randomUUID())DecisionRequest.builder()now includes.idempotencyKey("decide-" + UUID.randomUUID())Documentation Fixes
Notable Implementation Details
https://claude.ai/code/session_01V4QiiG3XgZ9ALnf3gCaBUw