Repository navigation
feat: serve dependencies from the serving knowledge base (v0.16.0) - #57
Merged
Merged
Conversation
Moves the service off the mining PostgreSQL database onto the serving DuckDB file, as the other five decoration services already did. Clean cut: there is no configuration that selects the mining path. - pkg/db opens the serving file read-only (duckdb, sqlite or postgres); Database.Path / DB_PATH is new and duckdb is the default driver. - pkg/resolver replaces go-component-helper's GetComponentsVersion, which resolves against all_urls, mines and versions. It tries every spelling the export stores, so scoped npm purls resolve however they are written, and it hands back each component's purl_id. - Licences come from component_version_license through license and "SPDX_license_data". Every licence row of a release is reported; compound identifiers are still split. There is no component-level licence table, so the projects fallback is gone. - Transitive dependencies come from component_version_dependency instead of the per-ecosystem JSON tables, every scope as before; crates map to the export's cargo purl type. The package identifier keeps the namespace for every ecosystem, which fixes scoped npm and composer entries. - Golang tags the export lacks (it carries pseudo-versions only) are answered live from pkg.go.dev, then from the GitHub repository; nothing is written back, and COMP_COMMIT_MISSING is removed. - cgo builds: release in golang:1.25-bookworm with the arm64 cross toolchain, Docker on bookworm with libstdc++6 and ca-certificates. - The service embeds UnimplementedDependenciesServer. - Tests run on SQLite against a transcription of the serving schema.
43% of component_version_license rows point at license 523, which has neither a name nor an identifier: mining's "no licence" row, so mining answered those releases without a licence too. A release with no licence of its own now borrows one, in the order scanoss.api's licence lookup uses, and reports it with info_code WARNING and scanoss.api's info_message: 1. the source component at the same version; 2. the nearest version of the component that has a licence; 3. the nearest version of the source component that has one. A status that already reports a problem keeps its code and gains the message. The placeholder rows (523, "None detected", "UNKNOWN", "unknown") trigger the fallback and are never borrowed. The resolver now hands over the source link it already read, so it is not read again (a scan of component by purl_id), and one query per component reads every licensed release. NearestVersions is ported from scanoss.api, ordering versions semver ranks equal by their build metadata so golang pseudo-versions pick the nearest in time. The live pkg.go.dev lookup of a module is given up after 5 s, both attempts together, and the GitHub repository and the knowledge base answer instead; a slow pkg.go.dev held the whole request (one call took 19 s).
brenbaez
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
dependenciesoff the mining PostgreSQL database onto the serving DuckDB knowledge base, the same migration the other five decoration services (components, cryptography, geoprovenance, licenses, vulnerabilities) went through. Clean cut: no configuration selects the mining path. CHANGELOG versioned as[0.16.0].go-component-helper→all_urls ⋈ mines ⋈ versionspkg/resolver→component,component_versionall_urls ⋈ licenses, fallbackprojectscomponent_version_license ⋈ license ⋈ "SPDX_license_data"golang_projects+ pkg.go.dev (optionally written back)component+ pkg.go.dev (read-only) + GitHub repository<ecosystem>_dependencies.dep_data(JSON)component_version_dependencyConfiguration:
Database.Driverdefaults toduckdb, andDatabase.Path/DB_PATHis new (opened read-only).COMP_COMMIT_MISSINGis gone.Behaviour changes
MIT/Apache-2.0) are still split.projectsequivalent, so a release without a licence reportsNO_INFO.pkg:npm/@angular/core(wasNO_INFO) and, in the transitive walk, scoped npm / composer entries (was 404, because the package identifier dropped the namespace for everything but maven).vmining stored (v5.4.5→5.4.5). An exactly requested version is echoed as the caller spelled it, so golangv1.9.1staysv1.9.1; a bare purl reports the stored spelling.SUCCESS.cargopurl type; the walk mapscratesto it and still answerspkg:crates/....UnimplementedDependenciesServerinstead of the papi interface.Verification
go test ./...passes;golangci-lintv2.10.1: 0 issues.golang:1.25-bookworm(maxGLIBC_2.34) and run againstfull_2026101605.duckdbon d3 with the same 14 requests captured from production v0.15.0:pkg:npm/@angular/coreNO_INFOpkg:github/scanoss/engine5.4.55.4.5(export drops thev)grpcbare purl picks the export's latest pseudo-versionVERSION_NOT_FOUND(the export has the component but no versions); wasCOMPONENT_NOT_FOUND>=4.2508.0.0withNO_INFO(bogus508release in both; its licence row is empty)Not in scope
component_version_licenserows point at alicenserow with an empty name and no SPDX id; those releases reportNO_INFO. That is in the export.Licence fallback (28cdae8)
43% of
component_version_licenserows point atlicense.id = 523, which has neither a name nor an SPDX id. That is mining's "no licence" row: production answers these releases without a licence too (I checked 36 samples against v0.15.0). A release with no licence of its own now borrows one, in the orderscanoss.api's licence lookup uses, and reports it withinfo_code: WARNINGandscanoss.api's message:source_purl_id) at the same version: "Showing results from the source code purl (…)";Details:
REQUIREMENT_NOT_MET,VERSION_NOT_FOUND) keeps its code, and the fallback message is appended.componentbypurl_id). One query per component reads every licensed release.NearestVersionsis ported fromscanoss.apiwith one addition. Versions that semver ranks equal are ordered by their build metadata, so golang pseudo-versions pick the nearest in time.pkg:composer/laravel/frameworkgets MIT frompkg:github/laravel/framework.pkg:pypi/djangoresolves to508.0.0, a bogus release in the export on both sides, and now borrows MIT from the equally bogus503.0.0.pkg.go.dev timeout
The live lookup of a golang module is given up after 5 s, covering both its attempts (with the version, then without), and the GitHub repository and the knowledge base answer instead. The HTTP client also carries the 5 s timeout, so an abandoned call does not linger. A test pins it with a pkg.go.dev that never answers.