Skip to content

test: clone-divergence sweep over the hand-copied type families - #145

Merged
CaffeinatedCoder merged 3 commits into
mainfrom
claude/clone-divergence-sweep-a285ad
Oct 18, 2026
Merged

CaffeinatedCoder merged 3 commits into
mainfrom
claude/clone-divergence-sweep-a285ad

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #140

Problem

Bugs at one API site recur at its hand-copied siblings, and this repository's history agrees: each NodaTime set file has been touched by five or six fix commits, the wrapper arities have repeatedly lagged their primitive set, and the 9.1.0 whitespace fix landed as two commits — range bounds, then 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.

Change

  • test/oracles/CloneSweep.cs — the clone-divergence sweep. Families are discovered, never listed: the value sets and wrapper arities under each Sets/ folder (core and NodaTime apart), the range unions in each library's root, the EF new RangeTypeDefinition<…>(…) / new SetTypeDefinition<…>(…) registrations and the Bridged<…>(…) wrapper-family entries, and each primitive set paired with its own arity. Every member is normalized — the type's name, element type and backing primitive become $TYPE/$T/$P; the type's stem inside an identifier becomes $STEM only for shapes the family shares (ParseDate/ParseTime), so ToString in StringSet and TimeSpan in TimeRange are left alone; a keyword alias (int, string) is read every way and the reading that agrees with the most siblings is compared; comments and formatting are stripped — and compared with the family's consensus under three rules: missing (present in all but one or two siblings), extra (only one has it), lone body (no sibling shares it while two or more share a near-identical one).
  • CloneDivergenceTests (conventions project) fails CI on any divergence not waived with a reason in test/oracles/clone-waivers.json, on a waiver without a reason, on a stale waiver, and on a family discovered with fewer siblings than known — so the sweep cannot pass vacuously. Holds from the source text; the shipping code is not run.
  • dotnet run tools/oracles.cs clones prints every divergence with its waiver status and the JSON line to paste for a new one. The engine is compiled into the tool through tools/Directory.Build.props (a file-based app can name packages and properties but not a second source file; it does import Directory.Build.props), so the tool and the test cannot disagree.
  • Registered in oracles.json; new seed sibling-drops-input-function-trim.patch (one temporal set drops its LiteralWhiteSpace.TrimAsInputFunction call — the shape of the 9.1.0 fix), and the existing variant-without-type-converter.patch now names the sweep too. docs/oracles.md, AGENTS.md, CONTRIBUTING.md and test/oracles/README.md describe it.

First run

61 divergences in 10 families, every one a deliberate per-type difference, now waived with its reason: the ordinal comparer of StringSet, yyyy-MM-dd for a date, RequireIso where a year-month cannot convert, discrete ranges canonicalizing where continuous ones store, InstantRange's positional variants, the temporal EF bridges parsing their pinned format with ParseExact. No sibling lags a fix today, so no bug issue and no candidates.json entry came out of it. One latent sibling-site risk is recorded on #129: the GuidSet<> EF bridge parses with Guid.Parse directly rather than through GuidSet.ParseValue, so the uuid_in grammar fix must reach that third site; its waiver points there and goes stale once it does.

Calibration history, for the record: the first cut reported 111 divergences; stem-shape acceptance, alias resolution against the siblings, body-only similarity and resolving the NodaTime registrations' positional parameters brought it to 61 with nothing real hidden (the alias noise was int Count in Int32Set and string? format in StringSet).

Tests

  • dotnet test test/CodoMetis.ValueRanges.Conventions.Tests -c Release: 169 passed (5 new in CloneDivergenceTests).
  • dotnet run tools/oracles.cs clones: 61 divergences, 61 waived, 0 unwaived, 0 stale.
  • dotnet run tools/oracles.cs seeds sibling-drops: CAUGHT by CloneDivergenceTests (1 of 5 fail: EveryDivergence_IsWaivedWithAReason) and by SetElementWhiteSpaceContractTests.
  • dotnet run tools/oracles.cs seeds variant-without-type-converter: CAUGHT by TypeConverterContractTests and by CloneDivergenceTests (TimeRange · Finite.<type> · lone body, the one core range variant without the attribute its six siblings carry).

Shares oracles.json, seeds/, docs/oracles.md with the sibling-parity PR from #139; this PR only appends to each.

🤖 Generated with Claude Code

Bugs at one API site recur at its hand-copied siblings, and the history agrees: each
NodaTime set file carries five or six fix commits, the wrapper arities have repeatedly
lagged their primitive set, and the 9.1.0 whitespace fix landed as two commits because
the second site was found only after the first. The claim-driven oracles hold a promise
per type and cannot see that one sibling lacks a line the others have.

test/oracles/CloneSweep.cs reads the source instead. Families are discovered: the value
sets and wrapper arities under each Sets/ folder, the range unions in each library's
root, the EF RangeTypeDefinition/SetTypeDefinition registrations and the Bridged
wrapper-family entries, and each primitive set paired with its own arity. Every member
is normalized (type name, element, backing primitive and shared stem shapes become
placeholders; keyword aliases are read every way and resolved against the siblings;
comments and formatting stripped) and compared with the family's consensus under three
rules: missing in all but one or two siblings, extra to one, or a lone body near one
the others share.

One engine, two consumers: CloneDivergenceTests (conventions project) fails CI on any
divergence not waived with a reason in test/oracles/clone-waivers.json and on a stale
waiver; `dotnet run tools/oracles.cs clones` prints every divergence with its status,
compiled from the same file through tools/Directory.Build.props. The first run finds
61 divergences, every one a deliberate per-type difference, now waived with its reason;
no sibling lags a fix today. The GuidSet<> EF bridge parsing with Guid.Parse directly
is noted on #129 so the uuid_in fix reaches that third site.

Registered in oracles.json with a new seed (one temporal set drops its
TrimAsInputFunction call, the shape of the 9.1.0 fix) and named by the existing
variant-without-type-converter seed; both proven caught with `oracles.cs seeds`.

Closes #140

Co-Authored-By: Claude Fable 5.1 <[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/value-sets Value set families and wrapper arities package/nodatime Affects CodoMetis.ValueRanges.NodaTime package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/core Affects CodoMetis.ValueRanges package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime labels Oct 18, 2026
…ce-sweep-a285ad

# Conflicts:
#	test/oracles/oracles.json
…ce-sweep-a285ad

# Conflicts:
#	test/CodoMetis.ValueRanges.Conventions.Tests/CodoMetis.ValueRanges.Conventions.Tests.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ranges Range unions, variants and the shape engines area/value-sets Value set families and wrapper arities package/core Affects CodoMetis.ValueRanges package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime 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.

Clone-divergence sweep over the hand-copied type families

1 participant