Skip to content

feat(weave): rebuild RemoteHTTPTraceServer on weave-server-sdk#7177

Draft
andrewtruong wants to merge 1 commit into
andrew/sdk-uptake-00-remove-stainless-serverfrom
andrew/sdk-uptake-01-remote-server-on-sdk
Draft

feat(weave): rebuild RemoteHTTPTraceServer on weave-server-sdk#7177
andrewtruong wants to merge 1 commit into
andrew/sdk-uptake-00-remove-stainless-serverfrom
andrew/sdk-uptake-01-remote-server-on-sdk

Conversation

@andrewtruong

@andrewtruong andrewtruong commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Description

Swaps RemoteHTTPTraceServer's hand-rolled HTTP mechanics for the generated weave-server-sdk client (0.0.1, temporarily resolved from test PyPI via a uv index pin), keeping the class and its full tsi-typed method surface intact — a drop-in replacement. (The dormant experimental StainlessRemoteHTTPTraceServer was removed in the parent PR, #7185.)

Transport design:

  • One injected httpx.Client (env-proxy default transport, ssl_verify/http_timeout honored) shared by SDK-routed and raw paths; a response event hook routes errors through handle_response_error so callers keep seeing httpx.HTTPStatusError / CallsCompleteModeRequired (retry predicates, 413 batch splitting, and the calls_complete auto-upgrade key off these); a request hook injects X-Weave-Retry-Id per attempt.
  • Typed SDK resource methods wherever the generated client is correct; raw requests, each with a documented reason, for endpoints excluded from the OpenAPI spec (calls_complete v2, eager v2 call start/end, completions, project stats, TTL, feedback aggregate) and for weave-server-sdk 0.0.1 codegen bugs (duplicate generated method names where the last definition wins, lost multipart/otel bodies). Streaming endpoints keep line-by-line streaming (the published SDK buffers jsonl).
  • files_stats now hits /files/query_stats (the real route); the old implementation targeted /files/stats, which does not exist.
  • The parallel-table-upload endpoint probe uses a new explicit unretried_table_create_from_digests method instead of poking _post_request_executor.__wrapped__ internals.
  • The network_proxy_client fixture routes the binding's transport into the FastAPI TestClient via the binding's transport test seam instead of monkeypatching weave.utils.http_requests.post.

Also starts the incremental client/server import lint (ruff TID251 banned-api): weave.trace_server.http_service_interface is now unused by client code and banned; the list grows as the client moves to weave_server_sdk models in the next PRs.

Testing

  • tests/trace_server_bindings — 58 passed, including transport-boundary tests for retry behavior, 413 splitting, calls_complete/eager batching, and the auto-upgrade path
  • Full pre-push hook suite (ty, pyright, mypy, ruff check/format) — all pass standalone on this PR (an earlier revision had a latent standalone mypy failure in weave_init.py that was masked at the stack tip; fixed here)
  • Full trace/flow/compat/utils/session/shared suites pass at the stack tip

andrewtruong commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.41629% with 114 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../trace_server_bindings/remote_http_trace_server.py 47.68% 110 Missing and 3 partials ⚠️
weave/trace/weave_init.py 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Swaps RemoteHTTPTraceServer's hand-rolled HTTP mechanics for the generated
weave-server-sdk client (0.0.1, temporarily resolved from test PyPI via a uv
index pin), keeping the class and its full tsi-typed method surface intact.
(The dormant experimental StainlessRemoteHTTPTraceServer and its opt-in
plumbing were removed in the previous commit.)

Transport design:

- One injected httpx.Client (env-proxy default transport, ssl_verify/
  http_timeout honored) shared by SDK-routed and raw paths; a response event
  hook routes errors through handle_response_error so callers keep seeing
  httpx.HTTPStatusError / CallsCompleteModeRequired (retry predicates, 413
  batch splitting, and the calls_complete auto-upgrade key off these); a
  request hook injects X-Weave-Retry-Id per attempt.
- Typed SDK resource methods wherever the generated client is correct; raw
  requests, each with a documented reason, for endpoints excluded from the
  OpenAPI spec (calls_complete v2, eager v2 call start/end, completions,
  project stats, TTL, feedback aggregate) and for weave-server-sdk 0.0.1
  codegen bugs (duplicate generated method names where the last definition
  wins, lost multipart/otel bodies). Streaming endpoints keep line-by-line
  streaming (the published SDK buffers jsonl).
- files_stats now hits /files/query_stats (the real route); the old
  implementation targeted /files/stats, which does not exist.
- The parallel-table-upload endpoint probe uses a new explicit
  unretried_table_create_from_digests method instead of poking
  _post_request_executor.__wrapped__ internals.
- The network_proxy_client fixture routes the binding's transport into the
  FastAPI TestClient via the binding's transport test seam instead of
  monkeypatching weave.utils.http_requests.post.

Also starts the incremental client/server import lint (ruff TID251
banned-api): weave.trace_server.http_service_interface is now unused by
client code and banned; the list grows as the client moves to
weave_server_sdk models.
@andrewtruong andrewtruong changed the base branch from master to graphite-base/7177 June 11, 2026 17:13
@andrewtruong andrewtruong force-pushed the andrew/sdk-uptake-01-remote-server-on-sdk branch from d34b793 to 8d5eed6 Compare June 11, 2026 17:13
@andrewtruong andrewtruong changed the base branch from graphite-base/7177 to andrew/sdk-uptake-00-remove-stainless-server June 11, 2026 17:14
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