Repository navigation
feat(oidc): add OIDC and rotating bearer tokens - #228
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
Pre-merge checks:
|
OIDC device-flow sign-in (RFC 8628) and rotating Bearer-token providers for the Rust, C and C++ clients, split out of #183 so the feature can be reviewed against `main` without the unrelated fixes of #226. Besides the feature, this carries the few pieces of #226 the feature depends on: - `Error::reclassified`, which keeps OIDC and token-provider diagnostics when an error is re-coded or annotated (reader endpoint errors, retry-budget and failover-deadline exhaustion). - ACK waits and the manual-progress close drain name the failure when they time out while reconnecting keeps failing, so a credential that needs a new sign-in reads as INTERACTION_REQUIRED. A manual close drain also stops at its deadline while a token refresh keeps failing. - `server_name_for_uri_host`, used by the OIDC HTTP client for IPv6 literal IdP hosts. - The store-and-forward pool's connect error keeps its payload, so an OIDC failure stays typed. The kept role-reject payload also lets a durable-ACK pool retry an all-replica role reject until the borrow budget. The full history is on branch `ia_oidc_device_flow` (#183).
3df927c to
79c0403
Compare
Native-backed OIDC device-flow sign-in and rotating Bearer-token providers for the Python client (`questdb.auth`, `oidc_auth=`, `bearer_token_provider=`), split out of #133 so the feature can be reviewed against `main` without the unrelated fixes of #160. The feature runs user callbacks (token providers, sign-in renderers) inside native calls, so this also carries the re-entry guards from #160 that keep such a callback from using an object a native call holds: - a sender rejects its methods while a native call borrows it, and from its own connection listener or error handler; - a `Buffer` that a native call is modifying rejects reads and writes; - a query cursor rejects same-thread re-entry during a native read, and finalizers reclaim cursors without blocking; - a DataFrame error keeps its class when a note is appended, so `except OidcError` still matches. Bumps c-questdb-client to the matching native change (questdb/c-questdb-client#228). The full history is on branch `ia_oidc_device_flow` (#133).
After a server rejects a token with HTTP 401, the connection pulls the token again with the rejection attached, so the provider can refresh it. On the shared isolated worker that pull joined whatever fetch was already in flight. When it joined fetches started by other connections twice in a row, it took the rejected token back as the provider's answer, although the provider was never told about the rejection. An async-connect QWP/WebSocket sender then failed with a 401 it would have recovered from, and a reader's mid-query failover gave up. Each isolated fetch now records the rejection its worker passes to the provider. A re-fetch accepts a result only from a fetch that carried its own rejection: it waits out any other fetch and then leads one, so a provider still runs at most one isolated worker at a time. A re-fetch that told the provider no longer asks it a second time when the provider answers with the same token.
A manual-progress QWP/WebSocket sender whose reconnect budget ran out before its first attempt latched the budget error as the reason reconnecting keeps failing. That error wraps what started the reconnect, such as a retriable server rejection, so a later ACK-wait timeout carried the rejected batch's diagnostic. line_sender_error_qwpws_get_view then returned true for a retryable failover_retry error, although it is documented to do so only for a terminal diagnostic, and the message claimed reconnecting kept failing with attempts=0. With reconnect_max_duration_millis=0 that message also grew with every pass. A budget that made no attempt no longer latches a reconnect failure, in both the manual driver and the background runner. ACK-wait and manual close-drain timeout errors also drop a server-rejection diagnostic from their cause, while keeping its OIDC, token-provider and role detail.
A forced refresh logged its "refreshing early" line while it held the
provider's state lock, and `Debug` for the provider takes the same lock.
A thread that formatted the provider while holding a log backend's output
lock -- `eprintln!("{provider:?}")` with a stderr logger -- deadlocked
with the thread handling the 401, and with them every later user of the
provider. The line is now logged after the lock is released, as the
provider's other log lines already were.
A RefreshingTokenProvider wrapped in a closure (`move || p.token()`) or
in a type of the application's own never heard of a 401: the wrapper's
`on_rejected` is the trait's no-op, so the re-resolution got the
rejected token back and every ILP/HTTP flush failed until the scheduled
refresh, about half the token's lifetime later. `token()` now refreshes
early when the calling thread is replacing a token a server rejected
with 401, as a wrapped OidcDeviceAuth already did.
A connected QWP/WebSocket sender rides out credential rejections past a
reconnect budget only because the budget's error keeps the rejection's
HTTP status, and no test crossed a budget expiry. New driver and sender
tests ride out 401s and 403s over several budgets, in both progress
modes, and then deliver the queued row.
The C and C++ token-provider headers said `get_token` runs once per
connect round, on a connect thread or an isolated worker. On an ILP/HTTP
sender it runs on every flush, on the flushing thread; they now say so.
A sender that has connected now rides out a server's 401/403 instead of becoming terminal, so a credential revoked mid-stream no longer fails the next call with an AuthError. ACK waits and the manual-progress close drain already named the reconnect failure in their timeout errors. The default background close drain and a flush that waited out sf_append_deadline_millis on a full queue did not: they reported a bare close-drain timeout, and the append timeout advised increasing sf_max_total_bytes, which cannot help while nothing can be acknowledged. Both now name the latest reconnect failure, keeping its OIDC and token-provider detail and dropping the server-rejection diagnostic, as the ACK-wait timeout does. With no reconnect failure latched, the messages are unchanged.
A copy of questdb::token_provider was another handle on one shared provider, so close() on a copy permanently ended every sender, pool and reader the original was attached to. oidc::device_auth deletes its copy operations for exactly that reason and offers share() instead. token_provider now does the same: the copy operations are deleted, moves remain, and share() takes an explicit additional handle. The C header documents that questdb_token_provider_clone aliases the provider rather than duplicating it.
retryable_interaction_required, reentrant_interaction_required, config_error and closed_error exist so the FFI crate can build typed OIDC errors. They were rendered as documented public API, while every other binding-only hook this feature adds is #[doc(hidden)].
The error for a token_provider or azure_* connect-string key pointed Rust callers at SenderBuilder::bearer_token_provider and ReaderConfig::token_provider. The first needs both the ILP/HTTP and the QWP/WebSocket sender, the second the reader, so an oidc-only or single-transport build was sent to methods it does not have. The message now names the methods the enabled features compile in.
A Rust token provider stops the background reconnects of the senders, readers and pools it serves by returning InvalidApiCall, which is carried as a terminal ConfigError. A C or C++ application provider had no equivalent: questdb_token_sink_set_error yields a token-unavailable error, which background reconnects retry whatever its classification, and the C++ wrapper reported every exception through that call. A provider that knew it could never succeed kept its clients reconnecting until the application closed them. questdb_token_sink_set_terminal_error reports such a failure from a get_token callback, carried as InvalidApiCall exactly as from a Rust provider. A C++ bearer_token_provider throws questdb::error with invalid_api_call. A refreshing provider's token source cannot report one, and the sink refuses it: closing the provider is how that kind stops its clients. The Rust and C++ docs also said every 401 makes the transport call on_rejected and resolve the token again. That happens only when the 401's WWW-Authenticate Bearer challenge names no error, or invalid_token, as the C headers already said; the Rust and C++ docs now say so too. And the docs of questdb_db_borrow_sender_with_retry and reconnect_pick still called every protocol-version error terminal, although a durable-ack pool now retries an all-replica role reject until the borrow budget runs out.
A token provider that returned a blank token, or one with a byte outside printable ASCII, made a connect the caller waits for pull it again until reconnect_max_duration ran out: the synchronous initial connect, a direct-sender pool borrow with retry, and an eager synchronous pool connect. A token file read with its trailing newline was enough. The same provider returning an unclassified error ends that connect at once, as the qwp_ws_token_provider docs promise for every provider failure the provider did not classify retryable. The validation error is now marked as a provider failure, like the provider's own errors, and so is the unwind-only error for a provider that panicked. Background reconnects still retry both, so queued store-and-forward frames stay replayable, and ILP/HTTP flushes are unchanged. A reader whose failover gives up on an invalid token now reports it rather than the transport error that started the failover, as for any other provider failure.
The terminal sign-in prompt shows a verification URL that safe_target refused as inert text, with its scheme broken so that terminals do not auto-link it. It broke a scheme only at the very start, although safe_target vets the stripped and trimmed URL. An identity provider that put a space, an NBSP or a word before a refused URL (userinfo, punycode or remote plaintext http) had it printed with a live scheme. defang_terminal_url now breaks every :// in the refused text. A URL that starts with its scheme prints as before. The doc comment that describes format_prompt is back on format_prompt.
The OIDC docs named only a missing sign-in as ending a QWP/WebSocket connect the caller waits for: the synchronous initial connect or a pool borrow with retry. Such a connect actually ends on every OIDC failure except a busy acquisition, a transient refresh failure included. An OidcDeviceAuth classifies none of its failures retryable, so an identity provider answering 5xx during a silent refresh fails the build or the borrow after one provider call, whatever its budget. That matches spec D8 and the Java client. Background reconnects keep retrying, and an ILP/HTTP flush resolves the token again until its retry_timeout expires. The docs of line_sender_opts_oidc_auth, questdb_db_connect_ex and both borrow-with-retry calls, their C++ and Rust counterparts, OidcErrorKind::Network and SECURITY.md now say so. The credential_unavailable event docs no longer claim that every initial connect fails fast: a synchronous one, or a pool borrow with retry, still retries a failure the provider classified retryable. A new test pins the Network case at the synchronous initial connect.
…vider In manual progress mode a reconnect pulls the token on the thread that drives progress, inside close_drain, wait or a flush waiting for queue space. Those calls check their deadlines only between attempts, so a RefreshingTokenProvider that held no usable token kept them for its whole cold_wait (30 s by default) while its refresh stalled. Such a pull no longer waits: it takes the cached token, or fails the attempt at once while the provider's refresher keeps fetching, and a later attempt pulls again. A connect the caller waits for, such as the initial connect, still waits for the provider.
The pool's borrow-with-retry paths and their tests compile only with the ffi-support feature, which no CI leg enabled for the questdb-rs tests, so the test for retrying a durable-ACK pool's all-replica role reject never ran in CI. Add the feature to the almost-all-features run; the arrow/polars run still covers the build without it.
|
Reviewing PR #228 at level 3, head b4d5848, base b3e60e2. Verdict: approve. There are no Critical or Moderate findings and one Minor. Two bugs found along the way already exist on PR metadata: The title follows Conventional Commits and carries CriticalNone. ModerateNone. MinorProblem: The sign-in failure display names the wrong cause for rejected token responses.
Adjacent findings (already on
|
Picks up questdb/c-questdb-client#228 commits 985e472a and 87a7ee12: - A RefreshingTokenProvider with min_refresh_interval below a millisecond -- 0, or up to 0.0004 s, which this wrapper rounds to 0 ms -- no longer fetches without pause while its source returns a refresh hint at or before receipt, as Azure Identity does with a cached token during an IMDS outage. The new test counts source calls over 0.3 s: about 40,000 before, at most 300 now. - questdb_token_provider_get_status zeroes the padding of its snapshot.
A device-flow poll whose reply delivered its status line and headers, but whose body then failed in transit -- the connection closed or reset early, or the body stalled past the request deadline -- ended the sign-in as a rejection: "the identity provider rejected the request". The body-read error carried the response status, and the poll loop took any non-transient status as a WAF or proxy error page. The IdP's answer is in the body, so such a reply answered nothing, yet the user's approval in the browser was lost and only a new sign-in with a new code recovered. The same fault one step earlier, a drop before the status line, kept the flow polling. A body read that fails on a socket error or a deadline now marks the error response_incomplete. The poll loop handles such a reply as a poll that got no reply: it keeps polling, applies the RFC 8628 interval increase after a timeout, and names the failure if the device code expires. A complete non-JSON reply is still a terminal rejection, and a body over the size cap or with malformed framing is not marked. The status stays attached, so the refresh path, which decides from it whether to keep a refresh token, is unchanged.
Picks up questdb/c-questdb-client#228 commit 886b497f. OidcDeviceAuth.sign_in() no longer fails with OidcDeviceFlowError ("the identity provider rejected the request") when a token-endpoint poll reply is cut off after its status line: an early close or reset, or a body that stalls past the timeout. It keeps polling, as it already did when a poll got no reply at all, so a user still approving the code in the browser can finish signing in. A complete non-JSON reply is still a rejection.
Clients that share a RefreshingTokenProvider see the same 401 at about the same time when a server stops accepting a token that has not yet expired. The first rejection forced a fetch and waited for it. Every other rejection inside forced_min_interval returned at once, so its client pulled the rejected token straight back, skipped its one 401 replay, and failed: an ILP/HTTP flush with AuthError, whose batch the Python binding then drops. The QWP/WebSocket and reader 401 replays go through the same path. Only the first client recovered, though the replacement token arrived milliseconds later. A rejection inside the rate limit still starts no fetch, but while the forced fetch for that same token is running it now waits for it, up to forced_wait, as the caller that started it does. Once that fetch has completed, the rate limit applies as before. Tests: c8_a_rejection_inside_the_rate_limit_waits_for_the_running_forced_fetch (direct on_rejected and the client replay path) and test_senders_sharing_a_provider_all_replay_a_shared_401 (two ILP/HTTP senders against mock servers) fail without the fix and pass with it.
The verification URL a device-flow sign-in opens in the browser, prints as a link and encodes as a QR code comes from the identity provider. safe_target refused a loopback URL from a remote IdP only over plain http, although its contract says a remote IdP must not be able to aim the browser at whatever else listens on the user's machine. A remote IdP could still name https://127.0.0.1:9000/exec?query=... -- or localhost, or [::1] -- and with open_browser on (the default) the browser opened it, reaching any local TLS service whose certificate it trusts. A loopback target is now accepted, over either scheme, only when the configured IdP endpoint is itself loopback. A local IdP keeps naming its own port. Names are not resolved, so a public name that resolves to loopback is not covered; the comment says so. safe_target_refuses_loopback_targets_from_a_remote_idp now covers https too and fails without the fix.
Picks up questdb/c-questdb-client#228 commits 7f2b01f1 and fab63e5b: - Senders that share a RefreshingTokenProvider all replay a 401 for the same token with its replacement. A rejection inside forced_min_interval got the rejected token straight back while the forced fetch was still running, so every ILP/HTTP flush but the first failed with AuthError and dropped its batch. - A device-flow sign-in no longer opens, links or QR-encodes a loopback https:// URL that a remote identity provider hands out. Only a loopback IdP may name a loopback target, over either scheme. The RefreshingTokenProvider.on_rejected() docstring and the comment on the fallback URL vetter say so.
FileTokenStore refuses a store directory whose final component is a
symbolic link, so a link planted at the store path cannot make it chmod
and write the link's target. The check lstat()s the configured path,
and path resolution follows a final symlink when the path ends in a
separator or `/.`: `<dir>/link/` passed the check that `<dir>/link`
fails, and a sign-in then tightened the link's target to 0700 and wrote
the token file into it. The documented default location,
`${HOME}/.questdb/oidc-tokens/`, invites that spelling in
QUESTDB_CLIENT_OIDC_TOKEN_STORE_DIR, and neither the C setter nor the
Python binding normalises it.
FileTokenStore::at now drops trailing separators and `.` components
once, so every later lstat, chmod and join sees the leaf itself.
Tests: refuses_a_symlinked_store_directory_however_it_is_spelled and
store_directory_drops_trailing_separators_and_dot_components fail
without the fix.
…rget fab63e5 refused a loopback verification URL from a remote identity provider, but decided "loopback" with a parser that accepts only canonical addresses and the exact name `localhost`. Browsers parse a host the URL Standard way: `127.1`, `2130706433`, `0x7f.0.0.1` and `0177.0.0.1` all open 127.0.0.1. So a remote IdP could still have https://127.1:9000/exec?query=... opened in the browser, linkified and QR-encoded, reaching a local TLS service whose certificate covers 127.0.0.1. `[::ffff:127.0.0.1]`, `0.0.0.0`, `[::]` and `*.localhost` got through the same way. safe_target now refuses a host that a browser parses as an IPv4 address unless it is a canonical dotted quad, whatever the IdP: no identity provider needs a shorthand spelling. It also treats unspecified addresses, IPv4-mapped loopback and unspecified addresses, and subdomains of `localhost` as the local machine, which only a loopback IdP may name. The plaintext rule is unchanged. Tests: safe_target_refuses_every_spelling_of_the_local_machine_from_a_remote_idp fails without the fix.
… fetch When a server rejects a RefreshingTokenProvider's token with HTTP 401, on_rejected forces a fetch and waits up to forced_wait for it. While the provider was backing off after a failed fetch -- an identity provider throttling with Retry-After, say -- the forced fetch was refused, yet the call still waited the whole forced_wait (5 s by default) for a fetch that could not start, and then handed back the rejected token. Every ILP/HTTP flush answered 401 in that state stalled 5 s before failing with the same 401, and since 7f2b01f so did every further 401 inside forced_min_interval. on_rejected now returns at once when no fetch is running and backoff lets none start before its deadline, as a cold token() already does. A backoff that ends within forced_wait is still waited for. Tests: c8_a_rejection_returns_at_once_when_backoff_outlasts_the_forced_wait fails without the fix; c8_a_rejection_still_waits_for_a_backoff_that_ends_within_the_forced_wait covers the wait that remains.
A C++ bearer_token_provider passes on a classified QuestDB error from its token() unchanged, so the clients keep the classification: a closed token_provider's failure stops them as auth_error with provider_closed set. That works by handing the error's C error to questdb_token_sink_set_error_from, but line_sender_error::from_c freed its C error instead of keeping it. A line_sender_error escaping token() -- the one opts::token_provider() throws for a closed provider, say -- was therefore re-reported as terminal: every client failed with config_error and no classification, contrary to the documented contract. One carrying OIDC detail lost that detail and was reported as an ordinary retryable failure. line_sender_error::from_c now keeps the C error, as questdb::error does, and report_current_exception passes on one carrying a classification or OIDC detail. Tests: "A provider passing on a sender error keeps its classification" and "... keeps its OIDC detail" fail without the fix.
doc/C.md and doc/CPP.md list the committed headers as the authoritative native API reference, and the token-provider header and example were added there, but not oidc.h, oidc.hpp or the OIDC examples, so a C or C++ user found no route to the device-flow API. SECURITY.md discussed the OIDC device flow but linked only the token-provider material.
…esh fixes Pins questdb/c-questdb-client#228 at 6df7aa67, which: - refuses a symlinked OIDC token store however its path is spelled. A trailing separator (`FileTokenStore('<dir>/link/')`, or the same in QUESTDB_CLIENT_OIDC_TOKEN_STORE_DIR) passed the symlinked-leaf check, and a sign-in then chmodded and wrote the link's target; - refuses every spelling of the local machine as a browser sign-in target from a remote identity provider: `127.1`, `2130706433`, `0x7f.0.0.1`, IPv4-mapped loopback, unspecified addresses and `*.localhost` got past the loopback refusal; - returns from a RefreshingTokenProvider's forced refresh at once when failure backoff lets no fetch start before forced_wait ends. Every ILP/HTTP flush answered 401 while the provider backed off stalled forced_wait (5 s) before failing with the same 401. The on_rejected() docstring says so; - passes on a C++ provider's escaping line_sender_error unchanged, and links the OIDC headers from the C and C++ guides. Neither affects this binding.
sanitize_display_text keeps at most four combining marks stacked on one base character, so that untrusted text -- an identity provider's error_description, an OIDC error message -- cannot smear a runaway "Zalgo" stack across the lines around it. It counted only marks from a list of stacking blocks, and any other kept character ended the run, including a combining mark outside those blocks. Interleaving such a mark with listed ones (`A` followed by 99 pairs of U+0951 U+0301) kept all 198 marks on one base character in the native stderr renderer, questdb_error_msg, the error view's idp_error_description and C FAILURE events, while the Python client, whose cap the docs said this matched, kept four. Every code point of general category Mn now counts, as in the Python client. A generated table of the Unicode 16.0.0 Mn ranges replaces the block list, which it contains; it is data, not a crate dependency. Tests: strip_control_counts_every_nonspacing_mark_in_a_run fails without the fix; nonspacing_marks_are_sorted_and_disjoint guards the table's binary search.
…etch questdb_token_provider_close, the last questdb_token_provider_free and RefreshingTokenProvider::close return while a source call already in flight keeps running on the refresher thread; its result is discarded, and release runs only after it returns. The headers said close "stops its refresher", and nothing told C callers that the source may still run, so a caller that freed what the source uses right after close and free -- user_data without a release, a global, a library -- could have it used after free. The OIDC handles in the same headers state their in-flight guarantees. token_provider.h, token_provider.hpp and the Rust docs now say so, and tell C callers to tear down what the source uses from release, and C++ callers to capture by value or keep what the source refers to alive until the provider drops its copy. Behaviour is unchanged.
Pins questdb/c-questdb-client#228 at 2a443686, which: - counts every non-spacing mark against the display sanitizer's cap of four marks on one base character. A combining mark outside its list of stacking blocks ended the run, so interleaving one between listed marks kept a whole "Zalgo" stack in an identity provider's error text. This binding's own renderers and OidcError messages already applied the full cap; a custom Renderer's on_failure() received the native text; - documents that closing a token provider does not wait for a fetch already running. Python's RefreshingTokenProvider.close(wait=True) already offers that wait.
cbbfb7a refused a target on keycloak.localhost, 0.0.0.0 or an IPv4-mapped loopback address unless the configured IdP is itself on the local machine. But the IdP side was still judged by is_loopback, which knows only loopback addresses and the exact name localhost. An IdP configured on one of those spellings therefore counted as remote, and its own verification URL was refused: no browser open, no "open directly" line, a NULL browser_target in the C prompt event, and a defanged URL in the terminal prompt. Sign-in itself still completed. Both sides of the rule now use one test, render::is_local_machine. The plaintext rules are unchanged: an http IdP or target must still be loopback. Test: an_idp_on_the_local_machine_keeps_its_verification_url_however_it_is_spelled fails without the fix (browser_target is None for keycloak.localhost).
|
Reviewing PR #228 at level 3, head 99dd41a, base a6fd07f. Verdict: approve. This review found no Critical, Moderate or Minor issues. The test gate passes, with no coverage gaps. PR metadata
Critical / Moderate / MinorNone. Adjacent findingsNothing new to file. The two known bugs in code this review touched are already tracked:
Coverage mapTest gate: passes, with no coverage gaps. Every behaviour change I traced has a test that runs in PR CI:
The graceful role-switch suites are Summary
|
|
Reviewing PR #165 at level 3, head cd29d4f4bec724147a78aa5fb17e84fff0955aec, base 8190c2a61d760fe3f12c65f75b1a21798bd06697. Reviewing PR #228 at level 3, head 99dd41a, base a6fd07f. This is a tandem review of questdb/py-questdb-client#165 and #228. Each PR was reviewed with its own repository's review skill. Verdict: approve both. #165 has one optional Minor; #228 has no findings. Both PRs were unchanged at the end of the review. questdb/py-questdb-client#165CriticalNone. ModerateNone. Minor1. An exception raised by a provider's
How it happens:
The documented behaviour of the other callbacks:
Suggested fix:
Adjacent findingsNothing new. #172 ( Coverage mapThe test gate passes with 0 admitted coverage gaps. The new guards and the provider and OIDC paths are covered by mock-only tests that run on every CI leg and in the wheel builds, for example Summary
#228Critical / Moderate / MinorNone. Adjacent findingsNothing new. #231 and #232 are already tracked. Coverage mapThe test gate passes with 0 admitted coverage gaps. Summary
The review was read-only: builds and probes ran in scratch worktrees, and both PRs' base/head pairs were revalidated before posting. |
jovfer
left a comment
There was a problem hiding this comment.
review approve seems valid, please double-check if we should really mark this PR as "breaking changes"
* feat(auth)!: add OIDC and rotating bearer tokens
Native-backed OIDC device-flow sign-in and rotating Bearer-token
providers for the Python client (`questdb.auth`, `oidc_auth=`,
`bearer_token_provider=`), split out of #133 so the feature can be
reviewed against `main` without the unrelated fixes of #160.
The feature runs user callbacks (token providers, sign-in renderers)
inside native calls, so this also carries the re-entry guards from #160
that keep such a callback from using an object a native call holds:
- a sender rejects its methods while a native call borrows it, and
from its own connection listener or error handler;
- a `Buffer` that a native call is modifying rejects reads and writes;
- a query cursor rejects same-thread re-entry during a native read,
and finalizers reclaim cursors without blocking;
- a DataFrame error keeps its class when a note is appended, so
`except OidcError` still matches.
Bumps c-questdb-client to the matching native change
(questdb/c-questdb-client#228).
The full history is on branch `ia_oidc_device_flow` (#133).
* test(auth): run the Arrow C stream tests on pyarrow 14
`RecordBatchReader.from_stream` and a dict argument to `pa.record_batch`
arrived in pyarrow 15, so ten OIDC tests failed on the linux-min-deps
job (pyarrow 14.0.1). Import the stream through `_import_from_c_capsule`
there, as `system_test.py` does, and build the batch from a list of
arrays.
* fix(auth): record the native main-thread ident under gevent
`_OIDC_MAIN_THREAD_IDENT` came from `threading.main_thread().ident`,
which gevent's monkey-patching makes a greenlet id. On 64-bit Windows
that does not fit an `unsigned long`, so `import questdb` after
`monkey.patch_all()` raised OverflowError, failing `main`'s
`test_scoped_calls_from_greenlets_on_one_thread` on both Windows jobs.
Elsewhere it never matched the native `PyThread_get_thread_ident()` the
main-thread checks compare it with, so under gevent no thread counted
as the main one.
Read the native ident when `get_native_id()`, which gevent leaves
alone, says this is the main OS thread, and compare natively in
`_tp_on_main_thread` too. Without gevent nothing changes.
* update submodule
* feat(auth): let Python token providers stop background reconnects
Bump c-questdb-client from a038a0a7 to b3e8f361: 7.2.0, merged from
main, and the OIDC branch's fixes since. Its new
`questdb_token_sink_set_terminal_error` lets an application provider
report a failure that retrying can never clear. Until now clients kept
retrying every failure of a Python provider in the background,
whatever its TokenUnavailableError said, so a provider that knew it
could never succeed kept its senders, queries and pools reconnecting
until the application closed them.
A provider now raises QuestDBError with code InvalidApiCall to stop
them, as a Rust provider returns `InvalidApiCall` and a C++ one throws
`questdb::error` with `invalid_api_call`: a QWP/WebSocket sender, query
or pool fails with ConfigError and stops reconnecting, and an ILP/HTTP
flush fails at once. A TokenUnavailableError keeps its classification
whatever its code. A RefreshingTokenProvider's source cannot report
one: its sink refuses it, so the exception counts as retryable like any
other, and closing the provider is what stops its clients.
The bump also brings:
- A RefreshingTokenProvider wrapped in a provider of one's own
(`lambda: tokens.token()`) refreshes early on a 401 instead of
handing the rejected token back until its scheduled refresh.
- A 401 re-fetch no longer takes the rejected token back from a fetch
another connection started, and a forced refresh no longer logs
under the provider's state lock, which could deadlock.
- A close drain, and a flush that waits out sf_append_deadline_millis
on a full queue, name a failing reconnect when they time out, rather
than reporting a bare timeout or advising a larger
sf_max_total_bytes. An ACK-wait or close-drain timeout no longer
carries a server rejection's sender_error, which marks a terminal
error.
Document the terminal failure, and that ILP/HTTP calls the provider on
every flush, on the flushing thread. Test that each kind of client
stops on it, that a source's stays retryable, and that wrapped
refreshing providers refresh on a QWP/WebSocket or ILP/HTTP 401.
* update submodule
* fix(auth): keep row() publish errors typed, and other review fixes
QWP/WebSocket row() reworded a failed auto-flush publish by calling the
exception's class with QuestDBError's positional signature. The classes
c_err_to_py now returns for token-provider and OIDC failures do not
share it. TokenUnavailableError, OidcDeviceFlowError and
OidcTimeoutError raised TypeError, which `except QuestDBError` misses:
row() did that during an IdP outage that fills the store-and-forward
queue, and after a RefreshingTokenProvider was closed. The other
OidcError classes came back with a tuple as their message and their
class's default code. Copy the instance instead, as
_dataframe_call_error does.
Also:
- _dataframe raised the main-thread signal-deferral counter before a
check that can refuse the call outside the try that lowers it. One
refused re-entrant dataframe() then swallowed every later Ctrl-C a
token callback parked, for the rest of the process.
- Sender and QuestDB gained a __dict__ for the bearer-token holder, so a
misspelt setting (sender.request_timeout = 5000) was stored and read
back while configuring nothing. Refuse new names as before; Python
subclasses keep their dictionary.
- RefreshingTokenProvider.close(wait=True) could return before a source
call that had already passed the closed check ran. Mark the call in
progress before checking.
- An on_rejected lookup that raised was reported as an internal
AttributeError: the signal-handler snapshot started as a tuple.
- Docs: list the rejected token-provider config keys under 6.1.0
breaking changes; the PG adapters raise whatever the provider raises,
not always OidcError; bearer_token_provider is keyword-only too
(conf.rst, Sender.from_env).
* fix(auth): let Sender and QuestDB construct on CPython 3.10-3.12
49e50f6 routed every attribute assignment on Sender and QuestDB through
_setattr_without_dict, which stored the value with object.__setattr__.
Before 3.13, CPython refuses that call ("can't apply this __setattr__ to
... object") on an instance whose class overrides the C-level setattr
slot, as the Cython __setattr__ does. __cinit__ sets
_bearer_token_provider that way, so neither class could be constructed
on CPython 3.10-3.12, and every wheel and test job for those versions
failed. CPython 3.13+ and PyPy do not make the check.
Call PyObject_GenericSetAttr, the function object.__setattr__ wraps,
directly. Cython's own setattr slot already calls it for deletes.
* update submodule
* test(auth): wait for the CredentialUnavailable event before closing the pool
test_pooled_dataframe_does_not_spin_on_oidc_network_failure counted the
listener's events only after leaving `with questdb.connect(...)`. The
event is queued on the pool's dispatcher inbox before dataframe() raises,
but delivery runs on the dispatcher thread, and closing the pool discards
anything it has not delivered yet. On a loaded CI agent the dispatcher had
not been scheduled before close, so the listener saw no event at all
(cp312 manylinux aarch64: `AssertionError: 0 != 1`).
Wait for the event while the pool is open, as the OIDC failover tests'
`_run` helper already does, then pause briefly so a surplus event from a
retrying call would still be counted before close discards it.
* update submodule
* fix(ci): retry the QuestDB release download on a transient network error
The "on mac" leg failed because DNS on the runner briefly stopped
resolving the GitHub release host. The first two system-test classes to
run, TestColumnIngressFailover and TestColumnIngressNarrowTypes, each
spent 30s in getaddrinfo, got URLError ([Errno 8] nodename nor servname
provided), and errored in setUpClass. The third class downloaded the same
tarball a minute later and every remaining test passed.
may_install_questdb() now retries a URLError up to four times with
1/2/4s backoff, and never retries an HTTP response such as a missing
release asset. This is the same retry #160 carries (ac24653), ported
verbatim so the two branches merge cleanly. The egress _exec timeout
change from that commit is unrelated and is left out.
* update submodule
* fix(auth): let exit-time flushes reach token providers, bound durations
questdb's atexit hook closes the callback gate before logging.shutdown()
and before any atexit callback registered ahead of `import questdb`. An
ILP/HTTP flush from either, with a Python bearer_token_provider, therefore
retried for retry_timeout, raised TokenUnavailableError and lost its rows.
A token callback that the main thread makes from inside its own native
call now still runs while the interpreter is not finalizing. Callbacks on
native threads stay refused, so the docs now say to flush and close
QWP/WebSocket clients, and anything that needs a token refresh, before
the interpreter exits.
RefreshingTokenProvider durations had no upper bound. close(wait=True)
with a timeout above threading.TIMEOUT_MAX raised OverflowError instead
of waiting, a duration beyond the uint64 millisecond range reached an
undefined double-to-integer conversion, and a huge retry_after overflowed
and lost the source's classification. Waits are now sliced and the
conversions clamped.
The CHANGELOG now lists every read-only call that raises during a native
call, and QuestDB.from_conf as a bearer_token_provider entry point.
* update submodule
* fix(auth): keep Sender.row() fast and token callbacks out of frames
Sender gained an instance __dict__ to hold the bearer-token holder
where PyPy's collector can see it. Cython allocates that dictionary in
tp_new, and while an instance has one, CPython cannot cache the method
lookup of `sender.row(...)`: every row took the generic lookup, with or
without a provider, about 7 ns per call over ILP/HTTP and 18 ns over
QWP/WebSocket. CPython now keeps the holder in a typed slot and drops
the empty dictionary in __cinit__; PyPy keeps it in the dictionary as
before. row() now runs its own-callback check whatever the auto-flush
mode, so a process-wide count of callback dispatches in progress
answers it first, and the full check runs only while one is.
An ILP/HTTP Sender.dataframe() auto-flush calls a bearer_token_provider
on the caller's thread, inside the native flush. The frame took that
callback for its own Python, so the provider could drive the sender it
was supplying -- new_buffer(), a flush of another buffer -- and nest a
native flush inside the one that called it. Outside a frame the same
calls were already refused. Token callbacks now count as callbacks
there, as OIDC ones do. Two holes in the same guard are closed too: a
nested flush cleared the sender's in-native flag for the rest of the
frame instead of restoring it, and a nested Buffer.dataframe() or
SenderTransaction.dataframe(), refused anyway, dropped the outer
frame's buffer borrow on its way to the refusal.
CHANGELOG: CredentialUnavailable reports bearer_token_provider failures
too, including the terminal stop on InvalidApiCall (ConfigError).
* fix(auth): stop a reader-lease GC crash and a dataframe() retry spin
_ReaderHandle gained a __dict__ and an object field to keep the token
providers alive, which made it a GC type with a Cython tp_clear that puts
None in its __dict__ slot. When the cyclic collector freed an unclosed
QuestDB.reader() lease -- one held in a frame that also kept a caught
exception, say -- it cleared the handle first, and the lease's
__dealloc__ then closed the reader and wrote _bearer_token_provider
through that None: SIGBUS or SIGSEGV on CPython 3.13 and 3.14, an
unraisable SystemError before. Mark the handle no_gc_clear, as
_CursorHandle and _TokenProviderHandle are. The providers it references
have their own tp_clear, so cycles through it stay collectable.
QuestDB.dataframe() and PooledSender.dataframe() borrowed again at once
after a connect that had already been given the rest of the reconnect
budget. Native ends such a connect early on a failure it does not retry
for a caller that waits -- an application bearer_token_provider that
returns an empty token, or one with a trailing newline -- so the call
spun until reconnect_max_duration ran out (300 s by default), calling the
provider thousands of times a second, where query(), an eager connect()
and Sender.establish() fail after one call. A connect that had a retry
budget and failed is now final for the call.
* docs(auth): scope background token retries to QWP/WebSocket
The token-provider guide and the BearerTokenProvider docstring said that
clients keep retrying a provider failure in the background, whatever a
TokenUnavailableError says. That holds for the background reconnects of
a QWP/WebSocket sender, query or pool, but not for ILP/HTTP: a flush
calls the provider on the flushing thread, retries a retryable failure
for up to retry_timeout, fails at once on a permanent one, and then
raises, discarding the rows in the sender's internal buffer as any
failed flush does. A reader who trusted the background retry could log
the error and lose those rows.
Scope the claim to QWP/WebSocket reconnects, note that a waited-for
connect honours the classification, describe the ILP/HTTP flush, and
show how to keep a batch for a resend: build it in sender.new_buffer()
and flush it with clear=False.
* fix(auth): keep a ws dataframe's token provider through a close
Sender.dataframe() over ws:: connects with its own clone of the sender's
options, so a close() from Python its plan build runs -- a logging
handler, an attrs read, an object cell -- does not stop it. With a
callable bearer_token_provider the close released the sender's only
reference to the provider's holder. That unregistered its callback id
while the clone still pulled tokens through it, so the call raised
TokenUnavailableError ("the token provider was released") and wrote
nothing, where the same sequence with token= or no auth completes. Keep
the holder alive for the call, as the dispatch context already is.
* fix(egress): let close() and cancel() from another thread wait for a read
The cursor guard refused any thread while a native read was in progress,
though the changelog and comments limit it to same-thread re-entry.
Refuse only the lock's owner; other threads wait as before. Also name
QWP/UDP among the protocols that ignored token-provider config keys.
* docs: correct the Arrow C-stream token error and cursor close() notes
The token-provider guide and the 6.1.0 changelog said that a query whose
failover cannot get a token raises TokenUnavailableError, and the
__arrow_c_stream__ caveat limited the loss of the exception type to
oidc_auth. A result read through its Arrow C stream -- pyarrow.table(),
RecordBatchReader.from_stream(), polars.DataFrame() -- carries only an
error string, so with a bearer_token_provider the consumer raises its
own exception type, OSError from pyarrow, with the provider's message,
and an `except TokenUnavailableError` around it never matches. Document
that for both providers, name the readers that keep the typed error,
and add a test that pins both behaviours.
The changelog also said cursor close(), cancel() and pulls refuse
same-thread re-entry only while a native read is in progress. They also
refuse it while a batch is decoded, where 6.0 accepted close() and freed
the cursor once the decoder let go of the batch. Say so, and update the
_CursorHandle docstring, which still described close() as deferred.
* fix(auth): accept callable providers in the PG adapters
sqlalchemy_engine() and psycopg_connect() called auth.token() directly, so
a function returning a token -- a provider bearer_token_provider= accepts,
the documented `lambda: tokens.token()` included -- failed with a bare
AttributeError: at once from psycopg_connect(), and from sqlalchemy_engine()
only when its first connection opened. Both now take an OidcDeviceAuth or
any provider bearer_token_provider= takes, and refuse anything else with
OidcConfigError up front, as they do every other bad argument. A token that
is not a str, which the driver would turn into the password with str(), is
refused too.
Also:
- questdb.connect() and QuestDB.from_conf() reject the reserved
token-provider keys in Python, with Sender.from_conf()'s message, rather
than native's, which also names the C, C++ and Rust APIs.
- QuestDB.from_conf() no longer calls every auth rejection terminal: a
sender that has connected rides it out. The ConnectionEventKind
descriptions move from #: comments, which Sphinx does not render for the
compiled module, into the class docstring.
* fix(auth): keep an interrupted pool close from holding the OIDC lock
QuestDB.close() waited for its provider's persistence diagnostics with
`with _OIDC_DIAGNOSTICS_DRAINED:`. Condition.__enter__ and __exit__ are
Python, so a Ctrl-C or a raising signal handler that fired just after the
lock was taken, or as __exit__ began, left the process-wide registry lock
held by the closing thread. Every provider built, collected or warning on
another thread then blocked on it, and a blocked non-daemon thread hung
interpreter exit. Take the lock through the RLock's own C-level `with`, as
close() takes _state_cond through acquire().
Also stop OidcDeviceAuth from importing IPython to learn that no shell is
running. In a plain process with IPython installed, every default
construction loaded about 600 modules and 200 ms, and the changed teardown
order made a pool left open print an unraisable AttributeError at exit. A
running shell has always imported IPython already.
* docs(auth): warn that signal handlers can run inside provider calls
An application bearer_token_provider runs inside the client call that
asks for a token on the caller's thread: every ILP/HTTP flush, and a
connection the call waits for. CPython runs a pending signal handler at
the first Python code on the main thread, which there is the provider,
so a SIGTERM handler that closes the sender can run mid-flush. Its
close() is refused with InvalidApiCall and closes nothing, while the
same handler works with a fixed token=. Nothing said so.
Add a "Code that runs inside a client call" section to the token
provider guide, and point to it from the BearerTokenProvider docstring
and the bearer_token_provider parameter docs. Correct the changelog
entry that read as if signal handlers themselves were deferred: only
the exception a handler raises is. The refusal message no longer names
only the OIDC diagnostic callback.
* fix(auth): bound lease and pool waits inside bearer-token calls
A bearer_token_provider= runs on a native thread when a QWP/WebSocket
sender, query or pool reconnects, and the reconnect waits for it. A
provider, or a logging handler it triggers, that used a PooledSender
lease another thread held across an indefinite ACK wait (wait(),
flush(wait=True)) blocked on the lease lock forever: the ACK needed the
reconnect, and the reconnect needed the provider to return. The stuck
callback then also blocked interpreter exit, and a db.close() made there
waited out the 60 s lease limit. OIDC callbacks already gave up after
two seconds; token-provider calls now do too, raising
QuestDBError(InvalidApiCall) that names a token-provider callback.
A provider that let that refusal escape token() would have stopped its
clients for good, which is what an InvalidApiCall from a provider means.
The lease or pool it gave up on is busy, not broken, so the refusal is
marked and counts as retryable instead.
Also:
- RefreshingTokenProvider refuses unknown attributes, as Sender and
QuestDB do. `tokens.cold_wait = 5` was stored and read back while
configuring nothing, and `tokens.token = None` hid the method.
- ConnectionEventKind.CredentialUnavailable and the changelog said a
foreground QuestDB.dataframe() fails fast on a SocketError credential
failure. With bearer_token_provider= it retries a retryable one for up
to reconnect_max_duration_millis, as token_providers.rst says. Say so.
- The auto_flush_bytes docstring now says it also raises from any thread
while the sender is inside a native call.
* update submodule
* fix(auth): give Sender subclasses the generic attribute setter back
49e50f6 gave Sender a __setattr__ that refuses misspelt settings on
Sender itself, and every Python subclass inherited it. Each attribute
store on a subclass then went through the Cython hook, about 4 ns more,
and CPython 3.11+ stopped specializing those stores: a __slots__ store
took about twice as long.
A subclass whose MRO reaches Sender's __setattr__ now gets object's
setter and deleter back, so its stores skip the hook and CPython can
specialize them again. A class in between with its own __setattr__
keeps it. The hook is a class attribute, as Cython refuses an extension
type's own __init_subclass__ method.
* update submodule
* fix(auth): treat a client refusal escaping a provider as retryable
A bearer_token_provider= that raises QuestDBError with code
InvalidApiCall stops its clients for good. The client raises the same
code when it refuses a call, and bc690a1 exempted only the lease and
close waits a callback gave up on. A provider, or a logging handler it
triggers, that borrowed from a pool at its sender_pool_max cap and let
the "Connection pool exhausted" refusal escape stopped the reconnecting
sender for good: its wait failed with ConfigError and the rows in that
lease were never sent. An InvalidApiCall now stops the clients only
when the provider raised it itself. One raised inside the questdb
package refuses a call to a busy or closing client, not a broken
credential, and is retried. The traceback says where it was raised, as
it already does for signal handlers.
Also:
- A Sender subclass that lists a class defining __setattr__ or
__delattr__ after Sender, as in class S(Sender, Mixin), raises
TypeError when it is defined. Sender's own method comes first, so the
mixin's silently never ran. The changelog now lists this, and the
other subclass changes that Sender's instance dictionary and
__setattr__ bring, as breaking.
- The changelog said a waited-for connection fails at once on any
provider failure but a retryable TokenUnavailableError. A plain
exception is retried too, and only with initial_connect_retry on. Say
so there and in the token-provider guide.
- The max_name_len, protocol_version, connection_events_dropped,
connection_events_delivered, published_fsn(), acked_fsn(),
poll_error() and error_events_dropped() docstrings say they raise
InvalidApiCall while the sender is inside a native call.
* fix(auth): accept a timedelta for OidcDeviceAuth timeout
OidcDeviceAuth(timeout=timedelta(seconds=30)) raised OidcConfigError
saying the timeout must be a positive, finite number no greater than
120 seconds, while every RefreshingTokenProvider duration takes a
timedelta. Accept one, and name a wrong type as such rather than as an
out-of-range value.
Also:
- CHANGELOG: list the refusal of same-thread QueryResult.close(),
cancel() and PooledReader.close() during a read under the 6.1.0
breaking changes. 6.0 accepted such a close().
- The comment on the dataframe() token-probe branch said a different
provider failure is retried. A busy refusal is; any other OIDC
failure is raised at once.
* fix(auth): clear a failed flush's rows before converting its error
Sender.flush() converted the native error before clearing the internal
buffer, and with a token provider attached that conversion runs Python.
With oidc_auth= it builds an OidcError, and a pending signal handler
runs there; on PyPy, or on CPython with a full pending-call queue, a
token provider's parked interrupt is re-raised there too. A Ctrl-C or a
SIGALRM deadline during an ILP/HTTP flush that then failed, on an
identity-provider outage say, raised from flush() with the failed rows
still buffered. The next flush sent them again, twice over if the
caller re-ran the ingestion, which the flush documentation presents as
safe: a failed flush discards its rows.
Clear the buffer before converting the error, deciding the
BatchTooLarge exemption from the native error code, as
flush_and_get_fsn() and the dataframe auto-flush already do.
* fix(auth): deliver diagnostic signal exceptions on PyPy
On PyPy, an exception a Python signal handler raised during an OIDC
persistence warning inside a client call -- an ILP/HTTP flush that
refreshed the token, say -- never reached the caller unless it was a
KeyboardInterrupt: a SIGTERM handler's sys.exit() and a SIGALRM
deadline's TimeoutError were dropped, and Ctrl-C was re-armed, which
ran a custom SIGINT handler again at every later bytecode of the
callback (four times for one signal).
Park it as CPython does. PyPy delivers no pending call, so the
native-return boundary raises it, as it already does for token
callbacks. OidcDiagnosticSignalTest now runs on PyPy, except two tests
that depend on CPython behaviour: cpyext runs an exception's __setattr__
when compiled code raises it, and PyPy runs a second pending handler
only at a later bytecode.
* fix(auth): preserve token provider errors in connect
Keep TokenUnavailableError out of duplicate-key diagnostic rewriting so callers retain the provider's classification and retry metadata.\n\nCover sender and reader warm-up with retryable and permanent provider failures.
* docs(auth): clarify terminal WebSocket credential failures
* fix(auth): keep Sender.row() specialized after its __dict__ is read
Sender gained an instance dictionary for the bearer-token holder, which
__cinit__ drops on CPython so the method lookup of `sender.row(...)`
stays cached. Any later read of `__dict__` -- dir(), vars(),
inspect.getattr_static(), an IDE completing `sender.` -- recreated it,
and nothing dropped it again: every later row() on that sender took the
generic lookup, about 13 ns (4%) per row on CPython 3.13.
dir() now drops the dictionary it recreates, and every flush drops one
any other read left, so the cost lasts at most until the next flush.
Only an empty dictionary of a Sender itself is dropped: the client
stores nothing there on CPython, and a subclass keeps its own.
* fix(auth): stop transports silently skipping token() overrides
A RefreshingTokenProvider subclass that overrode token() or
on_rejected(), passed as bearer_token_provider=, had its native handle
attached as is: every flush, connect and query read the native cache
and never called the override, while the PG-wire adapters and
bearer_token_provider=tokens.token did. Such a subclass, or an instance
attribute shadowing either method, is now attached as an application
provider, so its clients call its methods. One that overrides neither
still attaches its native provider.
oidc_auth= cannot honour an override: connections take the token from
the native OIDC provider. An OidcDeviceAuth whose token() is overridden
is now refused there with TypeError instead of being attached and
silently bypassed. The dataframe() fail-fast probe reads the native
provider through a private _foreground_token(), which the probe tests
now intercept in place of token().
* fix(auth): stop clients of closed overriding token providers
RefreshingTokenProvider subclasses that override token() or on_rejected()
use the application-provider bridge. After close(), their permanent token
failures were still retried by background reconnects, and pooled
flush(wait=True) could wait forever.
Report failures from closed refreshing providers as terminal through the
bridge, preserving main-thread interruption handling. Attached overrides
report ConfigError; attaching an already-closed override raises the same
nonretryable AuthError as the native-cache provider.
Also address the minor review findings:
- Give refreshing-provider subclasses Sender's generic attribute handling
and mixin-order guard.
- Remove the unused foreground OIDC classifier argument.
- Document closure behavior and include Buffer.dataframe() in the list of
operations guarded during native modification.
Add regressions for both override types, closed attachment, background
connects, pooled rows and flush waits, and subclass attribute handling.
Validation:
- CPython 3.13: full mock suite passed (1626 tests, 61 skipped).
- Auth suite passed (330 tests, 3 skipped).
- CPython 3.10 and 3.12: builds and token-provider suites passed
(83 tests, one optional-mypy skip each).
- Sphinx -nW --keep-going and git diff --check passed.
* test(auth): let the concurrent-attach test pass on PyPy mid-suite
test_concurrent_provider_attachments_publish_one_holder snapshots the
callback registry before it runs, then waited for the registry to equal
that snapshot again. On PyPy, an earlier test's provider entries are
garbage but not yet collected when the snapshot is taken, and the test's
own gc.collect() frees them too, so the registry ends up a strict subset
of the snapshot and the wait timed out. Since 4b190ee added the test that
runs just before it, it failed in every class and full-suite run on PyPy,
failing the PyPy wheel build. Nothing leaked: every entry the test
registered was released.
Wait for the registry to be a subset of the snapshot instead, which the
sibling tests' checks already allow for.
* fix(auth): make token-provider argument errors QuestDBErrors too
OidcDeviceAuth and the PG-wire adapters report a bad argument as
OidcConfigError, a QuestDBError with code ConfigError. The token-provider
API raised a plain TypeError or ValueError instead: for a
RefreshingTokenProvider source, duration or name, an ExpiringToken value,
a TokenUnavailableError retry_after, and a bearer_token_provider= or
oidc_auth= of the wrong kind. An `except QuestDBError` around provider
setup caught a bad OidcDeviceAuth timeout, but not a bad
RefreshingTokenProvider cold_wait.
Raise a TypeError or ValueError that is also a QuestDBError with code
ConfigError, so either except clause catches it. Existing handlers of the
built-in errors keep working. RefreshingTokenProvider.on_rejected()
validates its arguments the same way; before, a None token raised
AttributeError and a status beyond the C int range OverflowError. A
provider failure message still names the built-in error, not the private
class.
* fix(auth): stop clients of a closed provider reached through a wrapper
A RefreshingTokenProvider that an application provider calls --
`lambda: tokens.token()` or `tokens.token`, documented and tested for
401 refresh -- did not end its clients when closed. Its "is closed"
failure reached native as an ordinary non-retryable error, which
QWP/WebSocket background reconnects retry for good: a pooled
flush(wait=True) of rows already published never returned. Attaching
the bound method of an already-closed provider was accepted, unlike the
provider itself, so an async sender took rows it could never send.
_tp_token now marks a closed provider's failure and _tp_sink_exception
reports it as terminal, as for a closed overriding subclass: clients
stop with ConfigError. A method bound to a closed provider is refused
at attach with the provider's own error.
Also:
- RefreshingTokenProvider.__exit__ is stubbed Literal[False], so mypy
no longer reports a missing return after `with` blocks.
- A source whose fetch_token is not callable raises TypeError, or is
called itself when callable, instead of failing every fetch for good.
- An uninitialized provider passed as bearer_token_provider= raises the
ConfigError ValueError an uninitialized oidc_auth= does, and a
non-str name raises TypeError.
* fix(build): keep PyPy builds importable with Cython 3.3.1
Cython 3.3.1 builds PyPy's extension types from type specs by default
(cython/cython#7947). For a cdef class that declares both
`cdef dict __dict__` and `cdef object __weakref__` -- Sender,
_TokenProviderHandle and _ApplicationTokenProvider -- it puts two
Py_tp_members slots in the spec, which the interpreter rejects when the
module is imported:
SystemError: Multiple Py_tp_member slots are not supported
so the linux_x64_pypy wheel job failed at `import questdb`. CPython
rejects the same spec when type specs are on; it builds static types by
default, so it is unaffected.
Define CYTHON_USE_TYPE_SPECS=0 for PyPy builds, keeping the static
types PyPy used up to Cython 3.3.0.
* docs(auth): list unix_sock among rejected PG destination keys
The PG-wire adapters reject unix_sock in connect_args / connect_kwargs
like the other destination keys -- pg8000 dials that Unix socket
instead of the validated host -- and the CHANGELOG and the adapter
docstrings already say so, but the guide in docs/auth.rst left it out.
The comment explaining _DESTINATION_PARAMS now covers it too.
* update submodule
* update submodule
* update submodule
* docs(auth): say when a permanent source failure ends a connection
The token-provider guide said a connection the caller waits for -- a
synchronous initial connect, or an eager connect or pool borrow with
initial_connect_retry=on -- fails at once when the source of a
RefreshingTokenProvider raises TokenUnavailableError with
retryable=False. The connection does not retry that failure, but the
provider's cold wait comes first: the provider retries a failed fetch
whatever its classification, and the connection waits up to cold_wait
for a retry to succeed. With the default options a synchronous connect
failed only after about 21 s.
That wait follows the dynamic-credential specification (§5.3, §5.4)
and matches the Java client. The C header now describes it the same
way (questdb/c-questdb-client#228), and the guide now says a permanent
failure ends the connection when the provider's cold wait does.
A new test covers it: through a refreshing provider with a 0.5 s cold
wait, a permanent source failure is retried within the wait and ends a
synchronous connect after it, well inside the connect's 10 s budget.
* update submodule
* fix(auth): type bearer_token_provider on every entry point
The type stubs declared bearer_token_provider as Optional[Any] on
QuestDB.from_conf, Sender, Sender.from_conf and Sender.from_env, and
questdb.connect left it unannotated, so a type checker accepted any
value there -- an int, or the token string itself -- and the mistake
surfaced only at runtime. They now take the
Union[BearerTokenProvider, Callable[[], str]] that the PG adapters
already accept. connect() imports BearerTokenProvider only for type
checkers, so importing questdb still does not load questdb.auth.
The typing fixture now passes a refreshing provider, an object with
token(), a callable and a bound token() through the five entry points,
and marks a wrong value on each as a type error that
--warn-unused-ignores keeps honest.
* update submodule
* test(auth): fix login capture race and optional pandas guard
* Update examples/oidc_device_auth.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* fix(auth): resolve connect type hints at runtime
* fix(auth): update native pin for exception-safe token copying
Pull in questdb/c-questdb-client#228 at 5de775e975fa4d17be8b2cd5e71d79d38e79f4cf, which frees the native token if the C++ string copy throws.
* fix(auth): normalize oversized token timing arguments
* fix(auth): defang embedded schemes in refused sign-in prompts
Update the native pin to include renderer callback deadline accounting.
* update submodule
* Update native client with bounded cold-wait test
* fix(auth): align terminal failure cancellation semantics
Pin the native client to 29468d7e2670792217423f6bba91c8989c565991,
which commits terminal device-flow failures before renderer callbacks.
Document cancellation during on_failure as a no-op and verify that the
original denial or timeout survives while the provider remains reusable.
* fix(auth): pin native sign-in recovery fix and add regression
* test: measure promoted column allocations instead of RSS
* fix(auth): report ExpiringToken expiry as datetimes
ExpiringToken stored expires_at and refresh_at as float epoch seconds, even
when they were given as timezone-aware datetimes, while
RefreshingTokenProvider.status reports token_expires_at, last_success_at and
last_failure.at as datetimes. Ordering the two raised TypeError, and ==
returned False for the same instant.
The attributes now hold timezone-aware UTC datetimes; the constructor still
accepts a datetime or epoch seconds. ExpiringToken is new in the unreleased
6.1.0, so no released API changes.
* fix(auth): pin the native refresh-spacing and status-padding fixes
Picks up questdb/c-questdb-client#228 commits 985e472a and 87a7ee12:
- A RefreshingTokenProvider with min_refresh_interval below a millisecond
-- 0, or up to 0.0004 s, which this wrapper rounds to 0 ms -- no longer
fetches without pause while its source returns a refresh hint at or
before receipt, as Azure Identity does with a cached token during an
IMDS outage. The new test counts source calls over 0.3 s: about 40,000
before, at most 300 now.
- questdb_token_provider_get_status zeroes the padding of its snapshot.
* docs(auth): say that bearer_token_provider= refuses an OidcDeviceAuth
OidcDeviceAuth has a token() method, so it matches the BearerTokenProvider
protocol and type checkers accept it as bearer_token_provider=, but clients
refuse it there with TypeError: it must be attached as oidc_auth=. Say so on
the protocol, and correct the PG-wire paragraph and the adapters' docstring,
which said the adapters accept exactly what bearer_token_provider= accepts:
they also take an OidcDeviceAuth.
* fix(auth): pin the native fix for cut-off device-flow poll replies
Picks up questdb/c-questdb-client#228 commit 886b497f.
OidcDeviceAuth.sign_in() no longer fails with OidcDeviceFlowError ("the
identity provider rejected the request") when a token-endpoint poll reply
is cut off after its status line: an early close or reset, or a body that
stalls past the timeout. It keeps polling, as it already did when a poll
got no reply at all, so a user still approving the code in the browser can
finish signing in. A complete non-JSON reply is still a rejection.
* test(auth): cover a device-flow poll reply cut off mid-body
OidcTestServer can now cut a token-endpoint reply off: an override body
wrapped in TruncatedBody is sent with the whole body's Content-Length, but
only its first half goes out before the connection closes.
The new test cuts off the first device-grant poll's authorization_pending
reply. With the previous native pin, 87a7ee12, sign_in() raised
OidcDeviceFlowError ("the IdP rejected the token request ... Peer
disconnected") after one poll. With 886b497f it polls again and signs in.
* fix(auth): pin the native shared-401 and sign-in target fixes
Picks up questdb/c-questdb-client#228 commits 7f2b01f1 and fab63e5b:
- Senders that share a RefreshingTokenProvider all replay a 401 for the
same token with its replacement. A rejection inside
forced_min_interval got the rejected token straight back while the
forced fetch was still running, so every ILP/HTTP flush but the first
failed with AuthError and dropped its batch.
- A device-flow sign-in no longer opens, links or QR-encodes a loopback
https:// URL that a remote identity provider hands out. Only a
loopback IdP may name a loopback target, over either scheme.
The RefreshingTokenProvider.on_rejected() docstring and the comment on
the fallback URL vetter say so.
* fix(auth): accept datetime.max expiries and lone-surrogate refusals as ConfigError
ExpiringToken(token, datetime.max.replace(tzinfo=timezone.utc)), the
usual Python way to say that a token does not expire, was rejected as
outside the datetime range, against the docstring: the expiry went
through a float, which rounds past the last microsecond near the year
9999, and a provider whose source returned it never became ready, so
every client failed after cold_wait. An aware datetime is now checked by
its UTC instant and clamped to 9999-12-31T23:59:59.999Z, the latest
instant native represents, as native clamps it. Epoch seconds and status
times no longer go through the C library's gmtime, which on Windows
stops at the year 3000.
RefreshingTokenProvider(name=...) and on_rejected(token) raised a bare
UnicodeEncodeError for a str with a lone surrogate, which
`except QuestDBError` missed although the API documents every bad
argument as a ConfigError. They now raise its ValueError, as
OidcDeviceAuth does for the same input.
ExpiringToken.expires_in's docstring now says that refresh_at is an
instant, as for the constructor, not a delay like lifetime: a refresh_in
passed as is reads as an instant in 1970, and the provider then refreshes
every min_refresh_interval.
Tests: test_the_latest_instant_means_no_expiry and the new surrogate
cases in InvalidArgumentErrorTest fail without the fix.
* fix(auth): keep gevent greenlets apart in token-provider callbacks
With gevent, a token provider that waits on I/O suspends its greenlet
inside the token callback while the other greenlets on the main thread
run. The client counted those callbacks per OS thread, so it took every
greenlet for the suspended one:
- Interpreter exit hung for good when a greenlet was suspended in a
provider at exit. The exit hook waited for every admitted callback,
but the greenlet could only resume once the main thread, blocked in
that wait, ran the hub again. Ctrl-C did not end it; only SIGTERM or
SIGKILL did. The callback gate now counts the main thread's callbacks
apart, and the drain skips them when the main thread itself drains:
only a suspended greenlet can hold one then. A drain on another
thread still waits for them.
- A gevent.Timeout or the GreenletExit of kill() thrown into a greenlet
inside its provider is not an Exception, so it is parked like a
signal, and it was raised in whichever greenlet ran next: another
greenlet failed with B's Timeout, B never saw it, and a killed B ran
on. A parked exception now records its greenlet and is raised only
there; one whose greenlet died is dropped.
- While one greenlet waited in a provider, every other greenlet counted
as inside a token callback, so its QuestDB.close() or lease wait gave
up after two seconds ("cannot wait ... inside a token-provider
callback"). Such waits are now bounded only in the greenlet that is
inside the callback.
The main thread's regions where a parked exception must not be raised
-- token callbacks, diagnostic dispatches, dataframe serialization --
are tracked per greenlet. Without greenlets, or for a region entered
before greenlet was imported, they count for the whole thread as
before, and the main greenlet keeps the existing delivery order. On
PyPy, whose greenlet module is Python code, greenlets are not told
apart.
The docs and changelog say that exit does not wait for a greenlet
suspended in a provider call, so its flush never finishes.
Tests: the three TokenProviderGreenletTest tests, which run gevent in a
child interpreter and skip without it, fail without the fix: the exit
and close() children time out, and A raises B's Timeout.
* fix(auth): pin the native token-store, sign-in target and forced-refresh fixes
Pins questdb/c-questdb-client#228 at 6df7aa67, which:
- refuses a symlinked OIDC token store however its path is spelled. A
trailing separator (`FileTokenStore('<dir>/link/')`, or the same in
QUESTDB_CLIENT_OIDC_TOKEN_STORE_DIR) passed the symlinked-leaf check,
and a sign-in then chmodded and wrote the link's target;
- refuses every spelling of the local machine as a browser sign-in
target from a remote identity provider: `127.1`, `2130706433`,
`0x7f.0.0.1`, IPv4-mapped loopback, unspecified addresses and
`*.localhost` got past the loopback refusal;
- returns from a RefreshingTokenProvider's forced refresh at once when
failure backoff lets no fetch start before forced_wait ends. Every
ILP/HTTP flush answered 401 while the provider backed off stalled
forced_wait (5 s) before failing with the same 401. The on_rejected()
docstring says so;
- passes on a C++ provider's escaping line_sender_error unchanged, and
links the OIDC headers from the C and C++ guides. Neither affects
this binding.
* fix(auth): treat what a provider can never recover from as permanent
Two application-provider failures that no retry can fix were reported
to native as retryable:
- A token() that returns something other than a str (bytes from
base64.b64encode() or response.content, None) or a str that is not
valid Unicode (a lone surrogate from a surrogateescape-decoded file or
environment variable). The binding refuses it before native sees it,
and reported a retryable failure, so a connect the caller waits for
and QuestDB.dataframe() called the provider until the reconnect budget
ran out -- five minutes by default -- while an empty or non-printable
token already failed at once. It is now reported as permanent: those
calls and an ILP/HTTP flush end at once. Background reconnects keep
retrying, as for any classification. The message names the type or
the position, never the token.
- A closed OidcDeviceAuth reached through a provider of one's own,
bearer_token_provider=lambda: auth.token(). Its OidcCancelledError
was retried for good: a QWP/WebSocket sender kept reconnecting and
reporting CredentialUnavailable with SocketError, and an ILP/HTTP
flush used up retry_timeout. The error is now marked as a closed
RefreshingTokenProvider's is, so closing the auth ends the provider's
clients, reported as ConfigError, as with lambda: tokens.token().
Tests: test_a_token_that_is_no_str_fails_at_once_without_leaking_it,
test_closing_an_oidc_auth_a_provider_calls_ends_its_clients and the
new cases of test_an_unusable_token_does_not_spin_dataframe_retries fail
without the fix.
* fix(auth): keep a signal that interrupts a callback's own error handling
The token-provider and OIDC callbacks park a Python signal handler's
exception for the caller, so a Ctrl-C or a SIGALRM deadline that lands
in one still interrupts the flush or sign-in that ran it. Three windows
lost it instead:
- Classifying an application provider's failure runs Python: the
signal-handler test calls into the `signal` module, and the failure's
text runs its __str__. A handler that raised there was swallowed with
the failure, which was reported as "the token callback failed". On
the on_rejected() path it escaped the noexcept callback and was printed
as unraisable. The snapshot of installed handlers taken before the
call, Python too, had the same gap.
- A second interruption during sign_in() -- two signals together, or the
first one's queued sibling raised by its pending call -- was dropped
when it arrived while a SUCCESS or FAILURE event was rendered: the
provider keeps one interrupt to raise.
The token callbacks now park an exception raised while they examine a
failure, as the OIDC dispatchers already did, and the event path queues
a second interrupt for the main thread. sign_in() raises the first and
the second surfaces at its native-return boundary, chained to it.
Tests: test_a_signal_while_a_provider_failure_is_classified_reaches_the_caller
and test_a_second_interrupt_at_sign_in_success_is_not_lost fail without
the fix.
* docs(auth): say PyPy keeps a provider-owned client alive through a lease
A provider may own the client it is attached to: an object that
implements token() and keeps its own QuestDB or Sender. CPython collects
such an object together with its unclosed client, and so does PyPy,
since the client keeps the provider in its instance dictionary. On PyPy
that stops holding once the object also holds an unclosed lease or
QueryResult of that client: a lease or cursor holds the client and its
reader in typed fields, which PyPy's collector cannot see, so the
object, the client and its connections stay alive until the process
exits.
Moving those references where PyPy sees them is not a fix: a value set
through the generic attribute protocol lives in PyPy's own instance
dictionary, which __dealloc__ cannot read, and every lease and cursor
release path needs it there. The token-provider guide now says to close
such leases and results, as the API docs already ask, and the reader
handle's comment no longer claims cycles through it are collectable
everywhere.
* docs(auth): scope sqlalchemy_engine's sign-in note to OidcDeviceAuth
The docstring told every caller to sign in first, and said a connection
made before any token was acquired raises OidcInteractionRequired
rather than blocking the pool. That holds for an OidcDeviceAuth only.
The function also takes a RefreshingTokenProvider, which has no
sign_in(), and whose token() waits up to cold_wait for a token and then
raises TokenUnavailableError, and any other provider, which behaves as
its own token() does.
* fix(auth): keep a provider failure that cannot be printed out of later code
Classifying a bearer_token_provider's failure formats it, which runs the
exception's __str__. On the main thread, any exception raised while the
failure was classified was parked as if a signal handler had raised it.
A failure whose __str__ itself raises -- a provider's own error type
that reads a response an unreachable identity provider never sent --
interrupted nothing, yet the flush then failed with "the token callback
was interrupted", and the __str__ error was raised again on the main
thread once the flush's error had been caught: inside the caller's
`except QuestDBError` block, in a context manager's __exit__, at
threading shutdown. One for every token request the flush made -- 16
with the default retry_timeout -- and a SystemError at interpreter exit.
Such an exception is now parked only when it is no Exception, such as
KeyboardInterrupt, or the signal-handler test attributes it to a
handler, using the handler snapshot taken before the provider ran;
anything else is reported as "the token callback failed", as on any
other thread. on_rejected() errors use the same test. A deadline that a
signal handler raises while a failure is classified still reaches the
caller.
Tests: test_an_unprintable_provider_failure_stays_in_its_call fails
without the fix, with pending calls queued and with the native-return
fallback; test_a_signal_while_a_provider_failure_is_classified_reaches_the_caller
still passes.
* docs(auth): say that a TokenUnavailableError never stops reconnects
An application bearer_token_provider stops its clients' background
reconnects by raising its own QuestDBError with code InvalidApiCall. A
TokenUnavailableError is a QuestDBError, and its public `code=` accepts
InvalidApiCall, but clients classify one by `retryable` alone and keep
reconnecting -- deliberately, as native keeps a token-unavailable error
apart from InvalidApiCall. The CHANGELOG ("except QuestDBError with code
set to QuestDBErrorCode.InvalidApiCall that an application provider
raises itself, which stops them") and token_providers.rst ("Only an
InvalidApiCall your provider raises itself has that effect") read as if
it stopped them, so a provider that raised
TokenUnavailableError(..., code=InvalidApiCall) got endless reconnects
and CredentialUnavailable events with cause SocketError instead of a
ConfigError.
The CHANGELOG, token_providers.rst and the TokenUnavailableError,
BearerTokenProvider and ConnectionEventKind docstrings now say to raise
a plain QuestDBError, and that a TokenUnavailableError's code only
labels it. Behaviour is unchanged.
* docs(conf): document the request_durable_ack levels this release accepts
The c-questdb-client pin brings in questdb/c-questdb-client#208, so
request_durable_ack now also accepts local, replicated and
local,replicated, and sends them to the server. The configuration
reference still listed only 'on' and 'off', described for Enterprise
object storage, and the 6.1.0 CHANGELOG did not mention the new values,
which the previous release rejected.
docs/conf.rst now lists every value, what each acknowledgement means and
which servers grant it: local needs cairo.commit.mode=adaptive, which
QuestDB 10.1.0, Enterprise 4.1.0 and earlier lack; replicated is on's
new name, Enterprise only, and Enterprise 4.1.0 and earlier know only
on. It also says that the store-and-forward queue keeps a frame until
its durable acknowledgement, while this client's acknowledgement waits
-- PooledSender.wait(), flush(wait=True), await_acked_fsn() -- wait for
the ordinary OK acknowledgement. The CHANGELOG gains an entry.
* fix(auth): pin the native display-text cap and provider-close docs
Pins questdb/c-questdb-client#228 at 2a443686, which:
- counts every non-spacing mark against the display sanitizer's cap of
four marks on one base character. A combining mark outside its list of
stacking blocks ended the run, so interleaving one between listed
marks kept a whole "Zalgo" stack in an identity provider's error text.
This binding's own renderers and OidcError messages already applied
the full cap; a custom Renderer's on_failure() received the native
text;
- documents that closing a token provider does not wait for a fetch
already running. Python's RefreshingTokenProvider.close(wait=True)
already offers that wait.
* test(auth): give the token() interrupt test the default IdP timeout
test_interrupt_in_persistence_diagnostic_reaches_token failed on the
linux_arm64_manylinux_a release leg (cp312) with OidcNetworkError
"Failed to reach .../token: timeout: global".
Before it sends a refresh, native tombstones the stored parent token:
it takes the store lock, unlinks the entry and fsyncs the directory.
That time counts against the request's timeout, and the test inherits
the helper's 5 s. A plain OidcNetworkError, not OidcInteractionRequired,
means the request was never sent, so the agent spent all 5 s on that
local work. Stalling directory fsyncs for 6 s reproduces the same error
locally. With the library's 30 s default, the test passes.
* update submodule
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
## Summary - Document OIDC device-flow sign-in and rotating bearer-token providers for C/C++ and Rust 7.3.0+, and Python 6.1.0+, with language-specific examples. - Cover discovery, issuer pinning, scopes, silent refresh, token persistence, provider ownership, error handling, and shutdown. Include Python notebook support, managed identities, and PGWire adapters. - Replace obsolete unsupported-authentication claims and align the shared OIDC, connection-string, and QWP behavior references with the new provider and reconnect behavior. - Update connection-setup guidance to reflect eager pool initialization and where authentication failures surface. Related implementation PRs: questdb/c-questdb-client#228 and questdb/py-questdb-client#165.
Summary
Add OIDC device-flow sign-in and rotating bearer-token authentication to the Rust, C and C++ clients. Applications can share authentication across ILP/HTTP senders, QWP/WebSocket senders and readers, and connection pools, without rebuilding clients whenever a token expires.
The implementation provides an interactive OIDC helper and a general-purpose token-provider API for application-managed credentials. Rust enables the OIDC helper with the
oidcfeature; the C ABI always includes it.OIDC device authentication
/settingsor supplied explicitly. Support issuer pinning, scope and audience overrides, and access-token or ID-token selection for groups-in-token mode.sign_in()displays the device code and verification URL, optionally opens a browser, and polls for authorization. Custom renderer callbacks support application-owned UIs. Transport token lookups never prompt; they use cached credentials or silent refresh and reportInteractionRequiredwhen a new sign-in is needed. Silent refresh requires an IdP-issued refresh token, usually obtained by requestingoffline_access.slow_down, throttling, timeouts and interrupted responses within the device-code lifetime. Refresh uses bounded backoff andRetry-After; an ambiguous dispatched refresh does not blindly reuse a potentially rotated refresh token.TokenStoreor the bundledFileTokenStore, with cross-process locking and durable refresh-token rotation. The file store writes plaintext credentials under restrictive permissions; mutations currently require Unix, while non-Unix reads remain available for migration to a custom store.clear()removes cached and persisted local credentials without revoking them at the IdP;close()permanently disables the shared auth and stops attached clients on their next token pull. Freeing one handle only releases its reference.Rotating bearer-token providers
BearerTokenProviderfor application-supplied credentials andRefreshingTokenProviderfor a shared cache backed by aTokenSource. Sources can integrate an external identity SDK, an OAuth flow or a secrets manager; no particular identity SDK is built into the client.insufficient_scopedo not trigger a refresh replay.The native API adds
oidc.h/oidc.hpp,token_provider.h/token_provider.hpp, sender and reader attachment points, and extensible pool options throughquestdb_db_connect_ex.Transport integration and diagnostics
auth_failed) from failure to acquire a credential (credential_unavailable). Preserve structured OIDC and token-provider diagnostics through C/C++ exceptions, pool errors, reader failover and sender wait/drain timeouts.execute()after an exhausted mid-query failover, so a later credential recovery does not require rebuilding the reader.Security
Require HTTPS for non-loopback IdP endpoints, validate endpoint origins and browser targets, and sanitize untrusted prompt/error text. Remote IdPs cannot supply literal local-machine browser targets, including alternate numeric address spellings; this does not attempt DNS-rebinding protection. Token values are validated before entering authorization headers, known credentials are redacted from diagnostics, and owned native token buffers are zeroized on release. The file store rejects symlinked store directories, including paths with trailing separators or
.components.Compatibility notes
ReaderConfig::upgrade_headers()now returnsResult<Vec<_>>. Resolving a provider can fail. Callers must handle the result, for example with?; configurations without a provider never returnErr. There is no corresponding C/C++ API change.auth_failedevent therefore does not always mean a terminal stop. Rejection before the first successful connection or during a caller-awaited connect/pool borrow still fails that operation. Applications that want to give up must close the sender. An orphan drainer with rejected static credentials leaves the slot for a later session.token_provider,azure_resource,azure_client_idandazure_credentialnow produce a configuration error instead of being silently ignored by ILP schemas. Attach providers through the in-code API.request_durable_ack=on, borrow-with-retry waits within its budget for a primary instead of immediately returningProtocolVersionError; budget exhaustion retains that error code.Tests and documentation
Add Rust, C ABI and C++ coverage for device authorization, refresh and 401 replay, concurrent cancellation and shutdown, callback ownership/re-entry, persistence and lock recovery, token redaction, malformed responses, reader failover, and store-and-forward recovery. Include deterministic refresh-clock tests, manual-progress deadline regressions, C++ exception-safety tests and C++17/C++20 variants. Extend the Cargo matrix with OIDC-only feature combinations and
ffi-supportcoverage for owned pool handles.Add Rust, C and C++ OIDC examples, a C token-provider example, API documentation and authentication/security guidance.
All checks on the current head (
99dd41a3) are green, including Linux/macOS/Windows builds and tests, ASan/UBSan, QWP live-server and fuzz suites, Rust MSRV/documentation and formatting/lint checks, and enterprise end-to-end tests.Companion Python bindings
questdb/py-questdb-client#165