fix: close RolloutGate creation race window that allows prod to bypass staging ordering#1
Open
LittleChimera wants to merge 1 commit into
Open
fix: close RolloutGate creation race window that allows prod to bypass staging ordering#1LittleChimera wants to merge 1 commit into
LittleChimera wants to merge 1 commit into
Conversation
…ace window When an Environment with a relationship is created at the same time as its Rollout, the rollout controller can deploy freely during the window between Rollout creation and RolloutGate creation by the environment controller. The gate was created after syncDeploymentHistory and buildRelationshipGraph (both GitHub API calls), introducing a multi-second delay. Move createOrUpdateRolloutGate to the top of Reconcile, before any GitHub API calls. Also initialize AllowedVersions to [] (not nil) when a relationship is configured — nil is treated as "no restriction" by the rollout controller, so a freshly created gate would not block until updateAllowedVersionsFromRelationships ran a second time. Observed: kuberik-demo prod deployed main-1779290372-b797408 at 15:19:48 but the prod gate was not created until 15:19:50, allowing prod to bypass the staging-before-prod ordering requirement. Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
Environmentand itsRolloutare created simultaneously, the rollout controller can deploy freely during the window between Rollout creation and RolloutGate creation. The gate was being created aftersyncDeploymentHistory+buildRelationshipGraph— both GitHub API calls — introducing a multi-second delay.AllowedVersions=nilis treated by the rollout controller as "no restriction" rather than "block all", so the gate didn't protect anything untilupdateAllowedVersionsFromRelationshipsran a second time.Observed incident:
kuberik-demoprod deployedmain-1779290372-b797408at15:19:48but the prod gate wasn't created until15:19:50, allowing prod to bypass the staging-before-prod ordering requirement.Changes
createOrUpdateRolloutGateto before GitHub API calls inReconcile. The gate now exists immediately on first reconcile, before any slow external calls.AllowedVersions = [](not nil) when relationship is configured.nilmeans "no restriction" in the rollout controller. An empty slice means "block all versions" — the safe default while the gate is being set up.Test plan
relationship: { type: After }alongside its Rollout; verify no deployment happens before the gate'sallowedVersionsis populated by the upstream environment's bake successallowedVersions=nil)🤖 Generated with Claude Code