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

Remove daily summary index #141

Merged
merged 6 commits into from
May 27, 2020
Merged

Remove daily summary index #141

merged 6 commits into from
May 27, 2020

Conversation

mickmister
Copy link
Contributor

@mickmister mickmister commented May 21, 2020

Summary

This PR makes it so the daily summary settings live within the rest of the user's personal settings. I would like to consolidate the user settings in one place before we are locked into the store structure by the first release. This way there is only one user index as well. Feedback welcome, also tests still need to be adjusted.

Fixes #130

@mickmister mickmister added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels May 21, 2020
@mickmister mickmister requested review from levb and larkox May 21, 2020 08:52
@codecov-commenter
Copy link

codecov-commenter commented May 22, 2020

Codecov Report

Merging #141 into master will increase coverage by 0.41%.
The diff coverage is 48.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
+ Coverage   24.60%   25.01%   +0.41%     
==========================================
  Files          65       65              
  Lines        2556     2550       -6     
==========================================
+ Hits          629      638       +9     
+ Misses       1848     1832      -16     
- Partials       79       80       +1     
Impacted Files Coverage Δ
server/mscalendar/user.go 17.17% <ø> (+0.50%) ⬆️
server/mscalendar/daily_summary.go 45.52% <43.75%> (+6.43%) ⬆️
server/mscalendar/oauth2.go 85.00% <71.42%> (-1.80%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14ae3b8...03d9071. Read the comment docs.

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

Apart of the lint errors, look good to me.

@levb levb removed the 2: Dev Review Requires review by a core committer label May 22, 2020
@levb levb requested a review from DHaussermann May 22, 2020 10:51
@DHaussermann
Copy link

@mickmister maybe I missing something here but I have some issues when I deploy this.

  1. I don't see the UI to set the daily summary and setting the other options throws a warning.
    log WARN) error creating the slack attachment for setting summary_setting. err=Daily summary settings not found
    Screen Shot 2020-05-26 at 2 20 39 PM

  2. I tried to disconnect the test user to see if it resolves the issue but disconnecting caused the plugin to crash with the following logs:

{"level":"debug","ts":1590517461.349937,"caller":"mlog/sugar.go:15","msg":"store: deleted mattermost user subscription.","plugin_id":"com.mattermost.mscalendar","mattermostUserID":"49hc1zu64byetkwhhfozct8wbo","subscriptionID":"77aaf817-421c-49f9-b15f-996ab3def496"}
{"level":"error","ts":1590517461.377522,"caller":"mlog/sugar.go:23","msg":"failed to post MessageHasBeenPosted message","plugin_id":"com.mattermost.demo-plugin","channel_id":"qd1n6dc357yij8wgxu3894a4jc","user_id":"t6763ke74jb388jz4km4jt93nr","error":"SqlChannelStore.Get: Unable to find the existing channel., id="}
{"level":"debug","ts":1590517461.3931851,"caller":"mailservice/mail.go:308","msg":"sending mail","to":"mjkochell@gmail.com","subject":"[Mattermost] New Direct Message from @mscalendar on May 26, 2020"}
{"level":"error","ts":1590517461.4249291,"caller":"mlog/sugar.go:23","msg":"failed to post MessageHasBeenPosted message","plugin_id":"com.mattermost.demo-plugin","channel_id":"4s3rd88p7iy77c3h1no51ouxoh","user_id":"t6763ke74jb388jz4km4jt93nr","error":"SqlChannelStore.Get: Unable to find the existing channel., id="}
{"level":"debug","ts":1590517461.725848,"caller":"web/handlers.go:89","msg":"Received HTTP request","method":"POST","url":"/api/v4/channels/members/me/view","request_id":"t4r7phmqki8b7ym7bphd8eg6wo"}
{"level":"debug","ts":1590517462.607417,"caller":"plugin/hclog_adapter.go:53","msg":"panic: runtime error: invalid memory address or nil pointer dereference","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.607528,"caller":"plugin/hclog_adapter.go:53","msg":"[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x190a2a9]","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6075652,"caller":"plugin/hclog_adapter.go:53","msg":"","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.607604,"caller":"plugin/hclog_adapter.go:53","msg":"goroutine 120 [running]:","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6083899,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-plugin-mscalendar/server/remote/msgraph.(*client).DeleteSubscription(0xc0001463c0, 0xc0002080f0, 0x24, 0x24, 0x0)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.608447,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/remote/msgraph/subscription.go:55 +0x2c9","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.608703,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-plugin-mscalendar/server/mscalendar.(*mscalendar).DisconnectUser(0xc0004122a0, 0xc0004f40e0, 0x1a, 0xc0000fe100, 0x0)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6087549,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/mscalendar/user.go:139 +0x3f3","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.608782,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-plugin-mscalendar/server/command.(*Command).disconnect(0xc0000c41c0, 0x26c1b58, 0x0, 0x0, 0xc0001c6100, 0x0, 0x0, 0x0, 0x400)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6088011,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/command/disconnect.go:7 +0x4d","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.60882,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-plugin-mscalendar/server/command.(*Command).requireConnectedUser.func1(0x26c1b58, 0x0, 0x0, 0x26c1b58, 0x0, 0x0, 0x0, 0x0)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6088471,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/command/command.go:132 +0x7e","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.608865,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-plugin-mscalendar/server/command.(*Command).Handle(0xc0000c41c0, 0xc0004122a0, 0xc00022c380, 0x1ddaf20, 0xc00012dd60, 0xc000180600)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.60888,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/command/command.go:88 +0x10f","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.608897,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-plugin-mscalendar/server/plugin.(*Plugin).ExecuteCommand(0xc00022c400, 0xc000400300, 0xc0004ff900, 0x2a95048, 0xc00022c400)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.608921,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/src/github.com/mattermost/mattermost-plugin-mscalendar/server/plugin/plugin.go:195 +0x241","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.609185,"caller":"plugin/hclog_adapter.go:53","msg":"github.com/mattermost/mattermost-server/v5/plugin.(*hooksRPCServer).ExecuteCommand(0xc000129780, 0xc0004020a0, 0xc000402720, 0x0, 0x0)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.609229,"caller":"plugin/hclog_adapter.go:53","msg":"\t/Users/dylanhaussermann/go/pkg/mod/github.com/mattermost/mattermost-server/v5@v5.3.2-0.20200313113657-e2883bfe5f37/plugin/client_rpc_generated.go:114 +0x78","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.609505,"caller":"plugin/hclog_adapter.go:53","msg":"reflect.Value.call(0xc000400540, 0xc00040c048, 0x13, 0x1c81922, 0x4, 0xc0000b2f08, 0x3, 0x3, 0x0, 0x2a93a00, ...)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.609558,"caller":"plugin/hclog_adapter.go:53","msg":"\t/usr/local/go/src/reflect/value.go:460 +0x8ab","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.609592,"caller":"plugin/hclog_adapter.go:53","msg":"reflect.Value.Call(0xc000400540, 0xc00040c048, 0x13, 0xc0003bb708, 0x3, 0x3, 0xc0003bb6a0, 0x2, 0x0)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.60961,"caller":"plugin/hclog_adapter.go:53","msg":"\t/usr/local/go/src/reflect/value.go:321 +0xb4","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6098628,"caller":"plugin/hclog_adapter.go:53","msg":"net/rpc.(*service).call(0xc000418000, 0xc00040a0f0, 0xc00040e090, 0xc00040e0a0, 0xc000420080, 0xc000408980, 0x19a6380, 0xc0004020a0, 0x16, 0x19a63c0, ...)","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6099079,"caller":"plugin/hclog_adapter.go:53","msg":"\t/usr/local/go/src/net/rpc/server.go:377 +0x17f","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.609954,"caller":"plugin/hclog_adapter.go:53","msg":"created by net/rpc.(*Server).ServeCodec","plugin_id":"com.mattermost.mscalendar"}
{"level":"debug","ts":1590517462.6099882,"caller":"plugin/hclog_adapter.go:53","msg":"\t/usr/local/go/src/net/rpc/server.go:474 +0x42b","plugin_id":"com.mattermost.mscalendar"}
{"level":"error","ts":1590517462.614293,"caller":"mlog/log.go:175","msg":"RPC call ExecuteCommand to plugin failed.","plugin_id":"com.mattermost.mscalendar","error":"unexpected EOF"}
{"level":"debug","ts":1590517462.614322,"caller":"plugin/hclog_adapter.go:51","msg":"plugin process exited","plugin_id":"com.mattermost.mscalendar","wrapped_extras":"pathplugins/com.mattermost.mscalendar/server/dist/plugin-darwin-amd64pid41334errorexit status 2"}
{"level":"debug","ts":1590517462.620244,"caller":"mlog/log.go:163","msg":"Command with a trigger of 'mscalendar' not found. To send a message beginning with \"/\", try adding an empty space at the beginning of the message.","path":"/api/v4/commands/execute","request_id":"y5jd8jc81bd8j8p8ad56ct1jyy","ip_addr":"74.15.49.102","user_id":"49hc1zu64byetkwhhfozct8wbo","method":"POST","err_where":"command","http_code":404,"err_details":""}
{"level":"debug","ts":1590517462.7414908,"caller":"web/handlers.go:89","msg":"Received HTTP request","method":"POST","url":"/api/v4/users/status/ids","request_id":"u9q9x7y7mfft9bsbyhdqqfn7ww"}

Is there maybe a breaking change that means I need to start over with a fresh install and fresh KV store?

@mickmister
Copy link
Contributor Author

@DHaussermann the first error should be resolved by my most recent push. The second error seems to be caused by the same nil logger as mentioned in #116 . I've commented there saying so.

@larkox @levb We now ensure the daily summary settings are set after connect, so we do not have special case nil checks in several places in the code.

@DHaussermann
Copy link

@mickmister In it;s current state this is not testable for me.
Any slash command sent to the plugin is returning a 500 response.
Strangely I can't see anything related other than {"level":"error","ts":1590613139.4157705,"caller":"mlog/log.go:175","msg":"An error occurred while trying to execute this command.","path":"/api/v4/commands/execute","request_id":"ug65f4pa47rh9k1emay5opnxiy","ip_addr":"10.160.1.30","user_id":"rqikw64393fkmpstxmjtu4qaty","method":"POST","err_where":"ExecutePluginCommand","http_code":500,"err_details":"err=plugin not found: com.mattermost.mscalendar"}
After having updated the build.

@mickmister
Copy link
Contributor Author

@levb @larkox After this PR is merged, you will need to disconnect and reconnect your users in order for the daily summary settings to be set. The daily summary job will panic otherwise.

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • Daily summary now works again!
  • Tested setting and updating delivery time.
  • No issues found.
    LGTM!
    Please merge to make HA PR easier to test.

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels May 27, 2020
@mickmister mickmister merged commit d23d625 into master May 27, 2020
@mickmister mickmister deleted the daily-summary-settings branch May 27, 2020 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Daily Summary is not displaying at set time
5 participants