Address code-base audit findings - #534
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideIntroduces a detailed ExecPlan Markdown document that defines the non-code execution plan, constraints, risks, milestones, validation gates, and follow-up issue handling for addressing the 2026-06-05 code-base audit findings, without implementing any of the refactors yet. Flow diagram for ExecPlan approval gate and milestone loopflowchart TD
A[Draft ExecPlan created] --> B[Plan review]
B --> C{ExecPlan approved?}
C -- No --> B
C -- Yes --> D[Select next milestone]
D --> E[Implement milestone changes]
E --> F[Run make check-fmt]
F --> G[Run make lint]
G --> H[Run make test]
H --> I[Run coderabbit review --agent]
I --> J{All gates and CodeRabbit clear?}
J -- No --> E
J -- Yes --> K[git commit -F ...]
K --> L{More milestones?}
L -- Yes --> D
L -- No --> M[Run final gates and update draft PR]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Describe the gated implementation path for the audit refactors, including validation, CodeRabbit review, follow-up issue handling, and the explicit approval gate before code changes.
Extract the shared serialize, request-hook, framed-send, timing, and error-hook flow into a private client helper. Keep correlation handling in `send_envelope` and `call_streaming` while routing the repeated transport pipeline through one path. Record the milestone validation and review result in the ExecPlan.
Extract shared app outbound encoding and move response send helpers out of the inbound handler. Route codec-driver sends through the shared helper while preserving the raw length-delimited response path. Delegate inbound deserialization failure policy to `DeserFailureTracker` and split dispatchable envelope construction out of `handle_frame`, keeping the counter reset after the full inbound pipeline succeeds. Add focused response and outbound encoding tests with clearer assertion helpers, document the new helper boundaries, and record the zero-copy serializer deferral in ADR 005 and the ExecPlan.
Add a dedicated `WireframeApp` connection-state rebuild helper and use it from `on_connection_setup` instead of manually reconstructing every app field. Document and test the ordering rule: setup changes the connection state type, so teardown registered for the prior state is cleared and teardown must be registered after setup when both hooks are required.
Centralize pool lock poison recovery behind a documented helper, route client builder connect paths through into_parts, and replace the pooled lease dispatch macro with an async helper. The pool recovery path now emits a warning and metric, with tests covering normal and poisoned lock recovery plus observability side effects. The developer guide and ExecPlan document the reusable pool patterns and validation history.
Add wireframe_testing to the explicit workspace members while keeping the root package as the only default member. Update the workspace manifest integration and BDD tests to assert the helper crate membership, and refresh the developer guide command guidance for root, workspace, verification, and testing-crate workflows.
Move common TCP example runtime setup into examples/support/runtime_bootstrap.rs so ping_pong and packet_enum share tracing, listener, serve-loop, and runtime startup code. Move codec benchmark helper modules into wireframe_testing::codec_benchmarks and update benches, unit tests, and BDD fixtures to import them through the helper crate instead of path-coupling to tests/common.
Split the shared fragment transport test helper into focused modules for app setup, assertions, configuration, envelope construction, errors, and framed transport while preserving the existing facade import surface. Document the helper layout in the developer guide and keep the execplan updated with validation and CodeRabbit review outcomes.
Mark the code-base audit execution plan complete after all implementation milestones, validation gates, CodeRabbit reviews, and branch pushes have succeeded.
Reapply the helper crate package-id import and test annotation after rebasing onto origin/main. This keeps the direct workspace manifest regression aligned with the BDD fixture and preserves the existing lint policy for assertion-heavy integration tests.
60ef8e7 to
49ba698
Compare
Remove duplicate blank lines so the developer guide passes markdownlint after the rebase.
|
@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/response.rs: contains 5 functions with similar structure: send_response_framed_propagates_io_error,send_response_framed_propagates_serialization_error,send_response_framed_with_codec_propagates_frame_encoding_error,send_response_framed_with_codec_propagates_serialization_error and 1 more functions tests/lifecycle.rs: contains 2 functions with similar structure: setup_without_teardown_runs,teardown_without_setup_does_not_run tests/fixtures/workspace_manifest.rs: contains 2 functions with similar structure: WorkspaceManifestWorld.verify_helper_crate_is_workspace_member,WorkspaceManifestWorld.verify_verification_crate_is_workspace_member 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.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
cat tests/response.rs
echo "=== LIFECYCLE ==="
cat tests/lifecycle.rsLength of output: 23990 Files and symbols:
After reading the current code, further extraction is deleterious for both findings. Use the suppression messages below. Suppression messages
|
There was a problem hiding this comment.
Sorry @leynos, your pull request is larger than the review limit of 150000 diff characters
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai resume |
✅ Action performedReviews resumed. |
Move response send error-path fixtures and cases into a dedicated module so the main response integration test file stays below the 400-line project constraint. Record the follow-up review decision in the audit execplan.
|
@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/response/response_errors.rs Comment on lines +214 to +225 async fn send_response_framed_with_codec_propagates_serialization_error() {
let app = basic_app().expect("failed to create app");
let (client, _server) = tokio::io::duplex(1024);
let mut framed = Framed::new(client, app.length_codec());
let err = app
.send_response_framed_with_codec(&mut framed, &FailingResp)
.await
.expect_err("framed send should fail before transport");
assert_serialize_error(&err);
}❌ New issue: Code Duplication |
This comment was marked as resolved.
This comment was marked as resolved.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Implements the 2026-06-05 code-base audit refactor plan across the client send path, app outbound encoding, builder transitions, inbound decode/pipeline handling, client pool internals, workspace membership, example/benchmark support, and fragment test helpers.
ExecPlan: docs/execplans/code-base-audit-2026-06-05.md
Review walkthrough
Validation
make check-fmt: passed on the final implementation gate.make lint: passed on the final implementation gate.make test: passed on the final implementation gate.make markdownlint: passed after the final ExecPlan close-out update.coderabbit review --agent: completed with zero findings on the final Milestone 7 rerun.Notes
This pull request remains draft for reviewer triage, but the requested implementation work in the ExecPlan is complete and pushed.