Skip to content

Conversation

@emlimlf
Copy link
Collaborator

@emlimlf emlimlf commented Jan 29, 2026

In this PR

  • Removed the deduplication of gerrit repositories on the front end
  • Added additional gerrit URL when passing selected repositories

Ticket

IN-935

Signed-off-by: Efren Lim <elim@linuxfoundation.org>
Signed-off-by: Efren Lim <elim@linuxfoundation.org>
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 adjusts how Gerrit repositories are handled in repository filtering/selection, removing frontend normalization/deduplication logic and expanding selected Gerrit repository URLs to include an additional Gerrit query-style URL.

Changes:

  • Removed normalizeRepoName helper and the related normalization-based deduplication behavior in repository UI components.
  • Updated repository selection handling to operate on the raw repository names/URLs without normalization.
  • Expanded selected repository URL list (when Gerrit is connected) to include an additional /q/project: Gerrit URL format.

Reviewed changes

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

File Description
frontend/app/components/shared/utils/helper.ts Removes normalizeRepoName utility that previously normalized repo URLs/names.
frontend/app/components/modules/project/store/project.store.ts Adds Gerrit-specific expansion of selected repository URLs to include a /q/project: variant.
frontend/app/components/modules/project/components/shared/header/repository-switch/repository-search.vue Removes normalization-based mapping and switches filtering/selection grouping to use raw repo names.
frontend/app/components/modules/project/components/shared/header.vue Removes normalization + dedup logic when computing selected repo display name/count.

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

Comment on lines 119 to 122
const match = repoUrl.match(gerritUrlPattern);
if (match) {
const [, baseWithNamespace, projectPath] = match;
expandedRepos.push(`${baseWithNamespace}/q/project:${projectPath}`);
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

selectedReposValues now expands Gerrit repos by appending a derived /q/project: URL, but the construction can generate malformed URLs:

  • If repoUrl is already in /q/project: form, this will produce /q/project:q/project:....
  • projectPath may contain / and should be URL-encoded (Gerrit query URLs typically expect project:foo%2Fbar as a single path segment).
    Consider guarding against already-query URLs and encoding the project path when generating the query URL.
Suggested change
const match = repoUrl.match(gerritUrlPattern);
if (match) {
const [, baseWithNamespace, projectPath] = match;
expandedRepos.push(`${baseWithNamespace}/q/project:${projectPath}`);
// Skip expansion if this is already a Gerrit query URL
if (repoUrl.includes('/q/project:')) {
continue;
}
const match = repoUrl.match(gerritUrlPattern);
if (match) {
const [, baseWithNamespace, projectPath] = match;
const encodedProjectPath = encodeURIComponent(projectPath);
expandedRepos.push(`${baseWithNamespace}/q/project:${encodedProjectPath}`);

Copilot uses AI. Check for mistakes.
Comment on lines 104 to 130
const selectedReposValues = computed<string[]>(() => {
const hasGerrit = project.value?.connectedPlatforms?.some((platform) =>
platform.toLowerCase().includes('gerrit'),
);
const repos = selectedRepositories.value.map((repo: ProjectRepository) => repo.url);

if (hasGerrit) {
// For Gerrit repos, add the query URL format alongside each repo URL
// Input: https://gerrit.<domain>/<namespace>/<project>/<repo>
// Output: https://gerrit.<domain>/<namespace>/q/project:<project>/<repo>
const gerritUrlPattern = /^(https:\/\/gerrit\.[^/]+\/[^/]+)\/(.+)$/;
const expandedRepos: string[] = [];

for (const repoUrl of repos) {
expandedRepos.push(repoUrl);
const match = repoUrl.match(gerritUrlPattern);
if (match) {
const [, baseWithNamespace, projectPath] = match;
expandedRepos.push(`${baseWithNamespace}/q/project:${projectPath}`);
}
}

return expandedRepos;
}

return repos;
});
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

selectedReposValues is used for both API repo filtering and for archive-state calculations (allArchived / hasSelectedArchivedRepos). Expanding the list with derived Gerrit query URLs changes the meaning of “selected repos” and will cause allArchived to become false when the archived list only contains the canonical repo URLs (the added /q/project: URLs won’t be present). Suggestion: keep selectedReposValues as the canonical selected repo URLs and introduce a separate computed (e.g. selectedReposValuesForApi) for the expanded Gerrit list, or adjust the archive checks to use the unexpanded URLs.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@joanagmaia joanagmaia left a comment

Choose a reason for hiding this comment

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

Hey @emlimlf me and @mbani01 discussed this one out and we are going to apply the filter on Tinybird (to also include the q/project). Can you adjust the PR to only remove the deduplication, but to not send the urls?

So when filtering, you will only send the url that the user actually clicked on.

@emlimlf emlimlf requested a review from joanagmaia January 30, 2026 05:53
@emlimlf
Copy link
Collaborator Author

emlimlf commented Jan 30, 2026

@joanagmaia I've removed the additional parameter passing.

Signed-off-by: Efren Lim <elim@linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
… remove sharp

Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
@emlimlf emlimlf merged commit c037129 into main Feb 3, 2026
9 checks passed
@emlimlf emlimlf deleted the fix/filtering-gerrit branch February 3, 2026 00:51
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