fix(recipe): scope mixin fallback to affected candidates#521
Merged
Conversation
Contributor
Coverage Report ✅
Coverage BadgeMerging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. |
bbb0021 to
a56181c
Compare
When a mixin constraint fails in evaluateMixinConstraints, only exclude the candidate chains that contributed the failing constraint instead of resetting the entire recipe to base-only output. Independent overlays (e.g., monitoring-hpa) that had nothing to do with the failing mixin are now preserved. Key changes: - Build a constraint-to-candidate index so failures target specific chains rather than all applied overlays - Rebuild surviving spec via mergeOverlayChains so shared ancestors remain present when still needed by another surviving leaf - Change ExcludedOverlays from []string to []ExcludedOverlay with a machine-readable Reason field (constraint-failed vs mixin-constraint-failed) - Add backward-compatible UnmarshalYAML/UnmarshalJSON for the legacy string form of excludedOverlays - Update OpenAPI schema and docs with the new structured fields Fixes: #507
b84d740 to
c84ec51
Compare
Contributor
Author
Add additional tests to reover most of the gap. The delta is -0.1%, down from the original -1.43%. The remaining 0.1% is from error paths which would require malformed input that's hard to construct naturally. |
25 tasks
mchmarny
approved these changes
Apr 10, 2026
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
Scope mixin fallback to only the affected candidate chains instead of resetting the entire recipe to base-only output. Add structured
ExcludedOverlaytype with machine-readable reason field.Motivation / Context
When a mixin constraint fails in
evaluateMixinConstraints, the previous behavior excluded all non-base overlays — including unrelated overlays (e.g.,monitoring-hpa) that had nothing to do with the failing mixin.ExcludedOverlaysalso over-reported by including ancestors in the exclusion list.Fixes: #507
Related: #501
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/api,pkg/server)pkg/recipe)pkg/bundler,pkg/component/*)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)Implementation Notes
buildMixinConstraintCandidateIndexmaps each mixin constraint → the specific leaf candidates whose inheritance chains contribute it, so failures target specific chains rather than all applied overlaysmergeOverlayChainsso shared ancestors remain present when still needed by another surviving leaf (the old code used flatMergewhich lost ancestor ordering)ExcludedOverlayschanged from[]stringto[]ExcludedOverlay{Name, Reason}with two reason constants:constraint-failed(pre-merge) andmixin-constraint-failed(post-compose)UnmarshalYAML/UnmarshalJSONaccept both legacy"string"and new{name, reason}object formsevaluateMixinConstraintsnow returnserrorinstead of silently proceeding when constraint mapping failsConstraintWarning.Reasonformat changed from free-text to"mixin-constraint-failed: expected X, got Y"appliedOverlaysordering changes in b200/gb200-training combos due tomergeOverlayChains-based rebuildTesting
metadata_store_test.go:TestMixinConstraintFailureExcludesOnlyAffectedCandidateChainTestMixinConstraintFailurePreservesSharedAncestorsForSurvivingLeafTestEvaluateMixinConstraintsReturnsErrorWhenConstraintCannotBeMappedToCandidateTestEvaluatorFailingLeafExcludesCandidateandTestMixinConstraintFailureExcludesCandidatewith reason assertionsTestHydrateResult/"excluded overlays include reasons"inquery_test.goreader_recipe_compat_test.go(YAML + JSON)Risk Assessment
Rollout notes:
ExcludedOverlaysis now[]ExcludedOverlay(object) instead of[]string. Custom unmarshalers ensure backward compatibility for consumers reading stored recipes in the old format. API consumers will see the new{name, reason}format going forward.Checklist
make testwith-race)make lint)git commit -S) — GPG signing info