fix(actual-budget): make the finance backup unable to succeed quietly #202
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "docs/finance-backup-restore"
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?
Yesterday's categorisation work on finance.kblab.me prompted the question of whether it is backed up. It is: verified end to end (see below). This PR fixes what I found while verifying.
Two ways the job could report success without a usable backup
It tarred whatever was at
/datawithout checking. An unmounted PVC would have written a small successful archive, and 30 days of that rotates the good local copies away. The job now refuses to run unlessserver-files/account.sqliteand at least oneuser-files/*.sqliteexist, and refuses to upload an archive under 20KB.smbclient -cdoes not exit non-zero when a command inside it fails - it printsNT_STATUS_*and carries on - so the unchecked&&printedNAS copy OKfor an upload that had gone to the share root or nowhere. This adopts the checkedsmb()wrapper already used inapps/zomboid/backup/backup.shand adds a post-upload size check against the share.The off-box copy stays best-effort by design (the local copy is the success condition, per the runbook). What changes is that the log now tells the truth about it. The guards in (1) exit non-zero, so
KubeJobFailedpages.Verification
Ran the real script in a container with a stubbed
smbclient, against a real copy of the budget data:/dataempty (PVC not mounted)account.sqlitepresent, no budget filecdfails, file lands in share rootWARN(old code:NAS copy OK)WARN+ size mismatch (old code:NAS copy OK)And the current backup itself, independently of this change: today's 03:00 archive on the NAS unpacks clean, both SQLite files pass
integrity_check, the budget file is registered, and it holds 483 category assignments with the newest at 2026-08-24T19:43 local - yesterday evening's session.Docs
actual-budgetwas absent from the backup runbook entirely, so restoring finance data was undocumented. Adds:account.sqlitealone gets a working login and an empty budgetkarakeep-backupis local-only with no off-box copy, which the table now says.Not addressed here
smbclientpattern is still in the home-assistant, immich, litellm, vaultwarden and tax-export jobs. Left alone rather than changing five jobs' reporting in a PR about finance.