GRI-2150: create the client data directory before first write #287

Merged
vivy merged 2 commits from fix/GRI-2150-client-data-dir into dev 2026-11-16 14:26:54 +00:00
Member

Summary

  • Store::open (crates/client/src/state.rs) created client.db only, never the data directory it lives in. On a fresh install the directory does not exist, so the first write (temporary file + rename) failed with No such file or directory and the device never reached the server — forge issue #284.
  • open now creates the data directory first, 0700, via fs::DirBuilder with recursive(true). This covers every path the directory can come from: GRIMOIRIX_SIGNAGE_DATA_DIR, XDG_DATA_HOME, and the ~/.local/share/grimoirix-signage default.
  • Added tests: opening Store against a data directory that does not exist yet (the actual bug — the existing a_missing_file_is_a_first_start test only covered a missing client.db inside a directory that already existed), and that the created directory is 0700.

Test plan

  • cargo test -p client --lib state:: — 13 passed, including the two new tests.
  • ./scripts/local-gates.sh --rust-only — every gate passed.
## Summary - `Store::open` (`crates/client/src/state.rs`) created `client.db` only, never the data directory it lives in. On a fresh install the directory does not exist, so the first write (temporary file + rename) failed with `No such file or directory` and the device never reached the server — forge issue [#284](https://git.grimoirix.org/Grimoirix/grimoire-of-digital-signage/issues/284). - `open` now creates the data directory first, `0700`, via `fs::DirBuilder` with `recursive(true)`. This covers every path the directory can come from: `GRIMOIRIX_SIGNAGE_DATA_DIR`, `XDG_DATA_HOME`, and the `~/.local/share/grimoirix-signage` default. - Added tests: opening `Store` against a data directory that does not exist yet (the actual bug — the existing `a_missing_file_is_a_first_start` test only covered a missing `client.db` inside a directory that already existed), and that the created directory is `0700`. ## Test plan - [x] `cargo test -p client --lib state::` — 13 passed, including the two new tests. - [x] `./scripts/local-gates.sh --rust-only` — every gate passed.
GRI-2150: create the client data directory before first write
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / cargo fmt (pull_request) Successful in 4s
CI / install.sh client upgrade (pull_request) Successful in 13s
CI / cargo deny (pull_request) Successful in 14s
CI / cargo deny advisories (pull_request) Successful in 19s
CI / repository boundary (pull_request) Successful in 5s
CI / cargo clippy (pull_request) Successful in 1m12s
CI / frontend-web (pull_request) Successful in 1m2s
CI / cargo test (pull_request) Successful in 3m20s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 2s
281aede9f3
On a fresh install, Store::open never created the data directory itself,
only client.db inside it. The first write (a temporary file + rename)
then failed with ENOENT, and the device never reached the server.
vivy approved these changes 2026-11-16 14:06:22 +00:00
vivy left a comment

Reviewed: cause and fix match the issue, tests cover it, CI green, up to date with dev.

Reviewed: cause and fix match the issue, tests cover it, CI green, up to date with dev.
Merge branch 'dev' into fix/GRI-2150-client-data-dir
All checks were successful
CI / the pre-push hook (pull_request) Successful in 3s
CI / install.sh client upgrade (pull_request) Successful in 15s
CI / cargo fmt (pull_request) Successful in 4s
CI / cargo clippy (pull_request) Successful in 1m36s
CI / cargo deny (pull_request) Successful in 18s
CI / cargo deny advisories (pull_request) Successful in 23s
CI / repository boundary (pull_request) Successful in 5s
CI / frontend-web (pull_request) Successful in 1m10s
CI / cargo test (pull_request) Successful in 3m49s
CI / Notify gate failed (pull_request) Has been skipped
CI / CI (pull_request) Successful in 1s
aadc86fa7d
vivy merged commit 637514c197 into dev 2026-11-16 14:26:54 +00:00
vivy deleted branch fix/GRI-2150-client-data-dir 2026-11-16 14:26:55 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!287
No description provided.