mozilla-it / bugzilla-kanbanize

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

Two-way syncing of open/closed status between cards and bugs #6

Closed floatingatoll closed 8 years ago

floatingatoll commented 8 years ago

Handle this, rather than complaining about this.

floatingatoll commented 8 years ago

This error message:

"Bug 1234567 is not RESOLVED (NEW) but card 1234 says Done"

stems from this decision that hasn't been made since the initial development of this script:

+    # XXX: Should we close bug on card completion?
+    if ($bug_status ne "RESOLVED" and $card_status eq "Done") {
+       warn "Bug $bug->{id} is not RESOLVED but card says $card_status"; 
+    }

Let's decide.

floatingatoll commented 8 years ago

This problem turns out to be joined to the flipside problem: "What should happen when a bug is reopened?"

And that models precisely as the Assignee syncing problem does, as follows:

Each of these change possibilities is "initial state -> user-modified state -> kanbanize-synced state"

We detected the user-modified state using the history timestamps to compare against the last state change of the eventual target of the sync.

There are four actions possible for the script to take here:

With these four decisions in place, all open cards should reference only open bugs. Reopened bugs will be treated as new work, which appropriately reflects how they must be treated in the sprint scheduling as well.

floatingatoll commented 8 years ago

Various testing results, as of 35ac2e11ba1cac87fbf636556f25005f46e938e3.

card closed > bug open:

[Thu Jun 09 06:43:28 2016] [WARN] bug 1277639 (open) and card 3104 (closed) disagree
[Thu Jun 09 06:43:28 2016] [WARN] This conflict should be resolved in favor of card (closed).

bug closed > card open:

[Thu Jun 09 06:45:53 2016] [WARN] bug 1277639 (closed) and card 3104 (open) disagree
[Thu Jun 09 06:45:53 2016] [WARN] This conflict should be resolved in favor of bug (closed).

card open > bug closed:

[Thu Jun 09 06:46:44 2016] [WARN] bug 1277639 (closed) and card 3104 (open) disagree
[Thu Jun 09 06:46:44 2016] [WARN] This conflict should be resolved in favor of card (open).

bug open > card closed:

[Thu Jun 09 06:47:40 2016] [WARN] bug 1277639 (open) and card 3104 (closed) disagree
[Thu Jun 09 06:47:41 2016] [WARN] This conflict should be resolved in favor of bug (open).

All four paths work. Hooray!

floatingatoll commented 8 years ago

card closed (Done) > bug open:

[Thu Jun 09 08:47:49 2016] [WARN] bug 1277639 (open) and card 3117 (closed) disagree
[Thu Jun 09 08:47:50 2016] [WARN] This conflict should be resolved in favor of card (closed).
[Thu Jun 09 08:47:50 2016] [WARN] Card was modified more recently than Bug.
[Thu Jun 09 08:47:50 2016] [WARN] Card is closed. Close the bug.
[Thu Jun 09 08:47:51 2016] [INFO] Card 3117 - Bug  1277639 - [search] kanbanize test bug #1 ** [resolved (fixed) bug 1277639 for card 3117] **

card closed (Archive) > bug open:

[Thu Jun 09 08:52:17 2016] [WARN] bug 1277639 (open) and card 3117 (closed) disagree
[Thu Jun 09 08:52:17 2016] [WARN] This conflict should be resolved in favor of card (closed).
[Thu Jun 09 08:52:17 2016] [WARN] Card was modified more recently than Bug.
[Thu Jun 09 08:52:17 2016] [WARN] Card is closed. Close the bug.
[Thu Jun 09 08:52:19 2016] [INFO] Card 3117 - Bug  1277639 - [search] kanbanize test bug #1 ** [resolved (fixed) bug 1277639 for card 3117] **

bug closed > card open:

[Thu Jun 09 08:56:50 2016] [WARN] bug 1277639 (closed) and card 3117 (open) disagree
[Thu Jun 09 08:56:50 2016] [WARN] This conflict should be resolved in favor of bug (closed).
[Thu Jun 09 08:56:51 2016] [WARN] Bug was modified more recently than Card.
[Thu Jun 09 08:56:51 2016] [WARN] Bug is closed. Close the card.
[Thu Jun 09 08:56:51 2016] [INFO] Card 3117 - Bug  1277639 - [card] kanbanize test bug #1 ** [closed card 3117 for departed bug 1277639] **

card open > bug closed:

[Thu Jun 09 08:57:45 2016] [WARN] bug 1277639 (closed) and card 3117 (open) disagree
[Thu Jun 09 08:57:45 2016] [WARN] This conflict should be resolved in favor of card (open).
[Thu Jun 09 08:57:45 2016] [WARN] Card was modified more recently than Bug.
[Thu Jun 09 08:57:45 2016] [WARN] Card is open. Open the bug.
[Thu Jun 09 08:57:46 2016] [INFO] Card 3117 - Bug  1277639 - [card] kanbanize test bug #1 ** [reopened bug 1277639 for card 3117] **

bug open > card closed (Done):

[Thu Jun 09 08:59:08 2016] [WARN] bug 1277639 (open) and card 3117 (closed) disagree
[Thu Jun 09 08:59:09 2016] [WARN] This conflict should be resolved in favor of bug (open).
[Thu Jun 09 08:59:09 2016] [WARN] Bug was modified more recently than Card.
[Thu Jun 09 08:59:09 2016] [WARN] Bug is open. Open the card.
[Thu Jun 09 08:59:10 2016] [INFO] Card 3117 - Bug  1277639 - [search] kanbanize test bug #1 ** [reopened card 3117 bug 1277639] **

bug open > card closed (Archive):

[Thu Jun 09 08:46:28 2016] [WARN] bug 1277639 (open) and card 3117 (closed) disagree
[Thu Jun 09 08:46:28 2016] [WARN] This conflict should be resolved in favor of bug (open).
[Thu Jun 09 08:46:28 2016] [WARN] Bug was modified more recently than Card.
[Thu Jun 09 08:46:28 2016] [WARN] Bug is open. Open the card.
[Thu Jun 09 08:46:29 2016] [INFO] Card 3118 - Bug  1277639 - [search] kanbanize test bug #1 ** [reused card 3118 bug 1277639 to reopen archived card 3117] **