Repository navigation
Conversation
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds root-side migration records and machine-specific receipts so migrations can run again after a snapshot restore.
Review was based on source inspection; no tests were executed.
|
|
@dhh @omarchybot rerunning migrations whose records a snapshot restore rolled back, and the note on those records, is in #21027. The migration runner cases in Please consider closing this as superseded only after #21027 is accepted. Leaving the close to you. |
|
GPT-6.2 Sol High in Codex read the migration runner diff and #9828 and classified this as a bug fix because a root snapshot restore can undo a migration while its completion marker survives in the home directory. DeepSeek V4.1 Flash in Pi, using the default reasoning setting, classified it as an enhancement, so worker verification is paused until the classification is resolved. |
What changes
Fixes #9828.
omarchy-migratedecides a migration is done by one test: its marker exists under~/.local/state/omarchy/migrations/. That directory is on@home, and much of what migrations change is on@. A Snapper restore of/puts@back and leaves the markers, so the nextomarchy updateruns no migrations and says nothing. On 4.6.0-rc1 a tester restored the pre-update snapshot, updated again, and 131 migrations were skipped (comment in #9828).The runner now keeps two more empty files for each migration it completes:
/var/lib/omarchy/migration-records/<uid>/<migration>, on the root filesystem, so a restore takes it back;~/.local/state/omarchy/migrations-receipts/<machine-id>/<migration>, which says a root record was written on this machine.A migration whose receipt is there while its root record is gone was rolled back by a restore. It is pending again:
omarchy-migrate --pendinglists it, andomarchy update, the login notifier and a manualomarchy-migratepick it up with no new command. The rerun is announced as "Running migration again after a snapshot restore (…)".Only those migrations run again. #9828 found that replaying every migration is unsafe, so a marker without a receipt is trusted exactly as today. That covers every marker written before this change, the markers from
/etc/skel, and a home directory carried to another machine or a reinstall (the receipt is keyed by/etc/machine-id). Nothing that is complete today becomes pending.Privilege: the records directory belongs to the user but sits under root-owned directories, so creating it takes root once. The runner creates it only in a process that inherited the update lock, with
sudo -n, so it never asks for a password; insideomarchy updatethe authorization is already there. Any other run writes records when the directory exists and otherwise completes without them. Records and receipts are best effort and never fail a migration. A user can only misreport their own migrations, which is equally true of their markers.The manual paragraph that #15159 added as a warning now describes this, and keeps the warning for the cases below.
Limits:
agents/skills/migrations.md)./var/lib/omarchybeing on the snapshotted root subvolume, as it is on the default layout.Overlap: #16100 (multi-user) contains a wheel-writable
/var/lib/omarchy/admin-migrationsrecord that also reruns an administrator's migration after a rollback. This PR is the small standalone fix for #9828 and will conflict with it inbin/omarchy-migrate. It also conflicts textually, not in behaviour, with #14827, #17237, #18210 and #12906; it does not read or write marker content.Verification
bash test/shell.d/migrate-scope-test.sh: 13 pass (8 before). The five new cases: exactly the rolled-back migration reruns; markers without a receipt are trusted; another machine's receipts are ignored; sudo is called only when the update lock is held, assudo -n install -d -m 755 -o <uid> <dir>; the run falls back to plain markers when no record can be written. Each new case fails when the line it covers is changed (12 mutations, run by an independent reviewer).bash test/shell.d/i18n-test.shandbash test/shell.d/migrate-notify-test.shpass./var/lib/omarchy/migration-records/1000(owner 1000, mode 755, parent owned by root) and recorded the first migration. I took a Snapper snapshot of/, ran the second migration, and checked that the snapshot holds the first record and not the second. Given the snapshot's records,omarchy-migrate --pendingprinted only the second migration and the runner ran only it, with the new heading../test/all:test/clipasses.test/shellreports two failures in files this PR does not touch:agent-account-test.sh("a failed save while promoting keeps the next primary's login") fails the same way onquattroat 0d649d8, anddefault-agent-test.shfailed once in the full run and passes alone on this branch.limine-snapper-restorefollowed by a reboot andomarchy update. The VM check uses the content of a real snapshot instead. The systemd-boot restore path (omarchy-boot-sync restore-stage) was not exercised; it also replaces/from a snapshot.Screenshots
No visible change: a terminal heading in
omarchy-migrateafter a restore; no shell, menu or config change.Written by Claude (Fable 5.2) with an implementer (Gemini 4 Neon) and an independent reviewer and verifier (GPT 6.1 Sol), directed by @photuris.