Skip to content

feat: add composable promotion gate framework#6592

Draft
jsbroks wants to merge 1 commit into
mainfrom
jsbroks/gate-extraction
Draft

feat: add composable promotion gate framework#6592
jsbroks wants to merge 1 commit into
mainfrom
jsbroks/gate-extraction

Conversation

@jsbroks

@jsbroks jsbroks commented Jul 10, 2026

Copy link
Copy Markdown

Description

Closes #

Introduces pkg/promotion/gate, a small, composable framework for deciding
whether a Promotion may be created for a given Stage/Freight pair.

Gates are simple predicates that allow, deny, or defer (via a
RequeueAfter). They are composed with an ordered AND Set and evaluated
through Default() / DefaultEvaluate(). Each built-in gate lives in the
builtin package, one per file, with a single responsibility and its own
specific denial message:

  • namespace — Freight and Stage must reside in the same namespace (Project).
  • requested-origin — the Stage must request Freight from the Freight's origin.
  • availability — Freight must be approved, sourced directly, or verified in
    the required upstream Stage(s) (honoring the availability strategy).
  • soak-time — Freight must meet its required soak time; approval bypasses it.

Shared types (PromotionGate, PromotionInput, Decision) live in a
types subpackage to keep the framework and its built-in gates free of import
cycles. PromotionInput.FreightRequest() resolves the applicable
FreightRequest by origin so individual gates don't re-derive it.

This separates static eligibility (a stable invariant) from dynamic soak
policy
, keeps each check single-responsibility, and makes denials
human-readable and easy to observe.

Checklist

Eligibility

  • Linked to an existing issue with no blocking labels (kind/proposal, needs discussion, needs research, maintainer only, area/security, size/large, size/x-large, size/xx-large).
  • Changes documentation only.
  • Changes ten lines or fewer.

Quality

  • Adds or updates corresponding tests.
  • Adds or updates corresponding documentation.

AI Use Disclosure

This PR was written:

  • By a human without AI assistance.
  • By a human with AI assistance. A human has reviewed every line prior to opening the PR.
  • By an AI with human supervision. A human has reviewed every line prior to opening the PR.
  • Entirely by an AI. No human has reviewed this prior to opening the PR.

Sign-Off

All commits:

  • Are signed off by their author (git commit -s) (required)
  • Are cryptographically signed (git commit -S) (encouraged)

Made with Cursor

Introduce pkg/promotion/gate, a small framework for deciding whether a
Promotion may be created for a given Stage/Freight pair.

Gates are predicates that allow, deny, or defer (via RequeueAfter). They are
composed with an ordered AND Set and evaluated through Default()/
DefaultEvaluate(). Built-in gates live in the builtin package, one per file:

- namespace: Freight and Stage must reside in the same namespace (Project).
- requested-origin: the Stage must request Freight from the Freight's origin.
- availability: Freight must be approved, sourced directly, or verified in the
  required upstream Stage(s).
- soak-time: Freight must meet its required soak time; approval bypasses it.

This separates static eligibility (a stable invariant) from dynamic soak
policy, keeps each check single-responsibility, and gives every denial a
specific, human-readable message.

Signed-off-by: Justin Brooks <justin.brooks@akuity.io>
@kargo-governance-bot kargo-governance-bot Bot added needs/area Issue or PR needs to be labeled to indicate what parts of the code base are affected needs/kind Issue or PR needs to be labeled to clarify its nature needs/priority Priority has not yet been determined; a good signal that maintainers aren't fully committed labels Jul 10, 2026
@netlify

netlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

Deploy Preview for docs-kargo-io ready!

Name Link
🔨 Latest commit 425582a
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/6a5167e75f1415000856a00b
😎 Deploy Preview https://deploy-preview-6592.docs.kargo.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs/area Issue or PR needs to be labeled to indicate what parts of the code base are affected needs/kind Issue or PR needs to be labeled to clarify its nature needs/priority Priority has not yet been determined; a good signal that maintainers aren't fully committed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant