- Notifications
You must be signed in to change notification settings - Fork 1.9k
Python: enable overlay compilation + extractor overlay support#20337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: enable overlay compilation + extractor overlay support #20337
Uh oh!
There was an error while loading. Please reload this page.
Conversation
d10c commented Sep 1, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
0b94992 to feb4c3aComparefbb16b4 to e2f6e4aCompare This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
456c659 to c0707fdCompare3901c56 to 8844c2dCompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds overlay support to the Python extractor, enabling incremental compilation and overlay-based extraction for improved performance. The changes introduce overlay metadata handling, entity discard predicates, and consistency checks for overlay databases.
- Adds overlay compilation and extraction support to the Python ecosystem
- Implements entity discard predicates for incremental analysis
- Introduces consistency checks to ensure proper overlay database construction
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/ql/lib/semmlecode.python.dbscheme | Adds @top type and overlay metadata support to database schema |
| python/ql/lib/semmle/python/Overlay.qll | Implements comprehensive entity discard predicates for overlay functionality |
| python/ql/lib/semmle/python/internal/OverlayDiscardConsistencyQuery.qll | Provides consistency query logic for overlay database validation |
| python/extractor/semmle/worker.py | Adds overlay extraction mode with change-based file filtering |
| python/extractor/semmle/projectlayout.py | Improves Windows path handling in project layout configuration |
| python/extractor/semmle/path_rename.py | Updates environment variable to use CODEQL_PATH_TRANSFORMER |
| python/ql/test/extractor-tests/overlay/ | Adds comprehensive overlay extraction test cases |
| Various .expected files | Test output files for overlay functionality validation |
The new name is required by overlay support.
And don't add slash to start of path patterns on Windows.
- fall back to full extraction on overlay changes json read error - we filter both root modules and (transitive) imports against the overlay-changes json.
for dbscheme elements with direct or indirect location links in dbscheme. - Unify discardable entities under one Discardable superclass. - Two discard predicates depending on TRAP ID type. - Future-proof the XML and Yaml discard predicates for when their extractors become incremental.
8844c2d to e74f9a4CompareThe base source is in basic-overlay-eval/orig_src, the overlay source is in basic-full-eval. We run two tests: a full evaluation test in basic-full-eval, and an overlay evaluation test in basic-overlay-eval. The test source and expected results are the SAME, due to the .qlref, meaning we expect the same results for full and overlay evaluation.
e74f9a4 to ece1210Compare
tausbn left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question (non-blocking), otherwise this looks good to me. 👍
Uh oh!
There was an error while loading. Please reload this page.
e120e5c into github:mainUh oh!
There was an error while loading. Please reload this page.
This PR adds overlay support to the Python extractor, including overlay compilation, basic tests, and a consistency check.
Supercedes earlier PR #20206.
According to latest DCA results,
Clarifications:
@py_cobjectand@externalDataElementare not Discardable because they can't be linked to a source file. The consistency check ignores them.@externalDefect/Metric,@duplication_or_similarity, and@svnentryare not Discardable because they are deprecated.