Add 11-4-2 ExecPlan doc and tests; mark 12.4.2 roadmap done#509
Conversation
WalkthroughAdd an ExecPlan and extend troubleshooting documentation; map specific Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideAdds an ExecPlan for roadmap item 11.4.2, expands client troubleshooting docs for codec-length, preamble, and TLS misconfigurations, and extends the client preamble/runtime test harnesses and BDD scenarios to prove the documented behaviours without changing public APIs. Sequence diagram for updated client preamble error mappingsequenceDiagram
participant Client
participant PreambleModule
participant Server
rect rgb(235,235,255)
Client->>PreambleModule: write_preamble(preamble_bytes)
PreambleModule->>Server: send preamble_bytes over TCP
alt write succeeds
Server-->>PreambleModule: ack or invalid bytes
PreambleModule-->>Client: return
else write I_O_or_encode_failure
PreambleModule-->>Client: Err(EncodeError)
Client-->>Client: map to ClientError::PreambleEncode
end
end
rect rgb(235,255,235)
Client->>PreambleModule: read_preamble()
alt valid acknowledgement bytes
Server-->>PreambleModule: valid preamble ack
PreambleModule-->>Client: Ok(ack, leftover_bytes)
else invalid_or_malformed_bytes
Server-->>PreambleModule: invalid ack bytes
PreambleModule-->>Client: Err(read_or_decode_failure)
Client-->>Client: map to ClientError::PreambleRead
end
end
rect rgb(255,235,235)
Client->>PreambleModule: preamble_exchange with timeout
par server responds before timeout
Server-->>PreambleModule: response bytes
PreambleModule-->>Client: Ok
and timeout expires first
Client-->>Client: detect timeout expiry
Client-->>Client: map to ClientError::PreambleTimeout
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@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_preamble.rs Comment on file pub async fn start_invalid_ack_server(&mut self) -> TestResult {
let listener = TcpListener::bind("127.0.0.1:0").await?;
let addr = listener.local_addr()?;
let handle = tokio::spawn(async move {
use tokio::io::AsyncWriteExt;
let (mut stream, _) = listener.accept().await.expect("accept");
let (_preamble, _) = read_preamble::<_, TestPreamble>(&mut stream)
.await
.expect("read preamble");
stream
.write_all(&[0xff, 0x00, 0x01])
.await
.expect("write invalid acknowledgement");
});
self.addr = Some(addr);
self.server = Some(handle);
Ok(())
}❌ New issue: Code Duplication |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. tests/fixtures/client_preamble.rs Comment on file let addr = listener.local_addr()?;
let handle = tokio::spawn(async move {
let (mut stream, _) = listener.accept().await.expect("accept");
self.spawn_server(|mut stream| async move {❌ New issue: Code Duplication |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai Please suggest a fix for this issue and supply a prompt for an AI coding agent to enable it to apply the fix. Include the file and symbol names indicated in the issue at the head of your response. Code Duplicationtests/fixtures/client_preamble.rs: What lead to degradation?The module contains 4 functions with similar structure: ClientPreambleWorld.connect_with_invalid_ack,ClientPreambleWorld.connect_with_timeout,ClientPreambleWorld.start_ack_server,ClientPreambleWorld.start_invalid_ack_server Why does this problem occur?Duplicated code often leads to code that's harder to change since the same logical change has to be done in multiple functions. More duplication gives lower code health. How to fix it?A certain degree of duplicated code might be acceptable. The problems start when it is the same behavior that is duplicated across the functions in the module, ie. a violation of the Don't Repeat Yourself (DRY) principle. DRY violations lead to code that is changed together in predictable patterns, which is both expensive and risky. DRY violations can be identified using CodeScene's X-Ray analysis to detect clusters of change coupled functions with high code similarity. Read More |
This comment was marked as resolved.
This comment was marked as resolved.
…figs Add a comprehensive 427-line troubleshooting section for client misconfiguration diagnostics under roadmap item 11.4.2. This new document expands the existing terse bullet list into structured guidance covering codec length mismatches, preamble errors, and TLS-related deployment issues. The guide includes diagnostics, symptoms, confirmation steps, and fixes, aligned with current client error behaviors and without implying non-existent client TLS support. This addition also outlines constraints, tolerances, risks, and implementation stages to ensure accuracy and test coverage with rstest and rstest-bdd. The change prepares for better user guidance and will be validated with extensive test and documentation quality gates before marking the roadmap item complete. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
…s and integration tests - Complete roadmap item 11.4.2: document common client misconfigurations and error surfaces - Clarify reachable client error variants in preamble failures, removing references to unused PreambleWrite error - Add extensive `rstest` and BDD coverage for preamble error scenarios and TLS port mismatch - Align users-guide.md and wireframe-client-design.md to reflect observed client error surface - Update roadmap.md to mark 11.4.2 as completed - Provide decision record documenting rationale for error variant choices - Add tests ensuring client surfaces invalid preamble acknowledgement as PreambleRead error - Add tests verifying TLS protocol mismatch surfaces as transport WireframeError::Io - All docs and tests pass validation and linting, except unrelated legacy markdown lint issues Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
… fixture Extracted common server spawning logic into a new async method `spawn_server` in `ClientPreambleWorld` to reduce duplication across multiple server start functions. This change simplifies test server setup by reusing the listener binding and spawn code, improving maintainability and clarity in the test fixtures. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
…eamble.rs Extract common connection result handling logic into two async methods in ClientPreambleWorld to store the client or error and handle failure callbacks uniformly. Replace duplicate match blocks with calls to these methods, improving code clarity and reducing repetition in connection-related tests. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
…ture Consolidated multiple tokio imports into a single line to improve import clarity in tests/fixtures/client_preamble.rs. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Refactor the client_preamble test fixture by introducing a helper function make_failure_signal_callback to encapsulate the preamble failure callback logic. Replace inline failure callbacks with this helper to reduce code duplication and improve readability. Also, add spawn_server_after_preamble helper method to reuse preamble reading logic in test servers. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
e88b8cf to
4269272
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4269272de0
ℹ️ 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".
The callback-tracking logic in `store_connect_result_with_failure_signal` and `connect_with_preamble` incorrectly treated any non-timeout receiver completion as success. `timeout(..., rx).await.is_ok()` returns true for both `Ok(Ok(()))` (signal received) and `Ok(Err(RecvError))` (sender dropped without sending). This meant `success_callback_invoked` and `failure_callback_invoked` could be set even when callbacks never actually ran, allowing behavioural tests to pass with broken callback invocation. Changed both methods to explicitly check for `Ok(Ok(()))` using `matches!`, ensuring the flag is only set when the callback actually sends a signal. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
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/fixtures/client_preamble.rs (1)
1-482:⚠️ Potential issue | 🟡 MinorExtract signal helpers to a shared test utilities module.
This file is 482 lines, exceeding the 400-line ceiling by 82 lines. Move
create_signal_channel,send_signal, andmake_failure_signal_callback(lines 66–89) into a sharedtest_helpersortest_utilsmodule to reduce coupling and allow reuse in other fixture tests. This extraction alone reduces the file to approximately 440 lines; further refactoring ofClientPreambleWorldsetup methods may be warranted if additional reduction is required.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/fixtures/client_preamble.rs` around lines 1 - 482, Extract the three signal helpers create_signal_channel, send_signal, and make_failure_signal_callback into a shared test utilities module (e.g., test_helpers or test_utils) and update this fixture to import them; specifically, move the exact implementations (keeping generic signatures and SenderHolder<T> type alias) out of this file, expose them via pub (or pub(crate)) functions/alias, then replace the local definitions with use statements and remove the originals in ClientPreambleWorld; update all call sites in this file (e.g., in connect_with_preamble, connect_with_ack, connect_with_timeout, connect_with_invalid_ack) to use the imported helpers so behavior and types (oneshot::Receiver, SenderHolder, and callback return types) remain unchanged.
🤖 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/users-guide.md`:
- Around line 2281-2282: The sentence fragment should read "apply a reconnect or
retry policy" instead of "apply reconnect or retry policy"; update the
documentation text that mentions ClientError::Wireframe(WireframeError::Io(_))
to insert the missing preposition "a" before "reconnect" so the clause becomes
"treat ClientError::Wireframe(WireframeError::Io(_)) as a network-level or
peer-closure failure and apply a reconnect or retry policy at the call site."
- Around line 2262-2264: The docs string contains British Oxford spelling
requirement but uses "serialising" in the sentence mentioning
write_preamble(...) and PreambleWrite; update the text to use "serializing"
(i.e., replace "serialising" with "serializing") where it appears in the
sentence that reads "completion while serialising or writing the preamble..." so
the document adheres to the en-GB-oxendict -ize convention.
In `@tests/features/client_runtime.feature`:
- Line 29: Rename or replace the misleading Gherkin step "When the client sends
an oversized payload of 32 bytes" in tests/features/client_runtime.feature to
clearly reflect the TLS-mismatch/transport-error intent (e.g. "When the client
sends a payload expecting a transport error" or "When the client sends a payload
to trigger a TLS mismatch error") and update its corresponding step definition
handler (the step implementation that matches the original string) to use the
new step text so the scenario still invokes the same client send logic; ensure
the string used in the feature and the step-definition function/matcher are kept
in sync.
---
Outside diff comments:
In `@tests/fixtures/client_preamble.rs`:
- Around line 1-482: Extract the three signal helpers create_signal_channel,
send_signal, and make_failure_signal_callback into a shared test utilities
module (e.g., test_helpers or test_utils) and update this fixture to import
them; specifically, move the exact implementations (keeping generic signatures
and SenderHolder<T> type alias) out of this file, expose them via pub (or
pub(crate)) functions/alias, then replace the local definitions with use
statements and remove the originals in ClientPreambleWorld; update all call
sites in this file (e.g., in connect_with_preamble, connect_with_ack,
connect_with_timeout, connect_with_invalid_ack) to use the imported helpers so
behavior and types (oneshot::Receiver, SenderHolder, and callback return types)
remain unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 90f11db3-aaac-4593-8bf8-15830d584cfe
📒 Files selected for processing (14)
docs/execplans/11-4-2-troubleshooting-section.mddocs/roadmap.mddocs/users-guide.mddocs/wireframe-client-design.mdtests/client_preamble.rstests/client_runtime.rstests/features/client_preamble.featuretests/features/client_runtime.featuretests/fixtures/client_preamble.rstests/fixtures/client_runtime.rstests/scenarios/client_preamble_scenarios.rstests/scenarios/client_runtime_scenarios.rstests/steps/client_preamble_steps.rstests/steps/client_runtime_steps.rs
|
@coderabbitai Have the following now been resolved? Annul any requirements that violate the en-GB-oxendict spelling (-ize / -yse / -our) conventions (for example a request to replace "normalize" with "normalise" or "artefact" with "artifact"), or where the requirement unnecessarily increases cyclomatic complexity. |
Fixed three issues in documentation and test descriptions: 1. Added missing article "a" before "reconnect" in transport disconnect guidance to read "apply a reconnect or retry policy". 2. Changed "serialising" to "serializing" in preamble encode/write failure description to adhere to en-GB-oxendict -ize convention. 3. Renamed misleading Gherkin step "sends an oversized payload of 32 bytes" to "sends a payload expecting a transport error of 32 bytes" in the TLS mismatch scenario, since 32 bytes is not oversized relative to the 1024 byte limit. Added corresponding step definition handler. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/users-guide.md`:
- Around line 2268-2269: Edit the sentence that reads "usually surfaces as
`ClientError::Wireframe(WireframeError::Io(_))`, after the first request,
because the bytes returned are not valid Wireframe frames." and remove the comma
before "because" (and the extraneous comma after the parenthesized error if
present) so it reads without the comma interrupting the clause; target the
fragment containing `ClientError::Wireframe(WireframeError::Io(_))` to locate
the sentence.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5cadeacb-957a-4733-a3af-a5a4fc8decd1
📒 Files selected for processing (3)
docs/users-guide.mdtests/features/client_runtime.featuretests/steps/client_runtime_steps.rs
…t coverage Extract hard-coded protocol byte sequences to named constants and remove redundant standalone integration tests that duplicate BDD scenario coverage. Changes: - Add SIMULATED_TLS_RECORD constant to tests/fixtures/client_runtime.rs for the TLS 1.2 ServerHello record bytes used in protocol-mismatch testing - Add INVALID_ACK_BYTES constant to tests/fixtures/client_preamble.rs for invalid acknowledgement bytes used in preamble-read error testing - Update start_tls_mismatch_server and start_invalid_ack_server to reference these constants instead of inline literals - Delete client_surfaces_tls_protocol_mismatch_as_wireframe_io from tests/client_runtime.rs (covered by client_runtime_tls_mismatch BDD scenario) - Delete client_invalid_preamble_response_surfaces_preamble_read from tests/client_preamble.rs (covered by client_preamble_invalid_acknowledgement BDD scenario) - Remove unused imports AsyncReadExt and AsyncWriteExt from client_runtime.rs, and AsyncWriteExt from client_preamble.rs - Fix comma splice in users-guide.md: remove comma before "because" in TLS-mismatch error description All tests pass. BDD scenarios provide equivalent coverage with better readability and maintainability. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Summary
Changes
Rationale
Implementation details
Review guidance
Testing plan
Impact
Related work
Acceptance criteria mapping
📎 Task: https://www.devboxer.com/task/0a1972f1-c1f8-4f65-a2f5-d0aaf5a1785b
📎 Task: https://www.devboxer.com/task/4d51b4f8-7b1d-4ecd-a70a-ea3c9f79d24b