Client SQLite cache and state #41
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage#41
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Move the client's manifest and cache state into SQLite.
Done when
Client state survives a reboot with no network.
Depends on
#20
Plan
plan/client/offline-first.md, ADR 0003
Routing/Hold: no agent is routed to this issue automatically. To take it yourself, assign yourself. Vivy removes the hold when it is handed to an agent.Created for GRI-1818 from
plan/overview/roadmap.mdand the MVP plan on GRI-1761.Taken over by Vivy from Voidgazer (board reassignment, 2026-11-13).
Finding. Voidgazer's uncommitted draft (
crates/client/src/store.rs) was written on adevfrom 2026-10-20. Since then GRI-1854 landed a client state store as a JSON file (state.json) plus the hash-named media cache, so the draft no longer fits. Not used; it is still in the shared project workspace, uncommitted.What I did — branch
feature/GRI-1899-client-sqlite-state, commit99a2f32:client::state::Storekeeps its API (open/get/update, nowasync) and is backed byclient.db: SQLite throughsqlx(ADR 0003), WAL,synchronous = FULL, one transaction per change, mode0600(it holds the token).identity,playlist,manifest_entry. Schema incrates/client/migrations/0001_device_state.sql, run withsqlx::migrate!.state.jsonis imported once into the empty database, then renamedstate.json.imported. A corruptstate.jsonstops the start and is left alone (it holds the identity).plan/client/offline-first.md.sqlxnow holds only shared features; the server addspostgres, the client addssqlite. The client no longer links the Postgres driver."Done when: state survives a reboot with no network" is covered by
state::tests::every_field_survives_a_restartand the existingtests/sync_survives_restart.rs.Merged: PR #164,
99a2f32(mergec4e72cd) is indev. Required CI green (clippy, deny, fmt, test, frontend-web, repository boundary).One finding, not fixed here: RUSTSEC-2026-0459 / CVE-2026-119375 in the bundled SQLite.
cargo deny advisories(not a required check, and already red ondevfor glib, paste and proc-macro-error) flagslibsqlite3-sys 0.30.1. Before this change it was only in the lock file. Now it is linked into the client.-walfile whose page size differs.libsqlite3-sys >= 0.39. Nosqlxrelease accepts that today: 0.8.x pins^0.30.1, and 0.9.0 has>=0.30.1, <0.38.0.client.dband-wal. Both are mode0600in its data directory. To use the bug, an attacker must already be able to write as the client user, and that user can already read the token. So the risk is low.sqlite-unbundledfeature, which links the systemlibsqlite3and takes the distro's security updates; (b) wait for ansqlxrelease that accepts 0.39. Recommendation: (b), and bump when it ships. (a) adds a runtime system dependency on every display, and Ubuntu 24.04's 3.45 is affected too until the distro backports the fix.