Skip to content

Conversation

@lucasgoral
Copy link
Contributor

What this PR does / why we need it:
Edit MCP - Crossplane providers: Handle prefix correctly and do not drop unknown providers. Refactored hook that handles it

Copilot AI review requested due to automatic review settings December 23, 2025 10:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the hook that handles Crossplane provider selection to correctly handle provider naming prefixes and prevent dropping unknown providers. The changes address the issue where providers can be stored in the API without the provider- prefix (e.g., btp) while the component list includes them with the prefix (e.g., provider-btp).

Key changes:

  • Added originalName field to track the provider name as stored in the API
  • Refactored provider matching logic to handle both prefixed and non-prefixed provider names
  • Preserved unknown/custom providers that aren't in the available components list
  • Extracted complex logic into well-tested helper functions for better maintainability

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/lib/api/types/crate/createManagedControlPlane.ts Added originalName field to ComponentsListItem interface and updated provider mapping to use it for API requests
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.ts Refactored the hook by extracting helper functions for provider prefix handling, component mapping, validation, and custom provider addition
src/components/Wizards/CreateManagedControlPlane/useComponentsSelectionData.spec.ts Added comprehensive test coverage for all new helper functions and edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lucasgoral lucasgoral merged commit d2a4ef1 into main Jan 5, 2026
5 checks passed
@lucasgoral lucasgoral deleted the providers-edit-fix branch January 5, 2026 14:37
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.

3 participants