Repository navigation
fix(agent-backup): PREV is newest-before-stamp and latest never regresses (#4602) - #4608
Conversation
…sses (#4602) PREV compared against the greatest snapshot name, so a future-dated directory became the dedup baseline: a duplicate of the true previous snapshot was kept, and latest repointed backwards. Select the newest snapshot strictly before STAMP instead, and only move latest forward when the new snapshot is the newest on disk. Regression test covers duplicate-of-true-previous, mirror, and newest-run cases with the existing fake-date pattern.
|
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 38 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 SummaryThis 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 329a112246
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # included: a bare stamp sorts before its suffixed siblings. | ||
| PREV="$(find "$ROOT" -mindepth 1 -maxdepth 1 -type d -not -name "$STAMP" -printf '%f\n' | | ||
| sort | tail -n1 || true)" | ||
| awk -v stamp="$STAMP" '$0 < stamp' | sort | tail -n1 || true)" |
There was a problem hiding this comment.
Add awk to the backup service's runtime dependencies
In the deployed systemd service, home/common/default.nix:492–499 explicitly sets PATH to only coreutils, diffutils, and findutils; none provides awk. This new pipeline therefore fails with awk: command not found, but the trailing || true masks the failure and leaves PREV empty. Every invocation retains its snapshot even when nothing changed, silently disabling deduplication. Add pkgs.gawk to the service PATH or implement the filter using an existing dependency.
Useful? React with 👍 / 👎.
| NEWEST="$(find "$ROOT" -mindepth 1 -maxdepth 1 -type d -not -name "$STAMP" -printf '%f\n' | | ||
| sort | tail -n1 || true)" | ||
|
|
||
| if [ -z "$NEWEST" ] || [[ "$STAMP" > "$NEWEST" ]]; then |
There was a problem hiding this comment.
Exclude in-flight snapshots from the latest-pointer guard
When two backups overlap, the newer directory may only be an incomplete reservation. With latest pointing to an older snapshot P, run A can finish copying changed content X while run B reserves a newer timestamp and pauses before copying. A sees B here and skips updating latest; B then copies X, deduplicates against A, and deletes itself. Both runs succeed, but latest remains on P rather than the newest retained snapshot A, and subsequent unchanged runs exit without repairing it. Serialize deduplication/publication or distinguish completed snapshots from reservations before suppressing the update.
Useful? React with 👍 / 👎.
…#4602) The service PATH is coreutils+diffutils+findutils only, so the awk filter failed (masked by || true) and left PREV empty. Use a sorted sentinel scan with bash builtins instead; same newest-before-stamp semantics, same-second suffixed names keep in-second order.
|
Reply to Codex P2 (awk in runtime PATH): fixed in 398967b. The Reply to Codex P2 (overlapping reservations leaving |
Fixes #4602.
PREV compared against the greatest snapshot name, so a future-dated directory became the dedup baseline: a duplicate of the true previous snapshot was kept, and
latestrepointed backwards. This change selects the newest snapshot strictly before STAMP instead, and only moveslatestforward when the new snapshot is the newest on disk.Evidence:
latestregressed 2027 -> stamp.no change since <true-prev>, duplicate removed,lateststays on future snapshot.bash pkgs/agent-backup/test-backup.sh: same-second collision regression PASS (unchanged), new future-dated PREV/latest regression PASS.Same-second suffixed names (#3340) keep in-second order (string comparison); candidate list unchanged.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.