Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
914abf1
chore: schema changes
themarolt May 27, 2026
fa6fca7
Merge branch 'main' into feat/track-packages
themarolt May 27, 2026
55b4b1a
fix: guard VersionInfo.IsRelease nullability in versions BQ SQL
themarolt May 28, 2026
b19c5d1
chore: deps.dev ingestion wip
themarolt May 28, 2026
dc86b26
chore: finished the deps.dev importer and tested it on cargo and mave…
themarolt Jun 1, 2026
4ed2912
fix: issues with npm dups
themarolt Jun 1, 2026
fe99779
Merge branch 'main' into feat/track-packages
themarolt Jun 1, 2026
15d4187
fix: issues with npm
themarolt Jun 1, 2026
65c2871
fix: linting
themarolt Jun 1, 2026
8506726
fix: linting
themarolt Jun 1, 2026
35e5304
fix: smal fix
themarolt Jun 1, 2026
bee4c48
fix: fixes
themarolt Jun 1, 2026
38a8fe0
fix: fixes
themarolt Jun 2, 2026
08b4cba
fix: fixes
themarolt Jun 2, 2026
5b8f479
fix: fixes
themarolt Jun 2, 2026
637ac8c
fix: fixes
themarolt Jun 2, 2026
23f8990
fix: fixes
themarolt Jun 2, 2026
0d89c84
chore: split dependent counts and a few fixes
themarolt Jun 3, 2026
076c1f7
Merge branch 'main' into feat/track-packages
themarolt Jun 3, 2026
a855af0
chore: cleanup
themarolt Jun 3, 2026
85c0d96
fix: bug
themarolt Jun 3, 2026
611611a
fix: comments
themarolt Jun 3, 2026
6a2fdef
fix: comments
themarolt Jun 3, 2026
baebdf0
fix: linting
themarolt Jun 3, 2026
717ff23
fix: comments
themarolt Jun 3, 2026
647de22
fix: comments
themarolt Jun 3, 2026
8493a94
Merge branch 'main' into feat/track-packages
themarolt Jun 3, 2026
c320d4a
fix: snapshot date handling
themarolt Jun 3, 2026
9828cc4
fix: dont build the version lookup table if there are no deps to merge
themarolt Jun 3, 2026
11d3cee
fix: not enough buffer
themarolt Jun 4, 2026
a454b9a
fix: cleanup
themarolt Jun 4, 2026
fd96d71
chore: disable ranking in deps-dev ingestion pipeline
themarolt Jun 4, 2026
8581c75
Merge branch 'main' into feat/track-packages
themarolt Jun 4, 2026
14901c4
fix: comments
themarolt Jun 4, 2026
7560efc
chore: dont normalize github to github.com
themarolt Jun 4, 2026
f68973c
Merge branch 'main' into feat/track-packages
themarolt Jun 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions services/apps/packages_worker/src/deps-dev/canonicalRepoUrl.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const HOST_BY_TYPE: Record<string, string> = {
const DOMAIN_BY_TYPE: Record<string, string> = {
GITHUB: 'github.com',
GITLAB: 'gitlab.com',
BITBUCKET: 'bitbucket.org',
}

export function canonicalRepoUrl(type: string, name: string): string | null {
const host = HOST_BY_TYPE[type]
if (!host) return null
const domain = DOMAIN_BY_TYPE[type]
if (!domain) return null
// Names are bare paths (owner/repo or owner/subgroup/repo) — no host prefix.
// Strip full URL prefix only if present; bare paths pass through untouched.
// TODO(Step 2a): verify against sampled ProjectName shapes from BQ console.
Expand All @@ -18,16 +18,22 @@ export function canonicalRepoUrl(type: string, name: string): string | null {
// GitHub enforces case-insensitive uniqueness (can't create Foo and foo as separate orgs/repos),
// so lowercasing is always safe and aligns with deps.dev's canonical form.
// GitLab, Bitbucket, and self-hosted forges are case-sensitive — preserve original casing.
const path = host === 'github.com' ? stripped.toLowerCase() : stripped
const path = type === 'GITHUB' ? stripped.toLowerCase() : stripped
if (!/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._/-]+$/.test(path)) return null
return `https://${host}/${path}`
return `https://${domain}/${path}`
}

const HOST_BY_DOMAIN: Record<string, string> = {
'github.com': 'github',
'gitlab.com': 'gitlab',
'bitbucket.org': 'bitbucket',
}

export function parseRepoUrl(url: string): { host: string; owner: string; name: string } {
const u = new URL(url)
const parts = u.pathname.slice(1).split('/')
return {
host: u.hostname,
host: HOST_BY_DOMAIN[u.hostname] ?? u.hostname,
owner: parts[0],
name: parts.slice(1).join('/'),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ path_computed AS (
SELECT
pm.purl,
CASE pvp.ProjectType
WHEN 'GITHUB' THEN 'github.com'
WHEN 'GITLAB' THEN 'gitlab.com'
WHEN 'BITBUCKET' THEN 'bitbucket.org'
WHEN 'GITHUB' THEN 'github'
WHEN 'GITLAB' THEN 'gitlab'
WHEN 'BITBUCKET' THEN 'bitbucket'
END AS host,
CASE pvp.ProjectType
WHEN 'GITHUB' THEN LOWER(
Expand All @@ -40,7 +40,7 @@ path_computed AS (
)
SELECT
purl,
CONCAT('https://', host, '/', path) AS canonical_url,
CONCAT('https://', CASE host WHEN 'github' THEN 'github.com' WHEN 'gitlab' THEN 'gitlab.com' WHEN 'bitbucket' THEN 'bitbucket.org' END, '/', path) AS canonical_url,
confidence
FROM path_computed
WHERE REGEXP_CONTAINS(path, r'^[a-zA-Z0-9._-]+/[a-zA-Z0-9._/-]+$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ WITH raw AS (
p.Type AS raw_project_type,
p.Name AS raw_project_name,
CASE p.Type
WHEN 'GITHUB' THEN 'github.com'
WHEN 'GITLAB' THEN 'gitlab.com'
WHEN 'BITBUCKET' THEN 'bitbucket.org'
WHEN 'GITHUB' THEN 'github'
WHEN 'GITLAB' THEN 'gitlab'
WHEN 'BITBUCKET' THEN 'bitbucket'
END AS host,
CASE p.Type
WHEN 'GITHUB' THEN LOWER(
Expand All @@ -32,7 +32,7 @@ WITH raw AS (
AND p.Type IN ('GITHUB', 'GITLAB', 'BITBUCKET')
)
SELECT
CONCAT('https://', host, '/', path) AS canonical_url,
CONCAT('https://', CASE raw_project_type WHEN 'GITHUB' THEN 'github.com' WHEN 'GITLAB' THEN 'gitlab.com' WHEN 'BITBUCKET' THEN 'bitbucket.org' END, '/', path) AS canonical_url,
host,
REGEXP_EXTRACT(path, r'^([^/]+)/') AS owner,
REGEXP_EXTRACT(path, r'^[^/]+/(.+)$') AS name,
Expand Down
Loading