Page MenuHomePhabricator

Getting PhutilTypeCheckException on certaion Differential pages
Closed, ResolvedPublic

Description

Guessing D15365: Give unit test results their own table in Differential changed the data contract so we are now getting the following error when trying to visit certain differential pages:

2016/03/09 21:18:59 [error] 3128#0: *10185533 FastCGI sent in stderr: "PHP message: [2016-03-09 13:18:59] EXCEPTION: (PhutilTypeCheckExc
eption) Parameter 'duration' has invalid type. Expected type 'optional float|int', got type 'string'. at [<phutil>/src/parser/PhutilType
Spec.php:129]
PHP message: arcanist(head=master, ref.master=ccbaee585e1a), disqus(head=master, ref.master=6720f9c7bbbe), phabricator(head=master, ref.
master=27ce69183900), phutil(head=master, ref.master=7e2eca1f76d1)
PHP message:   #0 <#2> PhutilTypeSpec::check(string, string) called at [<phutil>/src/parser/PhutilTypeSpec.php:169]
PHP message:   #1 <#2> PhutilTypeSpec::checkMap(array, array) called at [<phabricator>/src/applications/harbormaster/storage/build/Harbo
rmasterBuildUnitMessage.php:84]
PHP message:   #2 <#2> HarbormasterBuildUnitMessage::newFromDictionary(HarbormasterBuildTarget, array) called at [<phabricator>/src/appl
ications/differential/controller/DifferentialController.php:178]
PHP message:   #3 <#2> DifferentialController::loadHarbormasterData(array) called at [<phabricator>/src/applications/differential/contro
ller/DifferentialRevisionViewController.php:257]
PHP message:   #4 <#2> DifferentialRevisionViewController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configurat
ion/AphrontApplicationConfiguration.php:237]
PHP message:   #5 phlog(PhutilTypeCheckException) called at [<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler
.php:32]
PHP message:   #6 PhabricatorDefaultRequestExceptionHandler::handleRequestException(AphrontRequest, PhutilTypeCheckException) called at
[<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:632]
PHP message:   #7 AphrontApplicationConfiguration::handleException(PhutilTypeCheckException) called at [<phabricator>/src/aphront/config
uration/AphrontApplicationConfiguration.php:242]
PHP message:   #8 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterContr
ol) called at [<phabric

The immediate fix we tried was to add |string to the duration field in src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php which fixed the error. Looking for a better solution, @avivey suggested casting duration to a float in here: https://secure.phabricator.com/diffusion/P/browse/master/src/applications/differential/controller/DifferentialController.php;27ce6918390088fbd6f786fb1a856d740bcf57b0$185-193