Skip to content

Implement interleaved queue parity tests and ExecPlan living doc#468

Merged
leynos merged 5 commits intomainfrom
exercise-interleaved-queues-bs1tgh
Feb 23, 2026
Merged

Implement interleaved queue parity tests and ExecPlan living doc#468
leynos merged 5 commits intomainfrom
exercise-interleaved-queues-bs1tgh

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Feb 19, 2026

Summary

  • Expands scope to implement parity tests for interleaved high/low push queues and shared rate limiting, plus updates to the ExecPlan doc and roadmap/status notes.
  • Adds a living ExecPlan for roadmap item 10.3.2: Exercise interleaved push queue fairness and rate-limit symmetry, along with concrete unit and behavioural tests to validate the plan.

Changes

  • Added docs/execplans/10-3-2-exercise-interleaved-queues.md (ExecPlan living document)
  • Added unit tests: src/client/tests/streaming_parity.rs
  • Extended client streaming test harness to support interleaved priority frames and shared rate limiting:
    • tests/fixtures/client_streaming.rs
    • tests/fixtures/client_streaming/server.rs
    • tests/features/client_streaming.feature (new scenarios)
    • tests/scenarios/client_streaming_scenarios.rs
    • tests/steps/client_streaming_steps.rs (new givens/steps)
  • Updated test integration and module wiring:
    • src/client/tests/mod.rs: added streaming_parity module
  • Documentation updates:
    • docs/roadmap.md: mark item 10.3.2 as done
      -/docs/users-guide.md: note parity validation observed via client streaming surface
    • docs/multi-packet-and-streaming-responses-design.md: add section 12.6 Interleaved queue parity validation
    • docs/wireframe-client-design.md: streaming parity validation notes
  • Updated related design docs to reference parity validation paths and testing stance.

Motivation

  • Align implementation with roadmap item 10.3.2 and prove parity when interleaving traffic via client streaming, providing a centralized, testable reference that gates progress.
  • Make parity assertions observable to both unit and behavioural tests, ensuring end-to-end validation without API changes.

Plan of work

Stage A: Lock the parity contract and test matrix

  • Define exact parity notions for fairness and shared rate-limiting; map to unit (rstest) and behavioural (rstest-bdd) tests; ensure traceability between assertions and planned test cases.
  • Go/no-go checkpoint: matrix exists and each assertion has at least one planned unit test and one planned BDD scenario.

Stage B: Extend unit tests (rstest) for interleaved parity

  • Add focused unit tests reusing existing streaming helpers for interleaved fairness and cross-priority rate symmetry.
  • Use deterministic virtual time for timing-sensitive checks.
  • Go/no-go checkpoint: targeted unit tests pass before BDD work begins.

Stage C: Extend behavioural tests (rstest-bdd 0.5.0)

  • Add client_streaming interleaving scenarios and fixtures to reflect externally observable parity outcomes.
  • Wire up steps, scenarios, and fixtures to cover both fairness and rate-limit symmetry.
  • Go/no-go checkpoint: behavioural tests pass for new parity scenarios.

Stage D: Apply minimal implementation fixes if required

  • Only implement smallest changes needed to restore symmetry, with regression coverage.
  • Avoid API surface changes unless strictly necessary and documented.
  • Go/no-go checkpoint: all parity tests pass with deterministic results.

Stage E: Update design docs, users guide, and roadmap

  • Record final decisions and testing rationale in the design/docs.
  • Update docs/users-guide.md if consumer-visible changes exist; otherwise note no API changes required.
  • Mark roadmap 10.3.2 as done after gates pass.

Stage F: Run full quality gates with captured logs

  • fmt, lint, tests (unit and BDD), markdownlint, nixie with logs.
  • Go/no-go checkpoint: all gates pass.

Acceptance criteria

  • Unit tests prove interleaved fairness and shared-rate symmetry via rstest.
  • Behavioural tests (rstest-bdd 0.5.0) demonstrate externally observable parity.
  • Related test suites continue to pass (e.g., tests/push.rs, tests/connection_actor_fairness.rs).
  • Design decisions documented in relevant docs; users guide reflects changes (or notes no API changes).
  • Roadmap 10.3.2 marked as done in docs/roadmap.md after gates pass.
  • All quality gates (fmt, lint, tests, markdownlint, nixie) pass.

Validation and acceptance

  • Final acceptance requires parity assertions implemented in code, paired with BDD scenarios, and comprehensive documentation updates.
  • Implementation should be additive and re-runable; no destructive migrations unless tests demand.

Context and orientation

  • This ExecPlan connects to implementations and tests under:
    • src/client/response_stream.rs, src/client/streaming.rs, src/push/queues/, tests/, and related docs including docs/roadmap.md and docs/users-guide.md.
  • It is designed to keep the team aligned on goals, constraints, and gating criteria as work proceeds through the stages.

Notes for implementers

  • Keep step definitions modular; reuse streaming test infrastructure where possible.
  • Avoid coupling to internal counters unless explicitly tested; prefer externally observable outcomes.
  • Use clear, testable naming for new tests and scenarios to facilitate roadmap audits.

📎 Task: https://www.devboxer.com/task/c4610f93-377f-41b4-ab9a-63cd88cecee6

Summary by Sourcery

Add parity validation for interleaved push queue fairness and shared rate limiting via client streaming paths, and document completion of roadmap item 10.3.2.

New Features:

  • Introduce unit tests and behavioural BDD scenarios that exercise interleaved high- and low-priority push queues through the client streaming interface.
  • Expose new client streaming test server modes for interleaved priority traffic and shared cross-priority rate limiting.

Enhancements:

  • Extend client streaming test fixtures and world state to verify fairness ordering and shared rate-limit symmetry as observed by clients.

Documentation:

  • Add a living ExecPlan document for roadmap item 10.3.2 and record the testing approach and outcomes.
  • Document interleaved queue parity validation in the multi-packet/streaming and wireframe client design docs, and note parity validation in the user guide.
  • Mark roadmap item 10.3.2 as complete in the roadmap.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Feb 19, 2026

Reviewer's Guide

Implements roadmap item 10.3.2 by adding an ExecPlan living document plus new unit and BDD tests that exercise interleaved high/low push queue fairness and shared rate limiting via the client streaming surface, wiring them through existing streaming fixtures and documenting the parity guarantees across the design and user docs.

Sequence diagram for interleaved queue parity validation via client streaming

sequenceDiagram
    participant UnitTest as UnitTest_streaming_parity
    participant BDD as BDD_client_streaming
    participant Fixture as ClientStreamingFixture
    participant Conn as ConnectionActor
    participant Fair as FairnessConfig
    participant PQHigh as PushQueueHigh
    participant PQLow as PushQueueLow
    participant RL as RateLimiter
    participant RS as ResponseStream

    UnitTest->>Fixture: configure_interleaved_scenario(high_load, low_load, shared_budget)
    BDD->>Fixture: configure_interleaved_scenario(high_load, low_load, shared_budget)

    Fixture->>Fair: build_fairness_config(thresholds)
    Fixture->>Conn: start_with_fairness(Fair)

    loop enqueue_interleaved_pushes
        Fixture->>PQHigh: enqueue_high_priority_push(frame)
        Fixture->>PQLow: enqueue_low_priority_push(frame)
    end

    Conn->>RL: request_budget_for_high(batch)
    RL-->>Conn: grant_or_delay_high
    Conn->>PQHigh: dequeue_under_budget
    PQHigh-->>Conn: high_frame

    Conn->>RL: request_budget_for_low(batch)
    RL-->>Conn: grant_or_delay_low
    Conn->>PQLow: dequeue_under_budget
    PQLow-->>Conn: low_frame

    Conn->>RS: emit_frame_to_response_stream(high_frame_or_low_frame)

    RS-->>UnitTest: yield_next_frame()
    RS-->>BDD: yield_next_frame()

    UnitTest->>UnitTest: assert_fairness_parity(interleaved_progress_low_under_burst)
    UnitTest->>UnitTest: assert_rate_limit_symmetry(shared_budget_across_priorities)

    BDD->>BDD: assert_user_visible_progress(low_priority_not_starved)
    BDD->>BDD: assert_user_visible_rate_limit_effects(shared_budget_marker_frame)
Loading

File-Level Changes

Change Details Files
Add an ExecPlan living document for roadmap item 10.3.2 that defines the parity contract, risks, plan of work, and acceptance criteria.
  • Introduce docs/execplans/10-3-2-exercise-interleaved-queues.md as a detailed living plan describing goals, constraints, risks, and staged implementation for interleaved queue parity
  • Document concrete mapping to unit and behavioural tests, including checklist, validation criteria, and quality gate requirements
  • Record outcomes, surprises, and decisions taken during implementation of 10.3.2
docs/execplans/10-3-2-exercise-interleaved-queues.md
Extend client streaming test fixtures to generate and send interleaved and rate-limited priority frames using the real ConnectionActor, queues, and hooks.
  • Add helper functions to build interleaved-priority and rate-limited frame sequences by configuring PushQueues, ConnectionActor fairness, and stream-end hooks
  • Expose build_interleaved_priority_frames and build_rate_limited_priority_frames from the server-side fixture so tests and BDD harness can reuse them
  • Refactor server run logic into a reusable run_streaming_mode helper that dispatches all StreamingServerMode variants, including new parity modes
tests/fixtures/client_streaming/server.rs
tests/fixtures/client_streaming.rs
Augment the client streaming BDD fixture and world state to drive parity scenarios and assert external fairness and rate-limit symmetry.
  • Extend StreamingServerMode with InterleavedPriorities and SharedRateLimit and add helper functions to send single or multiple StreamTestEnvelope frames over the framed transport
  • Add world methods to start parity-focused test servers and to verify interleaved priority ordering and shared rate-limit behaviour, including a marker frame to capture whether low-priority pushes were blocked
  • Track additional world state (shared_rate_limit_blocked) and reuse a unified run_streaming_mode path from the server handler
tests/fixtures/client_streaming.rs
Define new rstest unit tests that validate interleaved fairness and shared rate-limiting parity through the client streaming API.
  • Add streaming_parity.rs test module that builds push queues and ConnectionActor instances with fairness and rate-limit configuration mirroring production
  • Generate deterministic interleaved and rate-limited frame sequences, then consume them via call_streaming to assert payload ordering and limiter behaviour from the client perspective
  • Use tokio::time::pause/advance and futures::now_or_never to prove low-priority pushes are blocked by the shared limiter before refill
src/client/tests/streaming_parity.rs
src/client/tests/mod.rs
Add BDD steps and scenarios that express parity guarantees in user-facing language and hook them into rstest-bdd.
  • Introduce new Given steps to start interleaved-priority and shared-rate-limit streaming servers and Then steps to assert fairness (no low-priority starvation) and limiter blocking semantics
  • Wire two new scenarios in client_streaming_scenarios.rs to the existing client_streaming.feature file for parity-related behaviour
  • Extend client_streaming.feature with scenarios describing fair interleaving and shared rate limiting, reusing the general streaming request When clause and clean termination assertions
tests/steps/client_streaming_steps.rs
tests/scenarios/client_streaming_scenarios.rs
tests/features/client_streaming.feature
Update design and user documentation to describe how interleaved queue parity is validated via streaming and to mark the roadmap item complete.
  • Add a dedicated section 12.6 to the multi-packet/streaming design doc explaining fairness and rate-limit symmetry validation using ConnectionActor, FairnessConfig, and PushQueues feeding ResponseStream
  • Update the wireframe client design doc with a "Streaming parity validation" section describing the validation approach and guarantees without new public API
  • Note in the user guide that interleaved priority behaviour and shared cross-priority rate limiting are validated along the streaming path for roadmap 10.3.2, and mark roadmap item 10.3.2 as done in docs/roadmap.md
docs/multi-packet-and-streaming-responses-design.md
docs/wireframe-client-design.md
docs/users-guide.md
docs/roadmap.md

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 Feb 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8506484 and f7ea261.

📒 Files selected for processing (14)
  • docs/execplans/10-3-2-exercise-interleaved-queues.md
  • docs/multi-packet-and-streaming-responses-design.md
  • docs/users-guide.md
  • docs/wireframe-client-design.md
  • src/client/tests/mod.rs
  • src/client/tests/streaming_parity.rs
  • tests/features/client_streaming.feature
  • tests/fixtures/client_streaming.rs
  • tests/fixtures/client_streaming/modes.rs
  • tests/fixtures/client_streaming/server.rs
  • tests/fixtures/interleaved_push_queues.rs
  • tests/interleaved_push_queues.rs
  • tests/scenarios/client_streaming_scenarios.rs
  • tests/steps/client_streaming_steps.rs

Summary by CodeRabbit

Release Notes

  • Tests

    • Added comprehensive test coverage for client-side streaming interleaved queue fairness and rate-limit parity validation.
    • Introduced BDD scenarios verifying fair low-priority frame progression during high-priority bursts and cross-priority rate-limit enforcement.
  • Documentation

    • Enhanced documentation describing streaming parity validation and fairness guarantees for interleaved push queues.

Walkthrough

This pull request implements end-to-end validation of interleaved high-/low-priority push queue fairness and shared rate-limit symmetry through the client streaming surface, including comprehensive unit tests, behaviour-driven development scenarios, and documentation updates without changing public APIs.

Changes

Cohort / File(s) Summary
Documentation & Design
docs/execplans/10-3-2-exercise-interleaved-queues.md, docs/multi-packet-and-streaming-responses-design.md, docs/users-guide.md, docs/wireframe-client-design.md
Title, progress notes, decision logs, and deliverables updated to reflect end-to-end streaming parity validation implementation; new subsections document fairness-parity guarantees and rate-limit symmetry without public API changes.
Client Streaming Parity Tests
src/client/tests/streaming_parity.rs, src/client/tests/mod.rs
New test module with helper functions (stream_terminator, hooks_with_stream_end, PausedTimeGuard) and two test cases validating interleaved-priority fairness ordering and shared rate-limiting across priorities via the ResponseStream path.
BDD Test Fixtures & Modes
tests/fixtures/client_streaming/modes.rs, tests/fixtures/client_streaming/server.rs, tests/fixtures/client_streaming.rs
New modes module introducing StreamingServerMode enum and comprehensive server-side helpers (start_interleaved_priority_server, start_shared_rate_limit_server); verification methods added to ClientStreamingWorld; refactored server-start machinery and enabled all tokio features for timing-sensitive tests.
Feature Tests & Scenarios
tests/features/client_streaming.feature, tests/scenarios/client_streaming_scenarios.rs, tests/steps/client_streaming_steps.rs
Two new Gherkin scenarios ("Client receives fair interleaving across push priorities" and "Client observes shared rate limiting across push priorities") with corresponding scenario functions and Given/Then steps to validate fairness and rate-limit behaviour.
Test Macro Adjustments
tests/fixtures/interleaved_push_queues.rs, tests/interleaved_push_queues.rs
Result bindings added to push_expect! macro invocations to explicitly bind returned values, preventing unused-result warnings without altering control flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #225 — Introduces push_expect!/recv_expect! helpers that the new streaming parity tests directly use and adapt for test infrastructure.
  • PR #473 — Adds and modifies interleaved push queue tests and documentation covering PushQueues, FairnessConfig, and shared rate-limiter—directly aligned with this PR's validation scope.
  • PR #462 — Introduces client streaming infrastructure (ResponseStream, terminator detection, test fixtures) that this PR extends to validate fairness and rate-limit parity.

Poem

🎭 High-priority frames no longer hoard the stream,
Low-priority pushes share the dream,
Shared limiters keep the traffic fair,
Tests validate what's right with care! 🔄✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly summarises the main changes: implementing parity tests for interleaved queues and an ExecPlan living document, which aligns with the core scope of the changeset.
Description check ✅ Passed The description comprehensively relates to the changeset, detailing motivation, stages of work, acceptance criteria, and specific file changes covering unit tests, BDD scenarios, fixtures, and documentation updates.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch exercise-interleaved-queues-bs1tgh

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos leynos changed the title Add ExecPlan for 10.3.2: interleaved queues experiment Plan interleaved queue exercise: parity tests and ExecPlan Feb 22, 2026
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 22, 2026

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix:

tests/fixtures/client_streaming/server.rs

Comment on file

pub(crate) async fn build_interleaved_priority_frames(
    cid: CorrelationId,
) -> TestResult<Vec<StreamTestEnvelope>> {
    let (queues, handle) = PushQueues::<StreamTestEnvelope>::builder()
        .high_capacity(8)
        .low_capacity(8)
        .unlimited()
        .build()?;
    let push_handle = handle.clone();

    let mut actor = ConnectionActor::with_hooks(
        ConnectionChannels::new(queues, handle),
        None,
        CancellationToken::new(),
        hooks_with_stream_end(),
    );
    actor.set_fairness(FairnessConfig {
        max_high_before_low: 1,
        time_slice: None,
    });

    push_handle
        .push_high_priority(StreamTestEnvelope::data(
            MessageId::new(1),
            cid,
            Payload::new(vec![1]),
        ))
        .await?;
    push_handle
        .push_high_priority(StreamTestEnvelope::data(
            MessageId::new(3),
            cid,
            Payload::new(vec![3]),
        ))
        .await?;
    push_handle
        .push_low_priority(StreamTestEnvelope::data(
            MessageId::new(2),
            cid,
            Payload::new(vec![2]),
        ))
        .await?;
    push_handle
        .push_low_priority(StreamTestEnvelope::data(
            MessageId::new(4),
            cid,
            Payload::new(vec![4]),
        ))
        .await?;

    let (tx, rx) = mpsc::channel(4);
    tx.send(StreamTestEnvelope::data(
        MessageId::new(10),
        cid,
        Payload::new(vec![10]),
    ))
    .await?;
    tx.send(StreamTestEnvelope::data(
        MessageId::new(11),
        cid,
        Payload::new(vec![11]),
    ))
    .await?;
    drop(tx);

    actor
        .set_multi_packet_with_correlation(Some(rx), Some(cid.get()))
        .map_err(|e| format!("set_multi_packet_with_correlation failed: {e}"))?;
    drop(push_handle);

    let mut out = Vec::new();
    actor
        .run(&mut out)
        .await
        .map_err(|e| format!("connection actor run failed: {e:?}"))?;
    Ok(out)
}

❌ New issue: Large Method
build_interleaved_priority_frames has 72 lines, threshold = 70

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 22, 2026

@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix:

src/client/tests/streaming_parity.rs

Comment on file

async fn collect_interleaved_fairness_frames(
    correlation: CorrelationId,
) -> TestResult<Vec<TestStreamEnvelope>> {
    let (queues, handle) = PushQueues::<TestStreamEnvelope>::builder()
        .high_capacity(8)
        .low_capacity(8)
        .unlimited()
        .build()?;
    let push_handle = handle.clone();

    let mut actor = ConnectionActor::with_hooks(
        ConnectionChannels::new(queues, handle),
        None,
        CancellationToken::new(),
        hooks_with_stream_end(),
    );
    actor.set_fairness(FairnessConfig {
        max_high_before_low: 1,
        time_slice: None,
    });

    // High-priority burst with low-priority frames queued to prove fairness.
    push_handle
        .push_high_priority(TestStreamEnvelope::data(
            MessageId::new(1),
            correlation,
            Payload::new(vec![1]),
        ))
        .await?;
    push_handle
        .push_high_priority(TestStreamEnvelope::data(
            MessageId::new(3),
            correlation,
            Payload::new(vec![3]),
        ))
        .await?;
    push_handle
        .push_low_priority(TestStreamEnvelope::data(
            MessageId::new(2),
            correlation,
            Payload::new(vec![2]),
        ))
        .await?;
    push_handle
        .push_low_priority(TestStreamEnvelope::data(
            MessageId::new(4),
            correlation,
            Payload::new(vec![4]),
        ))
        .await?;

    let (tx, rx) = mpsc::channel(4);
    tx.send(TestStreamEnvelope::data(
        MessageId::new(10),
        correlation,
        Payload::new(vec![10]),
    ))
    .await?;
    tx.send(TestStreamEnvelope::data(
        MessageId::new(11),
        correlation,
        Payload::new(vec![11]),
    ))
    .await?;
    drop(tx);

    actor
        .set_multi_packet_with_correlation(Some(rx), Some(correlation.get()))
        .map_err(|e| format!("failed to set multi-packet source: {e}"))?;

    // Allow the actor to observe queue closure once all buffered frames drain.
    drop(push_handle);

    let mut out = Vec::new();
    actor
        .run(&mut out)
        .await
        .map_err(|e| format!("connection actor run failed: {e:?}"))?;
    Ok(out)
}

❌ New issue: Large Method
collect_interleaved_fairness_frames has 72 lines, threshold = 70

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@leynos leynos changed the title Plan interleaved queue exercise: parity tests and ExecPlan Implement interleaved queue parity tests and ExecPlan living doc Feb 22, 2026
@leynos leynos marked this pull request as ready for review February 22, 2026 22:55
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • The rate-limiting tests use tokio::time::pause()/resume() directly and can early-return on errors without resuming time; consider wrapping pause/resume in a small RAII guard so the runtime clock is always restored even on failure paths.
  • There is quite a bit of duplicated test harness logic between tests/fixtures/client_streaming/server.rs and src/client/tests/streaming_parity.rs (e.g., stream_terminator, hooks_with_stream_end, interleaved/rate-limited frame builders); it would be cleaner and easier to maintain if these helpers were shared in a common test module.
  • The shared rate-limit BDD fixture uses magic marker payload values 98/99 to signal contention; extracting these into named constants or a small helper would make the intent clearer and reduce the chance of accidental collisions with other test payloads.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The rate-limiting tests use `tokio::time::pause()`/`resume()` directly and can early-return on errors without resuming time; consider wrapping pause/resume in a small RAII guard so the runtime clock is always restored even on failure paths.
- There is quite a bit of duplicated test harness logic between `tests/fixtures/client_streaming/server.rs` and `src/client/tests/streaming_parity.rs` (e.g., `stream_terminator`, `hooks_with_stream_end`, interleaved/rate-limited frame builders); it would be cleaner and easier to maintain if these helpers were shared in a common test module.
- The shared rate-limit BDD fixture uses magic marker payload values `98`/`99` to signal contention; extracting these into named constants or a small helper would make the intent clearer and reduce the chance of accidental collisions with other test payloads.

## Individual Comments

### Comment 1
<location> `docs/execplans/10-3-2-exercise-interleaved-queues.md:3` </location>
<code_context>
+# Exercise Interleaved Push Queue Fairness and Rate-Limit Symmetry
+
+This ExecPlan is a living document. The sections `Constraints`, `Tolerances`,
+`Risks`, `Progress`, `Surprises & Discoveries`, `Decision Log`, and
+`Outcomes & Retrospective` must be kept up to date as work proceeds.
</code_context>

<issue_to_address>
**suggestion (review_instructions):** ExecPlan is introduced as an acronym without being defined on first use.

Consider expanding ExecPlan when it first appears, for example: "This Execution Plan (ExecPlan) is a living document." This would satisfy the requirement to define uncommon acronyms on first use.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</issue_to_address>

### Comment 2
<location> `docs/execplans/10-3-2-exercise-interleaved-queues.md:137` </location>
<code_context>
+  parallel feature namespace. Rationale: keeps behavioural coverage cohesive
+  and lowers maintenance cost. Date/Author: 2026-02-19 / Codex.
+
+- Decision: use virtual time in timing-sensitive unit tests and outcome-based
+  assertions in BDD scenarios. Rationale: deterministic CI behaviour without
+  over-coupling BDD tests to scheduler details. Date/Author: 2026-02-19 / Codex.
</code_context>

<issue_to_address>
**suggestion (review_instructions):** CI is used later in the document without being expanded on first use.

Later in the document the phrase "deterministic CI behaviour" is used, but CI is not expanded anywhere. To comply with the acronym guidance, consider changing that first occurrence to "continuous integration (CI)".

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*.md`

**Instructions:**
Define uncommon acronyms on first use.

</details>
</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 docs/execplans/10-3-2-exercise-interleaved-queues.md Outdated
Comment thread docs/execplans/10-3-2-exercise-interleaved-queues.md
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7157dc47e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/fixtures/client_streaming/server.rs Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 23, 2026

@coderabbitai review

2 similar comments
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 23, 2026

@coderabbitai review

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 23, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 23, 2026

✅ Actions performed

Review triggered.

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

@coderabbitai coderabbitai Bot added the codex label Feb 23, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

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

⚠️ Outside diff range comments (1)
tests/fixtures/client_streaming.rs (1)

418-424: ⚠️ Potential issue | 🟠 Major

Split this module to stay under 400 lines.

Extract the new streaming-mode helpers or verification logic into a sibling module (for example tests/fixtures/client_streaming/modes.rs) and re-export to keep this file below the size cap.

As per coding guidelines: "Files must not exceed 400 lines in length".

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

In `@tests/fixtures/client_streaming.rs` around lines 418 - 424, This file exceeds
the 400-line limit; extract the streaming-mode helpers and verification logic
into a sibling module (e.g. create tests/fixtures/client_streaming/modes.rs),
move all streaming-specific functions/types (including helpers that reference
server or abort_server behavior) out of client_streaming.rs, then in
client_streaming.rs add a mod modes; and pub use modes::*; to re-export them so
existing tests keep working; update any internal references to use the moved
symbols (e.g., ensure abort_server-related code still references the same
identifiers) and adjust imports in tests if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/execplans/10-3-2-exercise-interleaved-queues.md`:
- Line 1: Change the headings to sentence case: replace the H1 "Exercise
Interleaved Push Queue Fairness and Rate-Limit Symmetry" with "Exercise
interleaved push queue fairness and rate-limit symmetry" and update the
subheading "Surprises & Discoveries" to "Surprises & discoveries" so both comply
with the "Write headings in sentence case" guideline.
- Around line 148-151: The document uses the British-Oxford guideline requiring
-ize suffixes: find and replace the British spelling "synthesising" with the
-ize form "synthesizing" in the "Outcomes & retrospective" section (and any
other occurrences in this markdown), ensuring the change is applied to the text
and any inline code/quotes if present (search for the token "synthesising" and
update to "synthesizing").
- Around line 292-314: Replace the indented command block that starts with "set
-o pipefail" and includes the lines like "make fmt", "make check-fmt", "make
lint", "make test-bdd", "make test", "make markdownlint", and "make nixie" with
a fenced code block using a language identifier (use "shell"); wrap the exact
commands between ```shell and ``` and remove any leading indentation or plus
signs so Markdown tooling can validate the shell block correctly.

In `@src/client/tests/streaming_parity.rs`:
- Around line 156-224: In collect_rate_limited_frames fix handling of the
low-priority push future result: when inspecting
blocked_low_future.as_mut().now_or_never(), treat Some(Err(e)) as a real push
error and propagate/return it instead of treating it as "not blocked" and
discarding it; only treat None as the blocked case and proceed to time::advance
and await the future (checking its Result when awaited); ensure references to
push_low_priority, blocked_low/blocked_low_future, and now_or_never are updated
so any Err returned is surfaced as an error from collect_rate_limited_frames.

In `@tests/fixtures/client_streaming/server.rs`:
- Around line 206-270: build_rate_limited_priority_frames currently treats Any
Some(_) from blocked_low_future.as_mut().now_or_never() as "not blocked" and
drops potential Err values; change the logic to inspect the Option<Result<_, _>>
returned by now_or_never() from blocked_low_future: if Some(Err(e)) return Err
with that error (propagate test failure), if Some(Ok(_)) treat as not-blocked,
and only when None treat as blocked and advance time then await the future;
adjust handling of blocked_low/blocked_low_future accordingly so
push_low_priority errors are not swallowed.

---

Outside diff comments:
In `@tests/fixtures/client_streaming.rs`:
- Around line 418-424: This file exceeds the 400-line limit; extract the
streaming-mode helpers and verification logic into a sibling module (e.g. create
tests/fixtures/client_streaming/modes.rs), move all streaming-specific
functions/types (including helpers that reference server or abort_server
behavior) out of client_streaming.rs, then in client_streaming.rs add a mod
modes; and pub use modes::*; to re-export them so existing tests keep working;
update any internal references to use the moved symbols (e.g., ensure
abort_server-related code still references the same identifiers) and adjust
imports in tests if needed.

ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10daa36 and 8506484.

📒 Files selected for processing (12)
  • docs/execplans/10-3-2-exercise-interleaved-queues.md
  • docs/multi-packet-and-streaming-responses-design.md
  • docs/roadmap.md
  • docs/users-guide.md
  • docs/wireframe-client-design.md
  • src/client/tests/mod.rs
  • src/client/tests/streaming_parity.rs
  • tests/features/client_streaming.feature
  • tests/fixtures/client_streaming.rs
  • tests/fixtures/client_streaming/server.rs
  • tests/scenarios/client_streaming_scenarios.rs
  • tests/steps/client_streaming_steps.rs

Comment thread docs/execplans/10-3-2-exercise-interleaved-queues.md Outdated
Comment thread docs/execplans/10-3-2-exercise-interleaved-queues.md
Comment thread docs/execplans/10-3-2-exercise-interleaved-queues.md Outdated
Comment thread src/client/tests/streaming_parity.rs
Comment thread tests/fixtures/client_streaming/server.rs
leynos and others added 5 commits February 23, 2026 18:38
…y fairness and rate limiting

- Implement end-to-end parity validation for roadmap item 10.3.2.
- Add unit tests in src/client/tests/streaming_parity.rs to verify client observes server-side fairness and shared rate limiting.
- Extend behaviour-driven tests with new scenarios and fixtures covering interleaved high- and low-priority push queues.
- Update client streaming test fixtures and test server helpers to support interleaved priority and shared rate limiting modes.
- Document parity validation rationale and design decisions in multiple design and user guide docs.
- Mark roadmap item 10.3.2 as complete.

This work confirms fairness and symmetric rate limiting behaviour without changing the public WireframeClient API.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
- Extracted fairness actor setup into `setup_fairness_actor`.
- Moved multi-packet channel setup to separate async functions.
- Simplified `collect_interleaved_fairness_frames` by using helper functions.
- In client_streaming server tests, extracted push logic into a helper and improved multi-packet channel setup.
- Overall improved code organization and reusability in streaming parity tests.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
- Introduced PausedTimeGuard struct to encapsulate time::pause and time::resume calls.
- Replaced manual time::pause() and time::resume() in streaming parity and client streaming tests with PausedTimeGuard for safer and cleaner time control.
- Defined named constants for shared rate limit contention markers for clarity.
- Minor docs wording improvements in execution plan markdown.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
…o modes.rs

Extract streaming server mode definitions, implementations, and verification helpers from the
client_streaming fixture module into a new dedicated modes.rs file to improve code organization
and maintainability. This includes moving enum StreamingServerMode and related async functions
like run_streaming_mode, as well as associated verification methods on ClientStreamingWorld.

Also, fix subtle bug in build_rate_limited_priority_frames where now_or_never was previously
only checked for None but now properly accounts for Some(Ok) and Some(Err) cases.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Handle  results explicitly in interleaved queue tests so\n no longer fails on .\n\nAlso fix serializer imports after splitting client streaming helpers\ninto .
@devboxerhub devboxerhub Bot force-pushed the exercise-interleaved-queues-bs1tgh branch from 9b8bbe5 to f7ea261 Compare February 23, 2026 18:42
@leynos leynos merged commit 2933264 into main Feb 23, 2026
6 checks passed
@leynos leynos deleted the exercise-interleaved-queues-bs1tgh branch February 23, 2026 18:55
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