zeroshade commented on code in PR #1477:
URL: https://github.com/apache/iceberg-go/pull/1477#discussion_r3616148026


##########
catalog/rest/vended_creds.go:
##########
@@ -108,14 +114,20 @@ func (v *vendedCredentialRefresher) loadFS(ctx 
context.Context) (iceio.IO, error
        }
        defer v.mu.Release(1)
 
-       if v.cachedIO != nil && !v.now().After(v.expiresAt) {
+       if v.cachedIO != nil && !v.expired() {
                return v.cachedIO, nil
        }
 
        var config iceberg.Properties
-       if v.cachedIO == nil {
+       switch {
+       case v.cachedIO == nil:
                config = v.props

Review Comment:
   Non-blocking nit (fine as a follow-up — not gating the approval):
   
   The `ErrVendedCredentialsExpired` fail-loud path and the `expired()` guard 
above both only fire when `cachedIO != nil`. On the **first** `Load` we take 
this branch (`cachedIO == nil`), set `config = v.props`, and build the FileIO 
via `iceio.LoadFS` below **without** checking whether the creds are already 
past `expiresAt`. So a plan whose creds expire before the first read still gets 
a working-looking IO whose reads 403 — the exact opaque failure this sentinel 
was added to prevent.
   
   It's narrow (needs creds already expired at first use) and non-regressive, 
so it's a nit rather than a blocker. To close it: when `fetchCreds == nil && 
cachedIO == nil`, compute the expiry from `config` and return 
`ErrVendedCredentialsExpired` if it's already past, before `LoadFS`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to