Skip to content

Clone-divergence sweep over the hand-copied type families #140

Closed

Description

@CaffeinatedCoder

Why

Bugs at one API site recur at its hand-copied siblings, and the history here agrees: each NodaTime set file has been touched by five or six fix commits, wrapper arities repeatedly lag their primitive set, and the 9.1.0 whitespace fix landed as two commits — one for range bounds, one for set elements — because the second site was found only after the first was fixed. The claim-driven oracles hold a documented promise per type; none of them can notice that one sibling lacks a line the other nine have.

A normalized diff across a family is a cheap candidate generator for exactly that class of defect.

What

A clone-divergence sweep over the hand-copied type families in src/:

  • the primitive value sets and their wrapper arities under src/CodoMetis.ValueRanges/Sets/
  • the five NodaTime sets and arities under src/CodoMetis.ValueRanges.NodaTime/Sets/
  • the per-type range unions (Int32Range.cs … DateTimeOffsetRange.cs, and the NodaTime ranges)
  • the EF-side per-type definitions (new RangeTypeDefinition<…>(…) / new SetTypeDefinition<…>(…) registrations and the wrapper-family bridge entries)
  • each primitive set paired with its own arity

For each family, every member is normalized (the type's own name, its stem inside identifiers, its element type, its store type and format constants become placeholders; doc comments and formatting are stripped) and compared with the family's consensus member by member: a member present in all but one or two siblings, a member only one sibling has, and a body that no sibling shares while a near-identical body is shared by several are each a divergence.

Shipped as:

  1. dotnet run tools/oracles.cs clones — prints every divergence with its waiver status
  2. CloneDivergenceTests in the conventions project — fails CI on any divergence not listed in test/oracles/clone-waivers.json with a reason, and on a stale waiver; holds without running the shipping code
  3. a registration in oracles.json and a seed patch that removes one sibling's LiteralWhiteSpace.TrimAsInputFunction call (the shape of the 9.1.0 whitespace fix), proven caught with dotnet run tools/oracles.cs seeds
  4. a section in docs/oracles.md

Every real divergence the first run finds gets its own bug issue and a candidates.json entry; nothing beyond the sweep itself is fixed in this change.

Done when

The sweep runs, every current divergence is either waived with a reason or filed as a bug, the seed is proven, the doc describes the sweep, and the PR closes this issue.

Activity

  1. added
    testsAdds or changes tests only (oracles, harnesses); no library code
    area/rangesRange unions, variants and the shape engines
    area/value-setsValue set families and wrapper arities
    package/nodatimeAffects CodoMetis.ValueRanges.NodaTime
    package/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQL
    package/coreAffects CodoMetis.ValueRanges
    on Oct 17, 2026
  2. CaffeinatedCoder commented on Oct 18, 2026

    @CaffeinatedCoder
    OwnerAuthor

    First run, measured on main (3ecfa10): 61 divergences in 10 families (core sets 9, core arities 7, NodaTime sets 6, NodaTime arities 4, core ranges 8, NodaTime ranges 21, EF range definitions 0, EF set definitions 0, EF wrapper bridges 6, primitive vs arity 0). Every one is a deliberate per-type difference and is waived with its reason in test/oracles/clone-waivers.json; no sibling lags a fix today, so no bug issue and no candidates.json entry came out of this run. One latent sibling-site risk is recorded on #129 (the GuidSet<> EF bridge parses with Guid.Parse directly). Two seeds prove the sweep: the new sibling-drops-input-function-trim.patch and the existing variant-without-type-converter.patch, both CAUGHT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/rangesRange unions, variants and the shape enginesarea/value-setsValue set families and wrapper aritiespackage/coreAffects CodoMetis.ValueRangespackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQLpackage/efcore-nodatimeAffects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTimepackage/nodatimeAffects CodoMetis.ValueRanges.NodaTimetestsAdds or changes tests only (oracles, harnesses); no library code

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions