Page MenuHomePhorge

arc patch broken - class "DifferentialTestCommitMessageField" must define a "FIELDKEY" constant
Closed, ResolvedPublic

Description

arc patch broken by a recent diff of mine - D25333

Trace:

>>> [18] (+4,422) <exec> $ git show -s --format='%H' 9d512595c0e2a37bb50097f3494af806b8322d45 --
<<< [18] (+4,435) <exec> 12,510 us
>>> [19] (+4,473) <exec> $ git apply --whitespace nowarn --index --reject -- /private/var/folders/m3/rln12jbn4wj3m22zhq06r93r0000gp/T/8lxb42z1158ocowc/26015-ZFFbuA
Checking patch src/applications/differential/storage/__tests__/DifferentialChangesetTestCase.php...
Checking patch src/applications/differential/storage/DifferentialChangeset.php...
Checking patch src/__phutil_library_map__.php...
Applied patch src/applications/differential/storage/__tests__/DifferentialChangesetTestCase.php cleanly.
Applied patch src/applications/differential/storage/DifferentialChangeset.php cleanly.
Applied patch src/__phutil_library_map__.php cleanly.
<<< [19] (+4,496) <exec> 23,084 us
>>> [20] (+4,496) <exec> $ git submodule update --init --recursive
<<< [20] (+4,553) <exec> 56,108 us
>>> [21] (+4,553) <http> https://we.phorge.it/api/differential.getcommitmessage
<<< [21] (+4,751) <http> 197,433 us

[2023-08-11 16:57:57] EXCEPTION: (ConduitClientException) ERR-CONDUIT-CORE: <differential.getcommitmessage> "Phobject" class "DifferentialTestCommitMessageField" must define a "FIELDKEY" constant. at [<arcanist>/src/conduit/ConduitFuture.php:70]
arcanist(head=master, ref.master=788098096e11), phorge(head=arcpatch-D25323_1, ref.master=8310591523f5, ref.arcpatch-D25323_1=9d512595c0e2)
  #0 ConduitFuture::didReceiveResult(array) called at [<arcanist>/src/future/FutureProxy.php:40]
  #1 FutureProxy::isReady() called at [<arcanist>/src/future/Future.php:63]
  #2 Future::updateFuture() called at [<arcanist>/src/future/FutureIterator.php:224]
  #3 FutureIterator::next() called at [<arcanist>/src/future/FutureIterator.php:190]
  #4 FutureIterator::rewind()
  #5 iterator_to_array(FutureIterator) called at [<arcanist>/src/future/FutureIterator.php:84]
  #6 FutureIterator::resolveAll() called at [<arcanist>/src/future/Future.php:47]
  #7 Future::resolve() called at [<arcanist>/src/conduit/ConduitClient.php:65]
  #8 ConduitClient::callMethodSynchronous(string, array) called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:891]
  #9 ArcanistPatchWorkflow::getCommitMessage(ArcanistBundle) called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:750]
  #10 ArcanistPatchWorkflow::run() called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:399]
  #11 ArcanistPatchWorkflow::run() called at [<arcanist>/scripts/arcanist.php:427]
<<< [1] (+4,830) <exec> 4,830,164 us

Event Timeline

Sten triaged this task as Unbreak Now! priority.

I have a fix, but can't create it. Will need manually applying to the server:

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 83737eea52..d8831dc7a2 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -6761,7 +6761,7 @@ phutil_register_library_map(array(
     'DifferentialTabReplacementTestCase' => 'PhabricatorTestCase',
     'DifferentialTagsCommitMessageField' => 'DifferentialCommitMessageField',
     'DifferentialTasksCommitMessageField' => 'DifferentialCommitMessageField',
-    'DifferentialTestCommitMessageField' => 'DifferentialCommitMessageField',
+    'DifferentialTestCommitMessageField' => 'DifferentialCommitMessageCustomField',
     'DifferentialTestPlanCommitMessageField' => 'DifferentialCommitMessageField',
     'DifferentialTestPlanField' => 'DifferentialCoreCustomField',
     'DifferentialTitleCommitMessageField' => 'DifferentialCommitMessageField',
diff --git a/src/applications/differential/field/DifferentialTestCommitMessageField.php b/src/applications/differential/field/DifferentialTestCommitMessageField.php
index 9d398bc4fd..48c52f060c 100644
--- a/src/applications/differential/field/DifferentialTestCommitMessageField.php
+++ b/src/applications/differential/field/DifferentialTestCommitMessageField.php
@@ -4,7 +4,13 @@
  * This class should only be used for unit tests
  */
 final class DifferentialTestCommitMessageField
-  extends DifferentialCommitMessageField {
+  extends DifferentialCommitMessageCustomField {
+
+  const FIELDKEY = 'testCommitMessageField';
+
   public function getFieldName() { return 'Test'; }
   public function getFieldOrder() { return 1; }
+  public function getCustomFieldKey() {
+    return 'phabricator:test-custom-field';
+  }
 }
Sten removed Sten as the assignee of this task.Aug 11 2023, 18:07
avivey subscribed.

Unfortunately, that fix adds the word "Test:" to the title of any new diff. I'm trying to find an existing field that can make the test work, or else find another creative solution.

Simply adding a FIELDKEY adds Test: to the title of a new diff, but the full fix of making DifferentialTestCommitMessageField a DifferentialCommitMessageCustomField doesn't

oh

I've replaced it with DifferentialRevertPlanCommitMessageField, anyway - that one already has all the required stuff.