feat(comp): add eventual state to comp command; fix ineffective test#319
Merged
Conversation
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adds --eventual-state support to the comp command so composition impact analysis can simulate iterative reconciliation (surfacing later-stage resources gated by e.g. function-sequencer), and updates/extends integration tests + fixtures to validate the behavior.
Changes:
- Add
--eventual-stateflag tocrossplane-diff compand wire it into the shared diff processor options. - Expand integration tests to cover staged gating behavior for both
xrandcompwith/without eventual-state, and add structured JSON assertions forcompoutput. - Add documentation and new test fixtures (compositions, revisions, XRs) to support the new scenarios.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/diff/comp.go | Adds --eventual-state flag to comp and passes it into processor options. |
| cmd/diff/diff_integration_test.go | Extends harness and adds paired tests validating eventual-state behavior for xr and comp. |
| README.md | Documents --eventual-state usage and updates flag descriptions. |
| cmd/diff/testdata/diff/resources/* | Adds/updates compositions, revisions, and XR fixtures for gating/eventual-state scenarios. |
| cmd/diff/testdata/comp/* | Adds updated composition fixtures and pre-existing XR fixtures for comp impact tests. |
| .serena/project.yml | Updates Serena project configuration comments and adds additional_workspace_folders. |
| .requirements/.../REQUIREMENTS.md | Adds requirements/plan documentation for the feature (design record). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expectedStructuredOutput *tu.ExpectedDiff // for XR JSON output assertions | ||
| expectedStructuredCompOutput *tu.ExpectedCompDiff // for comp JSON output assertions | ||
| } | ||
|
|
Comment on lines
+314
to
+317
| if tt.outputFormat == "json" && tt.expectedStructuredCompOutput != nil { | ||
| tu.AssertStructuredCompDiff(t, outputStr, tt.expectedStructuredCompOutput) | ||
| return | ||
| } |
Comment on lines
+49
to
+69
| {{- with .observed.resources -}} | ||
| {{- with (index . "stage0-resource") -}} | ||
| {{- with .resource.status.conditions -}} | ||
| {{- range . -}} | ||
| {{- if and (eq .type "Ready") (eq .status "True") }} | ||
| --- | ||
| apiVersion: ns.nop.example.org/v1alpha1 | ||
| kind: XDownstreamResource | ||
| metadata: | ||
| name: 1-stage1-resource | ||
| namespace: {{ $.observed.composite.resource.metadata.namespace }} | ||
| annotations: | ||
| gotemplating.fn.crossplane.io/composition-resource-name: stage1-resource | ||
| spec: | ||
| forProvider: | ||
| configData: {{ $.observed.composite.resource.spec.coolField }} | ||
| {{- end -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
| {{- end -}} |
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Comment on lines
+183
to
+185
| --max-iterations=20 Maximum render iterations for requirements resolution | ||
| or eventual-state simulation. Increase for complex | ||
| pipelines that need more cycles to converge. |
Comment on lines
56
to
60
| ignorePaths []string // Paths to ignore in diffs | ||
| functionCredentials string // Path to function credentials file (optional) | ||
| eventualState bool // For XR tests: enable eventual state simulation (optional) | ||
| timeout time.Duration // Custom timeout for this test (0 = use default) | ||
| skip bool |
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
Fixes #318
I have:
earthly -P +reviewableto ensure this PR is ready for review.Added or updated e2e tests.(Added and fixed some ITs)Followed the API promotion workflow if this PR introduces, removes, or promotes an API.Need help with this checklist? See the cheat sheet.