Repository navigation
Preserve captured-dependent branches during query precompilation - #39479
Conversation
Co-authored-by: AndriySvyryd <[email protected]>
Agent harness evaluation deferredThis PR affects: |
There was a problem hiding this comment.
🔵 Needs a closer look
The change modifies core query precompilation in both runtime parameter extraction and generated extractor-path calculation, so maintainer validation is needed for additional captured-dependent short-circuit shapes beyond the new end-to-end cases.
No open issues 🎉
What changed in this PR
This pull request prevents query precompilation from incorrectly folding branches that depend on captured runtime values, while preserving safe folding for noncaptured expressions and ordinary runtime queries.
Changes:
- Prevent captured-dependent simplification of conditional, logical, and coalescing expressions during precompilation.
- Add synchronous and asynchronous regression coverage.
- Add SQL Server baselines for the new scenarios.
- Document the branch-preservation invariant in the query-pipeline skill.
| File | Description |
|---|---|
test/EFCore.SqlServer.FunctionalTests/Query/PrecompiledQuerySqlServerTest.cs |
Adds SQL Server baselines for the new synchronous and asynchronous scenarios. |
test/EFCore.Relational.Specification.Tests/Query/PrecompiledQueryRelationalTestBase.cs |
Adds shared regression coverage for conditional, logical, and coalescing expressions. |
src/EFCore/Query/Internal/ExpressionTreeFuncletizer.cs |
Preserves captured-dependent branches during precompiled query processing and extractor-path calculation. |
.agents/skills/query-pipeline/SKILL.md |
Documents the captured-value branch-preservation invariant. |
Review effort: Lite
Code coverage overviewLanguages: C# C# / code-coverage
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
Co-authored-by: AndriySvyryd <[email protected]>
Query precompilation folds
?:,&&,||, and??using placeholder captured values, dropping branches that depend on runtime values. For example,Where(e => all || e.IsActive)can incorrectly retain theIsActivefilter whenallis true.