-
Notifications
You must be signed in to change notification settings - Fork 0
feat(tx_cache): surface auth token retrieval errors #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ENG-1798: Add BuilderTxCacheError enum to properly surface auth token retrieval failures instead of silently using an empty string. Changes: - Add BuilderTxCacheError with TokenRetrieval variant wrapping RecvError - Add TxCache variant wrapping existing TxCacheError - Replace unwrap_or_else with ? operator to propagate errors - Update local Result type alias to use BuilderTxCacheError This is a breaking change for consumers that expect the old Result type, but surfaces the actual error cause for better debugging.
Fraser999
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BuilderTxCacheError::TxCache(TxCacheError::Reqwest(err)) issue is a blocker I think.
| assert!(matches!( | ||
| bundles, | ||
| BuilderTxCacheError::TxCache(TxCacheError::NotOurSlot) | ||
| )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this matches the new behaviour, but the test is ignored, so not picked up in CI.
src/perms/tx_cache.rs
Outdated
| #[derive(Debug, Error)] | ||
| pub enum BuilderTxCacheError { | ||
| /// Failed to retrieve the authentication token. | ||
| #[error("failed to retrieve auth token: {0}")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't a "failed to retrieve" right? this error is permanent and persistent, and implies something has gone wrong with the background auth task resulting in the sender being dropped?
- Use TxCacheError::from(err) to properly map reqwest errors to appropriate variants (NotFound, NotOurSlot, or Reqwest) - Use core::result::Result for consistency - Improve TokenRetrieval error message to clarify it indicates the background auth task stopped
|
Addressed review feedback:
|
Fraser999
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to have the test issue resolved, but that's probably not a blocker, so approving to unblock the PR.

Summary
Surfaces auth token retrieval errors instead of silently using an empty string.
Changes
BuilderTxCacheErrorenum with:TokenRetrievalvariant wrappingwatch::error::RecvErrorTxCachevariant wrapping existingTxCacheErrorunwrap_or_elsewith?operator to propagate errorsResulttype alias to useBuilderTxCacheErrorBreaking Change
This changes the return type from
signet_tx_cache::error::Resultto a new localResulttype. Consumers will need to handle the newBuilderTxCacheErrortype.Why
Per the ticket: "Right now, an empty string is used if the token retrieval fails, placing the responsibility of returning an appropriate error on the service being called. We should wrap the original error type, and add a variant that points out that there was a problem retrieving the token instead, surfacing the inner Recv error."
Closes ENG-1798