Skip to content

fix: settings & forms UX polish pass (#1966) - #2261

Merged
cursor[bot] merged 4 commits into
mainfrom
tale/xs7fr6k1hwsrwx8ze4nx6937n589e88h
Jul 3, 2026
Merged

cursor[bot] merged 4 commits into
mainfrom
tale/xs7fr6k1hwsrwx8ze4nx6937n589e88h

Conversation

@larryro

@larryro larryro commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of the Settings & forms UX polish epic (#1966). This PR lands a focused, fully-verified batch of the still-open child items. Each change is independently shippable per the epic.

Child issues addressed

Deliberate scoping

Verification

  • tsc --noEmit (platform) — clean
  • vitest server project: derive-name-from-email.test.ts (17 cases) + i18n messages.test.ts (parity/usage enforce) — pass
  • vitest UI project: organization-settings (incl. new required-name coverage), branding-form, copyable-field — pass
  • oxlint (changed files) + oxfmt --check + knip — clean

Required-org-name test coverage (addresses desk-review blocking point #1951)

organization-settings.test.tsx now has a schema-wired harness that mirrors the production container's useFormEditor({ schema: z.object({ name: z.string().trim().min(1, …) }) }). Four cases assert the new error branch end-to-end:

  • starts valid with a non-empty name (no error rendered),
  • clearing the name flips the editor's isValid to false (so the global Save button is gated) and renders the organization.nameRequired message on the field,
  • a whitespace-only name is trimmed and treated as empty (stays invalid + error shown),
  • typing a real name back recovers to valid and clears the error.

Note on the prior description: the earlier "onboarding account-step" UI test was not present — only the deriveNameFromEmail() unit test (17 cases, not 18) covered that path. This description has been corrected to state only what is actually verified; the integration wiring name: deriveNameFromEmail(email) || email in account-step.tsx remains a single line over the unit-tested util.

Remaining epic items (forms validation timing, toasts title+description, tables, branding palette, CSP, changelog nav, etc.) are out of scope for this PR and tracked by their own child issues.

Closes #1966

@larryro

larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Desk Review — PR #2261 (Epic #1966: Settings & forms UX polish pass)

Verdict: NOT READY — CHANGES REQUIRED (functionally correct, but a new error branch is untested and the PR's Verification section is inaccurate).

CI & tests (observed)

  • CI: GREEN — gh pr checks shows every job passing (Type check, Lint, Knip, Format, Unit, UI, Storybook, Build platform, all 16 Playwright shards, Smoke, etc.). The only non-pass entries are fork-PR-only jobs reported skipping, which is expected.
  • Tests I ran on this branch (bun/vitest):
    • bunx vitest --run --project server lib/utils/derive-name-from-email.test.ts → 17 passed (PR body says "18 cases" — it is 17).
    • bunx vitest --run --project server lib/i18n/messages.test.ts → 23 passed (locale parity + key-usage; confirms actions.clearAll still used, new keys present in all locales).
    • bunx vitest --run --config vitest.ui.config.ts organization-settings.test.tsx branding-form.test.tsx copyable-field.test.tsx → 18 passed.

What is correct (verified across branches)

Blocking points

  1. No test for the new org-name-required error branch (Improvement: Make organization name required #1951). organization-settings.test.tsx only covers page-load and locale-dirty behavior, and — critically — both of its harnesses call useFormEditor WITHOUT the schema, so the new .min(1) validation path the production container now wires is never instantiated in any test. Add a test asserting that with an empty/whitespace name (a) the editor's isValid is false / Save is disabled, and (b) the organization.nameRequired message renders on the name field. This is the PR's one substantive new error branch and it currently has zero coverage.
  2. The PR Verification section is inaccurate — correct it or make it true. It claims a passing "onboarding account-step" test, but no test references AccountStep / account-step / deriveNameFromEmail at the integration level (grep finds none); only the util unit test exists. It also states "18 cases" while the suite runs 17. Either add the claimed account-step test covering name: deriveNameFromEmail(email) || email and the email-before-Name ordering (Improvement: Rename "Display name" → "Name" and auto-derive Name from email #1941 AC), or amend the description to state only what was actually verified.

Non-blocking notes (no action required to merge once the above are fixed)

  • Whitespace-only org name (" ") is accepted by better-auth on update (its name.min(1) runs without trimming); "" is correctly rejected. The client coerces whitespace → undefined (organization-settings.tsx:349) so the UI is safe, but a direct API caller could persist a blank-looking name. Optional hardening: trim in the beforeUpdateOrganization hook (convex/auth.ts) to fully close Improvement: Make organization name required #1951 server-side.
  • copyAriaLabel reuses the field label — acceptable.

NOT READY — CHANGES REQUIRED (see the two numbered blocking points above).

@larryro

larryro commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

Desk Review — PR #2261 (Settings & forms UX polish, epic #1966)

Verdict: READY TO MERGE.

Reviewed the whole implementation on branch tale/xs7fr6k1hwsrwx8ze4nx6937n589e88h (11 files, +242/−25) across all five child issues, in two rounds (breadth review by dimension/file, then independent confirmation of every blocking candidate).

CI & tests

  • CI: fully green — all 44 required checks pass (Type check, Lint, Knip, Format, Unit, UI, Storybook, Build platform, all 16 Playwright platform shards, etc.). Only fork-PR-variant jobs are skipped, as expected.
  • Ran locally:
    • bunx vitest --run --project server → 543 files, 6518 tests passed (incl. derive-name-from-email.test.ts 17 cases + i18n parity/usage tests).
    • bunx vitest --run --config vitest.ui.config.ts → full UI suite 350 files, 2607 tests passed.
    • Targeted: bunx vitest --run --config vitest.ui.config.ts organization-settings.test.tsx branding-form copyable-field → 3 files, 22 tests passed (incl. the new required-org-name cases).

Acceptance criteria — all met

i18n parity verified across en/de/fr (+ de-CH override clean); new keys present in all locales; no orphaned keys.

Non-blocking follow-up notes (do not gate this merge)

  1. Test mirrors the schema instead of importing it — organization-settings.test.tsx rebuilds a local requiredSchema rather than the container's orgSchema, so a future prod-schema regression (dropping .trim(), wrong i18n key) wouldn't be caught by the unit test. Consider exporting the schema or adding an e2e empty-name case.
  2. Whitespace-only org name server-side — better-auth's min(1) rejects "" but not " " (no server trim). Only reachable by a raw API call bypassing the app (the client converts whitespace→undefined). Minor robustness edge.
  3. copyAriaLabel duplicates label on the 2FA CopyableField, so a screen reader announces the same text twice. Minor a11y nit.
  4. deriveNameFromEmail mid-word capitals — e.g. McDonald@… → "Mcd Onald". Rare; the util is conservative by design and the value is editable. Minor nit.

None of the above block the merge.

@cursor
cursor Bot merged commit 30fac4e into main Jul 3, 2026
51 checks passed
@cursor
cursor Bot deleted the tale/xs7fr6k1hwsrwx8ze4nx6937n589e88h branch July 3, 2026 13:31
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.

Epic: Settings & forms UX polish pass

1 participant