Skip to content

[rust] worker interface#6621

Merged
mikea merged 1 commit intomainfrom
maizatskyi/2026-04-20-rust-worker
Apr 24, 2026
Merged

[rust] worker interface#6621
mikea merged 1 commit intomainfrom
maizatskyi/2026-04-20-rust-worker

Conversation

@mikea
Copy link
Copy Markdown
Contributor

@mikea mikea commented Apr 20, 2026

upstreaming internal work to start building on it.

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

This introduces a Rust worker::Interface trait mirroring workerd::WorkerInterface, with FFI bridging and two simple implementations (error worker, kill-switch worker).

Findings (highest severity first):

  1. [MEDIUM] SCRIPT_KILLED_DETAIL_ID in bridge.h uses const uint64_t instead of constexpr kj::Exception::DetailTypeId, inconsistent with the rest of the codebase.
  2. [LOW] error.rs:86 uses std::result::Result<AlarmResult, KjError> while all other methods in the same file use crate::Result<T> — inconsistent.
  3. [LOW] Commented-out internal references leaked from internal repo (edgeworker namespace in test, commented-out #include and BUILD dep).
  4. [LOW] Typo in lib.rs doc comment: "rusts's" should be "Rust's".

These comments were generated by an AI code review assistant and may contain inaccuracies.

Comment thread src/rust/worker/bridge.h Outdated
Comment thread src/rust/worker/error.rs Outdated
Comment thread src/rust/worker/test.c++ Outdated
Comment thread src/rust/worker/BUILD Outdated
Comment thread src/rust/worker/lib.rs Outdated
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 20, 2026

Review posted successfully on PR #6621 with 5 inline comments covering:

  1. [MEDIUM] SCRIPT_KILLED_DETAIL_ID should use constexpr kj::Exception::DetailTypeId to match the codebase convention (with suggestion).
  2. [LOW] Inconsistent std::result::Result vs crate::Result in error.rs (with suggestion).
  3. [LOW] Commented-out internal includes/namespace in test file.
  4. [LOW] Commented-out internal BUILD dependency.
  5. [LOW] Typo "rusts's" in doc comment (with suggestion).

github run

@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch 4 times, most recently from 6a15a48 to ea13699 Compare April 21, 2026 15:46
Comment thread src/rust/worker/bridge.h
@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch from ea13699 to 114b9d1 Compare April 21, 2026 17:53
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

This PR introduces a Rust worker::Interface trait mirroring workerd::WorkerInterface, with FFI bridging via CXX, and two simple implementations (error worker, kill-switch worker).

Findings (highest severity first):

  1. [HIGH] CPU_LIMIT_DETAIL_ID value mismatch between Rust and C++ — the Rust constant has a missing hex digit, causing a silently wrong value.
  2. [LOW] compile_flags.txt references errors.rs@cxx but the source file is error.rs (no trailing 's').
  3. [LOW] All new files (.rs, .h, .c++) are missing copyright/license headers, which the codebase requires.

Note: the SCRIPT_KILLED_DETAIL_ID const/constexpr issue from the previous review is still valid and unaddressed.


These comments were generated by an AI code review assistant and may contain inaccuracies.

Comment thread src/rust/worker/exception.rs Outdated
Comment thread compile_flags.txt Outdated
Comment thread src/rust/worker/lib.rs
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 21, 2026

Review posted successfully on PR #6621 with 3 inline comments covering:

  1. [HIGH] CPU_LIMIT_DETAIL_ID value mismatch — the Rust constant 0xfdc_b787_ba24_0576 is 15 hex digits, missing a 4 compared to the C++ value 0xfdcb787ba4240576ull (16 hex digits). These are entirely different values. (with suggestion)
  2. [LOW] compile_flags.txt typo: errors.rs@cxx should be error.rs@cxx (with suggestion)
  3. [LOW] All 8 new files are missing copyright/license headers required by codebase convention.

github run

@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch from 114b9d1 to 1ecc930 Compare April 21, 2026 19:02
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 21, 2026

UnknownError: ProviderInitError

github run

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 21, 2026

@mikea Bonk workflow failed. Check the logs for details.

View workflow run · To retry, trigger Bonk again.

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 21, 2026

UnknownError: ProviderInitError

github run

@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch from 1ecc930 to 8f12f3c Compare April 21, 2026 20:42
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Apr 21, 2026

LGTM

github run

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 21, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing maizatskyi/2026-04-20-rust-worker (861eb04) with main (94328e1)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch 2 times, most recently from 17d219e to af2a35f Compare April 22, 2026 19:07
@mikea mikea marked this pull request as ready for review April 22, 2026 19:47
@mikea mikea requested review from a team as code owners April 22, 2026 19:47
Comment thread src/rust/worker/lib.rs
Comment thread src/rust/worker/kill_switch.rs Outdated
Comment thread src/rust/worker/kill_switch.rs
Comment thread src/rust/worker/ffi.rs
Comment thread src/rust/worker/ffi.rs
Copy link
Copy Markdown
Collaborator

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of nits, otherwise LGTM

@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch 2 times, most recently from 0090dae to 72b2473 Compare April 24, 2026 16:42
@mikea mikea requested a review from jasnell April 24, 2026 16:42
upstreaming internal work to start building on it.
@mikea mikea force-pushed the maizatskyi/2026-04-20-rust-worker branch from 72b2473 to 861eb04 Compare April 24, 2026 22:08
@mikea mikea merged commit 2e5edd0 into main Apr 24, 2026
22 checks passed
@mikea mikea deleted the maizatskyi/2026-04-20-rust-worker branch April 24, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants