Replace ntfy.state_dir with a top-level [state] dir
Security / Vulnerability check (push) Successful in 45s
Test / Lint and test (push) Successful in 2m1s

The job store is to keep its database in the directory that holds the
ntfy subscriptions' state files, so the directory moves to a section
of its own: [state] dir, or UBERBRINGER_STATE_DIR, in place of
[ntfy] state_dir. For now only the subscriptions use it. It still has
no default and is still required with a subscription, and the checks
at start name state.dir in their errors.

install.sh writes [state] dir into new configs, and the Docker image
sets UBERBRINGER_STATE_DIR. ntfy.state_dir has never been in a
release, so its CHANGELOG entry changes in place and there is no
fallback: a config that still sets it fails to load with an unknown
key until the line moves to [state].

The image itself was not built, since the workstation has no Docker.

Part of stage 1b of docs/plans/job-store.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-12-01 12:21:29 -06:00
1 parent f0b5bf020e
commit 66531e7314
16 files changed
+92 -68

No files matched your search

+6 -6
View File
@@ -367,7 +367,7 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
deliberately left out. A message queued but not yet printed when the
daemon stops is lost, as any waiting job is: the queue stays in
memory, because ESC/POS cannot say what printed.
- State is one JSON file per subscription in `ntfy.state_dir`, written
- State is one JSON file per subscription in `state.dir`, written
atomically (temporary file, fsync, rename), mode 0600 since held
messages carry titles. A change a restart must see, such as a message
printed, held or left out, is written within a second, and so is the
@@ -377,7 +377,7 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
day per subscription, which wears an SD card. A saved cursor that is
behind costs only a longer replay after a crash, and the saved IDs
drop the messages it sends again. A damaged
file means a fresh start with a warning. `state_dir` has no default,
file means a fresh start with a warning. `state.dir` has no default,
since the daemon also runs on Windows; `install.sh` writes the unit's
`StateDirectory`, `/var/lib/uberbringer`, and the image sets the same
path.
@@ -445,10 +445,10 @@ before anything is built. They come in this order.
the owner accepted every proposed default, 2026-12-01).
- Jobs survive a restart in SQLite, through `modernc.org/sqlite` and
`database/sql`, not GORM: WAL mode, one connection, exclusive
locking. `jobs.db` lives in `[state] dir`, which replaces
`ntfy.state_dir` and keeps the ntfy state files too; empty keeps the
queue in memory. modernc's exact `modernc.org/libc` is the one
exception to "latest stable", held by a gate check.
locking. `jobs.db` lives in `[state] dir`, beside the ntfy state
files; empty keeps the queue in memory. modernc's exact
`modernc.org/libc` is the one exception to "latest stable", held by
a gate check.
- A job has one delivery per printer, each with its own state. A
delivery's `sending` mark is synced before its first byte, and one
found in `sending` at start ends `uncertain`, a new terminal status,