Repository navigation
feat(components): enforce stability gating and inversion rules in CMS and bridge (b/580941989) - #1539
Conversation
There was a problem hiding this comment.
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.
|
/gemini review |
There was a problem hiding this comment.
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.
c14d89d to
aafb5ff
Compare
|
/gemini review |
There was a problem hiding this comment.
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.
d23ea84 to
cd3d9fc
Compare
… 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
d82553e to
891e978
Compare
There was a problem hiding this comment.
🤖 Incremental PR Approval
Clean rebase detected with zero semantic patch lines changed.
Preserving prior approval by @janzak-dev on commit d82553e.
Summary
Implements CMS
STABILITY_INVERSIONvalidation,ComponentPredicate.stabilityfiltering, and defense-in-depthExperimentalNotAcknowledgedreconciliation gating inxmc-bridge(Layer 2 of 4 forb/580941989). EnsuresSTABLEandPREVIEWcomponents cannot depend onEXPERIMENTALcomponents and holds upgrades on unacknowledgedEXPERIMENTALcomponents without tearing down running workloads.Motivation & Context
Even with Kubernetes CRD CEL admission rules in place, defense-in-depth requires the control plane (
xmc-bridgeand CMS) to enforce stability invariants at runtime:EXPERIMENTALcomponent reachesxmc-bridge(e.g., via a chart upgrade or pre-existing CR),xmc-bridgemust surfaceReady=False, Stalled=True, Reason=ExperimentalNotAcknowledgedand hold any Helm upgrade without tearing down an already-running workload.SetComponentIntentmust preventSTABILITY_INVERSIONboth when aSTABLE/PREVIEWcomponent declares a dependency on anEXPERIMENTALcomponent and when an upstream component attempts to downgrade its stability toEXPERIMENTALwhile depended upon by an activeSTABLE/PREVIEWcomponent.Key Changes
pkg/components/store/dependency/dependency_registration.go&pkg/components/store/error_info.go: Added bidirectionalValidateIntentStabilityreturningcodes.FailedPreconditionwitherrdetails.ErrorInfo{Reason: "STABILITY_INVERSION", Domain: "components.xmc.dev"}, wired into bothMemoryStoreanddbstore.Store(insideRunInSerializableTransaction).pkg/components/store/field_mask.go&pkg/components/store/lifecycle/health_aggregator.go: Addedstabilityandacknowledge_experimentalsupport toSetComponentIntentfield masks andComponentPredicate.stabilityfiltering (UNSPECIFIEDnormalized toSTABLE).pkg/components/cms/server.go: Added enum range validation forComponentSpec.stabilityinSetComponentIntent.pkg/components/bridge/{spec_parser.go,conditions.go,lifecycle.go,reconciler.go}: Parsedspec.stabilityandspec.acknowledgeExperimentalfromComponentCRs, gated unacknowledgedEXPERIMENTALcomponents withReasonExperimentalNotAcknowledged(Stalled=True, holding upgrades while preserving running workloads and access coordinates), and mapped CMSReasonStabilityInversionrejections toReasonStabilityInversion(Stalled=True, Requeue=false).Assumptions
STABILITY_INVERSIONEnforcement:SetComponentIntentchecks 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.EXPERIMENTALspec,xmc-bridgepreserves existingDependenciesReadyandAccesscoordinates and skipsactuateAndEvaluate(reconcileDisabledis not called), keeping the existing workload running.Verification & Testing
bazel test //pkg/components/...(21/21 test targets passed)./.githooks/pre-commit(92/92 affected Bazel test targets passed)...withenable_components: true):EXPERIMENTALcomponent (test-exp-ack) followed by aSTABLEcomponent (test-stable-dep) depending ontest-exp-ack; verifiedxmc-bridgereceivedSTABILITY_INVERSIONfrom CMS and setReady=False, Stalled=True, Reason=StabilityInversionwith messagestability 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 💬