Repository navigation
Conversation
`buildOAuthPopupUrl` returns the same URL the hook built inline: the redirect URI encoded, the token and attempt id as they are, then each filled credential in form order with its value encoded. The hook now calls it. No behaviour change; the new test pins the current string. Co-Authored-By: Claude Opus 5.5 <[email protected]>
When editing an OAuth2 authorization-code account, the popup URL now names the optional fields the user emptied in `cleared_credential_keys` (comma-separated, encoded), so the API removes them instead of keeping the stored values. The parameter is left out when nothing was cleared, which is always the case for a new account. Needs the unified-cloud-api change that reads the parameter to be live first: an older API would store it as a credential. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…helper `buildOAuthPopupUrl` now takes the raw credentials payload and splits it itself: filled fields become query values and `null` ones become `cleared_credential_keys`. The hook passes its payload straight through, so the derivation the hook did untested is now covered, including that a cleared field is never sent as a value (R1-20). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… branch
`withoutClearedFields` is now computed only where the create path sends it,
so the OAuth branch can no longer pass a payload with the clears already
dropped to `buildOAuthPopupUrl` (R2-04). A narrower parameter type can't
express this: a payload without nulls is still a `CredentialsPayload`.
Also drops the "never sends a cleared field as a value" test: the exact-URL
assertion already covers it, and `not.toContain('region=')` would trip on a
field like `subregion` (R2-14).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… error `updateAccount` took `Record<string, unknown>`, and narrowing it to `CredentialsPayload` would not help: a filled-only `Record<string, string>` from `withoutClearedFields` still assigns to `Record<string, string | null>`. `buildCredentialsPayload` now returns a `BuiltCredentialsPayload`, branded with a type-only unique symbol, and `updateAccount` requires one. Passing `withoutClearedFields(credentials)` to the PATCH is then a type error, which was checked by making that change in the hook. A `@ts-expect-error` spec pins it (R3-09). Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
No issues found across 6 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Requires human review: Fixes OAuth edits not clearing emptied optional fields by adding cleared_credential_keys to the popup URL; requires human sign-off because the new parameter depends on uc-api #9956 being deployed first, or older uc-api stores it as junk.
View guided diff | Turn on auto-fix | Re-trigger cubic
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
When an OAuth account is edited and an optional setup field is emptied, the Hub drops that field from the OAuth popup URL. uc-api then reconnects with the old value. This PR sends the emptied field names as
cleared_credential_keys, so uc-api can remove them.It also makes it a compile error to pass a credentials payload that has already lost its cleared fields to
updateAccount, the PATCH path from ENG-902.Overview: https://claude.ai/artifact/7GtpJfBy66EEzLHg2K4GJT
Linear: ENG-4462
Depends on StackOneHQ/unified-cloud-api#9956, which has to be live on production before the unified-cloud bump that ships this. An older uc-api would store the parameter as a junk credential.
Acceptance criteria
cleared_credential_keys, comma-joined and URL-encoded.cleared_credential_keys, and its URL is unchanged.What changed
buildOAuthPopupUrl(utils/oauthPopupUrl.ts): a new helper that builds the popup URL. It takes the rawCredentialsPayloadand derives both the values (withoutClearedFields) and the cleared names (clearedFieldKeys), so the hook has nothing to get wrong. A characterization test pins the URL from before the change.clearedFieldKeys: new, incredentialsPayload.tsnext towithoutClearedFields.BuiltCredentialsPayload: a type-only brand thatbuildCredentialsPayloadreturns andupdateAccountrequires. A filled-onlyRecord<string, string>can no longer be passed by accident; a@ts-expect-errortest pins this.credentialsstraight through, and applieswithoutClearedFieldsinline only on the create path (connectAccount).Sibling surfaces
handleConnect)updateAccount, ENG-902)connectAccount)/connect/oauth2URL buildersTest plan
oauthPopupUrl.test.ts:nullentry becomes a cleared name, neverkey=nullcredentialsPayload.test.ts:clearedFieldKeysreturns only thenullkeys, and none for a create payloadnpm run lint(biome and tsc) andnpm test(72 tests), all passing.Rollout and rollback
@stackone/hubbump, which is what reaches users.Review notes
This PR went through the same 3 bounded review rounds as #9956.
Deferred: credential keys and
tokenare still interpolated into the popup URL unencoded. That predates this ticket, and the keys come from connector configs written by admins. Only the new parameter is encoded.Known limit: MCP OAuth connectors are presented to the Hub as
oauth2, so the Hub sends clears for them too, but uc-api's MCP flow ignores them, as it already ignores every edited setup value.🤖 Generated with Claude Code