sbom: look installed files up by binary search #57282
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
0intro
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%