A way to filter tasks by subprojects and milestones?


Phabricator has support for filtering tasks by “”, "In any: " and "Not in: ". Question is there a way to filter tasks that are assigned to milestones of some project. ("Milestone of: ").

Our use-case: “Product” project that has a few workboard columns + every week we create a milestone “Sprint 202021”. It would be amazing to be able to build a dashboard listing the weeks tasks, but adjusting the query every week seems a bit cumbersome and it would be great if we could add “Milestones of: Product” to the search query for tasks.

If not right now possible - is it technically complex task or would it be possible to drop in some custom class to src/extensions directory to extend the project search field with “Milestone of: …” option? Would this be advisable? Could you provide a few pointers where to look for implementation of “Not in/In any”?

Thank you in advance.

There’s currently no way to do this.

I think milestone-of(project) is conceptually reasonable, although there are some other approaches which might be cleaner fits and/or solve a wider range of problems. One general issue is that you currently can not compose functions within tokenizers (for example, you can’t query for hypothetical milestone-of(viewerprojects())). I imagine possibly supporting this eventually, it’s just complex and mostly serves fairly niche use cases. If composition was supported, is-milestone(...) might accomplish the same goal in a more powerful way.

Since you can (almost) express milestone-of(project) in a Project query, another approach might be to support projects-query(123abc) and just let you execute an inline subquery.

In both cases, the most complex part of the feature is probably building the UI rather than implementing the underlying behavior.

There’s also some discussion of a Current Milestone function.

Would [writing an extension] be advisable?

The datasource itself isn’t directly extensible today, but it can be extended by adding a new datasource for milestone-of(project) to src/extensions/, then making a one line change to PhabricatorProjectLogicalDatasource.php to include your new datasource in getComponentDatasources().

To create the datasource: copy PhabricatorProjectLogicalOrNotDatasource.php and adjust evaluateFunction(...) to load the projects passed to the function, then emit OPERATOR_OR constraints for the milestones.

(This is not wildly complex, but may be fairly challenging if you aren’t familiar with Phabricator and/or PHP.)

Thank you for the explanation, @epriestley. I appreciate the detailed answer.

It does sound a bit involved. I had written a custom app for Phabricator (albeit very very simple), so have a bit of experience, but at the moment cannot justify time at work to dive into trying this out right now. But will keep an eye out to maybe justify an internal “side-project”. Will report here if I get anywhere useful.

I think that one way to help with this use case it to enable searching in a way that considers tasks assigned to a Milestone or a Subproject a part of the parent project, as well.

We have a “sprints”, project with a new milestone for each sprint. I was surprised when searching for tasks within Sprints project didn’t include tasks that were assigned to any of the milestones of the Sprints project!

Maybe an easy way to implement it UI-wise would be to add a checkbox that would toggle whether suprojects should be taken into consideration or not? Like “:white_check_mark: search in subprojects as well

My expectation is that Phabricator already works like this. Here’s an example of a search for a parent project tag finding tasks tagged with a milestone of that project:

Not to get too off-topic here, but that would be quite neat! As it currently stands, at my own work I just have the latest milestone for our primary product pinned as a link in the sidebar on the dashboard. It’d be neat to have that more integrated.

Not sure how I missed this, but it does work when the search query looks like this:

It isn’t very intuitive, but it does cover the use-case for us, as long as we only have one milestone active and no sub-projects (which in our case is true).

1 Like