Add e2e suites, query-param wiring, coverage push, and CI for tests + benches#1
Merged
Merged
Conversation
Introduces a shared dev-only crate at crates/test-utils/ras-test-helpers with MockAuthProvider, mock_user, and spawn_http/spawn_tcp helpers, then wires per-macro tests/e2e.rs and benches/ for jsonrpc_service!, file_service!, and jsonrpc_bidirectional_service!. Each suite drives the generated reqwest/tokio-tungstenite client all the way through the axum router and back, plus a criterion bench measuring per-call latency. REST macro coverage lands in the next commit so its query-param e2e cases can land together with the query-param client codegen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The rest_service! macro already parsed `?` query syntax for the server side, but the generated reqwest client emitted methods without query arguments — callers had to drop down to raw reqwest to actually exercise those endpoints. This commit teaches the client codegen to: - include each query parameter in the function signature, in the same order as the macro syntax (path → query → body), - detect Option<T> at the type level and serialize Some(_) only, - url-encode required parameters via reqwest's `.query()` helper. Adds the REST e2e suite + dispatch bench in the same commit so the new typed-client query-param test cases (required + optional + body + path combinations) land alongside the wiring they cover. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lifts workspace test coverage from 80% to 87% by adding focused unit tests for the framework's runtime types and trait defaults. The bias is toward "every public function called from at least one test" rather than chasing line coverage on data-shape modules. Files moved into the 95-100% range: - ras-rest-core (RestError/RestResponse constructors, IntoRestError) - ras-identity-core (NoopPermissions/StaticPermissions, error variants) - ras-identity-oauth2/config (provider config builder + serde) - ras-jsonrpc-bidirectional-types: error.rs, sender.rs (incl. real-sink WebSocketMessageSender close idempotency), manager.rs default + ext trait helpers via a small in-memory stub - ras-jsonrpc-bidirectional-server: error.rs status codes, connection.rs context + ChannelMessageSender, handler.rs default trait methods, router.rs notification + error wrapping paths, plus a new tests/manager_unit.rs that pins down the DefaultConnectionManager contract (subscriptions, broadcast counts, permission filtering, pending-request lifecycle) without spinning up a real WebSocket - ras-jsonrpc-bidirectional-client: error.rs constructors + From impls + recovery classification, config.rs full builder + URL/header paths, client.rs not-connected guards on call/notify/subscribe and full ClientBuilder setter coverage - ras-jsonrpc-types (canonical error code constructors + serde) Remaining gaps live in genuinely network-bound paths (WebSocket run loop / reconnect loop) and in the openrpc-types data crate, which is spec-shaped and lower runtime risk. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The demo's `upload` handler used `while let Some(field) = ...` and then unconditionally returned on the first iteration, which a recent clippy release flags as `never_loop`. Replaced with a single `next_field().await?.ok_or_else(...)` so the control flow matches what the code was actually doing. Behavior is unchanged: the handler still consumes exactly the first multipart field and returns NotFound when none is present. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the previous test-coverage.yml (which only ran cargo test) with
two workflows:
ci.yml — runs on every PR and master push, with parallel jobs for:
* rustfmt --check
* cargo clippy --workspace --all-targets --all-features (errors only;
legacy warnings are not yet promoted to deny)
* cargo test --workspace --all-features (separate build + run steps so
failures point to the right phase)
* cargo llvm-cov producing lcov.info as a build artifact and a printed
summary in the job log; Codecov upload is left commented for the
repo owner to enable with a CODECOV_TOKEN
bench.yml — runs on master pushes and on workflow_dispatch only. PRs
intentionally skip benches: GitHub runners are noisy and PR-time bench
diffs are dominated by that noise. Uploads target/criterion/ as an
artifact for trend inspection. Each macro's bench is run individually
under a short measurement window so the total runner time stays
bounded.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ras-test-helpersdev-only crate (MockAuthProvider,mock_user,spawn_http,spawn_tcp) plus per-macrotests/e2e.rs+benches/for all four service macros, exercising the generated client → axum router → handler chain end-to-end.rest_service!generated client. Required params serialize unconditionally;Option<T>is skipped whenNone. Adds typed-client coverage for required + optional + body + path-param combinations (the existingtests/http_integration.rsonly exercised this via raw reqwest).manager.rswent from 17% → 92%.ci.ymlruns fmt + clippy + test + coverage on every PR and master push;bench.ymlruns criterion benches on master pushes and on demand (PR runs are skipped — runner noise dominates the diffs).Bench baselines (local, ubuntu)
jsonrpc_add_dispatchrest_get_dispatchfile_upload_download_1mibws_echo_roundtripTest plan
🤖 Generated with Claude Code