@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Group query results under the "ANCESTOR" operator unconditionally

Summary:
Fixes T12753. See that task for reproduction instructions.

We add a `GROUP BY` clause to queries with an "ANCESTOR" edge constraint only if the constaint has more than one PHID, but this is incorrect: the same row can be found twice by an ANCESTOR query if task T is tagged with both "B" and "C", children of "A", and the user queries for "tasks in A".

Instead, always add GROUP BY for ANCESTOR queries.

Test Plan:
- Followed test plan in T12753.
- Saw proper paging controls after change.
- Saw `GROUP BY` in DarkConsole.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12753

Differential Revision: https://secure.phabricator.com/D18012

+6 -1
+6 -1
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 1811 1811 case PhabricatorQueryConstraint::OPERATOR_NOT: 1812 1812 case PhabricatorQueryConstraint::OPERATOR_AND: 1813 1813 case PhabricatorQueryConstraint::OPERATOR_OR: 1814 - case PhabricatorQueryConstraint::OPERATOR_ANCESTOR: 1815 1814 if (count($list) > 1) { 1816 1815 return true; 1817 1816 } 1818 1817 break; 1818 + case PhabricatorQueryConstraint::OPERATOR_ANCESTOR: 1819 + // NOTE: We must always group query results rows when using an 1820 + // "ANCESTOR" operator because a single task may be related to 1821 + // two different descendants of a particular ancestor. For 1822 + // discussion, see T12753. 1823 + return true; 1819 1824 case PhabricatorQueryConstraint::OPERATOR_NULL: 1820 1825 return true; 1821 1826 }