Skip to content

Add advanced fuzzing tests for push & stream handling#155

Merged
leynos merged 4 commits intomainfrom
codex/implement-tests-for-streams-and-push-delivery
Jun 30, 2025
Merged

Add advanced fuzzing tests for push & stream handling#155
leynos merged 4 commits intomainfrom
codex/implement-tests-for-streams-and-push-delivery

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jun 29, 2025

Summary

  • mark advanced push/stream tests as complete in roadmap
  • add proptest fuzzing test for push and stream responses
  • add loom concurrency test for concurrent push delivery
  • run advanced tests daily on GitHub workflow
  • add proptest and loom dev dependencies

Testing

  • make fmt
  • make lint
  • make test
  • nixie run attempted but failed due to event loop errors

https://chatgpt.com/codex/tasks/task_e_6861972605248322ac1de3f9ba0bf9f5

Summary by Sourcery

Add advanced fuzzing and concurrency tests for push and stream handling, update the roadmap to mark them complete, and schedule daily runs via GitHub Actions

New Features:

  • Introduce property-based fuzzing tests for push and stream responses using proptest
  • Add concurrency tests for concurrent push delivery using loom

Enhancements:

  • Mark advanced push/stream tests as complete in the asynchronous-outbound-messaging roadmap

Build:

  • Add proptest and loom as development dependencies under a new advanced-tests feature flag

CI:

  • Add a GitHub Actions workflow to run advanced tests daily with the advanced-tests feature

Documentation:

  • Update roadmap documentation to reflect completion of advanced push and stream tests

Tests:

  • Add advanced/interaction_fuzz.rs with proptest-based fuzzing scenarios
  • Add advanced/concurrency_loom.rs with loom-based concurrency scenarios

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 29, 2025

Reviewer's Guide

Introduce an advanced-tests feature flag with proptest and loom dependencies, update documentation, add fuzzing and concurrency tests under a new tests/advanced directory, and schedule a daily GitHub Actions workflow to run these tests.

Class diagram for advanced test modules and dependencies

classDiagram
  class interaction_fuzz {
    +proptest::proptest
    +test_push_response()
    +test_stream_response()
  }
  class concurrency_loom {
    +loom::model
    +test_concurrent_push_delivery()
  }
  class proptest {
    <<external crate>>
  }
  class loom {
    <<external crate>>
  }
  interaction_fuzz ..> proptest : uses
  concurrency_loom ..> loom : uses
Loading

File-Level Changes

Change Details Files
Introduce advanced-tests feature with proptest and loom dependencies
  • Add proptest and loom entries to Cargo.toml
  • Define advanced-tests feature flag
  • Update Cargo.lock to include new dependencies
Cargo.toml
Cargo.lock
Mark advanced push/stream tests as complete in roadmap
  • Toggle the tests covering streams and push delivery checkbox to complete
docs/asynchronous-outbound-messaging-roadmap.md
Add proptest fuzzing test for push and stream responses
  • Define Action enum and proptest strategy for mixed high, low, and stream frames
  • Initialize Tokio runtime and push queues to drive ConnectionActor
  • Assert that the output sequence matches the generated actions
tests/advanced/interaction_fuzz.rs
Add loom-based concurrency model test for push delivery
  • Use loom::model to simulate concurrent high/low priority pushes
  • Spawn actor and push tasks within a single-threaded Tokio runtime
  • Verify both frames are received under cancellation
tests/advanced/concurrency_loom.rs
Configure GitHub Actions to run advanced tests daily
  • Create advanced-tests workflow with manual and cron triggers
  • Install Rust toolchain with fmt and clippy components
  • Run tests with --features advanced-tests under RUSTFLAGS="--cfg loom"
.github/workflows/advanced-tests.yml

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 29, 2025

Summary by CodeRabbit

  • New Features

    • Introduced advanced concurrency and fuzz testing for push delivery and stream handling.
    • Added a new workflow to automatically run advanced tests on a schedule and on demand.
  • Chores

    • Added new development dependencies and feature flags to support advanced testing.
    • Updated project documentation to mark additional test coverage as complete.

Summary by CodeRabbit

  • New Features

    • Introduced advanced concurrency and property-based tests to enhance verification of push delivery and stream handling.
    • Added a new workflow for running advanced tests automatically and on demand.
  • Chores

    • Updated development dependencies and feature flags to support advanced testing.
    • Marked progress in documentation by completing the checklist item for tests covering streams and push delivery.

Walkthrough

A new advanced testing workflow is introduced, featuring property-based and concurrency tests using Loom and proptest. The Cargo manifest is updated to support these tools and a new feature flag. Documentation is updated to reflect completed test coverage. Two new advanced test files are added, targeting concurrent and fuzzed interactions.

Changes

File(s) Change Summary
.github/workflows/advanced-tests.yml Added a new GitHub Actions workflow for advanced tests, scheduled daily and on manual trigger.
Cargo.toml Added proptest and loom as dev-dependencies; introduced an advanced-tests feature flag.
docs/asynchronous-outbound-messaging-roadmap.md Marked the "Tests covering streams and push delivery" checklist item as completed.
tests/advanced/concurrency_loom.rs Added a Loom-based concurrency test for push delivery under the advanced-tests feature.
tests/advanced/interaction_fuzz.rs Added a property-based fuzzing test for push and stream interactions under the advanced-tests feature.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Runner
    participant Rust Toolchain
    participant Test Suite

    GitHub Actions->>Runner: Trigger advanced-tests workflow
    Runner->>Rust Toolchain: Install Rust, rustfmt, clippy
    Runner->>Runner: Cache Cargo dependencies
    Runner->>Test Suite: Run cargo test --features advanced-tests (RUSTFLAGS="--cfg loom")
    Test Suite-->>Runner: Execute advanced concurrency and fuzz tests
    Runner-->>GitHub Actions: Report test results
Loading

Possibly related PRs

Poem

In the warren of code, new tests now bloom,
With Loom and proptest, they chase away gloom.
Advanced checks run nightly, with features in tow,
Streams and pushes—now covered, you know!
The rabbit hops on, with a satisfied cheer,
For concurrency bugs have much less to fear.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a67177 and 0cf1363.

📒 Files selected for processing (2)
  • tests/advanced/concurrency_loom.rs (1 hunks)
  • tests/advanced/interaction_fuzz.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.rs`: * Seek to keep the cyclomatic complexity of functions no more than 12...

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments must use en-GB-oxendict spelling and grammar.

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • tests/advanced/concurrency_loom.rs
  • tests/advanced/interaction_fuzz.rs
🧬 Code Graph Analysis (2)
tests/advanced/concurrency_loom.rs (3)
tests/push_policies.rs (1)
  • rt (47-52)
tests/connection_actor.rs (1)
  • queues (18-18)
src/push.rs (1)
  • bounded (135-149)
tests/advanced/interaction_fuzz.rs (3)
tests/connection_actor.rs (1)
  • queues (18-18)
src/push.rs (1)
  • bounded (135-149)
tests/push_policies.rs (1)
  • rt (47-52)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-test
  • GitHub Check: Analyze (actions)
🔇 Additional comments (6)
tests/advanced/concurrency_loom.rs (1)

15-70: Well-structured concurrency test using loom model checker.

The test correctly uses loom to model concurrent push delivery behaviour. The design is sound:

  • Bounded queues with capacity 1 force interesting interleavings
  • Concurrent high and low priority pushes test priority handling
  • Shared output buffer with proper synchronisation
  • Graceful shutdown via cancellation token

The test follows coding guidelines well with proper module documentation and use of .expect() for error handling.

tests/advanced/interaction_fuzz.rs (5)

1-6: Module documentation properly addresses previous feedback.

The module-level documentation has been added as required by the coding guidelines, clearly explaining the module's purpose and utility.


32-39: Error handling properly addresses previous feedback.

The .unwrap() calls have been replaced with .expect() providing descriptive error messages, following the coding guidelines preference.


40-44: Potential logic issue with multiple stream actions.

When multiple Action::Stream variants are present, only the last one is retained (line 42 overwrites previous stream). Whilst this matches the behaviour in expected_from (line 65), consider whether this is the intended semantics.

If multiple streams should be processed sequentially rather than the last one replacing previous ones, both functions need adjustment.


74-89: Well-designed proptest strategy for comprehensive fuzzing.

The strategy generates diverse test scenarios:

  • Up to 5 high priority frames
  • Up to 5 low priority frames
  • Optional stream with up to 5 frames
  • Proper composition into action sequences

The strategy provides good coverage of edge cases and realistic scenarios.


107-122: Boundary tests properly implement previous suggestions.

The rstest parameterisation effectively addresses the previous feedback about reducing test duplication. The empty and maximal test cases provide good coverage of boundary conditions.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch codex/implement-tests-for-streams-and-push-delivery

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 @leynos - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `tests/advanced/interaction_fuzz.rs:36` </location>
<code_context>
+proptest! {
</code_context>

<issue_to_address>
Consider adding tests for empty and maximal input cases.

Explicitly test cases with an empty actions vector and with the maximum allowed size (5 high, 5 low, 5 stream frames) to ensure correct handling of boundary conditions.

Suggested implementation:

```rust
proptest! {
    #[test]
    fn random_push_and_stream(actions in actions_strategy()) {
        let rt = tokio::runtime::Builder::new_current_thread()
            .enable_all()
            .build()
            .unwrap();

        rt.block_on(async {
            let (queues, handle) = PushQueues::bounded(16, 16);
            let shutdown = CancellationToken::new();
        });
    }
}

// Test with empty actions vector
#[tokio::test]
async fn test_empty_actions_vector() {
    let (queues, handle) = PushQueues::bounded(16, 16);
    let shutdown = CancellationToken::new();
    let actions: Vec<Action> = Vec::new();

    // Insert logic to process actions as in the property-based test
    for action in actions {
        // No actions to process, but this ensures no panics or errors
        match action {
            Action::High(n) => { /* handle high */ }
            Action::Low(n) => { /* handle low */ }
            Action::Stream(frames) => { /* handle stream */ }
        }
    }
    // Optionally assert state if needed
}

// Test with maximal input case (5 high, 5 low, 5 stream frames)
#[tokio::test]
async fn test_maximal_actions_vector() {
    let (queues, handle) = PushQueues::bounded(16, 16);
    let shutdown = CancellationToken::new();

    let mut actions: Vec<Action> = Vec::new();
    for n in 0..5 {
        actions.push(Action::High(n));
    }
    for n in 0..5 {
        actions.push(Action::Low(n));
    }
    let stream_frames = (0..5).collect::<Vec<_>>();
    actions.push(Action::Stream(stream_frames));

    // Insert logic to process actions as in the property-based test
    for action in actions {
        match action {
            Action::High(n) => { /* handle high */ }
            Action::Low(n) => { /* handle low */ }
            Action::Stream(frames) => { /* handle stream */ }
        }
    }
    // Optionally assert state if needed
}

```

- You may need to replace the comment blocks with the actual logic for processing actions, as used in your property-based test.
- If there are assertions or state checks in the property-based test, consider adding them to these new tests as well.
- Ensure that `Action`, `PushQueues`, and `CancellationToken` are in scope for these new tests.
</issue_to_address>

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.

Comment thread tests/advanced/interaction_fuzz.rs Outdated
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e290ab and 3f1c5ba.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/advanced-tests.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • docs/asynchronous-outbound-messaging-roadmap.md (1 hunks)
  • tests/advanced/concurrency_loom.rs (1 hunks)
  • tests/advanced/interaction_fuzz.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
`docs/**/*.md`: Use the markdown files within the `docs/` directory as a knowled...

docs/**/*.md: Use the markdown files within the docs/ directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Proactively update the relevant file(s) in the docs/ directory to reflect the latest state when new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve.
Documentation in the docs/ directory must use en-GB-oxendict spelling and grammar, except for the word 'license'.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
`**/*.md`: Validate Markdown files using `markdownlint *.md **/*.md`. Run `mdfor...

**/*.md: Validate Markdown files using markdownlint *.md **/*.md.
Run mdformat-all after any documentation changes to format all Markdown files and fix table markup.
Validate Markdown Mermaid diagrams using the nixie CLI by running nixie *.md **/*.md.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks in Markdown files must be wrapped at 120 columns.
Tables and headings in Markdown files must not be wrapped.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
`docs/*`: Each file in the docs/ directory provides design, roadmap, testing, op...

docs/*: Each file in the docs/ directory provides design, roadmap, testing, operations, or reference documentation for the project. Use these files as a reference for understanding the project's architecture, development plans, testing strategies, operational guidelines, and documentation conventions.

📄 Source: CodeRabbit Inference Engine (docs/contents.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
`docs/**/*.md`: Use British English spelling based on the Oxford English Diction...

docs/**/*.md: Use British English spelling based on the Oxford English Dictionary, except retain US spelling in API names (e.g., 'color').
Use the Oxford comma in lists.
Write headings in sentence case and use Markdown heading levels in order without skipping.
Follow markdownlint recommendations for Markdown formatting.
Always use fenced code blocks with a language identifier; use 'plaintext' for non-code text.
Use '-' as the first level bullet and renumber lists when items change.
Prefer inline links using 'text' or angle brackets around the URL.
Expand any uncommon acronym on first use, e.g., Continuous Integration (CI).
Wrap paragraphs at 80 columns, code at 120 columns, and do not wrap tables.
Use footnotes referenced with '[^label]'.
When embedding figures, use 'alt text' and provide concise alt text describing the content.
Add a short description before each Mermaid diagram for screen readers.

📄 Source: CodeRabbit Inference Engine (docs/documentation-style-guide.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
`**/*.md`: * Avoid 2nd person or 1st person pronouns ("I", "you", "we") * Use en...

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-oxendic spelling and grammar.
  • Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
  • Code blocks should be wrapped to 120 columns.
  • Headings must not be wrapped.

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
`Cargo.toml`: Use explicit version ranges in `Cargo.toml` and keep dependencies up-to-date.

Cargo.toml: Use explicit version ranges in Cargo.toml and keep dependencies up-to-date.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • Cargo.toml
`**/*.rs`: Every Rust module must begin with a module level (`//!`) comment expl...

**/*.rs: Every Rust module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public Rust APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • tests/advanced/concurrency_loom.rs
  • tests/advanced/interaction_fuzz.rs
`**/*.rs`: * Seek to keep the cyclomatic complexity of functions no more than 12...

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments must use en-GB-oxendict spelling and grammar.

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • tests/advanced/concurrency_loom.rs
  • tests/advanced/interaction_fuzz.rs
🧬 Code Graph Analysis (2)
tests/advanced/concurrency_loom.rs (3)
tests/push_policies.rs (1)
  • rt (47-52)
tests/connection_actor.rs (1)
  • queues (18-18)
src/push.rs (1)
  • bounded (135-149)
tests/advanced/interaction_fuzz.rs (3)
tests/push_policies.rs (1)
  • rt (47-52)
tests/connection_actor.rs (1)
  • queues (18-18)
src/push.rs (3)
  • bounded (135-149)
  • push_high_priority (66-72)
  • push_low_priority (81-87)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-test
🔇 Additional comments (7)
Cargo.toml (1)

24-25: LGTM! Feature flag correctly enables advanced tests.

The advanced-tests feature flag properly gates the new testing functionality and aligns with the PR objectives.

docs/asynchronous-outbound-messaging-roadmap.md (1)

36-37: LGTM! Accurately reflects completed test coverage.

The documentation update correctly marks the stream and push delivery tests as complete, aligning with the newly implemented advanced tests.

.github/workflows/advanced-tests.yml (1)

1-24: LGTM! Well-structured workflow for advanced testing.

The workflow correctly configures:

  • Manual and scheduled triggers for flexibility
  • Proper permissions and environment setup
  • Required flags for loom testing (RUSTFLAGS="--cfg loom")
  • Secure action versions using commit hashes

This ensures the advanced tests run regularly and can be triggered on demand.

tests/advanced/concurrency_loom.rs (1)

11-54: LGTM! Comprehensive concurrency test using loom.

The test effectively validates concurrent push delivery by:

  • Using loom model checking for deterministic concurrency testing
  • Testing both high and low priority message delivery
  • Properly using loom-compatible synchronisation primitives
  • Verifying that both concurrent pushes are successfully delivered

The bounded queues with capacity 1 create backpressure scenarios that help expose potential race conditions.

tests/advanced/interaction_fuzz.rs (3)

19-34: LGTM! Well-designed proptest strategy for action generation.

The strategy effectively generates diverse combinations of high priority, low priority, and stream actions with reasonable bounds (0-5 elements each).


36-82: LGTM! Comprehensive property-based testing of push and stream interactions.

The test effectively validates the integration of:

  • Random sequences of push operations
  • Stream frame handling with proper replacement semantics
  • Correct output ordering and completeness

The async runtime setup and proptest integration are implemented correctly.


65-79: Ordering assumptions validated: tokio::select! biased enforces High → Low → Stream

Both the push loop and the connection actor use a biased tokio::select! to process high-priority messages first, then low-priority, and finally streamed responses:

  • src/push.rs
    tokio::select! {
        biased;
        res = self.high_priority_rx.recv() => … // High
        res = self.low_priority_rx.recv()  => … // Low
    }
  • src/connection.rs
    tokio::select! {
        biased;
        () = Self::wait_shutdown(...), if state.is_active() => … 
        res = Self::recv_push(self.high_rx.as_mut(),) => … // High
        res = Self::recv_push(self.low_rx.as_mut(),)  => … // Low
        res = Self::next_response(&mut self.response), if … => … // Stream
    }

The test’s construction of expected (high frames, then low frames, then stream frames) matches this implementation.

Comment thread Cargo.toml Outdated
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: 6

♻️ Duplicate comments (1)
Cargo.toml (1)

21-22: LGTM! Explicit version ranges implemented correctly.

The explicit version ranges using caret notation (^1.0, ^0.7) properly address the coding guidelines requirement for explicit version ranges in Cargo.toml.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f1c5ba and 0144ac6.

📒 Files selected for processing (2)
  • Cargo.toml (1 hunks)
  • tests/advanced/interaction_fuzz.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`Cargo.toml`: Use explicit version ranges in `Cargo.toml` and keep dependencies up-to-date.

Cargo.toml: Use explicit version ranges in Cargo.toml and keep dependencies up-to-date.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • Cargo.toml
`**/*.rs`: Every Rust module must begin with a module level (`//!`) comment expl...

**/*.rs: Every Rust module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public Rust APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • tests/advanced/interaction_fuzz.rs
`**/*.rs`: * Seek to keep the cyclomatic complexity of functions no more than 12...

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments must use en-GB-oxendict spelling and grammar.

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • tests/advanced/interaction_fuzz.rs
🧬 Code Graph Analysis (1)
tests/advanced/interaction_fuzz.rs (2)
tests/connection_actor.rs (1)
  • queues (18-18)
src/push.rs (1)
  • bounded (135-149)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-test
  • GitHub Check: Analyze (actions)
🔇 Additional comments (2)
Cargo.toml (1)

24-25: Feature flag implementation looks good.

The advanced-tests feature flag is properly configured as an empty feature to gate the advanced test suites.

tests/advanced/interaction_fuzz.rs (1)

48-51: Verify stream overwriting behaviour is intentional.

The logic overwrites previous stream data when multiple Stream actions occur. This matches the implementation in run_actions but may be worth documenting.

Please confirm this behaviour is intentional - should multiple streams be concatenated instead of overwritten?

Comment thread tests/advanced/interaction_fuzz.rs Outdated
Comment thread tests/advanced/interaction_fuzz.rs Outdated
Comment thread tests/advanced/interaction_fuzz.rs Outdated
Comment thread tests/advanced/interaction_fuzz.rs Outdated
Comment thread tests/advanced/interaction_fuzz.rs
Comment thread tests/advanced/interaction_fuzz.rs Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 30, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 30, 2025

✅ 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 3c130cb into main Jun 30, 2025
5 checks passed
@leynos leynos deleted the codex/implement-tests-for-streams-and-push-delivery branch June 30, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant