Skip to content

[UPSTREAM-17] fix(python): import the resource that an endpoint-less client builds - #75

Closed
moetemp wants to merge 1 commit into
moe/up/ts-endpointless-resource-returnfrom
moe/up/python-endpointless-resource-import
Closed

moetemp wants to merge 1 commit into
moe/up/ts-endpointless-resource-returnfrom
moe/up/python-endpointless-resource-import

Conversation

@moetemp

@moetemp moetemp commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

What changed?

This PR imports the resource class that the Python <Service>Client of a service with no @nexus.endpoint builds from an answer. services.py imports it at run time, next to its bind_*_client helper. A resource class that only annotations name stays under TYPE_CHECKING.

Depends on #73 (UPSTREAM-15).
Part of the Brook review series.

Why?

The method calls the class to build the resource, but services.py imported it only under TYPE_CHECKING. So the call failed with NameError at run time. An operation that returns the resource type itself, as in user-service, already imported it. Only a holder answer, such as the writer's writer-result, showed the bug.

How did you test it?

The new sample test test_a_client_with_no_endpoint_builds_the_returned_resource opens and closes Brook's writer from a Workflow, through a real Nexus endpoint. Without the fix, it fails with NameError: name 'Writer' is not defined.
cargo validate passes.

The client of a service with no endpoint builds a returned resource from its class, but
services.py imported the class only under TYPE_CHECKING. So the call failed with NameError. A
test opens and closes Brook's writer from a Workflow through a real endpoint.
@moetemp

moetemp commented Oct 29, 2026

Copy link
Copy Markdown
Owner Author

Closing this. The Streams stack doesn't need it.

@moetemp moetemp closed this Oct 29, 2026
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