Skip to content

fix(platform): close the session-lapse leftovers after #3795 - #3804

Merged
yannickmonney merged 7 commits into
mainfrom
fix/session-lapse-review-leftovers
Sep 29, 2026
Merged

yannickmonney merged 7 commits into
mainfrom
fix/session-lapse-review-leftovers

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #3795: the four leftovers from its review, each re-checked on current main first.

What changed

1. The cloud file pickers' checkboxes are named (WCAG 4.1.2). OneDriveFileTable is the one table the Google Drive, OneDrive and SharePoint pickers share. Its header box now reads Select all (common.aria.selectAll), and each row's box says what it selects:

  • en: Select folder ‹name› / Select file ‹name›
  • de: Ordner ‹name› auswählen / Datei ‹name› auswählen
  • fr: Sélectionner le dossier ‹name› / Sélectionner le fichier ‹name›

The keys are new, documents.aria.selectFolder/selectFile, next to that group's openFolder/openDocument. The dialog tests now find a row's box by name instead of const [, rowCheckbox] = getAllByRole('checkbox'). cloud-import-dialogs.lapsed-session.test.tsx does it with the real catalogs in en/de/fr.

2. The dashboard's banners clear the notch when no session notice stands above them. The two-factor grace, low-backup-codes and embedding banners were three copies of one row; they now render through one ShellAlert (app/components/layout/shell-alert.tsx).

  • ShellAlert carries role="status", the tint and a data-shell-alert marker. Whichever alert stands first pads the notch (first:pt-[calc(0.75rem+var(--safe-top))]).
  • The session notice carries the same marker in place of data-session-lapse-notice.
  • ShellMobileHeader/ShellNotchSpacer drop their pad for .mobile-nav-shell:has(>[data-shell-alert]), so with any alert on top the notch is padded once, not twice.

3. The create-organization page leaves a lapse to the dashboard layout. routes/dashboard.tsx already owns signed-out entry (beforeLoad and its re-check) and a session that ends under the page (Sign in / Stay here).

  • The page's own navigate({ to: '/log-in' }) effect is gone, and so are its auth conditions, so the wizard and the typed name stay mounted under Stay here.
  • Only a read that never answered is an error now (isLoadingError), the rule $id.tsx applies to its member context. A session that ends here is mostly met by a re-read: a reconnect re-reads stale queries once the 5-minute stale window has passed. That re-read's 401 marks the query as errored while it keeps its last answer. Under the old isError check, the page swapped the wizard for "the page could not load" behind Stay here.
  • The frame waits on capabilities.isPending instead of isLoading. The capabilities query is enabled: isAuthenticated, and the layout mounts the page as soon as Better Auth confirms a live session, possibly while the /users/me probe still reads signed out. In that window the query has not run: isLoading is false but isPending is true. Without the old auth conditions, an isLoading guard would have said creation is forbidden there.
  • useUserOrganizations drops the auth fields this page no longer reads.

4. The OAuth intent lane uses the shared lane helpers. oauth-intent.integration.ts drops its copies (cookieOf, signUp) for signUpUser from integration-lane-helpers.ts. oidc-integration.ts's freshUser takes its cookie from cookieHeaderFrom, which adds the empty-pair filter; its own password and email domain stay.

Where this differs from the brief, and why:

  • Row labels split by type. "Select {name}" read the same for a folder and a file of one name, which Google Drive allows side by side. A file named "all" read like "Select all".
  • One marker on every shell alert, rather than a selector widened to two markers. A banner written through ShellAlert cannot miss the rule, and the header's selector stays a single attribute.
  • isAuthLoading is dropped as well. The layout never mounts its children before the probe resolves, so the page could only see it true after a reset of the probe, and unmounting the wizard then is exactly what this change removes.
  • Only signUpUser is imported into the OAuth lane. Its cookieOf was used only inside signUp, so cookieHeaderFrom would be an unused import.

Review

An independent adversarial read of the diff found the re-read path in item 3 (fixed above), the same-named row labels (fixed), a probe-window test that asserted only absences (it now asserts that the mounted page shows its frame), and three stale notes (fixed).

Left as is, deliberately:

  • A frame that can hold indefinitely. If Better Auth reports a live session but /users/me never answers a user, the page holds its frame; the layout reloads once after 8 s. Main's page bounced to /log-in instead, whose guard sends a live session straight back to /dashboard.
  • The session notice keeps its own row. Its padding and its hide-while-asking behaviour differ from the banners; it shares only the marker, which is the notch contract.

How it was verified

  • Unit/component (jsdom): 258 tests over the 25 test files that import or mock a module changed in the last round, all green.

    • onedrive-file-table.test.tsx: literal names in en/de/fr, every box named, axe clean.
    • session-lapse-drafts.test.tsx runs the real /dashboard layout with the real create-organization page. The wizard and the typed name survive Stay here both when the probe loses its user and when a re-read of the capabilities meets the 401. There is no navigate, and while a live session's probe catches up the mounted page shows its frame, never the refusal.
    • organization-creation.test.tsx models v5 results (isPending, isLoadingError) and covers a failed re-read keeping the wizard.
  • Before/after:

    • On main's table, all 28 checkbox-dependent cases fail ("Unable to find … checkbox").
    • On main's page, the lapse cases fail: the wizard is "not found in the document", and navigate is called.
    • Against this PR's first version of the page (isError), exactly the two new re-read cases fail.
    • With isLoading kept, the probe-window case fails on onboarding.workspace.creationForbidden.
  • Browser (real Chromium). session-lapse-recovery.browser.test.tsx renders the real three banners in the phone shell with --safe-top: 47px: each alone above the header and above a thread page, two stacked, and one under the notice.

    • On main's components, 7 of the 8 new cases fail: the banner text sits at 13 px under a 47 px notch, and the first of two banners gets 12 px instead of 59 px. The 8th case guards against a banner under the notice padding again.
    • CI's Browser job ran the file (47 tests); it was not a cache replay.
  • Real app (backend + Vite, 375 px, a 47 px notch from the first paint), embedding banner showing.

    main branch
    banner title top 13 px (under the notch) 60 px
    banner padding-top 12 px 59 px
    header pad / thread spacer 47 px, a blank band below the banner 0
    page content top 169 px (chat 120) 169 px (chat 120)
  • visual-aspect-analyzer, main → branch: documents at 375 px with the notch 95 → 92, chat at 375 px with the notch 95 → 92 (twice), desktop at 1440 px 86 → 86 with identical defects.

    • The only defects on the notch flows are main's own late-banner layout shift. Every visible element lands in the same place on both.
    • The metric grows from 0.10 to 0.16 because the element that carried the notch pad now collapses under the arriving banner instead of moving down whole: its edge travels 120 px instead of 73. This is the intended hand-over of the pad.
    • One run showed jank on the first-visit "ready to work offline" toast; two re-runs did not.
  • Real Postgres. ITEST_LANES=checkConnectorOauthIntent,checkNativeIdentity passed 87/88: all 13 OAuth-intent and 58 identity checks. The one failure is the BM25 boot check, which needs pg_search, and the scratch server lacks it. No workflow runs backend:integration, so this is the only run of these lanes.

  • Static checks.

    • oxlint --type-aware and oxfmt --check on the changed files, and a scoped tsc over them and their imports: all clean.
    • The platform i18n suites pass (185 tests).
    • bun run lint:manual is ok, and check-guide.ts finds nothing new.
  • Manual layer. AUTH-B14's notched-iPhone step now covers a banner with no notice, and the wizard keeping its typed name. reference/automation.md records the new coverage, including an accessibility row for the picker names.

Overlap: open PRs #3801 and #3784 also edit messages/{en,de,fr}.yml, and they, #3803 and #3778 edit tests/manual/reference/automation.md, all on other lines.

The one table the Google Drive, OneDrive and SharePoint pickers share
rendered its checkboxes without a name, so a screen reader announced
each row's box as a bare "checkbox" (WCAG 4.1.2). The header box now
reads "Select all" (common.aria.selectAll) and each row's box names its
item through the new documents.aria.selectItem, in en, de and fr.

The dialog tests find a row's box by that name instead of by position;
a table test pins the names in every shipped locale and runs axe.
In an installed iPhone app, the two-factor and embedding banners stood
first in the shell's alert stack whenever no session notice was above
them. Their words sat under the notch, and the shell's header (or a
thread page's spacer) still padded the notch below them, leaving a blank
band as tall as the notch between the banner and the header.

The three banners now render through one ShellAlert, which marks the
row as a shell alert (data-shell-alert) and pads the notch when it
stands first. The session notice carries the same marker instead of
its own. The header and the spacer drop their pad while any shell alert
stands, so the notch is padded once, by whichever alert is on top.
The page ran a signed-out redirect of its own under the dashboard
layout, which already owns both a signed-out visit (beforeLoad and its
re-check) and a session that ends under an open page (Sign in / Stay
here). Once the session probe lost its user, the page swapped the
wizard for the loading frame, losing the typed organization name, and
left for /log-in without the page to return to or the choice.

The effect and the auth conditions are gone, so the wizard stays mounted
behind the layout's confirmation. The frame now waits on the
capabilities read's isPending rather than isLoading: that read waits for
the session probe, and the layout mounts the page as soon as Better Auth
confirms a live session, while the probe may still read signed out. A
read that has not run yet is not loading, so the page said creation was
forbidden in that window.
The connector OAuth intent lane kept its own copies of the suite's
cookie handling and throwaway sign-up, which integration-lane-helpers.ts
exists to hold once. It signs up through signUpUser now, and the
identity lane's freshUser takes its Cookie header from cookieHeaderFrom
(which also drops empty pairs), keeping its own password and address.
"Select {name}" read the same for a folder and a file of one name, which
Google Drive allows side by side, and a file named "all" read exactly
like the header's "Select all". A row's box now says what it selects,
the way the documents' own openFolder/openDocument labels do: "Select
folder {name}" or "Select file {name}", in en, de and fr.
A session that ends under the create-organization page is mostly met
by a re-read: once the stale window has passed, a reconnect re-reads
the capabilities, and the refusal marks the query as errored while it
keeps its last answer. The page took any error for a failed load and
swapped the wizard, and the name typed into it, for "the page could
not load" behind the layout's Stay here.

Only a read that never answered is an error now, the rule the org
layout already applies to its member context. The probe-window case
also asserts positively that the mounted page shows its frame.
useUserOrganizations still read the session probe for the
create-organization page, which no longer asks it; the grace banner
explained itself against a Banner component long since deleted; and
an e2e note still credited the page with a guard of its own, where
the /dashboard layout is what turns anonymous visitors away.
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.

1 participant