Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(site): CredentialField: mask api key after submit (#25848) - #27210

Closed
jakehwll wants to merge 1 commit into
release/2.34from
backport/25848-to-2.34
Closed

fix(site): CredentialField: mask api key after submit (#25848)#27210
jakehwll wants to merge 1 commit into
release/2.34from
backport/25848-to-2.34

Conversation

@jakehwll

Copy link
Copy Markdown
Contributor

🤖 This PR was written by Coder Agents on behalf of Jake Howell.

Manual backport of #25848 to release/2.34.

Original PR: #25848 — fix(site): CredentialField: mask api key after submit (fixes CODAGT-525)
Cherry-picked commit: 7195be87b1fcf4946bad2ad308a029503a32b1a0

Why this backport

release/2.34 still has the pre-refactor ProviderForm stories, including AddBedrockWithoutStaticCredentials, whose interaction test asserts:

expect(args.onSubmit).toHaveBeenCalledWith(expect.objectContaining({ type: "bedrock", ... }))

Formik invokes onSubmit(values, formikHelpers) with two arguments, so toHaveBeenCalledWith never matches and the Chromatic/storybook interaction test fails deterministically. This breaks storybook CI for any PR targeting release/2.34 (e.g. the #27083 backport #27144).

#25848 already fixed this on main and release/2.35 by wrapping onSubmit so the spy receives only values. This backport brings that fix (and the underlying credential-masking change) to release/2.34.

Cherry-pick conflict resolution

The provider files (ProviderForm.tsx, ProviderForm.stories.tsx, CredentialField.tsx, deferred.ts, etc.) applied cleanly. The only conflict was in site/src/pages/AgentsPage/AgentChatPage.test.ts:

  • The real fix(site): CredentialField: mask api key after submit #25848 change here is extracting createDeferred to #/testHelpers/deferred and importing it instead of defining it inline.
  • The cherry-pick diff also dragged in unrelated main-only drift (a getWorkspaceOptionsWithLinkedWorkspace test and MockUserOwner/MockWorkspace imports) that does not exist on release/2.34.

Resolution: added the createDeferred import, removed the inline createDeferred/Deferred definition, and dropped the unrelated drift.

Verified on 2.34: ProviderForm storybook stories (15) and AgentChatPage/useChatDraftAttachments unit tests (66) pass; changed files type-check and lint cleanly.

Fixes CODAGT-525

* Re-masks the field after submit
* Sets font to monospaced for legibility
* Extracts `createDeferred` to `testHelpers`

(cherry picked from commit 7195be8)
@linear-code

linear-code Bot commented Jul 14, 2026

Copy link
Copy Markdown

CODAGT-525

@jakehwll jakehwll closed this Jul 14, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 14, 2026
@jakehwll
jakehwll deleted the backport/25848-to-2.34 branch July 14, 2026 02:15
@jakehwll

Copy link
Copy Markdown
Contributor Author

Closed to favour a smaller test change, this seems like too big of a refactor to bring back without testing.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants