Add await_io() and await_io_value() to the Rust io-context crate #8117
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.36) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 191 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.315
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8117"
general
weight: 0.35
nathanwhit
await_io() is the promise-returning counterpart of await_io_and_run(), as
C++ IoContext::awaitIo() is of awaitIoAndRun(): it waits for a future
without the isolate lock, then returns a promise for what its callback
returns when called with the output under the lock. await_io_value() is
await_io() with a callback that converts the output with ToJS.
As in C++, the returned promise settles in a reaction. The callback's Ok
value resolves it, following a promise or thenable. An error the callback
returns is thrown by that reaction, as C++ throwOrReturnResult() does, so
that V8 records an async stack trace; an exception that JavaScript threw
in the callback rejects it. A panic while polling the future rejects it
with an internal error and lets execution continue, as a KJ exception from
the I/O does for C++ awaitIo(). A panic in the callback, or a termination,
settles nothing and fails the task, as for await_io_and_run().
A panic while dropping the future no longer aborts the process. kj-rs drops
the future of io_future_wait() through an extern "C" function, so a panic
in the drop of a cancelled future now is caught and logged. await_io()
drops its future once the output is ready, catching and logging a panic
there too, and keeps the output.
The first commit adds TestFixture::setLimitsExceeded(), which the test of a termination in the callback uses: the mock limit enforcer then reports the given outcome and fails requireLimitsNotExceeded(), as the real enforcer does once a limit such as CPU time is exceeded.