Skip to content

Gate Throughput Bucket selector on preview registration#3198

Merged
mkrueger merged 3 commits into
mainfrom
fix/3189-throughput-buckets-feature-gate
Jul 14, 2026
Merged

Gate Throughput Bucket selector on preview registration#3198
mkrueger merged 3 commits into
mainfrom
fix/3189-throughput-buckets-feature-gate

Conversation

@mkrueger

Copy link
Copy Markdown
Member

Fixes #3189.

Problem

The Throughput Bucket selector in the Query Editor was shown for every non-emulator account, even when the Throughput Buckets preview is not registered on the subscription. Throughput Buckets is a subscription-scoped preview, so the account model alone doesn't indicate whether the feature is usable — resulting in a control that has no effect.

Fix

  • Query the subscription feature registration for Microsoft.DocumentDB/ThroughputBuckets and only show the selector when the feature state is Registered.
  • Fail closed (hide the selector) for:
    • Emulator connections
    • Connections without Azure subscription metadata
    • ARM unavailability or authorization errors
  • Default the webview state to hidden until capability detection resolves, avoiding a flash of the selector on startup.

Implementation notes

  • Added @azure/arm-features and a createFeatureClient helper (masks the subscription ID).
  • Split the registration check into a pure predicate (throughputBucketsFeature.ts) so it can be unit-tested without VS Code host dependencies.
  • Added 7 unit tests covering registered / case-insensitive / inactive states / unrelated features.

Files

  • src/cosmosdb/throughputBuckets.ts — connection-aware capability detection
  • src/cosmosdb/throughputBucketsFeature.ts — pure registration predicate
  • src/cosmosdb/throughputBuckets.test.ts — unit tests
  • src/panels/trpc/routers/queryEditorRouter.ts — gate wired into Query Editor init
  • src/utils/azureClients.tscreateFeatureClient
  • src/webviews/cosmosdb/QueryEditor/state/QueryEditorState.tsx — hidden default state
  • package.json / package-lock.json — new dependency

Validation

  • Focused unit tests: 7/7 passing
  • ESLint + Oxlint on changed files: clean
  • Editor diagnostics on changed files: none

Fixes #3189. The Throughput Bucket selector was shown for every non-emulator account, even when the Throughput Buckets preview is not registered on the subscription. Query the subscription feature registration for Microsoft.DocumentDB/ThroughputBuckets and only show the selector when the feature state is Registered; fail closed for emulator, missing Azure metadata, and ARM/authorization errors. Default the webview state to hidden until capability detection resolves.
@mkrueger
mkrueger requested a review from a team as a code owner July 10, 2026 12:06
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

✅ Build (Compile, Lint, Prettier, l10n, Package)

🧱 Step Results

  • Validate Version: ✅ success
  • Localization: ✅ success
  • Lint: ✅ success
  • Prettier: ✅ success
  • Compile (tsc): ✅ success
  • Package: ✅ success
  • External Skills (info): ✅ success

📥 Artifacts (run)

@github-code-quality

github-code-quality Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/vitest

The overall coverage in the branch remains at 76%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File 8536169 ef0d33c +/-
src/cosmosdb/th...cketsFeature.ts 0% 100% +100%

Updated July 14, 2026 09:47 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🧪 Tests (Unit + Integration)

🧪 Results

  • Unit Tests (vitest): ✅ success
  • Integration Tests (extension host): ✅ success

📈 Coverage

@mkrueger
mkrueger requested a review from bk201- July 10, 2026 12:13
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🎭 E2E Tests (Playwright + VS Code)

🧪 Result

  • E2E Tests: ✅ success

📥 Artifacts (run)

Tip: the HTML report artifact contains a self-contained Playwright report.
Download the zip, extract, and open index.html — or run
npx playwright show-report <extracted-dir> for the interactive view.

bk201-
bk201- previously approved these changes Jul 13, 2026
…uckets-feature-gate

# Conflicts:
#	package-lock.json
#	package.json
#	src/utils/azureClients.ts
@mkrueger mkrueger closed this Jul 14, 2026
@mkrueger mkrueger reopened this Jul 14, 2026
@bk201-

bk201- commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@microsoft-github-policy-service rerun

@mkrueger mkrueger closed this Jul 14, 2026
@mkrueger mkrueger reopened this Jul 14, 2026
@mkrueger
mkrueger merged commit afa3e02 into main Jul 14, 2026
17 of 21 checks passed
@mkrueger
mkrueger deleted the fix/3189-throughput-buckets-feature-gate branch July 14, 2026 09:58
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.

Throughput Bucket selector shown even when Throughput Buckets feature is not enabled on the account

2 participants