Show a notice when a saved field value was rejected - #21
Open
masnwilliams wants to merge 1 commit into
Open
Conversation
Managed-auth fields carry replace_existing when the site rejected the stored credential. Carry it through the canonical projection and render a notice on the field so the user knows a new value is required.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
masnwilliams
marked this pull request as ready for review
August 2, 2026 18:41
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 a site explicitly rejects a stored credential, the pause records
replace_existingon the field so the user can be told the saved value is no longer usable. Nothing rendered it: the canonical projection dropped the flag, and neither field type declared it, so the form re-rendered as an ordinary empty input with no indication of why it was asked again.changes
replace_existingonManagedAuthFieldandDiscoveredFieldfieldsFromCanonical, which previously copied six keys and stoppedfieldReplaceExistingNoticelabel and theinputReplaceNoticeappearance slotThe notice uses the existing
--kma-color-dangertoken and the same typography as.kma-input-hint; no new design values.ordering
Based on #20, which introduces
fieldsFromCanonical. Review that first; this diff is only the flag.The API side ships in kernel/kernel#3094, which adds
replace_existingto theDiscoveredFieldschema. Until that deploys the flag only arrives on canonicalfields, which this handles; afterwards it arrives on both and both paths render.tests
bun test,bun run typecheck,bun run build, andprettier --checkall pass.Four pure cases in
state.test.ts:falsediscovered_fieldspass the flag through untouched, which is the path that goes live firsttoStrictEqualon the whole projected field, not a subset. The existing tests usetoMatchObject, which is why a dropped key passes unnoticed — this one fails if the projection forgets any property the form rendersThe first and fourth were verified to fail with the
fieldsFromCanonicalline reverted; the legacy and unset cases stay green in both states.Not covered: the render itself. The package has no DOM test setup, so
UnifiedAuthFormhas no test at any level and this change does not add one.Note
Low Risk
UI copy and optional field metadata only; no auth, credential handling, or submission logic changes.
Overview
When the backend marks a field with
replace_existing, the auth form now explains that the stored value was rejected and a new one is required, instead of showing a blank input with no context.replace_existingis added onManagedAuthFieldandDiscoveredField, forwarded throughfieldsFromCanonical(it was previously dropped in projection), and honored on legacydiscovered_fields.UnifiedAuthFormrenders a danger-styled notice above the field hint when the flag is set.Customers can customize copy via
fieldReplaceExistingNoticeand styling via theinputReplaceNoticeappearance slot.state.test.tsadds coverage for canonical projection, legacy passthrough, and a stricttoStrictEqualguard so future projection omissions fail tests.Reviewed by Cursor Bugbot for commit 7ab0711. Bugbot is set up for automated code reviews on this repo. Configure here.