Skip to content

ACM-30326 Implement private repo support for AppSet wizard#5789

Open
fxiang1 wants to merge 6 commits intostolostron:mainfrom
fxiang1:feng-appse-support-private-repo
Open

ACM-30326 Implement private repo support for AppSet wizard#5789
fxiang1 wants to merge 6 commits intostolostron:mainfrom
fxiang1:feng-appse-support-private-repo

Conversation

@fxiang1
Copy link
Contributor

@fxiang1 fxiang1 commented Mar 6, 2026

📝 Summary

Ticket Summary (Title):
Implement private repo support for AppSet wizard

  • Added an alert for the Repository step to remind users they need to add credentials for private repos
  • Added link to point to the ArgoCD repo settings page, link will be disabled if no Argo server is selected from the General step
  • Added feature to also lookup any Secrets for ArgoCD private repos, this is used for context suggestions when users are adding the URL and also to load the branch and path info from the private repo
image

Ticket Link:
https://issues.redhat.com/browse/ACM-30326

Type of Change:

  • 🐞 Bug Fix
  • ✨ Feature
  • 🔧 Refactor
  • 💸 Tech Debt
  • 🧪 Test-related
  • 📄 Docs

✅ Checklist

General

  • PR title follows the convention (e.g. ACM-12340 Fix bug with...)
  • Code builds and runs locally without errors
  • No console logs, commented-out code, or unnecessary files
  • All commits are meaningful and well-labeled
  • All new display strings are externalized for localization (English only)
  • (Nice to have) JSDoc comments added for new functions and interfaces

If Feature

  • UI/UX reviewed (if applicable)
  • All acceptance criteria met
  • Unit test coverage added or updated
  • Relevant documentation or comments included

If Bugfix

  • Root cause and fix summary are documented in the ticket (for future reference / errata)
  • Fix tested thoroughly and resolves the issue
  • Test(s) added to prevent regression

🗒️ Notes for Reviewers

Summary by CodeRabbit

  • New Features

    • UI alert and action to configure private repository credentials; wizard surfaces credential-aware guidance.
    • Repository selectors now include credential-backed repository options and can fetch branches/paths using stored credentials.
  • Backend

    • Watch added for repository-type secrets so repo credentials are discoverable.
  • Localization

    • English translations added for repository-credentials messages.
  • Tests

    • Expanded tests covering secret-based URL, branch, and path fetching and edge cases.

fxiang1 added 2 commits March 6, 2026 17:36
Signed-off-by: fxiang1 <fxiang@redhat.com>
Signed-off-by: fxiang1 <fxiang@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Mar 6, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fxiang1

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Mar 6, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2026

📝 Walkthrough

Walkthrough

Adds private repository credential support: backend Secret watcher for Argo CD repository secrets, UI translations and informational alert, Recoil-provided secrets passed into ArgoWizard, secret-aware Git selectors using secret credentials for branch/path lookups, and Argo CD URL helper extended to target specific subpaths.

Changes

Cohort / File(s) Summary
Backend watcher
backend/src/routes/events.ts
Added a Secret watch definition filtered by label argocd.argoproj.io/secret-type=repository.
Translations
frontend/public/locales/en/translation.json
Added translation keys for repository credential guidance and model-specific messages.
Alert UI
frontend/src/components/GitOpsPrivateRepoAlert.tsx
New informational PatternFly alert component with model-specific messaging and an action that opens Argo CD repo settings.
Argo CD navigation helpers
frontend/src/routes/.../diagram-helpers.ts, frontend/src/routes/.../topologyAppSet.ts, frontend/src/routes/.../topologyAppSet.test.ts
Renamed openArgoCDEditoropenArgoCDURL, added optional targetPath to open Argo CD at specific subpaths (e.g., /settings/repos); tests updated accordingly.
Recoil secrets injection
frontend/src/routes/Applications/CreateArgoApplication/CreateApplicationArgo.tsx, .../CreateApplicationArgoPullModel.tsx, .../EditArgoApplicationSet.tsx, frontend/src/shared-recoil.ts
Read secretsState and pass repoSecrets into ArgoWizard; secretsState exported from shared atoms.
Wizard surface
frontend/src/wizards/Argo/ArgoWizard.tsx
Added repoSecrets?: Secret[] prop, aggregate repo URLs from secrets, render GitOpsPrivateRepoAlert, and forward secrets to child selector components.
Generator & source selectors
frontend/src/wizards/Argo/MultipleGeneratorSelector.tsx, .../MultipleSourcesSelector.tsx, .../SourceSelector.tsx
Added secrets: Secret[] prop and forwarded secrets to RepoURL, GitRevisionSelect, GitPathSelect, and related children.
Git selector logic
frontend/src/wizards/Argo/common/GitRevisionSelect.tsx, .../GitPathSelect.tsx, .../index.tsx
Accept secrets; when a repository-type secret matches repo URL, call authenticated endpoints (getGitChannelBranches/getGitChannelPaths) using decoded credentials; otherwise fallback to unauthenticated calls; merged secret-derived URLs into RepoURL options.
Tests (selectors & source)
frontend/src/wizards/Argo/common/GitSelectors.test.tsx, frontend/src/wizards/Argo/SourceSelector.test.tsx
Expanded tests to cover secret-matching, credential decoding, .git suffix handling, deduplication, and updated renders to pass secrets.
Misc UI wiring
frontend/src/routes/Search/SearchPage.tsx, frontend/src/wizards/Argo/common/index.tsx
Small type-narrowing fix in search suggestions; RepoURL options now combine channels + secret-derived URLs.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as ArgoWizard UI
    participant State as Recoil (secretsState)
    participant Selector as GitRevision/GitPath Selector
    participant API as Backend/API Client
    participant Argo as Argo CD

    User->>UI: open repository step / click "Configure repository credentials"
    UI->>State: read repoSecrets
    UI->>Selector: render with secrets prop
    Selector->>State: find matching repo-type Secret
    alt Secret found
        Selector->>API: getGitChannelBranches/Paths (with credentials)
        API->>Argo: request branches/paths (auth)
        Argo-->>API: return branches/paths
        API-->>Selector: return results
    else No secret
        Selector->>API: getGitBranchList/getGitPathList (no auth)
        API->>Argo: request branches/paths (no auth)
        Argo-->>API: return branches/paths
        API-->>Selector: return results
    end
    UI->>User: display branch/path options
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I sniffed the secrets in Recoil's nest,
Routed branches and paths with a curious quest,
An alert to guide where credentials hide,
A link to settings — hop, open with pride,
Now repos greet me, authenticated and blessed.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description includes ticket summary, link, type of change marked, and most checklist items acknowledged. However, the checklist itself shows most items unchecked, indicating incomplete validation against the required checks. Complete the checklist items in the PR description, particularly verifying code builds locally, no console logs, external display strings, test coverage, and UI/UX review status.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main feature being implemented: private repository support for the Application Set wizard.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@fxiang1 fxiang1 changed the title Implement private repo support for AppSet wizard WIP Implement private repo support for AppSet wizard Mar 6, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

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

⚠️ Outside diff range comments (1)
frontend/src/wizards/Argo/ArgoWizard.tsx (1)

200-232: ⚠️ Potential issue | 🟠 Major

Scope repoSecrets to the currently selected Argo namespace before reusing them.

These new paths consume the raw props.repoSecrets list, but Argo CD repository credentials are namespace-scoped to the selected Argo server/ApplicationSet namespace. Right now the wizard can offer private repo URLs from another namespace and resolve revisions/paths with the wrong secret, even though the resulting ApplicationSet cannot use that credential.

Also applies to: 544-585

🧹 Nitpick comments (1)
frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts (1)

95-108: Consider adding test coverage for the new targetPath parameter.

The existing tests correctly use the renamed openArgoCDURL function, but there's no test coverage for the new targetPath parameter functionality. Consider adding a test case that verifies the URL construction when targetPath is provided (e.g., '/settings/repos').

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts`
around lines 95 - 108, Add a unit test in topologyAppSet.test.ts that covers the
new targetPath behavior of openArgoCDURL: call openArgoCDURL with appropriate
args (e.g., cluster 'local-cluster', namespace 'openshift-gitops', app name
'test-app', a toggleLoading mock, i18n mock t, and a targetPath like
'/settings/repos') and assert that window.open (mockWindowOpen) is invoked with
the expected constructed URL including the targetPath; reset mockWindowOpen in
beforeEach and verify call count and URL string to ensure path is appended
correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/components/GitOpsPrivateRepoAlert.tsx`:
- Around line 32-38: The CTA always passes cluster: hubClusterName to
processResourceActionLink, which forces opening Argo repo settings on the hub
(push model) even for pull-model users; update the onClick handler to detect the
deployment model and pass the appropriate cluster identifier instead of always
hubClusterName: if the app is in push mode keep cluster: hubClusterName, but for
pull mode pass the target/managed cluster (e.g., the current managed cluster
variable or iterate through managed clusters) so the action
'open_argo_repo_settings' opens settings on each target cluster where
credentials are required; change the call site around
processResourceActionLink({ action: 'open_argo_repo_settings', namespace,
cluster: ... }) to select the correct cluster id based on the deployment model
flag or props.

In `@frontend/src/wizards/Argo/ArgoWizard.tsx`:
- Around line 566-570: The namespace prop for GitOpsPrivateRepoAlert is coming
from the stale applicationSet built from props.resources; change it to read the
live ApplicationSet from the wizard's state (the in-memory draft the user is
editing) instead of applicationSet from props. Locate the GitOpsPrivateRepoAlert
usage and replace applicationSet?.metadata?.namespace ?? '' with the live wizard
state value (e.g., the draft/ApplicationSet object the wizard updates—often
named something like wizardState.applicationSet, applicationSetDraft, or
state.applicationSet) so the alert and its "Configure repository credentials"
action always use the current namespace selected by the user.

In `@frontend/src/wizards/Argo/common/GitPathSelect.tsx`:
- Around line 28-56: In gitPathsAsyncCallback, the secret-backed branch calls
getGitChannelPaths even when revision (targetRevision) is empty; add the same
empty-revision guard used in the public flow so that if revision is falsy/empty
the function returns [] early instead of invoking getGitChannelPaths for the
found secret; update the logic around secret, revision, repoURL and
getGitChannelPaths to return [] when revision is not set.

---

Nitpick comments:
In
`@frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts`:
- Around line 95-108: Add a unit test in topologyAppSet.test.ts that covers the
new targetPath behavior of openArgoCDURL: call openArgoCDURL with appropriate
args (e.g., cluster 'local-cluster', namespace 'openshift-gitops', app name
'test-app', a toggleLoading mock, i18n mock t, and a targetPath like
'/settings/repos') and assert that window.open (mockWindowOpen) is invoked with
the expected constructed URL including the targetPath; reset mockWindowOpen in
beforeEach and verify call count and URL string to ensure path is appended
correctly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3821949d-b25c-4c2d-a0d2-37ec5631f550

📥 Commits

Reviewing files that changed from the base of the PR and between af2859d and 9639be7.

📒 Files selected for processing (17)
  • backend/src/routes/events.ts
  • frontend/public/locales/en/translation.json
  • frontend/src/components/GitOpsPrivateRepoAlert.tsx
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/helpers/diagram-helpers.ts
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.test.ts
  • frontend/src/routes/Applications/ApplicationDetails/ApplicationTopology/model/topologyAppSet.ts
  • frontend/src/routes/Applications/CreateArgoApplication/CreateApplicationArgo.tsx
  • frontend/src/routes/Applications/CreateArgoApplication/CreateApplicationArgoPullModel.tsx
  • frontend/src/routes/Applications/CreateArgoApplication/EditArgoApplicationSet.tsx
  • frontend/src/wizards/Argo/ArgoWizard.tsx
  • frontend/src/wizards/Argo/MultipleGeneratorSelector.tsx
  • frontend/src/wizards/Argo/MultipleSourcesSelector.tsx
  • frontend/src/wizards/Argo/SourceSelector.tsx
  • frontend/src/wizards/Argo/common/GitPathSelect.tsx
  • frontend/src/wizards/Argo/common/GitRevisionSelect.tsx
  • frontend/src/wizards/Argo/common/GitSelectors.test.tsx
  • frontend/src/wizards/Argo/common/index.tsx

Signed-off-by: fxiang1 <fxiang@redhat.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (2)
frontend/src/wizards/Argo/common/GitSelectors.test.tsx (1)

23-29: ⚠️ Potential issue | 🟡 Minor

Mirror the real getGitBranchList / getGitPathList contracts in this mock.

The real helpers forward channel.spec.pathname, secretArgs, the url fallback, and the empty-branch short-circuit. This mock drops all of that and calls getGitChannelBranches/Paths with the whole channel object instead, so the fallback tests will still pass even if the component stops wiring the helper correctly.

Suggested fix
 jest.mock('../ArgoWizard', () => ({
   getGitBranchList: jest.fn((channel: any, getGitChannelBranches: any) =>
-    getGitChannelBranches(channel).then((branches: string[]) => branches)
+    getGitChannelBranches(channel.spec.pathname, {
+      secretRef: channel.spec?.secretRef?.name,
+      namespace: channel.metadata?.namespace,
+    }).then((branches: string[]) => branches)
   ),
-  getGitPathList: jest.fn((channel: any, revision: any, getGitChannelPaths: any) =>
-    getGitChannelPaths(channel, revision).then((paths: string[]) => paths)
+  getGitPathList: jest.fn((channel: any, revision: any, getGitChannelPaths: any, url?: string) =>
+    !revision
+      ? Promise.resolve([])
+      : getGitChannelPaths(channel?.spec?.pathname || url, revision, {
+          secretRef: channel?.spec?.secretRef?.name,
+          namespace: channel.metadata?.namespace,
+        }).then((paths: string[]) => paths)
   ),
 }))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Argo/common/GitSelectors.test.tsx` around lines 23 - 29,
The mock for ../ArgoWizard does not mirror the real
getGitBranchList/getGitPathList contracts — it passes the whole channel to
getGitChannelBranches/getGitChannelPaths and omits forwarding
channel.spec.pathname, secretArgs, the url fallback and the empty-branch
short-circuit; update the mock implementations of getGitBranchList and
getGitPathList to accept the same parameters as the real helpers and forward
channel.spec.pathname (or pathname fallback to url), pass through secretArgs,
implement the empty-branch short-circuit, and then call
getGitChannelBranches/getGitChannelPaths with the exact forwarded args so tests
exercise the same wiring as production.
frontend/src/wizards/Argo/ArgoWizard.tsx (1)

195-232: ⚠️ Potential issue | 🟠 Major

Scope repoSecrets to the selected Argo server namespace before using them.

CreateApplicationArgo.tsx passes the full secretsState into repoSecrets, and this code folds that unfiltered list into gitGeneratorRepos and forwards it to the repository selectors. The Git selector components then use the matched secret's metadata.namespace for branch/path fetches, so a repository secret from a different GitOps namespace can show up in the dropdowns and drive lookups with the wrong credentials for the selected Argo server.

Derive a namespace-scoped secret list from the live ApplicationSet.metadata.namespace and reuse that list here.

Also applies to: 552-580

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Argo/ArgoWizard.tsx` around lines 195 - 232, Scope the
repoSecrets to the selected Argo server namespace before building
gitGeneratorRepos: derive a filtered list (e.g., scopedRepoSecrets) by filtering
props.repoSecrets where secret.metadata.namespace matches the live
ApplicationSet.metadata.namespace (or the currently selected Argo namespace from
CreateApplicationArgo), then use scopedRepoSecrets instead of props.repoSecrets
in the gitGeneratorRepos computation and the similar block at 552-580; keep
using findGeneratorPathWithGenType, get, and the same repo parsing logic but
operate on the namespace-scoped list so selectors only receive credentials from
the correct namespace.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/wizards/Argo/SourceSelector.test.tsx`:
- Around line 37-49: The test doubles for WizAsyncSelect, WizSelect, WizHidden,
WizTiles, and WizTextInput render only id attributes but the tests query by
data-testid; update each mock component to include a data-testid attribute
(e.g., data-testid={`async-select-${label}`} for WizAsyncSelect,
data-testid={`select-${label}`} and data-testid={`option-${opt}`} for options
rendered in WizSelect, data-testid for WizHidden children wrapper, WizTiles and
WizTextInput) so the test queries (getByTestId/queryByTestId) can locate the
elements.

---

Outside diff comments:
In `@frontend/src/wizards/Argo/ArgoWizard.tsx`:
- Around line 195-232: Scope the repoSecrets to the selected Argo server
namespace before building gitGeneratorRepos: derive a filtered list (e.g.,
scopedRepoSecrets) by filtering props.repoSecrets where
secret.metadata.namespace matches the live ApplicationSet.metadata.namespace (or
the currently selected Argo namespace from CreateApplicationArgo), then use
scopedRepoSecrets instead of props.repoSecrets in the gitGeneratorRepos
computation and the similar block at 552-580; keep using
findGeneratorPathWithGenType, get, and the same repo parsing logic but operate
on the namespace-scoped list so selectors only receive credentials from the
correct namespace.

In `@frontend/src/wizards/Argo/common/GitSelectors.test.tsx`:
- Around line 23-29: The mock for ../ArgoWizard does not mirror the real
getGitBranchList/getGitPathList contracts — it passes the whole channel to
getGitChannelBranches/getGitChannelPaths and omits forwarding
channel.spec.pathname, secretArgs, the url fallback and the empty-branch
short-circuit; update the mock implementations of getGitBranchList and
getGitPathList to accept the same parameters as the real helpers and forward
channel.spec.pathname (or pathname fallback to url), pass through secretArgs,
implement the empty-branch short-circuit, and then call
getGitChannelBranches/getGitChannelPaths with the exact forwarded args so tests
exercise the same wiring as production.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f2583f68-d932-4e11-83b1-81368146396e

📥 Commits

Reviewing files that changed from the base of the PR and between 9639be7 and ded1226.

📒 Files selected for processing (5)
  • frontend/src/components/GitOpsPrivateRepoAlert.tsx
  • frontend/src/wizards/Argo/ArgoWizard.tsx
  • frontend/src/wizards/Argo/SourceSelector.test.tsx
  • frontend/src/wizards/Argo/common/GitPathSelect.tsx
  • frontend/src/wizards/Argo/common/GitSelectors.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/wizards/Argo/common/GitPathSelect.tsx

Signed-off-by: fxiang1 <fxiang@redhat.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
frontend/src/wizards/Argo/SourceSelector.test.tsx (1)

36-48: ⚠️ Potential issue | 🔴 Critical

Mock components use id but tests query by data-testid.

The mock components render with id={...} attributes, but the tests use getByTestId(), getAllByTestId(), and queryByTestId() queries which search for the data-testid attribute. These tests will fail to locate the mocked elements.

,

🐛 Proposed fix to use data-testid
-  WizAsyncSelect: ({ label }: any) => <div id={`async-select-${label}`} />,
+  WizAsyncSelect: ({ label }: any) => <div data-testid={`async-select-${label}`} />,
   WizSelect: ({ label, options }: any) => (
-    <div id={`select-${label}`}>
+    <div data-testid={`select-${label}`}>
       {options?.map((opt: string) => (
-        <span key={opt} id={`option-${opt}`}>
+        <span key={opt} data-testid={`option-${opt}`}>
           {opt}
         </span>
       ))}
     </div>
   ),
   WizHidden: ({ children }: any) => <>{children}</>,
-  WizTiles: ({ label }: any) => <div id={`tiles-${label}`} />,
-  WizTextInput: ({ label }: any) => <div id={`text-input-${label}`} />,
+  WizTiles: ({ label }: any) => <div data-testid={`tiles-${label}`} />,
+  WizTextInput: ({ label }: any) => <div data-testid={`text-input-${label}`} />,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Argo/SourceSelector.test.tsx` around lines 36 - 48, The
mocked wizard components (WizAsyncSelect, WizSelect, WizHidden, WizTiles,
WizTextInput) currently render elements with id attributes but tests use
getByTestId/getAllByTestId/queryByTestId, so update each mock to add matching
data-testid attributes (e.g., data-testid={`async-select-${label}`} for
WizAsyncSelect, data-testid={`select-${label}`} and on each option
data-testid={`option-${opt}`} for WizSelect, data-testid for WizHidden children
wrapper, WizTiles, and WizTextInput) so the test queries can find them; keep
existing ids if desired but ensure data-testid values mirror the ids used in
tests.
🧹 Nitpick comments (3)
frontend/src/routes/Search/SearchPage.tsx (1)

222-222: Consider using a more specific type instead of any.

Using any bypasses TypeScript's type checking. If searchComplete returns (string | null)[], consider typing the parameter explicitly to preserve type safety.

♻️ Suggested improvement
-          (_.get(searchCompleteData || [], 'searchComplete') ?? []).filter((s: any) => s !== null),
+          (_.get(searchCompleteData || [], 'searchComplete') ?? []).filter((s: string | null): s is string => s !== null),

This uses a type predicate to narrow the array type from (string | null)[] to string[] after filtering.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/routes/Search/SearchPage.tsx` at line 222, The filter callback
currently uses (s: any) which defeats TypeScript checks; update the filter on
(_.get(searchCompleteData || [], 'searchComplete') ?? []) to use a specific type
like (s: string | null): s is string and implement a type predicate that returns
true for non-null strings so the resulting array is inferred as string[] instead
of any[]; look for the filter invocation in SearchPage (the expression
referencing searchCompleteData and 'searchComplete') and replace the any-typed
parameter with the typed predicate.
frontend/src/wizards/Argo/SourceSelector.test.tsx (2)

276-279: Same querySelector inconsistency as in Git tests.

This uses the same CSS ID selector pattern. Update along with line 190 for consistency.

♻️ Suggested refactor
-      expect(helmSelect.querySelector('#option-https\\:\\/\\/github\\.com\\/private\\/repo')).toBeNull()
+      expect(screen.queryByTestId('option-https://github.com/private/repo')).not.toBeInTheDocument()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Argo/SourceSelector.test.tsx` around lines 276 - 279,
Replace the brittle CSS ID selector that escapes colons with a stable
data-testid lookup: change the assertion that uses
helmSelect.querySelector('#option-https\\:\\/\\/github\\.com\\/private\\/repo')
to check for
helmSelect.querySelector('[data-testid="option-https://github.com/private/repo"]')
(or use
within(helmSelect).queryByTestId('option-https://github.com/private/repo') if
you prefer RTL helpers) and update the matching test at the other occurrence
(the similar selector earlier in this file) to use the same data-testid-based
approach so both tests are consistent.

188-191: Inconsistent query method: querySelector with CSS ID selector.

This test uses .querySelector('#option-...') with a CSS ID selector, which differs from other tests that use getByTestId. After fixing the mocks to use data-testid, this query will also need to be updated for consistency.

♻️ Suggested refactor for consistency after fixing mocks
-      expect(gitSelect.querySelector('#option-https\\:\\/\\/charts\\.example\\.com\\/stable')).toBeNull()
+      expect(screen.queryByTestId('option-https://charts.example.com/stable')).not.toBeInTheDocument()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Argo/SourceSelector.test.tsx` around lines 188 - 191,
The test is using
gitSelect.querySelector('#option-https\\:\\/\\/charts\\.example\\.com\\/stable')
which mixes CSS ID selectors with the rest of the tests that use data-testid;
change this to use the testing-library query APIs: use
within(gitSelect).queryByTestId('option-https://charts.example.com/stable') (or
the sanitized data-testid you added in the mocks) and assert it is null,
updating the test to reference the same data-testid naming convention used
elsewhere; keep the variables selects and gitSelect as-is to locate the correct
element.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@frontend/src/wizards/Argo/SourceSelector.test.tsx`:
- Around line 36-48: The mocked wizard components (WizAsyncSelect, WizSelect,
WizHidden, WizTiles, WizTextInput) currently render elements with id attributes
but tests use getByTestId/getAllByTestId/queryByTestId, so update each mock to
add matching data-testid attributes (e.g., data-testid={`async-select-${label}`}
for WizAsyncSelect, data-testid={`select-${label}`} and on each option
data-testid={`option-${opt}`} for WizSelect, data-testid for WizHidden children
wrapper, WizTiles, and WizTextInput) so the test queries can find them; keep
existing ids if desired but ensure data-testid values mirror the ids used in
tests.

---

Nitpick comments:
In `@frontend/src/routes/Search/SearchPage.tsx`:
- Line 222: The filter callback currently uses (s: any) which defeats TypeScript
checks; update the filter on (_.get(searchCompleteData || [], 'searchComplete')
?? []) to use a specific type like (s: string | null): s is string and implement
a type predicate that returns true for non-null strings so the resulting array
is inferred as string[] instead of any[]; look for the filter invocation in
SearchPage (the expression referencing searchCompleteData and 'searchComplete')
and replace the any-typed parameter with the typed predicate.

In `@frontend/src/wizards/Argo/SourceSelector.test.tsx`:
- Around line 276-279: Replace the brittle CSS ID selector that escapes colons
with a stable data-testid lookup: change the assertion that uses
helmSelect.querySelector('#option-https\\:\\/\\/github\\.com\\/private\\/repo')
to check for
helmSelect.querySelector('[data-testid="option-https://github.com/private/repo"]')
(or use
within(helmSelect).queryByTestId('option-https://github.com/private/repo') if
you prefer RTL helpers) and update the matching test at the other occurrence
(the similar selector earlier in this file) to use the same data-testid-based
approach so both tests are consistent.
- Around line 188-191: The test is using
gitSelect.querySelector('#option-https\\:\\/\\/charts\\.example\\.com\\/stable')
which mixes CSS ID selectors with the rest of the tests that use data-testid;
change this to use the testing-library query APIs: use
within(gitSelect).queryByTestId('option-https://charts.example.com/stable') (or
the sanitized data-testid you added in the mocks) and assert it is null,
updating the test to reference the same data-testid naming convention used
elsewhere; keep the variables selects and gitSelect as-is to locate the correct
element.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0e8257e3-2738-4e8b-a306-3dfccae71b6c

📥 Commits

Reviewing files that changed from the base of the PR and between ded1226 and 4455879.

📒 Files selected for processing (3)
  • frontend/src/routes/Applications/CreateArgoApplication/EditArgoApplicationSet.tsx
  • frontend/src/routes/Search/SearchPage.tsx
  • frontend/src/wizards/Argo/SourceSelector.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/routes/Applications/CreateArgoApplication/EditArgoApplicationSet.tsx

fxiang1 added 2 commits March 9, 2026 13:12
Signed-off-by: fxiang1 <fxiang@redhat.com>
Signed-off-by: fxiang1 <fxiang@redhat.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/src/wizards/Argo/ArgoWizard.tsx (1)

180-180: Consider defining a type for source instead of using any.

Using explicit any bypasses TypeScript's type safety. Since sources should have a known shape (matching RepositoryProps), consider using that type or creating a dedicated interface.

♻️ Suggested improvement
-        sources.forEach((source: any) => {
+        sources.forEach((source: RepositoryProps) => {

Also applies to: 250-250

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/wizards/Argo/ArgoWizard.tsx` at line 180, The code uses an
untyped parameter in sources.forEach((source: any) => ...) which defeats
TypeScript's checks; replace the any with the correct shape (e.g.,
RepositoryProps or a new interface like ArgoRepository) and update all
occurrences (including the other instance around line 250) so functions/loops
that iterate sources use that type — locate the sources.forEach callback in
ArgoWizard (and any other similar loops) and change source: any to source:
RepositoryProps (or the new interface) and adjust imports/definitions if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/src/wizards/Argo/ArgoWizard.tsx`:
- Line 180: The code uses an untyped parameter in sources.forEach((source: any)
=> ...) which defeats TypeScript's checks; replace the any with the correct
shape (e.g., RepositoryProps or a new interface like ArgoRepository) and update
all occurrences (including the other instance around line 250) so
functions/loops that iterate sources use that type — locate the sources.forEach
callback in ArgoWizard (and any other similar loops) and change source: any to
source: RepositoryProps (or the new interface) and adjust imports/definitions if
needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a5dd7b5-1196-4911-a4d3-a6e43bf124f8

📥 Commits

Reviewing files that changed from the base of the PR and between 4455879 and fe998ef.

📒 Files selected for processing (2)
  • frontend/src/routes/Search/SearchPage.tsx
  • frontend/src/wizards/Argo/ArgoWizard.tsx

@fxiang1
Copy link
Contributor Author

fxiang1 commented Mar 9, 2026

/assign @jeswanke

@fxiang1 fxiang1 changed the title WIP Implement private repo support for AppSet wizard ACM-30326 Implement private repo support for AppSet wizard Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants