Repository: mozilla/bugbug

Issue:
Extend the whiteboard feature to consider all possible whiteboard words
https://github.com/mozilla/bugbug/blob/1784a10346d9dedcb2e18e076f3d482e39be93a1/bugbug/bug_features.py#L83


Discussion:
Right now it's only looking for `whiteboard` or `[ux]`. It should instead get all possible whiteboard words.
@marco-c It's currently looking for `memshrink` or `[ux]` right?. (You mentioned `whiteboard`) above.
Yes, see the comment above :smile: 
I found a list of commonly used whiteboard words here: https://wiki.mozilla.org/ReleaseEngineering/Bugzilla/Whiteboard . Should I add these?
No, unfortunately they are bound to change and there's no complete reference.
We should just use all whiteboard items we find in the whiteboard. The model will automatically discard the ones which are not meaningful.
Oh, I see. Please correct me if I'm wrong: I'll have to implement an regex that finds all text between `[` and `]` in the whiteboard, extracts only the tags from each (`[memshrink:XXX]` becomes only `memshrink`), and appends it to the returned list. Right?
Correct!

Resolving patch:
diff --git a/bugbug/bug_features.py b/bugbug/bug_features.py
--- a/bugbug/bug_features.py
+++ b/bugbug/bug_features.py
@@ -85,15 +85,26 @@ def __call__(self, bug):
 
 class whiteboard(object):
     def __call__(self, bug):
-        ret = []
 
-        # TODO: Add any [XXX:YYY] that appears in the whiteboard as [XXX: only
+        # Split by '['
+        paren_splits = bug['whiteboard'].lower().split('[')
 
-        for elem in ['memshrink', '[ux]']:
-            if elem in bug['whiteboard'].lower():
-                ret.append(elem)
+        # Split splits by space if they weren't in [ and ].
+        splits = []
+        for paren_split in paren_splits:
+            if ']' in paren_split:
+                paren_split = paren_split.split(']')
+                splits += paren_split
+            else:
+                splits += paren_split.split(' ')
 
-        return ret
+        # Remove empty splits and strip
+        splits = [split.strip() for split in splits if split.strip() != '']
+
+        # For splits which contain ':', return both the whole string and the string before ':'.
+        splits += [split.split(':', 1)[0] for split in splits if ':' in split]
+
+        return splits
 
 
 class patches(object):


Test patch:
diff --git a/tests/fixtures/bug_features/whiteboard.json b/tests/fixtures/bug_features/whiteboard.json
--- a/tests/fixtures/bug_features/whiteboard.json
+++ b/tests/fixtures/bug_features/whiteboard.json
@@ -1,2 +1,9 @@
-{"priority": "--", "creator": "mental2121@gmail.com", "assigned_to_detail": {"email": "nobody@mozilla.org", "real_name": "Nobody; OK to take it and work on it", "name": "nobody@mozilla.org", "nick": "nobody", "id": 1}, "blocks": [], "cf_tracking_geckoview64": "---", "last_change_time": "2017-08-09T18:35:56Z", "is_cc_accessible": true, "keywords": [], "comment_count": 4, "creator_detail": {"email": "mental2121@gmail.com", "real_name": "Khaled Ghalmi", "name": "mental2121@gmail.com", "nick": "mental2121", "id": 598001}, "cf_qa_whiteboard": "", "cc": ["astevenson@mozilla.com", "continuation@gmail.com", "erahm@mozilla.com", "tnikkel@gmail.com"], "duplicates": [], "see_also": [], "groups": [], "assigned_to": "nobody@mozilla.org", "url": "", "creation_time": "2017-07-07T02:12:03Z", "whiteboard": "[MemShrink][platform-rel-Facebook]", "id": 1379043, "qa_contact": "", "cf_tracking_geckoview65": "---", "depends_on": [], "cf_tracking_firefox64": "---", "cf_status_geckoview65": "---", "cf_rank": null, "mentors": [], "dupe_of": 1379139, "cf_status_firefox66": "---", "cf_status_firefox65": "---", "cf_fx_iteration": "---", "cf_tracking_firefox_relnote": "---", "resolution": "DUPLICATE", "classification": "Client Software", "cf_has_regression_range": "---", "alias": null, "op_sys": "Unspecified", "cf_tracking_firefox65": "---", "cf_last_resolved": "2017-08-09T18:35:56Z", "cf_tracking_firefox66": "---", "cf_fx_points": "---", "status": "RESOLVED", "cc_detail": [{"email": "astevenson@mozilla.com", "real_name": "Adam Stevenson [:adamopenweb]", "name": "astevenson@mozilla.com", "nick": "adamopenweb", "id": 489339}, {"email": "continuation@gmail.com", "real_name": "Andrew McCreight [:mccr8]", "name": "continuation@gmail.com", "nick": "mccr8", "id": 406194}, {"email": "erahm@mozilla.com", "real_name": "Eric Rahm [:erahm] (PTO until Jan 3)", "name": "erahm@mozilla.com", "nick": "erahm", "id": 496127}, {"email": "tnikkel@gmail.com", "real_name": "Timothy Nikkel (:tnikkel)", "name": "tnikkel@gmail.com", "nick": "tnikkel", "id": 255010}], "cf_crash_signature": "", "summary": "High heap-unclassified on facebook", "cf_has_str": "---", "cf_user_story": "", "is_open": false, "platform": "Unspecified", "cf_tracking_firefox_esr60": "---", "severity": "normal", "cf_status_firefox_esr60": "---", "votes": 1, "flags": [{"modification_date": "2017-07-13T01:53:20Z", "requestee": "mental2121@gmail.com", "creation_date": "2017-07-13T01:53:20Z", "type_id": 800, "status": "?", "name": "needinfo", "id": 1610812, "setter": "erahm@mozilla.com"}], "version": "56 Branch", "mentors_detail": [], "cf_status_firefox64": "---", "component": "Untriaged", "cf_status_geckoview64": "---", "is_creator_accessible": true, "target_milestone": "---", "product": "Firefox", "is_confirmed": false, "cf_platform_rel": "?", "history": [{"when": "2017-07-07T07:53:25Z", "who": "yfdyh000@gmail.com", "changes": [{"removed": "", "added": "[MemShrink]", "field_name": "whiteboard"}]}, {"when": "2017-07-07T21:49:56Z", "who": "tnikkel@gmail.com", "changes": [{"removed": "", "added": "tnikkel@gmail.com", "field_name": "cc"}]}, {"when": "2017-07-13T01:53:20Z", "who": "erahm@mozilla.com", "changes": [{"removed": "", "added": "erahm@mozilla.com", "field_name": "cc"}, {"removed": "HIGH RAM/DISK USAGE", "added": "High heap-unclassified on facebook", "field_name": "summary"}, {"removed": "", "added": "needinfo?(mental2121@gmail.com)", "field_name": "flagtypes.name"}]}, {"when": "2017-07-14T14:14:43Z", "who": "astevenson@mozilla.com", "changes": [{"removed": "", "added": "astevenson@mozilla.com", "field_name": "cc"}, {"removed": "[MemShrink]", "added": "[MemShrink][platform-rel-Facebook]", "field_name": "whiteboard"}, {"removed": "---", "added": "?", "field_name": "cf_platform_rel"}]}, {"when": "2017-07-14T23:20:45Z", "who": "continuation@gmail.com", "changes": [{"removed": "", "added": "continuation@gmail.com", "field_name": "cc"}]}, {"when": "2017-08-09T18:35:56Z", "who": "continuation@gmail.com", "changes": [{"removed": "UNCONFIRMED", "added": "RESOLVED", "field_name": "status"}, {"removed": "", "added": "DUPLICATE", "field_name": "resolution"}, {"removed": "", "added": "2017-08-09T18:35:56Z", "field_name": "cf_last_resolved"}]}], "comments": [{"text": "Created attachment 8884136\nSans titre.png\n\nUser Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\nBuild ID: 20170706060058\n\nSteps to reproduce:\n\nI'm on nightly 56.0a1 x64 Version of 6 july 2017\n\nI left www.facebook.com opened with a youtube music video and web.whatsapp.com all this in backround\n\n\nActual results:\n\nExcessif RAM usage and disk is satured even when closing everything\n\n3,641.63 MB (100.0%) -- explicit\n\u251c\u2500\u25002,608.97 MB (71.64%) \u2500\u2500 heap-unclassified\n\u251c\u2500\u2500\u2500\u2500575.68 MB (15.81%) -- network\n\u2502    \u251c\u2500\u2500575.58 MB (15.81%) -- cache2\n\u2502    \u2502  \u251c\u2500\u2500556.60 MB (15.28%) \u2500\u2500 disk-storage()\n\u2502    \u2502  \u2514\u2500\u2500\u250018.98 MB (00.52%) ++ (7 tiny)\n\u2502    \u2514\u2500\u2500\u2500\u25000.10 MB (00.00%) ++ (5 tiny)\n\u251c\u2500\u2500\u2500\u2500210.17 MB (05.77%) -- js-non-window\n\u2502    \u251c\u2500\u2500172.03 MB (04.72%) -- zones\n\u2502    \u2502  \u251c\u2500\u2500167.27 MB (04.59%) -- zone(0x15c384b7000)\n\u2502    \u2502  \u2502  \u251c\u2500\u2500115.73 MB (03.18%) ++ (359 tiny)\n\u2502    \u2502  \u2502  \u2514\u2500\u2500\u250051.53 MB (01.42%) ++ strings\n\u2502    \u2502  \u2514\u2500\u2500\u2500\u25004.76 MB (00.13%) ++ (5 tiny)\n\u2502    \u2514\u2500\u2500\u250038.14 MB (01.05%) ++ (2 tiny)\n\u251c\u2500\u2500\u2500\u2500\u250088.90 MB (02.44%) ++ (23 tiny)\n\u251c\u2500\u2500\u2500\u2500\u250063.15 MB (01.73%) -- window-objects\n\u2502     \u251c\u2500\u250050.05 MB (01.37%) -- top(about:memory, id=45)\n\u2502     \u2502  \u251c\u2500\u250049.07 MB (01.35%) -- active/window(about:memory)\n\u2502     \u2502  \u2502  \u251c\u2500\u250045.50 MB (01.25%) -- dom\n\u2502     \u2502  \u2502  \u2502  \u251c\u2500\u250045.47 MB (01.25%) \u2500\u2500 orphan-nodes\n\u2502     \u2502  \u2502  \u2502  \u2514\u2500\u2500\u25000.03 MB (00.00%) ++ (5 tiny)\n\u2502     \u2502  \u2502  \u2514\u2500\u2500\u25003.57 MB (00.10%) ++ (4 tiny)\n\u2502     \u2502  \u2514\u2500\u2500\u25000.98 MB (00.03%) ++ js-zone(0x15caf41a000)\n\u2502     \u2514\u2500\u250013.10 MB (00.36%) ++ (7 tiny)\n\u251c\u2500\u2500\u2500\u2500\u250056.22 MB (01.54%) ++ heap-overhead\n\u2514\u2500\u2500\u2500\u2500\u250038.54 MB (01.06%) -- add-ons\n      \u251c\u2500\u250036.43 MB (01.00%) ++ firefox@ghostery.com/window-objects/top(moz-extension://2277f384-134d-496a-bfc4-a43673ae1d8a/_generated_background_page.html, id=27)\n      \u2514\u2500\u2500\u25002.11 MB (00.06%) ++ (15 tiny)\n\n\n3,513.83 MB (100.0%) -- heap-committed\n\u251c\u2500\u25003,457.61 MB (98.40%) \u2500\u2500 allocated\n\u2514\u2500\u2500\u2500\u2500\u250056.22 MB (01.60%) \u2500\u2500 overhead\n\n2,267.16 MB (100.0%) -- explicit\n\u251c\u2500\u25001,055.21 MB (46.54%) -- window-objects\n\u2502  \u251c\u2500\u25001,024.43 MB (45.19%) -- top(https://www.facebook.com/, id=2147483653)\n\u2502  \u2502  \u251c\u2500\u2500\u2500\u2500608.46 MB (26.84%) -- active\n\u2502  \u2502  \u2502    \u251c\u2500\u2500608.38 MB (26.83%) -- window(https://www.facebook.com/)\n\u2502  \u2502  \u2502    \u2502  \u251c\u2500\u2500550.42 MB (24.28%) -- dom\n\u2502  \u2502  \u2502    \u2502  \u2502  \u251c\u2500\u2500548.24 MB (24.18%) \u2500\u2500 orphan-nodes\n\u2502  \u2502  \u2502    \u2502  \u2502  \u2514\u2500\u2500\u2500\u25002.18 MB (00.10%) ++ (5 tiny)\n\u2502  \u2502  \u2502    \u2502  \u251c\u2500\u2500\u250038.68 MB (01.71%) -- js-compartment(https://www.facebook.com/)\n\u2502  \u2502  \u2502    \u2502  \u2502   \u251c\u2500\u250033.17 MB (01.46%) ++ classes\n\u2502  \u2502  \u2502    \u2502  \u2502   \u2514\u2500\u2500\u25005.51 MB (00.24%) ++ (8 tiny)\n\u2502  \u2502  \u2502    \u2502  \u2514\u2500\u2500\u250019.28 MB (00.85%) ++ (3 tiny)\n\n\nExpected results:\n\nI have a 8gb laptop and never had this issue before it was max 300mb/process. Even my game never sucked this much ram before", "id": 12453379, "creation_time": "2017-07-07T02:12:03Z", "author": "mental2121@gmail.com"}, {"text": "The issue seems to be with Facebook", "id": 12453806, "creation_time": "2017-07-07T07:54:37Z", "author": "mental2121@gmail.com"}, {"text": "Can you provide your list of extensions from about:support? It's possible one of those is causing your issue.", "id": 12469194, "creation_time": "2017-07-13T01:53:20Z", "author": "erahm@mozilla.com"}, {"text": "This sounds like a dupe of bug 1379139. Please reopen if you are still seeing this issue with an up to date Nightly.\n\n*** This bug has been marked as a duplicate of bug 1379139 ***", "id": 12551392, "creation_time": "2017-08-09T18:35:56Z", "author": "continuation@gmail.com"}], "attachments": [{"content_type": "image/png", "creator": "mental2121@gmail.com", "flags": [], "is_patch": 0, "creation_time": "2017-07-07T02:12:03Z", "id": 8884136, "is_obsolete": 0}]}
-{"blocks": [], "cf_tracking_geckoview64": "---", "is_cc_accessible": true, "cf_status_thunderbird_esr52": "---", "keywords": [], "cf_qa_whiteboard": "", "url": "", "qa_contact": "", "cf_tracking_firefox64": "---", "cf_status_geckoview65": "---", "cf_rank": null, "cf_status_firefox65": "---", "cf_fx_iteration": "---", "cf_tracking_firefox_relnote": "---", "cf_tracking_firefox65": "---", "cf_last_resolved": "2017-07-04T02:36:27Z", "cf_tracking_firefox66": "---", "cf_fx_points": "---", "cc_detail": [{"email": "dvander@alliedmods.net", "real_name": "David Anderson [:dvander] - inactive, e-mail if emergency", "name": "dvander@alliedmods.net", "nick": "dvander", "id": 309316}, {"email": "Virtual@teknik.io", "real_name": "Virtual_ManPL [:Virtual] - (please needinfo? me - so I will see your comment/reply/question/etc.)", "name": "Virtual@teknik.io", "nick": "Virtual", "id": 342842}, {"email": "yfdyh000@gmail.com", "real_name": "YF (Yang)", "name": "yfdyh000@gmail.com", "nick": "yfdyh000", "id": 398515}], "summary": "Firefox Nightly 56 shows no buttons and no page content.", "cf_has_str": "---", "cf_user_story": "", "platform": "x86", "cf_status_firefox_esr60": "---", "votes": 0, "version": "56 Branch", "mentors_detail": [], "cf_tracking_thunderbird_esr52": "---", "is_creator_accessible": true, "is_confirmed": false, "priority": "--", "cf_status_thunderbird_esr60": "---", "assigned_to_detail": {"email": "nobody@mozilla.org", "real_name": "Nobody; OK to take it and work on it", "name": "nobody@mozilla.org", "nick": "nobody", "id": 1}, "creator": "johngraciliano@gmail.com", "last_change_time": "2017-07-17T21:46:57Z", "creator_detail": {"email": "johngraciliano@gmail.com", "real_name": "", "name": "johngraciliano@gmail.com", "nick": "johngraciliano", "id": 532161}, "comment_count": 3, "cc": ["dvander@alliedmods.net", "Virtual@teknik.io", "yfdyh000@gmail.com"], "duplicates": [], "cf_tracking_thunderbird_esr60": "---", "assigned_to": "nobody@mozilla.org", "groups": [], "see_also": [], "id": 1378004, "whiteboard": "", "creation_time": "2017-07-04T00:08:07Z", "depends_on": [], "cf_tracking_geckoview65": "---", "mentors": [], "dupe_of": 1377866, "cf_status_firefox66": "---", "resolution": "DUPLICATE", "classification": "Components", "alias": null, "cf_has_regression_range": "---", "op_sys": "Windows 8", "status": "RESOLVED", "cf_crash_signature": "", "is_open": false, "severity": "major", "cf_tracking_firefox_esr60": "---", "flags": [], "cf_status_firefox64": "---", "component": "Graphics", "cf_status_geckoview64": "---", "target_milestone": "---", "product": "Core", "cf_platform_rel": "---", "history": [{"when": "2017-07-04T02:36:27Z", "who": "yfdyh000@gmail.com", "changes": [{"removed": "UNCONFIRMED", "added": "RESOLVED", "field_name": "status"}, {"removed": "Unspecified", "added": "x86", "field_name": "platform"}, {"removed": "Untriaged", "added": "Graphics", "field_name": "component"}, {"removed": "", "added": "yfdyh000@gmail.com", "field_name": "cc"}, {"removed": "", "added": "DUPLICATE", "field_name": "resolution"}, {"removed": "Firefox", "added": "Core", "field_name": "product"}, {"removed": "normal", "added": "major", "field_name": "severity"}, {"removed": "Unspecified", "added": "Windows 8", "field_name": "op_sys"}, {"removed": "", "added": "2017-07-04T02:36:27Z", "field_name": "cf_last_resolved"}]}, {"when": "2017-07-04T05:00:38Z", "who": "dvander@alliedmods.net", "changes": [{"removed": "", "added": "dvander@alliedmods.net", "field_name": "cc"}, {"removed": "", "added": "needinfo?(johngraciliano@gmail.com)", "field_name": "flagtypes.name"}]}, {"when": "2017-07-04T07:53:38Z", "who": "Virtual@teknik.io", "changes": [{"removed": "", "added": "Virtual@MsgSafe.io", "field_name": "cc"}]}, {"when": "2017-07-17T21:46:57Z", "who": "dvander@alliedmods.net", "changes": [{"removed": "needinfo?(johngraciliano@gmail.com)", "added": "", "field_name": "flagtypes.name"}]}], "comments": [{"text": "User Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0\nBuild ID: 20170701030203\n\nSteps to reproduce:\n\nUpdated Nightly. (Either via interface or running firefox-56.0a1.en-US.win64.installer.exe [2017.07.02 mozilla central]).  This is in a Windows 8 machine!\n\n\nActual results:\n\nAfter restarting, nothing showed the bars were empty, the content was empty.  However (some?) buttons areas in the navigation bar were useful (tool tips show up).  A click above on the area below the close button made the options panel to show and I was able to restart in safe mode.  Firefox works in Safe Mode.  However, Firefox will not work with a new profile, even after refreshing Firefox.  I reverted to 2017.07.01. The 2017.07.03 does not fix anything for me.\n\n\nExpected results:\n\nFirefox Nightly should work mostly after an update.", "id": 12445163, "creation_time": "2017-07-04T00:08:07Z", "author": "johngraciliano@gmail.com"}, {"text": "\n\n*** This bug has been marked as a duplicate of bug 1377866 ***", "id": 12445279, "creation_time": "2017-07-04T02:36:27Z", "author": "yfdyh000@gmail.com"}, {"text": "John, if you get a chance could you attach your about:support? I will make sure the configuration is included in the fix for bug 1377866.", "id": 12445393, "creation_time": "2017-07-04T05:00:38Z", "author": "dvander@alliedmods.net"}], "attachments": []}
+{"whiteboard": "[MemShrink][platform-rel-Facebook]"}
+{"whiteboard": ""}
+{"whiteboard": "inj+ [AV:Quick Heal] "}
+{"whiteboard": "[AV:Quick Heal][regressed sept 6th][dll version is 3.0.1.*]"}
+{"whiteboard": "[AV:Quick Heal]inj+"}
+{"whiteboard": "[AV:Quick Heal] inj+"}
+{"whiteboard": "inj+ [AV:Quick Heal]"}
+{"whiteboard": "inj+[AV:Quick Heal]"}
+{"whiteboard": "inj+ ux [AV:Quick Heal] qf"}
diff --git a/tests/test_bug_features.py b/tests/test_bug_features.py
--- a/tests/test_bug_features.py
+++ b/tests/test_bug_features.py
@@ -72,7 +72,7 @@ def test_has_github_url():
 
 
 def test_whiteboard():
-    read('whiteboard.json', whiteboard, [['memshrink'], []])
+    read('whiteboard.json', whiteboard, [['memshrink', 'platform-rel-facebook'], [], ['inj+', 'av:quick heal', 'av'], ['av:quick heal', 'regressed sept 6th', 'dll version is 3.0.1.*', 'av'], ['av:quick heal', 'inj+', 'av'], ['av:quick heal', 'inj+', 'av'], ['inj+', 'av:quick heal', 'av'], ['inj+', 'av:quick heal', 'av'], ['inj+', 'ux', 'av:quick heal', 'qf', 'av']])
 
 
 def test_patches():