Fix empty Snapshots list: read snapper's JSON output #38

Merged
Breadway merged 1 commit from fix/snapshots-list-parse into main 2026-10-02 12:22:16 +08:00
Owner

get_snapshots split snapper's table on ASCII |, but snapper 0.13 draws it with U+2502, so every row was dropped and Snapshots always said "No snapshots yet" (hermes has 5).

Now it runs snapper --jsonout list and parses the machine output (keyed by config, root preferred, first config as fallback). Snapshot 0 ("current") is still dropped. SnapshotRow keeps number, date, description and gains kind, pre_number, cleanup (additive, unused by the current UI).

Interaction with BSET-22/BSET-23 (PR #24, snapshot restore): that PR only adds a restore_snapshot command next to this one and a Snapshots.svelte action; it does not touch the parser, and the row shape it consumes (number, date, description) is unchanged, so the two are independent and merge in either order. Once this lands the restore action finally has rows to act on.

Tests: 5 new unit tests including verbatim snapper --jsonout list output and a box-drawn table that must now be rejected instead of silently yielding an empty list.

Verification: npm run check (0 errors), npm run build, cargo fmt --all -- --check, cargo clippy --all-targets --locked -- -D warnings, cargo test --locked (80 passed).

Closes BSET-25

`get_snapshots` split snapper's table on ASCII `|`, but snapper 0.13 draws it with U+2502, so every row was dropped and Snapshots always said "No snapshots yet" (hermes has 5). Now it runs `snapper --jsonout list` and parses the machine output (keyed by config, `root` preferred, first config as fallback). Snapshot 0 ("current") is still dropped. `SnapshotRow` keeps `number`, `date`, `description` and gains `kind`, `pre_number`, `cleanup` (additive, unused by the current UI). Interaction with BSET-22/BSET-23 (PR #24, snapshot restore): that PR only adds a `restore_snapshot` command next to this one and a Snapshots.svelte action; it does not touch the parser, and the row shape it consumes (`number`, `date`, `description`) is unchanged, so the two are independent and merge in either order. Once this lands the restore action finally has rows to act on. Tests: 5 new unit tests including verbatim `snapper --jsonout list` output and a box-drawn table that must now be rejected instead of silently yielding an empty list. Verification: `npm run check` (0 errors), `npm run build`, `cargo fmt --all -- --check`, `cargo clippy --all-targets --locked -- -D warnings`, `cargo test --locked` (80 passed). Closes BSET-25
fix(snapshots): read snapper's JSON output instead of the box-drawn table
All checks were successful
check / check (push) Successful in 3m16s
8f3dcae392
snapper 0.13 draws its list table with U+2502, but get_snapshots split rows on
ASCII '|', so every row was dropped and the page always said 'No snapshots
yet'. Use 'snapper --jsonout list' (keyed by config, root preferred), drop
snapshot 0, and expose type, pre-number and cleanup for later UI use.
Tests use verbatim snapper output.
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!38
No description provided.