Skip to content

feat(feature-flags): generalize driver-side cache - #496

Merged
cathleeny merged 10 commits into
mainfrom
cathleeny/general-driver-flags
Oct 13, 2026
Merged

cathleeny merged 10 commits into
mainfrom
cathleeny/general-driver-flags

Conversation

@cathleeny

@cathleeny cathleeny commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Move and generalize the existing telemetry feature-flag cache into internal/featureflags; retain all returned values and add six typed getters.
  • Share values by workspace ID, with normalized host as a fallback, and use authenticated transport supplied by each caller.
  • Honor the connector-service TTL, falling back to 15 minutes when it is missing or invalid.

Validation

  • Full unit suite: go test ./... passed.
  • Feature-flag and telemetry tests passed with the race detector.
  • Cold-load/workspace and stale-reader concurrency tests passed for 30 repeated race-detector runs.
  • The new stale-reader regression test failed before the fix and passed afterward.
  • go vet ./... and golangci-lint passed (0 issues).

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
@cathleeny cathleeny added the integration-test-kernel Preview the full passthrough kernel integration suite (live warehouse) label Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Go integration tests triggered (sea / passthrough). View workflow runs.

@cathleeny
cathleeny marked this pull request as ready for review October 7, 2026 17:38

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

Clean, well-tested migration of the telemetry feature-flag cache into internal/featureflags. No dangling references to the deleted telemetry/featureflag.go symbols remain in code; the Acquire/Release ref-count stays balanced (telemetry init only runs on the Thrift path, which implies !UseKernel, which guarantees a prior Acquire); and the stale-reader concurrency (whole-map replacement under lock + singleflight cold path + TryLock refresh) is race-safe. Two minor notes: (1) one Low finding on the unrelated KERNEL_REV bump; (2) telemetry/ADDING_FEATURE_FLAGS.md (not in this diff) is now stale — it instructs developers to edit the deleted featureflag.go and references removed getFeatureFlagCache()/getAllFeatureFlags()/isTelemetryEnabled APIs, so it should be rewritten for the new Cache/typed-getter surface in a follow-up.

Comment thread KERNEL_REV Outdated
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
@github-actions github-actions Bot removed the integration-test-kernel Preview the full passthrough kernel integration suite (live warehouse) label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Integration test approval reset.

New commits were pushed to this PR. Label(s) integration-test-kernel were removed for security.

A maintainer must re-review and re-add a label to preview tests again. (The real gate runs in the merge queue.)

Latest commit: fe36481

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

Looks good — a clean, well-tested refactor that generalizes the feature-flag cache and correctly moves refcount ownership to the connector/conn lifecycle (Acquire in Connect, Release on error and in Close, balanced across kernel and Reyden-recovery paths). The go.mod/depguard changes properly accompany the new singleflight import, and the copy-on-write map replacement keeps the lock-free reads race-free. One low-severity note on cold-path singleflight context sharing.

Comment thread internal/featureflags/cache.go Outdated
@cathleeny
cathleeny requested a review from jay-xiao446 October 12, 2026 18:48
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 2 Low

Looks good — a clean, well-tested generalization of the telemetry flag cache into internal/featureflags. Acquire/Release reference counting is balanced across all connect/close paths (including Reyden→kernel recovery and kernel-skip), and the lock-free reads are safe because flags maps are published immutably. Two low-severity behavioral notes inline (stale-refresh context asymmetry; JSON-literal requirement for the new string getters) — neither blocks merge.

Comment thread internal/featureflags/cache.go
Comment thread internal/featureflags/cache.go
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 1 Low

Looks good — the feature-flags cache refactor is solid and well-tested (ref-count balance across Connect error paths and Close, cold-fetch singleflight, stale-reader non-blocking refresh, typed getters), with the depguard allowlist and go.mod direct-dep promotion correctly handled and no dangling references to removed symbols. One low-severity scope concern: an unrelated kernel C-ABI header change is bundled in.

Comment thread internal/backend/kernel/include/databricks_kernel.h Outdated
Comment thread internal/backend/kernel/include/databricks_kernel.h Outdated
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Comment thread connector.go Outdated
Comment thread connector.go Outdated

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No issues identified by the review bot.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>

@peco-review-bot peco-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict: 2 Low

Looks good — a clean, well-tested generalization of the telemetry feature-flag cache into internal/featureflags. The refcount lifecycle is correctly moved to connection ownership (balanced Acquire/Release across failed-open and Close, with a nil-guard against double release), the map-swap + singleflight concurrency design is sound and race-tested, and the depguard allowlist / go.mod direct-vs-indirect moves properly accompany the new singleflight dependency. Two low-severity notes only: a potential refresh-starvation edge under short-deadline readers, and a slightly misleading GetStringList error message.

Comment thread internal/featureflags/cache.go
Comment thread internal/featureflags/cache.go

@jay-xiao446 jay-xiao446 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm! thanks for addressing my comments

@cathleeny
cathleeny enabled auto-merge October 13, 2026 23:42
@cathleeny
cathleeny added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 59f8bae Oct 13, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants