Add snapshot restore action to BOS Settings #24

Merged
Breadway merged 2 commits from feature/bset-22-snapshot-restore into main 2026-10-02 17:40:34 +08:00
Owner

Adds a confirmed Restore selected snapshot and reboot action to Settings > Snapshots. The backend validates the snapshot number, invokes pkexec bos-restore-snapshot <number>, and passes the helper confirmation through stdin. The confirmation explains that the current @ root is preserved as a backup and that the system reboots after restore. Existing snapshot listing, GRUB boot, and delete actions remain available.

Verified: npm run check, npm run build, node --experimental-strip-types frontend/src/lib/snapshotRestore.test.mjs (3 passing headless cases), cargo test --locked (77 passed), cargo build --locked, cargo clippy --all-targets --locked -- -D warnings, and cargo fmt -- --check. The Rust invocation test uses temporary stub commands and does not call a real restore helper or reboot.

Closes #23

Adds a confirmed Restore selected snapshot and reboot action to Settings > Snapshots. The backend validates the snapshot number, invokes `pkexec bos-restore-snapshot <number>`, and passes the helper confirmation through stdin. The confirmation explains that the current `@` root is preserved as a backup and that the system reboots after restore. Existing snapshot listing, GRUB boot, and delete actions remain available. Verified: `npm run check`, `npm run build`, `node --experimental-strip-types frontend/src/lib/snapshotRestore.test.mjs` (3 passing headless cases), `cargo test --locked` (77 passed), `cargo build --locked`, `cargo clippy --all-targets --locked -- -D warnings`, and `cargo fmt -- --check`. The Rust invocation test uses temporary stub commands and does not call a real restore helper or reboot. Closes #23
feat: add snapshot restore action
All checks were successful
check / check (push) Successful in 5m52s
5e45c88cec
Author
Owner

Synced to its parent BSET-22: implementation is in PR #24 at 5e45c88; local frontend, headless confirmation, Cargo, formatting, build and Clippy checks pass. Forgejo run 97 is waiting to run, so this PR card is in DOING pending the required check.

Synced to its parent BSET-22: implementation is in PR #24 at `5e45c88`; local frontend, headless confirmation, Cargo, formatting, build and Clippy checks pass. Forgejo run 97 is waiting to run, so this PR card is in DOING pending the required check.
Author
Owner

Implementation is linked to PR #24. Frontend checks/build, headless confirmation tests, and Rust tests/build/Clippy/format passed. Forgejo CI was pending at last check. Moving to REVIEW for independent review; if CI fails, return it to TODO with the failure recorded.

Implementation is linked to PR #24. Frontend checks/build, headless confirmation tests, and Rust tests/build/Clippy/format passed. Forgejo CI was pending at last check. Moving to REVIEW for independent review; if CI fails, return it to TODO with the failure recorded.
Author
Owner

Not merged yet: this now conflicts with #38 in src/src/commands/snapshots.rs. Both PRs replace/rewrite the #[cfg(test)] mod tests block, so only the tests collide; the production code merges cleanly (restore_snapshot next to the new JSON get_snapshots). Rebase onto main and keep both test sets (the snapper-JSON parser tests from #38 plus this PR's restore tests). #38's row shape (number, date, description) is unchanged, so no UI rework is needed. Once rebased it is good to merge.

Not merged yet: this now conflicts with #38 in `src/src/commands/snapshots.rs`. Both PRs replace/rewrite the `#[cfg(test)] mod tests` block, so only the tests collide; the production code merges cleanly (`restore_snapshot` next to the new JSON `get_snapshots`). Rebase onto main and keep both test sets (the snapper-JSON parser tests from #38 plus this PR's restore tests). #38's row shape (`number`, `date`, `description`) is unchanged, so no UI rework is needed. Once rebased it is good to merge.
Merge remote-tracking branch 'origin/main' into feature/bset-22-snapshot-restore
All checks were successful
check / check (push) Successful in 5m6s
84d5f1c955
Author
Owner

Reconciled onto current main (11 commits, including the snapper JSON list rework in #38 and the retention copy in #22). The only conflict was the test module in src/src/commands/snapshots.rs: main's parse_snapper_json tests and this PR's restore tests are now one module, with the rest of the PR auto-merging cleanly.

Verified at the merge commit (84d5f1c), from a scratch worktree:

  • npm run check: 0 errors, 0 warnings; npm run build: wrote site to build.
  • node --experimental-strip-types frontend/src/lib/snapshotRestore.test.mjs: 3/3 pass.
  • cargo test --locked: 110 passed, 0 failed, including all seven snapshots::tests cases (main's five plus the two restore tests).
  • cargo clippy --all-targets --locked -- -D warnings: clean.
  • cargo fmt -- --check: clean.

Reviewed against the helper merged in BOS (iso/airootfs/usr/local/bin/bos-restore-snapshot): the exact RESTORE <n> stdin line, argument validation without leading zeros, the pkexec invocation (already the established pattern in this repo), and the preserve-then-reboot semantics all match, and the confirmation copy in snapshotRestore.ts names both the preserved @ root and the automatic reboot.

Reconciled onto current main (11 commits, including the snapper JSON list rework in #38 and the retention copy in #22). The only conflict was the test module in `src/src/commands/snapshots.rs`: main's `parse_snapper_json` tests and this PR's restore tests are now one module, with the rest of the PR auto-merging cleanly. Verified at the merge commit (84d5f1c), from a scratch worktree: - `npm run check`: 0 errors, 0 warnings; `npm run build`: wrote site to `build`. - `node --experimental-strip-types frontend/src/lib/snapshotRestore.test.mjs`: 3/3 pass. - `cargo test --locked`: 110 passed, 0 failed, including all seven `snapshots::tests` cases (main's five plus the two restore tests). - `cargo clippy --all-targets --locked -- -D warnings`: clean. - `cargo fmt -- --check`: clean. Reviewed against the helper merged in BOS (`iso/airootfs/usr/local/bin/bos-restore-snapshot`): the exact `RESTORE <n>` stdin line, argument validation without leading zeros, the `pkexec` invocation (already the established pattern in this repo), and the preserve-then-reboot semantics all match, and the confirmation copy in `snapshotRestore.ts` names both the preserved @ root and the automatic reboot.
Breadway deleted branch feature/bset-22-snapshot-restore 2026-10-02 17:40:39 +08:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Breadway/bos-settings!24
No description provided.