fix(cron): re-validate stale cron-output entries before deletion #37721 - #37868
Closed
kyssta-exe wants to merge 1 commit into
Closed
fix(cron): re-validate stale cron-output entries before deletion #37721#37868kyssta-exe wants to merge 1 commit into
kyssta-exe wants to merge 1 commit into
Conversation
…sResearch#37721) quick() and dry_run() previously trusted the stored category from tracked.json without re-validating at delete time. Stale entries from before NousResearch#34840 could carry category="cron-output" for cron control-plane paths (e.g. cron/jobs.json), causing quick() to delete the live scheduler registry. Fix: - Fix guess_category() to only classify cron/output/** as cron-output (was classifying ALL cron/* paths, missing the NousResearch#34840 fix). - Re-validate cron-output entries via guess_category() at delete time in quick() and dry_run(); stale entries that are no longer classified as cron-output are skipped and removed from tracked.json. - Add _is_protected_cron_path() as a hard defense-in-depth guard that blocks deletion of cron/cronjobs directories and known control-plane files (jobs.json, .tick.lock) regardless of stored category. - Update test_cron_subtree_categorised to match fixed guess_category (only cron/output/* is cron-output, not all of cron/). Tests: add 5 regression tests in TestStaleCronEntryMigration.
Collaborator
Contributor
|
Merged via #39067 (commit 30412a9 on I dropped the Verified live: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #37721 — stale
tracked.jsonentries withcategory: "cron-output"pointing to cron control-plane files (e.g.cron/jobs.json) could causequick()to delete the live scheduler registry.Root Cause
guess_category()on fork was missing the fix(cron): stop silent cron-job loss across update (disk-cleanup + snapshot restore) #34840 fix — it classified ALLcron/*paths ascron-output, not justcron/output/**.quick()anddry_run()trusted the stored category without re-validating at delete time. Stale entries from before fix(cron): stop silent cron-job loss across update (disk-cleanup + snapshot restore) #34840 could carrycategory: "cron-output"for paths likecron/jobs.json.Fix
guess_category(): Only classifycron/output/**ascron-output(matching the fix(cron): stop silent cron-job loss across update (disk-cleanup + snapshot restore) #34840 fix on main).quick()anddry_run(), re-runguess_category()forcron-outputentries. Stale entries that no longer match are skipped and removed fromtracked.json._is_protected_cron_path()that blocks deletion ofcron,cronjobs,jobs.json, and.tick.lockregardless of stored category.Changes
plugins/disk-cleanup/disk_cleanup.py: 3 fixes + new_is_protected_cron_path()helpertests/plugins/test_disk_cleanup_plugin.py: 5 new regression tests inTestStaleCronEntryMigration, 1 existing test updatedTest Results
All 43 tests pass (38 existing + 5 new regression tests).