Skip to content

BrowserSidecarAdapter persists sessions that production standalone deliberately drops #475

Description

@nedtwigg

TauriAdapter deliberately persists nothing. The flag is explicit, and its
comment ties the decision to the workspaces-rollout scope:

// standalone/src/tauri-adapter.ts:564
private static PERSIST_SESSION = false;

readonly persistsSession = TauriAdapter.PERSIST_SESSION;

saveState(state: unknown): void {
  if (!TauriAdapter.PERSIST_SESSION) return;
  ...
}
getState(): unknown {
  if (!TauriAdapter.PERSIST_SESSION) return null;
  ...
}

BrowserSidecarAdapter — the adapter behind pnpm dev:standalone:ab — has no
such gate and routes both calls straight to localStorage:

// standalone/src/browser-sidecar-adapter.ts:259
saveState(state: unknown): void {
  try { saveSessionState(localStorage, BrowserSidecarAdapter.STATE_KEY, state); }
  catch { console.error('[browser-sidecar] Failed to save session state'); }
}

getState(): unknown {
  try { return loadSessionState(localStorage, BrowserSidecarAdapter.STATE_KEY); }
  catch { return null; }
}

It also leaves persistsSession absent, which docs/specs/transport.md defines
as reading true.

Consequence: the browser dev harness restores panes across a reload that
production standalone deliberately drops. Anyone debugging session
save/restore behavior through the harness is exercising a code path the real
app does not take, and a stale localStorage blob can carry state between runs
that would not survive in the shipped product.

The harness contract says it "must preserve the PlatformAdapter … contracts
used by the app", which argues for adding the same gate. The counter-argument
is that pane persistence across a reload is a genuine convenience while
iterating in a browser tab — in which case the divergence should be documented
in docs/specs/standalone.md rather than silently inherited.

Either resolution is fine; the current state is that neither was chosen
deliberately. Flagging for a decision.

Found during the spec audit in #; left unchanged because it is a behavior
change, not a documentation fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions