Skip to content

A browser session is declared, never created by hand - #267

Merged
czpython merged 1 commit into
mainfrom
worktree-eng-855-lazy-session-rows
Aug 17, 2026
Merged

A browser session is declared, never created by hand#267
czpython merged 1 commit into
mainfrom
worktree-eng-855-lazy-session-rows

Conversation

@czpython

Copy link
Copy Markdown
Owner

A browser session exists because an extension declares it on its Extension
class. The stored row is a cache of what happened to that session — its
login state, its timestamps, its payload — not the session's identity. So
nothing creates a session by hand any more, and nothing materializes rows
ahead of time either.

Rows appear on the first action that needs one: a workflow borrowing the
login, an operator opening the login window, or a state import. Views only
read. Opening the sessions pane writes nothing to the database.

The pane now renders the declarations, joined with whatever rows exist. A
session that has been declared but never used shows up wanting a login,
which is how the operator learns an extension needs one — previously it was
invisible until something borrowed it, so the first login had nowhere to
start. A row whose declaring extension is gone still lists, marked as no
longer declared, with delete as its only action.

The wire is addressed by name, since the declared name (x_me.x) is the
identity; id leaves the response. Manual creation and rename are gone from
both the API and the UI — a renamed row would just orphan itself from its
declaration. State uploads now carry their payload format as a query param
and stamp it on the row, the way the borrow write-back already stamps it;
without that, a lazily created row would default to a profile directory
while the importer uploads storage-state JSON.

scripts/import_browser_session.py no longer creates anything. It refuses a
name no installed extension declares, and imports through the same lazy
door.

@czpython
czpython force-pushed the worktree-eng-855-lazy-session-rows branch from 108348c to dda6171 Compare August 17, 2026 08:26
A session exists because an extension declares it; the stored row is a
cache of what happened to it — login state, payload, timestamps — created
by the first action that needs one: a workflow borrow, a login-window open,
or a state import. The pane renders declarations joined with rows and
writes nothing; a declared-but-unused session lists wanting its first
login, and a row whose extension is gone lists as a leftover with delete as
its only action.

The wire is name-addressed — the declared name is the identity — and the
list is its only read: every mutation answers 204, the per-session GET is
gone, and the login window keys its Redis record by session name so the
window routes never visit the database. Manual creation and rename leave
the API and the UI. State uploads carry their payload format and stamp it
on the row, as the borrow write-back already does. The manual login loop
imports through the same lazy door, and row creation copies the
ON CONFLICT DO NOTHING idiom so racing first actions converge.
@czpython
czpython force-pushed the worktree-eng-855-lazy-session-rows branch from 5335f85 to b0a6cb1 Compare August 17, 2026 08:44
@czpython
czpython merged commit 8d658e6 into main Aug 17, 2026
2 checks passed
@czpython
czpython deleted the worktree-eng-855-lazy-session-rows branch August 17, 2026 08:47
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