Provide "MethodCallFuture" to fix exception semantics in mixed-future contexts


Provide "MethodCallFuture" to fix exception semantics in mixed-future contexts

Ref T13666. Currently, "PhabricatorRepository->newConduitFuture()" sometimes returns a real "ConduitFuture" (when repository clustering is configured) and sometimes returns a degenerate "ImmediateFuture" (when repository clustering is not configured).

To populate the "ImmediateFuture", the Conduit method is called inline without any special exception handling. This means that the two pathways have significantly different exception behavior:

  • On the "ImmediateFuture" pathway, the "newConduitFuture()" method itself may raise an exception related to resolving the call (e.g., invalid parameters).
  • On the "ConduitFuture" pathway, exceptions are raised only once the future is "resolve()"'d.

The second behavior is the correct behavior (and the primary behavior of upstream test environments, since all my stuff and the Phacility stuff is clustered).

Prepare to put both pathways on the second behavior by introducing a "MethodCallFuture", which can move the $conduit_call->execute() call (and thus its exception handling) to future resolution time.

See also the followup diff in Phabricator to actually enact this change.

Test Plan: Added unit tests and made them pass, see also next change.

Reviewers: cspeckmim

Reviewed By: cspeckmim

Maniphest Tasks: T13666

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


epriestley <git@epriestley.com>Authored on Sep 4 2021, 20:22
aviveyPushed on Jul 26 2022, 15:04
aviveyPushed on Jul 26 2022, 15:03
Differential Revision
D25039: merge phab/master -> phorge/master
rARC82016c00e132: Name extension as "arc-hg", not "arg-hg"
T15094: Catch up the master branch to upstream