Repository navigation
Implement WorkerInterface::fromException() in Rust behind an autogate - #8732
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8732 +/- ##
==========================================
- Coverage 68.01% 67.73% -0.28%
==========================================
Files 846 847 +1
Lines 219198 215027 -4171
Branches 32587 32588 +1
==========================================
- Hits 149081 145653 -3428
+ Misses 50876 50133 -743
Partials 19241 19241 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3900b4c to
9bb840e
Compare
9bb840e to
9ab7718
Compare
With the RUST_FAILURE_WORKER_INTERFACE autogate enabled, fromException() makes the Rust worker of src/rust/worker/failure.rs instead of the C++ ErrorWorkerInterface. Like it, the Rust worker fails every event with the exception, succeeds at prewarm() and tells a custom event the exception with failed() before failing it. It differs where the C++ one is wrong or incidental: - It fails each event with a copy of the exception, made with kj::Exception::clone(). The C++ one moves the exception out at its first failure, so a second event on the same worker fails with an empty one. - test() fails with the exception. The C++ one inherits the base class's test(), which returns a null promise. - Its failures are rejected promises. The C++ one throws from the call itself, which only a caller that chains on the returned promise without evaluating the call inside a promise or coroutine can tell apart. bench() is the base class's UNIMPLEMENTED in both. worker-interface.c++ now calls into the Rust worker crate, which itself depends on worker-interface.h, so the header gets a header-only :worker-interface-hdrs target for the crate, as worker-factory.h has. The tests run fromException() in both variants: the default one checks the C++ worker and @all-autogates the Rust one.
a3a191e to
edcfbea
Compare
There was a problem hiding this comment.
✅ Approved — The autogated Rust failure worker matches the C++ ErrorWorkerInterface, the build wiring avoids a dependency cycle, and tests cover both variants; no issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
The change adds no trust boundary, input handling, secret or access-control change.
📖 AGENTS.md: ✅ LGTM
The existing Rust and I/O guidance already covers this change, and it needs no new instructions.
📋 Code Quality: ✅ LGTM
The Rust worker behaves like the C++ ErrorWorkerInterface: prewarm() succeeds, every other event fails with a clone of the stored exception, and a custom event is passed the exception through failed() first. The build wiring avoids a dependency cycle by depending on the header-only worker-interface-hdrs. When the autogate is off, fromException() still returns the C++ worker, and the tests cover both variants.
⚡ Performance: ✅ LGTM
No performance concerns.
📝 Documentation: ✅ LGTM
The doc comments describe the current behaviour accurately.
Reviewed commit: edcfbead
WorkerInterface::fromException()makes the worker that stands in forone that couldn't be had: every event on it fails with the given
exception. As part of moving the
WorkerInterfaceimplementations thatdon't need the isolate to the Rust
worker::Interfacetrait, this addsa Rust version of it in
src/rust/worker/failure.rs, used instead ofthe C++
ErrorWorkerInterfacewhen theRUST_FAILURE_WORKER_INTERFACEautogate is enabled.
The Rust worker behaves like the C++ one, except where the C++ behaviour
is incidental: it fails every event with a copy of the exception rather
than moving it out at the first failure,
test()fails with theexception rather than returning a null promise, and its failures are
rejected promises rather than thrown from the call. A Worker sees the
same error either way.
Tests run
fromException()in both variants: the default one exercisesthe C++ worker and
@all-autogatesthe Rust one.