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

Connect My Computer: Keeping compatibility promise #31951

Merged
merged 18 commits into from
Sep 21, 2023

Conversation

gzdunek
Copy link
Contributor

@gzdunek gzdunek commented Sep 15, 2023

Contributes to #27881

This PR adds a compatibility information when the agent is not compatible with the cluster or is on a lower version and can be upgraded.
You can read more about it in the RFD [Agent versioning].
Short example: when the cluster is on version v15 it supports components (clients, nodes) that are on versions v15 and v14.

Setup

image

Status

Not compatible
image

Upgrade suggestion (I'm not sure if the copy reads well here, any recommendations are welcome)
image

@gzdunek gzdunek requested a review from avatus September 15, 2023 14:25
@gzdunek gzdunek force-pushed the gzdunek/cmc-compatibility-promise branch 2 times, most recently from bdeb65d to dd2bbab Compare September 15, 2023 14:34
@gzdunek gzdunek marked this pull request as ready for review September 15, 2023 14:35
@github-actions github-actions bot requested review from kimlisa and rudream September 15, 2023 14:36
@gzdunek
Copy link
Contributor Author

gzdunek commented Sep 15, 2023

@roraback WDYT of the proposed designs?

@gzdunek gzdunek force-pushed the gzdunek/cmc-compatibility-promise branch from dd2bbab to fad2508 Compare September 15, 2023 14:52
@gzdunek gzdunek mentioned this pull request Sep 15, 2023
8 tasks
Base automatically changed from gzdunek/do-not-omit-checking-permissions to master September 18, 2023 05:28
@gzdunek gzdunek force-pushed the gzdunek/cmc-compatibility-promise branch from fad2508 to bfacfa0 Compare September 18, 2023 08:10
Copy link
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

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

I was thinking if there's a way to simplify the logic by having an enum instead of a bool to answer the question "is the agent compatible?", like "compatible" | "agentTooOld" | "agentTooNew", but I don't think it'd help much here.

I'm still not sure about recommending the downgrade of the app, but I guess it makes sense in a scenario where the user uses our cloud and cannot downgrade the cluster.

In all other cases I'd assume that the person using Connect My Computer is also the cluster admin in some sense and has control over the version.

@gzdunek
Copy link
Contributor Author

gzdunek commented Sep 20, 2023

I'm still not sure about recommending the downgrade of the app, but I guess it makes sense in a scenario where the user uses our cloud and cannot downgrade the cluster.

Yeah, I thought exactly about the cloud case.

runtimeSettings: Pick<RuntimeSettings, 'appVersion' | 'isLocalBuild'>
): boolean {
const { appVersion, isLocalBuild } = runtimeSettings;
const isClusterOnOlderVersion =
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isClusterOnOlderVersion =
const isAgentOnOlderVersion =

Copy link
Member

@ravicious ravicious left a comment

Choose a reason for hiding this comment

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

This looks really solid now. I submitted one more suggestion to indicate incompatibility issues in the navigation menu icon.

@@ -283,7 +283,7 @@ export const ConnectMyComputerContextProvider: FC<{
const shouldAutoStartAgent =
isAgentConfigured &&
canUse &&
!isNonCompatibleAgent &&
isAgentCompatible &&
Copy link
Member

Choose a reason for hiding this comment

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

This made me realize: if the agent has been configured but it wasn't started because it's no longer compatible with the proxy, maybe we could display a warning indicator in the icon?

It should be a matter of doing this but please double check this:

diff --git a/web/packages/teleterm/src/ui/ConnectMyComputer/NavigationMenu.tsx b/web/packages/teleterm/src/ui/ConnectMyComputer/NavigationMenu.tsx
index ac8405ceda..25d92d7d55 100644
--- a/web/packages/teleterm/src/ui/ConnectMyComputer/NavigationMenu.tsx
+++ b/web/packages/teleterm/src/ui/ConnectMyComputer/NavigationMenu.tsx
@@ -112,15 +112,28 @@ export function NavigationMenu() {
 
 function getIndicatorStatus(
   currentAction: CurrentAction,
-  isAgentConfiguredAttempt: Attempt<boolean>
+  isAgentConfiguredAttempt: Attempt<boolean>,
+  isAgentCompatible: boolean
 ): IndicatorStatus {
   if (isAgentConfiguredAttempt.status === 'error') {
     return 'error';
   }
 
+  const isAgentConfigured =
+    isAgentConfiguredAttempt.status === 'success' &&
+    isAgentConfiguredAttempt.data;
+
+  if (!isAgentConfigured) {
+    return '';
+  }
+
   if (currentAction.kind === 'observe-process') {
     switch (currentAction.agentProcessState.status) {
       case 'not-started': {
+        if (!isAgentCompatible) {
+          return 'error';
+        }
+
         return '';
       }
       case 'error': {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! We should definitely show it on the icon.

Copy link
Member

Choose a reason for hiding this comment

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

I realized that in an ideal world, the error indicator would only show up if autostart was prevented due to incompatibility issues. Otherwise if you configure the agent, stop it and compatibility issues occur in the future, you're going to see the error indicator even though you're not actively using the agent.

Anyways, I think we can keep it as it is, at least it'll nudge those users towards an upgrade of Connect.

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, it would be better, but IMO it's still not bad, at least users will be more aware that they are using an incompatible version.

Copy link
Member

Choose a reason for hiding this comment

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

I ran into another issue with the indicator.

isAgentCompatible looks at rootCluster.proxyVersion, but this information is not immediately available. So if I configure my agent and then restart the app, the indicator will show a warning color until the app fetches detailed information about the cluster.

I think we should be able to fix this by replacing isAgentCompatible with agentCompatibility that can be one of three values: compatible, incompatible, unknown. I'll attempt to fix it next week.


Also, during the review I forgot that differentiating between success & error states with just color is usually not enough for users with red-green confusion.

Screen.Recording.2023-09-22.at.15.57.05.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I didn't think of it 😞

I think we should be able to fix this by replacing isAgentCompatible with agentCompatibility that can be one of three values: compatible, incompatible, unknown.

👍

As for colors, probably we should use an icon? I can take a look at it.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, an icon would be a good solution.

, clusters don't support clients that are on a newer major version. If
you wish to connect your computer,{' '}
{isAppDowngradePossible && (
<>downgrade the app to {downgradeAppTo} or </>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<>downgrade the app to {downgradeAppTo} or </>
<>downgrade the app to version {downgradeAppTo} or </>

I think it should say that, otherwise we say "version" for the cluster and just the number alone for the app.

compatibility promise example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed also in the upgrade suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can also cut out "If you wish" and say To connect your computer, downgrade...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, now it says: To use Connect My Computer, downgrade... (we already changed the copy a bit).

@gzdunek gzdunek requested a review from ravicious September 20, 2023 11:20
@roraback
Copy link
Contributor

@roraback WDYT of the proposed designs?

I think the designs work well for now. Thanks for pinging me!

FYI, longer term I'd love to move to a different error message style that Rishi has been working on, and that handles CTAs and two levels of text more gracefully, but the designs are quite new and aren't implemented, yet.

@@ -283,7 +283,7 @@ export const ConnectMyComputerContextProvider: FC<{
const shouldAutoStartAgent =
isAgentConfigured &&
canUse &&
!isNonCompatibleAgent &&
isAgentCompatible &&
Copy link
Member

Choose a reason for hiding this comment

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

I realized that in an ideal world, the error indicator would only show up if autostart was prevented due to incompatibility issues. Otherwise if you configure the agent, stop it and compatibility issues occur in the future, you're going to see the error indicator even though you're not actively using the agent.

Anyways, I think we can keep it as it is, at least it'll nudge those users towards an upgrade of Connect.

# Conflicts:
#	web/packages/teleterm/src/ui/ConnectMyComputer/DocumentConnectMyComputerSetup/DocumentConnectMyComputerSetup.tsx
#	web/packages/teleterm/src/ui/ConnectMyComputer/DocumentConnectMyComputerStatus/DocumentConnectMyComputerStatus.tsx
#	web/packages/teleterm/src/ui/ConnectMyComputer/connectMyComputerContext.tsx
@gzdunek gzdunek enabled auto-merge September 21, 2023 13:36
@gzdunek gzdunek added this pull request to the merge queue Sep 21, 2023
Merged via the queue into master with commit 81c352c Sep 21, 2023
@gzdunek gzdunek deleted the gzdunek/cmc-compatibility-promise branch September 21, 2023 14:13
@public-teleport-github-review-bot

@gzdunek See the table below for backport results.

Branch Result
branch/v14 Failed

@public-teleport-github-review-bot

@gzdunek See the table below for backport results.

Branch Result
branch/v14 Failed

gzdunek added a commit that referenced this pull request Sep 22, 2023
* Add server version to cluster

* Add components to display compatibility promise

* Show compatibility promise on status page

* Show compatibility promise on setup page

* Rename `serverVersion` -> `proxyVersion`, make all places to use `makeRootCluster`/`makeLeafCluster`

* Move `UpgradeAgentSuggestion` to a new file, make it stateless

* Return `isAgentCompatible` instead of `isNonCompatibleAgent` from context

* Add // DELETE IN comments

* Improve copies

* Add a story for too old client in Setup

* Extract CONNECT_MY_COMPUTER_RELEASE_MAJOR_VERSION

* Run prettier

* Fix license

* Show an error on the CMC icon when the agent is not compatible

* Always say "version" before the version number

* Adjust tests

* Drop "if you wish" from the copies

(cherry picked from commit 81c352c)
github-merge-queue bot pushed a commit that referenced this pull request Sep 22, 2023
* Add server version to cluster

* Add components to display compatibility promise

* Show compatibility promise on status page

* Show compatibility promise on setup page

* Rename `serverVersion` -> `proxyVersion`, make all places to use `makeRootCluster`/`makeLeafCluster`

* Move `UpgradeAgentSuggestion` to a new file, make it stateless

* Return `isAgentCompatible` instead of `isNonCompatibleAgent` from context

* Add // DELETE IN comments

* Improve copies

* Add a story for too old client in Setup

* Extract CONNECT_MY_COMPUTER_RELEASE_MAJOR_VERSION

* Run prettier

* Fix license

* Show an error on the CMC icon when the agent is not compatible

* Always say "version" before the version number

* Adjust tests

* Drop "if you wish" from the copies

(cherry picked from commit 81c352c)
@fheinecke fheinecke mentioned this pull request Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants