Repository navigation
Conversation
`backupRetain` deletes on every cron run, R2 deletes have no undo, and the thing deleted is a backup — so the only way to learn what a retention setting does on a real bucket was to let it run and read what was gone. That is a poor trade for a subsystem where both defects found in review were silent data loss, and it is worse than it sounds because eligibility turns on a metadata marker that legacy sidecars lack: on any pre-existing bucket, retention may own far fewer snapshots than the bucket holds, and nothing said so. `GET /_lunora/admin/backup/retention` answers "what would go next", and `lunora backup retention` prints it. The worker has to be the one to answer — it is the only party that knows its own `backupCron` and `backupRetain`, and the marker is not visible in a plain listing. The selection is shared, not re-derived. `pruneBackups` already computed its set before deleting; that computation is now `selectStaleBackups`, which both the prune and the preview call. A preview that can disagree with the prune is worse than no preview, and this subsystem has twice shown what happens when one rule gets written in two places. The test seeds one bucket with every case that makes eligibility subtle — a legacy sidecar, another deployment's cron, an operator's own snapshot — then runs the preview and a real cron fire against identical bucket state and asserts the sets match. Diverging only the preview fails it; perturbing the shared function moves both and is caught elsewhere. Nothing here deletes. The route reads, the verb reads, and a test asserts the bucket is byte-for-byte unchanged after a preview. Retention itself stays on the cron — this adds no second deleter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
Plan 313's §4.4 amendment said WS4 was wholly open; half of it is now done. The preview closes the "see it coming" half; what remains is the deletion becoming a step an operator invokes rather than a side effect of a backup succeeding. The docs say to run the preview after changing `backupRetain` and on any bucket that predates the marker — the case where the answer is least deducible from the config. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
✅ Deploy Preview for lunorash ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
Next review available in: 24 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (8)
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. Comment |
|
Thank you for following the naming conventions! 🙏 |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha #388 +/- ##
========================================
Coverage 87.09% 87.09%
========================================
Files 1172 1177 +5
Lines 63383 63618 +235
Branches 15447 15641 +194
========================================
+ Hits 55202 55411 +209
- Misses 7654 7677 +23
- Partials 527 530 +3
🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
Superseded by #389, merged as This branch is an ancestor of Verified on |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What
lunora backup retention— what the platform's retention would delete on itsnext run, and nothing else.
Backed by
GET /_lunora/admin/backup/retention, admin-gated like the storageread route.
Why this and not a log
backupRetaindeletes on every cron run, an R2 delete has no undo, and thething deleted is the backup. #387 records what was destroyed; nothing could
say what will be. So the only way to learn what a retention setting does on a
real bucket was to let it run and read the aftermath.
That matters more than usual here because eligibility depends on the
lunoraBackupCronmetadata marker, which sidecars written before that featurelack. On a pre-existing bucket, retention may own a fraction of what the bucket
holds — and no amount of reading the config tells you which fraction. The
preview does, and says so explicitly when the answer is zero.
The surface, and why
lunora backup retention— a report verb, notprune --dry-run.prunethat refuses to prune is confusing, and one that previewsby default with a
--applybehind it advertises a deleter this PR does notbuild.
retentionnames what it reports on, implies nothing destructive, andleaves
pruneunclaimed for the actual deleter when WS4's remaining halflands — so that name is not spent on something that refuses.
list, because it answers a different question from a differentsource:
listreads the bucket, this reads the worker's own configuration.listalso works against a--dirdestination, where retention does notexist.
Preview and prune are the same selection
pruneBackupsalready computed its set before deleting. That computation is nowselectStaleBackups, and both the prune and the preview call it — the previewdoes not re-derive eligibility, because a preview that can disagree with the
prune is worse than no preview, and this subsystem has twice produced the bug
where one rule was written in two places.
The test that matters seeds one bucket with every case that makes
eligibility subtle — a legacy sidecar with no marker, a sidecar carrying another
deployment's cron expression, an operator-written snapshot — then runs the
preview and a real cron fire against identical bucket state and asserts the sets
are equal. Getting the inputs genuinely identical took care: the fire writes a
snapshot before it prunes, so the seed includes a snapshot at the fire's own key
and the fire overwrites it rather than adding one. Without that the two would be
answering about different buckets and an equal result would mean nothing.
Non-vacuity checked both ways. Perturbing
selectStaleBackupsmoves bothsides together and the parity test stays green (correctly — that is what sharing
the code buys); perturbing only the preview fails it immediately.
Nothing here deletes
GET, calls only the selection, and never reaches adelete.keys, same contents.
asserted.
Plan
Plan 313's §4.4 amendment claimed WS4 was wholly open. Narrowed: the preview
half shipped, the deletion becoming an operator-invoked step is what remains,
along with a way to run the cron backup without the prune attached.
Note for the merge order
#387 (the retention log) is still open and touches the same function. It
refactors
pruneBackupsinto "computestale, then delete, then log"; this PRmoves that same computation into
selectStaleBackups. Whichever lands secondkeeps both — the log line and the shared selection are independent. The preview's
output is deliberately phrased like #387's log line, so a prediction and the
record of a real run read as one story.
🤖 Generated with Claude Code
https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP