-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
MM-17888 Check plugin Helpers minimum server version comments #12663
MM-17888 Check plugin Helpers minimum server version comments #12663
Conversation
Sorry, this is a big PR. I've tried to break up each change into a logical commit, so that it's easier to review. I got pretty deep into this and I think it's time to get an outside perspective. |
Sorry for the force-push. I was trying to get the commits to appear in the right order after doing some rebase cleanup earlier. I am done now. |
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See License.txt for license information. | ||
|
||
package main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the logic that was formerly in main.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome, @pbitty!
One, non-blocking question: are the checks transitive? That is, if a helper uses another helper, or calls a method that uses a helper/api, will it infer the version appropriately?
Good question! No, they are not transitive. That's an interesting problem. I am happy to try to implement that, but it might be worth doing it in another Issue and/or PR. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, amazing work @pbitty ! (Love the username, btw.) . Thanks for putting in the effort for this.
One non-blocking question for @lieut-data.
res.Warnings = append(res.Warnings, renderWithFilePosition( | ||
fset, | ||
pos, | ||
fmt.Sprintf("documented minimum server version too high on method %s", name)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something we want to enforce? (Just wondering if there may be a non-API reason why a function might be labelled higher than what is strictly required.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, my thoughts were that a helper might want to require a higher version in which a fix to an API was made, hence the warning. It's a purely theoretical concern right now.
No problem! I'm happy this is working. @lieut-data , if you would like to make this a transitive check, I am happy to give it a shot. If you decide to create an Issue for it, feel free to assign it to me. |
@pbitty, I think this is great as-is -- let's let it soak for a while, and we can revisit the transitive idea separately. |
@lieut-data does this PR need separate tests or does https://mattermost.atlassian.net/browse/MM-17889 cover this one as well? |
@prapti, looks like this PR already has separate tests: https://github.com/mattermost/mattermost-server/pull/12663/files#diff-fa60ffe40f271fe40d1e0ede8605016b. |
@lieut-data great! Thanks for pointing that one out. |
@prapti, this is a subtly different improvement, in which we're adding these comments to the plugin helpers specifically, not just the API. I do think it's still useful for QA verification. |
…nimum_server_version
This issue has been automatically labelled "stale" because it hasn't had recent activity. /cc @jasonblais @hanzei |
…nimum_server_version
…nimum_server_version
* master: (70 commits) Run unused against codebase (mattermost#12968) [MM-12623] Create CLI command "config reset" (mattermost#10296) Migrate tests from store/storetest/status_store.go to use test… (mattermost#12873) Fix golangci-lint target (mattermost#12985) [MM-16437] Plugin crashes the server when calling WriteHeader with an invalid http code (mattermost#11276) MM-18060: Include deleted posts in compliance export. (mattermost#12957) [MM-18331] When patching a bot send websocket notification (mattermost#12373) [MM-19473] Fix data race on user login (mattermost#12870) license, openGraph tests: convert to testify (mattermost#12919) oauth_test: use testify (mattermost#12949) [MM-18830] Unhelpful error message when adding bot to a channel before adding to team (mattermost#12844) emoji_test: update to use testify (mattermost#12932) MM-19310 - Wrong validation message when Bot name ends in a . (mattermost#12905) Migrate tests from store/storetest/oauth_store.go to use testify (mattermost#12875) Include extra metadata when clicking an interactive button (mattermost#12697) MM-19553: Generate valid passwords on bulk import. (mattermost#12871) Convert api4/webhook_test.go t.Fatal calls into require/assert calls (mattermost#12904) Fix golangci-lint target for non GOPATH installations (mattermost#12934) MM-17888 Check plugin Helpers minimum server version comments (mattermost#12663) [MM-18898] Stringify plugin.Log* parameters (mattermost#12700) ...
Summary
This implements a CI check that ensures
Minimum server version
comments in theplugin.Helpers
methods match the effective minimum version of all theAPI
calls that they make.Ticket Link
Resolves #11912.