Use Realistic Parser Samples

TEST-USE-REALISTIC-PARSER-SAMPLES

Summary

Test parsers with representative input, malformed cases, and safe degradation examples. Real samples catch compatibility failures, but fixtures should be minimized and scrubbed.

Rule

Use realistic samples and safe degradation cases in parser tests.

Why

Parser tests built only from idealized examples miss real whitespace, ordering, partial data, unknown fields, legacy formats, invalid input, and safe degradation behavior. Realistic samples keep compatibility and error behavior grounded in the inputs users actually have.

Helps

  • Catches parsing regressions and documents how malformed or unexpected input is handled.

Limits

Do not copy sensitive or huge production data into fixtures. Minimize realistic samples to the fields and failure modes that matter.

Agent Instruction

Use realistic samples and safe degradation cases in parser tests because parser tests built only from
idealized examples miss real whitespace, ordering, partial data, unknown fields, legacy formats,
invalid input, and safe degradation behavior.

Mechanisms

Supported by curated fixtures, golden files, malformed-input cases, round-trip tests, minimized bug samples, and compatibility fixture inventories.

References