Fix silent empty output when schema generation fails - #489
Open
silviogutierrez wants to merge 1 commit into
Open
silviogutierrez wants to merge 1 commit into
silviogutierrez wants to merge 1 commit into
Conversation
generate_types.py never checked the json2ts exit code: any failure to resolve or run it wrote a zero-byte generated.tsx and exited 0, so the build only failed later, deep in tsc, with dozens of misleading 'generated.tsx is not a module' errors. Fail at the source instead, and never overwrite generated.tsx with empty output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PKZUt2VP1HPLdXzR7fnmwk
This branch has not been deployed
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.
generate_types.py piped the schema through json2ts without checking the exit code. When json2ts fails to resolve or run (a broken or partially installed node_modules, for example), the script wrote a zero-byte generated.tsx and exited 0 — so the failure only surfaced later, deep in tsc, as a wall of "generated.tsx is not a module" and implicit-any errors pointing nowhere near the cause.
Now the script fails at the source with the real exit code, and never overwrites generated.tsx with empty output. Includes a test that stubs a failing npm and asserts both the refusal and that any existing generated.tsx is left untouched.
🤖 Generated with Claude Code
https://claude.ai/code/session_01PKZUt2VP1HPLdXzR7fnmwk