Skip to content

fix(web): tie a refused new password's error to its field - #5453

Open
rangoDJ wants to merge 4 commits into
Silo-Server:mainfrom
rangoDJ:fix/5159-password-error-field
Open

rangoDJ wants to merge 4 commits into
Silo-Server:mainfrom
rangoDJ:fix/5159-password-error-field

Conversation

@rangoDJ

@rangoDJ rangoDJ commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Depends on: none. Merge order: none. Follows #5124 (merged), which added the policy refusals these forms show.

Problem

Closes #5159
Related issue: #5124
Validation tasks: none

Other clients: none. Web only.

When a new-password form refused a password before sending it, the error wasn't tied to the field. Screen readers announced the alert, but the field had no aria-invalid and no aria-describedby pointing at the error, so moving back to it didn't say what was wrong. This affected the choose-password page (ChoosePassword.tsx), the password reset page (PasswordReset.tsx), Account settings (AccountSettings.tsx), and the invitation page (InviteClaim.tsx), which showed a policy refusal only as a toast. Signup and the admin Create User form already tie their errors to the field.

Approach

  • On choose-password, password reset and Account settings, the field a refusal is about is marked aria-invalid and described by the existing alert (which now has an id): the new password for a policy rule, the confirmation for a mismatch. That state clears when the field changes; editing the new password also clears a mismatch, since either field can correct it. On Account settings the new-password field keeps its requirements hint in aria-describedby, followed by the error.
  • newPasswordFieldProblem (lib/newPassword.ts) returns the reason together with the field it is about; newPasswordProblem now uses it and returns the same text as before.
  • On the invitation page, a policy refusal now shows under the password field (role="alert"), and the field references it, as the email field there already does. This replaces the toast. A mismatch still shows its toast on submit; the confirmation field now references the mismatch text the page already showed under it.
  • A refusal the server names at the new password (body.new_password, or body.password on the reset page) marks that field the same way (refusedPasswordMember). On Account settings, whose fields stay editable while a change is pending, it does so only if the field still holds the password that was sent. On the invitation page, a validation_failed refusal at body.password shows under the password field like a refusal before sending, and that error clears once the password passes the local check.

Validation

  • New tests, one per form: ChoosePassword.test.tsx (new file), PasswordReset.test.tsx, AccountSettings.test.tsx and InviteClaim.v2.test.tsx. Each one submits a short password and checks the new-password field is invalid and described by the rule, that changing the field clears it, and (except on the invitation page, where the mismatch shows while typing) that a mismatch marks the confirmation and that editing the new password clears it. ChoosePassword, PasswordReset and Account settings also check a server refusal at the new password marks that field, and InviteClaim.v2.test.tsx checks the same for the invitation page. All four fail on main and pass with this change.
  • pnpm exec vitest run on those forms, lib/newPassword, Signup, the admin set-password dialog and the setup wizard: 81 passed. tsc -b --noEmit, eslint and prettier on the changed files: clean.
  • In Chromium (Vite dev server, local Silo server), the invitation page after a short password: aria-invalid="true", aria-describedby="invite-password-error", and that element reads "Use at least 8 characters."
  • Not tested: a screen reader.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-5453/ (before/after screenshots of the invitation page at desktop and phone width)

Invitation page, after submitting a too-short password (desktop 1280x900 and phone 390x844)

Before (main): the rule appears only as a toast, and the password field has no error state.

After: the rule appears under the password field, which is outlined as invalid and references it.

On the other three forms the refused field now also gets the red invalid border that the shared input draws for aria-invalid; the message itself stays where it was. Their change is shown by the tests, not by captures. On main (38c3b8c), with the new tests:

 FAIL  src/pages/ChoosePassword.test.tsx > ties a refused password to the field it is about until that field changes
 FAIL  src/pages/InviteClaim.v2.test.tsx > shows a password the policy refuses under its field and ties the field to it
 FAIL  src/pages/PasswordReset.test.tsx > ties a refused password to the field it is about until that field changes
 FAIL  src/pages/settings/AccountSettings.test.tsx > AccountSettings > ties a refused password to the field it is about until that field changes
      Tests  4 failed | 31 passed (35)

With this PR: Tests 81 passed (81) across the forms above.

Risks

  • The invitation page no longer shows a toast for a policy refusal; the inline error is announced as an alert instead.
  • No API, schema, config or translation change: every message already existed.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code in the Claude desktop app
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, not yet human verified
  • Adversarial review: n/a

🤖 Generated with Claude Code

Note

Tie refused new-password errors to their form fields with ARIA attributes

  • Adds a field-aware validator in newPassword.ts: mismatches map to the confirmation field, policy failures to the password field. A new helper also checks whether a server V2ProblemError's first field error points at a given request-body member.
  • Applies this across the ChoosePassword, PasswordReset, InviteClaim, and AccountSettings password forms. Each form tracks the invalid field, clears it on edit, and marks the matching input with aria-invalid and aria-describedby.
  • In InviteClaim.tsx, local policy failures now render under the password input instead of a toast.
  • In AccountSettings.tsx, a server refusal marks the new-password input only when its current value still matches the submitted value, tracked via a ref.
  • Behavioral Change: server validation errors are shown inline at the field instead of generically, and only for errors located at body.new_password/body.password.

Macroscope summarized cbab228.

When a new-password form refused a password before sending it, the error
was an alert (or, on the invitation page, a toast) that the password
field did not reference: no aria-invalid and no aria-describedby, so
returning to the field did not say what was wrong.

On the choose-password, password reset and Account settings forms the
refused field (the new password for a policy rule, the confirmation for
a mismatch) is now marked invalid and described by the error until it
changes. The invitation page shows a policy refusal under the password
field instead of a toast, and its confirmation field references the
mismatch text it already showed.

newPasswordFieldProblem returns the reason with the field it is about.

Closes Silo-Server#5159

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-triage silo-triage Bot added the size/L 200–499 added + deleted lines (all files); change volume, not priority. label Nov 27, 2026
@silo-kody

silo-kody Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-triage silo-triage Bot added bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes impact: polish Annoyance, cosmetic, or nice-to-have javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish labels Nov 27, 2026
@silo-triage

silo-triage Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Resolved: the requested phone-width before-and-after captures have been added with build identifiers, covering the previously missing mobile-web surface.

Original request

The invitation-page captures show the desktop error-state change. Please also add before-and-after captures at a phone-width viewport for that page with the same refused-password case, identifying the builds. CONTRIBUTING.md treats desktop and mobile web as separate surfaces; the current evidence covers desktop only.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The password validation helper now identifies the field associated with an error. Choose-password, password-reset, invitation-claim, and account-settings forms expose errors on the relevant input and clear field error state when edited.

Changes: Password field error association

Layer / File(s) Summary
Field-aware validation in choose and reset forms
web/src/lib/newPassword.ts, web/src/pages/ChoosePassword.tsx, web/src/pages/ChoosePassword.test.tsx, web/src/pages/PasswordReset.tsx, web/src/pages/PasswordReset.test.tsx
The shared validator returns the error message and affected field. The forms mark the relevant input invalid, link it to the error description, and clear its invalid state when edited. Tests cover policy errors, confirmation mismatches, and server validation errors.
Invitation claim field errors
web/src/pages/InviteClaim.tsx, web/src/pages/InviteClaim.v2.test.tsx
Password-policy errors appear below the password input. Server password refusals are also associated with that input. The form marks confirmation mismatches on the confirmation input. Tests verify accessible descriptions and that invalid submissions do not proceed.
Account settings field errors
web/src/pages/settings/AccountSettings.tsx, web/src/pages/settings/AccountSettings.test.tsx
Account settings marks the affected input invalid and links it to the error alert. A server refusal marks the password input only when its value still matches the submitted value. Tests cover local validation, server refusals, and edits while a request is pending.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • Silo-Server/silo-server#5124: Adds password policy refusals and changes refusal handling on the invitation and Account settings pages. This change also handles password refusal details on those pages.

Suggested reviewers: rhainland, quick104

Merge Risk: Minimal · up to cbab2

This change links refused-password errors to the relevant field on the choose-password, reset, invitation, and Account settings forms. The behavior is limited to the UI, and the tests cover the main cases. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to cbab2

Password errors are now linked to the field that needs correction. The change does not alter who can set a password, where credentials are sent, or how a session is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): tie a refused new password's error to its field" matches the main change: the refused-password error on the choose-password, password reset, Account settings, and invitation pages…
Linked Issues check Passed Directly linked issue #5159 is open. Its coding requirements are: on the choose-password, password reset, invitation, and Account settings pages, mark the password field invalid when a refused passwor…
Out of Scope Changes check Passed Every changed file maps to #5159. Changes are: web/src/lib/newPassword.ts (new newPasswordFieldProblem and NewPasswordField type, refusedPasswordMember helper, and newPasswordProblem delegating with u…
Description check Passed The description is specific and on-topic. It names the four changed forms (ChoosePassword.tsx, PasswordReset.tsx, AccountSettings.tsx, InviteClaim.tsx) and the lib/newPassword.ts helper. It explains t…
Full details: Title check

Explanation

The title "fix(web): tie a refused new password's error to its field" matches the main change: the refused-password error on the choose-password, password reset, Account settings, and invitation pages is now associated with the password field through aria-invalid and aria-describedby. It is concise, specific, and follows a conventional commit style.

Full details: Linked Issues check

Explanation

Directly linked issue #5159 is open. Its coding requirements are: on the choose-password, password reset, invitation, and Account settings pages, mark the password field invalid when a refused password error is shown, reference the error text from the field, and clear that state when the password changes. The reviewed head meets these requirements per the change summary. ChoosePassword.tsx, PasswordReset.tsx, and AccountSettings.tsx use newPasswordFieldProblem to find the field a refusal concerns (password for a policy refusal, confirmation for a mismatch). They set aria-invalid and aria-describedby to the alert, which now has an id. They clear the state when the affected field changes. Editing the new password also clears a mismatch. AccountSettings keeps the requirements hint in aria-describedby and appends the error. InviteClaim.tsx shows a policy refusal under the password field with role="alert" and links the field to it. The confirmation field links to the existing mismatch text. Tests for each form check these behaviors. The PR reports that the four new tests fail on main and pass at the head. Follow-up commits add server refusal handling (body.new_password, or body.password on reset). This extends the same requirement and is not a separate objective. Remaining uncertainty: the current PR description says invitation server refusals show "as before" (toast), but the commit summary and InviteClaim.tsx summary say they now appear under the field. This does not change compliance with #5159, because the field is tied to its error either way. The source files were not inspected directly; the verdict relies on the change summary and the reported test results. No screen-reader test is required by the issue, and none was performed.

Full details: Out of Scope Changes check

Explanation

Every changed file maps to #5159. Changes are: web/src/lib/newPassword.ts (new newPasswordFieldProblem and NewPasswordField type, refusedPasswordMember helper, and newPasswordProblem delegating with unchanged message text); the four form pages (ChoosePassword.tsx, PasswordReset.tsx, AccountSettings.tsx, InviteClaim.tsx); and the matching test files (ChoosePassword.test.tsx, PasswordReset.test.tsx, AccountSettings.test.tsx, InviteClaim.v2.test.tsx). The helper is needed to identify the affected field. The server refusal handling is needed for the field to reflect server-named refusals of the new password, which is the same field-association concern. The invitation page change replaces the policy toast with an inline alert, which is the field association the issue asks for. The PR reports no API, schema, config, or translation change. No unrelated change was identified in the supplied summary. The source files were not inspected directly. The description-versus-code discrepancy on invitation server refusals is noted under the linked-issue assessment and does not establish an unrelated change.

Full details: Description check

Explanation

The description is specific and on-topic. It names the four changed forms (ChoosePassword.tsx, PasswordReset.tsx, AccountSettings.tsx, InviteClaim.tsx) and the lib/newPassword.ts helper. It explains the accessibility problem: the password field lacked aria-invalid and aria-describedby. It states the approach, the tests added, the validation performed, and the risk of removing the invitation toast. It is clearly related to the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 271e34e3-5873-4201-9305-5b0eca9a03cf
Commits

Reviewing files that changed from the base of the PR and between c62f687 and cbab228.

Files selected for processing: 9

  • web/src/lib/newPassword.ts
  • web/src/pages/ChoosePassword.test.tsx
  • web/src/pages/ChoosePassword.tsx
  • web/src/pages/InviteClaim.tsx
  • web/src/pages/InviteClaim.v2.test.tsx
  • web/src/pages/PasswordReset.test.tsx
  • web/src/pages/PasswordReset.tsx
  • web/src/pages/settings/AccountSettings.test.tsx
  • web/src/pages/settings/AccountSettings.tsx

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

Comment thread web/src/pages/ChoosePassword.tsx Resolved
…ssword

Review follow-up. A mismatch can be corrected from the new-password field,
so editing that field now clears the confirmation's error too. A refusal
the server names at the new password (body.new_password, or body.password
on the reset page) now marks that field as well, as the client-side
refusals do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@rangoDJ

rangoDJ commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

Added phone-width captures (390x844, headless Edge with mobile emulation) of the invitation page with the same refused-password case, before (main 38c3b8c) and after (dcb65cd), next to the desktop pair: https://evidence.siloserver.org/r/silo-server/pr-5453/. The build line in the notes names both commits.

@silo-triage silo-triage Bot removed the evidence-required Needs before-and-after evidence before the Evidence check passes label Nov 27, 2026
Review follow-up. Account settings keeps its fields editable while a
change is pending, so a refusal that arrives after the new password was
edited no longer marks the edited value invalid; the alert still shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silo-kody

silo-kody Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

The invitation page now shows a password the server's policy refuses
under the password field and marks the field, as the other new-password
forms do. It also clears the inline error once the password passes the
local check, so a policy refresh can't leave a stale refusal on screen.
The new test file's mode drops to 0644 like its neighbours.

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

@Quick104 Quick104 left a comment

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.

Review of 001174d. The other three forms hold up under submit, edit, and server-refusal sequences, and the new tests fail on main for the reported reason. All three findings below are in or next to the invitation page, and each is small. I'm fixing them in a commit on this branch, so there's no need to change anything yourself.

🤖 Claude Code (claude-opus-5-5)

Comment thread web/src/pages/InviteClaim.tsx Resolved
Comment thread web/src/pages/InviteClaim.tsx Resolved
Comment thread web/src/pages/ChoosePassword.test.tsx Resolved
@silo-kody

silo-kody Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@Quick104

Quick104 commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Review summary (head cbab228)

The change does what #5159 asks: on choose-password, reset, Account settings, and the invitation page, a refused new password now marks the field it's about and points the field at the error, and editing clears that state. I pushed one commit (cbab228) for the three findings in my review:

  • The invitation page now shows a password the server refuses (validation_failed at body.password) under the field, as the other three forms already do for their server refusals. New test fails on 001174d and passes after.
  • The invitation page's inline error clears once the password passes the local check, so a policy refresh can't leave a stale refusal on screen during the request.
  • ChoosePassword.test.tsx mode is back to 0644.

Verification. A sandbox built from the merge base, then rebuilt from cbab228, with the same link invitation. On the base, the password field had no aria-invalid and no description for either refusal (toast, then banner). On the head, it has aria-invalid="true" and aria-describedby="invite-password-error" for both, with the message under the field. The server refusal was reached by serving the page a looser policy than the server's; the notes say so. The PR's tests fail on the base for the reported reason (7 failed); 81 pass on the head. CI is green on cbab228.

Evidence: https://evidence.siloserver.org/r/silo-server/pr-5453-review/

Recheck on the same head (cbab228). Main hasn't changed any file this PR touches since its merge base. The PR's tests fail on the merge base for the reported reason (8 failed; each failure whose output vitest printed is the missing aria-invalid) and pass on the head (43 in the touched files); a fresh read of the diff found no new defects, and the board check above still holds. One correction to the PR body, which I've edited: aria-invalid also draws the shared input's red invalid border, so the refused field on choose-password, reset, and Account settings now looks different too, not only to assistive technology. That outline wasn't captured on those three forms; the invitation page captures show it.

Left for the maintainers to settle (none block merging):

  • The setup wizard's account step and the admin Set password dialog have the same gap: a toast only in the wizard, and in the dialog an aria-invalid that any error sets and no description pointing at the error. Both predate this PR and [bug] New-password form errors aren't tied to the password field #5159 doesn't list them. Filed as [bug] Setup wizard and admin Set password dialog don't tie password errors to the field #5673, to build on this PR's helpers once it merges.
  • On the invitation page the confirmation field is marked invalid while it differs from the password, including mid-typing, because the mismatch text there already shows live. The other forms mark it only after a submit.
  • Resubmitting the same refused password leaves the alert text unchanged, so a screen reader may not announce it again. The other forms on main already work this way.
  • A server refusal from schema validation reads "expected length >= 8", the API's raw message. The web client can't trigger it with a real policy (the minimum is never below 8), and this PR doesn't change it.

Validated features. Invitation claim (#1197 C2) runs through the changed page but its outcome is unchanged; nothing else on the board shares code with this diff. Validation tasks: none is right.

User manual. Unaffected: the manual doesn't describe where password refusals appear.

Other clients. Web only; Apple, Android, and Roku have their own password screens and this changes no API.

Council. Sol (gpt-6.2-sol, medium), Opus (claude-opus-5-5, medium), Gemini (gemini-4-neon, medium). Round 1 on 001174d: 8, 8, 8. Round 2 on cbab228: 9, 9, 9.5. All three found the invitation page's unmarked server refusal; the fix resolved it. The visual review of the invitation page rated the after better than the before (8, 8, 8).

Fit: 9/10 · Readiness: 9/10 — ready

Fit: an accessibility fix for a triaged bug, done inside the forms with a small helper and no new settings or API. Readiness: shown live on the invitation page and by tests that fail on the base for the other forms, validation board checked, and no open defects in this diff.

🤖 Claude Code (claude-opus-5-5)

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

Labels

bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/L 200–499 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] New-password form errors aren't tied to the password field

2 participants