test(parsing): #204 CsvBase strict contract — required-absent throws HeaderValidationException - #488
Merged
Merged
Conversation
…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
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>
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.
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
EntityClassMapRegressionTestsand #485FallacyClassMapRegressionTests— 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
CsvBaseconfiguration (LoggerMissingFieldFound+ defaultHeaderValidated), not a parallel copy:HeaderValidationException(the never-asserted inverse half — the headline guard)nullMissingFieldFoundnon-fatal Logger override → no throw; missing bound field resolves to empty string"", not nullSubtle 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 greendotnet 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)Dispatch
4rkh1ssecondaire (#204 fragile zone —CsvBaseMissingFieldFoundvsHeaderValidated, new test file only; no config zones touched).🤖 Worker po-2024