We have a class that extends DifferentialCoreCustomField (class body included below). Prior to D17067, calling differential.updaterevision with fields: {"devTestPHIDs" : ["PHID-TASK-ooohnicetaskphidjosh"] } worked as expected, adding the devTestPHIDs field to the revision object. After D17067, the call to updaterevision seems to succeed (no errors are returned), but it does not add the value to the revision.
While digging into it I found that the field map which gets created in DifferentialConduitAPIMethod no longer includes our custom field (as of https://secure.phabricator.com/rP64509dc#202368f8).
The old way of constructing the $field_map is:
$field_list = PhabricatorCustomField::getObjectFields( $revision, DifferentialCustomField::ROLE_COMMITMESSAGEEDIT); $field_list ->setViewer($viewer) ->readFieldsFromStorage($revision); $field_map = mpull($field_list->getFields(), null, 'getFieldKeyForConduit');
This includes our CIDevelopmentTestsDifferentialCustomField. However the new way of constructing the $field_map is:
$field_map = DifferentialCommitMessageField::newEnabledFields($viewer);
This does not include our CIDevelopmentTestsDifferentialCustomField.
I'm wondering whether the differential overhaul changed how custom fields should be added or if there's a legitimate bug with differential.updaterevision since the update.
Repro Steps
- Add a custom differential field class by extending DifferentialCoreCustomField
- Attempt to update your custom field by calling the differential.updaterevision conduit endpoint.
- Note that the field does not get updated.
Version Info
phabricator 9d10727f651fd4b359c4893f1886b7e436faad91 (Fri, Dec 30)
arcanist e8b580d2e5e740071b25d087a0aca33f0b0dd691 (Fri, Dec 30)
phutil 0ae0cc00acb1413c22bfe3384fd6086ade4cc206 (Fri, Dec 9)
CIDevelopmentTestsDifferentialCustomField.php:
<?php final class CIDevelopmentTestsDifferentialCustomField extends DifferentialCoreCustomField { public function getFieldKey() { return 'integrator:dev-tests'; } public function getFieldKeyForConduit() { return 'devTestPHIDs'; } public function canDisableField() { return false; } public function shouldAppearInEditView() { return false; } public function getFieldName() { return pht('Dev Tests'); } public function getFieldDescription() { return pht( 'Tasks corresponding to extended testing performed on this revision, '. 'such as track testing on a vehicle, or staging area deployments.'); } public function shouldAppearInPropertyView() { return true; } public function renderPropertyViewLabel() { return $this->getFieldName(); } protected function readValueFromRevision(DifferentialRevision $revision) { if (!$revision->getPHID()) { return array(); } return PhabricatorEdgeQuery::loadDestinationPHIDs( $revision->getPHID(), CIRevisionHasDevelopmentTestEdgeType::EDGECONST); } public function getApplicationTransactionType() { return PhabricatorTransactions::TYPE_EDGE; } public function getApplicationTransactionMetadata() { return array( 'edge:type' => CIRevisionHasDevelopmentTestEdgeType::EDGECONST, ); } public function getNewValueForApplicationTransactions() { $edges = array(); foreach ($this->getValue() as $phid) { $edges[$phid] = $phid; } return array('=' => $edges); } public function getRequiredHandlePHIDsForPropertyView() { return $this->getValue(); } public function renderPropertyViewValue(array $handles) { return $this->renderHandleList($handles); } public function shouldAppearInCommitMessage() { return true; } public function shouldAllowEditInCommitMessage() { return true; } public function getCommitMessageLabels() { return array( 'Dev Test', 'Dev Tests', ); } public function parseValueFromCommitMessage($value) { return $this->parseObjectList( $value, array( ManiphestTaskPHIDType::TYPECONST, )); } public function getRequiredHandlePHIDsForCommitMessage() { return $this->getRequiredHandlePHIDsForPropertyView(); } public function renderCommitMessageValue(array $handles) { return $this->renderObjectList($handles); } }