Python: enable overlay compilation + extractor overlay support#20337
Merged
d10c merged 15 commits intogithub:mainfrom Oct 16, 2025
Merged
Python: enable overlay compilation + extractor overlay support#20337d10c merged 15 commits intogithub:mainfrom
d10c merged 15 commits intogithub:mainfrom
Conversation
0b94992 to
feb4c3a
Compare
fbb16b4 to
e2f6e4a
Compare
456c659 to
c0707fd
Compare
3901c56 to
8844c2d
Compare
4 tasks
Contributor
There was a problem hiding this comment.
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
e74f9a4
Compare
The 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
ece1210
Compare
tausbn
approved these changes
Oct 16, 2025
Contributor
tausbn
left a comment
There was a problem hiding this comment.
One question (non-blocking), otherwise this looks good to me. 👍
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 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.