Repository navigation
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12261 +/- ##
==========================================
+ Coverage 83.23% 83.25% +0.01%
==========================================
Files 530 532 +2
Lines 124922 125069 +147
Branches 5312 5341 +29
==========================================
+ Hits 103981 104122 +141
- Misses 20147 20151 +4
- Partials 794 796 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude finished @bsod90's task in 3m 4s —— View job No blocking bugs; 0 high, 3 medium, 2 low. The swap and install logic holds up. The findings are an observability gap, stale docs, and a design limit. Review detailsFindings (posted inline)
Checked and found sound
Notes (not posted)
Review threadsThe listing returned 0 of my own threads: none resolved, none re-affirmed (no prior threads). Progress
|
|
Claude finished @bsod90's task in 3m 7s —— View job Review of PR #12261: no correctness bugs found. Findings: 0 high, 1 medium (docs), 3 low. Details
Findings
Checked and OK
Design note (not posted inline)A swap rebuilds every data source on the orchestrator together. One data source that is down blocks rotation for all the healthy ones: every 10 s one request fails, and the rest keep the old, possibly expired, credentials. This is documented, but per-data-source swaps would contain the damage if multi-source orchestrators matter. Not run
Review threadsThe listing returned 0 threads of mine: none resolved, none re-affirmed. I posted 3 new inline comments. |
|
Claude finished @bsod90's task in 2m 25s —— View job Looks good, no blocking issues: 0 high, 0 medium, 2 low (both posted inline). Review details
Findings
Checked and found sound
Not in scope, noted for context
Review threadsThe listing returned 0 prior threads of mine, so none were resolved or re-affirmed. |
|
Claude finished @bsod90's task in 2m 36s —— View job No blocking issues at c85d411: 0 high, 0 medium, 1 low (dead state fields). Review details
FindingsLow: dead fields on Checked and fine
Not run
Review threadsThe listing returned 0 of my own unresolved threads: none to resolve and none to re-affirm. The one finding above was posted as a new inline comment. |
|
Claude finished @bsod90's task in 2m 14s —— View job No issues found (0 high, 0 medium, 0 low). Nothing posted inline. Review details
What I checked in
|
|
Claude finished @bsod90's task in 2m 36s —— View job Review of 4f458c6: 0 high, 1 medium, 1 low. A stream that outlives the query timeout still loses its driver, and the docs no longer say so. DetailsFindingsMedium: a stream that outlives the timeout loses its driver (
Low: PR description is out of date
Checked, no issue
TestsI didn't run them: the checkout has no Review threadsThe listing returned 0 of my threads, so I resolved none and re-affirmed none. I opened 1 new inline thread. Progress
|
|
Claude finished @bsod90's task in 58s —— View job No issues in cd2920e (docs only): 0 high, 0 medium, 0 low. Review details
What I checked
Review threadsThe listing returned 0 of my own unresolved threads, so there was nothing to resolve or re-affirm. No inline comments were posted this round. |
|
@paveltiunov |
|
Claude finished @bsod90's task in 1m 59s —— View job No new issues at Review details
What I checked since the last roundThe latest-wins queue is gone (
PR description is staleNone of this changes the code; it only affects reviewers reading the description:
Review threadsThe listing returned 0 of my own threads, so none were resolved or re-affirmed. |
|
@claude please review the new commits on |
|
Claude finished @bsod90's task in 1m 16s —— View job Review of Details
Removals
Waiter on drivers built for no version (
|
|
@claude please review |
|
Claude finished @bsod90's task in 43s —— View job Review of Details
Medium: the example still makes the readiness probe report DOWN (
|
|
Claude finished @bsod90's task in 1m 41s —— View job No issues in Review details
What I checked
Not doneI could not run jest: running Review threadsThe listing returned 0 of my own unresolved threads, so none were resolved or re-affirmed. The user-facing docs requirement is met: |
|
Medium fixed in @claude please re-review. |
|
Claude finished @bsod90's task in 43s —— View job Review of Details
Following the probe through the exampleThe standalone
Why the service credential can't serve a tenantThe probe's driver lives in the Consistency
Optional nit (not a defect)In this example the probe's drivers sit in their own orchestrator, so the exception for "drivers built for no version" never triggers here. It only matters when the probe shares an id with real requests. The text is accurate as a general rule, so no change is needed. Not done
|
|
Claude finished @bsod90's task in 38s —— View job Clean: no issues at Review details
What changed since the last round
The new comment in the code ("which no versioned request uses") matches what happens at runtime. In this example the probe resolves to its own orchestrator id ( I also re-read Review threadsThe listing returned 0 of my own unresolved threads, so there was nothing to resolve or re-affirm. |
|
@claude please review |
|
Claude finished @bsod90's task in 32s —— View job Review of Details
Low: "bound to a data source for passthrough" is not defined anywhere (
|
|
Claude finished @bsod90's task in 1m 10s —— View job Review of Details
ScopeSince FindingsLow: Verified
Review threadsThe listing returned 0 of my own unresolved threads, so none were resolved or re-affirmed. |
|
Claude finished @bsod90's task in 30s —— View job Review of Details
What I checked
Not done
|
|
Claude finished @bsod90's task in 52s —— View job No issues found in Review details
ScopeThe only change since
|
|
@paveltiunov ready for review at |
8f0bd74 to
7909641
Compare
|
Claude finished @bsod90's task in 1m 40s —— View job Review of
|
…version changes Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LNEgK1REDundqTqsVrpApd
|
Claude finished @bsod90's task in 2m 12s —— View job No issues found at Review details
What I checked
Not runI didn't run the unit tests ( Review threadsThe listing returned 1 of my own unresolved threads, and I resolved it:
No threads re-affirmed, no new inline comments. |
|
@paveltiunov ready for review at |
The problem in plain words
server-corebuilds one driver per orchestrator and data source, from the context of the first request that reaches it, and never rebuilds it. When adriverFactoryderives credentials from the security context (a per-user OAuth or OIDC token), the driver keeps the first token forever. Once that token expires, every reconnect fails until the process restarts. This is the bug class behind several customer escalations (Snowflake and Databricks per-user OAuth).The fix: an explicit
driverVersionA new option,
driverVersion(context) => string. It runs on every orchestrator lookup: once per API request, more often during a scheduled refresh run, and for the readiness probe with an empty context. When the string changes for an orchestrator,server-core:driverFactoryand the current context in the background, and runstestConnection()on them. The request does not wait: it and every request until the swap are served by the current drivers;executionTimeout, which default toCUBEJS_DB_QUERY_TIMEOUT(10 min). No separate delay to configure.If the new drivers fail, the error is logged, the old ones stay and the same version is not retried for 10 s. A version asked for during a swap is not queued: a later request swaps to it. The first request after the readiness probe, when no driver is cached yet, just adopts its own context. Drivers built for no version, such as the readiness probe's (possibly a fallback credential), never serve a versioned request: it waits until a switch installs drivers for a version, its own or another request's, and fails if its own cannot be built. The contract for callers: change the version while the previous credential is still valid. The trigger is explicit: no config fingerprinting, no expiry parsing. The application decides what "a new credential" means.
flowchart LR R[request] --> V{driverVersion<br/>changed?} V -- no --> C[cached driver] V -- yes --> C V -- "yes, in background" --> B[build + testConnection<br/>new drivers] B -- ok --> SW[swap into cache] SW --> REL[release old drivers<br/>after the query timeout] B -- fails --> KEEP[keep old drivers<br/>back off 10 s]What this PR changes
server-core/src/core/OrchestratorDrivers.ts(new)getDriver(the driver factory),ensureVersion(the per-request check: starts a background swap unless one is running, backoff), andswap: rebuild every cached driver from the new context, install them in one synchronous step, schedule the old ones' releaseserver-core/src/core/SwappedDriverReleases.ts(new)server-core/src/core/server.tscheckDriverVersioningetOrchestratorApi,resolveDriverVersion,buildDriver, and re-lookup of an evicted orchestratorserver-core/src/core/OrchestratorApi.tsisReleased()so a swap finishing after eviction installs nothingserver-core/src/core/OrchestratorStorage.tspeek()for the same checkserver-core/src/core/types.ts,optionsValidate.tsdriverVersionoptiondriver_versionconfig section; its Python and JavaScript examples handle the readiness probe's empty context: a fixed orchestrator id and a service credential fromdriver_factory.Also fixed on the way: without separate pre-aggregation credentials, a pre-aggregation lookup that came first could orphan a driver when the regular lookup overwrote the shared alias. Both lookup orders now share one cache entry.
Related work
Risks
contextToOrchestratorIdto separate whatever the version depends on; every swap is logged asDriver Swapdriver_version. Queries and pre-aggregation builds time out firstdriverVersionthrowsOff by default: nothing changes unless
driverVersionis set.Tests
packages/cubejs-server-core/test/unit/driver-version.test.ts, 33 cases (28 tests plus two parameterized tests with 3 and 2 cases): aqueueOptionsfunction that throws failing the swap before any driver is installed, requests served by the old drivers while the swap warms, drivers built for the readiness probe never serving a versioned request (it is served once another version's switch installs), a request waiting for a first version that starts no swap once its orchestrator is released, a throwing logger, swap with the new context, test-before-visible, concurrent single-flight, failure and backoff, a version asked for during a swap and swapped to by a later request, the first request after the readiness probe, release at the queue timeout (default,CUBEJS_DB_QUERY_TIMEOUT, and the longer of two queue timeouts) andreleaseConnections(), chained swaps, both alias orders, constructed-driver factories, lazy data sources after a swap, reinstall of an older driver, swap finishing after eviction or release, anddriverVersionerrors.orchestrator-drivers.test.ts(2 cases) covers the bound on remembered failed swaps directly. Each test was checked to fail with its code reverted. The full server-core unit suite passes (262/262).Verified on a staging deployment
An earlier revision of this PR (release after a fixed delay; the swap path is unchanged) ran under a real credential rotation: a Cube Cloud staging deployment on BigQuery (Workload Identity Federation), where every user's or group's token lives 10 minutes and the Cloud layer returns the token's issue time as the version.
🤖 Generated with Claude Code