Skip to content

bug(platform): account name saves leave stale user data and Discard restores the older name #3671

Closed

Description

@yannickmonney

Saving an account name does not refresh the current-user cache. The form reports Saved, but a subsequent edit and Discard restores the name from before that successful save. Confirmed locally at 44e0dcf254975286c0e9dea443b5cd1ca6b23347; suggested severity P2.

  1. Open Settings → Account with name Mia.
  2. Change it to Mia Rossi and Save. Wait for Saved.
  3. Type a different name, then choose Discard without leaving the mounted page.

Expected: Discard restores the last successfully saved name, Mia Rossi. Other mounted readers of the current user should receive the saved name.

Actual: The server-side service stores Mia Rossi, while the current-user query still contains Mia. Discard restores Mia because the form's authoritative data prop still comes from that unchanged query. Other useAuth consumers remain stale until another event refetches the user.

The users/mutations:updateUserName adapter has no query invalidation, and useUpdateUserName adds no cache update. The native service writes the Better Auth user row without publishing a compensating hint. The shared form's Discard reads its current server-data prop, exposing the stale baseline.

Source:

Parent proof: personal-settings-proof/account-cache.test.tsx and account-cache.log under /Users/yannick/.codex/notes/tale-100-findings. Both tests passed. Actual AccountForm, shared editor and Save/Discard controls, useAuth, React Query, current-user query, mutation hook, adapter and native updateUserName run. A scripted SQL tag records the native service's bound name; the transport GET returns that saved fixture. Only session/auth identity, unrelated account sections and final HTTP transport are controlled. No real account name or production data changes.

Controls: explicit invalidation of the actual current-user query immediately updates both the form and shared useAuth reader to Mia Rossi. Native Enter-save failures correctly show a toast and preserve the draft; that suspected issue was rejected.

/Users/yannick/.npm/_npx/22f2fe8d8bc13000/node_modules/.bin/bun x --no-install vitest run --config /Users/yannick/.codex/notes/tale-100-findings/personal-settings-proof/vitest.config.ts account-cache.test.tsx --maxWorkers=1 --testTimeout=30000 --reporter=verbose

Live all-state profile/name/stale and profile/discard searches found no matching root. No claim of a real PostgreSQL integration or whole-browser reproduction.

Activity

  1. yannickmonney commented on Oct 2, 2026

    @yannickmonney
    ContributorAuthor

    Related evidence from agent #2's independent review of PR #4067 (merged as 2a169f4c7), P3 item 6 in #4067 (comment).

    users/mutations:updateUserName (settings.ts:1276-1281) invalidates nothing. Since #4067, a renamed user's session-probe answer refreshes only when a probe observer mounts, or after the 5-minute stale window. Before #4067, any read that mounted after that window also refreshed it. The reviewer's suggested fix is to invalidate currentUserQuery in that row.

    This looks like part of the stale user data this issue describes, so it is linked here rather than filed again. The fleet manager (TALE-357) has not re-verified it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions