Skip to content

test: entry point × culture × type probe sweeps (route B, step 2) - #125

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
test/culture-entry-point-probe
Oct 17, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
test/culture-entry-point-probe

Conversation

@CaffeinatedCoder

@CaffeinatedCoder CaffeinatedCoder commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #124

Problem

test/oracles/axes.md listed four pairs that no test varied. The literal is a wire format with no culture (J04, J05, J13, J16), but the existing culture sweeps each held only part of that:

  • LiteralCultureContractTests varies the current culture for ToString only.
  • LiteralProviderContractTests varies the provider handed to Parse, and leaves the current culture as the machine set it.
  • No test sent a request culture through a host, bound every type from configuration, or bound a variant-typed or nullable parameter through a host.

So a parser that read CultureInfo.CurrentCulture itself passed on any CI machine set to the invariant culture. #116 was one cell of the missing product, found once and not kept.

Change

  • CultureEntryPointProbeTests (conventions project): one [DynamicData] row per discovered type (52 rows). Each type is tried as the union and as the sealed variant, through 12 read and 5 write entry points that need no host, under de-DE, sv-SE, fa-IR and th-TH as the current culture:

    • Parse and TryParse, string and span, with a null provider and with the current culture
    • TypeDescriptor from and to text, with a null and the current culture
    • IConfiguration binding
    • JSON value, and JSON dictionary key for ranges
    • interpolation and string.Format

    The reference is read and written under the invariant culture before any culture is switched. The project gains Microsoft.Extensions.Configuration and .Binder (10.0.12).

  • HostCultureProbeTests (AspNetCore project): one TestServer serving 107 declared types (every union, its 5 variants, every RangeSet, every set type). Each type has a minimal-API route group and a closed ProbeController<T>. Each is bound from a query, a nullable query, a route value, a form field and a JSON body, under four request cultures set by UseRequestLocalization.

    • A valid value must answer 200 with the right runtime type and the same JSON value.
    • A malformed literal, or a literal of another shape for a variant, must answer 400.
    • Each handler echoes the culture it ran under, so a culture that never arrived fails instead of passing vacuously.
    • The project now references the NodaTime package and links RangeProbes, SetProbes, WrapperElements, Reflect and Candidates.cs. SetProbes' two crefs became <c> so the file compiles in both projects.
  • Oracle machinery:

    • Both classes are registered in oracles.json and added to the heldBy of J04, J05, J13, J15, J16 and J32.
    • New seed parser-reads-the-current-culture.patch.
    • axes.md moves entry point × culture × type, current culture × JSON, host × request culture, configuration × every type and host × variant-typed parameter into "Varied by".
    • A paragraph each in docs/oracles.md (route B) and docs/testing.md, and a line in AGENTS.md (AspNetCore project).
  • Finding: only Minimal API binds a variant-typed parameter as null for a valid literal and answers 200 #116, measured wider than filed (comment on Minimal API binds a variant-typed parameter as null for a valid literal and answers 200 #116). Every variant of every range type, bound by a minimal API through TryParse from a query, nullable query, route value or form field, answers 200 with null, for the right shape and for another shape alike. That is 160 requests per range type. It is registered as 11 candidates (one per range type, row <Type> variant minimal TryParse ), scoped so the JSON-body and MVC cells of the same variants stay held. No defect is fixed here.

Tests

  • dotnet test is green in all eight projects, integration included (Docker on).

  • Rows run: 52 + 52, plus a discovery floor in each class. The conventions sweep makes ~10,300 checks in 0.3 s; the host sweep sends ~12,400 requests in ~3 s.

  • dotnet run tools/oracles.cs seeds parser-reads-the-current-culture:

    • CAUGHT → CultureEntryPointProbeTests: 10 of 53 tests fail
    • CAUGHT → HostCultureProbeTests: 10 of 53 tests fail

    The failures are for the defect: -1.5 is refused under de-DE, and the host answers 400 to a valid literal.

  • dotnet run tools/oracles.cs status: 32 oracles, 33 seeds, none without a seed; 25 candidates, none without an issue. Only the two AOT claims A02 and A03 are unheld, as before this PR.

  • Expect a rebase against route B step 3 (the literal corpus × entry point sweep), which also touches oracles.json, claims.json, docs/oracles.md and docs/testing.md.

Bug issues this sweep would have caught

I went through all 16 issues labelled bug, open and closed, and checked each against the two probe classes.

🤖 Generated with Claude Code

CultureEntryPointProbeTests (conventions) reads and writes every discovered
range, multirange and set type, as union and sealed variant, through Parse,
TryParse, TypeDescriptor, configuration binding, JSON and interpolation under
de-DE, sv-SE, fa-IR and th-TH as the current culture, against the invariant
culture's reading. HostCultureProbeTests (AspNetCore) binds every type from a
query, nullable query, route value, form field and JSON body through MVC and
a minimal API under four request cultures set by RequestLocalization.

Both are registered in oracles.json, named in the heldBy of J04, J05, J13,
J15, J16 and J32, and seeded with parser-reads-the-current-culture. The only
disagreement is #116, measured wider than filed: every variant-typed
minimal-API parameter bound through TryParse answers 200 with null, for the
right shape and another shape alike; registered as one candidate per range
type. axes.md moves the four pairs into "Varied by".

Closes #124

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added tests Adds or changes tests only (oracles, harnesses); no library code package/nodatime Affects CodoMetis.ValueRanges.NodaTime area/json System.Text.Json and TypeConverter wire forms area/literals Parse, TryParse and formatting package/core Affects CodoMetis.ValueRanges labels Oct 17, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 86a59a9 into main Oct 17, 2026
@CaffeinatedCoder
CaffeinatedCoder deleted the test/culture-entry-point-probe branch October 17, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/json System.Text.Json and TypeConverter wire forms area/literals Parse, TryParse and formatting 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.

Route B, step 2: entry point × culture × type probe sweep

1 participant