Skip to content

Fix dangerous config method typo#456

Merged
durch merged 2 commits intomasterfrom
fix/issue-433-dangerous-config-typo
May 4, 2026
Merged

Fix dangerous config method typo#456
durch merged 2 commits intomasterfrom
fix/issue-433-dangerous-config-typo

Conversation

@durch
Copy link
Copy Markdown
Owner

@durch durch commented May 4, 2026

Linked issue

Fixes #433

Problem

Bucket exposes set_dangereous_config, with "dangerous" misspelled in the public API and docs. Removing or renaming the existing method outright would break users on the 0.37.x line.

Solution

  • Added the correctly spelled Bucket::set_dangerous_config(...) with the existing behavior.
  • Kept Bucket::set_dangereous_config(...) as a deprecated forwarding wrapper for semver-compatible source compatibility.
  • Updated the public doc example and the existing dangerous-config test call site to prefer the correct spelling.
  • Added a focused unit test proving the corrected method and deprecated alias set the same client options.

Focused verification

  • cargo test -p rust-s3 dangerous_config_correct_spelling_and_compat_alias_set_same_options --features tokio-native-tls — passed: 1 passed, 0 failed.
  • cargo test -p rust-s3 --doc set_dangerous_config --features tokio-native-tls — passed: 1 doctest passed, 0 failed.
  • cargo check -p rust-s3 --no-default-features --features tokio-rustls-tls — passed.
  • git diff --check — passed.

Risk notes

Low risk: the existing implementation was moved to the correctly spelled method, and the misspelled method now forwards to it. This preserves existing callers while guiding new callers to the corrected API via deprecation.

Provider/runtime cordons

  • Change is limited to the Tokio TLS-gated dangerous client configuration path already used by this API.
  • No signing, credential resolution, URL construction, streaming/multipart, XML parsing, sync generated APIs, or provider-specific behavior changed.
  • Verified both Tokio native-tls and Tokio rustls feature paths compile/test in focused checks above.

This change is Reviewable

Summary by CodeRabbit

  • New Features

    • Added a corrected API to configure the HTTP client's SSL certificate and hostname validation behavior (optionally accept invalid certs/hostnames when enabled).
  • Deprecations

    • The previous misspelled API name is deprecated and now forwards to the corrected API; migrate to the corrected name.
  • Tests

    • Added a unit test verifying both APIs yield identical client validation settings.
    • Updated ETag tests to use unique temporary file paths per run.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4de87826-f154-4e69-9475-b9395472ec43

📥 Commits

Reviewing files that changed from the base of the PR and between 6e94d56 and dc67eab.

📒 Files selected for processing (1)
  • s3/src/utils/mod.rs
✅ Files skipped from review due to trivial changes (1)
  • s3/src/utils/mod.rs

📝 Walkthrough

Walkthrough

Added correctly spelled Bucket::set_dangerous_config (cfg-gated for tokio-native-tls / tokio-rustls-tls) to update HTTP client options for accepting invalid certs/hostnames. Kept a deprecated set_dangereous_config alias forwarding to the new method. Tests updated and a unit test verifies both produce identical options.

Changes

Typo Fix with Backward Compatibility

Layer / File(s) Summary
Data Shape / Options
s3/src/bucket.rs
client_options flags accept_invalid_certs and accept_invalid_hostnames are read and updated when reconfiguring the Bucket.
Core Implementation
s3/src/bucket.rs
Added pub fn set_dangerous_config(&self, accept_invalid_certs: bool, accept_invalid_hostnames: bool) -> Result<Bucket, S3Error> (cfg-gated) that clones and updates client_options and rebuilds the HTTP client.
Backward Compatibility
s3/src/bucket.rs
Added deprecated set_dangereous_config (same cfg gate) which forwards to set_dangerous_config.
Tests / Call Sites
s3/src/bucket.rs, s3/src/utils/mod.rs
Updated an ignored integration-style test to call set_dangerous_config; added unit test dangerous_config_correct_spelling_and_compat_alias_set_same_options asserting both methods yield identical client_options. Replaced fixed ETag test file paths with a temp-path helper (etag_test_path) and updated two ETag tests to use unique temp files.
Manifest
Cargo.toml
Present in diff metadata; no functional manifest change.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I nibbled at a spelling trail tonight,
I fixed the name but kept the old one light.
Two paths converge where SSL flags align,
A tiny hop — the options now combine. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Fix dangerous config method typo' directly and clearly summarizes the main change—correcting the misspelled method name from set_dangereous_config to set_dangerous_config.
Linked Issues check ✅ Passed The PR fully addresses issue #433 by adding the correctly spelled set_dangerous_config method, maintaining set_dangereous_config as a deprecated alias, updating tests and documentation to use the corrected spelling, and ensuring source compatibility on the 0.37.x line.
Out of Scope Changes check ✅ Passed Changes are scoped to fixing the typo in bucket.rs (adding corrected method and deprecating the misspelled one) and updating related test code in utils/mod.rs. Test file path improvements are minimal and directly related to supporting test stability for the dangerous-config tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-433-dangerous-config-typo

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@brownian-motion-v0
Copy link
Copy Markdown

Brownian Motion (Brass)

Recommendation: Proceed

Summary: Fixes a typo in the public API while maintaining backward compatibility.
Risk: Low · Confidence: 90%

Highlights

  • Good test coverage
  • Clear commit history

Next actions

  • Keep: The deprecated method for backward compatibility.
  • Drop: Any unnecessary comments or code that doesn't contribute to clarity.
  • Add: Documentation updates reflecting the change.

Reflection questions

  • What core assumption underpins this PR's approach?
  • How does this change align with the project's longer-term goals?
  • Could there be a simpler way to achieve the primary objective here?

@durch durch force-pushed the fix/issue-433-dangerous-config-typo branch from 1a09427 to e1d573c Compare May 4, 2026 20:47
@brownian-motion-v0
Copy link
Copy Markdown

Brownian Motion (Brass)

Recommendation: Proceed

Summary: PR effectively corrects a typo while maintaining backward compatibility.
Risk: Low · Confidence: 90%

Highlights

  • Good test coverage
  • Clear commit history

Next actions

  • Keep: the deprecation wrapper for backward compatibility
  • Drop: any unnecessary complexity in future changes
  • Add: documentation updates to reflect the change

Reflection questions

  • What core assumption underpins this PR's approach?
  • How does this change align with the project's longer-term goals?
  • Could there be a simpler way to achieve the primary objective here?

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
s3/src/bucket.rs (1)

812-825: 💤 Low value

Doctest exercises compilation but not runtime — consider fn main() pattern for full coverage.

The current # fn example() -> Result<(), S3Error> { … # } wrapper, without a corresponding fn main(), causes rustdoc to emit an implicit fn main() that defines but never calls example. The doctest therefore only validates that the code compiles with the ? operator; the client(&options) call inside set_dangerous_config is never actually executed.

If runtime verification is important (e.g., confirming reqwest accepts the TLS configuration without panicking), replace the hidden function wrapper with a fn main()-style pattern:

🔧 Optional: switch to an actually-executed doctest
-/// # fn example() -> Result<(), S3Error> {
-/// let bucket = Bucket::new("my-bucket", Region::from_str("us-east-1")?, Credentials::default()?)?
-///     .set_dangerous_config(true, true)?;
-/// # Ok(())
-/// # }
+/// # fn main() -> Result<(), S3Error> {
+/// let bucket = Bucket::new("my-bucket", Region::from_str("us-east-1")?, Credentials::anonymous()?)?
+///     .set_dangerous_config(true, true)?;
+/// # Ok(())
+/// # }

Switching to Credentials::anonymous() also removes the dependency on a live credential chain, making the doctest self-contained.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@s3/src/bucket.rs` around lines 812 - 825, The doctest currently uses a hidden
helper function so it only compiles but never runs the code path that calls
client(&options) inside Bucket::set_dangerous_config; change the example to an
actual executable doctest (use fn main() rather than the hidden fn example()) so
the runtime is exercised, and make the example self-contained by using
Credentials::anonymous() (or another non-network credential) with
Bucket::new(...) and then calling .set_dangerous_config(true, true)? to ensure
the TLS/client configuration path runs during the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@s3/src/bucket.rs`:
- Around line 812-825: The doctest currently uses a hidden helper function so it
only compiles but never runs the code path that calls client(&options) inside
Bucket::set_dangerous_config; change the example to an actual executable doctest
(use fn main() rather than the hidden fn example()) so the runtime is exercised,
and make the example self-contained by using Credentials::anonymous() (or
another non-network credential) with Bucket::new(...) and then calling
.set_dangerous_config(true, true)? to ensure the TLS/client configuration path
runs during the test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0f10b00-23dd-4961-8d3f-e0b0ab825dfd

📥 Commits

Reviewing files that changed from the base of the PR and between 1a09427 and e1d573c.

📒 Files selected for processing (1)
  • s3/src/bucket.rs

@durch durch force-pushed the fix/issue-433-dangerous-config-typo branch from e1d573c to 6e94d56 Compare May 4, 2026 20:57
@brownian-motion-v0
Copy link
Copy Markdown

Brownian Motion (Brass)

Recommendation: Proceed

Summary: Fixes a typo in the public API without breaking existing functionality.
Risk: Low · Confidence: 90%

Highlights

  • Good test coverage
  • Clear commit history

Next actions

  • Keep: The deprecated alias for backward compatibility.
  • Drop: No unnecessary complexity present.
  • Add: Documentation updates to reflect the change.

Reflection questions

  • What core assumption underpins this PR's approach?
  • How does this change align with the project's longer-term goals?
  • Could there be a simpler way to achieve the primary objective here?

@brownian-motion-v0
Copy link
Copy Markdown

Brownian Motion (Brass)

Recommendation: Proceed

Summary: Fixes a typo in the public API while maintaining backward compatibility.
Risk: Low · Confidence: 90%

Highlights

  • Good test coverage
  • Clear commit history

Next actions

  • Keep: The deprecated method for backward compatibility.
  • Drop: Any unnecessary complexity in future changes.
  • Add: Documentation updates to reflect the change.

Reflection questions

  • What core assumption underpins this PR's approach?
  • How does this change align with the project's longer-term goals?
  • Could there be a simpler way to achieve the primary objective here?

@durch
Copy link
Copy Markdown
Owner Author

durch commented May 4, 2026

Thanks for the compatibility-preserving API cleanup. This adds the correctly spelled set_dangerous_config while keeping the misspelled set_dangereous_config as a deprecated forwarding wrapper, so existing callers continue to compile.

During CI follow-up, this PR also picked up a small test-only stability fix: the ETag tests now use unique temp paths instead of sharing test_etag, which removed an intermittent parallel-test race seen in CI.

Verification before merge:

  • focused dangerous-config test passed locally
  • tokio-nossl-test-not-ignored, the target that exposed the ETag race, passed locally
  • ETag tests passed 30 repeated local runs under the CI feature set
  • refreshed GitHub checks are green
  • reviewed under triage rules: PASS; public API change is source-compatible because the old spelling remains as a deprecated alias

Merging this as the fix for #433.

@durch durch merged commit b584ce7 into master May 4, 2026
6 checks passed
@durch durch deleted the fix/issue-433-dangerous-config-typo branch May 4, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typo in "dangerous" (see Bucket::set_dangereous_config)

1 participant