Repository navigation
test: differential fuzzing sweep of ranges, multiranges and value sets against PostgreSQL - #113
Merged
Merged
Conversation
…s against PostgreSQL DifferentialFuzzParityTests draws seeded random operands for every range, multirange and value set type the packages define, discovered by reflection (BCL and NodaTime). It requires memory, the EF Core translation (column, inlined constant and parameter operands) and PostgreSQL's operator on EF's literals to agree on every operation EF translates. 200 rows per type by default (about 12 s). VALUERANGES_FUZZ_ROWS and VALUERANGES_FUZZ_SEED widen it locally. The first run found three families. They are registered as candidates: IsUnboundedStart/End on (,) (#109), RangeSet.Overlaps on continuous domains (#106), and adjacency at the date extremes (#110). Two seeds prove the sweep fails (both CAUGHT by tools/oracles.cs). Candidates.Verdict gains requireEveryCandidate so that another seed does not report a candidate as fixed. Closes #104 Co-Authored-By: Claude Opus 5.5 <[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 #104
Problem
The parity layer against PostgreSQL sweeps hand-picked rows: about ten shapes per domain in
ShapeMatrixParityTests, five instants inTemporalStoreParityTests, a fixed list inUnionCanonicalityTests. Every value-level defect between memory and the database so far hid behind correct SQL until someone picked the row that showed it:IsAdjacentTo(6.2.1),IsStrictlyLeftOfandExcept(7.0.0), andRangeSet.Exceptwith infinity (8.0.0).Change
DifferentialFuzzParityTests(integration project), with its helpers inFuzzing/:FuzzDomains). It is seeded per type, so CI draws the same rows every run, and a seed's first rows stay the same when the budget grows. Bounds are drawn near the extremes, the shared edges, the centre or another bound of the row, then stepped by a few units, so equal, adjacent, touching and off-by-one bounds come up constantly. It draws all five shapes, empties, andRangeSets of 0 to 5 members. Value sets draw from a small pool per row, so they have duplicates. Strings cover case and culture folds, composed and decomposed forms, whitespace, and characters an array literal must quote or escape. Temporal values include the extremes and are drawn at store precision.MappingParityTestsdoes: 11 range types plus their multiranges, and 30 value set types (closed sets and wrapper arities, BCL and NodaTime). An element type with no domain fails loudly.(,min)domain boundary.==,Merge,Intersect,Union,Except,Contains(element), bounds, inclusivity, and the 5 shape checks.RangeSet: the same against a range, against a set, and against an element, plus the|&-operators,Merge,Complement, bounds and shape checks. Value sets:Contains,Overlaps, the four subset predicates,==,Union(projected, and under<@,&&andcardinality = 0only, per the SQL guard),RemoveandCount/IsEmpty.VALUERANGES_FUZZ_ROWSandVALUERANGES_FUZZ_SEEDwiden the search locally. Each failure line carries the seed and row, and says "at the domain edge" when an operand touches an exact extreme.22003,22008,22009, the documented domain boundary) are counted and set aside. Sub-microsecond temporal values are left out becauseTemporalStoreParityTestsowns them.postgres:17-alpineand registered incandidates.json:IsUnboundedStart()/IsUnboundedEnd()on(,)answerfalsein memory andtruethrough EF (lower_inf), on all 11 range types.IsAdjacentToat the date extremes.MinValue/MaxValuebecome±infinityon the server, and no finite date is adjacent to those. This affectsDateRange,LocalDateRangeand theirRangeSets.RangeSet.Overlapson every continuous type, through column, constant and parameter. I commented the measured scope on the issue.oracles.jsonand added toheldByof the 15 claims it holds. There are two new seeds:intersect-tied-end-keeps-receiver-inclusivity(ranges) andvalue-set-subset-ignores-tail(value sets).Candidates.VerdictgainsrequireEveryCandidate(defaulttrue), so a non-default seed does not report a candidate as fixed.docs/testing.mdgets a "The Differential Fuzzing Sweep" section, anddocs/oracles.mdgets "Generated operands" (the candidate row form, seeds, replay and shrinking).Tests
dotnet testwith Docker: all 8 projects green, 1,693 tests. The integration project takes 15 s.VALUERANGES_FUZZ_SEED=7. The 2,000-row run finds no family beyond the three above.dotnet run tools/oracles.cs seeds intersect-tied-endand… seeds value-set-subsetboth printCAUGHT … → DifferentialFuzzParityTests. Both seeds fail the sweep for the planted reason: tied-endIntersectrows on every continuous type, and subset-predicate rows on every value set family.🤖 Generated with Claude Code