Skip to main content

Module session_other_builds

Module session_other_builds 

Source
Expand description

Restore a layout another build saved.

Every channel and every version keeps its own objects.db (channels/<ch>/versions/<v>/data/db/), and with it its own session record (session_restore, Client.meta["session:last_topology"]). So a build that has never run here, or a different local build, comes up with the default layout while the record the previous build saved sits unused in that buildโ€™s database. This finds those records, reading each database read-only, and rebuilds one in this instance with the replay a same-build restore uses (session_restore::replay_tabs). The other database is never written.

A first launch, or a cold start that seeds the default layout because nothing was restored, remembers it (remember_seeded_default); while that layout is untouched the window offers the newest record, and restoring replaces it.

Structsยง

DbFile ๐Ÿ”’
ScanRoots ๐Ÿ”’
Where to look: the channels root, and this processโ€™s own data/db/ (never offered).

Constantsยง

BUSY_TIMEOUT ๐Ÿ”’
A database another process holds locked is skipped after this long rather than waited for.
DEFAULT_VIEWS ๐Ÿ”’
The views of the default seed (window_create): a record holding only these, with no agent chosen, is not worth offering.
MAX_SCANNED ๐Ÿ”’
Databases opened per scan, the most recently written first: each is one open and one row read, and only recent builds matter.
SCAN_BUDGET ๐Ÿ”’
A scan stops opening databases after this long.
SEEDED_META_KEY ๐Ÿ”’
The default layout a cold start seeded: {workspace_id, tab_id, block_ids}.

Functionsยง

apply_publish ๐Ÿ”’
db_files ๐Ÿ”’
Every channels/<ch>/versions/<v>/data/db/objects.db but this processโ€™s own. Dev builds keep theirs under dev/, outside the channels root.
discover ๐Ÿ”’
The layouts other builds saved, newest first. Reads at most MAX_SCANNED databases, the most recently written first, for at most budget; one that is missing, locked, corrupt or of an unknown shape is skipped. Blocking: run it off the async workers.
immutable_uri ๐Ÿ”’
path as an SQLite URI with immutable=1.
is_plain_segment ๐Ÿ”’
A single, plain path segment: what a channel or version directory is named.
locate ๐Ÿ”’
The database of build channel/version, never this processโ€™s own.
meta_str ๐Ÿ”’
modified_ms ๐Ÿ”’
newest_other_version_db ๐Ÿ”’
The most recently written database of another version of this processโ€™s own channel: the version a new one follows (user_workspaceโ€™s upgrade copy, SPEC_WORKSPACES_2026_10_23.md ยง4.2). None outside a channel.
open_other_db ๐Ÿ”’
Another buildโ€™s database at path, read-only. A database with nothing in its -wal is opened immutable, so not even the readerโ€™s -wal/-shm files are created; one with WAL content is opened as an ordinary reader, which reads that content and may add the -shm index.
own_channel ๐Ÿ”’
The channel this processโ€™s own database belongs to: the <ch> of <channels root>/<ch>/versions/<v>/data/db. None for a database elsewhere (a dev buildโ€™s, under dev/).
read_record ๐Ÿ”’
The session record in the database at path, read-only (open_other_db).
remember_first_launch_default ๐Ÿ”’
A first launch: the store was empty and wcore::ensure_initial_data seeded the default layout, which a new build or a new local build starts with.
remember_seeded_default ๐Ÿ”’
A cold start seeded the default layout because nothing was restored.
restore ๐Ÿ”’
Rebuild the layout build channel/version saved into window window_id: its first windowโ€™s tabs into this window, replacing the default tab when it is untouched and otherwise beside what is open; its other windows each into a workspace of its own, queued for this window to open (window.TakeRestoredWindows).
same_dir ๐Ÿ”’
srv_running ๐Ÿ”’
Whether an srv is running on the database db (<data>/db/objects.db): the srv.lock beside db/ names a pid that is still an srv that wrote it. Restoring that buildโ€™s layout here would run its agents twice.
summarize ๐Ÿ”’
Describe a record, or None when it holds nothing worth restoring: no tabs, or only the untouched default layout. written_ms stands in for the save time a record made before records carried one.
untouched_default_tab ๐Ÿ”’
The seeded default tab of workspace ws_id, if the workspace still holds only it, with the same panes and no agent chosen in its agent pane.
wal_len ๐Ÿ”’
wal_of ๐Ÿ”’