Clarify applicable queries in task tests

Add specific test-cases to test the applicability rule so that it can be
removed from many tests intended to test other things.  Remove the
unneeded applicable queries to simplify the other test cases. Add
comments explaining many remaining applicable queries that are still
needed.

Change-Id: I0a7ebb48806d40270b17ef8adcf267100d21c42c
diff --git a/src/main/resources/Documentation/task_states.md b/src/main/resources/Documentation/task_states.md
index 222728c..3ab312c 100644
--- a/src/main/resources/Documentation/task_states.md
+++ b/src/main/resources/Documentation/task_states.md
@@ -8,14 +8,17 @@
 
 ```
 [root "Root N/A"]
-  applicable = is:closed
+  applicable = is:closed # Assumes test query is "is:open"
+
+[root "Root APPLICABLE"]
+  applicable = is:open # Assumes test query is "is:open"
+  pass = True
+  subtask = Subtask APPLICABLE
 
 [root "Root PASS"]
-  applicable = is:open
   pass = True
 
 [root "Root FAIL"]
-  applicable = is:open
   fail = True
 
 [root "Root straight PASS"]
@@ -36,19 +39,16 @@
   fail = is:open
 
 [root "Root grouping PASS (subtask PASS)"]
-  applicable = is:open
   subtask = Subtask PASS
 
 [root "Root grouping WAITING (subtask READY)"]
-  applicable = is:open
   subtask = Subtask READY
 
 [root "Root grouping WAITING (subtask FAIL)"]
-  applicable = is:open
   subtask = Subtask FAIL
 
 [root "Root grouping NA (subtask NA)"]
-  applicable = is:open
+  applicable = is:open # Assumes Subtask NA has "applicable = NOT is:open"
   subtask = Subtask NA
 
 [root "Root READY (subtask PASS)"]
@@ -78,30 +78,24 @@
    pass = -is:open
 
 [root "Subtasks File"]
-  applicable = is:open
   subtasks-file = common.config
 
 [root "Subtasks File (Missing)"]
-  applicable = is:open
   subtasks-file = common.config
   subtasks-file = missing
 
 [root "Subtasks External"]
-  applicable = is:open
   subtasks-external = user special
 
 [root "Subtasks External (Missing)"]
-  applicable = is:open
   subtasks-external = user special
   subtasks-external = missing
 
 [root "Subtasks External (User Missing)"]
-  applicable = is:open
   subtasks-external = user special
   subtasks-external = user missing
 
 [root "Subtasks External (File Missing)"]
-  applicable = is:open
   subtasks-external = user special
   subtasks-external = file missing
 
@@ -113,21 +107,24 @@
   subtask = Subtask Properties
 
 [root "INVALIDS"]
-  applicable = is:open
   subtasks-file = invalids.config
 
 [root "Root NA Pass"]
-  applicable = -is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
   pass = True
 
 [root "Root NA Fail"]
-  applicable = -is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
   fail = True
 
 [root "NA INVALIDS"]
-  applicable = -is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
   subtasks-file = invalids.config
 
+[task "Subtask APPLICABLE"]
+  applicable = is:open
+  pass = True
+
 [task "Subtask FAIL"]
   applicable = is:open
   fail = is:open
@@ -143,7 +140,7 @@
   pass = is:open
 
 [task "Subtask NA"]
-  applicable = NOT is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
 
 [task "Subtask Properties"]
   subtask = Subtask Properties Hints
@@ -189,18 +186,15 @@
 [task "file task/common.config FAIL"]
   applicable = is:open
   fail = is:open
-  pass = is:open
 ```
 
 `task/invalids.config` file in project `All-Projects` on ref `refs/meta/config`.
 
 ```
 [task "No PASS criteria"]
-  applicable = is:open
   fail-hint = Invalid without Pass criteria and without subtasks
 
 [task "WAITING (subtask INVALID)"]
-  applicable = is:open
   pass = is:open
   subtask = Subtask INVALID
 
@@ -209,34 +203,30 @@
   subtask = Subtask INVALID
 
 [task "WAITING (subtask missing)"]
-  applicable = is:open
   pass = is:open
   subtask = MISSING # security bug: subtask name appears in output
 
 [task "Grouping WAITING (subtask INVALID)"]
-  applicable = is:open
   subtask = Subtask INVALID
 
 [task "Grouping WAITING (subtask missing)"]
-  applicable = is:open
   subtask = MISSING  # security bug: subtask name appears in output
 
 [task "Subtask INVALID"]
-  applicable = is:open
   fail-hint = Use when an INVALID subtask is needed, not meant as a test case in itself
 
 [task "NA Bad PASS query"]
-  applicable = -is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
   fail = True
   pass = has:bad
 
 [task "NA Bad FAIL query"]
-  applicable = -is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
   pass = True
   fail = has:bad
 
 [task "NA Bad INPROGRESS query"]
-  applicable = -is:open
+  applicable = NOT is:open # Assumes test query is "is:open"
   fail = True
   in-progress = has:bad
 
@@ -259,7 +249,6 @@
 [task "userfile task/special.config FAIL"]
   applicable = is:open
   fail = is:open
-  pass = is:open
 ```
 
 The expected output for the above task config looks like:
@@ -275,6 +264,18 @@
          "roots" : [
             {
                "hasPass" : true,
+               "name" : "Root APPLICABLE",
+               "status" : "PASS",
+               "subTasks" : [
+                  {
+                     "hasPass" : true,
+                     "name" : "Subtask APPLICABLE",
+                     "status" : "PASS"
+                  }
+               ]
+            },
+            {
+               "hasPass" : true,
                "name" : "Root PASS",
                "status" : "PASS"
             },
diff --git a/test/all b/test/all
index ef506c7..5ce71fc 100644
--- a/test/all
+++ b/test/all
@@ -11,6 +11,20 @@
             {
                "applicable" : true,
                "hasPass" : true,
+               "name" : "Root APPLICABLE",
+               "status" : "PASS",
+               "subTasks" : [
+                  {
+                     "applicable" : true,
+                     "hasPass" : true,
+                     "name" : "Subtask APPLICABLE",
+                     "status" : "PASS"
+                  }
+               ]
+            },
+            {
+               "applicable" : true,
+               "hasPass" : true,
                "name" : "Root PASS",
                "status" : "PASS"
             },
diff --git a/test/root.change b/test/root.change
index e0d4187..3ca43aa 100644
--- a/test/root.change
+++ b/test/root.change
@@ -1,9 +1,7 @@
 [root "INVALIDS Preview"]
-  applicable = is:open
   subtasks-file = invalids.config
 
 [root "Root PASS Preview"]
-  applicable = is:open
   pass = True
 
 [root "Root READY (subtask PASS) Preview"]
@@ -13,7 +11,6 @@
   ready-hint = You must now run the ready task
 
 [root "Subtasks External Preview"]
-  applicable = is:open
   subtasks-external = user special Preview
 
 [root "Root NA Pass Preview"]