Consistently reject illegal values in configuration setters
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- backend-api-design
Research direction
Start by locating the listed configuration setters and comparing them with the existing with_max_connection_age assertion. Review the DeadlinePolicy min/max behavior and axum integration equivalent, then ensure each constrained setter consistently rejects illegal values or documents its exception; leave with_max_connection_age_grace accepting zero.
Written by the indexing model from the issue text.
Description
Summary
Configuration setters across the crate are inconsistent about validating their arguments. Most accept any value silently; a few clamp at the point of use; and (after #165) BoundServer::with_max_connection_age / Server::with_max_connection_age now reject a zero Duration with a panic. We should make this consistent: setters that take a value with an illegal range should reject the illegal value the same way, rather than silently misbehaving in production.
Background
std::time::Duration is unsigned, so it can never be negative — the only out-of-range value for a duration is zero. So "validate" here means "reject zero where zero is illegal" (and any other type-specific illegal values for non-Duration config).
#165 added with_max_connection_age, where a zero duration would turn the server into a connection shredder (every connection retired the instant it starts serving). That setter now assert!s a non-zero duration. The other setters have not been brought into line.
Setters to review
Server::with_tls_handshake_timeout/BoundServer::with_tls_handshake_timeout/ the axum integration equivalent — a zero handshake timeout is pathological (every TLS handshake times out immediately); currently unguarded.DeadlinePolicy::with_default_timeout— zero likely illegal.DeadlinePolicy::with_inter_message_timeout— zero likely illegal.DeadlinePolicy::with_min/with_max— these already clamp at the point of use; decide whether to also reject obviously-illegal inputs (e.g.min > max) at set time, or leave the clamp.
Note: with_max_connection_age_grace intentionally accepts zero — a zero grace means "GOAWAY then close immediately, no drain window," which is a legitimate choice — so it should not be guarded.
Decision needed
Pick one rejection mechanism and apply it consistently:
- Panic (
assert!) at set time — fail-fast, keeps the chainable-> Selfbuilder shape. This is whatwith_max_connection_agenow does. - Clamp / treat-as-disabled at use — the pattern
DeadlinePolicyalready uses for min/max.
A Result-returning setter would break the chainable builder API, so it is probably not the right fit.
Acceptance
Each value-range-constrained config setter either rejects illegal input consistently (matching the chosen mechanism) or documents why it intentionally accepts the full range.
- 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