mozilla-it / bugzilla-kanbanize

Sync Automation between Kanbanize and Mozilla
0 stars 1 forks source link

Handle multiple bugs with the same whiteboard link to Kanban #7

Closed floatingatoll closed 8 years ago

floatingatoll commented 8 years ago

When a bug is cloned, or in various other circumstances, we can end up with multiple bugs pointing to the same Kanban card. Use the card to determine which bug is the correct one and assign the rest a new card.

floatingatoll commented 8 years ago

Currently, the bugs randomly overwrite each other in Kanban:

[Wed Jun 08 06:42:45 2016] [INFO] [ 569/ 641] Card 3072 - Bug  1234 - [search] kanbanize test bug ** Updated card summary ('1234 - kanbanize test bug' vs '5678 - kanbanize test bug') **
[Wed Jun 08 06:42:45 2016] [INFO] [ 569/ 641] Card 3072 - Bug  1234 - [search] kanbanize test bug ** Updated external link to bugzilla ( https://bugzilla.mozilla.org/show_bug.cgi?id=5678 => https://bugzilla.mozilla.org/show_bug.cgi?id=1234) **
floatingatoll commented 8 years ago

Okay. It works now. Each bug that isn't referenced by that same Kanban card is given a card of its own, either by relinking the bug to a card that already exists pointing to it, or by creating a new card for it.

It fails gracefully if the card referenced by all the bugs doesn't exist, by assigning a new bug.

This required significant improvement to the update_whiteboard function, which now understands how to alter modern whiteboard status to prevent duplication (and strips trailing whitespace).

Example 1:

[Wed Jun 08 08:11:59 2016] [WARN] Card 3072 is referenced by whiteboards on multiple bugs: 1277639, 1278775, 1278765
[Wed Jun 08 08:12:00 2016] [INFO] Card 3078 - Bug  1277639 - [search] kanbanize test bug #1 ** [assigned existing card 3078 to bug 1277639 replacing conflicted card 3072] **
[Wed Jun 08 08:12:01 2016] [INFO] Card 3077 - Bug  1278765 - [search] kanbanize test bug #2 ** [assigned existing card 3077 to bug 1278765 replacing conflicted card 3072] **
[Wed Jun 08 08:12:02 2016] [INFO] Card 3095 - Bug  1278775 - [search] kanbanize test bug #3 ** [assigned new card 3095 to bug 1278775 replacing conflicted card 3072] **

Example 2:

[Wed Jun 08 08:17:45 2016] [WARN] Card 3078 is referenced by whiteboards on multiple bugs: 1277639, 1278775, 1278765
[Wed Jun 08 08:17:46 2016] [INFO] Card 3077 - Bug  1278765 - [search] kanbanize test bug #2 ** [assigned existing card 3077 to bug 1278765 replacing conflicted card 3078] **
[Wed Jun 08 08:17:47 2016] [INFO] Card 3095 - Bug  1278775 - [search] kanbanize test bug #3 ** [assigned existing card 3095 to bug 1278775 replacing conflicted card 3078] **
floatingatoll commented 8 years ago

If multiple cards reference the same bug, this doesn't do anything about that, because it's impossible to know without human intervention which card is the right one to keep. That's a different problem, that shouldn't happen anymore thanks to work surrounding issue #9.

floatingatoll commented 8 years ago

Improved slightly to indicate which card is the right one.

[Wed Jun 08 08:24:47 2016] [WARN] Card 3078 is referenced by whiteboards on multiple bugs: 1277639, 1278775, 1278765
[Wed Jun 08 08:24:47 2016] [WARN] Card 3078 is already correctly associated with bug 1277639
[Wed Jun 08 08:24:47 2016] [INFO] Card 3077 - Bug  1278765 - [search] kanbanize test bug #2 ** [assigned existing card 3077 to bug 1278765 replacing conflicted card 3078] **
[Wed Jun 08 08:24:48 2016] [INFO] Card 3095 - Bug  1278775 - [search] kanbanize test bug #3 ** [assigned existing card 3095 to bug 1278775 replacing conflicted card 3078] **