GRI-1899: client state in SQLite through sqlx #164

Merged
vivy merged 1 commit from feature/GRI-1899-client-sqlite-state into dev 2026-11-13 15:51:18 +00:00
Owner

Closes #41 (board GRI-1899).

The client's state — identity, pinned key, last playlist, last media manifest — moves from state.json to client.db: SQLite through sqlx, per ADR 0003.

  • Store keeps its API; open and update are now async. Session::on_text follows.
  • WAL, synchronous = FULL, one transaction per change, file mode 0600.
  • Schema: crates/client/migrations/0001_device_state.sql, run with sqlx::migrate!.
  • Upgrade path: an existing state.json is imported once into an empty database, then renamed state.json.imported. A corrupt one stops the start and is left alone.
  • Media files stay hash-named files; the directory is still the cache index.
  • Workspace sqlx carries only the shared features; the server adds postgres, the client adds sqlite.
  • Not in scope: schedule and queued reports (nothing produces them yet). Recorded in plan/client/offline-first.md.

Local gates (--rust-only, front end untouched): all pass. The GTK binary was also checked with cargo clippy --features gtk-renderer.

Closes #41 (board GRI-1899). The client's state — identity, pinned key, last playlist, last media manifest — moves from `state.json` to `client.db`: SQLite through `sqlx`, per ADR 0003. - `Store` keeps its API; `open` and `update` are now `async`. `Session::on_text` follows. - WAL, `synchronous = FULL`, one transaction per change, file mode `0600`. - Schema: `crates/client/migrations/0001_device_state.sql`, run with `sqlx::migrate!`. - Upgrade path: an existing `state.json` is imported once into an empty database, then renamed `state.json.imported`. A corrupt one stops the start and is left alone. - Media files stay hash-named files; the directory is still the cache index. - Workspace `sqlx` carries only the shared features; the server adds `postgres`, the client adds `sqlite`. - Not in scope: schedule and queued reports (nothing produces them yet). Recorded in `plan/client/offline-first.md`. Local gates (`--rust-only`, front end untouched): all pass. The GTK binary was also checked with `cargo clippy --features gtk-renderer`.
GRI-1899: client state in SQLite through sqlx, state.json imported once
Some checks failed
CI / the pre-push hook (pull_request) Successful in 43s
CI / cargo fmt (pull_request) Successful in 48s
CI / cargo deny advisories (pull_request) Failing after 1m48s
CI / cargo deny (pull_request) Successful in 2m10s
CI / cargo clippy (pull_request) Successful in 3m22s
CI / repository boundary (pull_request) Successful in 1m1s
CI / frontend-web (pull_request) Successful in 1m58s
CI / cargo test (pull_request) Successful in 6m55s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 5s
99a2f328dc
The client kept identity, last playlist and last manifest in state.json.
ADR 0003 puts it in SQLite through sqlx: client.db, WAL, synchronous=FULL,
one transaction per change, mode 0600. An existing state.json is imported
into an empty database on first start and renamed to state.json.imported;
a corrupt one stops the start and is left alone.

The workspace sqlx entry now carries only shared features; the server adds
postgres, the client adds sqlite, so neither links the other's driver.
vivy merged commit c4e72cdabc into dev 2026-11-13 15:51:18 +00:00
vivy deleted branch feature/GRI-1899-client-sqlite-state 2026-11-13 15:51:18 +00: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
Grimoirix/grimoire-of-digital-signage!164
No description provided.