G
YouTube TikTok Games
Skip to content

fix(sdk): unify connection string options across TCP, QUIC and WebSocket - #4872

Open
SteveParadox wants to merge 21 commits into
apache:masterfrom
SteveParadox:fix/4210-unified-connection-options-pr
Open

SteveParadox wants to merge 21 commits into
apache:masterfrom
SteveParadox:fix/4210-unified-connection-options-pr

Conversation

@SteveParadox

@SteveParadox SteveParadox commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Closes #4210

Rationale

TCP, QUIC and WebSocket connection strings use inconsistent option names and certificate-validation behavior, standardizing these options improves configuration consistency while preserving compatibility with existing connection strings.

What changed?

TCP, QUIC and WebSocket previously used inconsistent reconnection and TLS option names, with incomplete validation and propagation of some settings into client configurations.

The parsers now support standardized option names while retaining deprecated aliases with warnings, duplicate options follow last-occurrence precedence, malformed values are rejected and existing transport-specific TLS defaults are preserved. Client configuration propagation, TLS connection behavior and the documented connection-string options have also been updated and covered by regression tests.

Local Execution

Passed:

  • cargo test -p iggy_common --lib — 545 passed, 0 failed.
  • TCP connection-string regression tests — 8 passed.
  • QUIC connection-string regression tests — 10 passed.
  • WebSocket connection-string regression tests — 4 passed.
  • TCP, QUIC, and WebSocket deprecation-warning integration tests — 3 passed.
  • Targeted SDK TLS and configuration-validation tests — 5 passed.
  • git diff --check upstream/master...HEAD — passed.
  • cargo test -p iggy_common --tests — passed.
  • cargo test -p iggy --lib — 770 passed.
  • cargo test -p iggy_common --tests — passed.

AI Usage

1. Which tools?

ChatGPT, Codex

2. Scope of usage?

Assistance with test strategy, regression verification commands, analysis of test results and preparation of the PR description.

Any AI-assisted generation or modification of implementation code must also be disclosed here before submission.

3. How did you verify the generated code works correctly?

Executed the targeted TCP, QUIC and WebSocket regression tests, deprecated-option warning tests and SDK TLS tests locally. The complete iggy_common library suite passed all 545 tests, additional SDK.

4. Can you explain every line of the code if asked?

I will be prepared to explain the parsing changes, deprecated aliases, precedence rules, configuration propagation, TLS behavior and regression tests.

Security consideration: TCP TLS certificate validation

Previously, TCP connections enforced certificate validation unconditionally.

This implementation introduces configurable tls_validate_certificate behavior as requested in #4210.

  • Certificate validation remains enabled by default (true).
  • Explicitly setting tls_validate_certificate=false disables certificate verification.
  • This is a security-sensitive behavioral change because it allows connections without server certificate verification.
  • Disabling certificate verification should only be considered for controlled testing environments.

Maintainer review and explicit approval are requested for this behavior before merging.

Error handling compatibility

Invalid retry-count values in the updated Rust connection-string parsers now return InvalidConnectionString instead of the previous InvalidNumberValue error, including for QUIC.

This is an intentional error-classification change associated with the connection-string validation updates in #4210.

Go and Swift currently keeps the previous error behavior, Cross-SDK error compatibility will be tracked in a separate follow-up issue.

Consumers matching specific error variants should be aware of this behavioral change.

@github-actions

Copy link
Copy Markdown

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

If AI assistance was used to create this PR, you are required to run the team-review skill before opening it.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer
  • /pin - exempt the PR from the stale bot, /unpin to undo

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Nov 12, 2026

@krishvishal krishvishal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the PR body doesn't mention that TCP can now skip cert checks or the new retry error, and other SDKs reject the new keys.
Also c2e791a has a Codex co-author, please name it under AI Usage.

tls_ca_file: connection_string.options().tls_ca_file().to_owned(),
// Require certificate verification, including when trusting a private CA.
tls_validate_certificate: true,
tls_validate_certificate: connection_string.options().tls_validate_certificate(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old code forced true here on purpose (see the removed comment), and now a TCP connection string can turn cert checks off.
I get that #4210 asks for the key, but please call this out in the PR body so a maintainer can sign off on it.

),
};
}
"reconnection_retries" => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go, .NET, Node and Swift reject reconnection_max_retries and tls_validate_certificate as unknown keys, so following this warning breaks the same string there.
Please add the keys to those parsers, or open a follow-up issue and link it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting the cross-SDK compatibility issue, I’ve opened a dedicated follow-up issue to track support for the standardized connection-string options across Go, .NET, Node.js and Swift.

I’ll link it in the PR description as well, so i can keep #4210 focused on the current Rust implementation.

value => Some(
value
.parse()
.map_err(|_| IggyError::InvalidConnectionString)?,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bad retry count now returns InvalidConnectionString instead of InvalidNumberValue (QUIC too), while Go and Swift still return the old one.
Please mention it in the PR body and cover Go/Swift in the follow-up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have explicitly documented the change from InvalidNumberValue to InvalidConnectionString, including its impact on QUIC, in the PR description.

I also include Go and Swift error compatibility and corresponding regression tests in the cross-SDK follow-up issue.

}

#[test]
fn connection_string_hosts_preserve_the_existing_explicit_server_name_contract() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Connection strings still pin QUIC server_name to localhost, so tls_validate_certificate=true can't work against a real remote host.
That's older than this PR and fine as a follow-up, but I'd drop this test instead of locking it in.

Comment thread core/sdk/src/clients/client.rs Outdated
/// "iggy+ws://user:secret@localhost:8092?reconnection_max_retries=5&reestablish_after=500ms&tls_validate_certificate=true&tls=true&tls_domain=localhost",
/// )?
/// .build()?;
/// let legacy_client = IggyClient::builder_from_connection_string(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legacy_client teaches the deprecated key with cert checks off, and the example lost most of the options the old one had.
Can you drop legacy_client and bring back the full example with the new keys?

Comment thread foreign/cpp/include/iggy.hpp Outdated
*
* Durations use Iggy duration syntax, such as `500ms`, `5s`, or `1min`.
* Boolean values are `true` or `false`.
* Certificate validation accepts exactly `true` or `false`. Disabling it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the "Boolean values are true or false" line got dropped, and now only cert validation is described as strict, though tls is strict too.
Please bring that line back and mention tls.

}
"tls" => {
tls_enabled = option_parts[1] == "true";
tls_enabled = option_parts[1]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Swift notes are stale now that tls is strict: foreign/swift/README.md:125 and ConnectionString.swift:40,202 say Rust reads non-true as false.
Please update them in this PR.

* - `tls_ca_file=<path>`
* - `reconnection_retries=<uint32|unlimited>`
* - `tls_validate_certificate=<bool>` (default `true`)
* - `reconnection_max_retries=<uint32|unlimited>` (`reconnection_retries` is deprecated)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Python and PHP bindings don't install a tracing subscriber, so their users never see these deprecation warnings.
Could the Python and PHP connection string docs list the deprecated keys like this header does?

.map_err(|_| IggyError::InvalidConnectionString)?;
}
"nodelay" => {
nodelay = option_parts[1] == "true";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodelay still does == "true", so nodelay=1 quietly means false while the other SDKs reject it (same for accept_unmasked_frames).
Pre-existing and not blocking, but with tls strict now, parse::<bool>() here would match.

reestablish_after = IggyDuration::from_str(option_parts[1])
.map_err(|_| IggyError::InvalidConnectionString)?;
}
"reconnection_reestablish_after" => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few callers still use deprecated keys and will log warnings on every run: client_lifecycle.rs:137 (this one), postgres_source.rs:198,319, tcp_client.rs:1597, test_client_config.py:469.
Please switch them to the new keys.

@krishvishal

Copy link
Copy Markdown
Member

/author

@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Nov 12, 2026
Match the QUIC and WebSocket warning format and update the TCP test.
@SteveParadox
SteveParadox force-pushed the fix/4210-unified-connection-options-pr branch from 6af630f to e9e206f Compare November 13, 2026 06:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author PR is waiting on author response

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the same connection string key for the same option on every transport

2 participants