Skip to content

Commit 1837aa3

Browse files
committed
fix: review
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
1 parent 8a7bc96 commit 1837aa3

4 files changed

Lines changed: 6 additions & 21 deletions

File tree

services/apps/packages_worker/src/maven/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ hitRate }`; the critical batch logs it once per batch under message **`POM cache
8181

8282
The matrix below describes the **critical** path (full POM + parent resolution).
8383
Non-critical packages are DB-only: they receive just the universe-stat columns
84-
(`criticality_score`, `dependent_packages_count`, `dependent_repos_count`,
85-
`downloads_last_month`) plus `purl`/`namespace`/`name`/`registry_url`/`last_synced_at`;
84+
(`criticality_score`, `dependent_packages_count`, `dependent_repos_count`)
85+
plus `purl`/`namespace`/`name`/`registry_url`/`last_synced_at`;
8686
all POM-derived columns stay null for them.
8787

8888
### packages

services/apps/packages_worker/src/maven/runMavenEnrichmentLoop.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ async function processNonCriticalPackage(qx: QueryExecutor, pkg: PackageRow): Pr
110110
criticalityScore: pkg.criticalityScore,
111111
dependentPackagesCount: pkg.dependentPackagesCount,
112112
dependentReposCount: pkg.dependentReposCount,
113-
downloadsLastMonth: pkg.downloads30d,
114113
})
115114
}
116115

@@ -151,7 +150,6 @@ async function processCriticalPackage(
151150
criticalityScore: pkg.criticalityScore,
152151
dependentPackagesCount: pkg.dependentPackagesCount,
153152
dependentReposCount: pkg.dependentReposCount,
154-
downloadsLastMonth: pkg.downloads30d,
155153
})
156154
log.warn({ groupId, artifactId }, 'Not on Maven Central — writing minimal record')
157155
return { status: 'skipped', hopLimitReached: false }
@@ -188,7 +186,6 @@ async function processCriticalPackage(
188186
criticalityScore: pkg.criticalityScore,
189187
dependentPackagesCount: pkg.dependentPackagesCount,
190188
dependentReposCount: pkg.dependentReposCount,
191-
downloadsLastMonth: pkg.downloads30d,
192189
})
193190
log.warn({ groupId, artifactId }, 'No release version in metadata — writing minimal record')
194191
return { status: 'skipped', hopLimitReached: false }
@@ -200,7 +197,6 @@ async function processCriticalPackage(
200197
criticalityScore: pkg.criticalityScore,
201198
dependentPackagesCount: pkg.dependentPackagesCount,
202199
dependentReposCount: pkg.dependentReposCount,
203-
downloadsLastMonth: pkg.downloads30d,
204200
})
205201
log.debug({ groupId, artifactId, version }, 'Version unchanged — skipping POM extraction')
206202
return { status: 'unchanged', hopLimitReached: false }
@@ -229,7 +225,6 @@ async function processCriticalPackage(
229225
criticalityScore: pkg.criticalityScore,
230226
dependentPackagesCount: pkg.dependentPackagesCount,
231227
dependentReposCount: pkg.dependentReposCount,
232-
downloadsLastMonth: pkg.downloads30d,
233228
})
234229
return { status: 'error', hopLimitReached: false }
235230
}
@@ -273,7 +268,6 @@ async function processCriticalPackage(
273268
criticalityScore: pkg.criticalityScore,
274269
dependentPackagesCount: pkg.dependentPackagesCount,
275270
dependentReposCount: pkg.dependentReposCount,
276-
downloadsLastMonth: pkg.downloads30d,
277271
})
278272
pkgChanged.forEach((f) => changed.add(f))
279273

services/libs/data-access-layer/src/osspckgs/packages.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export type MavenPackageToSync = Pick<
2727
| 'criticalityScore'
2828
| 'dependentPackagesCount'
2929
| 'dependentReposCount'
30-
| 'downloads30d'
3130
> & {
3231
purl: string
3332
latestVersion: string | null
@@ -74,7 +73,6 @@ export async function listMavenPackagesToSync(
7473
p.criticality_score AS "criticalityScore",
7574
p.dependent_count AS "dependentPackagesCount",
7675
p.dependent_repos_count AS "dependentReposCount",
77-
p.downloads_last_month AS "downloads30d",
7876
p.latest_version AS "latestVersion"
7977
FROM packages p
8078
WHERE
@@ -106,7 +104,6 @@ export async function listMavenPackagesToSync(
106104
pu.criticality_score AS "criticalityScore",
107105
pu.dependent_count AS "dependentPackagesCount",
108106
pu.dependent_repos_count AS "dependentReposCount",
109-
pu.downloads_30d AS "downloads30d",
110107
p.latest_version AS "latestVersion"
111108
FROM packages_universe pu
112109
LEFT JOIN packages p ON p.purl = pu.purl
@@ -142,7 +139,6 @@ export async function touchPackageSyncedAt(
142139
criticalityScore: number | null | undefined
143140
dependentPackagesCount: number | null | undefined
144141
dependentReposCount: number | null | undefined
145-
downloadsLastMonth: bigint | null | undefined
146142
},
147143
): Promise<void> {
148144
await qx.result(
@@ -151,17 +147,15 @@ export async function touchPackageSyncedAt(
151147
last_synced_at = NOW(),
152148
criticality_score = COALESCE($(criticalityScore), criticality_score),
153149
dependent_count = COALESCE($(dependentPackagesCount), dependent_count),
154-
dependent_repos_count = COALESCE($(dependentReposCount), dependent_repos_count),
155-
downloads_last_month = COALESCE($(downloadsLastMonth), downloads_last_month)
150+
dependent_repos_count = COALESCE($(dependentReposCount), dependent_repos_count)
156151
WHERE purl = $(purl)
157152
`,
158153
{
159154
purl,
160155
criticalityScore: metrics.criticalityScore ?? null,
161156
dependentPackagesCount: metrics.dependentPackagesCount ?? null,
162157
dependentReposCount: metrics.dependentReposCount ?? null,
163-
downloadsLastMonth: metrics.downloadsLastMonth ?? null,
164-
},
158+
},
165159
)
166160
}
167161

@@ -202,13 +196,13 @@ export async function upsertPackage(
202196
purl, ecosystem, namespace, name,
203197
description, homepage, registry_url, declared_repository_url, repository_url,
204198
licenses, licenses_raw, latest_version, versions_count, latest_release_at,
205-
criticality_score, dependent_count, dependent_repos_count, downloads_last_month,
199+
criticality_score, dependent_count, dependent_repos_count,
206200
ingestion_source, last_synced_at
207201
) VALUES (
208202
$(purl), $(ecosystem), $(namespace), $(name),
209203
$(description), $(homepage), $(registryUrl), $(declaredRepositoryUrl), $(repositoryUrl),
210204
$(licenses)::text[], $(licensesRaw), $(latestVersion), $(versionsCount), $(latestReleaseAt),
211-
$(criticalityScore), $(dependentPackagesCount), $(dependentReposCount), $(downloadsLastMonth),
205+
$(criticalityScore), $(dependentPackagesCount), $(dependentReposCount),
212206
$(ingestionSource), NOW()
213207
)
214208
ON CONFLICT (purl) DO UPDATE SET
@@ -225,7 +219,6 @@ export async function upsertPackage(
225219
criticality_score = COALESCE(EXCLUDED.criticality_score, packages.criticality_score),
226220
dependent_count = COALESCE(EXCLUDED.dependent_count, packages.dependent_count),
227221
dependent_repos_count = COALESCE(EXCLUDED.dependent_repos_count, packages.dependent_repos_count),
228-
downloads_last_month = COALESCE(EXCLUDED.downloads_last_month, packages.downloads_last_month),
229222
ingestion_source = EXCLUDED.ingestion_source,
230223
last_synced_at = NOW()
231224
RETURNING id, description, homepage, registry_url, declared_repository_url, repository_url,
@@ -256,7 +249,6 @@ export async function upsertPackage(
256249
criticalityScore: item.criticalityScore ?? null,
257250
dependentPackagesCount: item.dependentPackagesCount ?? null,
258251
dependentReposCount: item.dependentReposCount ?? null,
259-
downloadsLastMonth: item.downloadsLastMonth ?? null,
260252
},
261253
)
262254
return { id: row.id as number, changedFields: row.changed_fields as string[] }

services/libs/data-access-layer/src/osspckgs/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export type IDbPackageUpsert = {
3333
criticalityScore?: number | null
3434
dependentPackagesCount?: number | null
3535
dependentReposCount?: number | null
36-
downloadsLastMonth?: bigint | null
3736
registryUrl?: string | null
3837
repositoryUrl?: string | null
3938
}

0 commit comments

Comments
 (0)