Skip to content

Follow-ups from the #4067 review: pin the session-probe gate's untested branches, batch its cache listener, stale docs and dead mocks #4078

Closed

Description

@yannickmonney

Source: agent #2's independent review of PR #4067 (merged as 2a169f4c7, Refs #4062), the items marked "Non-blocking (P3), for follow-up" in #4067 (comment). The fleet manager (TALE-357) filed this so the follow-ups are tracked in one place. Nothing below has been re-verified beyond that review.

  1. Unpinned branches. Four one-change mutants pass every case:

    • snapshot = read even when not asked. "False when not asked" holds only because the quiet hook mounts while the probe is null;
    • subscribe returning () => {}, which is a gated read that leaks its cache listener on unmount;
    • the listener ignoring the probe's hash;
    • useAutomationSettingsValues never gating its unadapted lane, which is unreachable today.

    Seeding a user before the quiet mount, and asserting that getQueryCache().hasListeners() is false after unmount, would pin the first two.

  2. Robustness. The cache listener isn't wrapped in notifyManager.batchCalls, as react-query's own useIsFetching is. No failing case was found.

  3. The gate's cache lifetime rests on root observers. It holds none of its own, and a garbage-collected probe reads as signed out until something remounts.

    • One of those observers is ColdLoadProbe. Its doc (main.tsx:44-45) still says "Dev-only probe … the one request every auth-gated read waits on", and both halves are now wrong.
    • The hook's "(as a mounting observer would)" overstates: an observer also keeps the query and refetches on reconnect.
  4. Comment and naming nits:

    • use-backend-query.ts:117-118 says "resolves", while the doc says "holding a user";
    • use-session-probe.ts:14-15 says only removal is linear, but adding is too;
    • use-settings-values.ts:77-79 still talks of a Convex socket;
    • the local isAuthenticated in useBackendQuery reads false for every adapted read, so gateOpen would be a safer name.
  5. Dead useSessionUser mocks, beyond the six the PR named:

    • user-button.test.tsx;
    • dashboard-layout.test.tsx, whose "drives both" comment is now wrong;
    • dashboard-shell.browser.test.tsx;
    • account-form.name.test.tsx, account-form.password.test.tsx and forced-change-password.test.tsx.

    The reviewer found that no assertion became vacuous.

Tracked elsewhere: the review's item 6 belongs with #3671 (account name saves leave stale user data). There, users/mutations:updateUserName (settings.ts:1276-1281) invalidates nothing, so a renamed user's probe answer refreshes only when a probe observer mounts, or after the 5-minute stale window.

Acceptance

Activity

  1. added a commit that references this issue on Oct 4, 2026
    b994483
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions