Merge lp://staging/~gary/launchpad/bug777874 into lp://staging/launchpad

Proposed by Gary Poster
Status: Merged
Approved by: Gary Poster
Approved revision: no longer in the source branch.
Merged at revision: 13470
Proposed branch: lp://staging/~gary/launchpad/bug777874
Merge into: lp://staging/launchpad
Diff against target: 756 lines (+458/-33)
8 files modified
lib/lp/bugs/configure.zcml (+3/-0)
lib/lp/bugs/javascript/bugtask_index.js (+32/-1)
lib/lp/bugs/model/bug.py (+29/-15)
lib/lp/bugs/model/bugtask.py (+71/-16)
lib/lp/bugs/model/tests/test_bug.py (+101/-0)
lib/lp/bugs/model/tests/test_bugtask.py (+206/-0)
lib/lp/services/features/flags.py (+14/-0)
lib/lp/testing/factory.py (+2/-1)
To merge this branch: bzr merge lp://staging/~gary/launchpad/bug777874
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+68406@code.staging.launchpad.net

Commit message

[r=gmb][bug=777874] enable autocompletion of "New" bugtasks that affect more than one person. Feature-flagged by project/distro.

Description of the change

This branch fixes bug 777874 by enabling autoconfirmation of new bugtasks that affect more than one person. It is feature-flagged by project and distribution, though the intent is to roll it out to all Launchpad users.

The discussion in the bug, particularly in comment 11 (https://bugs.launchpad.net/launchpad/+bug/777874/comments/11) is a good background to what I'm doing. The only difference is that I ended up not using events. The call sites were very constrained, and generic modified events would have been more difficult that what I actually needed. gmb was fine with this on a follow-up conversation.

The Python is well tested.

The JavaScript was within a completely untested module, and I did not try to add tests. Moreover, this is the kind of use case that calls out for a client-side MVC pattern. We just don't have it yet.

Tests can be run with
./bin/test -vv lp.bugs.model.tests.test_bug TestBugAutoConfirmation
and
./bin/test -vv lp.bugs.model.tests.test_bugtask TestAutoConfirmBugTasks

I get layer teardown errors when I do this, but it has nothing to do with my branch's changes to my knowledge. I think it is something to do with running tests from a single layer, but I didn't dig into it past a cursory investigation.

  File "/home/gary/launchpad/lp-branches/bug777874/lib/canonical/testing/layers.py", line 363, in tearDown
    cls.fixture.cleanUp()
AttributeError: 'NoneType' object has no attribute 'cleanUp'

Lint is happy.

I am a bit paranoid that privacy issues will bite this code somehow (e.g., the current user does not have privileges to change the status of a bug and things fall over when they try to set a dupe or say "me too"), but I can't think of a way: the calls I make are either internal to an object, and so not wrapped with a security proxy; or they are publicly allowed. I'd appreciate your consideration of this issue in the review though.

QA/testing:

I'll define two scenarios, then describe what to do with them.

Scenario 1:
 A. Go to or make a bug that has a bugtask in a NEW status and only one person affected (but at least one--launchpad.dev has some that are don't affect anyone to start with, like its bug 1) who is not you.
 B. Mark the bug as affecting you.

Scenario 2:
 A. Go to or make a bug that has a bugtask in a NEW status and only one person affected (but at least one--launchpad.dev has some that are don't affect anyone to start with, like its bug 1) who is not you.
 B. Go to another bug and mark it as a duplicate of the first bug.
 C. Return to the first bug.

Scenario 3:
 A. Go to or make a bug that has a bugtask in a NEW status and that *only affects you*.
 B. Go to another bug and mark it as a duplicate of the first bug.
 C. Return to the first bug.

First, verify that, without feature flags set, there is no autoconfirm for all three scenarios.

Now set feature flags to turn on the behavior for ubuntu and launchpad. Locally, that means that you go to https://launchpad.dev/+feature-rules . You want these rules.

bugs.autoconfirm.enabled_distribution_names default 1 ubuntu
bugs.autoconfirm.enabled_product_names default 1 launchpad

Now, go through scenarios 1 and 2 for ubuntu and/or launchpad-related bugs and make sure that bugtasks change; and go through scenarios 1 and 2 for other projects and/or distributions and make sure they do not change. Finally, if you want, go through scenario 3 for ubuntu/launchpad and make sure that bugtasks do *not* change.

For extra credit, change the flags to match everything:

bugs.autoconfirm.enabled_distribution_names default 1 *
bugs.autoconfirm.enabled_product_names default 1 *

Now make sure that scenarios 1 and 2 make a change, and 3 does not.

Writing this, it strikes me that distribution names and product names share a namespace, so I didn't need to separate them. I'm not inclined to change anything, but I could if you wanted. It would make the code that we plan to delete anyway a bit simpler.

Thank you!

Gary

To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

One other comment: I changed user_ids_affected_with_dupes because I thought I needed to. It turned out I was wrong, but the change still seemed good to me. If you disagree, I'm happy to reinstate the old code.

Revision history for this message
Graham Binns (gmb) :
review: Approve (code)
Revision history for this message
Robert Collins (lifeless) wrote :

Two comments:
 - changing the user affects union to an or may throw out bug search
query plans; you'll need to test this with an eye towards timeouts.
[OTOH it may have been written that way in the first place and never
altered; I suspect its deliberately a union [but I haven't annotated
to be sure]].

 - in the client side js, the limit of checking whether the task was
new seems unnecessary - isn't it reasonable to just cross check
regardless?

Revision history for this message
Gary Poster (gary) wrote :

As Robert said on IRC, reverting the union change will make qa easier. I'll do it.

For the js, since we don't do this generically (yet) I thought it would be surprising to update other tasks in response to saying "me too" because people might confuse coincidence with consequence. I'd be fine if we always kept statuses up-to-date with long-poll later, for instance; then we would not need this "something happened" code path at all. For now, though, I stand by my call there. Robert said on IRC he saw my point, and was fine with me proceeding as planned.

Revision history for this message
Gary Poster (gary) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.