Skip to content

fix(platform): close the session-lapse review round after #3763 - #3795

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

yannickmonney merged 14 commits into
mainfrom
fix/session-lapse-leftovers

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #3763, from its post-merge review (TALE-100). I re-checked each finding on main (c2c5d4a) before changing it; all eight still held. The branch is rebased on 3257d0e.

What changed

Better Auth's lapse answer is pinned (medium). authClientError reads a 401 with the code UNAUTHORIZED, or with no code at all, as a lapsed session. That rested on one browser observation of create-team's bare 401. The two answers are now pinned once, in backend/auth/team-lapse.integration.ts, and held to the library twice:

  • A new backend:integration lane, checkLapsedTeamWrites, asks the real create-team and update-team on Postgres. It goes through the Better Auth client the SPA uses and tries three sessions: no cookie, an expired one and a signed-out one. It also has a live control and checks that the refused writes wrote nothing.
  • backend:integration is not a CI job, so app/lib/auth/auth-client-error.test.ts also runs the app's own createAuth handler in the CI test lane. Its database is a closed port, so an answer that needed the database would be a 500. The test holds the no-session answers to the same pin and reads them through authClientError to the session sentence in en, de and fr. Moving the pin, or making the app stop reading a bare 401 as a lapse, fails both.
  • AUTH-B13 now creates and renames a team on the held tab, in de, fr and en. Each shows its localized title (settings.teams.teamCreateFailed / teamUpdateFailed) with common.errors.sessionEnded beneath. The AUTH-B13 automation row names the test and the lane.

No notch band (low). In an installed iPhone app, the in-shell notice padded the notch, and the shell's mobile header (or a thread page's spacer) padded it again right below. The notice now carries data-session-lapse-notice. The header and spacer are extracted as ShellMobileHeader and ShellNotchSpacer (app/components/layout/shell-mobile-header.tsx), and drop their pad while .mobile-nav-shell holds the notice.

The notice no longer floats over pages outside the shell (low). On the organization wizard, the changelog and access-denied pages, the notice floated at the top of the window. At 375 px it covered the header and the changelog's back link. It is now the shell's compact row (title and Sign in, the sentence kept for screen readers), placed in the flow above the page. The page is bounded to the rest of the window while the notice shows, so a page exactly the window tall (STANDALONE_PAGE, h-screen) still scrolls to its last control. The frame around the dashboard is always there, so pages never remount when the notice appears.

One toast per failure (low). These surfaces kept the write hook's default toast while also toasting through failureDetail: the Google Drive and Microsoft 365 imports (including the import walk's folder-listing actions), team delete (the dialog and the teams table's bulk bar), and adding and removing members. One failure raised two toasts, or one per refused call. The hooks now pass errorToast: false.

One behaviour change in the create dialog: a refused member add after the team exists now shows one destructive toast, "Team created, but not every member was added" (teams.teamCreatedMembersRefused) with the refusal (the session sentence or teams.membershipChangesFailed). Before, it said "Couldn't create team", or was hidden behind a success toast that claimed every member was added. The new *.lapsed-session.test.tsx files run the real hooks, adapter rows and backendFetch, and count every toast on the real @tale/ui/use-toast.

One rule for runtime errors (low). readableErrorMessage (@tale/ui/error-message) now returns nothing for the runtime's own error types. failureDetail builds on it after its refusal and connection checks, so the two read a failure by one rule. json-input needs no opt-in: its inline validation shows the parser's words, and its toast falls back to validation.invalidJson. .agents/repo.md says so.

The guard catches e.message (low). Error names now include e and ex, with samples. An allowlist entry is keyed by file and the matched text and counts its sites (one by default), so it exempts exactly those, not its whole file or another copy of its line.

AUTH-B13 (g) and the member docs agree (low). The box keeps the Environment tab open in a browser tab of its own. The old "still-open" tab had been navigated away and passed only inside the read's five-minute freshness. The member preferences page (en, de, fr) now says that a reopened Environment tab shows its variables for five minutes after it last loaded. A pin records why.

The connection sentence has a box (low). NAV-B5 gains a save variant: save on the Environment tab with the browser offline, in de and fr and in Firefox and Safari. It expects common.errors.connectionLost under the save's title, never the browser's own wording. The adapters.test.ts coverage moved from the AUTH-B13 row to NAV-B5's.

Review round 1

  • Create dialog proof (medium): the partial refusal without a lapse (409 NOT_A_MEMBER) and the success toast are now tested on the real toast, one toast each, dialog closed; a SET-F18 automation row records it.
  • Its title (low): fr teamCreated says "créée avec succès", so the destructive toast has its own key, teams.teamCreatedMembersRefused, in en/de/fr (no de-CH override needed).
  • Bulk delete reason (low): BulkDeleteBar takes an optional describeFailure(reasons); the teams table passes the first refusal through failureDetail, so a lapsed bulk delete says common.errors.sessionEnded.
  • No page jump (low): while the confirmation is open the notice stays, invisible and aria-hidden, instead of unmounting; the page no longer moves 49 px behind the dialog and on Stay here (browser tests fail on the previous code).
  • Guard (low): allowlist entries carry a count.
  • Lane helpers (low): cookieHeaderFrom and signUpUser moved to backend/integration-lane-helpers.ts, shared by integration-check.ts and the team-lapse lane (not re-run on Postgres this round: typecheck only).
  • Manual (low): AUTH-B14 gains a device step (notch band, no jump, 375 px changelog and wizard); the AUTH-B13 row says the expired and signed-out cases are proven only when backend:integration is run by hand.

How I verified it

Every new test was run against main's code, and failed there:

  • Team dialogs: 25 tests, each counting toasts.
  • Imports: 6 tests, plus the 6 folder-walk tests against main's dialogs.
  • Browser tests: 11 tests (the notch cases and all nine page-outside-the-shell cases).
  • The CI pin and the lane: both fail when the pin moves.
  • Without the height bound, the three wizard cases fail: the last control ends 49 px below the window.

Integration lane: ITEST_LANES=checkLapsedTeamWrites on a scratch Postgres 16 passes 9/9 of its checks, on the rebased branch too. The only other failure in that run is the BM25 boot check, which needs pg_search and isn't available here.

Real browser: Chromium 141 in vitest browser mode, 34 tests, measured at 375×740, 900×400 and 1280×800 with a 47 px notch.

The real app: local backend and Vite, 375×740, signed out through the same cookie jar, then Stay here.

main this branch
in the shell, 47 px notch header pads 47 px more under the notice (a blank band) header padding 0, directly under the notice
changelog, no notch fixed notice at 12–168 px covers Back (40–60), not pressable in-flow row at 0–49, Back at 89–109, pressable

visual-aspect-analyzer was embedded and signed in, with the lapse set up in its interact hook, against main as baseline:

  • The in-shell lapsed flow scores 65 on both, and the signed-in shell page 74 on both, with the same defects.
  • At 1440 px, reruns score 99 on both. The one defect is the same 0.01 page-load shift; a first-visit flicker and jank came and went between runs.
  • The lapsed changelog scores 96 against 99. The one extra defect is the page slot moving 49 px as the notice moves from inside the shell to above the page, in the same frame the page itself changes. A frame-by-frame probe shows no frame of the new page without its notice. In use that navigation follows a click, which layout-shift scoring excludes.

Checks run locally, all passing:

  • Type-aware oxlint and scoped tsc over every changed file (integration-check.ts in a run of its own); oxfmt --check.
  • vitest for the changed files and their neighbours: 145 UI files (1,368 tests) and 5 server files; after the rebase, the core sets again.
  • lint:manual, check-guide on auth.md and navigation.md, and the docs suite (35 files).

The whole platform suite, workspace-wide tsc and knip are left to CI (the sandbox's 4 GB limit).

Left open

  • Other double toasts. A read-only sweep found about 150 more sites where a write hook's default toast fires beside the caller's own. They span conversations, tasks, projects, governance editors (the useUpsertGovernancePolicy comment says editors pass errorToast: false, but most do not), legal hold, data residency, enterprise SSO and more. TOAST_LIMIT 1 shows only the last toast, but both fire. That is its own sweep.
  • The file pickers' row checkboxes carry no accessible name (onedrive-file-table.tsx), noticed while testing the imports.
  • The other shell banners (2FA grace, low backup codes, embedding setup) still sit under the notch when no session notice is above them. This predates fix(platform): word lapsed-session failures and guard the rule #3763.
  • /dashboard/create-organization may leave for /log-in by itself after a lapse. Its effect navigates there once useAuth() reports signed out, and the recovery's recheck refreshes that probe. If so, the wizard's drafts skip the Stay-here confirmation. That is from reading create-organization.tsx; I did not reproduce it.

Overlaps only the shared registers with open PRs: integration-check.ts (one import and one lane entry), reference/automation.md (three rows) and pins.md (#3794, #3787, #3786, #3785, #3784, #3782, #3781, #3780, #3779, #3778, #3776, #3775, #3772).

yannickmonney and others added 14 commits September 29, 2026 00:10
readableErrorMessage passed a TypeError's or SyntaxError's developer text through, while the platform's failureDetail hid it. The floor now returns nothing for the runtime's own error types, and failureDetail builds on it after its refusal and connection checks, so the two read a failure by one rule. The repo contract says so.
The guard's error name missed the short catch names, so 'description: e.message' passed. It now matches e and ex, and an allowlist entry names its file and the matched text, so it exempts one site rather than its whole file.
The Google Drive and Microsoft 365 imports, team delete (dialog and bulk bar) and the team membership writes kept the write hook's default toast while their surfaces also toasted, so one failure raised two toasts, or one per refused call. The hooks pass errorToast: false. The create dialog now reports a refused member add in its one toast (the team exists, so it no longer says it could not be created, nor hides the refusal behind a success toast). Tests run the real hooks and count every toast.
authClientError reads a 401 with the code UNAUTHORIZED, or with no code, as a lapsed session. That rested on one browser observation of create-team's bare 401. A Better Auth upgrade that changed either answer would have put the library's English under the team dialogs' localized titles, and nothing would have failed.

The answers are now pinned once, in backend/auth/team-lapse.integration.ts. The new backend:integration lane checkLapsedTeamWrites asks the real create-team and update-team, through the Better Auth client the SPA uses, with no session cookie, an expired session and a signed-out one, and asserts that nothing was written. Because backend:integration is not a CI job, auth-client-error.test.ts also runs the app's own createAuth handler, with no reachable database, in the CI test lane, holds its no-session answers to the same pin, and reads them through authClientError into the session sentence in en, de and fr.
In an installed iPhone app the in-shell notice padded the notch, and the shell's mobile header, or a thread page's spacer, padded it again right below it, leaving a blank band while the notice showed. The notice now carries data-session-lapse-notice; the header and the spacer (now ShellMobileHeader and ShellNotchSpacer) drop their pad while the shell holds it.

On a dashboard page outside the shell (the organization wizard, the changelog, access denied) the notice floated over the top of the page. Below about 536 px it covered the header or the changelog's back link. It is now the same compact row as in the shell, placed in the flow above the page, and the page is bounded to the rest of the window, so a page exactly the window tall still scrolls to its last control. The frame is always there, so the page never remounts.

The browser test measures both in Chromium: a 47 px notch cleared once, and the three real page frames at 375, 900x400 and 1280 px.
AUTH-B13 now creates and renames a team on the held tab, in de, fr and en, each under its localized title with the session sentence beneath. Its Environment step runs on a tab that really stayed open, in a browser tab of its own: the old box said 'still-open' while its other steps navigated that tab away, and it passed only because of the read's five-minute freshness. The member preferences page (en, de, fr) now says when a reopened Environment tab still shows its variables.

NAV-B5 gains a save variant: a save made offline shows the localized connection sentence in de and fr, per engine, never the browser's own words. The adapters coverage moved from the AUTH-B13 automation row to NAV-B5's. AUTH-B13 and AUTH-B14 name the new tests and the lane, and a pin records why the Environment step has its own tab.
Importing a folder from Google Drive or Microsoft 365 lists it first, through an action that kept its default toast. A refused listing therefore toasted, and the import's own failure toast followed. The walk's listing actions now pass errorToast: false. The dialog already reports every walk failure in its one toast. The lapsed-session test now imports a folder too.
The create dialog's destructive toast for refused member adds reused
`settings.teams.teamCreated`, which French words as "créée avec succès",
so a red toast said the team was created successfully above the reason.
It now reads `settings.teams.teamCreatedMembersRefused` in en, de and fr.

The partial refusal without a lapse (a 409 `NOT_A_MEMBER`) and the
success toast had no test: both are pinned now with the real toast, one
toast each, the dialog closed, and recorded in a SET-F18 automation row.
`BulkDeleteBar` raised one failure toast for a batch with only its
title. A caller whose write hook keeps its own toast silent, so a
failure raises one toast, had no way to show the refusal's words.
`describeFailure` receives the refused deletes' reasons and returns the
toast's description; without it the toast is unchanged.
`useDeleteTeam` keeps its own toast silent, so a bulk delete from the
teams table showed only "Couldn't delete some items", never why. The
table now passes the first refusal through `failureDetail` to the bar,
so a lapsed session reads `common.errors.sessionEnded` in that toast.
The standing notice unmounted while the confirmation was open, so its
Sign in grew the page behind the dialog by the notice's height and Stay
here shrank it again, outside the shell and in it, and the focus had no
Sign in to return to. The notice now stays, invisible and aria-hidden,
while the confirmation is open; the notch stays cleared once.
An entry was keyed by file and matched text, so it also exempted every
identical copy of its line in that file. An entry now carries a count
(one by default): a file with more copies lists them all, and one with
fewer marks the entry stale.
The team-lapse lane carried a byte-for-byte copy of integration-check's
`cookieHeaderFrom` and its own copy of `signUpUser`. Both move, with the
throwaway users' password, to `backend/integration-lane-helpers.ts`,
which the check and the lane import.
AUTH-B14 gains a device step: no notch band above the shell header in
an installed iPhone app, no page jump under the reopened confirmation,
and at 375 px the notice in the flow above the changelog (Back can be
pressed) and the organization wizard (scrolls to its last control).

The AUTH-B13 automation row now says no workflow runs
`backend:integration`, so the expired and signed-out team-write answers
are proven only when `checkLapsedTeamWrites` is run by hand.
@yannickmonney
yannickmonney merged commit 80ca77d into main Sep 29, 2026
57 of 58 checks passed
@yannickmonney
yannickmonney deleted the fix/session-lapse-leftovers branch September 29, 2026 03:12
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