Skip to content

test(generate): a Python client streams all four RPC shapes through the companion - #1161

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
fix/python-client-streaming
Oct 25, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
fix/python-client-streaming

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Finding

Review r38 of obin-ai/module-model-gateway#210 saw the Python client generator emit the model gateway's four streaming RPCs as unary calls (libraries/model-client/python/model_client/model.py).

The generator template is not in the CLI. codefly generate client --language python renders the facade with the proto companion's protoc-gen-codefly-facade-python, owned by core (companions/proto/facades/python/). Core already fixed it in codefly-dev/core@08716e9: each streaming RPC calls the gateway seam named for its shape (unary / unary_stream / stream_unary / stream_stream, with requests for client streams). The CLI's core pin (88f4434c) includes that commit.

The defect that reached the model gateway is a stale companion image under an unchanged tag. 08716e9 shipped inside proto:0.0.17 without a version bump. 0.0.17 was first published as sha256:aa8d63e1… (old plugin) and republished at 20:42Z as sha256:46e8b398… (streaming plugin). The CLI uses a cached tag when one is present, so a machine holding the first image still renders everything unary. Filed as codefly-dev/core#837: bump the companion to 0.0.18, plus a CI guard. That bump moves this repo's go.mod, so it waits behind #1158.

Change

A generator test over a proto with all four method kinds, run through codefly generate client and the real companion. It is not a check of core's template source, because that is exactly what missed a companion still shipping the old plugin.

  • cmd/generate/client_streaming_test.go: TestGenerateClientPythonStreaming generates shapes-client from a contracts catalog and asserts each method's seam in the generated facade. It then runs testdata/python_streaming/exercise.py inside the companion image (its own grpcio and generated bindings). That script drives every facade method against an in-process grpcio server: unary, server stream, client stream (including empty) and bidi (including empty).
  • Gated like the other companion tests, on linux-amd64-docker-generate (CODEFLY_GENERATE_QUALIFY=1, developer machine; CI skips it).

Evidence, run locally on darwin/arm64 with CODEFLY_GENERATE_QUALIFY=1:

  • with the cached proto:0.0.17 = sha256:aa8d63e1: FAIL, shapes.py does not contain "self._gateway.unary_stream(\"/shapes.v1.EchoService/Fan\","
  • after docker pull (sha256:46e8b398): PASS, all four generated RPC shapes passed

Transport: the facade names the shape and the Gateway owns the transport, the same as unary today. A Gateway would serve unary_stream on Connect and stream_unary/stream_stream on gRPC, because Connect's client and bidi streams need HTTP/2, and the Python Connect face serves them on gRPC only. No runtime Gateway implements the three streaming seams yet: solution-runtime-python has unary only. There is no Python consumer of the model client's streaming methods today, so that is left as a gap rather than built ahead of a consumer.

Classification

Fix (test-only here). The generator fix lives at its owner (core 08716e9); the version-discipline fix is core#837. Nothing here touches #1158's files.

Not verified: CI does not run this test (the row is not-yet-qualified). I did not run the rest of the cmd/generate qualify suite.

To unblock module-model-gateway now: docker pull ghcr.io/codefly-dev/proto:0.0.17, then regenerate libraries/model-client.

🤖 Generated with Claude Code

…he companion

`codefly generate client --language python` renders its facade with the
proto companion's protoc-gen-codefly-facade-python, which lives in core
(companions/proto/facades/python). Core fixed it in 08716e9: each
streaming RPC calls the gateway seam named for its shape (unary_stream,
stream_unary, stream_stream). It shipped inside proto:0.0.17 without a
version bump, and 0.0.17 was republished at 20:42 UTC, so a machine
holding the earlier 0.0.17 still renders every RPC as `unary` — the
model gateway's generated model.py is that output.

The test generates a client from a proto carrying all four method kinds
through `codefly generate client`, asserts each method's seam, and drives
every method against a real grpcio server inside the companion image.
It fails against the earlier 0.0.17 (sha256:aa8d63e1) and passes against
the published one (sha256:46e8b398).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byte added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit 5536d73 Oct 25, 2026
14 checks passed
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