Honour paths-ignore when selecting CDS compilation targets#389
Merged
data-douser merged 4 commits intoJun 19, 2026
Merged
Conversation
When a project has standard CAP directories (db/, srv/, app/), determineCdsFilesToCompile() returned them as compilation targets based solely on existSync() checks, ignoring paths-ignore from the CodeQL config. The other two branches (root-level files and per-file fallback) were already correct because they derive from project.cdsFiles, which determineCdsFilesForProjectDir() filters upstream. Drop a CAP directory from the targets only when every .cds file under it has been filtered out by paths-ignore (i.e. no entry in project.cdsFiles lives under that directory). Partially-covered directories are still compiled, matching the project convention that paths-ignore should not change compiler input granularity unless a target is fully covered.
When every .cds file in the source tree is filtered out by
paths-ignore, the dependency graph correctly ends up empty and the
extractor enters the no-projects branch. That branch unconditionally
logged two ERROR lines and ran a diagnostic re-glob that ignored
paths-ignore entirely, so an intentional full exclusion looked
identical to a real project-detection bug.
Apply paths-ignore to the diagnostic glob and split the no-projects
branch into three cases:
- no .cds files in the tree (INFO, unchanged)
- .cds files exist but all are paths-ignored (INFO, new message)
- .cds files survive paths-ignore but no project was detected
(ERROR, unchanged — this is a real bug)
The early-exit flow (addNoCdsProjectsDiagnostic + handleEarlyExit)
is unchanged; only the log output differs.
8 tasks
data-douser
approved these changes
Jun 19, 2026
data-douser
left a comment
Collaborator
There was a problem hiding this comment.
LGTM!
Related to but not blocking this PR, I created tracking issue #390 for what I think may be a gap in the paths-ignore behavior of the CDS extractor. If the index.cds -> model.cds.json scenario (described in that issue) isn't a real concern / problem, then we can just close that issue.
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.
Honour
paths-ignorewhen selecting CDS compilation targetsThe CDS extractor was only partially honouring
paths-ignorefrom the CodeQL config:determineCdsFilesToCompile()returned the standard CAP directories (db/,srv/,app/) as compilation targets based purely onexistsSync()checks, never consultingpaths-ignore. A directory whose.cdsfiles were all excluded was still being handed to the CDS compiler. (The other two branches — root-level files and per-file fallback — were already correct, since they derive fromproject.cdsFiles, which is filtered upstream bydetermineCdsFilesForProjectDir().)When every
.cdsfile in the source was paths-ignored, the dependency graph correctly ended up empty and the extractor entered the no-projects branch incds-extractor.ts. That branch unconditionally logged twoERRORlines and ran a diagnostic re-glob that ignoredpaths-ignoreentirely, so an intentional full exclusion looked identical to a real project-detection bug.