Repository navigation
test: clone-divergence sweep over the hand-copied type families - #145
Merged
Merged
Conversation
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]>
…ce-sweep-a285ad # Conflicts: # test/oracles/oracles.json
…ce-sweep-a285ad # Conflicts: # test/CodoMetis.ValueRanges.Conventions.Tests/CodoMetis.ValueRanges.Conventions.Tests.csproj
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 #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 eachSets/folder (core and NodaTime apart), the range unions in each library's root, the EFnew RangeTypeDefinition<…>(…)/new SetTypeDefinition<…>(…)registrations and theBridged<…>(…)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$STEMonly for shapes the family shares (ParseDate/ParseTime), soToStringinStringSetandTimeSpaninTimeRangeare 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 intest/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 clonesprints every divergence with its waiver status and the JSON line to paste for a new one. The engine is compiled into the tool throughtools/Directory.Build.props(a file-based app can name packages and properties but not a second source file; it does importDirectory.Build.props), so the tool and the test cannot disagree.oracles.json; new seedsibling-drops-input-function-trim.patch(one temporal set drops itsLiteralWhiteSpace.TrimAsInputFunctioncall — the shape of the 9.1.0 fix), and the existingvariant-without-type-converter.patchnow names the sweep too.docs/oracles.md,AGENTS.md,CONTRIBUTING.mdandtest/oracles/README.mddescribe 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-ddfor a date,RequireIsowhere a year-month cannot convert, discrete ranges canonicalizing where continuous ones store,InstantRange's positional variants, the temporal EF bridges parsing their pinned format withParseExact. No sibling lags a fix today, so no bug issue and nocandidates.jsonentry came out of it. One latent sibling-site risk is recorded on #129: theGuidSet<>EF bridge parses withGuid.Parsedirectly rather than throughGuidSet.ParseValue, so theuuid_ingrammar 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 CountinInt32Setandstring? formatinStringSet).Tests
dotnet test test/CodoMetis.ValueRanges.Conventions.Tests -c Release: 169 passed (5 new inCloneDivergenceTests).dotnet run tools/oracles.cs clones: 61 divergences, 61 waived, 0 unwaived, 0 stale.dotnet run tools/oracles.cs seeds sibling-drops: CAUGHT byCloneDivergenceTests(1 of 5 fail:EveryDivergence_IsWaivedWithAReason) and bySetElementWhiteSpaceContractTests.dotnet run tools/oracles.cs seeds variant-without-type-converter: CAUGHT byTypeConverterContractTestsand byCloneDivergenceTests(TimeRange · Finite.<type> · lone body, the one core range variant without the attribute its six siblings carry).Shares
oracles.json,seeds/,docs/oracles.mdwith the sibling-parity PR from #139; this PR only appends to each.🤖 Generated with Claude Code