Repository navigation
perf(depscan): skip a scheduled rescan when OSV answers the same - #2685
Merged
Merged
Maple Review Bot / Maple / review
succeeded
Nov 16, 2026 in 2m 25s
Confidence 10/10 · No issues found
🟢 Confidence 10/10 · safe to merge. Skip, fallbacks and the failed-scan regression are each pinned by call-counting tests; the residual assumption is OSV bumping modified when a record is edited.
no findings · tests covered · risk medium · 3/3 new units observable
A scheduled dependency rescan now returns Unchanged without a scan row when the commit and OSV's answer are unchanged, with the lockfile plan cached per commit and a new advisory_fingerprint column. Every skip and fallback path is pinned by new tests; safe to merge.
DependencyScanner.scanprechecks a scheduled head scan and skips when the OSV fingerprint matchesPackageAdvisoryCatalogsplits intoquery(querybatch) andresolve(record reads), withfingerprintOfdependency_scans.advisory_fingerprintstores the OSV answer only on scans that reconciled- Commit lockfile selection is cached as a plan keyed by provider, repo and commit sha
Before merge
- Migration · Check it is safe on production data and with the code still deployed ·
packages/db/drizzle/20261116082407_dependency_scan_advisory_fingerprint/migration.sql - Manual · Deploy applies
20261116082407_dependency_scan_advisory_fingerprint; existing rows have a null fingerprint, so every repository full-scans once after rollout
Production impact
Production traffic of the changed files (last 7 days)
| File | Calls/day | Busiest operations |
|---|---|---|
packages/backend/src/services/security/PackageAdvisoryCatalog.ts |
12k | PackageAdvisoryCatalog.advisories 12k/day, 0.0% err |
Telemetry this change adds and removes (2)
- ➕ span name
PackageAdvisoryCatalog.query·packages/backend/src/services/security/PackageAdvisoryCatalog.ts:211 - ➕ span name
PackageAdvisoryCatalog.resolve·packages/backend/src/services/security/PackageAdvisoryCatalog.ts:223
What was checked
- Skip needs the newest any-status head scan to be completed, errorless, same commit, with a fingerprint (
DependencyScanner.ts:490) getOrComputepropagates the compute error, so a truncated tree is never cached as a plan (lib/cache/src/edge-cache.ts:460)selectLockfiles/manifestsForare pure and sorted, so a cached plan equals a fresh one (lockfile-selection.ts:53)
Observability coverage: 3 of 3 changes observable
| Change | Kind | Observable | Evidence |
|---|---|---|---|
| Scheduled scan precheck and skip (DependencyScanner.scan) | background job step | yes | Runs inside the existing DependencyScanner.scan span; outcome annotated as maple.depscan.outcome=unchanged with maple.depscan.skip_reason (DependencyScanner.ts:523) |
| OSV querybatch advisory query | outbound call | yes | New PackageAdvisoryCatalog.query span wrapping the existing osv.querybatch client span with peer.service=osv.dev (PackageAdvisoryCatalog.ts:219, :144) |
| Commit scan-plan cache read/write | cache | yes | EdgeCacheService.getOrCompute span records bucket, hit/miss, read_ms (loadPlan, DependencyScanner.ts:331) |
4267722 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Loading