Page MenuHomePhabricator

Add support for Dependent Tasks filter in Maniphest search queries
Needs RevisionPublic

Authored by rafikk on May 29 2014, 1:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 10:21 AM
Unknown Object (File)
Sun, Apr 7, 5:40 PM
Unknown Object (File)
Sun, Apr 7, 5:16 PM
Unknown Object (File)
Mar 14 2024, 3:12 AM
Unknown Object (File)
Mar 14 2024, 3:12 AM
Unknown Object (File)
Feb 15 2024, 10:50 PM
Unknown Object (File)
Feb 1 2024, 1:19 AM
Unknown Object (File)
Jan 18 2024, 9:56 AM
Tokens
"Like" token, awarded by brianespinosa."Like" token, awarded by cspickert.

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

While the list of dependent tasks on a task page is nice, I'd like a view of those tasks grouped by priority/assigned. This revision allows you to construct that view via search queries in Maniphest.

Test Plan

Tested search in local instance of Phabricator running against my company installation's database.

Diff Detail

Repository
rP Phabricator
Branch
dependent-tasks-filter
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 757
Build 757: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

rafikk retitled this revision from to Add support for Dependent Tasks filter in Maniphest search queries.
rafikk updated this object.
rafikk edited the test plan for this revision. (Show Details)
rafikk added a reviewer: epriestley.
rafikk set the repository for this revision to rP Phabricator.

This would be super useful for us.

Can you walk me through this use case a bit? How many dependencies do tasks have in your system?

It's also a little surprising to me that this is listing things which are blocked by a task (right?) not things which are blocking a task. I could imagine wanting to know who owns all the stuff that's blocking a task so you can, e.g., go yell at them or whatever, but I'm less clear on why it's useful to see things which a task blocks.

We're using high-level tasks to manage individual development/release phases of features, similar to T1049: Implement Harbormaster or T2015: Implement Drydock but with many more subtasks (now called "Blocked By" tasks, it seems, but I'll continue to refer to them as subtasks in this comment for continuity). On the individual task page, you can see a list of all the subtasks of the item (sorted by open v. closed), but there is no mechanism to view those tasks by priority or by assignee, or anything else you can do via Advanced Search.

So the use looks like: Show me all subtasks of "Implement Drydock" grouped by assignee or Show me all subtasks of "Implement Harbormaster" grouped by priority. AFACT, there's no way to do that.

Given your comment and the recent naming changes, perhaps there should be two fields added to Maniphest search: Blocked By Task IDs and Blocking Task IDs, which would enable either view.

That makes sense -- either I'm misreading this or the edge type isn't right? Or maybe we're using the edge types wrong internally? See inline...

src/applications/maniphest/query/ManiphestTaskQuery.php
383

I would expect this to be TYPE_TASK_DEPENDS_ON_TASK?

No, it's correct. We've got it running on our internal Phabricator installation. You want the list of all tasks that are dependended on by the task you're querying for. So if I wanted all subtasks of T1049: Implement Harbormaster, I would want all tasks that are dependended on by T1049, not all tasks that depend on that task.

Ohhh, it's querying on edge.dst. Another way to write the query would be:

JOIN edge ON edge.dst = task.phid WHERE edge.src IN (%Ls) ...

This would use the other half of the edge.

Since there a (src, type, dst) key but no (dst, type, src) key these approaches probably have very different query plans. I would expect the src join (as here) to require a table scan of the edge table, while the dst join would be able to use the key.

That seems to be the case in practice. Here's the query plan on this install for the query as written (table scan of the entire edge table):

mysql> explain SELECT * FROM maniphest_task t JOIN edge e ON e.src = t.phid WHERE e.type = 3 AND e.dst IN ('PHID-TASK-24ufnbymvb5hiahutw45');
+----+-------------+-------+--------+---------------+------+---------+-----------------------------+------+-------------+
| id | select_type | table | type   | possible_keys | key  | key_len | ref                         | rows | Extra       |
+----+-------------+-------+--------+---------------+------+---------+-----------------------------+------+-------------+
|  1 | SIMPLE      | e     | ALL    | PRIMARY,src   | NULL | NULL    | NULL                        | 4349 | Using where |
|  1 | SIMPLE      | t     | eq_ref | phid          | phid | 194     | phabricator_maniphest.e.src |    1 |             |
+----+-------------+-------+--------+---------------+------+---------+-----------------------------+------+-------------+
2 rows in set (0.00 sec)

Here's the query plan for the version which uses the key:

mysql> explain SELECT * FROM maniphest_task t JOIN edge e ON e.dst = t.phid WHERE e.type = 4 AND e.src IN ('PHID-TASK-24ufnbymvb5hiahutw45');
+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+-------------+
| id | select_type | table | type   | possible_keys | key     | key_len | ref                         | rows | Extra       |
+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+-------------+
|  1 | SIMPLE      | e     | ref    | PRIMARY,src   | PRIMARY | 198     | const,const                 |    1 | Using where |
|  1 | SIMPLE      | t     | eq_ref | phid          | phid    | 194     | phabricator_maniphest.e.dst |    1 |             |
+----+-------------+-------+--------+---------------+---------+---------+-----------------------------+------+-------------+
2 rows in set (0.00 sec)

Oh, great point. I wasn't aware of which indexes were available on the edge table. I'll definitely make that change. Anything else to include in the next diff? Should I rename/add Blocking Task IDs and Blocked By Task IDs as well?

epriestley edited edge metadata.

This is ~18 months old. If it is eventually revised, see Contributing Feature Requests and Contributing Code for modern contribution guidelines.

This revision now requires changes to proceed.Nov 23 2015, 3:38 PM