Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The schema misclassifies empty structural nodes as literal leaves, breaking YEAST rules, while omitted base-class fields and a generator command that bypasses Poetry introduce additional correctness and setup failures.
3 open issues
What changed in this PR
This PR adds schema generation for using the Python extractor’s legacy AST with YEAST, drawing on master.py and the runtime AST definitions.
Changes:
- Adds a schema generator with metadata validation and a
--checkmode. - Commits the generated schema and tests its structure and freshness.
- Adds and documents the
make legacy-ast-typesregeneration workflow.
| File | Description |
|---|---|
python/extractor/yeast-python/legacy_ast_types.yml |
Generated node types, fields, and supertypes. |
python/extractor/tests/test_legacy_ast_types_gen.py |
Tests schema structure and generated-file freshness. |
python/extractor/semmle/python/legacy_ast_types_gen.py |
Generates and validates the legacy AST schema. |
python/extractor/Makefile |
Adds the schema regeneration target. |
python/extractor/extending-the-parser.md |
Documents regeneration and metadata overrides. |
Review effort: Max
tausbn
force-pushed
the
tausbn/python-yeast-node-types
branch
from
November 23, 2026 16:55
7a345f3 to
8d21719
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The documentation omits the need to restore structural-node empty maps after JSON round-trips, and the generator emits fields outside legacy AST slot order, affecting rule behavior, traversal, and typed dumps.
2 open issues
3 resolved since last review
Review effort: Max
This uses `master.py` -- the file that describes the structure of Python
ASTs -- and the internal Python extractor AST classes to generate a
`node-types.yml` file that can be used by YEAST. On the rare occasion
that this file needs to be regenerated, this can be done by invoking
`make legacy-ast-types`, in the same way that `make ast` regenerates the
QL files for the AST.
In the process, we ended up needing to distinguish between AST leaves
that carry values (like identifiers) and ones that are just structural
(like `Break`). In the schema, the latter can now be given an explicit
empty map `{}` as fields. This required a small change to `yeast-schema`
and friends.
tausbn
force-pushed
the
tausbn/python-yeast-node-types
branch
from
November 24, 2026 12:58
8d21719 to
8a39148
Compare
tausbn
marked this pull request as ready for review
November 24, 2026 15:11
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.


This uses
master.py-- the file that describes the structure of Python ASTs -- to generate anode-types.ymlfile that can be used by YEAST. On the rare occasion that this file needs to be regenerated, this can be done by invokingmake legacy-ast-types, in the same way thatmake astregenerates the QL files for the AST.