Skip to content

[Devant Migration] Implement Link a repository, Add orgs and repos in import flow features#754

Open
SandaminiM wants to merge 5 commits into
wso2:devant-migrationfrom
SandaminiM:devant-migration
Open

[Devant Migration] Implement Link a repository, Add orgs and repos in import flow features#754
SandaminiM wants to merge 5 commits into
wso2:devant-migrationfrom
SandaminiM:devant-migration

Conversation

@SandaminiM

Copy link
Copy Markdown

Purpose

$subject

resolves:

Refer to the followings:

2026-07-17.13-26-27.mp4
2026-07-17.13-27-28.mp4

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

@SandaminiM
SandaminiM requested review from gabilang and sm1990 July 17, 2026 08:02
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7bcb8ab9-7d82-44d6-b1e8-182c64855d4a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR adds credential-based Git provider support to project creation, import, and repository-linking flows. It propagates secretRef through repository APIs, React Query hooks, GraphQL requests, REST requests, and project/component mutations. New credential selectors, authorization dialogs, GitHub management actions, provider-specific repository URL construction, shared repository-source state, and project repository-linking APIs are introduced. Provider selections can now route into import flows, and project pages use the new repository-linking dialog.

Sequence Diagram(s)

sequenceDiagram
  participant CreateOrImportPage
  participant useGitRepoSource
  participant CredentialSelectCard
  participant RepositoryAPI
  participant ProjectOrComponentAPI
  CreateOrImportPage->>CredentialSelectCard: select or add provider credential
  CredentialSelectCard->>useGitRepoSource: set selected credential
  useGitRepoSource->>RepositoryAPI: fetch repositories with secretRef
  RepositoryAPI-->>useGitRepoSource: return repositories and branches
  CreateOrImportPage->>ProjectOrComponentAPI: submit provider, URL, and secretRef
  ProjectOrComponentAPI-->>CreateOrImportPage: return created project or component
Loading

Suggested reviewers: sm1990, gabilang

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description mostly contains template placeholders; only Purpose has issue links and the required sections are not filled in. Fill in Goals, Approach, User stories, Release note, Documentation, tests, security checks, samples, migrations, and test environment with concrete details.
Docstring Coverage ⚠️ Warning Docstring coverage is 24.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is related to the main change and summarizes repository linking and import-flow updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SandaminiM

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ipaas/src/pages/ImportProject.tsx (1)

122-140: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not block importing when the availability check fails.

When this request errors, availability remains undefined and canSubmit stays false. Destructure availabilityError and treat it as ready, matching CreateProject.

Proposed fix
-  const { handler: effectiveHandler, handlerEdited, isCheckingAvailability, availability, startEditing, stopEditing, onHandlerChange } = useProjectHandler(displayName);
+  const { handler: effectiveHandler, handlerEdited, isCheckingAvailability, availability, availabilityError, startEditing, stopEditing, onHandlerChange } = useProjectHandler(displayName);

-  const availabilityReady = !effectiveHandler || effectiveHandler.length < 2 || availability !== undefined;
+  const availabilityReady = !effectiveHandler || effectiveHandler.length < 2 || availability !== undefined || availabilityError;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ipaas/src/pages/ImportProject.tsx` around lines 122 - 140, Update
ImportProject’s useProjectHandler destructuring to include availabilityError,
then adjust availabilityReady so an availability request error is treated as
ready alongside a completed availability result. Keep the existing validation
and submission checks unchanged, matching the readiness behavior in
CreateProject.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ipaas/src/api/cloud/projects.ts`:
- Around line 97-99: Update linkProjectRepository to use the mandated ni() stub
helper instead of directly throwing an Error, matching the existing pattern used
by the ICP stub and preserving the unsupported-operation behavior.

In `@ipaas/src/components/ProjectCreate/GitProviderCards.tsx`:
- Around line 74-79: Update the onSelect handler in credentialCard so it passes
the selected credential’s actual provider type derived from c.type, rather than
always using the card’s provider value. Preserve the existing credential
selection flow while ensuring Bitbucket Server credentials retain their server
provider and repository URL behavior.

In `@ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx`:
- Line 198: Update the repository URL, organization, and repository change
handlers in LinkRepositoryDialog to clear both the selected branch and directory
whenever the repository source changes. Preserve the new source value while
resetting these dependent selections so stale values cannot be submitted.
- Around line 178-184: Update the GitHub authorization UI around isGitHub and
authStatus so only an actively authorizing state shows the indefinite
CircularProgress; render the appropriate retry or installation actions for idle,
failed, and needs-install states, preferably by reusing GitHubAuthArea. Preserve
the completed state behavior.
- Around line 125-131: Normalize directoryPath in the link-repository mutation
payload to match the creation flows: represent the root directory as an empty
string and remove any leading slash from non-root paths. Update the
directoryPath field in the payload while leaving the surrounding repository and
provider fields unchanged.

In `@ipaas/src/pages/ImportIntegration.tsx`:
- Around line 124-132: Update the isAuthenticated calculation in
ImportIntegration to derive authentication from a successful repository query
rather than requiring userRepos.length > 0, so authorized accounts with empty
repository lists remain authenticated. Preserve the existing public-repository
behavior and use the query’s success state alongside the existing loading/error
state as appropriate.
- Around line 314-319: Update the source URL construction in the integration
payload to use selectedCredential.type when isCredentialMode is enabled, while
retaining credProvider for other modes. Ensure buildRepoUrl recognizes
BITBUCKET_SERVER and uses the selected credential’s serverUrl when constructing
that provider’s URL; preserve existing GitHub and Bitbucket Cloud behavior.

In `@ipaas/src/utils/gitProviderUrl.test.ts`:
- Around line 23-38: Add a regression test in the buildRepoUrl suite for
GitProvider.BITBUCKET_SERVER using a self-managed server URL, and assert it
produces the expected Bitbucket Server repository URL rather than the GitHub
default. Follow the existing GitLab self-managed test pattern and preserve the
current coverage for other providers.

In `@ipaas/src/utils/gitProviderUrl.ts`:
- Around line 27-36: Update buildRepoUrl to add a dedicated
GitProvider.BITBUCKET_SERVER case that constructs the correct Bitbucket Server
repository URL instead of using the GitHub fallback. Add a regression test in
ipaas/src/utils/gitProviderUrl.test.ts covering this provider and expected URL;
no direct change is required in ipaas/src/pages/Project.tsx because it is only
an affected caller.

---

Outside diff comments:
In `@ipaas/src/pages/ImportProject.tsx`:
- Around line 122-140: Update ImportProject’s useProjectHandler destructuring to
include availabilityError, then adjust availabilityReady so an availability
request error is treated as ready alongside a completed availability result.
Keep the existing validation and submission checks unchanged, matching the
readiness behavior in CreateProject.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c364004-4d39-44a4-b4d9-72533a4a6ae0

📥 Commits

Reviewing files that changed from the base of the PR and between 0973e0d and 1d7dc4b.

📒 Files selected for processing (38)
  • ipaas/public/config.json
  • ipaas/src/api/cloud/projects.ts
  • ipaas/src/api/contracts.ts
  • ipaas/src/api/icp/projects.ts
  • ipaas/src/api/wip/components.ts
  • ipaas/src/api/wip/credentials.ts
  • ipaas/src/api/wip/projects.ts
  • ipaas/src/api/wip/repository.ts
  • ipaas/src/components/Import/CredentialSelectCard.tsx
  • ipaas/src/components/Import/GitHubAuthArea.tsx
  • ipaas/src/components/Import/gitHubSelectActions.tsx
  • ipaas/src/components/IntegrationCreate/TechDetectionIcon.tsx
  • ipaas/src/components/ProjectCreate/GitProviderCards.tsx
  • ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx
  • ipaas/src/components/Settings/Credentials/AddCredentialDialog.tsx
  • ipaas/src/constants/gitProviders.tsx
  • ipaas/src/constants/import.tsx
  • ipaas/src/constants/project.ts
  • ipaas/src/hooks/useCredentials.ts
  • ipaas/src/hooks/useGitHubAuth.ts
  • ipaas/src/hooks/useGitRepoSource.ts
  • ipaas/src/hooks/useProjectHandler.ts
  • ipaas/src/hooks/useProjects.ts
  • ipaas/src/hooks/useRepository.ts
  • ipaas/src/pages/CreateIntegrationOptions.tsx
  • ipaas/src/pages/CreateProject.tsx
  • ipaas/src/pages/ImportIntegration.tsx
  • ipaas/src/pages/ImportProject.tsx
  • ipaas/src/pages/Project.tsx
  • ipaas/src/paths.ts
  • ipaas/src/types/component.ts
  • ipaas/src/types/credentials.ts
  • ipaas/src/types/import.ts
  • ipaas/src/types/project.ts
  • ipaas/src/utils/gitCredentials.test.ts
  • ipaas/src/utils/gitCredentials.ts
  • ipaas/src/utils/gitProviderUrl.test.ts
  • ipaas/src/utils/gitProviderUrl.ts

Comment thread ipaas/src/api/cloud/projects.ts Outdated
Comment thread ipaas/src/components/ProjectCreate/GitProviderCards.tsx Outdated
Comment thread ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx
Comment thread ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx Outdated
Comment thread ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx Outdated
Comment thread ipaas/src/pages/ImportIntegration.tsx
Comment thread ipaas/src/pages/ImportIntegration.tsx Outdated
Comment thread ipaas/src/utils/gitProviderUrl.test.ts
Comment thread ipaas/src/utils/gitProviderUrl.ts
@SandaminiM

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx`:
- Around line 179-180: Update the conditional rendering around GitHubAuthArea so
it also renders when authorization is complete but repository loading returns no
usable repositories or an error. Preserve the existing auth-status behavior and
pass the completed-state data needed for GitHubAuthArea to show its warning and
reconnect action.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ae74203e-3aee-402d-9d53-3d01a6eb2518

📥 Commits

Reviewing files that changed from the base of the PR and between 1d7dc4b and c4f11c2.

📒 Files selected for processing (13)
  • ipaas/src/api/cloud/projects.ts
  • ipaas/src/api/wip/repository.ts
  • ipaas/src/components/Import/CredentialSelectCard.tsx
  • ipaas/src/components/ProjectCreate/GitProviderCards.tsx
  • ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx
  • ipaas/src/components/Settings/Credentials/AddCredentialDialog.tsx
  • ipaas/src/constants/gitProviders.tsx
  • ipaas/src/pages/CreateProject.tsx
  • ipaas/src/pages/ImportIntegration.tsx
  • ipaas/src/pages/ImportProject.tsx
  • ipaas/src/utils/gitCredentials.test.ts
  • ipaas/src/utils/gitProviderUrl.test.ts
  • ipaas/src/utils/gitProviderUrl.ts
💤 Files with no reviewable changes (1)
  • ipaas/src/constants/gitProviders.tsx
🚧 Files skipped from review as they are similar to previous changes (11)
  • ipaas/src/utils/gitProviderUrl.ts
  • ipaas/src/api/cloud/projects.ts
  • ipaas/src/utils/gitCredentials.test.ts
  • ipaas/src/utils/gitProviderUrl.test.ts
  • ipaas/src/components/Import/CredentialSelectCard.tsx
  • ipaas/src/components/ProjectCreate/GitProviderCards.tsx
  • ipaas/src/api/wip/repository.ts
  • ipaas/src/components/Settings/Credentials/AddCredentialDialog.tsx
  • ipaas/src/pages/ImportProject.tsx
  • ipaas/src/pages/CreateProject.tsx
  • ipaas/src/pages/ImportIntegration.tsx

Comment thread ipaas/src/components/ProjectCreate/LinkRepositoryDialog.tsx Outdated
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.

1 participant