Skip to content

Native AOT DataProviderMigrate release build passes again, and CI publishes it on every PR - #127

Merged
MelbourneDeveloper merged 1 commit into
mainfrom
fix/native-aot-release
Oct 13, 2026
Merged

MelbourneDeveloper merged 1 commit into
mainfrom
fix/native-aot-release

Conversation

@MelbourneDeveloper

Copy link
Copy Markdown
Collaborator

TLDR

Make the Native AOT DataProviderMigrate release build pass again, and run it on every PR so it can't silently break.

What Was Added?

  • Migration/DataProviderMigrate/Program.SqlServer.cs: the SQL Server migrate path, compiled only in the managed build. In the native (AOT) build, --provider sqlserver prints that the provider is unavailable there and points to the managed dotnet tool.
  • DataProvider/Nimblesite.DataProvider.SQLite/SqliteGeneratorJsonContext.cs: source-generated System.Text.Json metadata for the SQLite generator's config files.
  • NativeAotMigrateSmokeTests.NativeBinary_SqlServerProvider_ReportsUnsupported.
  • CI (lint-and-dataprovider job): installs the Linux AOT toolchain, runs make aot (native publish + smoke migrate), and runs NativeAotMigrateSmokeTests against the published binary.

What Was Changed or Deleted?

  • Why the release failed: the v0.10.0-beta.1 release failed in release-dotnet-binaries on all four platforms, and main failed the same way.
    • Microsoft.Data.SqlClient is not trim or AOT compatible (IL2104/IL3053, including 7.1.1), and it pulled System.Data XML serialization and ConfigurationManager into the native binary.
    • Migration.SQLite now references DataProvider.SQLite for its SQLite parser. The publish passes -p:PublishAot=true globally, so the AOT analyzers ran on that project and rejected two reflection-based JsonSerializer.Deserialize calls (IL2026/IL3050).
  • DataProviderMigrate.csproj: references Migration.SqlServer only when PublishAot is not set.
  • SqliteCodeGenerator: both config reads now use SqliteGeneratorJsonContext (case-insensitive, as before). The ! operators on those lines are removed.
  • Makefile: with TMPDIR unset (Linux, CI), make aot smoke-tested against /tmpdataprovider_aot_smoke.db, which can't be created. It now joins the path with exactly one /.

How Do The Automated Tests Prove It Works?

  • The release workflow's exact AOT publish (dotnet publish Migration/DataProviderMigrate -c Release -r linux-x64 -p:PublishAot=true -p:InvariantGlobalization=true --self-contained) now succeeds with zero warnings. Before, it failed with the IL2026/IL3050 and IL2104/IL3053 errors above.
  • The release smoke step (migrate example-schema.yaml to SQLite with the native binary) passes, including the schema integrity check. make aot passes.
  • NativeAotMigrateSmokeTests (4/4) pass against the published binary, including the new NativeBinary_SqlServerProvider_ReportsUnsupported. CI now runs them on every PR.
  • The managed build still runs real SQL Server migrations: dotnet run --project Migration/DataProviderMigrate -- migrate --provider sqlserver reaches SqlClient (connection error against an unreachable server, not the AOT message). The in-process SQL Server CLI tests in Migration.Tests pass.
  • make fmt CHECK=1, make lint and deslop . (14.81% against the 15% budget) pass. DataProvider.Tests (393), DataProvider.Example.Tests (194) and Migration.Tests (610, plus the 4 native smoke tests that skip without a binary) pass with their coverage gates.

Spec / Doc Changes

  • docs/plans/dataprovider-migrate-aot.md: new [MIG-AOT-SQLSERVER] section covering the SQL Server exclusion and the [MIG-AOT-CI] PR gate.

Breaking Changes

  • None
  • The native DataProviderMigrate binaries (Homebrew/Scoop/GitHub Release) do not support --provider sqlserver. Nothing regresses: no native binary has shipped yet (the AOT release workflow arrived in Fix existing-database upgrades and strengthen cross-platform toolkit CI #113 and has failed on every tag since), and 0.9.12-beta's CLI had no SQL Server migrate path. The managed dotnet tool and the NuGet packages keep full SQL Server support.

Microsoft.Data.SqlClient is not trim or Native AOT compatible, so the
native DataProviderMigrate build leaves out the SQL Server provider and
reports it as unavailable; the managed dotnet tool keeps it. The SQLite
generator's config reads use a source-generated JSON context so the AOT
analyzers accept the assembly the migrate binary now compiles for its
SQLite parser.

make aot no longer writes its smoke database to /tmpdataprovider_aot_smoke.db
when TMPDIR is unset, and CI runs make aot plus the native smoke tests.
@MelbourneDeveloper
MelbourneDeveloper enabled auto-merge (squash) October 13, 2026 11:54
@MelbourneDeveloper
MelbourneDeveloper merged commit e0c6f8c into main Oct 13, 2026
11 checks passed
@MelbourneDeveloper
MelbourneDeveloper deleted the fix/native-aot-release branch October 13, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant