Repository navigation
Conversation
WithSuppliedComposites adds caller-supplied composites, keyed by Composition name, to the discovered or scoped set. A supplied composite with a discovered one's identity replaces it, so it renders once. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Pick each input's Composition the way Crossplane does: compositionRef, compositionSelector, the XRD's defaultCompositionRef, then the sole Composition of the composite type. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Errors about project simulate's --resource-file inputs say so; xr and composition simulate keep saying -f. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
An XR of a v1 XRD and a claim read compositionRef and compositionSelector under spec only; a v2 XR prefers spec.crossplane, as the engine does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Run checks the inputs against the cluster's XRDs once the clients initialize, assigns each to a project Composition and hands them to the Composition diff processor. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Project simulate without --resource-file appends a note for each created Composition no composite would adopt, pointing at --resource-file. -o diff prints it to stderr. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
--namespace now defaults the namespace of inputs that set none, duplicate input identities fail, and an XRD's enforcedCompositionRef wins as in Crossplane. The ambiguous-selector test now exercises the selector. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
A --resource-file composite the cluster lacks no longer counts as re-pointing, and is not deferred for a Manual policy since a new composite takes the latest revision. Supplied composites render even when impact analysis is skipped, and a live composite supplied under another Composition renders once, there. Impacts mark them Supplied. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Skipped-analysis messages now confine their claim to the cluster's composites and name the supplied composites that were rendered, and the diff renderer lists those composites rather than only the filtered ones. Composite lines and plan headers carry (from --resource-file). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Skip the duplicate check for inputs with no name, read the XRD's enforcedCompositionRef in a test, and test the --namespace wiring through inputNamespace. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Under a skipped impact analysis with --resource-file composites, -o diff now prints the filtered-composites line before the rendered list, and the skip message keeps its --analyze-on remedy. ImpactAnalysisSkipped docs note the supplied exception. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
A --resource-file composite not discovered under the run is now looked up in the cluster, so a live one that --resource, --namespace or a Composition outside the run leaves out keeps its update policy and counts as re-pointing. A lookup error is reported as that composite's error. A net-new claim's backing XR is net-new too, so a Manual claim renders with the predicted revision. Composites with only a generateName are never matched or looked up. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
DiffProcessor stays within interfacebloat's limit; the composition processor asserts ClusterCompositeGetter where it needs the lookup. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Drops the optional ClusterCompositeGetter interface, its type assertion and the unreachable fallback branch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Replaces suppliedIdentity and the parallel diff-key maps (lookupErr, netNewKeys' string keys) with result.CompositeKey, so liveness, merge and net-new lookups share one key that internal/simulate can reuse. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Export XRTypeFromXRD and NestedCrossplaneValue from the diff Crossplane client and use them in assign.go, use labels.SelectorFromSet for the selector match, key the duplicate check by result.CompositeKey, and use the testutils Composition builder. A claim now composes its XRD's first referenceable version, and an XRD without group or kind fails. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
An empty selector value again matches a Composition lacking the label. crossplaneField drops its unused type name and names the v2 API version. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Reporting the unresolved claims under a skip, from main, pushed processSingleComposition over the gocognit limit. The check right after the skip already returns when no supplied composite is left to render. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
A --resource-file XR rarely names the compositionRevisionRef Crossplane wrote, so a Manual one replacing a live pinned XR was classified as re-pointing while it rendered as pinned. Read its pin via pinnedRevision, as for claims, and restore the fixtures that model this. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…nalysis Keep the unresolved entries when the analysis is skipped, so a supplied claim whose pin could not be read gets main's error instead of a render. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
… composite A --resource-file XR that omits compositionUpdatePolicy over a live Manual XR was classified Automatic and re-pointed, while render inherits Manual from the cluster and stays pinned. Read both the policy and the ref from the effective composite, resolved once; a policy the file sets still wins, as in render. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
The effective-composite wording belongs to a live supplied XR, whose pin is now read in classifyXR; pinnedRevision serves claims alone, so it reports the backing XR of the claim, as on main. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
jcogilvie
force-pushed
the
jco-shared-composition-selection
branch
from
November 25, 2026 15:13
08d076c to
19bd296
Compare
4 of 6 tasks
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
…ite throughout Match the selector against the effective composite, so a file naming no policy over a live Manual XR ignores its selector as render does. Read a live supplied claim's policy and pin from its backing XR, resolved once and with main's wording. Resolve a live supplied composite only when the file leaves its pin open: no policy, or Manual with no ref. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…ifyXR Keeps classifyXR under the cognitive-complexity limit. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…mposition refs Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…ders Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…ion client builder Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
…ared helpers Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
One generic function owns the order (the XRD's enforcedCompositionRef, compositionRef, compositionSelector, the XRD's defaultCompositionRef, then the type) and the field reads; callers back each step with a CompositionLookup over their own Compositions. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
FindMatchingComposition now applies the XRD's enforcedCompositionRef and defaultCompositionRef, as Crossplane does, resolving their revisions as for a compositionRef. project simulate's selection is unchanged. A shared table checks both paths pick the same Composition. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Crossplane applies defaultCompositionRef only to a composite with no compositionSelector at all. Also pass Malformed's field separately so it can't index an empty path. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
runCompositionFor took the run's Composition named in compositionRef before consulting the XRD, bypassing enforcedCompositionRef. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
jcogilvie
force-pushed
the
jco-shared-composition-selection
branch
from
November 25, 2026 17:44
19bd296 to
a715711
Compare
…uilder Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.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.
Description of your changes
Note
This builds on #601 and includes its commits until #601 merges. Only the last 9 commits are new: compare view. I'll rebase onto
mainonce #601 merges.The CLI picks a Composition for a composite in two places:
FindMatchingCompositionin the diff client, for composites in the cluster (xr simulate, and the diff engine), andselectComposition, forproject simulate --resource-fileinputs against the project's Compositions (#601). Both have to follow Crossplane's selection order, and they had drifted. The cluster path ignored the XRD'senforcedCompositionRefanddefaultCompositionRef, soxr simulatecould preview a different Composition than Crossplane would select.This adds
SelectComposition(internal/diff/client/crossplane/composition_select.go). It owns the order and the field reads: the XRD's enforced ref, then the composite'scompositionRef, itscompositionSelector, the XRD's default ref, then the only Composition of its type. Each caller supplies aCompositionLookupfor its own source:Behaviour changes for
xr simulate:enforcedCompositionRefanddefaultCompositionRef, resolving their revisions as it does forcompositionRef. A nested composite's enforced Composition also overrides itscompositionRef.compositionSelectorthat is present but empty skips the default ref, as in Crossplane. With several Compositions of the type that's an error, since Crossplane would pick one at random. A null selector still uses the default.compositionRef.nameor selector label that isn't a string is now an error ("cannot read compositionRef/compositionSelector for ") instead of being skipped or dropped. The project path and the diff engine already rejected these.compositionRefis read at its XRD's v1 or v2 path, not inferred from the composite's apiVersion.Otherwise selections and messages are unchanged.
NewCompDiffProcessornow takes aDefinitionClient.Tests:
TestSelectComposition: a recording fake lookup covers every precedence step, empty and null selectors, and malformed fields, on v1 and v2 XRDs.TestSelectionMatchesCluster: the same inputs run through both lookups and must pick the same Composition.FindMatchingCompositionandrunCompositionForgain rows for enforced and default refs, malformed fields and legacy nested composites.go test ./...,go test -tags integration -p 1 ./...andgolangci-lint run ./...pass locally.I have:
./nix.sh flake checkto ensure this PR is ready for review.Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.
🤖 Generated with Claude Code