Skip to content

Conversation

@alvarowolfx
Copy link
Collaborator

The TokenProviderWithRetry struct was not implementing RefUnwindSafe because it held Arc<dyn RetryPolicy> and Arc<dyn BackoffPolicy>, which are trait objects that do not automatically implement RefUnwindSafe.

When TokenProviderWithRetry was embedded into other public structs (like IDTokenCredentials), those structs also lost their RefUnwindSafe implementation. This caused a semantic versioning check failure as RefUnwindSafe is part of the public API promise.

Towards #3592

@alvarowolfx alvarowolfx requested a review from coryan January 29, 2026 17:42
@alvarowolfx alvarowolfx requested review from a team as code owners January 29, 2026 17:42
@alvarowolfx
Copy link
Collaborator Author

unblocks #4260, #4257 and #4256

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 95.45455% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 95.04%. Comparing base (90873cc) to head (fe2f63c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/auth/src/retry.rs 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4447      +/-   ##
==========================================
- Coverage   95.04%   95.04%   -0.01%     
==========================================
  Files         194      194              
  Lines        7372     7384      +12     
==========================================
+ Hits         7007     7018      +11     
- Misses        365      366       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#[derive(Debug)]
struct UnwindSafeAdapter<T>(T);

impl<T> RefUnwindSafe for UnwindSafeAdapter<T> {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we are going to do this, I propose we simply implement the trait for TokenProviderWithRetry (or the builder for it).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's an option too. I did this because only retry_policy and backoff_policy are not UnwindSafe, but you're right, in the end we are adding a impl RefUnwindSafe thing anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmm, weird. I had to add both RefUnwindSafe and UnwindSafe explicitly to make it work:

impl RefUnwindSafe for Builder {}
impl UnwindSafe for Builder {}

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.

2 participants