Skip to content

fix: filter last maven repository_url erros (CM-1305) - #4338

Merged
ulemons merged 3 commits into
mainfrom
fix/maven-additional-repo
Jul 15, 2026
Merged

fix: filter last maven repository_url erros (CM-1305)#4338
ulemons merged 3 commits into
mainfrom
fix/maven-additional-repo

Conversation

@ulemons

@ulemons ulemons commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends Maven declared_repository_url normalization to recognize Subversion (SVN) URLs and a handful of remaining edge cases that previously resolved to null, so more repository URLs get stored as a canonical link instead of being dropped.

Changes

  • Add SVN normalization (normalizeSvnScmUrl / normalizeSvnUrl in extract.ts) covering scm:svn: connection strings, svn(+ssh):// schemes, and bare http(s):// URLs on known SVN hosts (Apache, ObjectWeb, Sonatype, SourceForge, etc.). Apache's viewvc, viewcvs.cgi, and repos/asf fronts are unified to the same /repos/asf/... link, mirroring the existing git host logic.
  • java.net only counts as SVN when explicitly marked (scm:svn: prefix or svn(+ssh):// scheme) — the bare host is shared with non-SVN content (forums, wikis, JIRA).
  • Export isSvnHost from extract.ts and use it in parseRepoUrl (normalize.ts): SVN has no owner/repo shape, so its path is now kept whole as name instead of being mis-split into owner/repo (e.g. /repos/asf/geronimo/server no longer becomes owner=repos, name=asf).
  • Handle ssh://host:port/... (no git@ user) as a generic Gerrit-style clone URL.
  • Add OpenDaylight Gerrit host handling: unifies the gitweb browse query (?p=<repo>.git;a=summary) and the SSH clone form (ssh://git.opendaylight.org:29418/<repo>.git) into the same canonical gitweb link.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

JIRA ticket

CM-1305

@ulemons ulemons self-assigned this Jul 14, 2026
Copilot AI review requested due to automatic review settings July 14, 2026 10:03
@ulemons ulemons added the Bug Created by Linear-GitHub Sync label Jul 14, 2026

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

Pull request overview

Extends Maven SCM URL normalization to recover SVN, OpenDaylight Gerrit, and internal-host repository links.

Changes:

  • Adds canonical SVN URL handling.
  • Normalizes OpenDaylight Gerrit and internal SCM URLs.
  • Adds regression tests and preserves complete SVN paths.

Two URL-validation bugs remain. The PR title also misspells “errors” and lacks the required JIRA key.

Reviewed changes

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

File Description
maven/normalize.ts Parses normalized SVN repository identities.
maven/extract.ts Adds SCM host and URL normalization rules.
maven/__tests__/normalize.test.ts Tests the new normalization behavior.

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

Comment thread services/apps/packages_worker/src/maven/extract.ts Outdated
Comment thread services/apps/packages_worker/src/maven/extract.ts Outdated
@ulemons
ulemons force-pushed the fix/maven-additional-repo branch from 6e9cf92 to 1ae132b Compare July 15, 2026 07:54
Copilot AI review requested due to automatic review settings July 15, 2026 07:54
@ulemons
ulemons marked this pull request as ready for review July 15, 2026 07:56
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes only Maven SCM URL normalization and repo parsing metadata, but widens which URLs are accepted and stored (SVN, internal hosts, Gerrit/SVN identity rules), so incorrect heuristics could persist bad links—mitigated by extensive tests and explicit null cases for ambiguous inputs.

Overview
Extends Maven declared_repository_url handling so more legacy SCM strings become a stored canonical repository_url instead of null.

SVN is normalized before git-oriented logic via normalizeSvnScmUrl / normalizeSvnUrl: scm:svn:, svn(+ssh)://, and bare URLs on known SVN hosts (Apache fronts unified to /repos/asf/..., SourceForge /p/.../code, etc.). java.net is SVN only when explicitly marked; marker-only roots stay null. parseRepoUrl uses exported isSvnHost to keep the full path as name (no bogus owner/repo split).

OpenDaylight Gerrit (git.opendaylight.org) maps gitweb ?p= and ssh://host:port/<repo>.git (new generic port rewrite) to one browser gitweb link; parseRepoUrl reads repo id from ?p=.

Also adds cs.android.com Gitiles passthrough like android.googlesource.com, allowlists internal Adobe/Alibaba Git hosts per product decision, and expands tests for these shapes.

Reviewed by Cursor Bugbot for commit 3d26c6c. Bugbot is set up for automated code reviews on this repo. Configure here.

@ulemons ulemons changed the title fix: filter last maven repository_url erros fix: filter last maven repository_url erros (CM-1305) Jul 15, 2026
Comment thread services/apps/packages_worker/src/maven/normalize.ts

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

Pull request overview

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

Comment thread services/apps/packages_worker/src/maven/normalize.ts
const name = rawName ? extractGitwebRepoName(rawName) : null
if (!name) return null

return `https://${OPENDALIGHT_GERRIT_HOST}/gerrit/gitweb?p=${name}.git`
* `svn(+ssh)://` scheme) — the bare hostname is shared with non-SVN content
* (java.net hosted forums, wikis, JIRA, etc. alongside its SVN forge).
*/
const SVN_HOSTS_REQUIRE_EXPLICIT_MARKER = new Set(['java.net'])
Copilot AI review requested due to automatic review settings July 15, 2026 08:32
// identifier (e.g. /repos/asf/geronimo/server), so splitting it into
// parts[0]/parts[1] like a git host would produce garbage (owner='repos',
// name='asf'). Keep the whole path as `name` instead.
if (isSvnHost(h)) return { host: 'svn', owner: null, name: parts.join('/') || null }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

java.net misclassified as SVN

Medium Severity

parseRepoUrl treats every java.net URL as SVN via isSvnHost, but normalizeSvnScmUrl only accepts that host with an explicit scm:svn: or svn(+ssh):// marker. Non-SVN java.net links get host: 'svn' and a full-path name when writeRepoLink parses repository_url, diverging from normalization rules.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ae393e9. Configure here.

Comment thread services/apps/packages_worker/src/maven/extract.ts
ulemons added 3 commits July 15, 2026 10:37
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons
ulemons force-pushed the fix/maven-additional-repo branch from ae393e9 to 3d26c6c Compare July 15, 2026 08:37

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

Pull request overview

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

Comment thread services/apps/packages_worker/src/maven/normalize.ts
Comment thread services/apps/packages_worker/src/maven/normalize.ts
Comment thread services/apps/packages_worker/src/maven/extract.ts
Comment thread services/apps/packages_worker/src/maven/extract.ts
Copilot AI review requested due to automatic review settings July 15, 2026 08:39

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3d26c6c. Configure here.

const name = p ? p.replace(/\.git$/, '') : null
return { host: 'gerrit', owner: null, name }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cs.android paths truncated in parseRepoUrl

Medium Severity

normalizeScmUrl now keeps full Gitiles-style paths for cs.android.com, but parseRepoUrl still splits only the first two path segments into owner and name. Enriched packages with those URLs get truncated repo metadata in writeRepoLink while repos.url stays correct.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3d26c6c. Configure here.

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

Pull request overview

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

Comment thread services/apps/packages_worker/src/maven/normalize.ts
Comment thread services/apps/packages_worker/src/maven/normalize.ts
Comment thread services/apps/packages_worker/src/maven/extract.ts
@ulemons
ulemons merged commit b6f71e8 into main Jul 15, 2026
14 checks passed
@ulemons
ulemons deleted the fix/maven-additional-repo branch July 15, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants