Fail, not skip, when a mock body flunks Kotlin's required-field validation

Merged
JE
4mo ago
+8-2

Closes the Kotlin conformance runner's silent-degradation hole (wave 1, rock B6): a mock body that fails kotlinx.serialization's required-field validation now FAILS the suite instead of quietly skipping.

The bug

The runner caught MissingFieldException and reported SKIP. Kotlin is the strictest fixture consumer — no other runner validates required fields at all — so this catch was the only place an under-specified fixture body could be detected, and it whispered: the test's coverage silently vanished and the suite still exited 0. Two real fixtures rode this path until #554 repaired them (the UploadsDownload metadata bodies), which is exactly how the hole hid — riders looked like clean SKIPs, not fixture bugs.

The fix

One clause: TestResult(passed = false, ...) instead of skipped = true, with the message unchanged (Mock body lacks required Kotlin model fields: ...). A malformed body is a fixture bug to repair against the canonical spec/fixtures/ shapes, not a runner limitation.

Kill test (deliberate malformed-required-field proof, verbatim)

A scratch-only fixture (never committed) with a GetProject body stripped to {"id": 1} — the Kotlin Project model requires status, created_at, updated_at, name, url, app_url.

Before the flip — rides the SKIP path, suite exits 0 (REAL_EXIT=0):

  SKIP: KILL TEST: mock body missing required Kotlin model fields
        Mock body lacks required Kotlin model fields: Fields [status, created_at, updated_at, name, url, app_url] are required for type with serial name 'com.basecamp.sdk.generated.models.Project', but they were missing at path: $

Passed: 121, Failed: 0, Skipped: 4, Total: 125

After the flip — same fixture, hard failure, suite exits nonzero (REAL_EXIT=2):

  FAIL: KILL TEST: mock body missing required Kotlin model fields
        Mock body lacks required Kotlin model fields: Fields [status, created_at, updated_at, name, url, app_url] are required for type with serial name 'com.basecamp.sdk.generated.models.Project', but they were missing at path: $

Passed: 121, Failed: 1, Skipped: 3, Total: 125

Real suite after the flip

No fixture rides the path anymore (#554 fixed the only two riders):

Passed: 121, Failed: 0, Skipped: 3, Total: 124

(REAL_EXIT=0; remaining skips: the link-header architectural case and the two B4 download-retry cases.)

No SPEC roster changes: the degradation was never rostered — it was invisible by construction, which is the point of this fix.


Summary by cubic

Fail the Kotlin conformance test when a mock body is missing required model fields instead of skipping it. This surfaces fixture bugs and prevents silent coverage loss.

  • Bug Fixes
    • Treat kotlinx.serialization MissingFieldException as FAIL in runTest (no longer SKIP).
    • Keep the same error message: “Mock body lacks required Kotlin model fields: ...”.
    • Suite now exits non-zero when such a fixture is present; current suite passes with no new failures.