From e7862d14bb5c30cd71a6ac692aee8ee9706d366a Mon Sep 17 00:00:00 2001 From: repo-worker-code Date: Mon, 2 Nov 2026 17:13:36 -0600 Subject: [PATCH] fix(pm-dashboard-backup): point DUMP_DIR at pm-stack-backup.sh output dir (dezren39/nix#1365) The db-dump step runs ~/tools/pm-stack-db-backup.sh (bridge to pm-stack-backup.sh, code#1514), which writes to ~/backups/pm-stack//. DUMP_DIR still pointed at ~/backups/db-dumps//, which never exists, so every run with DUMP_RAN=1 failed verify as required-member-missing and the local-archive leg failed (2026-11-02 run, exit 1). The staged tree keeps its historic db-dumps name; only the source dir changed. Test dump stubs updated to match. --- nixos/home/pm-dashboard-backup-copy.test.sh | 12 ++++++------ nixos/home/pm-dashboard-backup-manifest.test.sh | 8 ++++---- nixos/home/pm-dashboard-backup-record.test.sh | 4 ++-- nixos/home/pm-dashboard-backup.sh | 14 +++++++++----- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/nixos/home/pm-dashboard-backup-copy.test.sh b/nixos/home/pm-dashboard-backup-copy.test.sh index c127f1a5f8..5f909c9d1c 100755 --- a/nixos/home/pm-dashboard-backup-copy.test.sh +++ b/nixos/home/pm-dashboard-backup-copy.test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Tests for pm-dashboard-backup.sh's dataset staging copies (#1023): # the copies that stage the aggregator files, the snapshots tree, the -# meta-quota-export files, and the db-dumps dir were unchecked, and the +# meta-quota-export files, and the staged dumps dir were unchecked, and the # manifest is generated by walking the staged tree — so a failed copy # (a present but unreadable dataset file) was invisible to the verify # step: the run reported full success with an incomplete archive, @@ -14,7 +14,7 @@ # file, nothing uploaded, marker unchanged # * unreadable snapshots file — same, naming the snapshots tree # * unreadable meta-export file — same, naming the file -# * unreadable db-dumps file — same, naming the dumps dir +# * unreadable dumps file — same, naming the pm-stack source dir # * missing required file (control) — WARN at staging as before # (absent is not unreadable: no dataset-copy failure), but since # #1025 the run then FAILS at verify naming the member, uploads @@ -95,7 +95,7 @@ setup_and_run() { local agg="$HOME_DIR/.local/state/pm-aggregator" local meta="$HOME_DIR/atlas/meta-quota-export" mkdir -p "$HOME_DIR/backups/dashboard" "$agg/snapshots" "$meta" \ - "$HOME_DIR/backups/db-dumps/$DATE_ARG" + "$HOME_DIR/backups/pm-stack/$DATE_ARG" local f for f in actions.json comments.json fleet-feed.json quota-current.json \ registry.json quota-gatherer-state.json quota-gatherer-heartbeat.json; do @@ -104,7 +104,7 @@ setup_and_run() { printf '{}\n' >"$agg/snapshots/snap1.json" printf '{}\n' >"$meta/latest.json" printf '{}\n' >"$meta/history.jsonl" - printf 'dump\n' >"$HOME_DIR/backups/db-dumps/$DATE_ARG/dump.sql" + printf 'dump\n' >"$HOME_DIR/backups/pm-stack/$DATE_ARG/dump.sql" echo "$PRESET" >"$HOME_DIR/backups/dashboard/.last-run-epoch" if [[ -n "$break_rel" ]]; then if [[ "$break_rel" == MISSING:* ]]; then @@ -156,8 +156,8 @@ expect_copy_failure unreadable-snapshots "snapshots" setup_and_run unreadable-meta "atlas/meta-quota-export/latest.json" expect_copy_failure unreadable-meta "latest.json" -setup_and_run unreadable-dumps "backups/db-dumps/$DATE_ARG/dump.sql" -expect_copy_failure unreadable-dumps "db-dumps" +setup_and_run unreadable-dumps "backups/pm-stack/$DATE_ARG/dump.sql" +expect_copy_failure unreadable-dumps "pm-stack" # Control: a missing dataset file still only WARNs at staging (absent # is not unreadable — no dataset-copy failure), but comments.json is a diff --git a/nixos/home/pm-dashboard-backup-manifest.test.sh b/nixos/home/pm-dashboard-backup-manifest.test.sh index df32bfa77d..1484772bb9 100755 --- a/nixos/home/pm-dashboard-backup-manifest.test.sh +++ b/nixos/home/pm-dashboard-backup-manifest.test.sh @@ -26,8 +26,8 @@ # * dump-ran-no-dir — the dump step ran (stub script, exit 0) but # produced no dumps dir: db-dumps is conditionally REQUIRED, so # the run fails naming db-dumps, cursor unchanged. -# * dump-ran-with-dir — the dump step produced its dir: db-dumps -# recorded required + present, run completes. +# * dump-ran-with-dir — the dump step produced its dir: the staged +# db-dumps member is recorded required + present, run completes. set -uo pipefail SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -96,8 +96,8 @@ chmod +x "$BIN/bws" "$BIN/journalctl" "$BIN/rclone" DUMPBIN="$TMP_ROOT/dump-bin" mkdir -p "$DUMPBIN" { printf '#!%s\n' "$BASH"; cat <<'STUB' -mkdir -p "$HOME/backups/db-dumps/$1" -printf 'dump bytes\n' >"$HOME/backups/db-dumps/$1/dump.sql" +mkdir -p "$HOME/backups/pm-stack/$1" +printf 'dump bytes\n' >"$HOME/backups/pm-stack/$1/dump.sql" exit 0 STUB } >"$DUMPBIN/dump-with-dir.sh" diff --git a/nixos/home/pm-dashboard-backup-record.test.sh b/nixos/home/pm-dashboard-backup-record.test.sh index 9055c19abc..03784564c2 100644 --- a/nixos/home/pm-dashboard-backup-record.test.sh +++ b/nixos/home/pm-dashboard-backup-record.test.sh @@ -104,8 +104,8 @@ run_scenario() { dump_script="$home/dump-ok.sh" { printf '#!%s\n' "$BASH" - printf '%s\n' 'mkdir -p "$HOME/backups/db-dumps/$1"' - printf '%s\n' 'printf "{}\n" > "$HOME/backups/db-dumps/$1/dump.sql"' + printf '%s\n' 'mkdir -p "$HOME/backups/pm-stack/$1"' + printf '%s\n' 'printf "{}\n" > "$HOME/backups/pm-stack/$1/dump.sql"' } >"$dump_script" chmod +x "$dump_script" elif [[ $dump_mode == "fail" ]]; then diff --git a/nixos/home/pm-dashboard-backup.sh b/nixos/home/pm-dashboard-backup.sh index e63b08ea2e..39d2c4941a 100755 --- a/nixos/home/pm-dashboard-backup.sh +++ b/nixos/home/pm-dashboard-backup.sh @@ -274,12 +274,16 @@ ledger_set credentials ok # --- optional pm-stack DB dumps (code#1514) -------------------------------- # The #1514 dump job (Kaneo Postgres + Grist + Pad) publishes its script at -# ~/tools/pm-stack-db-backup.sh and writes dumps to ~/Backups/db-dumps// -# (here: ~/backups/db-dumps//). When present it runs first and its -# output rides this archive to all three destinations; until it lands, the -# archive carries the dashboard state set only and says so in the log. +# ~/tools/pm-stack-db-backup.sh (a bridge to pm-stack-backup.sh) and writes +# dumps to ~/backups/pm-stack// (here: $DUMP_DIR). When present it runs +# first and its output rides this archive to all three destinations; until +# it lands, the archive carries the dashboard state set only and says so in +# the log. (nix#1365: DUMP_DIR previously pointed at ~/backups/db-dumps, +# which the dump script never writes — every run with DUMP_RAN=1 then failed +# verify as required-member-missing. The staged tree keeps its historic +# db-dumps name; only the source dir changed.) DUMP_SCRIPT="${PM_DB_DUMP_SCRIPT:-$HOME/tools/pm-stack-db-backup.sh}" -DUMP_DIR="$HOME/backups/db-dumps/$DATE" +DUMP_DIR="$HOME/backups/pm-stack/$DATE" DUMP_RAN=0 if [ -x "$DUMP_SCRIPT" ]; then ledger_begin db-dump