Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
with:
dotnet-version: 10.0.x
dotnet-version: 11.0.x
dotnet-quality: preview

# Publishes exactly what was verified — the packages are not rebuilt here.
- name: Download packages
Expand Down Expand Up @@ -233,7 +234,7 @@ jobs:
# are reported and skipped instead of failing the job. Pushes are not atomic across packages,
# so retry with "Re-run failed jobs" on the same run: that logs in afresh (the temporary key
# expires an hour after login) and pushes the same verified artifact. A fresh run rebuilds —
# from the same commit, since release tags are immutable, but with whatever SDK 10.0.x is
# from the same commit, since release tags are immutable, but with whatever SDK 11.0.x is
# then, so the remaining packages would not be the ones verified with those already pushed.
- name: Push to NuGet
env:
Expand Down
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
This file is the canonical agent guide. `CLAUDE.md` only imports it (`@AGENTS.md`), so Claude Code
and every other agent read the same rules. Edit this file, never `CLAUDE.md`.

In-memory range and multirange types for .NET 10, mirroring PostgreSQL's six built-in range domains (`int4range`, `int8range`, `numrange`, `daterange`, `tsrange`, `tstzrange`) plus two v5 additions: `TimeRange` over `TimeOnly` (maps to the custom `timerange` type — needs `HasPostgresRange` + `EnableUnmappedTypes` on the EF side) and, in the NodaTime satellite, `YearMonthRange` over `YearMonth` (stored as a month-aligned `daterange`). Since 10.0.0, `Float64Range` and `Float32Range` cover finite `double` and `float` (the custom `float8range` and `float4range`, set up like `timerange`), with `Float64Set`/`Float32Set` and their arities on `double precision[]`/`real[]`. Each range type is a discriminated union of five sealed variants with exhaustive pattern matching.
In-memory range and multirange types for .NET 11 on `main` (the 11 line; `release/10.x` stays on .NET 10), mirroring PostgreSQL's six built-in range domains (`int4range`, `int8range`, `numrange`, `daterange`, `tsrange`, `tstzrange`) plus two v5 additions: `TimeRange` over `TimeOnly` (maps to the custom `timerange` type — needs `HasPostgresRange` + `EnableUnmappedTypes` on the EF side) and, in the NodaTime satellite, `YearMonthRange` over `YearMonth` (stored as a month-aligned `daterange`). Since 10.0.0, `Float64Range` and `Float32Range` cover finite `double` and `float` (the custom `float8range` and `float4range`, set up like `timerange`), with `Float64Set`/`Float32Set` and their arities on `double precision[]`/`real[]`. Each range type is a discriminated union of five sealed variants with exhaustive pattern matching.

Since v6 there is a second type family: **value sets** (`Sets/`) — immutable, canonical (deduplicated, sorted, no nulls) sets of scalar values stored as native PostgreSQL arrays (`StringSet`/`text[]`, `GuidSet`/`uuid[]`, …), plus a validated-wrapper arity for every family (`StringSet<T>` … `DateTimeOffsetSet<T>`, and five more in the NodaTime satellite) constrained only on BCL interfaces. EF maps them as scalars with plugin-owned mappings and translators (`@>`, `&&`, `<@`, `cardinality`, `array_cat`, `array_remove`) — never through EF's primitive-collection machinery. `Intersect`/`Except`/`Add` are deliberately client-side only: PostgreSQL's array type has no intersection, difference, or sorted insert.

## Stack
.NET 10 · C# 14 (extension methods) · MSTest 4.x · EF Core + Npgsql (PostgreSQL bridge)
.NET 11 (`main`; `release/10.x` is .NET 10) · C# 14 (extension methods) · MSTest 4.x · EF Core 11 + Npgsql (PostgreSQL bridge)

## Structure
Shipping projects live under `src/`, test projects under `test/`. Never hard-code a positional
Expand All @@ -23,13 +23,13 @@ so moving a project cannot silently retarget a test.
- `test/CodoMetis.ValueRanges.NodaTime.Tests/` — NodaTime satellite unit tests
- `test/CodoMetis.ValueRanges.EFCore.PostgreSQL.Tests/` — EF Core SQL translation tests (no database)
- `test/CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime.Tests/` — NodaTime EF translation tests (no database)
- `test/CodoMetis.ValueRanges.EFCore.PostgreSQL.IntegrationTests/` — Live PostgreSQL via Testcontainers (needs Docker; Inconclusive without, but hard failure under CI=true). The shared container runs `VALUERANGES_POSTGRES_IMAGE`, default `postgres:16-alpine` (the 10.x floor); CI runs both integration projects on 16 and 18, and a server below 16 fails every test (`PostgresServer.cs`). Covers BCL and NodaTime types. Authority on PostgreSQL semantics — run when changing translations or range algebra. `CapturedCollectionProbeTests` sends every discovered range and set type as a captured collection (`Contains`, `Any`, `Count`); it links `RangeProbes` and `SetProbes` from the conventions project rather than copying them. `ComplexIndexesCrossTests` holds this package's columns under `EFCore.ComplexIndexes.PostgreSQL`'s temporal and exclusion constraints and GiST indexes on PostgreSQL 16 and 18 (containers of its own) through a test-only reference; neither shipping package references the other
- `test/CodoMetis.ValueRanges.EFCore.PostgreSQL.IntegrationTests/` — Live PostgreSQL via Testcontainers (needs Docker; Inconclusive without, but hard failure under CI=true). The shared container runs `VALUERANGES_POSTGRES_IMAGE`, default `postgres:16-alpine` (the 10.x floor); CI runs both integration projects on 16 and 18, and a server below 16 fails every test (`PostgresServer.cs`). Covers BCL and NodaTime types. Authority on PostgreSQL semantics — run when changing translations or range algebra. `CapturedCollectionProbeTests` sends every discovered range and set type as a captured collection (`Contains`, `Any`, `Count`); it links `RangeProbes` and `SetProbes` from the conventions project rather than copying them. `ComplexIndexesCrossTests` holds this package's columns under `EFCore.ComplexIndexes.PostgreSQL`'s temporal and exclusion constraints and GiST indexes on PostgreSQL 16 and 18 (containers of its own) through a test-only reference; neither shipping package references the other. Off on the 11 line (the reference and the file are conditioned on `net10.0`) until ComplexIndexes ships its own 11 preview, CaffeinatedCoder/EFCore.ComplexIndexes#38; its #42 turns them back on
- `test/CodoMetis.ValueRanges.EFCore.PostgreSQL.InfinityDisabled.IntegrationTests/` — The same live layer for configuration that is per process: its runtimeconfig sets `Npgsql.DisableDateTimeInfinityConversions`, which Npgsql and the plugin each read once, so it cannot be flipped inside the other project's run. Holds the temporal store rule at the extremes with the conversion off. Own container; CI's integration job runs every `test/*IntegrationTests/`
- `test/CodoMetis.ValueRanges.AspNetCore.Tests/` — Host-level behaviour with no ValueRanges registration: configuration binding (`TypeConverter`), MVC and minimal-API binding and JSON bodies via `TestServer`, and the documented OpenAPI schema transformer (`ValueRangesSchemaTransformer.cs`), which `docs/serialization.md` must carry verbatim — edit the test copy, then the doc. `HostCultureProbeTests` binds every discovered type (core and NodaTime) through both hosts under four request cultures; it links `RangeProbes`, `SetProbes`, `WrapperElements` and `Reflect` from the conventions project rather than copying them
- `test/CodoMetis.ValueRanges.Conventions.Tests/` — Repo-level conventions: changelog consistency and form, packaging metadata, release wiring, the SECURITY.md supported-versions table, value set contract compliance, EF mapping parity, the default JSON contract. Everything is discovered (projects by globbing `src/`, types by reflection), so adding a package or a type needs no edit here
- `test/oracles/` — The bug-finding system (`docs/oracles.md`): `claims.json` quotes every promise the consumer-facing docs make and names the test that holds it (empty `heldBy` is the worklist); `oracles.json` registers the sweep classes; `seeds/*.patch` plant one defect each in `src/` that the named oracles were shown to catch; `surface-waivers.json` names the public members no claim covers, with the reason; `candidates.json` holds disagreements found but not fixed, keyed to issues; `postgres-surface.json` holds every PostgreSQL range, multirange and array operator and function (one entry per row of `postgres-surface.catalog.txt`, the raw `pg_operator`/`pg_proc` listing) with the member that mirrors it, the translation a test asserts, or a waiver or issue; `CloneSweep.cs` is the clone-divergence sweep over the hand-copied type families (sets, arities, ranges, EF registrations), and `clone-waivers.json` explains every divergence it finds between siblings that is right as it is. `Oracle*Tests` and `CloneDivergenceTests` in the conventions project hold all of it consistent in CI without building; `dotnet run tools/oracles.cs seeds` re-proves locally that every seed is caught, `… status` prints the worklist, `… pg-surface` regenerates the listing from a container, `… clones` prints the sibling divergences with their waiver status
- `tools/oracles.cs` — The local prover and status report for `test/oracles/`; file-based app, never run in CI
- `test/consumer-smoke-test.sh` — The only check of *delivery* rather than code: packs the four packages, restores them into throwaway projects created outside the repository (inside it, `Directory.Build.props` would apply), compiles and runs real code against them, and asserts on printed output and translated SQL — never on the exit code alone. Four consumers: core only; a Native AOT publish of core + NodaTime, run as a native binary (extra linker paths via `SMOKE_AOT_LINKER_ARGS`, e.g. for Homebrew's dotnet); the NodaTime EF satellite, which pulls in all four through the nuspec chain; and the EF package beside `EFCore.ComplexIndexes.PostgreSQL` from nuget.org, asserting its exclusion and temporal constraints over this package's columns in the create script. `NUGET_PACKAGES` is redirected to a private folder because NuGet resolves id+version from the global cache before any source, so a locally built package is otherwise shadowed by whatever build of that version was restored before; the generated `nuget.config` uses package source mapping so this repo's ids come from the local feed only and everything else from nuget.org. Runs on every PR in both modes (own feed; the pre-built `dist` the release workflow passes). Everything is discovered (projects by globbing `src/`, types by reflection), so adding a package or a type needs no edit here
- `test/consumer-smoke-test.sh` — The only check of *delivery* rather than code: packs the four packages, restores them into throwaway projects created outside the repository (inside it, `Directory.Build.props` would apply), compiles and runs real code against them, and asserts on printed output and translated SQL — never on the exit code alone. Four consumers: core only; a Native AOT publish of core + NodaTime, run as a native binary (extra linker paths via `SMOKE_AOT_LINKER_ARGS`, e.g. for Homebrew's dotnet); the NodaTime EF satellite, which pulls in all four through the nuspec chain; and the EF package beside `EFCore.ComplexIndexes.PostgreSQL` from nuget.org, asserting its exclusion and temporal constraints over this package's columns in the create script (skipped on the 11 line until CaffeinatedCoder/EFCore.ComplexIndexes#38, like `ComplexIndexesCrossTests`). `NUGET_PACKAGES` is redirected to a private folder because NuGet resolves id+version from the global cache before any source, so a locally built package is otherwise shadowed by whatever build of that version was restored before; the generated `nuget.config` uses package source mapping so this repo's ids come from the local feed only and everything else from nuget.org. Runs on every PR in both modes (own feed; the pre-built `dist` the release workflow passes). Everything is discovered (projects by globbing `src/`, types by reflection), so adding a package or a type needs no edit here
- `docs/` — Agent docs (read relevant doc before starting work)

## Commands
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ A version's section is the GitHub release's notes. Each line is one change: what
to do about it, and a link to the guide with the detail. [CONTRIBUTING.md](CONTRIBUTING.md#changelog)
has the rules.

## [11.0.0-preview.1] — 2026-10-19

The first preview of the 11 line: the same public API as 10.0.0, on .NET 11. Nothing was removed or renamed. The 10.x line stays on .NET 10 ([Branches and releases](https://github.com/CaffeinatedCoder/CodoMetis.ValueRanges/blob/main/CONTRIBUTING.md#branches-and-releases)).

### Breaking

- All four packages target `net11.0` and need the .NET 11 runtime, one target framework per line; the EF Core packages reference EF Core 11 and `Npgsql.EntityFrameworkCore.PostgreSQL` 11 (release candidates while .NET 11 is in preview). PostgreSQL 16 or later, as in 10.x.

### Changed

- EF Core: an `ExecuteUpdate` that sets a nullable value set inside a JSON column to a value that may be null is refused for the JSON array alone; Npgsql 11 writes the null outcome as JSON null, so the message no longer names a whole-document NULL ([JSON columns](https://github.com/CaffeinatedCoder/CodoMetis.ValueRanges/blob/main/docs/efcore.md#put-a-range-or-set-inside-a-json-column)).
- EF Core: an empty captured list of ranges or sets reads no rows through EF Core 11's own `SELECT … WHERE FALSE`; the SQL differs from 10.x, the answers do not ([Captured lists](https://github.com/CaffeinatedCoder/CodoMetis.ValueRanges/blob/main/docs/efcore.md#match-a-column-against-a-list-of-sets)).

### Fixed

- Value sets: every set type implements `IFormattable` itself, so `ToString()` and formatting no longer run the interface's default, whose shared-generic stub traps under Native AOT with ILCompiler 11 RC2 ([Native AOT](https://github.com/CaffeinatedCoder/CodoMetis.ValueRanges/blob/main/docs/serialization.md#native-aot)).

## [10.0.0] — 2026-10-19

Nothing was removed or renamed. Some calls answer differently, and text PostgreSQL refuses is refused here too: [Migration from v9.x](https://github.com/CaffeinatedCoder/CodoMetis.ValueRanges/blob/main/docs/migration.md#migration-from-v9x).
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dotnet build CodoMetis.ValueRanges.slnx
dotnet test
```

`global.json` pins the SDK to the line's major (10.0.x on `main`), so install a .NET 10 SDK; a
`global.json` pins the SDK to the line's major (11.0.x on `main`, 10.0.x on `release/10.x`), so install a .NET 11 SDK; a
newer major on the machine is refused rather than silently used ([branches and
releases](#branches-and-releases)).

Expand Down Expand Up @@ -177,7 +177,10 @@ fails outright.
on, a minor on one line moves its row and `CompanionLineRelease` on the other branch in a PR of
its own. The table gets its second row in the PR that opens the first version after `v11.0.0`.
- **The ApiCompat baseline** is the latest stable release before the version being prepared,
never a preview: the 11 line validates against 10.0.0 until 11.0.0 ships.
never a preview: the 11 line validates against 10.0.0 until 11.0.0 ships. Package validation
cannot pair a `net11.0` asset with a `net10.0` baseline, so until then `Directory.Build.props`
ignores the baseline's framework and each preview's PR quotes a `dotnet apicompat` run over the
two assemblies instead; the mechanical gate returns when 11.0.0 is the baseline.
- **GitHub's Latest release** is the highest stable version. The release workflow decides it
rather than trusting the API's default, so a 10.x tag pushed after 11.0.0 exists, or any
preview, can't take Latest from it.
Expand Down
19 changes: 17 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>10.0.0</Version>
<Version>11.0.0-preview.1</Version>
<Authors>CaffeinatedCoder</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down Expand Up @@ -64,9 +64,24 @@
-->
<PropertyGroup>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageValidationBaselineVersion>9.1.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion>10.0.0</PackageValidationBaselineVersion>
</PropertyGroup>

<!--
The 11 line against the 10.x baseline (#103). Package validation pairs assets by the
baseline's frameworks: the baseline ships net10.0, this line ships net11.0 only, and a net11.0
asset does not serve a net10.0 consumer, so the baseline's framework is reported as dropped
(PKV006) and no member comparison runs. Ignoring the framework is that statement made
explicit — it is dropped, on purpose, one TFM per line — and it leaves nothing for the
validator to compare until 11.0.0 is the baseline. Until then the public surface is held
equal to 10.0.0 by hand: `dotnet apicompat` (Microsoft.DotNet.ApiCompat.Tool) over the
baseline's and this build's assemblies, run for each preview and quoted in its PR. Remove
this once PackageValidationBaselineVersion names a net11.0 release.
-->
<ItemGroup>
<PackageValidationBaselineFrameworkToIgnore Include="net10.0" />
</ItemGroup>

<!--
The latest release of the other supported line, or empty while only one line has a release.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![dev.to](https://img.shields.io/badge/dev.to-Article-3B82F6)](https://dev.to/caffeinatedcoder/the-interval-is-the-thing-modelling-range-types-as-first-class-domain-objects-in-net-3jha)
[![hashnode](https://img.shields.io/badge/hashnode.dev-Article-3B82F6)](https://codometis.hashnode.dev/stop-modeling-time-with-two-columns-codometis-valueranges-brings-interval-logic-to-your-net-domain?utm_source=hashnode&utm_medium=feed)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![.NET 10](https://img.shields.io/badge/.NET-10-512BD4)](https://dotnet.microsoft.com)
[![.NET 11](https://img.shields.io/badge/.NET-11-512BD4)](https://dotnet.microsoft.com)
[![Native AOT: core + NodaTime](https://img.shields.io/badge/Native%20AOT-core%20%2B%20NodaTime-3B82F6)](docs/serialization.md#native-aot)

Immutable **range types** (`[2025-06-01, 2025-06-08]`) and **value sets** (`{alpha, beta}`) for
Expand All @@ -20,7 +20,7 @@ multirange and array columns, so one expression means the same thing in a unit t
dotnet add package CodoMetis.ValueRanges
```

You need .NET 10 or later. To run your LINQ queries as SQL, add the EF Core package,
You need .NET 11 or later (the 10.x line stays on .NET 10). To run your LINQ queries as SQL, add the EF Core package,
[`CodoMetis.ValueRanges.EFCore.PostgreSQL`](docs/efcore.md). It needs PostgreSQL 16 or later. For NodaTime types, add the
[NodaTime packages](#nodatime).

Expand Down
10 changes: 4 additions & 6 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,23 @@ maintained.

| Version | Supported |
|---|---|
| 9.1.x | ✅ |
| < 9.1 | ❌ |
| 10.0.x | ✅ |
| < 10.0 | ❌ |

Previews (`11.0.0-preview.N`) are not supported versions and have no row: a fix reaches a preview
in the next preview.

### How the table changes

- **Until 10.0.0 ships**, one line is supported: 9.1.x.
- **When 10.0.0 ships**, 9.x stops receiving fixes and 10.0.x takes its row. The 11.0.0 previews
that follow on `main` have no row.
- **Until 11.0.0 ships**, one line is supported: 10.0.x. 9.x stopped receiving fixes when 10.0.0
shipped. The 11.0.0 previews on `main` have no row.
- **When 11.0.0 ships**, the table gets its second row: 11.0.x, and below it the latest 10.x minor.
From then on each line's row moves when that line ships a minor.

### For how long

There is no fixed end-of-support date. Each line is tied to the .NET release it targets:

- **9.x** targets **.NET 10** (`net10.0`, EF Core 10) and receives fixes until 10.0.0 ships.
- **10.x**, the LTS line, targets **.NET 10** (`net10.0`, EF Core 10, PostgreSQL 16+). The intention
is to maintain it for as long as Microsoft supports .NET 10 (LTS, until November 2028).
- **11.x** targets **.NET 11** (`net11.0`, EF Core 11, Npgsql 11, PostgreSQL 16+), as previews until
Expand Down
Loading