Skip to content

Conversation

@opieter-aws
Copy link
Contributor

@opieter-aws opieter-aws commented Apr 16, 2025

Problem

The business logic of auth-related features is complex and implemented separately for all IDEs. Flare/DEXP LSP server has implemented auth that can be reused for all IDEs. The source code was introduced, but not yet instantiated upon activation.

Follow up for #6958

Solution

  • Remove "amazonqLSP" experiment flag
  • Have regionProfileManager.ts depend on authProvider through IAuthProvider interface to remove circular dependency with AuthUtil
  • Deprecate getChatAuthState() API in favor of new getAuthState()
  • Instantiate and activate LSP client and new AuthUtil instance

NOTE: CI is expected to fail, since the reference updates for AuthUtil in the rest of code and unit tests have not been committed yet


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions
Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@opieter-aws opieter-aws marked this pull request as ready for review April 16, 2025 15:59
@opieter-aws opieter-aws requested review from a team as code owners April 16, 2025 15:59

// Create status bar and reference log UI elements
void Commands.tryExecute('aws.amazonq.refreshStatusBar')
void Commands.tryExecute('aws.amazonq.updateReferenceLog')
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume it's acceptable that this might be racey?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if you have a better suggestion let me know!

export const amazonQScopes = [...codeWhispererChatScopes, ...scopesGumby, ...scopesFeatureDev]

/** AuthProvider interface for the auth functionality needed by RegionProfileManager */
export interface IAuthProvider {
Copy link
Contributor

@hayemaxi hayemaxi Apr 17, 2025

Choose a reason for hiding this comment

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

Is this needed? RegionProfileManager is only used for Q. Why not just pass the Q specific utility class for it to use? AuthUtil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC that's what I attempted initially, but it introduces a circular dependency. See b381d0d#diff-b1c252677272c2b57d62cc5d3da2ee04c060e1db7432c3ea40ab00f9ab26558aR41-R59

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can revisit the implementation as a follow-up, merging the PR to unblock next PR with references

@opieter-aws opieter-aws merged commit b896e4f into aws:feature/amazonqLSP-auth Apr 17, 2025
3 of 22 checks passed
opieter-aws added a commit that referenced this pull request Apr 21, 2025
…dentity server for Amazon Q (#7088)

## Problem
The business logic of auth-related features is complex and implemented
separately for all IDEs. Flare/DEXP LSP server has implemented auth that
can be reused for all IDEs. The source code was introduced already
introduced in #6958 with
activation and client updates in
#7062. But the references
to `AuthUtil` through the codebase weren't updated yet.

## Solution
* Update all remaining references to `AuthUtil` in the codebase
* All `toolkits` unit tests are passing
* Disable telemetry and existing AuthUtil unit tests, to be updated in
follow-up PR
* `amazonq` and `web` unit tests still failing, to be addressed in
follow-up PR

**Note that CI is expected to fail for amazonq and web unit tests**



---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Co-authored-by: Justin M. Keyes <[email protected]>
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.

4 participants