Skip to content

test: sibling parity sweeps (wrapper vs primitive set, range vs one-element RangeSet, literal entry points) - #143

Merged
CaffeinatedCoder merged 2 commits into
mainfrom
test/sibling-parity-sweeps
Oct 18, 2026
Merged

CaffeinatedCoder merged 2 commits into
mainfrom
test/sibling-parity-sweeps

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #139

Problem

The claim-driven oracles check each promise where a document makes it, so they find a bug at one site and miss it at the sibling site that makes the same promise without saying so. The changelog shows that pattern repeatedly: IsAdjacentTo (6.2.1) → IsStrictlyLeftOf/Except (7.0.0) → RangeSet.Except(TRange) (8.0.0), the wrapper arities lagging their primitive set, and ==/!= untested on 18 of 20 set types. Nothing compared the siblings with each other.

Change

Three differential sweeps in test/CodoMetis.ValueRanges.Conventions.Tests/, one [DynamicData] row per discovered type. None asserts a ground truth; when two siblings disagree, one of them is the bug.

  • SetWrapperParityTests compares each primitive set with its wrapper arity closed over an identity element (Same<T>, SameText in IdentityWrappers.cs). Across the family's probes and extremes, it checks every operation, ParseValue/FormatValue, Parse/TryParse (string and span), ToString with each format and provider, the TypeConverter, JSON token kinds, each sibling reading the other's JSON, and a grid of array literals and JSON documents (quoted, padded, duplicated, out of order, empty, NULL, malformed). Each comparison wants the same value, or the same exception type.
  • RangeSetLiftParityTests compares each range with the one-element RangeSet holding it. It covers every predicate (set-set and set-range overloads), every operation (named method and operator), and every accessor, Merge, Complement, the literal and Contains(T), over the shape matrix plus bounds at the domain's minimum and maximum. That's about 378k checks per type.
  • LiteralEntryPointParityTests sends one literal through every entry point: Parse/TryParse (string and span), JSON, the TypeConverter and IConfiguration binding. It covers every range union and each sealed variant, every multirange (including its explicit IParsable implementation) and every value set. The result must be an equal value, or a refusal everywhere.

Supporting changes:

  • RangeSpecs.cs: the shape-matrix enumeration, embeddings and new domain extremes, moved out of DomainParityOracleTests. That test's behaviour is unchanged, and its seed is still caught.
  • StringOverloads.cs: under an IRangeFactory/IValueSetFactory constraint, TSet.Parse(string, …) binds to the span overload, because ISpanParsable hides IParsable in overload resolution. The sweeps call the string overloads through a helper constrained on IParsable<T> alone. The existing generic sweeps have the same blind spot, filed as Generic sweeps call the span overload when they mean Parse(string): ISpanParsable hides IParsable in overload resolution #142.
  • Microsoft.Extensions.Configuration and .Binder 10.0.12 added to the conventions project, for the binding entry point.
  • Registered in oracles.json. Named in the heldBy of J11, J13, J28, S09, M03 and M07. Described in docs/testing.md#the-sibling-parity-sweeps and docs/oracles.md#sibling-parity.

What they found

Tests

Each sweep has a seed it is shown to catch:

Seed Caught by
wrapper-integer-elements-written-as-strings SetWrapperParityTests (token kinds, cross-reads)
multirange-upper-inc-reads-lower-bound RangeSetLiftParityTests (11 of 11 rows). DomainParityOracleTests misses it
set-tryparse-reads-blank-as-empty LiteralEntryPointParityTests, SetWrapperParityTests. Missed until the string overloads were called through StringOverloads
  • dotnet test test/CodoMetis.ValueRanges.Conventions.Tests: 245 passed. The three sweeps take about 4 s altogether.
  • dotnet run tools/oracles.cs seeds: every seed caught, 47 (seed, oracle) pairs, Docker-backed ones included.

🤖 Generated with Claude Code

…ge and its one-element RangeSet, and the literal entry points

Three differential sweeps in the conventions project, one [DynamicData] row per discovered
type, that compare two sites which must agree instead of asserting a ground truth:

- SetWrapperParityTests: each primitive value set against its wrapper arity closed over an
  identity element (Same<T>, SameText): every operation, ParseValue/FormatValue, Parse and
  TryParse (string and span), ToString, the TypeConverter, JSON token kinds and cross-reads.
- RangeSetLiftParityTests: each range against the one-element RangeSet holding it, over the
  shape matrix (RangeSpecs, extracted from DomainParityOracleTests) plus the domain extremes.
- LiteralEntryPointParityTests: one literal through Parse/TryParse (string and span), JSON,
  the TypeConverter and IConfiguration binding, for unions, variants, multiranges and sets.

Generic code under an ISpanParsable-derived constraint binds TSet.Parse(string, ...) to the
span overload, so the sweeps reach the string overloads through StringOverloads (#142 for
the existing sweeps). Each sweep is registered in oracles.json with a seed it catches. The
disagreements are candidates: #141 (wrapper JSON element reads wider than the primitive's)
and #109 (IsUnboundedStart/End on (,) against its own multirange).

Closes #139

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/nodatime Affects CodoMetis.ValueRanges.NodaTime area/literals Parse, TryParse and formatting package/core Affects CodoMetis.ValueRanges labels Oct 18, 2026
Resolves the csproj (both sides added the configuration packages) and merges the
candidates and claims entries of both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/literals Parse, TryParse and formatting 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/core Affects CodoMetis.ValueRanges package/nodatime Affects CodoMetis.ValueRanges.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.

Sibling parity sweeps: wrapper arity vs primitive, range vs one-element RangeSet, literal entry points

1 participant