configurable artifact retention with background cleanup and dry-run CLI#475
Open
ishitaajain22-tech wants to merge 6 commits into
Open
configurable artifact retention with background cleanup and dry-run CLI#475ishitaajain22-tech wants to merge 6 commits into
ishitaajain22-tech wants to merge 6 commits into
Conversation
utksh1
requested changes
Jun 2, 2026
Owner
utksh1
left a comment
There was a problem hiding this comment.
Requesting changes. The retention idea is useful, but this PR is not safe to merge in its current form. CI formatting-hygiene is failing, and the diff removes existing application wiring: API key startup initialization is removed, the saved views router is no longer included, denied capability settings are removed, and parser sandbox settings are replaced by retention settings. Those are unrelated regressions. Please rebase on current main, keep the retention change scoped, preserve existing auth/saved-view/parser-sandbox configuration, and get formatting plus backend tests green.
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.
Description
Implements production-grade artifact retention for scan tasks and their raw output files.
--max-age-days), count (--keep-statuses), and status guardpython -m backend.secuscan.cli cleanup --dry-run) that reports what would be removed without touching the DB or diskretention_purge) written for every real deletion.env.examplerestored and extended with commented-out retention knobs — all policies default to0(disabled), so existing deployments are unaffectedRelated Issues
Closes #217
Type of Change
How Has This Been Tested?
27 new unit tests added in
testing/backend/unit/test_retention.py.Run the new tests:
Run full unit suite to confirm no regressions:
Manually test dry-run CLI:
Test coverage includes:
keep_statusesguard:runningandqueuednever purged regardless of policyresult.errors, cleanup continues for remaining tasksretention_purgewritten per deleted task; not written on dry-runChecklist