Repository navigation
Reuse feature-flag responses across connections to the same host - #630
vuanhphung wants to merge 7 commits into
Conversation
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Low
Looks good, with 1 low concern. Idle retention, expiry on the monotonic clock, the LRU bound, and coalescing of in-flight fetches are correct, and the tests cover them. Nit: the CHANGELOG entry is a loose paragraph rather than a bullet with a PR reference like its neighbours.
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Resolve the main changes by merging (no force-push). Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Low
Looks good, with 1 low concern in the test setup. The idle-retention logic in FeatureFlagCache handles expiry, in-flight fetches and the size bound correctly. Global performance.now() is safe because the engines field requires Node 22 or later.
| await cycle(0); | ||
| await cycle(1); | ||
| expect(fetch.callCount).to.equal(1); | ||
| } finally { |
There was a problem hiding this comment.
🔵 Low — The e2e test asserts fetch.callCount === 1, but the flag fetch only happens in initializeTelemetry. That call is skipped when DATABRICKS_TELEMETRY_DISABLED is set, so the count would be 0 and the test would fail for reasons unrelated to caching. Clear and restore the env var around the test, or skip the test when it is set.
🔀 Found by Claude Opus 5.5 · confirmed by the judge
Resolve the main changes by merging (no force-push). Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
Every sequential Thrift reconnect refetches flags after the last client closes. Five rotated A/B runs measure 30 GETs per 30 reconnects and paired connect+openSession p50 186.94 -> 134.36 ms (28% faster). Skipping that GET moves a TLS handshake into the first OpenSession, so CONNECTION_OPEN operation_latency_ms p50 rises 65 -> 134 ms for sequential reconnects despite faster total setup; notify Node.js telemetry dashboard owners before release.
Keep main's sharing key unchanged (workspace org-id, otherwise normalized host), including active-request coalescing across auth types and SPOG hosts. Retain up to 100 idle successful responses for every auth type until their original monotonic expiry, without retaining credentials, connections or timers; successful responses without a valid TTL use the 15-minute default, while failures preserve shorter retry windows. The live TTL is 3600 s, so a server-side flag flip can take up to an hour to reach a reconnecting app, the same as a long-lived client on main.
Local verification: 1,836 unit tests, 29 live Thrift/kernel e2e tests plus a warm-suite isolation repro, lint/format/types/build, typed/null/limit/cancel checksums, and 1,000-cycle 64-MiB-heap lifecycle checks pass. OAuth mock runs substitute credentials, not real grants; live external-token runs use the issued token.
Adversarial review: converged in two rounds; bot re-review approved with no issues after fixing its one Low finding and changelog nit.
This pull request and its description were written by Isaac.