fix(sdk-generator): re-export the runtime timeout surface from the package root - #104
Merged
Merged
Conversation
…ckage root `request_timeout` is the documented way to bound a generated call, and the README teaches importing it from the package root. It lives in the hand-maintained runtime, and the generated `platform/__init__.py` did not re-export it — so the export only existed because it had been added by hand to a file whose header reads "auto-generated ... do not edit". The first regeneration since then removed it, breaking `from archastro.platform import DEFAULT_TIMEOUT_S, request_timeout` and failing the guard test that exists for exactly this case. The hand edit also left the file's `Content hash` untouched, so nothing else could detect the drift. Emit the re-export so the public import survives regeneration and is covered by the content hash. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013CN15q1LWb444eMZSkQi9M
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.
Review on ArchCode
Problem and author intent
platform/__init__.pyis generated, and its header reads "auto-generated by @archastro/sdk-generator. Do not edit." The generator emitted re-exports for the client, versions and auth — but not for the runtime's timeout surface.request_timeoutis the documented way to bound a generated call: the README teaches importing it from the package root, and callers thread a remaining deadline through it. Because the generator never emitted that import, the export inarchastro-pythonexisted only because it had been added by hand to that do-not-edit file (archastro-python@c7ef03a7).The first regeneration since then removed it, exactly as designed, and broke the public import:
That guard test was written alongside the hand edit and carries the comment "a regeneration that drops the re-export fails here" — it is the only thing that detected this, and it could not fire until a regeneration actually ran. The hand edit also left the file's
Content hashheader untouched, so no hash comparison could reveal the drift either.What changed
generatePackageInitnow emits the runtime re-export alongside the existing client re-export:This makes a documented public import part of generated output, so it survives regeneration and is covered by the content hash rather than depending on a hand edit that the next regeneration silently removes.
runtime/http_client.pyitself is unchanged and stays hand-maintained — this only changes what the generated package re-exports from it.Scope and risk
Generator-only; one function in
backends/python/index.ts. Python backend only.Risk: low. The change is additive — one import line in the generated package root. Every downstream SDK already ships this runtime module, so the import always resolves.
Testing
New test
re-exports the runtime timeout surface from the package rootasserts the emittedplatform/__init__.pycontains the import.Full generator suite: 424 passed (12 files),
tscclean,eslintclean.End-to-end: regenerating the real 260-route platform spec emits the re-export and all 37 generated modules still pass
python -m py_compile. The emitted file's content hash moves fromd14486b6976eto2b92e5dbd287, which is the point — the export is now hash-covered content rather than an invisible hand edit.Follow-ups
No version bump here, per this repo's convention. A
sdk-generatorrelease is needed beforearchastro-pythoncan regenerate green; its regen PR is currently red on precisely this import.🤖 Generated with Claude Code
https://claude.ai/code/session_013CN15q1LWb444eMZSkQi9M