Skip to content

feat: Add AWS discovery with consistent multi-method sign-in - #1057

Open
BChoudhury-ms wants to merge 7 commits into
feature/aws-discoveryfrom
dev/bchoudhury/aws-discover
Open

BChoudhury-ms wants to merge 7 commits into
feature/aws-discoveryfrom
dev/bchoudhury/aws-discover

Conversation

@BChoudhury-ms

Copy link
Copy Markdown
Contributor

Summary

Add AWS DocumentDB discovery through the Service Discovery sidebar and New Connection flow. Reuse the existing Atlas-style onboarding UI and shared connection infrastructure to provide consistent sign-in, cluster browsing, and saved connections.

Changes

  • Add login cards for AWS profile, access key, browser SSO, and temporary credentials.
  • Support independent credential entries with remembered discovery regions, secure secret storage, and session-only temporary credentials.
  • Discover clusters across accounts and regions with tree/list layouts, refresh, deduplication, and partial-failure reporting.
  • Show cluster metadata, including VPC, subnet, and security-group information.
  • Integrate CA bundle selection, database authentication, database/collection browsing, and Save to Connections.
  • Add AWS SDK dependencies, regression tests, and contributor documentation.

How to test

  1. Run:
    npm run build
    npx jest --no-coverage src/plugins/service-aws-documentdb src/webviews/documentdb/awsCredentials
  2. Launch the Extension Development Host and open Service Discovery → AWS DocumentDB.
  3. Exercise each login card; verify the stages and navigation remain consistent with Atlas.
  4. For SSO, approve browser sign-in, select an account and role, then verify and save. Repeat with cancellation.
  5. Add multiple credential entries and select discovery regions; verify account/region grouping, flat-list mode, refresh, and cluster tooltips.
  6. Test an inaccessible region alongside a healthy region; confirm failures remain visible without hiding discovered clusters.
  7. With network access to a cluster, select its PEM CA bundle, enter database credentials, and browse databases and collections.
  8. Save a cluster to Connections, reload, and reconnect. Repeat discovery through New Connection → Service Discovery.
  9. Confirm temporary credential entries do not persist across extension sessions.

Risks

  • Review credential replacement, SSO cancellation/refresh, and secret-storage boundaries closely.
  • AWS sign-in does not provide database credentials or network access; managed tunneling and IAM database authentication are not included.
  • CA bundle paths are local to the extension host, and TLS certificate/hostname verification remains enabled.
  • VPC enrichment requires rds:DescribeDBSubnetGroups; denied access must not block cluster discovery.
  • Live AWS authentication, connectivity, and visual parity require manual validation.

Validation status

Case 1 (draft PR): the implementation build and focused tests ran during development. Full ready-for-review checks, including prettier-fix, are deferred until the PR is ready for review. Live AWS and visual validation remain outstanding.

Documentation

AWS discovery implementation and integration analysis

Work Item

Task 5835307 — [IMPL] AWS Discovery in vscode-documentdb extension

…lity

- Implemented AWS credentials webview controller and router for managing AWS credentials.
- Added tests for the AWS credentials controller and router to ensure functionality.
- Introduced SCSS styling for the AWS credentials webview.
- Created a schema for validating AWS credential inputs.
- Implemented SSO (Single Sign-On) flow handling for AWS credentials.
- Added error handling and telemetry for AWS credential operations.

Co-authored-by: Copilot <[email protected]>
@BChoudhury-ms
BChoudhury-ms changed the base branch from main to feature/aws-discovery November 3, 2026 08:38
@BChoudhury-ms
BChoudhury-ms force-pushed the dev/bchoudhury/aws-discover branch from 2311e8b to 5053371 Compare November 3, 2026 08:38
@BChoudhury-ms
BChoudhury-ms marked this pull request as ready for review November 3, 2026 08:38
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ CI passed: standard tier (ready PR)

Commit d556787, workflow run.

Layer Result Ran or skipped because
Static checks ✅ passed every push
Unit tests ✅ passed every push
npm packages: verify tarballs ✅ passed packages/**, package-lock.json or the CI workflow changed
VSIX: inspect contents ✅ passed ready PR
VSIX: self-test of the checks ✅ passed build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow changed
VSIX: activate in VS Code ✅ passed ready PR
VSIX: self-test of the activation check ✅ passed build/verification/**, build/vite/**, the Vite configs, package-lock.json or the CI workflow changed
Webview host in unbundled extensions ✅ passed packages/vscode-ext-webview/**, package-lock.json or the CI workflow changed
E2E ⏭️ not available yet arrives with the E2E iteration (full tier)

Full run: add the ci:full-requested label to run every layer once on the current commit.
No full run yet.

Code quality

Check Status How to fix
Localization (l10n) ✅ Passed Nothing to fix
ESLint ✅ Passed Nothing to fix
Prettier formatting ✅ Passed Nothing to fix

Build size

No size data for feature/aws-discovery yet; sizes only. VSIX: 8.7 MiB.

Artifacts: VSIX | Bundle-reports-41977803262 | L1-manifest-report-41977803262

All graphs (exact bytes)
Graph PR bytes
Collection View page (collectionView) 6,036,769
Document View page (documentView) 4,809,254
Local Quick Start page (localQuickStart) 1,551,905
Atlas Credentials page (atlasCredentials) 1,505,105
Cluster Dashboard page (clusterDashboard) 1,551,357
Activation (mainStartup) 3,791,822
Extension host (main) 10,454,153
Playground worker (playgroundWorker) 5,728,002
VSIX (vsix) 9,099,568
playgroundTsPlugin 6,175
viewsEntry 1,457,085
viewsAssets 80,340
awsCredentials 1,512,976
editorWorker 259,528
jsonWorker 389,389

Packaged bytes. Shared chunks count in every graph that loads them, so rows do not add up.

Updated in place on every run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Credential updates discard verified MFA sessions and can break discovery, while stale discovery error caches and a missing report-route entry cause additional refresh and verification failures.

4 open issues
What changed in this PR

Adds AWS DocumentDB discovery to the extension’s Service Discovery sidebar and New Connection flow, reusing shared onboarding, database browsing, and saved-connection infrastructure.

Changes:

  • Supports profile, access-key, browser SSO, and session-only temporary credentials.
  • Adds multi-account and regional discovery, tree/list layouts, infrastructure metadata, CA bundle selection, and connection diagnostics.
  • Integrates AWS dependencies, webview registration, regression tests, browser verification fixtures, and contributor documentation.

This remains Case 1 draft work. Full ready-for-review checks, including prettier-fix, are deferred; live AWS and visual validation remain outstanding.

File Description
vite.config.ext.mjs Bundles AWS credential providers.
src/​webviews/​documentdb/​awsCredentials/​AwsCredentialsView.test.tsx Tests onboarding stages, submission, and cancellation.
src/​webviews/​documentdb/​awsCredentials/​awsCredentialsRouter.ts Implements credential and SSO procedures.
src/​webviews/​documentdb/​awsCredentials/​awsCredentialsRouter.test.ts Tests validation, flow ownership, and cleanup.
src/​webviews/​documentdb/​awsCredentials/​awsCredentialsController.ts Manages credential panel configuration and lifecycle.
src/​webviews/​documentdb/​awsCredentials/​awsCredentialsController.test.ts Tests panel outcomes and configuration filtering.
src/​webviews/​documentdb/​awsCredentials/​awsCredentials.scss Removes default page padding.
src/​webviews/​_integration/​WebviewRegistry.ts Registers the lazy-loaded AWS view.
src/​webviews/​_integration/​WebviewRegistry.test.tsx Adds AWS lazy-loading coverage.
src/​webviews/​_integration/​appRouter.ts Registers AWS host procedures.
src/​plugins/​service-aws-documentdb/​types.ts Defines AWS credentials and discovery models.
src/​plugins/​service-aws-documentdb/​models/​AwsClusterModel.ts Defines stable cluster identity and readiness.
src/​plugins/​service-aws-documentdb/​models/​AwsClusterModel.test.ts Tests identity and readiness rules.
src/​plugins/​service-aws-documentdb/​discovery/​regions.ts Lists suggested discovery regions.
src/​plugins/​service-aws-documentdb/​discovery/​AwsDiscoveryService.ts Coordinates verification, caching, and discovery.
src/​plugins/​service-aws-documentdb/​discovery/​AwsDiscoveryService.test.ts Tests persistence, cancellation, and partial failures.
src/​plugins/​service-aws-documentdb/​discovery-wizard/​SelectAwsClusterSteps.ts Adds region selection and connection preparation.
src/​plugins/​service-aws-documentdb/​discovery-tree/​awsTree.test.ts Tests tree lookup and shared cluster behavior.
src/​plugins/​service-aws-documentdb/​discovery-tree/​AwsServiceRootItem.ts Renders discovery layouts and recovery actions.
src/​plugins/​service-aws-documentdb/​discovery-tree/​AwsClusterItem.ts Adds metadata, database authentication, and CA selection.
src/​plugins/​service-aws-documentdb/​credentialsManagement/​configureAwsCredentials.ts Implements credential management actions.
src/​plugins/​service-aws-documentdb/​credentials/​awsCredentialStore.ts Stores persistent secrets and temporary sessions.
src/​plugins/​service-aws-documentdb/​connect/​awsConnection.ts Validates CA bundles and constructs connection strings.
src/​plugins/​service-aws-documentdb/​connect/​awsConnection.test.ts Tests TLS configuration and certificate handling.
src/​plugins/​service-aws-documentdb/​config.ts Defines provider and command identifiers.
src/​plugins/​service-aws-documentdb/​AwsDiscoveryProvider.ts Connects discovery entry points and lifecycle.
src/​plugins/​service-aws-documentdb/​AwsDiagnosticsProvider.ts Explains certificate and network failures.
src/​plugins/​service-aws-documentdb/​AwsDiagnosticsProvider.test.ts Tests diagnostic matching and isolation.
src/​plugins/​service-aws-documentdb/​auth/​profiles.ts Enumerates profiles and controls MFA prompts.
src/​plugins/​service-aws-documentdb/​auth/​profiles.test.ts Tests profile metadata and MFA behavior.
src/​plugins/​service-aws-documentdb/​auth/​errors.ts Sanitizes AWS errors and supports cancellation.
src/​plugins/​service-aws-documentdb/​auth/​AwsSsoManager.ts Manages device authorization and token refresh.
src/​plugins/​service-aws-documentdb/​auth/​AwsSsoManager.test.ts Tests SSO polling, expiry, and cancellation.
src/​plugins/​service-aws-documentdb/​api/​documentDb.ts Verifies identities and enumerates cluster metadata.
src/​plugins/​service-aws-documentdb/​api/​documentDb.test.ts Tests enumeration, enrichment, and cancellation.
src/​documentdb/​ClustersExtension.ts Registers AWS providers and commands.
package.json Adds AWS dependencies and menu contributions.
docs/​ai-and-plans/​service-discovery-onboarding-roadmap.md Documents onboarding architecture and AWS scope.
docs/​ai-and-plans/​README.md Indexes AWS feature documentation.
build/​vite/​README.md Explains AWS credential-provider bundling.
build/​verification/​inspect.test.cjs Extends lightweight-view checks to AWS.
build/​verification/​inspect.cjs Includes AWS in packaged-view inspection.
build/​verification/​browser/​scenarios.ts Adds the AWS browser scenario.
build/​verification/​browser/​scenarios.test.ts Updates scenario and route expectations.
build/​verification/​browser/​runtime.ts Recognizes AWS browser fixtures.
build/​verification/​browser/​harness.test.ts Extends harness coverage to the AWS page.
build/​verification/​browser/​fixtures.ts Supplies AWS browser configuration and mocked responses.

Review effort: Balanced

Comment thread build/verification/browser/fixtures.ts Resolved
Comment thread src/documentdb/ClustersExtension.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Authentication retries can reuse revoked cached credentials, profile parsing drops valid indented properties, and the region picker blocks supported regions outside its hard-coded list.

3 open issues
4 resolved since last review

Review effort: Balanced

@tnaum-ms Tomasz Naumowicz (tnaum-ms) added this to the 1.1.0 milestone Nov 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Concurrent credential replacements can commit before generation invalidation, causing an AbortError despite a persisted change and leaving the identity cache inconsistent with the stored credential; per-credential serialization and a regression test are needed.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

High severity Serialize concurrent credential replacements and cache updates

src/​plugins/​service-aws-documentdb/​discovery/​AwsDiscoveryService.ts:351

When two panels replace the same temporary credential concurrently, both saves can commit before this generation invalidation runs. The second call then throws AbortError even though its replacement remains stored, while the identity cache contains the first replacement, so a failed update still changes the credential used by later discovery. Serialize each credential's commit, generation invalidation, and cache update together, and add a regression test for concurrent replacements.

3 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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.

3 participants