fix(scripts): make sweep-cf-orphans MAX_DELETE_PCT env override actually work - #2062
Merged
Merged
Conversation
The script's own help text documents \`MAX_DELETE_PCT=62 ./sweep-cf-orphans.sh\` as the way to relax the safety gate, but the in-script assignment on line 35 was unconditional and overwrote any env value — so the override never worked. During today's staging tenant-provision recovery (CP #255 context), hit the 57%-delete threshold and needed the documented override to clear 64 orphan records. The one-char change to \`\${MAX_DELETE_PCT:-50}\` honors the env while keeping the 50% default when no caller overrides. Ran with MAX_DELETE_PCT=62 after the fix — deleted 64 records, CF zone 111→47. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
The script's own help text documents `MAX_DELETE_PCT=62 ./sweep-cf-orphans.sh` as the way to relax the 50% safety gate, but the in-script assignment on line 35 was unconditional and clobbered any env value — so the override never worked and the script would always refuse above 50%.
Hit this today while clearing CF zone buildup that was wedging staging tenant provisions. With the env honored, swept 64 orphans (36 e2e-tenant + 28 ws), zone went 111 → 47 of 200 cap.
One-char fix: `MAX_DELETE_PCT=50` → `MAX_DELETE_PCT=${MAX_DELETE_PCT:-50}`.
Related: CP #255 (cache-collision recovery), CP #239 (zone quota).