feat(promote): honor a component's environment-ladder subset at runtime - #530
Merged
Merged
Conversation
A component may declare an environments list shorter than the repo-global ladder. Generation already emitted per-component workflows scoped to the component's resolved envs, but the promotion runtime read the global ladder, so a short-ladder component could be advanced toward environments it does not target. applyComponentLadder now narrows the working ladder to the component's resolved environments in NewPromoter and the preflighter, so next-env, is-last-env, and gating all use the subset: the subset's last environment is the terminal publish boundary and a promotion toward an environment outside the subset is rejected. An empty component, and a state-only component with no declaration, use the global ladder unchanged, byte-identical. Mirrors how rollback already resolves the component's ladder. Refs #297. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.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.
Problem
A component may declare an
environmentslist shorter than the repo-global ladder. Generation already emitted per-component workflows scoped to the component's resolved envs, but the promotion RUNTIME (NewPromoter, the preflighter) read the global ladder, so a short-ladder component could be advanced toward environments it does not target.Fix
applyComponentLaddernarrows the working ladder to the component's resolved environments inNewPromoterand the preflighter, so next-env, is-last-env, and gating all use the subset: the subset's last environment is the terminal publish boundary, and a promotion toward an environment outside the subset is rejected.componentsdeclaration, use the global ladder unchanged, byte-identical. Mirrors how rollback already resolves the component's ladder.Generation was audited and is already correct (workflows built from
resolved.Config); this closes the runtime gap only.Verification
go build ./...,go test ./...(2661 pass),go test -raceon promote+simulate (257 pass),golangci-lint run ./...clean; e2e build+vet clean; single-component byte-identical baseline gate green. Unit tests prove a[dev, staging]component never targetsprod, cascade within the subset succeeds, the subset's last env is terminal, and a full-ladder sibling still reachesprod. New e2e scenario55-component-env-subset.yaml(api narrowed to[dev, staging], web full ladder) passes locally in the harness (42.6s): api dev-to-staging is terminal, api dev-to-prod fails as expected, web reaches prod.Refs #297.