Skip to content

feat(fe): keep an app's session across a page load - #4272

Open
sea-snake wants to merge 4 commits into
fe/browser-key-storefrom
fe/app-session-store
Open

feat(fe): keep an app's session across a page load#4272
sea-snake wants to merge 4 commits into
fe/browser-key-storefrom
fe/app-session-store

Conversation

@sea-snake

@sea-snake sea-snake commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Design: #4224. Overview: #4230. Consumed by #4273, which stores a record, and #4248, which reads and discards one.

A session outlives the tab that created it. Without storing the chain, a sibling subdomain asking for the first time — or a user returning to a closed tab — would mean another ceremony, which is the cadence this design exists to remove.

Records keyed by identity, account and origin, in IndexedDB alongside the identity's own session.

A record within five minutes of its expiry is not treated as usable, so a chain is never handed over that dies mid-request. Five minutes is half the shortest session a caller can ask for, so a session near that floor is never answered from storage.

The purge that already runs when an identity is discarded now takes these records with it, at the eight places that discard one. Leaving them would keep a chain for an identity the browser has forgotten.

Three of the four exports have no caller here: storeAppSession gains one in #4273, appSessionsForOrigin and discardAppSession in #4248. purgeAppSessions is called by this PR.

Tests: app-session.store.test.ts (7): storage keyed by identity, account and origin; a record for another origin not served; an expiring record not served; and the purge removing them.

@zeropath-ai

zeropath-ai Bot commented Aug 22, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 9b420ec.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► src/frontend/src/lib/stores/app-session.store.ts
    Add in-app session store and management (storeAppSession, discardAppSession, appSessionsForOrigin, purgeAppSessions)
Enhancement ► src/frontend/src/routes/(new-styling)/+page.svelte
    Invoke purgeAppSessions on identity removal
Enhancement ► src/frontend/src/routes/(new-styling)/authorize/views/ContinueView.svelte
    Invoke purgeAppSessions on certain error paths
Enhancement ► src/frontend/src/routes/(new-styling)/cli/+layout.svelte
    Invoke purgeAppSessions on identity removal
Enhancement ► src/frontend/src/routes/(new-styling)/manage/(authenticated)/+layout.svelte
    Invoke purgeAppSessions on identity removal
Enhancement ► src/frontend/src/routes/(new-styling)/recovery/+page.svelte
    Invoke purgeAppSessions on identity removal

@sea-snake
sea-snake force-pushed the fe/app-session-store branch from 0fb539a to 49d4a11 Compare August 22, 2026 18:45
@sea-snake
sea-snake force-pushed the fe/app-session-store branch from 49d4a11 to 4b40492 Compare August 22, 2026 19:07
@sea-snake
sea-snake force-pushed the fe/app-session-store branch from 4b40492 to 1aad6be Compare August 22, 2026 19:25
A session outlives the tab that created it, so the frontend has to store the
chain it holds — otherwise a sibling subdomain asking for the first time, or a
user returning to a closed tab, would mean another ceremony.

Keyed by identity, account and origin, in IndexedDB alongside the identity's own
session. A record within five minutes of its expiry is not treated as usable, so
a chain is never handed over that dies mid-request.

The purge that already runs when an identity is discarded now takes these
records with it, at the eight places that discard one. Leaving them would keep
a chain for an identity the browser has forgotten.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sea-snake
sea-snake force-pushed the fe/app-session-store branch from 1aad6be to 76c8818 Compare August 22, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature:revocable-app-sessions Design: revocable app sessions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant