Repository navigation
test: the translator's parity sweep against EF Core's query SQL, and the same rows answered on PostgreSQL 18 - #75
Merged
Conversation
…the same rows answered on PostgreSQL 18 5.x's differential sweep, ported as files. The catalogue reads the translator's tables and crosses every construct with every operand shape; the rows are compiled by Roslyn; the translator and the kernel's resolver are compared with EF Core's ToQueryString(), both parsed with PostgreSQL's precedence. A disagreement is listed in waivers.txt with its reason, and a waiver nothing needs fails. The live test runs the same rows on PostgreSQL 18 and builds an index for each expression a waiver calls equivalent. The part written anew is how SchemaKit's side is rendered. Members of a JSON document are left out behind one switch until a provider renders them. Closes #74 Co-Authored-By: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #74
The second slice of #26.
Problem
The translator (#71) was held by rule tests: each says what a lambda is written as. Nothing checked that this is what EF Core's own queries write for the same lambda, which is the point of the translator: PostgreSQL uses an expression index only for a query whose expression matches it, and a predicate with other null semantics covers other rows.
Change
5.x's differential sweep, ported as files into
test/CodoMetis.EFCore.SchemaKit.Tests/TranslatorParity, about 1,900 lines:ParityCatalogue,ParityModel,ParitySeed,PostgresCanonicalForm,ParityWaivers,TranslatorParitySweepTests: as they were, namespaces and names aside.ParitySweep: the SchemaKit side is written anew. 5.x declared an index per template and read the SQL from its differ. Here a template goes through the kernel's resolver, against the same model EF Core's query is written for.waivers.txt: 5.x's file with its reasons, less the rows over a JSON document.Integration/TranslatorParityLiveTests: the answers-alike run on PostgreSQL 18, and the unique index on a concatenation with a nullable operand.The sweep was green on its first run with 5.x's waivers: Npgsql 11 writes every swept construct as Npgsql 10 did, and the port of the translator (#72) changed none.
negator,boolean-equality,integer-length)ulongNot here
Members of a JSON document. The kernel's resolver refuses a path into one until a provider package renders it (#43), so every such row would be accepted at the declaration and fail at resolution. The catalogue leaves that operand shape out behind
ParityCatalogue.JsonMembers; 5.x swept it, and its waivers for it are in its repository.Tests
On SDK 11.0.100 in the checkout: 398 kernel tests before, 405 after, without a server (the 4 integration tests go inconclusive). Against
postgres:18in Docker: the 4 integration tests pass, among them the live run over more than 1,400 rows.One test is new and not from 5.x:
The_sweep_is_not_hollowputs a floor under what is compared, since a sweep that compares nothing agrees with everything.Undone in a scratch copy, with the sweep and the live run:
!=substrforsubstringwaivers.txtNo waiver outlives the disagreement it waivesfailsThe two rows that pass on the server are what the sweep is for:
btrim(x)andsubstrgive the same answers on the seed rows and are not the expression EF Core's query has, so an index on them would not be used. Only the comparison of renderings sees that.Found on the way: the live test class threw in its cleanup when no server was configured, which made the two tests fail and not go inconclusive. The cleanup now does nothing when the test never connected.
🤖 Generated with Claude Code