Skip to content

feat(platform): Add platform/conduit Conduit client - #1013

Draft
roychying wants to merge 1 commit into
mainfrom
chenghan.ying/platform-conduit
Draft

roychying wants to merge 1 commit into
mainfrom
chenghan.ying/platform-conduit

Conversation

@roychying

Copy link
Copy Markdown
Contributor

Why?

SubmitQueue reads Phabricator through Conduit from more than one place, and each caller encodes requests, authenticates and parses Conduit's result envelope its own way. A shared client gives them one encoding, one auth placement and one error shape, and gives the planned Phabricator support in the Runway merger a client from day one.

What?

  • New platform/conduit: NewClient(httpClient, token) and Call(ctx, method, params, result).
    • Sends params as JSON with the token in __conduit__. Conduit ignores api.token once the parameters are JSON, so the token lives on the client rather than in a transport.
    • A non-200 reply is a platform/http.StatusError. A Conduit error_code is a typed *conduit.Error; Conduit returns those with HTTP 200, a rejected token (ERR-INVALID-SESSION) included.
    • A null result or an empty array (PHP's empty map) leaves the caller's result untouched.
    • No per-method wrappers: typed requests and results stay with each caller.
  • The encoding and auth placement were checked against a production Phabricator for differential.querydiffs, differential.revision.search and differential.getcommitmessage.

Test Plan

bazel test //platform/conduit/...

Issue

…N params with the API token and decodes the result envelope into a typed error or the caller's result
@roychying
roychying added this pull request to stack #1015 November 5, 2026 05:53

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant