Skip to content

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

Merged
roychying merged 2 commits into
mainfrom
chenghan.ying/platform-conduit
Nov 14, 2026
Merged

roychying merged 2 commits 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

@roychying
roychying added this pull request to stack #1015 November 5, 2026 05:53
…N params with the API token and decodes the result envelope into a typed error or the caller's result
@roychying
roychying force-pushed the chenghan.ying/platform-conduit branch from 0cb9ee2 to ccf708e Compare November 14, 2026 04:32
@roychying
roychying marked this pull request as ready for review November 14, 2026 04:33
@roychying
roychying added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit b391ec0 Nov 14, 2026
39 checks passed
@roychying
roychying deleted the chenghan.ying/platform-conduit branch November 14, 2026 04:56
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.

2 participants