← Back to Pull requests

sbom: look installed files up by binary search #57282

Closed
unknown closed this pull request without merging on Oct 12, 2026 16:54 UTC
View on GitHub
unknown unknown commented on Oct 01, 2026 11:08 UTC
Author

The CWS SBOM resolver finds the package of an opened or executed file by
scanning the hashes of every installed file, then scanning them again
for the owner, up to three times on usr-merged layouts. A container
image holds tens of thousands of files, and the host index that the
runtime usage enrichment of the host SBOM brings into use (#57278)
holds hundreds of thousands: 250,069 on an Ubuntu 24.04 machine, where
a lookup took 82 to 161 µs. Every exec and sampled open of a tracked
process pays one.

Keep the hashes sorted, each with the index of the package listing it,
and binary search them. A path two packages list still resolves to the
first of them in the report, as the scan in report order did. The index
takes 12 bytes a file instead of 8, and building it sorts once per scan.
The two-entry negative cache in front of the scan goes with its lock,
since a miss now costs about as much as taking that lock. Building the
index also drops a trace call per file, which boxed a copy of the
package for every file: 500,000 allocations and 36 MiB for that host.

BenchmarkQueryFile and BenchmarkNewFileQuerier index a synthetic host
of that size, 2,171 packages and 250,069 files, n=6 and p=0.002 for
each line:

name old sec/op new sec/op delta
QueryFile/hit 96.52µ ± 4% 30.62n ± 19% -99.97%
QueryFile/miss 70.24µ ± 1% 33.21n ± 22% -99.95%
QueryFile/usr-merged-miss 141.2µ ± 2% 71.42n ± 15% -99.95%
NewFileQuerier 24.48m ± 9% 44.48m ± 3% +81.68%

name old B/op new B/op delta
NewFileQuerier 36.31Mi ± 0% 2.893Mi ± 0% -92.03%

Diff: 211 lines (+158 / -53) across 2 files Reviewer: 0intro Review duration: 16185m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 211 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.320
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #57282"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 36.5% (MEDIUM) · Higher = larger blast radius
36.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.4% · Safe to merge
14.4%