Skip to content

test: translation-support inventory — every public query member classified and probed against EF Core (#384) - #386

Merged
CaffeinatedCoder merged 3 commits into
mainfrom
test/384-translation-inventory
Oct 25, 2026
Merged

CaffeinatedCoder merged 3 commits into
mainfrom
test/384-translation-inventory

Conversation

@CaffeinatedCoder

@CaffeinatedCoder CaffeinatedCoder commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Closes #384

It reuses the composition helpers from #383, which has merged, so it's now based on main directly. #408 (10.3.0) depends on it, and #430 ports it to release/10.x.

Problem

postgres-surface.json inventories PostgreSQL's side. Nothing inventoried the C# side: which public members a query can call, and whether EF Core runs each one as SQL. docs/efcore.md#what-runs-where lists both halves by hand, and a member in neither table (a new overload, a generic family, a member the docs never mention) had no stated support. A member whose translation disappeared or appeared was noticed only if a hand-written test called it. The composition sweeps counted Clamp as "untranslated" without saying whether that was intended.

Change

  • QueryMembers (conventions project, linked into the integration project): discovered from the public API, not from the translators. Every public method and instance property of a public, non-nested type of the two libraries whose receiver, a parameter or the result is a range, a multirange or a value set. One key per overload, with generic families kept generic. Converters, static constants and overloads an expression tree cannot hold (ReadOnlySpan<char>, out) are left out by rule. That gives 813 keys.
  • test/oracles/translation-support.json: 36 entries, first match wins: server, client (with the reason) or planned (with the issue). Every reason quotes its row in docs/efcore.md#what-runs-where, or says plainly that the docs don't mention the member.
  • TranslationSupportInventoryTests (conventions, no database): every key is classified, no entry is stale, and every entry carries what its support needs. A new public member fails CI until it is classified.
  • TranslationSupportProbeTests (integration): 2,254 member × type cells over 13 range and 34 value set types, about 12 s. Each call takes a column as an operand. It first runs where the server must evaluate it: a filter for a predicate, a null test for a value that can be NULL, an ordering for one that can't (EF Core folds (int?)x == null away untranslated), and HAVING for an aggregate. Then it runs in a final projection. Both are compared with memory over the rows as loaded.
  • Registered in oracles.json, named in E30/E31 heldBy, described in docs/oracles.md and AGENTS.md.

What it found

  • RangeLowerBoundComparer.Compare runs as SQL in the range order: EF Core rewrites any Compare(a, b) to the natural comparison #385 (new, silent, low): EF Core rewrites any Compare(a, b) to the natural comparison. So RangeLowerBoundComparer<TRange, T>.Instance.Compare(r.Period, p) runs as SQL in the full range order. Where(… == 0) drops ranges that share p's lower bound. It is registered as a candidate. The root cause is EF Core's: a comparer that reverses int order gets the same treatment. Reporting that upstream is separate.
  • Everything else agrees with the docs: 1,656 cells run as SQL with memory's answers, and 598 run in memory only and project memory's answers.

Members docs/efcore.md#what-runs-where didn't mention (classified from what the probe shows)

#399 (PR #400) has since listed all of them, and their reasons now point at those rows. Only RangeLowerBoundComparer.Compare is still unlisted, until #385 is fixed. The other reasons follow #402's rewrite (PR #403). The classifications didn't change.

The calendar factories (Month, Quarter, Year, IsoWeek with a column argument) are planned with #191, which tracks them and which the docs link.

Tests

After merging main and updating the reasons (2026-10-25, PostgreSQL 16 locally): TranslationSupportInventoryTests and the oracle tests 65/65, conventions project 416/416, TranslationSupportProbeTests passes with the #385 candidate. With *Range.Month(* classified server, the probe fails with "classified server, but refused" on every Month overload of DateRange and LocalDateRange, so it reaches the calendar entries.

As first opened:

  • TranslationSupportInventoryTests 3/3; conventions project 412/412.
  • TranslationSupportProbeTests passes on PostgreSQL 16 and 18 with the RangeLowerBoundComparer.Compare runs as SQL in the range order: EF Core rewrites any Compare(a, b) to the natural comparison #385 candidate; integration project 301/301 on both.
  • Seed merge-translation-dropped.patch (the range translator stops translating Merge): CAUGHT by TranslationSupportProbeTests as "classified server, but refused" on every range type.
  • While building it, three probe artifacts were fixed in the harness, not reported: an explicit Convert to the interface parameter (C# passes the column without one), CultureInfo as a constant in a client projection, and sub-microsecond probe elements (the store's truncation is TemporalStoreParityTests' to judge).

🤖 Generated with Claude Code

…ified and probed against EF Core (#384)

The public API's query members are discovered (QueryMembers: every public
method and instance property whose receiver, a parameter or the result is a
range, a multirange or a value set; one key per overload, generic families kept
generic; converters, constants and span/out overloads out by rule) and each is
classified in test/oracles/translation-support.json as server, client (with the
reason) or planned (with the issue).

- TranslationSupportInventoryTests (conventions): every key classified, no stale
  entry, every entry with what its support needs.
- TranslationSupportProbeTests (integration): 811 keys over 2,254 member/type
  cells, each with a column operand, first where the server must evaluate it
  (filter, null test, ordering for a non-nullable value, HAVING for an
  aggregate), then in a final projection, against memory over the loaded rows.

The first run found #385: EF Core rewrites any Compare(a, b) to the natural
order, so RangeLowerBoundComparer.Compare runs as SQL in the range order.
Seeded by merge-translation-dropped.patch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added tests Adds or changes tests only (oracles, harnesses); no library code area/ranges Range unions, variants and the shape engines area/range-set RangeSet and multirange algebra area/value-sets Value set families and wrapper arities package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime stacked Base is another open PR; merge in order, CI does not run until it targets main labels Oct 24, 2026
Base automatically changed from test/362-composition-sweeps to main October 24, 2026 20:30
@CaffeinatedCoder

Copy link
Copy Markdown
Owner Author

When #399 merges (PR #400), the reason of the entries that say "not in docs/efcore.md#what-runs-where" should point at the rows that now list them: *.Equals(*, RangeSet<TRange, T>.Count, *.Item[* (the RangeSet half), *.Values, *.GetEnumerator(*, *.From(*, *.Parse(*, *.ToString(*, *.GetHashCode(* and NodaTimeInteropExtensions.*. The calendar entries' "not translated yet" becomes "not translated", following the new row. RangeLowerBoundComparer stays as it is (#385).

@CaffeinatedCoder

Copy link
Copy Markdown
Owner Author

Further to the note above: #402 (PR #403) rewrites the in-memory reasons in docs/efcore.md#what-runs-where. Several reason texts in translation-support.json quote the old ones and should follow the new rows: *Range.Length ("int4range overflows int4"), *Range.Values(*/*Range.Split(* ("a set of rows rather than a value"), *ValueSetRangeExtensions.* ("unnest and a custom aggregate"), RangeExtensions.Clamp(* ("a CASE per shape"), *Range.Shift(*/*Range.Expand(*, ValueSetExtensions.Intersect(*/Except(*/Add(* ("no intersection/difference/sorted insert") and *.Item[* ("the canonical order is the CLR comparer's"). The classifications stay as they are; only the reasons change.

@CaffeinatedCoder

Copy link
Copy Markdown
Owner Author

Correction to the PR description and my earlier notes: the calendar factories are tracked, by #191 ("Translate the calendar factories when they read a column"). So *Range.Month(*, *Range.Quarter(*, *Range.Year(* and *Range.IsoWeek(* should be planned with #191, not client; YearMonthRange.Create* stays client. #399 keeps "not translated yet" in the docs and links #191.

CaffeinatedCoder and others added 2 commits October 25, 2026 13:37
…an the calendar factories under #191 (#384)

The reasons quoted docs/efcore.md#what-runs-where as it stood before #399
listed every public query member and #402 rewrote the in-memory reasons.
Each now follows its row. The calendar factories over a column are
planned with #191, not client. No classification of a server or client
member changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder removed the stacked Base is another open PR; merge in order, CI does not run until it targets main label Oct 25, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit c6a7b5f into main Oct 25, 2026
15 of 16 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the test/384-translation-inventory branch October 25, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/range-set RangeSet and multirange algebra area/ranges Range unions, variants and the shape engines area/value-sets Value set families and wrapper arities package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime tests Adds or changes tests only (oracles, harnesses); no library code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translation-support inventory: every public query member classified as server, client-only or planned, and probed against EF Core

1 participant