Skip to content

Release bfabric 1.24.2 - #651

Merged
Caushi merged 5 commits into
releasefrom
rel-20261118-01
Nov 18, 2026
Merged

Caushi merged 5 commits into
releasefrom
rel-20261118-01

Conversation

@Caushi

@Caushi Caushi commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Caushi and others added 5 commits November 10, 2026 11:21
Merge release back into main (bfabric 1.24.1, bfabric_scripts 1.19.1)
B-Fabric rotates refresh tokens and, once a rotated one is presented again
after the 10 s grace period, revokes every refresh token of that user and
client. Processes sharing one token cache file (gunicorn workers, an RQ
worker that unpickled the client, several CLI processes) each refreshed
with their own in-memory copy, so all but the first got invalid_grant and
could trigger the revocation.

- When the in-memory token is expired (or missing), _ensure_token now
  takes an flock on <cache>.lock, adopts the cached token if it expires
  later, and only refreshes if that one is expired too; the refreshed
  token is persisted before the lock is released. A valid token still
  takes the fast path with no file I/O.
- __init__ keeps the newer (by expires_at) of an explicit token and the
  cached one, under the same lock, and persists only an explicit token
  that is newer. A fresh login/exchange token still wins; an unpickled
  stale token no longer overwrites a newer cache entry.
- client_credentials uses the same lock: harmless, and workers then share
  one fetched token instead of each fetching their own.
- flock is POSIX-only; on Windows (not a supported/CI'd platform) the
  lock is a no-op and behaviour is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
The temp file was named .<name>.<pid>.tmp, so two threads of one process
(e.g. gunicorn with 16 threads) saving the same cache shared it: one
renamed it into place and the other's replace() failed with
FileNotFoundError. Use tempfile.mkstemp in the cache directory (0o600)
for a unique name per write, keep the atomic replace, and remove the
temp file if the write or rename fails.

Co-Authored-By: Claude <noreply@anthropic.com>
OAuth: serialise token refreshes across processes sharing a token cache
Bump bfabric and move the two OAuth token-cache fixes from #650 out of the
already-released 1.24.1 section, where they had landed, into 1.24.2. No other
package has unreleased changes, and every dependent's bfabric range already
admits 1.24.2.

Release mechanics only; no code changes.
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Release Preview

The following packages will be released when this PR is merged:

Package Current (PyPI) New Version
bfabric 1.24.1 1.24.2

This comment is automatically updated when the PR changes.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Release Distribution Testing

Packages to release: bfabric

Test Results:

  • Python 3.11 (highest): ✅ passed
  • Python 3.11 (lowest-direct): ✅ passed
  • Python 3.13 (highest): ✅ passed

Status: All tests passed with built distributions. The packages are ready for release.

Last updated: 2026-11-18T11:12:27.423Z

@Caushi
Caushi merged commit 528fef6 into release Nov 18, 2026
5 checks passed
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.

1 participant