Skip to content

refactor: migrate AuthCredentialAdditionalChallenge onto SignedRequestChallenge base#373

Open
DhruvPareek wants to merge 1 commit into04-22-feat_add_post__internal-accounts__id__export_to_export_wallet_credentialsfrom
04-22-refactor_migrate_authcredentialadditionalchallenge_onto_signedrequestchallenge_base
Open

refactor: migrate AuthCredentialAdditionalChallenge onto SignedRequestChallenge base#373
DhruvPareek wants to merge 1 commit into04-22-feat_add_post__internal-accounts__id__export_to_export_wallet_credentialsfrom
04-22-refactor_migrate_authcredentialadditionalchallenge_onto_signedrequestchallenge_base

Conversation

@DhruvPareek
Copy link
Copy Markdown
Contributor

@DhruvPareek DhruvPareek commented Apr 22, 2026

Retrofits the add-additional-credential 202 challenge (on POST /auth/credentials) to compose the shared SignedRequestChallenge base introduced earlier in this stack. Brings the add-credential flow to match the other flows that use the http 202 signed ppayload challenge: delete-credential, delete-session, and export-wallet challenges.

What changed

  • AuthCredentialAdditionalChallenge.yaml — rewritten from a flat { type, payloadToSign, requestId, expiresAt } object to allOf(../common/SignedRequestChallenge.yaml, { type: AuthMethodType }).

What stays the same

  • Wire shape of 202 responses is unchanged — still { type, payloadToSign, requestId, expiresAt } plus any per-variant fields.
  • The discriminated oneOf wrapper AuthCredentialAdditionalChallengeOneOf and the three variant schemas (EmailOtp…, Oauth…, Passkey…) are untouched
  • payloadToSign, requestId, expiresAt descriptions shift to the slightly more generic phrasing already in SignedRequestChallenge, but the semantics are identical

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

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

Project Deployment Actions Updated (UTC)
grid-flow-builder Ready Ready Preview, Comment Apr 23, 2026 3:26am

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

✱ Stainless preview builds

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

kotlin

chore(internal): regenerate SDK with no functional changes

openapi

chore(types): refactor AuthCredentialAdditionalChallenge to use allOf composition

python

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-python studio · code · diff

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

pip install https://pkg.stainless.com/s/grid-python/647e7ed7c20edc12085942b172f0e655dd583a4c/grid-0.0.1-py3-none-any.whl
grid-typescript studio · code · diff

generate ❗build ✅lint ⏳test ⏳

npm install https://pkg.stainless.com/s/grid-typescript/e3a3208960eacd55d98007411801ecdf25b05112/dist.tar.gz
grid-openapi studio · code · diff

Your SDK build had at least one "error" diagnostic, but this did not represent a regression.
generate ❗

grid-kotlin studio · code · diff

generate ❗build ⏳lint ✅test ✅

⏳ These are partial results; builds are still running.


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-04-23 03:33:39 UTC

Copy link
Copy Markdown
Contributor Author

DhruvPareek commented Apr 22, 2026

@DhruvPareek DhruvPareek marked this pull request as ready for review April 22, 2026 21:46
@DhruvPareek DhruvPareek requested a review from pengying April 22, 2026 21:46
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 22, 2026

Greptile Summary

This PR refactors AuthCredentialAdditionalChallenge to compose SignedRequestChallenge via allOf, matching the pattern already used by AuthCredentialDeleteChallenge, SessionDeleteChallenge, and InternalAccountExportChallenge. The wire shape (type, payloadToSign, requestId, expiresAt) is unchanged, the discriminated oneOf wrapper and variant schemas are untouched, and the stainless.yml JSONPath is correctly updated to allOf[1].properties.

Confidence Score: 5/5

Safe to merge — pure schema refactor with identical wire shape and correct tooling update.

All findings are P2 (documentation/example quality). No logic, wire shape, or discriminator regressions were found. The stainless.yml path update is correct.

No files require special attention.

Important Files Changed

Filename Overview
openapi/components/schemas/auth/AuthCredentialAdditionalChallenge.yaml Refactored from a flat object schema to allOf(SignedRequestChallenge, {type}), matching sibling schemas; wire shape is preserved but the payloadToSign example becomes a generic placeholder.
.stainless/stainless.yml JSONPath target correctly updated from .properties to .allOf[1].properties to reach the type field now nested inside the allOf composition.
openapi.yaml Generated file mirrors the YAML source change; discriminator, variant schemas, and AuthCredentialAdditionalChallengeOneOf are all unchanged and remain consistent.
mintlify/openapi.yaml Mintlify copy of the spec updated identically to openapi.yaml; no issues found.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class SignedRequestChallenge {
        +string payloadToSign
        +string requestId
        +string expiresAt
    }
    class AuthCredentialAdditionalChallenge {
        +AuthMethodType type
    }
    class EmailOtpCredentialAdditionalChallenge {
        +string type = "EMAIL_OTP"
        +string email
    }
    class OauthCredentialAdditionalChallenge {
        +string type = "OAUTH"
    }
    class PasskeyCredentialAdditionalChallenge {
        +string type = "PASSKEY"
    }
    class AuthCredentialAdditionalChallengeOneOf {
        <<oneOf discriminator: type>>
    }
    SignedRequestChallenge <|-- AuthCredentialAdditionalChallenge : allOf
    AuthCredentialAdditionalChallenge <|-- EmailOtpCredentialAdditionalChallenge : allOf
    AuthCredentialAdditionalChallenge <|-- OauthCredentialAdditionalChallenge : allOf
    AuthCredentialAdditionalChallenge <|-- PasskeyCredentialAdditionalChallenge : allOf
    AuthCredentialAdditionalChallengeOneOf --> EmailOtpCredentialAdditionalChallenge
    AuthCredentialAdditionalChallengeOneOf --> OauthCredentialAdditionalChallenge
    AuthCredentialAdditionalChallengeOneOf --> PasskeyCredentialAdditionalChallenge
Loading

Fix All in Claude Code

Prompt To Fix All With AI
This is a comment left during a code review.
Path: openapi/components/schemas/auth/AuthCredentialAdditionalChallenge.yaml
Line: 1-9

Comment:
**`payloadToSign` example loses endpoint-specific fidelity**

The inherited `SignedRequestChallenge.payloadToSign` example (`Y2hhbGxlbmdlLXBheWxvYWQtdG8tc2lnbg`) is an opaque base64-like placeholder, whereas the old example was the literal JSON that callers must sign byte-for-byte:

```json
{"requestId":"7c4a8d09-…","type":"EMAIL_OTP","accountId":"InternalAccount:01HF3Z4QWERTY","expiresAt":"2026-04-08T15:35:00Z"}
```

Developers who need to implement signing for `POST /auth/credentials` now lose the concrete hint about the payload structure. The variant schemas (`EmailOtpCredentialAdditionalChallengeFields`, etc.) don't override the example either. Consider overriding `payloadToSign` in the `allOf[1]` object with a challenge-specific example, the same way the old schema did.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "refactor: migrate AuthCredentialAddition..." | Re-trigger Greptile

Comment on lines +1 to +9
title: Authentication Credential Additional Challenge
allOf:
- $ref: ../common/SignedRequestChallenge.yaml
- type: object
required:
- type
properties:
type:
$ref: ./AuthMethodType.yaml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 payloadToSign example loses endpoint-specific fidelity

The inherited SignedRequestChallenge.payloadToSign example (Y2hhbGxlbmdlLXBheWxvYWQtdG8tc2lnbg) is an opaque base64-like placeholder, whereas the old example was the literal JSON that callers must sign byte-for-byte:

{"requestId":"7c4a8d09-…","type":"EMAIL_OTP","accountId":"InternalAccount:01HF3Z4QWERTY","expiresAt":"2026-04-08T15:35:00Z"}

Developers who need to implement signing for POST /auth/credentials now lose the concrete hint about the payload structure. The variant schemas (EmailOtpCredentialAdditionalChallengeFields, etc.) don't override the example either. Consider overriding payloadToSign in the allOf[1] object with a challenge-specific example, the same way the old schema did.

Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/auth/AuthCredentialAdditionalChallenge.yaml
Line: 1-9

Comment:
**`payloadToSign` example loses endpoint-specific fidelity**

The inherited `SignedRequestChallenge.payloadToSign` example (`Y2hhbGxlbmdlLXBheWxvYWQtdG8tc2lnbg`) is an opaque base64-like placeholder, whereas the old example was the literal JSON that callers must sign byte-for-byte:

```json
{"requestId":"7c4a8d09-…","type":"EMAIL_OTP","accountId":"InternalAccount:01HF3Z4QWERTY","expiresAt":"2026-04-08T15:35:00Z"}
```

Developers who need to implement signing for `POST /auth/credentials` now lose the concrete hint about the payload structure. The variant schemas (`EmailOtpCredentialAdditionalChallengeFields`, etc.) don't override the example either. Consider overriding `payloadToSign` in the `allOf[1]` object with a challenge-specific example, the same way the old schema did.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

@DhruvPareek DhruvPareek force-pushed the 04-22-refactor_migrate_authcredentialadditionalchallenge_onto_signedrequestchallenge_base branch from 24ba40f to 9fe06f2 Compare April 22, 2026 23:36
@DhruvPareek DhruvPareek force-pushed the 04-22-feat_add_post__internal-accounts__id__export_to_export_wallet_credentials branch from 580af7e to 54aa238 Compare April 22, 2026 23:36
@DhruvPareek DhruvPareek force-pushed the 04-22-feat_add_post__internal-accounts__id__export_to_export_wallet_credentials branch from 54aa238 to fc10ac7 Compare April 23, 2026 02:38
@DhruvPareek DhruvPareek force-pushed the 04-22-refactor_migrate_authcredentialadditionalchallenge_onto_signedrequestchallenge_base branch from 9fe06f2 to 03b789b Compare April 23, 2026 02:38
@DhruvPareek DhruvPareek force-pushed the 04-22-refactor_migrate_authcredentialadditionalchallenge_onto_signedrequestchallenge_base branch from 03b789b to a77502e Compare April 23, 2026 03:03
@DhruvPareek DhruvPareek force-pushed the 04-22-feat_add_post__internal-accounts__id__export_to_export_wallet_credentials branch from fc10ac7 to 12052ef Compare April 23, 2026 03:03
…tChallenge base

Retrofits the add-additional-credential 202 challenge (on `POST /auth/credentials`) to compose the shared `SignedRequestChallenge` base introduced earlier in this stack. Brings the add-credential flow onto the same footing as the delete-credential, delete-session, and export-wallet challenges.

**What changed**
- `AuthCredentialAdditionalChallenge.yaml` — rewritten from a flat `{ type, payloadToSign, requestId, expiresAt }` object to `allOf(../common/SignedRequestChallenge.yaml, { type: AuthMethodType })`.
- `.stainless/stainless.yml` — the existing "remove `type` from base schema properties" transform's target path for `AuthCredentialAdditionalChallenge` updated from `.properties` to `.allOf[1].properties`, since the inline `type` definition now lives in the second `allOf` element. Same behavior as before (the variant's single-value inline enum on `type` remains the sole definition), just the path reflects the new composition.

**What stays the same**
- Wire shape of 202 responses is unchanged — still `{ type, payloadToSign, requestId, expiresAt }` plus any per-variant fields.
- The discriminated `oneOf` wrapper `AuthCredentialAdditionalChallengeOneOf` and the three variant schemas (`EmailOtp…`, `Oauth…`, `Passkey…`) are untouched; they keep their `allOf(AuthCredentialAdditionalChallenge, …Fields)` structure and resolve to the same merged shape.
- `payloadToSign`, `requestId`, `expiresAt` descriptions shift to the slightly more generic phrasing already in `SignedRequestChallenge`, but the semantics are identical — the endpoint-specific context (that the retry goes to `POST /auth/credentials`) is already communicated by the endpoint description.

**Why now**
- Matches the pattern the other three signed-retry challenges in this stack already follow. Keeping the add-credential case on its own flat shape was a deferred-consolidation note that's no longer justified now that three sites share the base.
- Bundled `openapi.yaml` + `mintlify/openapi.yaml` regenerated via `make build`.
@DhruvPareek DhruvPareek force-pushed the 04-22-feat_add_post__internal-accounts__id__export_to_export_wallet_credentials branch from 12052ef to a5adbf9 Compare April 23, 2026 03:26
@DhruvPareek DhruvPareek force-pushed the 04-22-refactor_migrate_authcredentialadditionalchallenge_onto_signedrequestchallenge_base branch from a77502e to 089354f Compare April 23, 2026 03:26
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