Skip to content

feat(xr): add --xrd to xr generate to resolve the kind from the XR - #616

Open
tampakrap wants to merge 1 commit into
crossplane:mainfrom
tampakrap:theo/feat_xr_generate_xrd
Open

tampakrap wants to merge 1 commit into
crossplane:mainfrom
tampakrap:theo/feat_xr_generate_xrd

Conversation

@tampakrap

Copy link
Copy Markdown
Collaborator

Description of your changes

Resolve the kind of the generated XR from the XRD that owns the Claim, instead of guessing "X" plus the Claim's kind, which is only a naming convention. --xrd and --kind are mutually exclusive.

Related:

I have:

  • Read and followed Crossplane's contribution process.
  • Read and followed Crossplane's AI policy and confirmed a human stands behind this PR.
  • Run ./nix.sh flake check to ensure this PR is ready for review.
  • Added or updated unit tests.
  • Linked a PR or a docs tracking issue to document this change.
  • Added backport release-x.y labels to auto-backport this PR.

Need help with this checklist? See the cheat sheet.

@tampakrap
tampakrap requested review from adamwg and haarchri November 26, 2026 12:04
@tampakrap
tampakrap requested review from a team and jcogilvie as code owners November 26, 2026 12:04
@tampakrap
tampakrap requested review from jbw976 and a balanced review from Copilot and removed request for a team November 26, 2026 12:04

Copilot AI 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.

🟡 Changes recommended

The XRD input is not validated for a nonempty kind, so an empty or incorrect document can cause generation to succeed with an invalid XR instead of an actionable error.

1 open issue
What changed in this PR

Adds XRD-based kind resolution to xr generate, allowing Claim conversion to use the declared composite kind rather than relying on the X prefix convention.

Changes:

  • Adds --xrd, mutually exclusive with --kind.
  • Centralizes kind resolution with precedence: explicit kind, XRD kind, then the existing naming fallback.
  • Adds resolution tests and a CLI usage example.
File Description
pkg/​xr/​claim.go Adds XRD input and shared kind-resolution logic.
pkg/​xr/​claim_test.go Tests kind-resolution precedence and fallback.
cmd/​crossplane/​xr/​help/​generate.md Documents generation using --xrd.
cmd/​crossplane/​xr/​generate.go Adds the flag, loads the XRD, and passes it to conversion.

Review effort: Balanced

Comment thread pkg/xr/claim.go Resolved
@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.84615% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.42%. Comparing base (14a9f58) to head (fe66b54).

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 12:42

Copilot AI 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.

🟡 Changes recommended

Converter tests do not pass Options.XRD to verify a composite kind differing from "X" + claimKind or rejection of an empty kind, leaving the new wiring and error path unprotected against regressions.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread pkg/xr/claim.go Resolved
Copilot AI balanced review requested due to automatic review settings November 26, 2026 12:46

Copilot AI 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.

🟢 Approval recommended

No active review issues are recorded for the change adding XRD-based kind resolution to composite resource generation.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 12:49
@tampakrap
tampakrap force-pushed the theo/feat_xr_generate_xrd branch from 05dcfb0 to 92916a7 Compare November 26, 2026 12:50

Copilot AI 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.

🟢 Approval recommended

No active review issues block the change enabling generated composite resources to use XRD-defined kinds.

1 open issue

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 12:51
@tampakrap
tampakrap force-pushed the theo/feat_xr_generate_xrd branch from 92916a7 to 0c4a2db Compare November 26, 2026 12:52

Copilot AI 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.

🟢 Approval recommended

No active review issues block approval of the XRD-based kind resolution change.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 12:53

Copilot AI 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.

🟢 Approval recommended

No active review issues block the XRD-based kind-resolution change.

No open issues 🎉

Review effort: Balanced

Resolve the kind of the generated XR from the XRD that owns the Claim,
instead of guessing "X" plus the claim's kind, which is only a naming
convention. --xrd and --kind are mutually exclusive.

Signed-off-by: Theo Chatzimichos <tampakrap@gmail.com>
@tampakrap
tampakrap force-pushed the theo/feat_xr_generate_xrd branch from 0c4a2db to fe66b54 Compare November 26, 2026 13:01
Copilot AI balanced review requested due to automatic review settings November 26, 2026 13:01

Copilot AI 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.

🟢 Approval recommended

No active review issues block approval of the XRD-aware resource generation change.

No open issues 🎉

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants