Skip to content

[grid-api] Document the 202 processing-pending / retry-same-request contract (SP-3579) - #820

Draft
carsonp6 wants to merge 1 commit into
mainfrom
sp3579-202-processing-pending-contract
Draft

[grid-api] Document the 202 processing-pending / retry-same-request contract (SP-3579)#820
carsonp6 wants to merge 1 commit into
mainfrom
sp3579-202-processing-pending-contract

Conversation

@carsonp6

Copy link
Copy Markdown
Contributor

What

Documents the 202 processing-pending / retry-same-request contract on the Embedded Wallet sync endpoints. This is the ramp prerequisite for the state-machine migration: the underlying wallet operation now runs optimistically in line and can fall back to asynchronous processing. When it does, the endpoint returns a non-terminal 202 with { "status": "PENDING" }, and the caller must re-send the identical request (same method, path, body, and headers) until it resolves to a terminal 200/201/204 (or an error).

Docs-only change to the spec + integrator docs. No behavior change here; the server behavior lands separately, and the webdev client regen from this source is a follow-on after merge.

Reusable component

  • components/schemas/common/ProcessingPendingResponse.yaml — body carrying the required status: PENDING field plus the authoritative "still processing — re-send the identical request" description.

Affected endpoints (all got the 202)

Endpoint Terminal 202 body
POST /auth/credentials/{id}/verify (login: OTP / OAuth / passkey) 200 challenge or pending
POST /auth/credentials/{id}/challenge (OTP init / passkey challenge) 200 pending
POST /auth/sessions/{id}/refresh (session refresh) 201 challenge or pending
POST /auth/credentials (add credential) 201 challenge or pending
PATCH /customers/{customerId} (contact update: email / phone) 200 challenge or pending
POST /auth/delegated-keys (delegated-key create) 201 challenge or pending
DELETE /auth/delegated-keys/{id} (delegated-key revoke) 204 pending
POST /internal-accounts/{id}/export (wallet export) 200 challenge or pending

(challenge covers both the passkey challenge and the OTP-init/send path.)

Response-shape modeling decision (please sanity-check)

Six of these endpoints already return a 202 — the existing signed-retry challenge (payloadToSign + requestId). Since an operation has only one 202, the pending marker has to share it. The two bodies are a non-tagged union with no shared discriminator property, and the repo's spectral config forbids inline response schemas (no-inline-response-schema) and oneOf without a discriminator (oneOf-must-have-discriminator, "use anyOf for non-tagged unions"). So each such 202 now $refs a small named anyOf wrapper:

  • common/SignedRequestChallengeOrProcessingPending.yaml (refresh, contact update, export)
  • auth/AuthSignedRequestChallengeOrProcessingPending.yaml (verify, add credential)
  • auth/DelegatedKeySignedRequestChallengeOrProcessingPending.yaml (delegated-key create)

The two clean endpoints (challenge, delegated-key revoke) $ref ProcessingPendingResponse directly. The reusable piece is modeled as a schema rather than a components.responses entry to match repo convention (there are no components.responses in this spec; all reuse is via schema files).

Docs

Retry contract documented in each endpoint description and in the Global Accounts authentication guide (snippets/global-accounts/authentication.mdx, new "Still-processing responses (202 PENDING)" section under the shared signed-retry pattern — the session and export guides already link there).

Verification

  • make build — clean
  • make lint (redocly + spectral) — clean (0 errors; remaining warnings/infos are pre-existing on unrelated schemas)

…st contract (SP-3579)

Several Embedded Wallet sync endpoints run their underlying wallet
operation optimistically in line and can fall back to asynchronous
processing. When that happens they return a non-terminal HTTP 202 with
`{ "status": "PENDING" }`; the caller must re-send the identical request
(same method, path, body, and headers) until it resolves to a terminal
200/201/204.

Add a reusable `ProcessingPendingResponse` schema (status: PENDING) and
reference it as a 202 on each affected endpoint:

- POST /auth/credentials/{id}/verify    (login: OTP / OAuth / passkey)
- POST /auth/credentials/{id}/challenge (OTP init / passkey challenge)
- POST /auth/sessions/{id}/refresh      (session refresh)
- POST /auth/credentials                (add credential)
- PATCH /customers/{customerId}         (contact update: email / phone)
- POST /auth/delegated-keys             (delegated-key create)
- DELETE /auth/delegated-keys/{id}      (delegated-key revoke)
- POST /internal-accounts/{id}/export   (wallet export)

Endpoints that already return a 202 signed-retry challenge now document an
anyOf of that challenge or the pending marker, via named wrapper schemas
(spectral forbids inline response schemas and oneOf without a
discriminator). Document the retry contract in the endpoint descriptions
and the Global Accounts authentication guide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
grid-flow-builder Ignored Ignored Aug 12, 2026 10:54pm
grid-wallet-demo Ignored Ignored Aug 12, 2026 10:54pm

Request Review

@mintlify

mintlify Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Grid 🟢 Ready View Preview Aug 12, 2026, 10:55 PM

@github-actions github-actions Bot added the breaking-change Introduces a breaking change to the OpenAPI spec label Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Breaking OpenAPI changes detected

oasdiff reports 12 error / 0 warning changes to openapi.yaml.
This PR will need approval from an API reviewer before merge.

Errors (12)

  • POST /auth/sessions/{id}/refresh — the response's body type/format changed from object/to/`` for status 202 [response-body-type-changed].
  • POST /auth/sessions/{id}/refresh — removed the required property expiresAt from the response with the 202 status [response-required-property-removed].
  • POST /auth/sessions/{id}/refresh — removed the required property payloadToSign from the response with the 202 status [response-required-property-removed].
  • POST /auth/sessions/{id}/refresh — removed the required property requestId from the response with the 202 status [response-required-property-removed].
  • PATCH /customers/{customerId} — the response's body type/format changed from object/to/`` for status 202 [response-body-type-changed].
  • PATCH /customers/{customerId} — removed the required property expiresAt from the response with the 202 status [response-required-property-removed].
  • PATCH /customers/{customerId} — removed the required property payloadToSign from the response with the 202 status [response-required-property-removed].
  • PATCH /customers/{customerId} — removed the required property requestId from the response with the 202 status [response-required-property-removed].
  • POST /internal-accounts/{id}/export — the response's body type/format changed from object/to/`` for status 202 [response-body-type-changed].
  • POST /internal-accounts/{id}/export — removed the required property expiresAt from the response with the 202 status [response-required-property-removed].
  • POST /internal-accounts/{id}/export — removed the required property payloadToSign from the response with the 202 status [response-required-property-removed].
  • POST /internal-accounts/{id}/export — removed the required property requestId from the response with the 202 status [response-required-property-removed].

Detected by oasdiff. Full report: job summary or the oasdiff-report artifact.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

✱ Stainless preview builds for grid

This PR will update the grid SDKs with the following commit messages.

cli

chore(internal): regenerate SDK with no functional changes

go

chore(internal): regenerate SDK with no functional changes

kotlin

chore(internal): regenerate SDK with no functional changes

openapi

feat(api): add ProcessingPendingResponse, update 202 responses across auth/wallet/delegated-key

php

chore(internal): regenerate SDK with no functional changes

python

chore(internal): regenerate SDK with no functional changes

ruby

chore(internal): regenerate SDK with no functional changes

typescript

chore(internal): regenerate SDK with no functional changes

Edit this comment to update them. They will appear in their respective SDK's changelogs.

grid-typescript studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ⏭️ (prev: build ✅) → lint ⏭️ (prev: lint ❗) → test ✅

grid-openapi studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️

grid-ruby studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ⏭️ (prev: build ✅) → lint ✅test ✅

grid-cli studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ❗lint ❗test ❗

grid-php studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅lint ✅test ✅

grid-go studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ⏭️ (prev: build ✅) → lint ❗test ❗

go get github.com/stainless-sdks/grid-go@91ec72de77bc3a74e6f743fe1b6577eef2d6d770
grid-kotlin studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ⏭️ (prev: build ✅) → lint ⏭️ (prev: lint ✅) → test ❗

grid-python studio · code · diff

Your SDK build had at least one "note" diagnostic, but this did not represent a regression.
generate ✅build ⏭️ (prev: build ✅) → lint ⏭️ (prev: lint ❗) → test ❗


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-08-12 22:59:29 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Introduces a breaking change to the OpenAPI spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant