Skip to content

Fix #8407 sorting with projected navigation orderings#9276

Merged
michaelstaib merged 2 commits intomainfrom
mst/issue-8407
Mar 2, 2026
Merged

Fix #8407 sorting with projected navigation orderings#9276
michaelstaib merged 2 commits intomainfrom
mst/issue-8407

Conversation

@michaelstaib
Copy link
Copy Markdown
Member

Fixes #8407

Summary

  • Adds a regression test for sorting over a root EF query that projects a navigation collection with its own OrderBy.
  • Fixes sort-order detection so ThenBy is only selected when the source expression itself is an IOrderedQueryable.
  • Prevents nested navigation OrderBy expressions from being mistaken as root ordering state.

Repro Test Code

[Fact]
public async Task Sorting_With_Navigation_OrderBy_In_Projection_Does_Not_Throw()
{
    IServiceProvider services =
        new ServiceCollection()
            .AddDbContextPool<Issue8407Context>(
                b => b.UseInMemoryDatabase($"Issue8407-{Guid.NewGuid():N}"))
            .AddGraphQL()
            .AddSorting()
            .AddQueryType<Issue8407Query>()
            .Services
            .BuildServiceProvider();

    // ...seed parents/children...

    var executor = await services.GetRequiredService<IRequestExecutorProvider>()
        .GetExecutorAsync();

    var result = await executor.ExecuteAsync(
        """
        {
          parents(order: [{ id: ASC }]) {
            id
            children {
              id
            }
          }
        }
        """);

    var operationResult = result.ExpectOperationResult();
    Assert.Empty(operationResult.Errors ?? []);
}

Tests

  • dotnet test src/HotChocolate/Data/test/Data.EntityFramework.Tests/HotChocolate.Data.EntityFramework.Tests.csproj -f net8.0 --filter "FullyQualifiedName~Issue8407ProbeTests" (Passed)
  • dotnet test src/HotChocolate/Data/test/Data.EntityFramework.Tests/HotChocolate.Data.EntityFramework.Tests.csproj -f net9.0 --filter "FullyQualifiedName~Issue8407ProbeTests" (Passed)
  • dotnet test src/HotChocolate/Data/test/Data.EntityFramework.Tests/HotChocolate.Data.EntityFramework.Tests.csproj -f net10.0 --filter "FullyQualifiedName~Issue8407ProbeTests" (Passed)

@github-actions
Copy link
Copy Markdown
Contributor

Fusion Gateway Performance Results

Progress: 0/6 benchmarks completed — this report updates as each job finishes.

Simple Composite Query

Req/s Err%
Constant 2 (50 VUs) pending pending
Ramping 2 (0-500-0 VUs) pending pending
Response Times
Min Med Avg P90 P95 Max
Constant 2 pending pending pending pending pending pending
Ramping 2 pending pending pending pending pending pending

Deep Recursion Query

Req/s Err%
Constant 2 (50 VUs) pending pending
Ramping 2 (0-500-0 VUs) pending pending
Response Times
Min Med Avg P90 P95 Max
Constant 2 pending pending pending pending pending pending
Ramping 2 pending pending pending pending pending pending

Variable Batching Throughput

Req/s Err%
Constant 2 (50 VUs) pending pending
Ramping 2 (0-500-0 VUs) pending pending
Response Times
Min Med Avg P90 P95 Max
Constant 2 pending pending pending pending pending pending
Ramping 2 pending pending pending pending pending pending

Runner 2 = benchmarking-2

Run 22506675002 • Commit 162cf17 • Fri, 27 Feb 2026 22:42:31 GMT

@michaelstaib michaelstaib added 🔍 investigate Indicates that an issue or pull request needs more information. 🎬 ready Ready to merge and removed 🔍 investigate Indicates that an issue or pull request needs more information. labels Mar 2, 2026
@michaelstaib michaelstaib merged commit d952375 into main Mar 2, 2026
117 checks passed
@michaelstaib michaelstaib deleted the mst/issue-8407 branch March 2, 2026 13:31
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (afd4ba4) to head (7181aa7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9276   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Sorting on navigation properties in EF projection with UseSorting middleware fails

1 participant