Skip to content

ci: fix bench#1319

Merged
guibeira merged 2 commits intomainfrom
fix-benchmark-pipeline
Apr 1, 2026
Merged

ci: fix bench#1319
guibeira merged 2 commits intomainfrom
fix-benchmark-pipeline

Conversation

@guibeira
Copy link
Copy Markdown
Contributor

@guibeira guibeira commented Mar 17, 2026

Summary by CodeRabbit

  • Tests
    • Enhanced HTTP route readiness checking to support concurrent request batching during initialization.
    • Improved timeout error messages to include request paths and concurrent request counts for better debugging.
    • Refined WebSocket and HTTP concurrency benchmark harnesses for more robust testing.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
iii-docs Ready Ready Preview, Comment Apr 1, 2026 2:05pm
iii-website Ready Ready Preview, Comment Apr 1, 2026 2:05pm
motia-docs Ready Ready Preview, Comment Apr 1, 2026 2:05pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Three benchmark harnesses updated to support concurrent request validation, eliminate temporary config file generation in websocket tests, and improve runtime lifecycle management with better error reporting.

Changes

Cohort / File(s) Summary
HTTP Blackbox Concurrent Requests
engine/benches/http_blackbox/mod.rs
Added wait_for_stable_route() public method to support configurable concurrent request batching for route readiness checks. Refactored internal wait_for_route() to delegate to batch implementation with concurrent_requests = 1. Updated timeout messages to include path and batch size context. Added futures_util::future::join_all import for parallel request fan-out.
WebSocket Roundtrip Config Elimination
engine/benches/ws_roundtrip_bench.rs
Replaced temporary config file generation with direct EngineBuilder::add_module() registration of WorkerModule. Removed EngineConfig and NamedTempFile dependencies. Updated websocket message payloads to include action: None field on Message::InvokeFunction across all invocation paths. Modified message match arm with .. pattern to handle extended payload.
HTTP Concurrency Loop Restructuring
engine/benches/http_concurrency_loopback_bench.rs
Moved BenchRuntime::start() and target_path initialization inside per-concurrency loop, with wait_for_stable_route() called before each iteration. Runtime shutdown relocated inside loop. Enhanced response status assertion to capture status value and provide diagnostic error message format (expected success, got {status}).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • sergiofilhowz

Poem

🐰 A rabbit hopped through the benchmarks so fast,
With concurrent requests now holding steadfast,
No config files cluttering the warren with mess,
Just stable routes ready—we're testing the best! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'ci: fix bench' is vague and overly generic. While it references CI and benchmarks, it does not convey what specific issue was fixed or what changes were made to address it. Replace with a more specific title describing the actual fix, such as 'ci: improve benchmark HTTP route readiness checking with concurrent requests' or 'ci: fix benchmark setup with configurable concurrent request validation'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-benchmark-pipeline

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
engine/benches/http_blackbox/mod.rs (1)

211-218: Avoid silently accepting action-based invokes in this benchmark worker.

Using action: _ makes Some(...) follow the same echo path as baseline invokes, which can hide action-routing regressions. Prefer matching action: None and handling Some(...) separately.

♻️ Proposed change
                     Message::InvokeFunction {
                         invocation_id,
                         function_id,
                         data,
                         traceparent,
                         baggage,
-                        action: _,
+                        action: None,
                     } => {
                         let invocation_id = invocation_id.unwrap_or_else(Uuid::new_v4);
                         let response = Message::InvocationResult {
                             invocation_id,
                             function_id,
@@
                         let _ = outbound_tx.send(WsMessage::Text(
                             serde_json::to_string(&response)
                                 .expect("serialize InvocationResult")
                                 .into(),
                         ));
                     }
+                    Message::InvokeFunction { action: Some(_), .. } => {}
                     _ => {}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@engine/benches/http_blackbox/mod.rs` around lines 211 - 218, The current
match arm for Message::InvokeFunction uses action: _ which treats action-bearing
invokes the same as baseline echoes; update the pattern to match action: None in
the Message::InvokeFunction arm (preserving invocation_id, function_id, data,
traceparent, baggage) and add a separate match arm for Message::InvokeFunction {
invocation_id, function_id, data, traceparent, baggage, action: Some(action) }
that explicitly handles or logs/errors on action-based invokes (e.g., return an
error or panic/log a warning) so action routing regressions aren't silently
accepted; adjust any downstream uses of invocation_id/function_id accordingly.
engine/benches/ws_roundtrip_bench.rs (1)

220-227: Prefer strict action handling in the service worker match.

action: _ will echo action-based invokes the same as baseline invokes. Matching action: None explicitly makes this benchmark less likely to mask action-routing regressions.

♻️ Proposed change
                     Message::InvokeFunction {
                         invocation_id,
                         function_id,
                         data,
                         traceparent,
                         baggage,
-                        action: _,
+                        action: None,
                     } => {
                         let invocation_id = invocation_id.unwrap_or_else(Uuid::new_v4);
                         let response = Message::InvocationResult {
                             invocation_id,
                             function_id,
@@
                             .await
                             .expect("send InvocationResult");
                     }
+                    Message::InvokeFunction { action: Some(_), .. } => {}
                     _ => {}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@engine/benches/ws_roundtrip_bench.rs` around lines 220 - 227, The pattern
matching arm for Message::InvokeFunction currently uses a wildcard for the
action field (action: _), which conflates action-based invokes with baseline
invokes; update the match to explicitly require action: None in that arm (i.e.,
Message::InvokeFunction { invocation_id, function_id, data, traceparent,
baggage, action: None, } ) and add a separate arm (or an explicit match case) to
handle Some(action) if needed so action-based invokes are not treated as
baseline in ws_roundtrip_bench.rs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@engine/benches/http_blackbox/mod.rs`:
- Around line 211-218: The current match arm for Message::InvokeFunction uses
action: _ which treats action-bearing invokes the same as baseline echoes;
update the pattern to match action: None in the Message::InvokeFunction arm
(preserving invocation_id, function_id, data, traceparent, baggage) and add a
separate match arm for Message::InvokeFunction { invocation_id, function_id,
data, traceparent, baggage, action: Some(action) } that explicitly handles or
logs/errors on action-based invokes (e.g., return an error or panic/log a
warning) so action routing regressions aren't silently accepted; adjust any
downstream uses of invocation_id/function_id accordingly.

In `@engine/benches/ws_roundtrip_bench.rs`:
- Around line 220-227: The pattern matching arm for Message::InvokeFunction
currently uses a wildcard for the action field (action: _), which conflates
action-based invokes with baseline invokes; update the match to explicitly
require action: None in that arm (i.e., Message::InvokeFunction { invocation_id,
function_id, data, traceparent, baggage, action: None, } ) and add a separate
arm (or an explicit match case) to handle Some(action) if needed so action-based
invokes are not treated as baseline in ws_roundtrip_bench.rs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 310c7af1-1204-41de-a950-84765e0dfeab

📥 Commits

Reviewing files that changed from the base of the PR and between e95dc60 and 8231f11.

📒 Files selected for processing (3)
  • engine/benches/http_blackbox/mod.rs
  • engine/benches/protocol_serde_bench.rs
  • engine/benches/ws_roundtrip_bench.rs

sergiofilhowz
sergiofilhowz previously approved these changes Mar 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
engine/benches/ws_roundtrip_bench.rs (1)

55-57: ⚠️ Potential issue | 🟠 Major

Surface engine startup failures instead of swallowing them.

At Line 56, let _ = builder.serve().await; drops the actual startup error. If serve fails, startup then degrades into timeout/panic paths (Lines 59-65) without the real cause, which makes CI bench failures hard to diagnose and undermines the retry intent.

Also applies to: 59-65

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@engine/benches/ws_roundtrip_bench.rs` around lines 55 - 57, The spawn
currently swallows errors by doing `let _ = builder.serve().await;` inside the
`tokio::spawn` task (the `engine_task`), losing the real startup failure; change
the task to surface the `serve()` result instead of discarding it — e.g., have
the async move return the Result from `builder.serve().await` (or call
`.expect()`/`.unwrap()` with a clear message) and then check the JoinHandle
(`engine_task.await`) so any error from `builder.serve()` is propagated/logged
to the test harness; apply the same fix to the other similar block(s) around
lines 59-65 so no startup errors are swallowed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@engine/benches/http_blackbox/mod.rs`:
- Around line 94-101: The readiness check allows concurrent_requests == 0 which
creates an empty probe batch and incorrectly treats the route as ready; in
wait_for_stable_route (and any other callers that pass concurrent_requests to
wait_for_route_batch) validate or clamp concurrent_requests to at least 1 before
building the batch—e.g., if concurrent_requests == 0 set it to 1 or return an
error/Result indicating invalid input—so wait_for_route_batch is never invoked
with a zero-sized batch.

---

Outside diff comments:
In `@engine/benches/ws_roundtrip_bench.rs`:
- Around line 55-57: The spawn currently swallows errors by doing `let _ =
builder.serve().await;` inside the `tokio::spawn` task (the `engine_task`),
losing the real startup failure; change the task to surface the `serve()` result
instead of discarding it — e.g., have the async move return the Result from
`builder.serve().await` (or call `.expect()`/`.unwrap()` with a clear message)
and then check the JoinHandle (`engine_task.await`) so any error from
`builder.serve()` is propagated/logged to the test harness; apply the same fix
to the other similar block(s) around lines 59-65 so no startup errors are
swallowed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7ddb3acc-d876-43b3-bc62-dc728c0ef8dc

📥 Commits

Reviewing files that changed from the base of the PR and between 8231f11 and 5144eea.

📒 Files selected for processing (3)
  • engine/benches/http_blackbox/mod.rs
  • engine/benches/http_concurrency_loopback_bench.rs
  • engine/benches/ws_roundtrip_bench.rs

Comment thread engine/benches/http_blackbox/mod.rs
@guibeira guibeira merged commit 2b708ea into main Apr 1, 2026
6 of 19 checks passed
@guibeira guibeira deleted the fix-benchmark-pipeline branch April 1, 2026 16:43
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