Files
Pavlo Ratushnyi 1e0d11df1c
ci / build, test, smoke (push) Failing after 3m33s
ci / the same smoke on an image with no base (push) Successful in 8m10s
ci / lint the workflow and the shell (push) Failing after 19s
ci / the operator page in a real browser (push) Successful in 4m41s
ci / build the image and smoke it (push) Failing after 8m11s
the first query moves off ef, and the aot edge reads its own policy from the database
Wall 3 starts. Two projects, one query path, measured.

dotnet/OpenWaf.Data is the runtime: OrmContext (a DbDataSource plus an
ISqlDialect), Query<T>, RowReader, OrmMeta. It is typed over System.Data.Common
and carries no provider package; the driver is supplied at composition, which is
how the neighbouring deployment ships it too. Query<T> renders SQL by walking the
expression tree rather than compiling it — that is the exact difference from EF's
pipeline, and the reason it survives a NativeAOT link where EF does not. The
supported grammar is a closed set that refuses by name: joins, subqueries,
aggregates other than COUNT, updates, deletes, JSON columns and method calls each
raise UnsupportedQueryNodeException naming the node, because a renderer that
guesses is a renderer that ships wrong SQL.

dotnet/OpenWaf.Data.Generator is a Roslyn incremental generator attached to
OpenWaf.Infrastructure as an analyzer. For a [Table] class it emits the column
map, the row materializer and an OrmMeta.Register call inside a
[ModuleInitializer], so the question a NativeAOT binary cannot answer — what are
this type's properties — is never asked. The generated file is ordinary C#,
readable in obj/ and asserted against.

PolicySetting is the entity moved and EdgePolicyProvider.ReloadAsync the call
site, which was the first refusal in the probe log. Program.cs composes the
driver and dialect on the same Database:Provider switch EF uses, so one generated
query serves sqlite (the shipped image) and PostgreSQL (the migrations'
provider). EF still owns every write and every other read; the two layers
coexist on one composition root, which is what makes this incremental rather than
a rewrite.

Measured on the AOT binary, same probe, same window, before and after:
queries refused at run time 32 -> 18; EdgePolicyProvider reload failures 1 -> 0;
native binary 49,609,680 -> 49,676,016 bytes. The 18 that remain are named by
their own frames: 14 EdgeStateStore.RefreshAsync, 2 BlockStore.WriteBanAsync,
1 BlockStore.AddOperatorAsync, 1 admin endpoint.

The sqlite timestamp column turned out to be a contract, not a detail. The model
puts EF's DateTimeOffsetToBinaryConverter on every timestamp column, so every row
already written says (localTicks / 1000) * 2048 + (offsetMinutes & 2047); the
formula was derived by probing EF's converter and is now pinned by
SqliteTimestampEncodingTests against that converter over five instants including
+05:30, -05:00 and DateTimeOffset.MinValue — including the microsecond
truncation the /1000 imposes, which is EF's behaviour and is now a test rather
than a future surprise.

Two build traps, both paid for and both recorded where the next person will hit
them. -p:PublishAot on the command line is a global property, so it reaches every
project in the graph including a netstandard2.0 Roslyn analyzer, and the publish
dies with NETSDK1207; AOT is now switched by OpenWafAot=true, which only
OpenWaf.Edge.csproj turns into PublishAot — the same shape as the existing
OpenWafCompiledModel switch. And a raw Microsoft.Data.Sqlite data source needs
SQLitePCL.Batteries.Init() before its first open, because the order in which
EF's provider and this data source are first used is not guaranteed.

Gates on this tree: build 0 warnings, unit 391/391 (13 new: rendered SQL for both
dialects, null tests, the captured-null case, the refusals, the timestamp
encoding), integration 408/408, smoke 256/256, and the AOT probe above. One
earlier run of the 408 carried a single failure in AdminConsoleTests at a host
load average near 30 and the next run was clean; recorded rather than hidden, in
the same family as the load-sensitive compose gates this README already
documents.
2026-10-07 21:48:01 +02:00

67 lines
3.5 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\OpenWaf.Domain\OpenWaf.Domain.csproj" />
<!-- The generated query layer (OPEN-79, wall 3). The runtime is an ordinary
reference; the generator is attached as an analyzer so it runs inside this
compilation and emits the mapping for the [Table] classes declared here. -->
<ProjectReference Include="..\OpenWaf.Data\OpenWaf.Data.csproj" />
<ProjectReference Include="..\OpenWaf.Data.Generator\OpenWaf.Data.Generator.csproj"
OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="all"
UndefineProperties="PublishAot;SelfContained;RuntimeIdentifier" />
<!-- BackgroundService, DI and options come from the shared framework;
an explicit PackageReference for them would be pruned by NuGet. -->
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.12">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.12" />
<!-- NU1903: EF's transitive SQLitePCLRaw 2.1.11 carries a known high
severity advisory (GHSA-2m69-gcr7-jv3q). Pinned forward rather than
suppressed, because TreatWarningsAsErrors is on and the audit is the
thing that caught it. -->
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.1.13" />
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.13" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
<PackageReference Include="MaxMind.GeoIP2" Version="5.2.0" />
</ItemGroup>
<PropertyGroup>
<!-- The EF compiled model under Persistence/CompiledModel is generated for
ONE provider — sqlite, the one the shipped image runs. The framework-
dependent build serves sqlite *and* postgres and builds its model at
startup, so the compiled model is compiled in only for the AOT publish
(`-p:OpenWafCompiledModel=true`), where EF refuses to build a model at
runtime at all. Leaving it in every build would hand a sqlite model to a
postgres connection. -->
<OpenWafCompiledModel Condition="'$(OpenWafCompiledModel)' == ''">false</OpenWafCompiledModel>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<!-- The DDL this build ships with, generated from the model by
`dotnet ef dbcontext script` and checked by the schema-script gate. It is
the schema of a NativeAOT binary, which cannot ask EF to build a model at
run time; see Persistence/EmbeddedSchema.cs. -->
<EmbeddedResource Include="Persistence/Schema/schema.sqlite.sql"
LogicalName="OpenWaf.Infrastructure.Persistence.Schema.schema.sqlite.sql" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="OpenWaf.Tests.Unit" />
<InternalsVisibleTo Include="OpenWaf.Tests.Integration" />
</ItemGroup>
<ItemGroup Condition="'$(OpenWafCompiledModel)' != 'true'">
<Compile Remove="Persistence/CompiledModel/**/*.cs" />
</ItemGroup>
</Project>