Page MenuHomePhabricator

Conduit "maniphest.search" method call allows ordering by "project" column on arbitrary queries, but this internal column is only meaningful when "Group By" is "Project"
Open, WishlistPublic

Description

from https://discourse.phabricator-community.org/t/conduit-api-maniphest-search-with-params-order-project-id-returns-error-502/

(here, today)
calling maniphest.search with order: [“project”, “id”] results in this error:
#1054: Unknown column 'projectGroupName.indexedObjectName' in 'order clause'

Event Timeline

This isn't meaningful, but we can raise a more specific error.

Specifically, ordering by "project" is not meaningful if you aren't also grouping by project. A task may belong to both "Aardvark Adventure" and "Zebra Zither Concerto". I'm not sure what the user is trying to do, but it probably isn't valid and/or this probably isn't the best way to accomplish it.

The fix I'd propose is:

  • When we begin executing the query:
    • If project is in the order vector and groupBy is any value other than GROUP_PROJECT:
      • Throw an exception trying to explain that this order is not sensible in the general case and explaining the underlying constraint ("You can not order by project unless you are also grouping by project.")

Alternatively, since project is automatically applied to the vector if it is relevant (that is, GROUP_PROJECT implies that the vector becomes project, ..., regardless of other settings) we could add some kind of key to getOrderableColumns() like 'internal' => true, a flag which causes the ordering column to be hidden from Conduit help and rejected in Conduit calls. This is perhaps cleaner, but perhaps also a little more work.

epriestley renamed this task from task search by project errors out to Conduit "maniphest.search" method call allows ordering by "project" column on arbitrary queries, but this internal column is only meaningful when "Group By" is "Project".Jul 20 2018, 5:14 PM
epriestley triaged this task as Wishlist priority.
epriestley added a project: Conduit.