Expand description
A new version starts with the data of the version before it
(docs/specs/SPEC_UPGRADE_FOR_USERS_AND_AGENTS_2026_10_15.md §6).
Installed and portable builds keep their databases per version
(channels/<ch>/versions/<v>/data/db/), so without this an upgrade
starts with an empty objects.db: no windows, no layouts, and no pane’s
agent:sessionid to resume. On the first start of a version, before its
pre-migration snapshot and migrations, each database is copied from the
newest older version in the same channel; migrations then bring it up to
date as they would after an in-place upgrade.
Each copy is VACUUM INTO a temporary file, renamed into place: a
consistent snapshot even if the older version is still running (two
portable folders side by side), and never a half-written file. Any failure
leaves the new version to start fresh, as it did before. Dev builds keep
their data per branch, and local task package builds get a channel of
their own, so neither has an older version to copy from.
This is the only thing that seeds a version’s databases. A channel whose
install predates per-version data still has its old channels/<ch>/data/db/;
it is copied only while no version has data yet. The launcher used to copy
that folder into every new version before srv started, so srv found an
objects.db in place and carried nothing forward: each upgrade started from
that old data, without the layout the previous version’s quit had saved
(docs/incident/RCA_UPGRADE_LOSES_LAYOUT_2026_10_22.md). Each copy
records where it came from (CARRIED_FROM_FILE), and the first start
after an upgrade checks it (continuity_problem).
Functions§
- from_
previous_ version - On the first start of
version(noobjects.dbindb_diryet), copy the databases of the newest older version in the same channel (or the channel’s pre-versioning ones,source_for), and record where they came from (CARRIED_FROM_FILE). Returns the version directory copied from, orNonewhen there was nothing to do or the copy failed (logged; the version then starts fresh). - stop_
message - The message a start that cannot carry the previous version’s data forward stops with: the cause in plain words, that the
previous version’s data was not touched, and that this version did not start empty.
erroris whattry_from_previous_versionreturned; it goes last, for the log. - try_
from_ previous_ version from_previous_version, telling “nothing to copy” (Ok(None)) apart from “there was data to copy and copying it failed” (Err), whichmigrate --preparemust not treat as a fresh start: that would relaunch the new version without the user’s data (migrations/prepare.rs). Copies that failed are removed again, so a retry starts clean.