Test modules run several times the size CONTRIBUTING allows, with the harness copied per test
Nobody has claimed this yet.
- #305 by @rpb-ant — closed without merging
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 48/100
Research direction
Start with conformance/src/bin/client.rs and compare the configuration prologues in do_unary_call, do_server_stream_call, do_client_stream_call, and do_bidi_stream_call. Run the conformance cases before and after the first independently landable change. Done means the duplicated setup is consolidated without changing behavior, with the conformance suite still passing.
Written by the indexing model from the issue text.
Description
Summary
CONTRIBUTING says test modules beyond roughly 500 lines should be split into focused sub-modules. Nine files exceed that; three exceed it fourfold. There is also no shared test-support crate, so the same server spin-up and tear-down is written out dozens of times.
| File | Test-module lines |
|---|---|
connectrpc/src/client/mod.rs |
3,329 |
connectrpc-codegen/src/codegen.rs |
2,419 |
connectrpc/src/server.rs |
2,198 |
tests/streaming/src/lib.rs |
2,002 |
connectrpc/src/service.rs |
2,020 |
connectrpc/src/interceptor.rs |
1,079 |
connectrpc/src/compression.rs |
992 |
connectrpc/src/response.rs |
699 |
connectrpc-build/src/lib.rs |
694 |
The duplication, ranked by what it risks
1. The conformance client's configuration prologue, four times, byte-identical. In conformance/src/bin/client.rs, each of do_unary_call, do_server_stream_call, do_client_stream_call and do_bidi_stream_call opens with the same ~45 lines building the base URI, the ClientConfig, and the CallOptions from the runner's request. This is the one that matters most, because the code is semantically load-bearing: it translates the conformance runner's ClientCompatRequest into client configuration, so a fix applied to one arm and not the other three silently changes which conformance tests pass. The only real variation is the compression registry, and both variants already carry comments explaining why they differ.
2. server.rs's lifecycle boilerplate. The spawn-with-graceful-shutdown prologue appears 22 times and its tear-down epilogue 24 times. Two tests are 39 and 35 lines that differ only in one builder call and one assertion, duplicated five-line comment included. The file already has a small helper block, so the instinct is there; it just stopped short of the lifecycle. Separately, eight tests bind a real TCP socket purely to assert on a BoundServer config field they never serve on.
3. benches/rpc's load drivers. echo_bench.rs, log_bench.rs and fortune_bench.rs each re-implement ServerProcess with its Drop, a build_*_server function differing only in a binary name, a BenchResult struct, and a ~100-line closed-loop driver. It has already drifted — one copy of the driver silently dropped its explanatory comment and diverged on a sampling constant. All of this runs in the load-generator process, out of band from the server being measured, so factoring it cannot perturb a number.
Split axes
These follow how the tests already cluster, and match the structure of the production half of each file:
server.rs— by configuration surface: builder-config assertions, graceful shutdown, header-read timeout, HTTP/2 knobs, connection lifecycle (age/idle/count), TLS peer identity, shared helpers.client/mod.rs— by protocol then concern: bidi lifecycle, Connect stream decoding, gRPC/gRPC-Web decoding, transport-error propagation, client-streaming send/drop, timeout formatting, header construction, body helpers, config merge. The timeout-format and body-helper clusters are pure-function tests with no client involved and could move next to what they test.codegen.rs— by codegen feature: fixtures, view/alias emission, file-per-package, type-path resolution, keyword escaping, client-feature gating,encodable_impls, whole-output invariants. The plugin-option tests are currently scattered across seven separate places; collecting those alone is the cheapest useful move.tests/streaming— the cleanest one. It is the workspace's designated end-to-end consumer ofconnectrpc-build, it has notests/directory, and 36 tests plus the service impls sit insrc/lib.rs. Promoting the shared harness into apub mod testingand moving the tests totests/also gets process-level parallelism for free.
Deliberately excluded
The example crates' start_server helpers should stay duplicated. Each is eight to fourteen lines and each differs in exactly the thing its crate exists to demonstrate. A shared helper covering all six would have to be generic over the client type, the registration call and the layer stack, and would hide the API being demonstrated to save 60–80 lines.
The bench server binaries should also stay separate. log_server and log_server_noutf8 differ in their handler bodies precisely where the measurement is, and sharing a handler behind a trait would put a call boundary in the measured path.
The conformance runner's flat one-function-per-RPC-kind shape is correct and should be kept — a conformance driver's job is to be readable against the spec. The fix there is the duplicated prologue, not the shape.
Suggested order
Each of these is independently landable under the 250-line-net guideline: the conformance prologue first (guarded by 6,800 conformance cases), then the bench harness, then a TestServer helper in server.rs, then the module splits one file at a time.
- Dominant language
- Rust
- Stars
- 544
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from connectrpc/connect-rust
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
connectrpc/connect-rust#360 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
connectrpc/connect-rust#358 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 53/100
connectrpc/connect-rust#355 ·
-
Streaming request body errors are always reported as `internal`Possibly taken @AhmedElBanna80 claimed this 18 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
connectrpc/connect-rust#352 ·
-
Difficulty 3/5 Half a day Newbie friendliness 48/100
connectrpc/connect-rust#349 ·
All issues in connectrpc/connect-rust
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Choochmeque/tauri-plugin-webdriver#134 ·
Maintainers usually reply within 17 days
-
bug rust SDK & CLI & REST API
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
boxlite-ai/boxlite#3292 ·
Maintainers usually reply within 1 day
-
Android bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anefzaoui/misterdownloadmanager#2516 ·
Maintainers usually reply within 1 day
-
editor ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
state:triage tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 89/100
agent8-cash/ethpayserver#731 ·
Maintainers usually reply within 1 day