Skip to content

feat: unittest flow - #1

Merged
AntoineToussaint merged 4 commits into
mainfrom
feat/flow
May 13, 2024
Merged

feat: unittest flow#1
AntoineToussaint merged 4 commits into
mainfrom
feat/flow

Conversation

@AntoineToussaint

Copy link
Copy Markdown
Contributor

No description provided.

@AntoineToussaint
AntoineToussaint merged commit 7a6b627 into main May 13, 2024
antoinetoussaint-byte added a commit that referenced this pull request Aug 25, 2026
…-safe (#14)

Addresses review findings on the optional gRPC server.

#1 (main.py): the grpc server was imported at module top level, so importing
src.main required the generated stubs. Runtime.Init runs GenerateOpenAPI, which
imports src.main *before* Sync generates those stubs (and they are git-ignored,
so a fresh clone has none) — Init failed with ModuleNotFoundError. The import
now lives inside the startup handler; OpenAPI generation never fires startup, so
the module imports cleanly without stubs.

#2 (proto location): the proto was scaffolded at code/proto/api.proto, but
core's LoadEndpoints re-derives the gRPC contract from standards.ProtoPath
(proto/api.proto at the service root) and the manifest stores no proto bytes.
The endpoint therefore reloaded with zero RPCs and dependent services could not
generate clients. The proto now lives at the service-root standard path (Buf and
grpcEndpoint read it there), and defaultProtoPath is bound to standards.ProtoPath
so it can never drift again.

#3 (server.py): add_insecure_port returns 0 instead of raising when a port can't
be bound, so the server would "start" listening on nothing while FastAPI stayed
healthy. It now raises, which also fails the pod's HTTP readiness probe via the
shared lifespan (covers the gRPC-readiness gap).

Tests: added a reload regression test asserting the gRPC endpoint keeps its RPCs
after LoadEndpoints (would have caught #2), and a check that src.rpc is never
imported at module top level (would have caught #1).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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