@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.

When a Herald rule blocks a push, show which rule fired in the push log UI

Summary:
Ref T13164. See PHI765. We currently show "Rejected: Herald" in the push log UI, but don't show which rule rejected a push.

We store this data, and it's potentially useful: either for hunting down a particular issue, or for getting a general sense of how often a reject rule is triggering (maybe because you want to tune how aggressive it is).

Show this data in the web UI, and include it in the data export payload.

Test Plan:
- Pushed to a hosted repository so that I got blocked by a Herald rule.
- Viewed the push logs in the web UI, now saw which rule triggered things.
- Exported logs to CSV, saw Herald rule PHIDs in the data.

{F5776211}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

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

+22 -5
+18 -5
src/applications/diffusion/view/DiffusionPushLogListView.php
··· 14 14 $logs = $this->logs; 15 15 $viewer = $this->getViewer(); 16 16 17 + $reject_herald = PhabricatorRepositoryPushLog::REJECT_HERALD; 18 + 17 19 $handle_phids = array(); 18 20 foreach ($logs as $log) { 19 21 $handle_phids[] = $log->getPusherPHID(); ··· 21 23 if ($device_phid) { 22 24 $handle_phids[] = $device_phid; 23 25 } 26 + 27 + if ($log->getPushEvent()->getRejectCode() == $reject_herald) { 28 + $handle_phids[] = $log->getPushEvent()->getRejectDetails(); 29 + } 24 30 } 25 31 26 - $handles = $viewer->loadHandles($handle_phids); 32 + $viewer->loadHandles($handle_phids); 27 33 28 34 // Only administrators can view remote addresses. 29 35 $remotes_visible = $viewer->getIsAdmin(); ··· 74 80 $flag_names); 75 81 76 82 $reject_code = $log->getPushEvent()->getRejectCode(); 77 - $reject_label = idx( 78 - $reject_map, 79 - $reject_code, 80 - pht('Unknown ("%s")', $reject_code)); 83 + 84 + if ($reject_code == $reject_herald) { 85 + $rule_phid = $log->getPushEvent()->getRejectDetails(); 86 + $handle = $viewer->renderHandle($rule_phid); 87 + $reject_label = pht('Blocked: %s', $handle); 88 + } else { 89 + $reject_label = idx( 90 + $reject_map, 91 + $reject_code, 92 + pht('Unknown ("%s")', $reject_code)); 93 + } 81 94 82 95 $rows[] = array( 83 96 phutil_tag(
+4
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
··· 149 149 id(new PhabricatorStringExportField()) 150 150 ->setKey('resultName') 151 151 ->setLabel(pht('Result Name')), 152 + id(new PhabricatorStringExportField()) 153 + ->setKey('resultDetails') 154 + ->setLabel(pht('Result Details')), 152 155 id(new PhabricatorIntExportField()) 153 156 ->setKey('writeWait') 154 157 ->setLabel(pht('Write Wait (us)')), ··· 237 240 'flagNames' => $flag_names, 238 241 'result' => $result, 239 242 'resultName' => $result_name, 243 + 'resultDetails' => $event->getRejectDetails(), 240 244 'writeWait' => $event->getWriteWait(), 241 245 'readWait' => $event->getReadWait(), 242 246 'hostWait' => $event->getHostWait(),