Page MenuHomePhabricator

Weird indentation on task list (due to empty rendering of deadline subtype tag)
Closed, ResolvedPublicBUG REPORT

Description

Why are the tags for T379335 indented as such?

Screenshot 2024-11-08 at 14.58.11.png (389×936 px, 79 KB)

Details

Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Task list view: Do not render tag for Deadline tasks without due daterepos/phabricator/extensions!42aklapperT379376emptyDueDatewmf/stable
Customize query in GitLab

Event Timeline

Aklapper renamed this task from Weird indenting on activity list to Weird indentation on task list (due to empty rendering of deadline subtype tag).Nov 18 2024, 3:50 PM
Aklapper triaged this task as Low priority.

Code triggering this behavior is custom hasTagView() in https://gitlab.wikimedia.org/repos/phabricator/extensions/-/blob/wmf/stable/src/customfields/DeadlineEditEngineSubtype.php not checking that the storage value can be empty, basically:

diff --git a/src/customfields/DeadlineEditEngineSubtype.php b/src/customfields/DeadlineEditEngineSubtype.php
index 0d48826..839ece1 100644
--- a/src/customfields/DeadlineEditEngineSubtype.php
+++ b/src/customfields/DeadlineEditEngineSubtype.php
@@ -8,6 +8,11 @@ class DeadlineEditEngineSubtype extends PhabricatorEditEngineSubtype {
   }
 
   public function hasTagView() {
+    $deadline = $this->getDeadline(PhabricatorUser::getOmnipotentUser());
+    // Tasks can have Deadline type but an empty deadline value - T379376
+    if ($deadline && !$deadline->getValueForStorage()) {
+      return false;
+    }
     return true;
   }

Ideally I'd say that tasks shouldn't be of subtype "Deadline" when no Due Date is set. But our entire custom Deadline implementation is...interesting.

Digging more into code history related to T379376, it looks like rPHEXbc14cc06e1176db0a89deab7ffcf58b68ad36060 hid the issue in T379376 in the past, as we had H295 and H296 avoiding this situation by automatically changing task subtype. However I disabled these Herald rules as the internal implementation of custom fields had somehow changed (I'm not aware of details though) and is now broken only showing "Unknown Field" in the Herald settings (and rPHEXbc14cc06e1176db0a89deab7ffcf58b68ad36060 not doing anymore what it was supposed to do?), which made me file https://we.phorge.it/T15885 and https://we.phorge.it/T15887 in upstream to potentially make Phorge code more robust.

Naively trying to re-set up these two Herald rules, the "Custom Fields" section in the Herald rule "Conditions" dropdown does not list a Deadline/Due Date field nowadays but there are none of our three date type Custom Fields offered in Herald (and none of type users either) as https://secure.phabricator.com/T655#131721 implies it's not supported (which makes me wonder if we changed the Deadline custom field to a date type in maniphest.custom-field-definitions at some point?).

aklapper merged https://gitlab.wikimedia.org/repos/phabricator/extensions/-/merge_requests/42

Task list view: Do not render tag for Deadline tasks without due date

For the records, a similar problem is exposed in the Task Graph section:

Screenshot from 2024-12-16 23-39-28.png (263×568 px, 27 KB)

Aklapper changed the subtype of this task from "Task" to "Deadline".
Aklapper changed the subtype of this task from "Deadline" to "Bug Report".

Confirming this is fixed by today's deployment.