Skip to content

test: cover Rust error payload generation - #157

Merged
adamcavendish merged 1 commit into
mainfrom
adamcavendish/rust-error-generation-coverage
Oct 19, 2026
Merged

adamcavendish merged 1 commit into
mainfrom
adamcavendish/rust-error-generation-coverage

Conversation

@adamcavendish

@adamcavendish adamcavendish commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow up #156 with six tests covering shared Rust error generation through the public CodeGenerator::generate boundary.

  • Pin exact error-enum output for arrays, nullable arrays, maps, primitive and model aliases, long map payloads, bodyless errors, and JSON/text/binary payloads across reqwest, ureq, and aioduct.
  • Exercise nested nullable/alias combinations directly from IR and verify a real sigil-stitch failure returns GeneratorError::Emission with API and original source context instead of panicking.
  • Compile the new fixture's generated clients for all three Rust backends.

Coverage

Paired cargo llvm-cov runs used the library tests and the three existing Rust golden suites; the second run additionally included rust_error_generation.

Shared emitter Before After
src/generators/rust/common/emit_api.rs line coverage 1043/1144 1061/1144
Percentage 91.17% 92.74%

These are scoped line-coverage measurements, not repository-wide or value-weighted coverage percentages.

Boundaries

  • Tests and fixture only: no production behavior, dependencies, existing goldens, or release versions change.
  • Failure propagation uses deliberately invalid lowered IR, not a test-only hook or a claim that valid OpenAPI input should be rejected.
  • New generated-client checks prove compilation, not live HTTP decoding of every composite payload.
  • An existing OAS 3.0 lowering issue drops nullable within map values. That cross-language issue remains outside this PR; the direct-IR cases independently protect nested-nullable generator behavior.

- Pin composite payload types, aliases, and media overrides through the public
  generators for reqwest, ureq, and aioduct.
- Verify invalid lowered payloads preserve contextual emission errors without
  adding test-only production hooks.
- Compile generated clients for the new payload fixture across all Rust backends.
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adamcavendish
adamcavendish merged commit fac58c2 into main Oct 19, 2026
25 checks passed
@adamcavendish
adamcavendish deleted the adamcavendish/rust-error-generation-coverage branch October 19, 2026 07:26
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