Repository navigation
docs: pin the date extremes as a documented boundary where adjacency diverges - #169
Merged
Merged
Conversation
…diverges At the extremes of a date domain, IsAdjacentTo answers true in memory and false in PostgreSQL. Npgsql writes DateOnly.MinValue / MaxValue and LocalDate.MinIsoValue / MaxIsoValue as -infinity / infinity, so a range bounded at an extreme holds a sentinel on the server where the model holds a date, and no finite date is next to a sentinel: [-infinity,-infinity] -|- [0001-01-02,) is false where [0001-01-01,0001-01-01] and [0001-01-02,) are one day apart. Every other operator agrees, since both sides map the sentinel the same way and the reader turns it back into the extreme. The model keeps its answer on purpose. With Npgsql.DisableDateTimeInfinityConversions set the extremes reach the server as dates and -|- answers true there, so a model that stopped stepping across an extreme would disagree with that configuration instead; InfinityConversionsDisabledTests now holds that. The divergence joins the integer sentinel rows in docs/architecture.md's boundary table, docs/efcore.md and docs/ranges.md say it in the consumer's voice, claim E44 quotes it, DomainBoundaryDivergenceTests pins it as a literal, a parameter and through EF Core for DateRange and LocalDateRange, and DifferentialFuzzParityTests sets an adjacency row at a date extreme aside only when it disagrees in exactly the documented shape (memory true, EF and PostgreSQL false), counting it. The two #110 candidates are removed; with the set-aside removed the sweep reports them as unregistered rows again. Closes #110 Found-By: OT Defect-Class: STORE Co-Authored-By: Claude Fable 5.1 <[email protected]>
This was referenced Oct 18, 2026
…-adjacency-divergence # Conflicts: # test/oracles/candidates.json
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 #110
Stacked on #168 (
fix/infinite-range-is-unbounded), which is stacked on #167: merge those first, then retarget this tomain.Problem
At the extremes of a date domain
IsAdjacentToreturnstruein memory andfalsein PostgreSQL. Npgsql writesDateOnly.MinValue/MaxValueandLocalDate.MinIsoValue/MaxIsoValueas-infinity/infinity, so[0001-01-01,0001-01-01]is[-infinity,-infinity]on the server, and no finite date is next to a sentinel. Every other operator agrees on these values (both sides map the sentinel the same way, and the reader turns it back into the extreme); adjacency is the one with a step. Neither the domain-boundary table nor the EF Core guide said so.Decision
The issue offered two fixes: document the row as a domain boundary, or stop the in-memory check stepping across an extreme. This PR takes the first, because the second would create a new disagreement: with
Npgsql.DisableDateTimeInfinityConversionsset, the extremes reach the server as dates and-|-returnstruethere, exactly as memory does. The newInfinityConversionsDisabledTests.AtTheDateExtremes_AdjacencyAgrees_BecauseTheExtremesStayDatesholds that, so the in-memory answer is right for one configuration and the documented divergence is a property of Npgsql's infinity mapping, not of the algebra. Nothing insrc/changes; the issue'sbreakinglabel is removed accordingly,silentstays (the disagreement exists and is now documented and pinned).Change
docs/architecture.md: the date extremes join the domain-boundary section, with a table of the two divergent pairs and the pair that agrees, and why the model keeps its answer.docs/efcore.md(Store timestamp ranges) anddocs/ranges.md(Check adjacency, Good to know): the consumer-facing sentence; claimE44-date-extremes-adjacent-to-nothing-in-sqlquotes it, held by the three tests below.DomainBoundaryDivergenceTests.DateRange_AtTheDomainEdge_IsNotAdjacentAcrossAnExtremeOnTheServer: memorytrue, the literals EF writesfalse, column-against-parameter through EF CorefalseforDateRangeat both extremes andLocalDateRangeatMaxIsoValue, and the pair one day inside the extremestrueon both sides.DifferentialFuzzParityTests: an adjacency row at a date extreme is set aside only when it disagrees in exactly the documented shape (memorytrue, EF and PostgreSQLfalse) and counted in the test output; any other disagreement at the edge still fails.FuzzDomainexposes its extremes for the check, which keys on the literal EF writes for the extreme containinginfinity, soYearMonthRange(whose extremes are month boundaries, never sentinels) is not covered by it.docs/testing.md: the set-aside rule.test/oracles/candidates.json: the two IsAdjacentTo at the date extremes: memory says adjacent, PostgreSQL does not (MinValue/MaxValue are ±infinity there) #110 rows removed.Tests
DifferentialFuzzParityTests.Ranges_AgreeWithPostgresfails with the two previously registered rows (DateRange IsAdjacentTo at the domain edge …,RangeSet<DateRange> IsAdjacentTo(set) at the domain edge …), so the candidates were right to go and the set-aside is what holds them.🤖 Generated with Claude Code