Branch comparison
Branch comparison takes the latest completed scan on two branches and shows which findings the compare branch introduces, which it resolves, and how many stay the same. Use it before merging a feature branch, or to check what a release branch changed.
Compare two branches
What you see
- Exposure banner - whether total exposure increased, decreased or stayed the same. It also states how many new Critical or High findings need review before merging.
- Introduced - findings on the compare branch that are not on the base branch, with a Critical, High, Medium and Low breakdown.
- Resolved - findings on the base branch that are gone on the compare branch, with the same breakdown.
- Net exposure - total findings on the compare branch minus the base branch, shown as
base → compare. - Unchanged - a count of findings present on both scans.
- Scan provenance - the scan ID and date used for each side.
- Severity movement - a chart of introduced and resolved findings by severity.
- Introduced on
<compare>and Resolved on<compare>- the finding lists, each with View all in triage.
If either scan did not complete with full engine coverage, an empty Introduced list reads No new findings in the scanned coverage and names the incomplete side. It is not presented as a clean result.
How findings are matched
A finding is identified by its file, line and the first 50 characters of its message. Matching identities on both sides count as Unchanged. A finding whose line moved between branches therefore shows up once as resolved and once as introduced.
The comparison uses the latest completed scan on each branch, whatever its scan type, and includes every finding on those scans, not only dependency advisories. For a like-for-like result, run the same scan type on both branches.
API
GET /api/sca/branch-compare/{repository_id}?base_branch=main&compare_branch=feature/logincompare_branch is required. base_branch defaults to main. The response includes:
| Field | Meaning |
|---|---|
base_scan_id, compare_scan_id | Scans used, null when a branch has none |
base_scan_health, compare_scan_health | Engine coverage of each scan |
summary.new_issues, summary.fixed_issues, summary.common_issues | Counts |
summary.base_total, summary.compare_total | Total findings on each scan |
summary.new_by_severity, summary.fixed_by_severity | Severity breakdowns |
new_issues, fixed_issues | Up to 50 findings each |
When neither branch has a completed scan, the response is {"error": "No completed scans found for either branch"}.
Use cases
- Pre-merge review - check what a feature branch introduces before merging to the default branch.
- Release tracking - see what a release branch fixed and what it introduced.
- Regression check - confirm a hotfix branch did not bring back resolved findings.
For the difference between two scans of the same branch, use Dependency diff.