Repository navigation
fix(backups): detect empty pm-stack day dirs (#3869) - #7866
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Adds a new watchdog validation to detect “empty” fresh pm-stack day directories (directory exists but expected pm-stack-<date>.tar.zst archive is missing), and extends the test suite to cover the new scenarios.
Changes:
- Add a pm-stack day-directory freshness + archive-presence check (skipped when pm-stack root is absent).
- Update tests to run with a scratch
HOMEand validate absent-root, empty-fresh-day, archive-present, and stale-only day-directory scenarios.
| File | Description |
|---|---|
| nixos/home/laptop-backups-watchdog.sh | Implements the new pm-stack day-dir selection and required archive check. |
| nixos/home/laptop-backups-watchdog.test.sh | Adds scratch HOME usage and new test cases for pm-stack root/day/archive behavior. |
Review effort: Lite
| TODAY="$(date +%F)" | ||
| PM_STACK_ROOT="$HOME_DIR/backups/pm-stack" | ||
| YESTERDAY="$(date -d '1 day ago' +%F)" |
There was a problem hiding this comment.
Accepted and fixed in the follow-up commit on this branch: the test now captures one TEST_EPOCH at the pm-stack scenario start and derives TODAY, YESTERDAY, and STALE_DAY (and the stale dir mtime) from it, so a midnight rollover mid-run cannot make the scenarios disagree about the current day. Full watchdog test suite passes.
| rmdir "$PM_STACK_ROOT/$TODAY" | ||
| rm -f "$PM_STACK_ROOT/$YESTERDAY/pm-stack-$YESTERDAY.tar.zst" | ||
| rmdir "$PM_STACK_ROOT/$YESTERDAY" | ||
| STALE_DAY="$(date -d '48 hours ago' +%F)" |
There was a problem hiding this comment.
Accepted and fixed in the follow-up commit on this branch: the test now captures one TEST_EPOCH at the pm-stack scenario start and derives TODAY, YESTERDAY, and STALE_DAY (and the stale dir mtime) from it, so a midnight rollover mid-run cannot make the scenarios disagree about the current day. Full watchdog test suite passes.
| PM_STACK_ROOT="$HOME/backups/pm-stack" | ||
| if [ -d "$PM_STACK_ROOT" ]; then | ||
| newest_pm_stack_day="" | ||
| for day_dir in "$PM_STACK_ROOT"/*/; do | ||
| [ -d "$day_dir" ] || continue |
There was a problem hiding this comment.
Accepted and fixed in the follow-up commit on this branch: the pm-stack day-dir loop now runs under shopt -s nullglob (restored with shopt -u after the loop), so an unmatched glob expands to nothing instead of relying on the [ -d ] guard to filter the literal pattern. Full watchdog test suite passes.
…ne epoch Addresses Copilot review on PR #7866: the day-dir glob now runs under nullglob instead of relying on the [ -d ] guard to catch the literal unmatched pattern, and the watchdog tests derive TODAY/YESTERDAY/ STALE_DAY from a single captured TEST_EPOCH so a midnight rollover mid-run cannot make the scenarios disagree about the current day.
e96cfcf to
f4c7e2a
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
agent-note:v1 |


Summary
the watchdog now checks the newest valid, fresh pm-stack day directory:
The check is read-only and skips when the pm-stack root is absent. Tests use a scratch HOME and cover absent root, an empty newest day despite an older archive, archive present, and stale-only directories.
Evidence
bash nixos/home/laptop-backups-watchdog.test.sh— all passed, including the missing/present/stale scenarios.Merge Danger
Door: two-way — the watchdog check can be reverted independently.
Blast Radius: low — read-only local backup validation; only emits a failure for a recent empty dated directory.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.