prevent generation crash in mixed TS/Python environments and harden s…#101
Open
prevent generation crash in mixed TS/Python environments and harden s…#101
Conversation
…chema/title normalization
added 2 commits
March 18, 2026 13:52
eneumann
reviewed
Mar 18, 2026
Member
eneumann
left a comment
There was a problem hiding this comment.
Thanks for working on this one @palimad!
One concern: this special-case returns bare ReturnType. Can you confirm ReturnType is actually bound in generated __init__.py globals at import time?
Current test asserts -> dict, so it doesn’t exercise the bare ReturnType path. If that name is unresolved, deploy/import can still fail.
|
|
||
| def _normalize_return_type_for_annotation(function_name: str, return_type_name: str) -> str: | ||
| if return_type_name == "ReturnType": | ||
| return "ReturnType" |
Member
There was a problem hiding this comment.
Does bare ReturnType resolve at import time in generated __init__.py?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/polyapi/poly-alpha/issues/4230
This PR fixes a deploy-time crash in mixed TypeScript/Python environments where generated Python annotations could reference a non-existent
ReturnTypemodule attribute. The server function renderer now avoids unsafe namespacing for the specialReturnTypecase, preventingAttributeErrorduring generate flows. It also hardens generation paths against non-string metadata shapes by normalizing schema title/root values and description inputs before string operations. These changes improve resilience of codegen against inconsistent spec payloads. Regression test coverage was updated around theReturnTypeissue.