Skip to content

Upgrade Marten to v9 - #10651

Open
jarlef wants to merge 1 commit into
ChilliCream:mainfrom
jarlef:jf/upgrade-marten-to-v9
Open

jarlef wants to merge 1 commit into
ChilliCream:mainfrom
jarlef:jf/upgrade-marten-to-v9

Conversation

@jarlef

@jarlef jarlef commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Upgrade Marten to v9 since v8 has been flagged with critical vulnerabilitie

GHSA-rfx3-98h7-v3xp
GHSA-vmw2-qwm8-x84c

Since v9 has a breaking change where sync operations are no longer supported on the queryable a custom executable is needed. This wraps the marten queryable to ensure async operations are invoked.

https://martendb.io/migration-guide.html

Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:43

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.

🟡 Changes recommended

Offset paging still bypasses the async executable and uses synchronous count queries unsupported by Marten v9.

2 open issues
What changed in this PR

Upgrades Marten to v9 to address reported vulnerabilities and adapts Hot Chocolate’s Marten integration for asynchronous query execution.

Changes:

  • Updates Marten to 9.51.0.
  • Adds an async executable and integrates it with filtering and sorting.
  • Adds integration coverage and updates SQL-capture test helpers.
File Description
src/​HotChocolate/​Marten/​test/​Data.Marten.Sorting.Tests/​SortVisitorTestBase.cs Captures SQL through executables.
src/​HotChocolate/​Marten/​test/​Data.Marten.Filters.Tests/​IntegrationTests.cs Tests async resolver execution paths.
src/​HotChocolate/​Marten/​test/​Data.Marten.Filters.Tests/​FilterVisitorTestBase.cs Captures SQL through executables.
src/​HotChocolate/​Marten/​src/​Data/​Sorting/​MartenQueryableSortProvider.cs Wraps sorting query builders.
src/​HotChocolate/​Marten/​src/​Data/​MartenQueryBuilder.cs Adapts Marten results for async execution.
src/​HotChocolate/​Marten/​src/​Data/​MartenQueryableExecutable.cs Implements async query operations.
src/​HotChocolate/​Marten/​src/​Data/​MartenEnumerableExtensions.cs Exposes AsMartenExecutable().
src/​HotChocolate/​Marten/​src/​Data/​Filtering/​MartenQueryableFilterProvider.cs Wraps filtering query builders.
src/​Directory.Packages.props Updates the Marten dependency.

Review effort: Balanced

<PackageVersion Include="JsonPointer.Net" Version="5.0.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.3.4" />
<PackageVersion Include="Marten" Version="8.37.4" />
<PackageVersion Include="Marten" Version="9.51.0" />
=> await source.CountAsync(cancellationToken).ConfigureAwait(false);

public override async ValueTask<List<T>> ToListAsync(CancellationToken cancellationToken = default)
=> [.. await source.ToListAsync(cancellationToken).ConfigureAwait(false)];
@michaelstaib

michaelstaib commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

We have already this on our list for HC 17 at the end of the year.

@glen-84

glen-84 commented Oct 21, 2026

Copy link
Copy Markdown
Member

This branch has not been deployed

No deployments
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.

4 participants