Page MenuHomePhabricator

Editing tasks results in "You cannot add more than 0 objects to the relationship" error
Closed, ResolvedPublicBUG REPORT


List of steps to reproduce (step by step, including full links if applicable):

  • Visit a task.
  • Click "Edit Related Tasks"->"Edit Parent Tasks"
  • Select a parent task and click "Save Parent Tasks"

What happens?:
A dialog appears with title "Invalid Relationship" and message "You cannot add more than 0 objects to the relationship."

What should have happened instead?:
The parent tasks list should be updated successfully.

Taavi says:
looks like a custom hack of ours broken by some upstream change:

Event Timeline

It wasn't broken by an upstream change, it was only deployed today and the change doesn't work properly because only ManiphestTaskMergeInRelationship and ManiphestTaskCloseAsDuplicateRelationship specify a value in getMaximumSelectionSize(). This means other relationship types default to null here:

Ok, think I have a patch:

--git a/src/applications/maniphest/relationship/ManiphestTaskMergeInRelationship.php b/src/applications/maniphest/relationship/ManiphestTaskMergeInRelationship.php
index c2a35361d3..b99335401f 100644
--- a/src/applications/maniphest/relationship/ManiphestTaskMergeInRelationship.php
+++ b/src/applications/maniphest/relationship/ManiphestTaskMergeInRelationship.php
@@ -58,10 +58,6 @@ final class ManiphestTaskMergeInRelationship
   public function willUpdateRelationships($object, array $add, array $rem) {
-    if (count($add) > $this->getMaximumSelectionSize()) {
-    }
     return $this->newMergeFromTransactions($add);
diff --git a/src/applications/search/controller/PhabricatorSearchRelationshipController.php b/src/applications/search/controller/PhabricatorSearchRelationshipController.php
index 796822b25c..10c57f5a9a 100644
--- a/src/applications/search/controller/PhabricatorSearchRelationshipController.php
+++ b/src/applications/search/controller/PhabricatorSearchRelationshipController.php
@@ -81,12 +81,14 @@ final class PhabricatorSearchRelationshipController
       try {
         $max_selection = $relationship->getMaximumSelectionSize();
-        if (count($add_phids) && count($add_phids) > $max_selection) {
-          throw new Exception(
-            pht(
-              'You cannot add more than %d objects to the relationship.',
-              $max_selection
-            ));
+        if (! is_null($max_selection)) {
+          if (count($add_phids) && count($add_phids) > $max_selection) {
+            throw new Exception(
+              pht(
+                'You cannot add more than %d objects to the relationship.',
+                $max_selection
+              ));
+          }
         foreach ($add_phids as $add_phid) {
           $dst_object = idx($dst_objects, $add_phid);`


2022-06-15-14:00:46.png (594×1 px, 73 KB)


2022-06-15-14:01:10.png (682×1 px, 96 KB)

Now to figure out arc...

Mentioned in SAL (#wikimedia-releng) [2022-06-15T22:39:50Z] <brennen> phabricator: tagged release/2022-06-15/1 (T310742)

brennen claimed this task.
brennen moved this task from To Triage to Misc on the Phabricator board.