Skip to content

fix(python): refresh zero-lifetime OAuth tokens - #3971

Merged
Xuanwo merged 1 commit into
lancedb:mainfrom
primorLee:codex/fix-oauth-zero-expiry
Oct 22, 2026
Merged

Xuanwo merged 1 commit into
lancedb:mainfrom
primorLee:codex/fix-oauth-zero-expiry

Conversation

@primorLee

Copy link
Copy Markdown
Contributor

Summary

  • treat an OAuth expires_in value of zero as an explicit immediate expiration
  • refresh zero-lifetime tokens instead of caching them indefinitely
  • add a regression test covering two consecutive header requests

Tests

  • pytest python/tests/test_header_provider.py -q (16 passed)
  • ruff format --check python/lancedb/remote/header.py python/tests/test_header_provider.py
  • ruff check python/lancedb/remote/header.py python/tests/test_header_provider.py

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added bug Something isn't working Python Python SDK labels Aug 20, 2026

@lancedb-gatekeeper lancedb-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Gate recommendation: approve.

An explicit expires_in=0 now follows the documented lifetime semantics instead of being treated like an omitted expiry. The narrow condition change preserves the no-expiry behavior, and the regression test covers consecutive requests.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 20, 2026
@Xuanwo
Xuanwo merged commit 548a190 into lancedb:main Oct 22, 2026
4 checks passed
Xuanwo added a commit that referenced this pull request Oct 22, 2026
…4632)

## Summary

#3971 added `test_zero_lifetime_token_is_refreshed`, but its expected
headers omit `x-lancedb-credential-type: oidc`, which
`OAuthProvider.get_headers()` has emitted since #2631/#4070. The test
fails against current main and breaks the PR CI matrix for every open
PR.

## Changes

- Align the two zap assertions in
`test_zero_lifetime_token_is_refreshed` with the provider contract (see
`test_token_refresh` and `test_sync_method`).

## Tests

- `pytest python/tests/test_header_provider.py -q`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance. Python Python SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants