Skip to content

Fix net8/net9 snapshot mismatches in filter tests - #10125

Merged
glen-84 merged 1 commit into
mainfrom
gai/net8-net9-filter-snapshots
Jul 21, 2026
Merged

glen-84 merged 1 commit into
mainfrom
gai/net8-net9-filter-snapshots

Conversation

@glen-84

@glen-84 glen-84 commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • EF Core versions are pinned per target framework, so the SQL captured in snapshots differs between net8/net9 (EF 8/9, @__p_0 parameter naming) and net10/net11 (EF 10+, @p). Both filter test suites only carried the EF 10+ variants, so their tests failed on net8/net9, which CI (net11 only) never runs.
  • Data.Filters.SqlServer.Tests: Filter_With_Multi_Expression now uses the string overload EndsWith("0") (CA1866 suppressed), which EF Core 8/9 can translate, and matches a shared NET8_0_NET9_0 snapshot. This replaces per-TFM snapshots that recorded an expected translation failure with machine-specific stack traces.
  • Spatial Data.Filters.SqlServer.Tests: tests select snapshots via the Postfix helper — net8/net9 share an EF 8/9 variant, net10/net11 use the base, and the Distance test keeps a NET10_0 variant because EF 10 and EF 11 name the second parameter differently (@p0 vs @p1).

Test plan

  • dotnet test for Data.Filters.SqlServer.Tests: 364/364 across all four target frameworks.
  • dotnet test for the spatial Data.Filters.SqlServer.Tests (PostgreSQL/PostGIS containers): 28/28 across all four target frameworks.

Copilot AI review requested due to automatic review settings July 21, 2026 11:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes framework-specific snapshot selection and expectations in the filter test suites so they pass consistently across net8/net9 (EF Core 8/9) and net10/net11 (EF Core 10+), including parameter-name differences in generated SQL.

Changes:

  • Update spatial filter tests to select NET8_0_NET9_0 snapshots via TestEnvironment.Postfix(...), defaulting to the base snapshot for net10/net11 (except Distance, which keeps a net10-specific variant).
  • Refresh/add net8/net9 spatial snapshots to reflect EF Core 8/9 parameter naming (@__p_0, etc.) and correct test-to-snapshot alignment.
  • Fix Filter_With_Multi_Expression to use EndsWith("0") (with CA1866 suppressed) so EF Core 8/9 translate it, and replace net8/net9 “expected failure” snapshots with a shared successful NET8_0_NET9_0 snapshot.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorWithinTests.cs Switch snapshot selection to Postfix([NET8_0, NET9_0]) via static TestEnvironment import.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorTouchesTests.cs Same snapshot selection change for Touches tests.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorOverlapsTests.cs Same snapshot selection change for Overlaps tests.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorIntersectsTests.cs Same snapshot selection change for Intersects tests.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs Use Postfix([NET8_0, NET9_0], [NET10_0]) to keep net10-specific snapshot while sharing net8/net9.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorContainsTests.cs Same snapshot selection change for Contains/NotContains tests.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorWithinTests.Create_Within_Query_NET8_0_NET9_0.snap Update EF8/9 SQL parameter naming and correct function/geometry alignment.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorTouchesTests.Create_Touches_Query_NET8_0_NET9_0.snap Update EF8/9 SQL parameter naming.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorOverlapsTests.Create_Overlaps_Query_NET8_0_NET9_0.snap Update EF8/9 SQL parameter naming.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorIntersectsTests.Create_Intersects_Query_NET8_0_NET9_0.snap Update EF8/9 SQL parameter naming.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorDistanceTests.Create_Distance_Expression_NET8_0_NET9_0.snap Add EF8/9-specific snapshot for Distance expression parameter naming.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorContainsTests.Create_Contains_Expression_NET8_0_NET9_0.snap Update EF8/9 SQL parameter naming.
src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/snapshots/QueryableFilterVisitorContainsTests.Create_NotContains_Expression_NET8_0_NET9_0.snap Update EF8/9 SQL parameter naming.
src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/DataLoaderTests.cs Share net8/net9 snapshot postfix and update query to EndsWith("0") for EF8/9 translation (CA1866 suppressed).
src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/snapshots/DataLoaderTests.Filter_With_Multi_Expression_NET8_0.md Remove per-TFM net8 snapshot that captured translation failure details.
src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/snapshots/DataLoaderTests.Filter_With_Multi_Expression_NET9_0.md Remove per-TFM net9 snapshot that captured translation failure details.
src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/snapshots/DataLoaderTests.Filter_With_Multi_Expression_NET8_0_NET9_0.md Add shared net8/net9 snapshot capturing successful SQL + result.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84
glen-84 merged commit 71459e8 into main Jul 21, 2026
148 checks passed
@glen-84
glen-84 deleted the gai/net8-net9-filter-snapshots branch July 21, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants