mattermost-plugin-jira icon indicating copy to clipboard operation
mattermost-plugin-jira copied to clipboard

Add conditions for subscription validation

Open mickmister opened this issue 2 years ago • 11 comments

Summary

This PR adds more checks to the validateSubscription function, as well as adding more test cases.

Ticket Link

Fixes https://mattermost.atlassian.net/browse/MM-44185

mickmister avatar May 17 '22 22:05 mickmister

Not sure why CI is failing:

cd webapp && /usr/local/bin/npm install
make: *** [Makefile:68: webapp/.npminstall] Terminated

Too long with no output (exceeded 10m0s): context deadline exceeded

mickmister avatar May 18 '22 06:05 mickmister

Fixed CI with most recent commit

mickmister avatar May 18 '22 20:05 mickmister

@DHaussermann Gentle ping on review for this

mickmister avatar Jun 05 '22 23:06 mickmister

/update-branch

DHaussermann avatar Jun 17 '22 17:06 DHaussermann

Codecov Report

Patch coverage: 61.29% and project coverage change: +0.23 :tada:

Comparison is base (0ba44b3) 30.91% compared to head (9239901) 31.15%.

:exclamation: Current head 9239901 differs from pull request most recent head a84d6af. Consider uploading reports for the commit a84d6af to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #858      +/-   ##
==========================================
+ Coverage   30.91%   31.15%   +0.23%     
==========================================
  Files          50       50              
  Lines        7332     7405      +73     
==========================================
+ Hits         2267     2307      +40     
- Misses       4884     4907      +23     
- Partials      181      191      +10     
Impacted Files Coverage Δ
server/issue.go 30.41% <ø> (ø)
server/plugin.go 11.65% <ø> (ø)
server/user.go 26.70% <0.00%> (-0.43%) :arrow_down:
server/subscribe.go 65.26% <64.77%> (-0.92%) :arrow_down:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Jun 17 '22 17:06 codecov-commenter

@mickmister - Not sure if I'm seeing a deployment issue or if something else is happening here. I don't see a new filter as expected for Comment Visibility so I am unable to do any functional testing for this.

I have the matching commit deployed. Any thoughts here? Maybe I've misunderstood something here?

DHaussermann avatar Jun 30 '22 18:06 DHaussermann

@DHaussermann and I have discussed offline the scope of this PR, which does not include changes to comment visibility

mickmister avatar Jul 12 '22 14:07 mickmister

@mickmister following up on our brief chat yesterday, what's missing to get this merged? Just the QA review? cc @DHaussermann

jupenur avatar Sep 22 '22 17:09 jupenur

@jupenur Yes QA review is the next step here

mickmister avatar Sep 22 '22 22:09 mickmister

/update-branch

DHaussermann avatar Sep 29 '22 18:09 DHaussermann

@mickmister I did a round of testing and this seems to be working as expected.

Is there a reason this is not just a bool radio button? image Also - Can I try and tweak the wording on the option for clarity?

Also - With this design Security Level is no longer optional. The UI should reflect this when a new subscription is being created. Right now it's just allowing users to create non-functional subscriptions with no feedback.

DHaussermann avatar Oct 06 '22 20:10 DHaussermann

@DHaussermann what should I be checking for here?

  • UI, default values etc.?
  • my one comment would be does this need to be turned on by default, or just in high-security shops. I can definitely see why there are cases not enabling this would be useful. If this is just turned on will it break any existing subscriptions?

asatkinson avatar Nov 20 '22 16:11 asatkinson

I have discussed this with @mickmister.

  1. For now, a compromise would be to add the following text below the "approximate JQL" line: "Note that since you have not selected a security level filter, the subscription will only allow issues that have no security level assigned." The text would then disappear once a security level is added.

  2. I think the label of the enforcement flag would be more clear if we set the text to: "Subscriptions will only include issues that have a security level assigned if the appropriate security level has been included as a filter"

  3. A correction from above

"With this design Security Level is no longer optional. The UI should reflect this when ...."

This is not true. Technically they are still optional. Without a filter only issues with no security level assigned are included. This is a valid use case.

cc @asatkinson

DHaussermann avatar Jan 31 '23 20:01 DHaussermann

@DHaussermann I've updated the PR with the changes mentioned above. Note that the sentence wraps around with one word on the second line. This looks a little asymmetrical/odd to me:

image

mickmister avatar Feb 02 '23 07:02 mickmister

I have done a round of testing and this is looking good.

  • Tested that security level filter is no longer opt-in on upgrade
  • Tested that the "kill switch" works as expected to continue subscription delivery
  • Regression tested security level filter is working
  • Labeling is system console has been improved for clarity
  • Subscription creation screen now has user feed back that there is now security level filter set when this is the case

When I tried to repeat this testing on server (testing above was on cloud) I get an error saving the subscription

image

@mickmister couple questions...

  • Is there any chance this change is agnostic to Jira Server Vs Jira Cloud? to me this seems like a risk.
  • The error above seems unrelated to the PR but can you confirm if it's happening on our side or on the Jira side?

DHaussermann avatar Feb 28 '23 21:02 DHaussermann

I tested this again and it is working as expected in this branch provided @mickmister here https://github.com/mattermost/mattermost-plugin-jira/tree/validate-subscription_debug.

DHaussermann avatar Mar 01 '23 22:03 DHaussermann

@m1lt0n or @asatkinson we should discuss the impact of this change and if clients need to be warned about it. This PR really should have some type of Business Analysts approval.

Testing this has caused me to wonder how common the case is where people use projects in Jira with no issue security scheme applied. In such a case, users won't quickly be able to go edit their subscription to get it working again once they upgrade the plugin. Some effort is required in Jira as well to associate the project with a security scheme.

In short... Issue where a scheme is applied and the security level is set to none works fine and no changes are needed to the subscription. But our solution here kind of assumes all projects have issue security schemes applied.
For any project where there is no issue security scheme in use there will be no way of delivering subscriptions unless the "kill switch" to make it work the old way is turned on to not require security level.

DHaussermann avatar Mar 01 '23 22:03 DHaussermann

@asatkinson Since this is a business decision, what do you propose to be the recommended course of action with this? cc: @DHaussermann

Let's bring this up in either our grooming or planning or async in our chat.

m1lt0n avatar Mar 09 '23 16:03 m1lt0n

@DHaussermann I've been looking through this and I don't think I fully understand why this is so problematic.
It seems like they just want a switch so that if this filter is set then we restrict subscription notification to those posts below a certain security level - as defined in this JIRA help doc

Can we do a quick call so you can walk me through this? I don't have access to this UI.

asatkinson avatar Mar 14 '23 13:03 asatkinson

If the issue is that it applies this and prevents all other subscriptions from working, then yes, this is a big problem and we should find another way to do this.

asatkinson avatar Mar 14 '23 13:03 asatkinson

@DHaussermann Gentle ping to give this PR another look. I've resolved issues in CI

mickmister avatar Mar 17 '23 22:03 mickmister

@mickmister Heads up that there is a conflict to resolve

hanzei avatar Mar 30 '23 14:03 hanzei

/update-branch

DHaussermann avatar May 01 '23 16:05 DHaussermann

After discussing with @mickmister again the last concern I had is not applicable here.

I have checked again and tested on both Cloud and Server. If the issue is part of a project where there is no security level to assign because no level is in use by the project, the subscription will deliver the event even though the subscription has no applicable security level to evaluate.

DHaussermann avatar May 02 '23 22:05 DHaussermann