Skip to content

feat(components): enforce stability gating and inversion rules in CMS and bridge (b/580941989) - #1539

Merged
VLukiantsev merged 6 commits into
feat/component-stability-api-b580941989from
feat/component-stability-cms-bridge-b580941989
Nov 3, 2026
Merged

VLukiantsev merged 6 commits into
feat/component-stability-api-b580941989from
feat/component-stability-cms-bridge-b580941989

Conversation

@VLukiantsev

@VLukiantsev VLukiantsev commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements CMS STABILITY_INVERSION validation, ComponentPredicate.stability filtering, and defense-in-depth ExperimentalNotAcknowledged reconciliation gating in xmc-bridge (Layer 2 of 4 for b/580941989). Ensures STABLE and PREVIEW components cannot depend on EXPERIMENTAL components and holds upgrades on unacknowledged EXPERIMENTAL components without tearing down running workloads.

Motivation & Context

Even with Kubernetes CRD CEL admission rules in place, defense-in-depth requires the control plane (xmc-bridge and CMS) to enforce stability invariants at runtime:

  1. If an unacknowledged EXPERIMENTAL component reaches xmc-bridge (e.g., via a chart upgrade or pre-existing CR), xmc-bridge must surface Ready=False, Stalled=True, Reason=ExperimentalNotAcknowledged and hold any Helm upgrade without tearing down an already-running workload.
  2. CMS SetComponentIntent must prevent STABILITY_INVERSION both when a STABLE/PREVIEW component declares a dependency on an EXPERIMENTAL component and when an upstream component attempts to downgrade its stability to EXPERIMENTAL while depended upon by an active STABLE/PREVIEW component.

Key Changes

  • pkg/components/store/dependency/dependency_registration.go & pkg/components/store/error_info.go: Added bidirectional ValidateIntentStability returning codes.FailedPrecondition with errdetails.ErrorInfo{Reason: "STABILITY_INVERSION", Domain: "components.xmc.dev"}, wired into both MemoryStore and dbstore.Store (inside RunInSerializableTransaction).
  • pkg/components/store/field_mask.go & pkg/components/store/lifecycle/health_aggregator.go: Added stability and acknowledge_experimental support to SetComponentIntent field masks and ComponentPredicate.stability filtering (UNSPECIFIED normalized to STABLE).
  • pkg/components/cms/server.go: Added enum range validation for ComponentSpec.stability in SetComponentIntent.
  • pkg/components/bridge/{spec_parser.go,conditions.go,lifecycle.go,reconciler.go}: Parsed spec.stability and spec.acknowledgeExperimental from Component CRs, gated unacknowledged EXPERIMENTAL components with ReasonExperimentalNotAcknowledged (Stalled=True, holding upgrades while preserving running workloads and access coordinates), and mapped CMS ReasonStabilityInversion rejections to ReasonStabilityInversion (Stalled=True, Requeue=false).

Assumptions

  • Bidirectional STABILITY_INVERSION Enforcement: SetComponentIntent checks both upstream dependencies of the target component and downstream active dependents in the catalog so stability inversion cannot be introduced by reversing registration/update order.
  • Hold-Upgrade Semantics: When an already-actuated component transitions to an unacknowledged EXPERIMENTAL spec, xmc-bridge preserves existing DependenciesReady and Access coordinates and skips actuateAndEvaluate (reconcileDisabled is not called), keeping the existing workload running.

Verification & Testing

  • Commands Executed:
    • bazel test //pkg/components/... (21/21 test targets passed)
    • ./.githooks/pre-commit (92/92 affected Bazel test targets passed)
  • Live GKE Cluster Verification (... with enable_components: true):
    • Applied an acknowledged EXPERIMENTAL component (test-exp-ack) followed by a STABLE component (test-stable-dep) depending on test-exp-ack; verified xmc-bridge received STABILITY_INVERSION from CMS and set Ready=False, Stalled=True, Reason=StabilityInversion with message stability inversion: STABLE component "test-stable-dep" cannot depend on EXPERIMENTAL component "test-exp-ack".

Related Issues / Bugs

Fixes bug 580941989

TAG=agy
CONV=bfd7efa2-aaa4-46db-a3f1-59cc171656b6


Stack created with GitHub Stacks CLI • Give Feedback 💬

@VLukiantsev
VLukiantsev added this pull request to stack #1542 November 2, 2026 21:02

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces stability gating for components, adding support for EXPERIMENTAL stability levels and preventing stability inversions (e.g., stable components depending on experimental ones). It updates the reconciler, spec parser, CMS server, and store implementations to validate stability rules and reject invalid configurations, while also updating GetPlatformHealth to support filtering by stability. Feedback on the changes highlights the need to normalize the parsed stability string to uppercase and trim whitespace to avoid silent validation bypasses, as well as adding nil checks on component specs in dependency registration to prevent potential nil pointer dereference panics.

Comment thread pkg/components/bridge/spec_parser.go Resolved
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces component stability tiers (EXPERIMENTAL, PREVIEW, STABLE) and enforces stability rules, such as preventing stability inversion and requiring explicit acknowledgment for experimental components. It updates the reconciler, lifecycle, spec parser, and database store, and adds corresponding unit tests. Feedback highlights a potential bug in wasComponentPreviouslyActive where the new gating reasons could cause active workloads to be incorrectly reported as not running, and suggests making parseStability case-insensitive to ensure robust parsing.

Comment thread pkg/components/bridge/lifecycle.go Resolved
Comment thread pkg/components/bridge/spec_parser.go Resolved
@VLukiantsev
VLukiantsev force-pushed the feat/component-stability-cms-bridge-b580941989 branch from c14d89d to aafb5ff Compare November 2, 2026 21:30
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces component stability tiers (STABLE, PREVIEW, EXPERIMENTAL) and implements stability inversion validation to prevent stable or preview components from depending on experimental ones. It also adds support for filtering platform health by stability and requires explicit acknowledgment for enabling experimental components. The review feedback suggests improving parsing consistency in spec_parser.go by supporting both snake_case and camelCase variants for the acknowledge_experimental field, matching the behavior in field_mask.go.

Comment thread pkg/components/bridge/spec_parser.go Resolved
@VLukiantsev
VLukiantsev force-pushed the feat/component-stability-cms-bridge-b580941989 branch 4 times, most recently from d23ea84 to cd3d9fc Compare November 3, 2026 09:05
@VLukiantsev
VLukiantsev marked this pull request as ready for review November 3, 2026 09:20
@VLukiantsev VLukiantsev added the priority::2-high top of mind. should not wait. label Nov 3, 2026
Comment thread pkg/components/bridge/lifecycle.go Resolved
Comment thread pkg/components/README.md Resolved
janzak-dev
janzak-dev previously approved these changes Nov 3, 2026
… and bridge (b/580941989)

Add CMS and xmc-bridge enforcement for the Component Stability Contract:
- Validate ComponentStability enum values in CMS SetComponentIntent and apply field_mask updates for stability and acknowledge_experimental.
- Enforce bidirectional STABILITY_INVERSION rules in dependency.ValidateIntentStability (forbidding STABLE/PREVIEW components from depending on EXPERIMENTAL components or downgrading active dependencies to EXPERIMENTAL).
- Support stability filtering in GetPlatformHealth (treating UNSPECIFIED as STABLE) and wire dbstore.GetPlatformHealth to ListActiveComponents.
- Parse spec.stability and spec.acknowledgeExperimental in bridge.ParseSpecFromUnstructured and enforce defense-in-depth ExperimentalNotAcknowledged gating in xmc-bridge without tearing down running workloads on live flips.

TAG=agy
…tate when gated

Normalize stability strings (uppercase + trim) in parseStability, add explicit
nil Spec guards in ValidateIntentStability, and append the running-workload
suffix in reportGated so wasComponentPreviouslyActive preserves actuation state
across multiple gated passes for components without dependencies.

TAG=agy
CONV=bfd7efa2-aaa4-46db-a3f1-59cc171656b6
Accepts both camelCase (acknowledgeExperimental) and snake_case (acknowledge_experimental) keys in ParseSpecFromUnstructured for consistency with field_mask.go.

TAG=agy
CONV=bfd7efa2-aaa4-46db-a3f1-59cc171656b6
…-in-depth gating

Documents CMS stability inversion validation and xmc-bridge ExperimentalNotAcknowledged / holdUpgrade semantics in pkg/components/README.md, cmd/xmc_bridge/README.md, and docs/architecture/components.md.

TAG=agy
CONV=bfd7efa2-aaa4-46db-a3f1-59cc171656b6
- Expand TestWasComponentPreviouslyActive table cases in
  pkg/components/bridge/lifecycle_test.go for ReasonExperimentalNotAcknowledged
  and ReasonStabilityInversion (with and without runningWorkloadHeldSuffix),
  and update the wasComponentPreviouslyActive doc comment in lifecycle.go.
- Add normalization ("  experimental  ") and unrecognized ("INVALID_TIER")
  stability test cases to TestParseSpecFromUnstructured_Stability in
  pkg/components/bridge/spec_parser_test.go.
- Deduplicate enum string matching in
  pkg/components/store/lifecycle/health_aggregator.go via matchesProtoEnum.
- Fix ErrorWithInfo constructor name and remove stale legacy prefix note in
  pkg/components/README.md.

Comment link: #1539 (comment)
Comment link: #1539 (comment)
Comment link: #1539 (comment)
Comment link: #1539 (comment)
Fixes bug 580941989

TAG=agy
CONV=bfd7efa2-aaa4-46db-a3f1-59cc171656b6
@VLukiantsev
VLukiantsev force-pushed the feat/component-stability-cms-bridge-b580941989 branch from d82553e to 891e978 Compare November 3, 2026 11:57

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Incremental PR Approval

Clean rebase detected with zero semantic patch lines changed.

Preserving prior approval by @janzak-dev on commit d82553e.

@VLukiantsev
VLukiantsev added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 0c5fa28 Nov 3, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority::2-high top of mind. should not wait.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants