Skip to content

Add protocol parser fuzz tests#356

Merged
leynos merged 11 commits intomainfrom
codex/implement-fuzz-testing-for-protocol-parser
Sep 14, 2025
Merged

Add protocol parser fuzz tests#356
leynos merged 11 commits intomainfrom
codex/implement-fuzz-testing-for-protocol-parser

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Sep 10, 2025

Summary

  • expand advanced fuzz tests with envelope parser coverage
  • document protocol parser fuzzing strategy
  • mark roadmap task for protocol parser fuzzing as complete

Testing

  • make fmt
  • make lint
  • make test
  • make markdownlint
  • make nixie (fails: KeyboardInterrupt)

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

Summary by Sourcery

Introduce property-based fuzz tests for the protocol parser and adjust test configuration and project setup accordingly.

New Features:

  • Add proptest-based envelope round-trip and panic-safety fuzz tests for the BincodeSerializer protocol parser.

Enhancements:

  • Refactor FairnessTracker tests to use rstest parameterization and gate all tests under cfg(not(loom)).
  • Apply cfg(not(loom)) to the server module and existing test files to exclude them when running under loom.

Build:

  • Extend Cargo.toml with a lib section, include serializer-bincode in default features, add new features (serializer-bincode, examples, cucumber-tests), and configure example binaries.
  • Move metrics-exporter-prometheus dependency under cfg(not(loom)) and add lint and example configurations.

Documentation:

  • Document the protocol parser fuzzing strategy in the multi-layered testing guide and mark the corresponding roadmap task as complete.

Tests:

  • Add advanced interaction fuzz tests covering envelope parsing and ensure existing test suites compile only when not running under loom.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Sep 10, 2025

Reviewer's Guide

This PR adds Proptest-based fuzz tests for the protocol envelope parser under a new serializer-bincode feature, refactors test configurations to exclude loom, updates documentation and the roadmap to include the new fuzzing strategy, and adjusts Cargo.toml feature and dependency settings.

File-Level Changes

Change Details Files
Introduce Proptest-based fuzz tests for the envelope parser
  • Define envelope_strategy generator for random Envelope values
  • Add envelope_roundtrip property test verifying round-trip serialization and byte‐consumption
  • Add fuzz_parse_does_not_panic property test to feed arbitrary bytes to the parser
tests/advanced/interaction_fuzz.rs
Document and track protocol parser fuzzing
  • Describe the fuzzing strategy, tooling, and objectives in multi-layered-testing-strategy.md
  • Mark the roadmap task as complete in roadmap.md
docs/multi-layered-testing-strategy.md
docs/roadmap.md
Refactor test modules to exclude under loom and improve fairness tests
  • Prefix most integration tests and the server module with #[cfg(not(loom))]
  • Replace async tokio tests in fairness.rs with parameterized synchronous rstest cases under cfg(all(test, not(loom)))
src/fairness.rs
src/lib.rs
tests/**/*.rs
Adjust Cargo.toml features, dependencies, and defaults
  • Add a [lib] section and disable doctests
  • Introduce serializer-bincode, examples, and cucumber-tests features and include serializer-bincode in default features
  • Move metrics-exporter-prometheus to a cfg(not(loom)) dependency and update test harness feature requirements
Cargo.toml

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 Sep 10, 2025

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • New Features

    • Added example apps (echo, packet_enum, ping_pong) via the “examples” feature.
  • Documentation

    • Corrected streaming test expectations and spelling.
    • Added protocol parser fuzzing section.
    • Marked roadmap item for fuzz testing as complete.
    • Expanded test-world scenario docs.
  • Tests

    • Introduced protocol parser fuzz tests.
    • Gated numerous tests to run only outside Loom.
    • Improved fairness and interaction fuzz coverage.
  • Chores

    • Added library target; adjusted dependencies for non-Loom builds.
    • Introduced features (cucumber-tests, serializer-bincode) and set updated defaults.

Walkthrough

Add proptest-based fuzz tests for the protocol parser and Envelope round-trips; append fuzz‑testing docs and mark roadmap item done. Gate many tests and the server module under cfg(not(loom)). Update Cargo.toml with an explicit lib target, new features, examples, target‑specific dependency and a lint rule. No public API signature changes.

Changes

Cohort / File(s) Summary
Docs: Testing strategy
docs/multi-layered-testing-strategy.md
Insert "Protocol Parser Fuzzing with proptest" section describing Envelope round‑trip and panic‑safety properties, execution hints (PROPTEST_CASES, features), target 100,000 cases; correct streaming test wording/spelling and require on_logical_response_end called once.
Docs: Roadmap
docs/roadmap.md
Mark "Implement fuzz testing for the protocol parser" as completed and reference tests/advanced/interaction_fuzz.rs.
Advanced fuzz tests
tests/advanced/interaction_fuzz.rs
Add envelope_strategy, envelope_roundtrip and fuzz_parse_does_not_panic behind serializer-bincode; import Envelope; adjust cfg to all(feature = "advanced-tests", not(loom)); adapt stream/resp_stream naming.
Tests: loom gating (bulk)
tests/*.rs (many files, e.g. tests/server.rs, tests/world.rs, tests/response.rs, tests/metrics.rs, ...)
Add crate/module-level #![cfg(not(loom))] or #[cfg(not(loom))] to gate compilation of numerous test files under non‑loom builds; update tests/world.rs docs.
Source gating & tests
src/lib.rs, src/fairness.rs
Gate pub mod server with #[cfg(not(loom))]; change fairness tests attribute to #[cfg(all(test, not(loom)))] and parameterise them via rstest; add/new tests replacements and a zero-threshold test.
Cargo manifest & examples
Cargo.toml
Add explicit lib target; move metrics-exporter-prometheus to [target.'cfg(not(loom))'.dependencies]; add features examples, cucumber-tests, serializer-bincode and set default to include serializer-bincode; add three [[example]] entries (echo, packet_enum, ping_pong); add lints.rust unexpected_cfgs rule; adjust cucumber test required-features.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant P as Proptest
  participant T as Test Harness
  participant E as Envelope
  participant S as BincodeSerializer

  rect rgb(227,242,253)
    P->>T: generate random Envelope
    T->>E: to_bytes()
    E-->>T: envelope_bytes
    T->>T: append trailing_junk
    T->>S: parse(envelope_bytes + junk)
    S-->>T: (frame, consumed)
    T->>T: assert frame == original && consumed == envelope_len
  end

  rect rgb(255,249,196)
    P->>T: generate random bytes
    T->>S: parse(random_bytes)
    S-->>T: result (no panic expected)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

Fuzz winds whirl through bytes at night,
Envelopes wing in binary light.
Junk trails tested, parsers hold fast,
No panics found as inputs blast.
Docs and roadmap hum — a hundred thousand cast.

Changelog entry (concise):
- Add proptest fuzz tests for protocol parser: Envelope round‑trip and panic‑safety for `BincodeSerializer::parse` (`tests/advanced/interaction_fuzz.rs`), target 100,000 cases.
- Update docs: add protocol parser fuzzing section and mark roadmap item complete.
- Gate many tests and `server` module under `cfg(not(loom))`.
- Update Cargo.toml: add explicit lib target, new features (`examples`, `cucumber-tests`, `serializer-bincode`), move `metrics-exporter-prometheus` to a `cfg(not(loom))` target dependency, and add three example binaries.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed Accept the pull request title as it concisely and accurately summarises the primary change — adding protocol parser fuzz tests — and it maps to the changeset that introduces proptest-based envelope round-trip and panic-safety tests, updates documentation and marks the roadmap item complete. Keep the title short and specific; it avoids noise and file lists that would reduce scanability. Do not expand the title to include every ancillary change such as Cargo.toml or test-gating details.
Description Check ✅ Passed Mark the pull request description as passing because it directly relates to the changeset and documents the main actions: adding proptest-based protocol parser fuzz tests, updating documentation, marking the roadmap task complete, and listing test/build commands. Keep the description as it provides reviewers with the high-level intent and testing steps even though it does not enumerate every file change. Proceed to review without demanding a rewrite.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

codescene-delta-analysis[bot]

This comment was marked as outdated.

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


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.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Sep 10, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 10, 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.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 140dd58 and 7c2e2cf.

📒 Files selected for processing (3)
  • docs/multi-layered-testing-strategy.md (1 hunks)
  • docs/roadmap.md (1 hunks)
  • tests/advanced/interaction_fuzz.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.md

⚙️ CodeRabbit configuration file

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

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/roadmap.md
  • docs/multi-layered-testing-strategy.md
**/*.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
🔇 Additional comments (2)
docs/roadmap.md (1)

174-176: Mark the roadmap item as complete.

The checkbox and reference to tests/advanced/interaction_fuzz.rs are accurate.

tests/advanced/interaction_fuzz.rs (1)

2-6: Module docs read well and meet guidelines.

The crate-level cfg and module doc succinctly state scope and purpose.

Comment thread docs/multi-layered-testing-strategy.md Outdated
Comment thread docs/multi-layered-testing-strategy.md
Comment thread tests/advanced/interaction_fuzz.rs Outdated
Comment thread tests/advanced/interaction_fuzz.rs
Comment thread tests/advanced/interaction_fuzz.rs
Comment thread tests/advanced/interaction_fuzz.rs
codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as 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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e2f37ac and b3bf18f.

📒 Files selected for processing (1)
  • src/fairness.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • src/fairness.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • src/fairness.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • src/fairness.rs
🔇 Additional comments (4)
src/fairness.rs (4)

101-101: LGTM: exercise dynamic threshold via parameter.


106-113: LGTM: pre‑reset yield assertion and threshold check are correct.


115-118: LGTM: reset restores non‑yield state as expected.


82-82: Ensure loom cfg is defined and applied

Add loom = [] under [features] in Cargo.toml or configure CI with
RUSTFLAGS="--cfg loom".

Run these commands to confirm guards are effective:

rg -n 'cfg\(loom\)' -C2 src/**/*.rs
rg -n 'cfg(all(test, not(loom)))' -C2 src/**/*.rs

Comment thread src/fairness.rs Outdated
Comment thread src/fairness.rs
codescene-delta-analysis[bot]

This comment was marked as outdated.

Repository owner deleted a comment from coderabbitai Bot Sep 12, 2025
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Sep 12, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 12, 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
Copy link
Copy Markdown
Owner Author

leynos commented Sep 12, 2025

@sourcery-ai review

sourcery-ai[bot]

This comment was marked as resolved.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Sep 12, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 12, 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.

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: 2

♻️ Duplicate comments (1)
src/fairness.rs (1)

92-99: Remove the branch in the test via parameterisation.

Drive the counter to the assertion point and drop the conditional.

Apply:

-    #[case::threshold_2_then_reset(2, false, false)]
-    #[case::threshold_1_then_reset(1, true, false)]
+    #[case::threshold_2_then_reset(2, 2, true,  false)]
+    #[case::threshold_1_then_reset(1, 1, true,  false)]
@@
-    fn fairness_threshold_behaviour(
-        #[case] max_high_before_low: usize,
-        #[case] should_yield_before_reset: bool,
-        #[case] should_yield_after_reset: bool,
-    ) {
+    fn fairness_threshold_behaviour(
+        #[case] max_high_before_low: usize,
+        #[case] calls_before_assert: usize,
+        #[case] expected_before_reset: bool,
+        #[case] expected_after_reset: bool,
+    ) {
@@
-        fairness.record_high_priority();
-        assert_eq!(
-            fairness.should_yield_to_low_priority(),
-            should_yield_before_reset
-        );
-        if !should_yield_before_reset {
-            fairness.record_high_priority();
-            assert!(fairness.should_yield_to_low_priority());
-        }
+        for _ in 0..calls_before_assert {
+            fairness.record_high_priority();
+        }
+        assert_eq!(fairness.should_yield_to_low_priority(), expected_before_reset);
         fairness.reset();
-        assert_eq!(
-            fairness.should_yield_to_low_priority(),
-            should_yield_after_reset
-        );
+        assert_eq!(fairness.should_yield_to_low_priority(), expected_after_reset);

Also applies to: 95-118

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b3bf18f and 5b36a0c.

📒 Files selected for processing (4)
  • Cargo.toml (2 hunks)
  • docs/multi-layered-testing-strategy.md (2 hunks)
  • src/fairness.rs (2 hunks)
  • tests/advanced/interaction_fuzz.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.md

⚙️ CodeRabbit configuration file

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

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/multi-layered-testing-strategy.md
**/*.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
  • src/fairness.rs
🔍 Remote MCP Deepwiki

Summary — additional repo facts useful for reviewing PR #356

  • BincodeSerializer implements FrameMetadata::parse and delegates parsing to Envelope::from_bytes — the new fuzz tests exercise that parse path (consumed-byte accounting) and panic-safety.
  • The added proptest tests (tests/advanced/interaction_fuzz.rs) include:
    • envelope_roundtrip: serialize an Envelope, append extra bytes, parse with BincodeSerializer and assert parsed == original && consumed == original length.
    • fuzz_parse_does_not_panic: feed arbitrary bytes to BincodeSerializer::parse and assert it never panics.
      Run hint provided in docs: PROPTEST_CASES=100000 cargo test -F advanced-tests -- tests/advanced/interaction_fuzz.rs.
  • Many test files and the server module were gated with #[cfg(not(loom))]; since the project uses loom for concurrency testing, those files will be skipped under loom builds — confirm this gating is intentional for CI/loom test coverage.
  • Cargo manifest changes (adds serializer-bincode to features/defaults; moves metrics-exporter-prometheus under cfg(not(loom))) alter the build/test feature matrix — reviewers should verify CI/feature flags (advanced-tests, serializer-bincode, not(loom)) are set where the new tests/serializer are expected to run.

Sources/tools used:,

⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review
🔇 Additional comments (16)
src/fairness.rs (3)

82-82: Gate tests under not(loom). Good.

Keep tests excluded from loom runs to avoid false positives from simulated concurrency.


92-99: Name and structure cases. Good.

Case labels improve output, and en‑GB “behaviour” is aligned with the style guide.


121-133: Add zero-threshold regression test. Good.

Lock the “never yield without slice” contract.

Cargo.toml (6)

13-17: Define lib target and disable doctests. Good.

Avoid doctest flakiness while keeping docs.rs configured.


85-87: Enable unexpected_cfgs check for ‘loom’. Good.

Surface stray cfgs early.


88-102: Gate examples behind a feature. Good.

Keep release builds lean; examples compile only on demand.


108-109: Require features for the cucumber runner. Good.

Avoid accidental inclusion in default test runs.


75-81: Add CI job: run cargo check --no-default-features matrix

Align tests and docs with the new default features; add a CI job that runs:

#!/usr/bin/env bash
set -euo pipefail
cargo check --no-default-features
cargo check --no-default-features -F serializer-bincode

71-73: Verify metrics feature under loom — rerun checks locally

Sandbox cargo check failed (no /proc). Rerun the checks locally and paste outputs to confirm enabling "metrics" with cfg(loom) does not compile the Prometheus exporter. Run:

#!/usr/bin/env bash
set -euo pipefail

echo "Default build"
cargo check

echo "With loom cfg and metrics feature"
RUSTFLAGS="--cfg loom" cargo check --features metrics

echo "Find unconditional references to exporter"
rg -n "metrics[-_]exporter[-_]prometheus|Prometheus" -g '**/*.rs' -C2 || true

echo "Show feature resolution for exporter (requires cargo-tree)"
cargo tree -e features -i metrics-exporter-prometheus || echo "Install cargo-tree: cargo install cargo-tree"

Inspect Cargo.toml (Cargo.toml: lines 71–73) and confirm:

[target.'cfg(not(loom))'.dependencies]
metrics-exporter-prometheus = { version = "0.17.2", optional = true, features = ["http-listener"] }

Paste the command outputs here.

tests/advanced/interaction_fuzz.rs (5)

2-6: Expand module docs to include envelope parser. Good.

Document the new fuzzing scope.


20-22: Gate serializer import. Good.

Prevent builds from failing when the feature is off.


138-145: Define envelope strategy with Into for payload. Good.

Future‑proof the constructor call.


146-159: Round‑trip property with consumed‑byte check. Good.

Assert parser consumption to guard framing bugs.


161-169: Panic‑safety property. Good.

Exercise malformed input at scale.

docs/multi-layered-testing-strategy.md (2)

59-59: Standardise ‘seriali[z]e’ spelling. Good.

Use -ize per en‑GB‑oxendict.


428-449: Document protocol parser fuzzing with measurable objective. Good.

Call out tool, target, properties, and budget.

Comment thread docs/multi-layered-testing-strategy.md Outdated
Comment thread tests/advanced/interaction_fuzz.rs Outdated
codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as 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: 3

Caution

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

⚠️ Outside diff range comments (1)
tests/advanced/interaction_fuzz.rs (1)

41-60: Avoid name shadowing of futures::stream.

Rename the local stream variable to improve readability and avoid confusion with the imported module.

-    let mut stream: Option<FrameStream<u8, ()>> = None;
+    let mut resp_stream: Option<FrameStream<u8, ()>> = None;
@@
-                let s = stream::iter(frames.clone().into_iter().map(Ok));
-                stream = Some(Box::pin(s));
+                let s = stream::iter(frames.clone().into_iter().map(Ok));
+                resp_stream = Some(Box::pin(s));
@@
-    let mut actor: ConnectionActor<_, ()> =
-        ConnectionActor::new(queues, handle, stream, shutdown);
+    let mut actor: ConnectionActor<_, ()> =
+        ConnectionActor::new(queues, handle, resp_stream, shutdown);

Also applies to: 53-55

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 856a8db and d0a2af0.

📒 Files selected for processing (2)
  • docs/multi-layered-testing-strategy.md (2 hunks)
  • tests/advanced/interaction_fuzz.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • tests/advanced/interaction_fuzz.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • tests/advanced/interaction_fuzz.rs
tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.rs: Use rstest fixtures for shared setup
Replace duplicated tests with #[rstest(...)] parameterised cases
Prefer mockall for mocks/stubs

Files:

  • tests/advanced/interaction_fuzz.rs
docs/**/*.md

📄 CodeRabbit inference engine (docs/documentation-style-guide.md)

docs/**/*.md: Use British English based on the Oxford English Dictionary (en-oxendict) for documentation text.
The word "outwith" is acceptable in documentation.
Keep US spelling when used in an API, for example color.
Use the Oxford comma in documentation text.
Treat company names as collective nouns in documentation (e.g., "Lille Industries are expanding").
Write headings in sentence case in documentation.
Use Markdown headings (#, ##, ###, etc.) in order without skipping levels.
Follow markdownlint recommendations for Markdown files.
Provide code blocks and lists using standard Markdown syntax.
Always provide a language identifier for fenced code blocks; use plaintext for non-code text.
Use - as the first level bullet and renumber lists when items change.
Prefer inline links using [text](url) or angle brackets around the URL; avoid reference-style links like [foo][bar].
Ensure blank lines before and after bulleted lists and fenced blocks in Markdown.
Ensure tables have a delimiter line below the header row in Markdown.
Expand any uncommon acronym on first use, for example, Continuous Integration (CI).
Wrap paragraphs at 80 columns in documentation.
Wrap code at 120 columns in documentation.
Do not wrap tables in documentation.
Use sequentially numbered footnotes referenced with [^1] and place definitions at the end of the file.
Where it adds clarity, include Mermaid diagrams in documentation.
When embedding figures, use ![alt text](path/to/image) and provide concise alt text describing the content.
Add a brief description before each Mermaid diagram in documentation for screen readers.

Document examples showing how to deprecate old message versions gracefully

docs/**/*.md: Use docs/ markdown as the source of truth for requirements and decisions
Proactively update docs/ when requirements, dependencies, or architecture change
Documentation must use en-GB-oxendict spelling and grammar (LICENSE name exempt)

When long lines are warranted in ...

Files:

  • docs/multi-layered-testing-strategy.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

**/*.md: Markdown paragraphs and bullet points must be wrapped at 80 columns
Markdown code blocks must be wrapped at 120 columns
Do not wrap tables and headings in Markdown
Use dashes (-) for list bullets in Markdown
Use GitHub-flavoured Markdown footnotes ([^1])

Files:

  • docs/multi-layered-testing-strategy.md

⚙️ CodeRabbit configuration file

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

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/multi-layered-testing-strategy.md
docs/**

📄 CodeRabbit inference engine (docs/wireframe-1-0-detailed-development-roadmap.md)

docs/**: Document async-stream as the canonical way to create streams imperatively
Write comprehensive user guides for Duplex Messaging & Pushes, Streaming Responses, and Message Fragmentation with runnable examples

Files:

  • docs/multi-layered-testing-strategy.md
🧬 Code graph analysis (1)
tests/advanced/interaction_fuzz.rs (2)
src/app/connection.rs (1)
  • serializer (115-116)
src/app/envelope.rs (6)
  • id (49-49)
  • id (94-94)
  • id (116-116)
  • payload (122-122)
  • new (83-89)
  • new (107-113)
🔍 Remote MCP Deepwiki

Quick findings relevant to reviewing PR #356

  • tests/advanced/interaction_fuzz.rs is NOT present on main — the fuzz test file is planned but not implemented on main.
  • Cargo.toml on main does NOT define a feature named "serializer-bincode" (so adding that feature/default in the PR would change main's feature set).
  • Repository docs confirm proptest is used for property-based tests and that BincodeSerializer is the project's default serializer (so the PR's choice of proptest + bincode is consistent with existing testing/serializer conventions).

Recommended quick checks for the review

  • Verify the PR’s change to Cargo.toml (adding serializer-bincode and making it a default) is intentional and acceptable for downstream users / CI.
  • Confirm the new fuzz test compiles under the feature gating used (serializer-bincode / advanced-tests) and that CI/test matrices (especially loom builds) remain correct.
  • Run the new fuzz tests locally / CI with the proposed proptest case counts to validate runtime and resource impact before merge.

Sources:,

⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
🔇 Additional comments (5)
tests/advanced/interaction_fuzz.rs (4)

18-20: Feature-gated serializer import is correct.

Import under serializer-bincode matches the tests below. No issues.


136-143: Envelope strategy uses .into() for payload — good future-proofing.

Strategy compiles for current Vec<u8> and adapts to Bytes if changed later.


159-167: Panic-safety fuzz present and gated — LGTM.

Coverage for arbitrary input without panics is in place.


145-157: Confirm CI can sustain 100k proptest cases

100k-case budget is heavy — sandbox run failed with "no /proc/self/exe available". Run the test locally or on CI, record wall time and CI runner minutes, and lower PROPTEST_CASES if the job times out or exceeds runner limits.

File: tests/advanced/interaction_fuzz.rs (lines 145–157)

#!/usr/bin/env bash
PROPTEST_CASES=100000 cargo test -F advanced-tests -F serializer-bincode -- \
  tests/advanced/interaction_fuzz.rs::envelope_roundtrip -- --nocapture -q

Record elapsed wall time and CI minutes. If limits are hit, reduce PROPTEST_CASES (e.g. to 10_000) and re-run.

docs/multi-layered-testing-strategy.md (1)

59-59: Spelling aligns with en‑GB (-ize).

“Serialized” with z is correct per style guide.

Comment thread docs/multi-layered-testing-strategy.md
Comment thread tests/advanced/interaction_fuzz.rs
Comment thread tests/advanced/interaction_fuzz.rs Outdated
Use a distinct name for the response stream to avoid shadowing `futures::stream` and improve clarity in the interaction fuzz harness.
codescene-delta-analysis[bot]

This comment was marked as 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

Caution

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

⚠️ Outside diff range comments (1)
tests/advanced/interaction_fuzz.rs (1)

41-55: Box the response stream and map the Result error to WireframeError

Import StreamExt and bring WireframeError into scope. FrameStream is aliased as Pin<Box<dyn Stream<Item = Result<F, WireframeError>> + Send + 'static>>; map frames to Ok::<u8, WireframeError<()>> and call .boxed() so the types align.

Location: tests/advanced/interaction_fuzz.rs:41-55

use futures::{stream, StreamExt};
...
Action::Stream(frames) => {
    let s = stream::iter(frames.clone()).map(|f| Ok::<u8, WireframeError<()>>(f)).boxed();
    resp_stream = Some(s);
}
♻️ Duplicate comments (2)
tests/advanced/interaction_fuzz.rs (2)

5-6: Standardise -ize spelling in module docs

Use en‑GB‑oxendict “-ize”.

Apply:

-//! various randomised scenarios.
+//! various randomized scenarios.

1-2: Gate advanced tests outwith loom builds at module level

Align with the PR objective to exclude these tests under loom.

Apply:

-#![cfg(feature = "advanced-tests")]
+#![cfg(all(feature = "advanced-tests", not(loom)))]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0a2af0 and 1a2c1ea.

📒 Files selected for processing (1)
  • tests/advanced/interaction_fuzz.rs (5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • tests/advanced/interaction_fuzz.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • tests/advanced/interaction_fuzz.rs
tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.rs: Use rstest fixtures for shared setup
Replace duplicated tests with #[rstest(...)] parameterised cases
Prefer mockall for mocks/stubs

Files:

  • tests/advanced/interaction_fuzz.rs
🧬 Code graph analysis (1)
tests/advanced/interaction_fuzz.rs (4)
src/app/connection.rs (1)
  • serializer (115-116)
src/app/envelope.rs (6)
  • new (83-89)
  • new (107-113)
  • id (49-49)
  • id (94-94)
  • id (116-116)
  • payload (122-122)
src/connection.rs (3)
  • new (30-34)
  • new (146-159)
  • new (520-529)
src/message.rs (1)
  • to_bytes (27-27)
🔇 Additional comments (5)
tests/advanced/interaction_fuzz.rs (5)

13-16: Clean import of Envelope looks correct

Import only what is used; this removes prior warnings.


18-20: Correctly gate BincodeSerializer behind feature flag

Prevent builds without the feature from failing.


136-143: Envelope strategy is sound and future‑proofed with .into()

Good use of Into to tolerate payload type changes.


159-167: Panic‑safety fuzz is scoped and adequately configured

The test exercises arbitrary inputs with a large case budget; no issues.


72-83: Keep as-is — single Stream action already enforced

rg output shows Action::Stream is only pushed when actions are built (tests/advanced/interaction_fuzz.rs:97,126); those builders push at most one Stream, so expected_from will not encounter >1 Stream. Add the debug_assert as optional hardening.

Comment thread tests/advanced/interaction_fuzz.rs
codescene-delta-analysis[bot]

This comment was marked as 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

♻️ Duplicate comments (1)
tests/advanced/interaction_fuzz.rs (1)

145-157: Assert the unconsumed tail equals the injected noise.

Strengthen the round‑trip by verifying tail bytes as well.

Apply:

         let (parsed, consumed) = serializer.parse(&bytes).expect("failed to parse envelope");
         prop_assert_eq!(parsed, env);
         prop_assert_eq!(consumed, len);
+        prop_assert_eq!(&bytes[consumed..], &extra[..]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a2c1ea and 737f958.

📒 Files selected for processing (2)
  • docs/multi-layered-testing-strategy.md (2 hunks)
  • tests/advanced/interaction_fuzz.rs (5 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • tests/advanced/interaction_fuzz.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • tests/advanced/interaction_fuzz.rs
tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.rs: Use rstest fixtures for shared setup
Replace duplicated tests with #[rstest(...)] parameterised cases
Prefer mockall for mocks/stubs

Files:

  • tests/advanced/interaction_fuzz.rs
docs/**/*.md

📄 CodeRabbit inference engine (docs/documentation-style-guide.md)

docs/**/*.md: Use British English based on the Oxford English Dictionary (en-oxendict) for documentation text.
The word "outwith" is acceptable in documentation.
Keep US spelling when used in an API, for example color.
Use the Oxford comma in documentation text.
Treat company names as collective nouns in documentation (e.g., "Lille Industries are expanding").
Write headings in sentence case in documentation.
Use Markdown headings (#, ##, ###, etc.) in order without skipping levels.
Follow markdownlint recommendations for Markdown files.
Provide code blocks and lists using standard Markdown syntax.
Always provide a language identifier for fenced code blocks; use plaintext for non-code text.
Use - as the first level bullet and renumber lists when items change.
Prefer inline links using [text](url) or angle brackets around the URL; avoid reference-style links like [foo][bar].
Ensure blank lines before and after bulleted lists and fenced blocks in Markdown.
Ensure tables have a delimiter line below the header row in Markdown.
Expand any uncommon acronym on first use, for example, Continuous Integration (CI).
Wrap paragraphs at 80 columns in documentation.
Wrap code at 120 columns in documentation.
Do not wrap tables in documentation.
Use sequentially numbered footnotes referenced with [^1] and place definitions at the end of the file.
Where it adds clarity, include Mermaid diagrams in documentation.
When embedding figures, use ![alt text](path/to/image) and provide concise alt text describing the content.
Add a brief description before each Mermaid diagram in documentation for screen readers.

Document examples showing how to deprecate old message versions gracefully

docs/**/*.md: Use docs/ markdown as the source of truth for requirements and decisions
Proactively update docs/ when requirements, dependencies, or architecture change
Documentation must use en-GB-oxendict spelling and grammar (LICENSE name exempt)

When long lines are warranted in ...

Files:

  • docs/multi-layered-testing-strategy.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

**/*.md: Markdown paragraphs and bullet points must be wrapped at 80 columns
Markdown code blocks must be wrapped at 120 columns
Do not wrap tables and headings in Markdown
Use dashes (-) for list bullets in Markdown
Use GitHub-flavoured Markdown footnotes ([^1])

Files:

  • docs/multi-layered-testing-strategy.md

⚙️ CodeRabbit configuration file

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

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/multi-layered-testing-strategy.md
docs/**

📄 CodeRabbit inference engine (docs/wireframe-1-0-detailed-development-roadmap.md)

docs/**: Document async-stream as the canonical way to create streams imperatively
Write comprehensive user guides for Duplex Messaging & Pushes, Streaming Responses, and Message Fragmentation with runnable examples

Files:

  • docs/multi-layered-testing-strategy.md
🧬 Code graph analysis (1)
tests/advanced/interaction_fuzz.rs (3)
src/app/connection.rs (1)
  • serializer (115-116)
src/app/envelope.rs (6)
  • new (83-89)
  • new (107-113)
  • id (49-49)
  • id (94-94)
  • id (116-116)
  • payload (122-122)
src/connection.rs (3)
  • new (30-34)
  • new (146-159)
  • new (520-529)
🔇 Additional comments (7)
tests/advanced/interaction_fuzz.rs (6)

1-2: Gate advanced tests outwith loom and feature‑gate bincode — LGTM.

Keep this pattern for any serializer‑specific additions.

Also applies to: 18-20


5-6: Standardise docs to -ize spelling — LGTM.

Spelling aligns with en‑GB‑oxendict (“randomized”).


41-41: Use a typed, pinned FrameStream — LGTM.

Type and pinning match FrameStream<u8, ()> expectations.

Also applies to: 54-55, 60-60


136-143: Future‑proof the payload conversion — LGTM.

Using payload.into() is a harmless no‑op today and resilient to signature changes.


159-167: Panic‑safety fuzz on arbitrary bytes — LGTM.

Case budget and gating are appropriate.


69-83: Confirm single-stream semantics are intentional.

File: tests/advanced/interaction_fuzz.rs (lines 69–83)
The loop overwrites stream_frames for each Action::Stream, so only the last stream is retained.
Document the single-stream contract by adding a brief comment on Action::Stream or ensure actions_strategy emits at most one stream.
When concatenation is required, change the match arm to extend instead:

-            Action::Stream(v) => stream_frames = v.clone(),
+            Action::Stream(v) => stream_frames.extend_from_slice(v),
docs/multi-layered-testing-strategy.md (1)

59-59: Use -ize spelling — LGTM.

“serialized” matches the house style.

Comment thread docs/multi-layered-testing-strategy.md Outdated
codescene-delta-analysis[bot]

This comment was marked as 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: 3

Caution

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

⚠️ Outside diff range comments (1)
tests/advanced/interaction_fuzz.rs (1)

41-55: Make the stream’s error type explicit to avoid inference traps.

Type inference usually resolves this, but being explicit removes ambiguity and future‑proofs against signature changes.

Apply this diff:

-            Action::Stream(frames) => {
-                let s = stream::iter(frames.clone().into_iter().map(Ok));
-                resp_stream = Some(Box::pin(s));
-            }
+            Action::Stream(frames) => {
+                let s = stream::iter(frames.clone().into_iter().map(Ok::<u8, ()>));
+                resp_stream = Some(Box::pin(s));
+            }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 737f958 and 34a5db2.

📒 Files selected for processing (2)
  • docs/multi-layered-testing-strategy.md (2 hunks)
  • tests/advanced/interaction_fuzz.rs (5 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • tests/advanced/interaction_fuzz.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • tests/advanced/interaction_fuzz.rs
tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.rs: Use rstest fixtures for shared setup
Replace duplicated tests with #[rstest(...)] parameterised cases
Prefer mockall for mocks/stubs

Files:

  • tests/advanced/interaction_fuzz.rs
docs/**/*.md

📄 CodeRabbit inference engine (docs/documentation-style-guide.md)

docs/**/*.md: Use British English based on the Oxford English Dictionary (en-oxendict) for documentation text.
The word "outwith" is acceptable in documentation.
Keep US spelling when used in an API, for example color.
Use the Oxford comma in documentation text.
Treat company names as collective nouns in documentation (e.g., "Lille Industries are expanding").
Write headings in sentence case in documentation.
Use Markdown headings (#, ##, ###, etc.) in order without skipping levels.
Follow markdownlint recommendations for Markdown files.
Provide code blocks and lists using standard Markdown syntax.
Always provide a language identifier for fenced code blocks; use plaintext for non-code text.
Use - as the first level bullet and renumber lists when items change.
Prefer inline links using [text](url) or angle brackets around the URL; avoid reference-style links like [foo][bar].
Ensure blank lines before and after bulleted lists and fenced blocks in Markdown.
Ensure tables have a delimiter line below the header row in Markdown.
Expand any uncommon acronym on first use, for example, Continuous Integration (CI).
Wrap paragraphs at 80 columns in documentation.
Wrap code at 120 columns in documentation.
Do not wrap tables in documentation.
Use sequentially numbered footnotes referenced with [^1] and place definitions at the end of the file.
Where it adds clarity, include Mermaid diagrams in documentation.
When embedding figures, use ![alt text](path/to/image) and provide concise alt text describing the content.
Add a brief description before each Mermaid diagram in documentation for screen readers.

Document examples showing how to deprecate old message versions gracefully

docs/**/*.md: Use docs/ markdown as the source of truth for requirements and decisions
Proactively update docs/ when requirements, dependencies, or architecture change
Documentation must use en-GB-oxendict spelling and grammar (LICENSE name exempt)

When long lines are warranted in ...

Files:

  • docs/multi-layered-testing-strategy.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

**/*.md: Markdown paragraphs and bullet points must be wrapped at 80 columns
Markdown code blocks must be wrapped at 120 columns
Do not wrap tables and headings in Markdown
Use dashes (-) for list bullets in Markdown
Use GitHub-flavoured Markdown footnotes ([^1])

Files:

  • docs/multi-layered-testing-strategy.md

⚙️ CodeRabbit configuration file

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

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/multi-layered-testing-strategy.md
docs/**

📄 CodeRabbit inference engine (docs/wireframe-1-0-detailed-development-roadmap.md)

docs/**: Document async-stream as the canonical way to create streams imperatively
Write comprehensive user guides for Duplex Messaging & Pushes, Streaming Responses, and Message Fragmentation with runnable examples

Files:

  • docs/multi-layered-testing-strategy.md
🧬 Code graph analysis (1)
tests/advanced/interaction_fuzz.rs (3)
src/app/connection.rs (1)
  • serializer (115-116)
src/app/envelope.rs (6)
  • new (83-89)
  • new (107-113)
  • id (49-49)
  • id (94-94)
  • id (116-116)
  • payload (122-122)
src/connection.rs (3)
  • new (30-34)
  • new (146-159)
  • new (520-529)
🔇 Additional comments (10)
docs/multi-layered-testing-strategy.md (1)

59-61: Standardise -ize spelling confirmed; keep as is.

"serialized" aligns with en‑GB‑oxendict (-ize/-our). No further change required.

tests/advanced/interaction_fuzz.rs (9)

1-1: Gate advanced tests outwith loom at module level.

The module‑level cfg correctly excludes these tests under loom. Good.


5-6: Docs spelling aligned with en‑GB (-ize).

"randomized" is correct per en‑GB‑oxendict. Proceed.


18-20: Feature‑gate the optional serializer import.

The cfg on BincodeSerializer is correct and prevents feature‑off build breaks.


59-66: Drive the actor once; handle is no longer needed.

Construction and run path look correct; the write buffer is driven to completion before assertions.


72-83: Compute the expected ordering deterministically (high > low > stream).

The expectation matches the documented priority. Good.


103-117: Use a current‑thread runtime per test to keep execution deterministic.

The pattern is fine for property tests that need async. No change required.


136-143: Future‑proof the envelope strategy.

Using payload.into() keeps the strategy resilient to signature changes. Good.


145-158: Strengthen the round‑trip property with tail‑bytes check.

Assertions cover equality, byte consumption, and the unconsumed tail. Perfect.


160-168: Exercise the panic‑safety fuzz with the documented case budget.

Configuration and intent are aligned; keep as is.

Comment thread docs/multi-layered-testing-strategy.md Outdated
Comment thread docs/multi-layered-testing-strategy.md
Comment thread tests/advanced/interaction_fuzz.rs
codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Sep 13, 2025

@coderabbitai pause

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)
tests/advanced/interaction_fuzz.rs (1)

41-55: Accumulate multiple Stream actions instead of last‑wins.

Current logic replaces the response stream on every Action::Stream, so only the final one is honoured. Accumulate frames and build the stream once after the loop to widen coverage and make semantics explicit.

Apply:

-    let mut resp_stream: Option<FrameStream<u8, ()>> = None;
+    let mut stream_frames_acc: Vec<u8> = Vec::new();
     for act in actions {
         match act {
@@
-            Action::Stream(frames) => {
-                let s = stream::iter(frames.clone().into_iter().map(Ok::<u8, ()>));
-                resp_stream = Some(Box::pin(s));
-            }
+            Action::Stream(frames) => {
+                stream_frames_acc.extend_from_slice(frames);
+            }
         }
     }
 
-    let mut actor: ConnectionActor<_, ()> =
-        ConnectionActor::new(queues, handle, resp_stream, shutdown);
+    let resp_stream: Option<FrameStream<u8, ()>> = if stream_frames_acc.is_empty() {
+        None
+    } else {
+        let s = stream::iter(stream_frames_acc.into_iter().map(Ok::<u8, ()>));
+        Some(Box::pin(s))
+    };
+    let mut actor: ConnectionActor<_, ()> =
+        ConnectionActor::new(queues, handle, resp_stream, shutdown);

Also applies to: 59-61

♻️ Duplicate comments (1)
tests/advanced/interaction_fuzz.rs (1)

12-16: Gate Envelope import to avoid unused‑import warnings.

Envelope is only used under serializer-bincode; importing it unconditionally will warn when that feature is disabled. Gate it like the tests.

Apply:

-use wireframe::{
-    app::Envelope,
-    connection::ConnectionActor,
-    response::FrameStream,
-};
+use wireframe::{connection::ConnectionActor, response::FrameStream};
+
+#[cfg(feature = "serializer-bincode")]
+use wireframe::app::Envelope;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34a5db2 and a0da5c5.

📒 Files selected for processing (1)
  • tests/advanced/interaction_fuzz.rs (5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • tests/advanced/interaction_fuzz.rs

⚙️ CodeRabbit configuration file

**/*.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 and docs must follow en-GB-oxendict (-ize / -our) 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.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • 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/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
  • Environment access (env::set_var and env::remove_var) are always unsafe in Rust 2024 and MUST be marked as such

    • For testing of functionality depending upon environment variables, dependency injection and the mockable crate are the preferred option.
    • If mockable cannot be used, env mutations in tests ...

Files:

  • tests/advanced/interaction_fuzz.rs
{src,tests}/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • tests/advanced/interaction_fuzz.rs
tests/**/*.rs

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.rs: Use rstest fixtures for shared setup
Replace duplicated tests with #[rstest(...)] parameterised cases
Prefer mockall for mocks/stubs

Files:

  • tests/advanced/interaction_fuzz.rs
🧬 Code graph analysis (1)
tests/advanced/interaction_fuzz.rs (3)
src/app/connection.rs (1)
  • serializer (115-116)
src/app/envelope.rs (6)
  • new (83-89)
  • new (107-113)
  • id (49-49)
  • id (94-94)
  • id (116-116)
  • payload (122-122)
src/connection.rs (3)
  • new (30-34)
  • new (146-159)
  • new (520-529)
🔇 Additional comments (6)
tests/advanced/interaction_fuzz.rs (6)

1-6: Good gating and docs.

Keep the module-level cfg and en‑GB “-ize” spelling as-is.


18-20: Feature‑gate of BincodeSerializer is correct.

Leave this as-is.


86-101: Action strategy is sound.

Generation covers empty, small and present/absent stream cases appropriately.


136-143: Envelope strategy is robust.

Using payload.into() future‑proofs the constructor call.


145-158: Round‑trip fuzz is well‑specified.

Case budget, exact‑consumption check, and tail‑bytes assertion are all on point.


160-168: Panic‑safety fuzz looks good.

Large sample size is appropriate for parser hardening.

Comment thread tests/advanced/interaction_fuzz.rs
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 13, 2025

✅ Actions performed

Reviews paused.

@leynos leynos merged commit bde29c3 into main Sep 14, 2025
6 checks passed
@leynos leynos deleted the codex/implement-fuzz-testing-for-protocol-parser branch September 14, 2025 00:11
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