Skip to content

Fix readiness signal ownership compile error#444

Merged
leynos merged 2 commits intomainfrom
fix-readiness-signal-ownership-ki23o2
Feb 5, 2026
Merged

Fix readiness signal ownership compile error#444
leynos merged 2 commits intomainfrom
fix-readiness-signal-ownership-ki23o2

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Feb 5, 2026

Summary

  • Fix readiness signal ownership compile error by switching to an option-pattern that safely borrows or moves the sender as needed
  • Minor documentation formatting adjustments to improve readability and accuracy

Changes

Core

  • Server runtime: Refactor readiness signaling in src/server/runtime.rs to use if let Some(tx) = ready_tx and gracefully handle the send error instead of using is_some_and. This avoids ownership issues when signaling readiness.

Documentation

  • Docs formatting:
    • docs/execplans/migrate-from-cucumber-to-rstest-bdd.md: wrap long mitigation line for readability
    • docs/server/configuration.md: update reference to readiness signal location (line number)

Test plan

  • Build the project: cargo build
  • Run the server and verify readiness is signaled after all workers spawn
  • Ensure a warning is logged if the readiness receiver is dropped
  • Verify there are no compile-time ownership errors related to readiness signaling

◳ Generated by DevBoxer


ℹ️ Tag @devboxerhub to ask questions and address PR feedback

📎 Task: https://www.devboxer.com/task/ebae0089-4582-46b8-8dd7-b6380ec2cec2

📝 Closes #311

Summary by Sourcery

Fix readiness signaling in the server runtime to avoid ownership issues and update related documentation references.

Bug Fixes:

  • Correct readiness signaling logic to prevent ownership-related compile errors when sending the readiness signal.

Documentation:

  • Wrap a long mitigation line in the Cucumber-to-rstest-bdd migration guide for improved readability.
  • Update the documented source location of the readiness signal in the server configuration guide.

Refactored the readiness signal sending in src/server/runtime.rs to use a clearer if let statement and handle the error with a map_err call. Also updated documentation references to reflect new line numbers. This improves code readability and maintainability without changing functionality.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated server configuration documentation to clarify readiness signalling implementation.
    • Minor formatting refinements to migration planning documentation.
  • Refactor

    • Improved code clarity and control flow in server runtime handling for enhanced maintainability.

Walkthrough

Describe the compilation fix: replace is_some_and borrow pattern with explicit Some(tx) pattern to move the sender and call send(). Update documentation reference and adjust minor formatting in an execplan doc.

Changes

Cohort / File(s) Summary
Readiness signal fix
src/server/runtime.rs
Replace `ready_tx.is_some_and(
Configuration docs update
docs/server/configuration.md
Update readiness signalling location reference to reflect the runtime change (function-path in WireframeServer::run_with_shutdown) and adjust line reference.
Documentation formatting
docs/execplans/migrate-from-cucumber-to-rstest-bdd.md
Minor line-wrapping/inline code formatting change for the Risk 3 mitigation text only; no behavioural change.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🦀 Ownership nudged where borrow would stall,
Move the sender, let the readiness call.
Docs refreshed, a tidy line,
Compile now passes, all align. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change—fixing a readiness signal ownership compile error—which is the core issue addressed in the PR.
Description check ✅ Passed The description relates to the changeset, outlining the core fix to readiness signalling and documentation updates, and includes a test plan.
Linked Issues check ✅ Passed The code changes directly address issue #311's requirements: replacing is_some_and with an if let Some(tx) pattern that moves the sender and handles send errors correctly.
Out of Scope Changes check ✅ Passed All changes are in-scope: runtime refactoring addresses the ownership issue, and documentation updates relate to readiness signalling location and formatting for readability.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-readiness-signal-ownership-ki23o2

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

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Feb 5, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the server runtime readiness signaling logic to avoid ownership issues when sending the readiness signal and updates related documentation for readability and accuracy.

Sequence diagram for updated readiness signaling in server runtime

sequenceDiagram
    participant ServerRuntime
    participant ReadySender
    participant ReadyReceiver
    participant Logger

    ServerRuntime->>ServerRuntime: spawn_all_workers()
    ServerRuntime-->>WorkerTasks: workers spawned

    ServerRuntime->>ServerRuntime: check ready_tx
    alt ready_tx_some
        ServerRuntime->>ReadySender: send(())
        alt receiver_alive
            ReadySender-->>ReadyReceiver: deliver readiness signal
            ReadyReceiver-->>ServerRuntime: readiness_ack
        else receiver_dropped
            ReadySender--xReadyReceiver: send fails
            ReadySender->>Logger: log warning receiver dropped
        end
    else ready_tx_none
        ServerRuntime-->>ServerRuntime: skip readiness signaling
    end

    ServerRuntime->>ServerRuntime: enter accept_loop()
Loading

File-Level Changes

Change Details Files
Refactor readiness signaling to avoid ownership/borrowing issues when sending the readiness signal.
  • Replace is_some_and-based readiness check with an if-let pattern that consumes the optional sender
  • Send the readiness signal only when a sender is present and ignore the successful result
  • Map send errors into a warning log indicating the readiness receiver was dropped
src/server/runtime.rs
Tidy and align documentation with the updated readiness signaling implementation.
  • Reflow a long mitigation line in the Cucumber-to-rstest-bdd migration guide for readability
  • Update the documented source reference line number for the readiness signal location in the server configuration guide
docs/execplans/migrate-from-cucumber-to-rstest-bdd.md
docs/server/configuration.md

Assessment against linked issues

Issue Objective Addressed Explanation
#311 Fix the readiness signalling compile error by changing the ready_tx handling so that the oneshot::Sender is moved (not borrowed) when calling send, while preserving the warning log if sending fails.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@leynos leynos marked this pull request as ready for review February 5, 2026 11:55
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In src/server/runtime.rs, the map_err(|()| ...) on tx.send(()) looks incorrect for a oneshot::Sender (the error type isn’t ()); consider simplifying to if tx.send(()).is_err() { warn!(...) } to both fix the type and make the intent clearer.
  • The docs change in docs/server/configuration.md still hardcodes a specific source line number; consider referencing a function/section name or using a more stable marker instead of a line number to avoid future drift.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `src/server/runtime.rs`, the `map_err(|()| ...)` on `tx.send(())` looks incorrect for a `oneshot::Sender` (the error type isn’t `()`); consider simplifying to `if tx.send(()).is_err() { warn!(...) }` to both fix the type and make the intent clearer.
- The docs change in `docs/server/configuration.md` still hardcodes a specific source line number; consider referencing a function/section name or using a more stable marker instead of a line number to avoid future drift.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Refactored the readiness signal sending in `WireframeServer::run_with_shutdown` to a more concise pattern using combined `if let` and condition check.

Also updated related documentation to specify the exact location of readiness signalling in the code for clarity.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 5, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos leynos merged commit e9803b4 into main Feb 5, 2026
6 checks passed
@leynos leynos deleted the fix-readiness-signal-ownership-ki23o2 branch February 5, 2026 13:29
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.

Fix readiness signal handling: is_some_and borrows but send() requires ownership

1 participant