Repository navigation
Generate Python types from service and access record schemas - #4683
Merged
Merged
Conversation
Keep JSON schemas canonical and carry their field types through Record reads and writes using generated type-only stubs. Type the service constructor and transient address result so the real producer benefits from field checking; preserve dependency-free system-Python session cleanup.
Use an unsupported lifetime word that typos will not repair. Narrow the thread ID in the newly integrated stills scenario before passing it to the command, matching neighboring scenarios and clearing whole-tree ty.
leaf-agent
approved these changes
Oct 29, 2026
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.
Python now checks the fields of service and access-key records against types generated from their existing JSON schemas. A misspelled key, wrong port or lifetime value, or missing token is reported by ty through the actual record read/write APIs.
Keep the schemas canonical:
leaf-dev record-typesgenerates a type-only stub, and pre-commit checks its freshness alongside whole-tree ty.Recordcarries the value type through storage without adding runtime validation or dependencies to standalone session cleanup. The service constructor and fresh-address result also have precise types, so the real producer benefits from the generated fields. The trial covers these two simple records; opaque runtime metadata remains an open dictionary.Validation: whole-tree pre-commit and
pnpm run check; focused generator, address and service-lifetime tests; dependency-free loading on system Python 3.9. Independent review by Astra recommended the constructor/address refinements included here and approved the final result.