Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(cli): prevent asynchronous print of version mismatch in config-ssh #13845

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

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Jul 9, 2024

image

Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Should we link it with any issue?

cli/configssh.go Outdated
Comment on lines 249 to 252
// Talk to the API early to prevent bad placement of the
// version mismatch warning. The asynchronous requests
// issued by sshPrepareWorkspaceConfigs may trigger the
// warning at any time.
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to clarify what "bad placement" means.

How will this change address the issue if

The asynchronous requests issued by sshPrepareWorkspaceConfigs may trigger the warning at any time.

?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something we can test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I can clarify.

How will this change address the issue if

By talking early. The warning is printed only once/on first API communication. Understanding this context requires knowledge of the version mismatch message, not sure it's worth expanding upon here. 🤔

Is this something we can test?

Not really, since version mismatch is a http transport middleware triggered on first API comms, it applies essentially to all CLI commands and testing this in a general way doesn't seem feasible or would require rewriting most of our tests to be run both with a matched and mismatched client/server.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, thanks for the clarification; I think this detail would be relevant in the comment.
"Early" doesn't really explain why this fixes the issue, IMO.

Copy link
Member Author

@mafredri mafredri Jul 9, 2024

Choose a reason for hiding this comment

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

I do see your point Danny, and how that could be valuable information for the reader. I just don't think repeating the behavior about how version mismatch works in every place there needs to be an exception is the right way to go about it.

The curious reader can search for "version mismatch" and find it/its doc:

// wrapTransportWithVersionMismatchCheck adds a middleware to the HTTP transport
// that checks for version mismatches between the client and server. If a mismatch
// is detected, a warning is printed to the user.

I'm open to ideas for improvement, if you think it really needs it. I just want to avoid documenting another components logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

fb1d0d9 LGTM 👍 thanks

@mafredri mafredri merged commit 54055dc into main Jul 9, 2024
28 checks passed
@mafredri mafredri deleted the mafredri/fix-cli-configssh-async-version-mismatch branch July 9, 2024 11:32
@github-actions github-actions bot locked and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants