test(engine): stabilize runner and envoy suites#4809
test(engine): stabilize runner and envoy suites#4809NathanFlurry wants to merge 2 commits intoengine-stabilize/reject-empty-actor-kv-valuesfrom
Conversation
|
PR 4809 Code Review: stabilize runner and envoy suites This is a DRAFT PR. Review provided for early feedback. Overview Large test-infrastructure overhaul (11,713 additions, 816 deletions, 43 files). The PR:
The direction is correct: separating the two connection paths into distinct test clients ensures envoy tests exercise the envoy protocol and runner tests exercise the runner protocol. Issues Critical — Spin-wait in Runner::wait_ready() violates CLAUDE.md CLAUDE.md prohibits: "Never poll a shared-state counter with loop { if ready; sleep(Nms).await; }. Pair the counter with a tokio::sync::Notify..." The current implementation polls every 25ms using AtomicBool. Fix by adding a tokio::sync::Notify field, signalling it in handle_message when ToClientInit arrives, and awaiting notified() in wait_ready(). Medium — actors mutex held across on_stop().await In Runner::handle_stop_actor(), the actors mutex guard remains alive while on_stop().await executes. This blocks concurrent handle_start_actor and has_actor calls. Fix by scoping the lock acquisition so the guard drops before calling the callback: take the actor out of the map inside a block that owns the guard, then call on_stop() after the block ends. Medium — Misleading _kv_tx name in test_envoy.rs In TestEnvoyCallbacks::actor_config(), the variable _kv_tx is moved into ActorConfig::kv_request_tx. It is not unused. The underscore prefix signals "intentionally unused" to readers and clippy. Rename to kv_tx. Medium — Unexplained behaviour changes in actors_scheduling_errors.rs The assertion "no_runners_available" is changed to "no_runner_config_configured" without explanation. Also, actor_crash_destroy_policy flips from asserting "no error on destroy" to asserting "Crashed error is set with a crash message". If these reflect real engine behaviour changes they should be documented in the PR description or in a comment. Low — std::sync::Mutex in async code Test actors use std::sync::Mutex for notify-sender patterns. CLAUDE.md requires parking_lot::Mutex for forced-sync contexts in async code. No guard crosses an .await so the risk is low, but the rule should be followed consistently. Low — Approximately 40 ignored tests with no tracking path Each ignore comment names the failure symptom clearly. However no linked issue tracks re-enabling them. Several failures ("times out in full engine sweep") suggest a systemic setup problem; fixing it would unblock many tests at once. Consider linking a tracking issue in the ignore reason. Low — Deprecated polling helper used in new envoy alarm tests wait_for_actor_wake_polling documents itself as "DEPRECATED for other tests" in its docstring, yet new envoy alarm tests (basic_alarm, alarm_in_the_past, etc.) call it. Use the event-driven wait_for_actor_wake_from_alarm where possible to reduce timing flakiness. Positive observations
Minor style notes
Review generated by claude[bot] |
f9362ab to
c12d710
Compare
91328b0 to
ff28b88
Compare
c12d710 to
a2d5d39
Compare
ff28b88 to
a35b876
Compare
a2d5d39 to
7f0614e
Compare

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: