Skip to content

test: hand-written axes list and the JSON options probe sweep (route B, step 1) - #122

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
test/json-options-probe
Oct 17, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
test/json-options-probe

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #121

Problem

The oracle machinery (#54) holds the library to its documents and lists what the API offers, but nothing varies the settings a consumer combines: the declared type of a property, the host's JsonSerializerOptions, the culture, the entry point. #114, #116 and #117 were each found by one such combination, as a one-off probe that was not kept. #105 records two routes to consumer probing; this is the first step of route B (the BLite way): no tooling, a hand-written axes list and probe classes as ordinary MSTest sweeps.

Change

  • test/oracles/axes.md (new, hand-written): one section per surface family of claims.json — literals and JSON; TypeConverter, configuration and web binding; EF Core; hosting and AOT. Each axis lists its values, the test that already varies it, and the pairs no test varies yet, which are the next probe classes (entry point × culture × type, where Minimal API binds a variant-typed parameter as null for a valid literal and answers 200 #116 is one cell; literal corpus × entry point against psql, where An inverted range literal parses as empty on every entry point; PostgreSQL rejects it #114 and Decimal text beyond 28 significant digits is rounded silently when a literal or JSON array is read #115 are cells).
  • JsonOptionsProbeTests (conventions project, new): one [DynamicData] row per discovered range union, multirange and value set type (52 rows). Each row runs every value of the type × how it is declared {union, sealed variant, IRange<T> / shape interface / IValueSet<T>, object and List<object>, property of a record, dictionary value} × JsonSerializerOptions {default, camelCase, snake_case, ReferenceHandler.Preserve, a source-generated context, NumberHandling.AllowReadingFromString}. The oracle is the document's promise: the wire form is the type's literal (a set's array), the round trip is the same value, a null property stays null, a read into an interface is the documented NotSupportedException, and under AllowReadingFromString every number may arrive quoted. Disagreements are lines and end in Candidates.Verdict. 13,560 checks in about 400 ms.
  • JsonOptionsProbeContext (new): the source-generated context listing every union, variant, multirange, set and element type. A discovery test fails naming the [JsonSerializable] line to add when a type is missing, since a context cannot discover types.
  • Candidates.Verdict gains an optional rowPrefix: a per-row sweep passes its row's label, so a candidate of another row is neither matched nor judged "fixed" there. Additive; every existing call is unchanged.
  • OracleCatalogueTests now also requires a *ProbeTests class that holds a claim to be registered in oracles.json, so a probe cannot exist without a seed.
  • Catalogue: registered in oracles.json; added to the heldBy of J16, J18, J19 and J21; seed interface-without-json-converter.patch (drops the [JsonConverter] on IValueSet<T>, the pre-9.0.0 defect).
  • Docs: docs/oracles.md gets the axes.md section, the probe-class rules and a "Write a probe" step; docs/testing.md and test/oracles/README.md mention the probe sweeps. No consumer-facing document changed, so no claim quote moved.

Tests

  • dotnet test test/CodoMetis.ValueRanges.Conventions.Tests: 164 passed (54 of them the new class).
  • dotnet run tools/oracles.cs seeds interface-without-json-converter: CAUGHT → JsonOptionsProbeTests: 30 of 54 tests fail, CAUGHT → JsonDefaultContractTests: 1 of 5 tests fail.
  • dotnet run tools/oracles.cs status: 30 oracles, 0 without a seed; the two unheld claims are still A02 and A03 (Native AOT, smoke-test only).
  • dotnet build of the whole solution is clean under warnings-as-errors.
  • Findings: none. The one group of lines the first run produced (List<object> under ReferenceHandler.Preserve wrote {"$id":"1","$values":[…]}) is System.Text.Json's form for the list itself, not the value's, so it was a harness mistake and the check now reads the $values array. No candidate was registered and no bug issue opened.

🤖 Generated with Claude Code

…B, step 1)

The first step of route B from #105: no tooling, a hand-written list of what a consumer
varies and probe classes as ordinary MSTest sweeps over the product.

- test/oracles/axes.md: one section per surface family of claims.json (literals and JSON;
  TypeConverter, configuration and web binding; EF Core; hosting and AOT), each axis with its
  values, the test that already varies it, and the pairs no test varies yet.
- JsonOptionsProbeTests (conventions project): every discovered range, multirange and value set
  type, one [DynamicData] row each, x {union, sealed variant, interface, object, record property,
  dictionary value} x {default, camelCase, snake_case, ReferenceHandler.Preserve, a
  source-generated context, NumberHandling.AllowReadingFromString}. The oracle is the documented
  wire form and round trip, or the documented refusal. 13,560 checks in under a second; no
  disagreement found.
- JsonOptionsProbeContext lists every type for the source-generated option set; a discovery test
  fails naming the attribute line to add when a type is missing.
- Candidates.Verdict gains rowPrefix, so a per-row sweep scopes "candidate fixed" to its row.
- OracleCatalogueTests requires a *ProbeTests class that holds a claim to be registered.
- Registered in oracles.json; held claims J16, J18, J19, J21; seed
  interface-without-json-converter (IValueSet<T> without its [JsonConverter]), caught by
  JsonOptionsProbeTests and JsonDefaultContractTests.

Co-Authored-By: Claude Fable 5.1 <[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 package/core Affects CodoMetis.ValueRanges labels Oct 17, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 3ecfa10 into main Oct 17, 2026
@CaffeinatedCoder
CaffeinatedCoder deleted the test/json-options-probe branch October 17, 2026 22:46
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 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 1: hand-written axes list and the JSON options probe sweep

1 participant