fix(ci): sweep only the previews that still hold a slot - #1609
Open
FelixTJDietrich wants to merge 1 commit into
Open
fix(ci): sweep only the previews that still hold a slot#1609FelixTJDietrich wants to merge 1 commit into
FelixTJDietrich wants to merge 1 commit into
Conversation
The nightly reconcile listed every environment that had ever taken a preview deployment, with no filter on what became of it. A preview torn down months ago stayed a candidate for ever, so each night it was re-assessed, handed to Coolify as a close event for a stack that no longer exists, and re-retired. The bound made that worse rather than containing it. Candidates were sorted ascending and truncated to the first hundred, so as soon as more than a hundred pull requests had ever been previewed, the sweep would spend its whole budget on the oldest — the ones already dealt with — and never reach a preview that had actually leaked. The safety net would have stopped catching anything, quietly. Candidates now come from the same reckoning admission uses: the environments still holding a slot. Nothing dealt with is swept, and the bound is reached only if teardown is genuinely failing, which is when a bound is worth having. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017VKWqbmrPJFv8aKZBp36uD
Contributor
|
Warning Review limit reachedNext included review available in 38 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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 |
Contributor
🧩 Storybook PreviewReview this pull request's components and interaction states: Preview for commit 0f5d679. Updates automatically on new commits. |
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
Merging #1538 with the
previewlabel still attached exercised teardown for the first time, and it worked end to end. Checking the parts that only bite later found one that would have failed silently.The nightly reconcile built its candidate list from every environment that had ever taken a preview deployment, with no filter on what became of it:
A preview torn down months ago stays a candidate for ever. Each night it is re-assessed, handed to Coolify as a close event for a stack that no longer exists, and re-retired. Measured against the live repository today: 1 candidate,
pr-1538, already retired — the entire list was work that did not need doing.The bound made it worse rather than containing it. Candidates were sorted ascending and truncated to the first hundred, so once more than a hundred pull requests had ever been previewed, the sweep would spend its whole budget on the oldest — the ones already dealt with — and never reach a preview that had actually leaked. The safety net would have stopped catching anything, without a single failed run to show for it.
Candidates now come from the same reckoning admission already uses —
occupiedEnvironments, "the environments still holding a slot", which excludes tombstoned teardowns and failed deploys. That is the right set by construction: if admission believes a slot is held and the pull request is closed, that is exactly the leak reconcile exists to fix. The shell inventory moves into the controller, where it is testable.How to test
occupiedEnvironments: the new test fails on the retired entry, and the existing admission test fails with it. Restored, 30 pass.application_previewsrow is gone; the deployment readsqueued → success → inactivewith the tombstone description; the sticky comment now reads "Preview removed — its slot is free again".bun run formatandbun run checkare green.Checklist