Page MenuHomePhabricator

Task Form becomes inaccessible after edit
Closed, ResolvedPublic

Description

After editing the "Bug Report" form to make a minor change to its default task description template, the task form became inaccessible, both from the usage side when creating tasks, as well as from the admin side when trying to view or edit the form configuration itself.

https://phabricator.wikimedia.org/maniphest/task/edit/form/43/
https://phabricator.wikimedia.org/transactions/editengine/maniphest.task/view/43/
https://phabricator.wikimedia.org/transactions/editengine/maniphest.task/defaults/43/

These all fail with:

RuntimeException: Array to string conversion

Trace, courtesy of @Dzahn:
P30961

PHP message: [2022-07-08 03:13:12] EXCEPTION: (RuntimeException) Array to string conversion at [<arcanist>/src/error/PhutilErrorHandler.php:261]
PHP message: arcanist(), ava(), phabricator(), translations(), wmf-ext-misc()
PHP message:   #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<phabricator>/src/view/form/control/AphrontFormTextAreaControl.php:76]
PHP message:   #1 <#2> AphrontFormTextAreaControl::renderInput() called at [<phabricator>/src/view/form/control/PhabricatorRemarkupControl.php:390]
PHP message:   #2 <#2> PhabricatorRemarkupControl::renderInput() called at [<phabricator>/src/view/form/control/AphrontFormControl.php:172]
PHP message:   #3 <#2> phutil_tag(string, array, array) called at [<phabricator>/src/view/form/PHUIFormLayoutView.php:54]
PHP message:   #4 <#2> PHUIFormLayoutView::render() called at [<phabricator>/src/view/form/AphrontFormView.php:160]
PHP message:   #5 <#2> phutil_tag(string, array, array) called at [<phabricator>/src/infrastructure/javelin/markup.php:70]
PHP message:   #6 <#2> phutil_escape_html(array) called at [<phabricator>/src/infrastructure/markup/render.php:139]
PHP message:   #7 <#2> phutil_escape_html(array) called at [<phabricator>/src/infrastructure/markup/render.php:97]
PHP message:   #8 <#2> phutil_tag(string, array, array) called at [<phabricator>/src/view/phui/PHUITwoColumnView.php:203]
PHP message:   #9 <#2> PHUITwoColumnView::buildMainColumn() called at [<phabricator>/src/view/phui/PHUITwoColumnView.php:121]
PHP message:   #10 <#2> PHUITwoColumnView::getTagContent() called at [<phabricator>/src/view/AphrontTagView.php:161]
PHP message:   #11 <#2> AphrontTagView::render() called at [<phabricator>/src/view/AphrontView.php:222]
PHP message:   #12 <#2> AphrontView::producePhutilSafeHTML() called at [<phabricator>/src/infrastructure/markup/render.php:115]
PHP message:   #13 <#2> phutil_escape_html(PHUITwoColumnView) called at [<phabricator>/src/infrastructure/markup/render.php:171]
PHP message:   #14 <#2> phutil_implode_html(string, array) called at [<phabricator>/src/view/page/PhabricatorBarePageView.php:58]
PHP message:   #15 <#2> PhabricatorBarePageView::willRenderPage() called at [<phabricator>/src/view/page/PhabricatorStandardPageView.php:217]
PHP message:   #16 <#2> PhabricatorStandardPageView::willRenderPage() called at [<phabricator>/src/view/page/AphrontPageView.php:46]
PHP message:   #17 <#2> AphrontPageView::render() called at [<

Event Timeline

The last frame in the trace is AphrontFormTextAreaControl.php which has some recent upstream changes, in particular:

https://github.com/phacility/phabricator/commit/9426765a2c6a149f5b0ed2d9132cd1e4e7ee152d
https://secure.phabricator.com/D21854

which modifies the exact line that we're hitting.

To confirm that this isn't a one-off issue, or otherwise specific to the "Bug Report" form, I edited an old form we no longer use currently ("Create RFC task"), and after a no-op submittion of the "Edit form defaults" page, that has now too become inaccessible:

https://phabricator.wikimedia.org/transactions/editengine/maniphest.task/view/89/
https://phabricator.wikimedia.org/transactions/editengine/maniphest.task/defaults/89/

Upstream issue that may be related: https://secure.phabricator.com/T13685

I suspect may be one of our custom form fields is configured incorrectly in a way that was probably silently ignored until now.

A possible workaround (suggested by @Dreamy_Jazz) is to create the task as a normal task and then change its subtype to Bug Report. As far as I can tell, the bug report is fully functional after that – you can still edit the task then, and the form seems to work fine (tested with the rename at T312631).

I followed this for filing T312628 and have been able to interact with it since without errors.

I think this should represent the correct state for a deploy, with (stable) Flatten "RemarkupValue" objects when setting field defaults for custom forms cherry-picked from upstream:

https://gerrit.wikimedia.org/r/plugins/gitiles/phabricator/deployment/+/refs/tags/release/2022-07-08/1

On phab1001, we are fetching the deploy repo from gerrit:

sudo -u phab-deploy git fetch gerrit
sudo -u phab-deploy git submodule foreach git fetch

And then ~brennen/update.sh should be what we did last time.

Note that this did not include a bin/celerity run. Given the lack of CSS/JS updates, I think that should be irrelevant.

On phab1001, we are fetching the deploy repo from gerrit:

sudo -u phab-deploy git fetch gerrit
sudo -u phab-deploy git submodule foreach git fetch

{{done}}

And then ~brennen/update.sh should be what we did last time.

To be clear this should be sudo ~brennen/update.sh as it stops puppet and apache.

We'll need someone with global root to run some cookbooks so we don't page everyone.

I think I documented the downtime commands on wikitech, but I'm not 100% certain since I don't have the ability to run these commands. @Dzahn would know for sure.

Mentioned in SAL (#wikimedia-operations) [2022-07-08T19:58:38Z] <thcipriani> quick phab downtime for deploy to fix T312614

thcipriani assigned this task to brennen.

Upstream confirmed here https://secure.phabricator.com/T13685#257106)

Thanks a lot for the quick fix and everything!

As a follow-up we did talk about how to avoid the need for root to downtime for emergency deploys like this. Silencing is possible via the web UI of alerts.wikimedia.org. Tyler has created docs here: https://wikitech.wikimedia.org/wiki/Phabricator/Deployment#Silence_Alerts but we should test

Related commit bc21a199 pushed by brennen (author: Brennen Bearnes):

[ repos/phabricator/deployment@wmf/stable ] Phabricator: Add cherry-picked from fix from upstream