Add type annotations to `clientConnect.ml`
commite96a15c06b7f6cd55b50f55e7ccb255b83c0f43e
authorWaleed Khan <waleedk@fb.com>
Thu, 29 Nov 2018 21:14:40 +0000 (29 13:14 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 29 Nov 2018 21:16:58 +0000 (29 13:16 -0800)
tree0e0515ffb1b35591500ff23888b394d41e0ea3d7
parent73eee4f89760fa50739e2eb52d1fdab62e37f829
Add type annotations to `clientConnect.ml`

Summary:
Add type annotations to `clientConnect.ml`.

This exposes an issue where we sometimes send different types over RPC:

* For persistent clients, we always send a `persistent_client_message_type`.
* For non-persistent clients, we send a `persistent_client_message_type` when sending `Ping` or `Hello` messages, or directly send a payload otherwise.

This is dubious because the payload and the `Ping`/`Hello` variants belong to different types, so it's accident that it works to begin with.

The fix is to just use the existing `Response` type to convey the payload, and assert that we don't ever send a `Push` notification to a non-persistent client. (I bet there's a fancy type system way to do it also, but let's not bother.)

Reviewed By: ljw1004

Differential Revision: D13149117

fbshipit-source-id: 61848882f9a8a97c5c9daf1469dff59b1910c68b
hphp/hack/src/client/clientConnect.ml
hphp/hack/src/client/clientLsp.ml
hphp/hack/src/server/serverClientProvider.ml
hphp/hack/src/server/serverCommandTypes.ml