Move per-transaction spending limits onto cards - #818
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
✱ Stainless preview builds for gridThis PR will update the cli go kotlin openapi php python ruby typescript Edit this comment to update them. They will appear in their respective SDK's changelogs.
|
c30da6b to
eb85c58
Compare
Greptile SummaryThe PR moves per-transaction spending limits from delegated keys to a nullable scalar on cards and updates card create, update, response, and webhook contracts. The OpenAPI artifacts are internally synchronized, but the bundled CLI still exposes and sends the removed delegated-key field.
Confidence Score: 4/5The PR should not merge until the CLI's obsolete delegated-key spending-limit option is removed or migrated to the card endpoints. The OpenAPI contract removes delegated-key spending limits, while the checked-in CLI still advertises the option and sends the deleted field, causing user requests to fail or silently create an unprotected card. Files Needing Attention: openapi/components/schemas/auth/DelegatedKeyCreateRequest.yaml and cli/src/commands/auth.ts
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/auth/DelegatedKeyCreateRequest.yaml | Removes delegated-key spending limits, but the repository CLI still sends the deleted request field. |
| openapi/components/schemas/cards/Card.yaml | Adds the required nullable card-level spending limit consistently to the shared Card response contract. |
| openapi/components/schemas/cards/CardCreateRequest.yaml | Adds an optional positive int64 limit with documented currency-unit and omission semantics. |
| openapi/components/schemas/cards/CardUpdateRequest.yaml | Adds the intended omission/value/null PATCH tri-state using the repository's established OpenAPI 3.1 nullable pattern. |
| openapi/paths/cards/cards_{id}.yaml | Documents setting and clearing the card limit and supplies representative PATCH examples. |
| openapi/webhooks/card-state-change.yaml | Updates all state-change examples to include the newly required nullable Card field. |
| openapi/webhooks/card-funding-source-change.yaml | Updates the funding-source-change example to include the newly required nullable Card field. |
| openapi.yaml | Generated bundle reflects the modular source changes consistently. |
| mintlify/openapi.yaml | Mintlify bundle remains synchronized with the root generated OpenAPI artifact. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Card create or update] --> B[maxSpendPerTransaction]
B --> C[Card resource]
C --> D[Card response]
C --> E[State-change webhook]
C --> F[Funding-source-change webhook]
G[Delegated-key creation] -. spendingLimits removed .-> H[Signing key]
I[Existing CLI option] -- still sends spendingLimits --> G
Prompt To Fix All With AI
### Issue 1
openapi/components/schemas/auth/DelegatedKeyCreateRequest.yaml:24
**CLI sends removed limit field**
When a user runs `grid auth delegated-keys create --spending-limit USD:5000`, the CLI still serializes `spendingLimits` even though this change removes it from `DelegatedKeyCreateRequest`, causing the request to be rejected or the requested protection to be silently ignored.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(grid-api): move card spending limit..." | Re-trigger Greptile
eb85c58 to
7cd7301
Compare

Reason
Delegated-key spending limits cannot protect custodial-funded cards, and the public array shape implies multi-currency limits that a single-currency card does not need.
Overview
Moves the per-transaction limit to the card as one scalar
maxSpendPerTransactionvalue in the smallest unit of the card currency. Create accepts an optional positive int64 and omission means unlimited. Card responses always include the nullable field. PATCH omits to preserve, supplies a positive integer to set, and suppliesnullto clear. The delegated-key limit contract andDelegatedKeySpendingLimitschema are removed.The bundled CLI now exposes the scalar on card create/update through
--max-spend-per-transaction, supports clearing it during update, and no longer advertises or serializes the removed delegated-key field.This is intentionally breaking: there are no active production cards, so the change carries no legacy API compatibility or backfill.
Test Plan
npm run lint:openapi(cd cli && npm test)— 80 tests passed(cd cli && npm run build)openapi.yamlandmintlify/openapi.yaml