You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(hot-standby): address all code review findings (C1–L6)
Critical:
- C1 install-standby-sync: ExecStart used NVMe mount-prefix path; strip
SD_ROOT_MNT so the path is correct when the SD card boots
- C2 standby-restore-agent: replace `source "${TRIGGER}"` with safe
explicit field parsing + shell-metacharacter rejection (injection guard)
- C3 hot-standby-sync + standby-restore-agent: sync state now lives on the
SD boot partition (.pi2s3-last-synced on FAT); NVMe-side state file was
wiped on every restore, causing infinite reboot loops
High:
- H1 pi-image-backup: guard standby_failback() against empty
STANDBY_FAILBACK_CMD; sync marker is never written without a real failback
- H2 cf-dns-swap: wrap CF API calls in 3-attempt retry with exponential
backoff; transient 429/503 no longer leaves DNS permanently on standby
- H3 standby-restore-agent: add error handling on both sudo reboot calls
- H4 route53-swap: capture CHANGE_ID stdout-only; stderr goes to temp file
so warnings no longer corrupt the change ID
Medium:
- M1 hot-standby-sync: register cleanup trap before mktemp -d (closes
window where a crash left SD card mounted + temp dirs unremoved)
- M2 hot-standby-sync: add flock single-instance guard (prevents concurrent
cron runs racing on the SD card)
- M3 hot-standby-sync: distinguish NoSuchKey from real S3 errors; auth
failures now surface as ERROR + ntfy instead of silent exit 0
- M4 cf-dns-swap: missing CNAME now exits non-zero (partial failover = failure)
- M5 install-standby-sync: remove dead SD_BOOT_MNT / _SD_BOOT_MOUNTED code
- M6 standby-restore-agent: _NTFY_SITE now sourced from config.env
(CF_SITE_HOSTNAME) after removing the injected trigger source
Low:
- L1 hot-standby-sync: remove unused HOST_SHORT variable
- L2 hot-standby-sync: move exec>> log redirect to before config loading
- L3 install-standby-sync: chmod fallback 666 → 640
- L4 hot-standby-sync: remove NTFY_URL from trigger file; restore agent
reads NTFY_URL from its own config.env on the SD card
- L5 route53-swap: fix trailing comma trim with sed (heredoc appends newline
after comma; string suffix operator did nothing)
- L6 standby-restore-agent: capture restore exit code before error message
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments