Skip to content

test(parsing): #204 CsvBase strict contract — required-absent throws HeaderValidationException - #488

Merged
jsboige merged 1 commit into
masterfrom
test/204-csvbase-strict-contract
Jun 15, 2026
Merged

test(parsing): #204 CsvBase strict contract — required-absent throws HeaderValidationException#488
jsboige merged 1 commit into
masterfrom
test/204-csvbase-strict-contract

Conversation

@jsboige

@jsboige jsboige commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

What

New additive test file pinning the bidirectional CSV load contract of the production CsvBase<T,TMap>.LoadFromContent (CsvHelper 31.0.4).

The existing ClassMap regression suites — #476 EntityClassMapRegressionTests and #485 FallacyClassMapRegressionTests — covered only one direction of the contract ("Optional column absent → does not throw"). The inverse half — a non-Optional column absent from the header → throws — was never asserted. That inverse is the strict guard that would catch a dropped .Optional() on a currently-required column at load time, instead of silently zeroing the field (the #216/#477 localization fragility class).

Contract halves (synthetic ContractEntity, decoupled from evolving domain ClassMaps)

Exercises the real CsvBase configuration (Logger MissingFieldFound + default HeaderValidated), not a parallel copy:

# Test Pins
1 required column absent from header HeaderValidationException (the never-asserted inverse half — the headline guard)
2 Optional column absent from header → no throw, property null
3 short data row MissingFieldFound non-fatal Logger override → no throw; missing bound field resolves to empty string "", not null

Subtle characterization detail pinned by (3): a field bound to a header slot but absent from a given row body resolves to empty string — distinct from (2), where an Optional column absent from the header yields null (the property is never bound). This distinction is real and previously undocumented.

Verification

  • dotnet test (filtered): 3/3 green
  • dotnet test (full suite): 251 passed / 0 failed / 5 skipped (no regression; the 5 skips are the known Playwright/Freeplane visual tests requiring an interactive session)
  • Additive only: no production code or existing test modified (1 file, +133 lines)

Dispatch

4rkh1s secondaire (#204 fragile zone — CsvBase MissingFieldFound vs HeaderValidated, new test file only; no config zones touched).

🤖 Worker po-2024

…HeaderValidationException

New additive test file pinning the bidirectional CSV load contract of the
production CsvBase<T,TMap>.LoadFromContent (CsvHelper 31.0.4). The existing
ClassMap regression suites (#476 EntityClassMapRegressionTests, #485
FallacyClassMapRegressionTests) covered only ONE direction of the contract
("Optional absent -> no throw"). This pins the inverse half + isolation.

Contract halves via a synthetic ContractEntity (decoupled from evolving
domain ClassMaps), exercising the REAL CsvBase configuration:
- required (non-Optional) column absent from header -> HeaderValidationException.
  The guard that catches a dropped .Optional() at load time instead of silently
  zeroing a field (the #216/#477 localization fragility class).
- Optional column absent from header -> no throw, property null.
- short data row -> MissingFieldFound (non-fatal Logger override) -> no throw;
  the missing bound field resolves to EMPTY STRING, not null (distinct from the
  Optional-absent-from-header case which yields null).

3 tests, all green. Full suite 251 passed / 0 failed / 5 skipped (no regression).
Additive only: no production code or existing test modified.

Dispatch 4rkh1s secondaire (#204 fragile zone, new test file).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jsboige
jsboige merged commit 4ac52e2 into master Jun 15, 2026
3 checks passed
@jsboige
jsboige deleted the test/204-csvbase-strict-contract branch June 15, 2026 23:08
jsboige added a commit that referenced this pull request Jun 16, 2026
#491)

Pin the two fragile zones of the DocumentLocalization mechanism that
existing coverage (MmGeneratorTests) missed:

1. Ordering contract (headline). The family-hierarchy DocumentLocalization in
   AssetConverterConfig carries the documented comment "Order: most specific
   first (Soussousfamille > SousFamille > Famille) to avoid partial matches"
   because DoStaticConversions is a naive substring Replace and "Famille" is a
   substring of "SousFamille". No test pinned this contract. New theory runs the
   REAL family-hierarchy entry (located by TargetProperties, not list index) on a
   template carrying all three family keywords, for all 7 target langs, asserting
   each resolves to its distinct localized property with no "SousFamily"
   contamination — the corruption signature of a broken ordering. Same substring
   fragility class as the card-set mapping (#477) and CSV contract (#488).

2. 8-language release scope. The existing MindMapLocalization theory covers only
   en/ru/pt; the release targets 8 langs and the config declares 7 target langs
   (en/ru/pt/es/ar/fa/zh). New theory closes the gap for es/ar/fa/zh across every
   Fallacy text + family expression, so a dropped conversion surfaces immediately.

Additive only: 1 new file (MindMapLocalizationRegressionTests.cs), 11 tests,
zero production code and zero existing test modified.

Verified: 11/11 new tests green; full suite 270 passed / 0 failed / 5 skipped.

Co-authored-by: Your <your.email@example.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant