Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(amazonq): Use the correct state for Q in remote environment #5575

Merged
merged 2 commits into from
Sep 19, 2024

Commits on Sep 18, 2024

  1. fix(amazonq): Use the correct state for Q in remote environment

    Problem:
    
    As part of our design we intentionally separate the Auth state between a local environment, versus a remote (ssh'd) one.
    We do this so that if the user has 2 IDE instances, one local and the other remote, if one changes its auth state
    the other one will not be affected.
    
    The reason for separating auth that I can remember is due to how we store the actual tokens on disk.
    Because the remote does not have access to the disk of the local, we need to ensure the remote operates its
    auth independently of the local auth.
    
    By design globalState is shared by both local and remote instances. So for local we need to ensure we do not use the
    base globalState, otherwise the same Auth state as the remote will be used.
    
    The problem, SecondaryAuth is not doing this for all cases. It is using the globalState when it should be asking Auth
    which state it should use. The happy path was working though, but there can be potential issues with this bug
    at some other point.
    
    Solution:
    
    Expose the state that Auth is using so that something like SecondaryAuth can ask Auth for the correct state object
    depending on the local vs remote.
    Signed-off-by: Nikolas Komonen <[email protected]>
    nkomonen-amazon committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    55021d2 View commit details
    Browse the repository at this point in the history
  2. fix failing test

    due to this change one of the tests needed a slight update to work again due
    to a race condition that occurs during testing since we do not know when all
    the required event emitters are fully completed.
    
    In this case the onDidDeleteConnection event handler in SecondaryAuth was async
    and the unit test completed before the handler finished. This caused the test to fail.
    
    Signed-off-by: nkomonen-amazon <[email protected]>
    nkomonen-amazon committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    9a034ff View commit details
    Browse the repository at this point in the history