Keep r2-test's largeListings within its time limit #8836
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 409 lines diff across 5 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.360
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8836"
general
weight: 0.35
piscisaureus
This stops
//src/workerd/server/tests/r2:r2-testfrom timing out atits 15 s limit in CI.
Since R2 buckets landed in #8507 on Nov 19, it timed out in 12 jobs
among failed Tests runs: 5 on test-linux, 4 of them on main; 4 on
Windows; 3 on Linux ASan; plus one on arm64 debug. Every timeout was
inside
largeListings.That case wrote, listed, and deleted two sets of 100 objects with large
metadata. It slowed down far more than the other cases under parallel
load: locally, it took 0.9 s of the test's 1.5 s alone in fastbuild and
4.7-5.8 s of 6.7-7.0 s with 18 tests in parallel. This points at its
many small file operations. A CPU profile showed no hot spot and
nothing quadratic or blocking.
The two commits make these changes:
r2.js: A listing that includes metadata HEADed every object thestore listed, up to 1000, and then kept only the roughly 40 that fit
the 512 KiB reply. It now takes items 16 at a time in the store's
order, HEADs the objects among them at once, and stops at the first
item past the budget.
The reply differs in two cases:
An uncut reply's objects and prefixes are now in the order of
compare, UTF-8 byte order, rather than as the store listed them.These are the same for the local store and for S3 and GCS, which
list in that order.
The objects of batches past the budget are not HEADed, so a HEAD of
one that would have failed other than with a 404 no longer fails
the listing.
This barely speeds up the test, but avoids hundreds of wasted HEADs
on large real listings.
New tests pin both behaviours. A second r2 Worker in the test runs
the same
r2.jsover the same bucket through a small probe Workerthat counts HEADs and fails the HEAD of one key past the budget; the
listing must succeed and HEAD fewer objects than it lists.
listingOrderchecks that an uncut reply of objects and prefixescomes back in UTF-8 byte order, with keys whose UTF-16 order differs.
r2-test.js:largeListingsnow uses one set of 50 objects with3,600 CJK characters of metadata, each followed by a key under a
1 KB prefix. It lists the set with and without a delimiter. Both
listings still span two pages, and the delimited one has about 5 KB
of budget to spare. The page count checks that the budget counts
bytes, not characters: it would fit in one page if characters were
counted.
The test cannot tell whether the cursor skips a prefix's keys because
the local store already skips a common prefix at or before
start-after. The old test could not tell either.The test's size and 15 s limit are unchanged.
Results
Local timings (medians, except the parallel row):
|
largeListings| Before | After || --- | --- | --- |
| Alone, fastbuild | 888 ms | 493 ms |
| 18 runs in parallel | 4.7-5.8 s | 2.1-2.3 s |
Twenty runs each of
r2-test@,@all-autogates,@all-compat-flags, andr2-wrangler-testall passed, 18 at a time.r2-testaveraged 3.5-4.2 s, with a maximum of 4.4 s. Alone, thewhole test takes 1.2 s instead of 1.5 s in fastbuild.
workerd-server_testand the cluster tests, which also list throughr2.js, pass.Lines changed
| Kind | Added | Removed |
| --- | ---: | ---: |
| Implementation | 30 | 17 |
| Tests | 137 | 45 |