feat: add migration for blast radius analysis (CM-1328)#4374
Conversation
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
PR SummaryLow Risk Overview
Aggregated report metrics are not stored; they’re intended to be computed from Reviewed by Cursor Bugbot for commit b2dd456. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
Adds PostgreSQL persistence for the four-stage blast-radius analysis pipeline.
Changes:
- Adds schemas for analyses, symbol specifications, dependents, verdicts, and stage runs.
- Adds integrity constraints and query indexes.
- Keeps aggregate reports derived from verdict data.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| analysis_id UUID NOT NULL REFERENCES blast_radius_analyses (id), | ||
| dependent_id BIGINT NOT NULL UNIQUE REFERENCES blast_radius_dependents (id), |
Summary
Adds the database schema for the blast-radius analysis pipeline (CM-1328). This PR is migrations only — it lays the ground for replicating the blast-radius PoC pipeline (intel → dependents → reachability → report) on top of the new blast-radius worker, backed by the database instead of the PoC's per-run JSON files under
data/<VULN-ID>/. API/data-access-layer wiring lands in a follow-up PR.Changes
backend/src/osspckgs/migrations/V1784700000__blast_radius_analyses.sql, adding 5 tables:blast_radius_analyses— one row per submitted job (idmatches theanalysisIdalready generated bysubmitBlastRadiusJob). Stores the rawadvisory_osv_id/package_namefrom the request plus nullableadvisory_id/package_idFKs, resolved later — the advisory or package may not be ingested yet when the job is submitted.blast_radius_symbol_specs— stage 1 (intel) output, 1:1 with an analysis.blast_radius_dependents— stage 2 output; unifies the PoC's "analyzed" and "excluded_by_range" dependent lists into one table via anexcluded_by_rangeflag, since excluded candidates never get a resolved version/tarball.blast_radius_verdicts— stage 3 output, 1:1 with a non-excluded dependent, including per-verdictcost_usd/turns_used/model.blast_radius_stage_runs— dedicated performance-monitoring table: one row per(analysis, stage)trackingduration_ms/cost_usd/model, kept independent of the ecosystem-specific tables so it keeps working as more ecosystems are added.blast_radius_verdictsat read time to avoid keeping a denormalized copy in sync.CREATE TABLE/INDEX IF NOT EXISTS, noALTERon existing tables) — no lock risk onpackages/advisoriesin production.packages-dbimage (built fromscripts/packages-db/Dockerfile, which includespg_partman).Type of change
JIRA ticket
CM-1328