Skip to content

fix(error): retain structured type mismatch facts - #1049

Merged
LunaStev merged 2 commits into
wavefnd:masterfrom
erenbati:fix/typed-diagnostic-facts-1024
Oct 25, 2026
Merged

LunaStev merged 2 commits into
wavefnd:masterfrom
erenbati:fix/typed-diagnostic-facts-1024

Conversation

@erenbati

Copy link
Copy Markdown
Contributor

Closes #1024

Summary

  • Preserve the supplied expected and found strings in the existing structured fields of WaveError::type_mismatch by chaining the established with_expected and with_found builders.
  • Keep the current human message, label, kind, file/line/column, span, and optional diagnostic code unchanged. The JSON schema already contains both fields; no schema change is needed.
  • Add two focused Rust integration tests to front/error/tests/diagnostic_rendering.rs: constructor facts plus message/span/code preservation, and an explicit text-only semantic-error boundary.

Motivation

The shared type-mismatch helper already retained the type strings in WaveErrorKind::TypeMismatch and the human message, but serialized JSON expected: [] and found: null. The new test verifies a single expected entry and a found string from the constructor. It does not claim to repair semantic producers that create generic diagnostics without structured type facts; those remain outside this scoped fix.

Target and compatibility impact

Only structured diagnostic facts on errors created through WaveError::type_mismatch. No language behavior, runtime ABI, command-line flag, JSON field name, existing text, or std compatibility revision changes.

Validation

  • An offline source-contract check verified RED before the implementation (no builder calls) and GREEN afterward (both calls present in the targeted method); this is not an executable Rust test.
  • Added Rust integration tests for JSON expected/found values and unchanged code, message, label, source span, and the still-text-only semantic boundary.
  • git diff --check passed and only front/error/src/error.rs plus its existing test file changed.
  • DCO Signed-off-by trailer verified in commit 5c2d1a66d663efd60f8e7657a45f9bf554df7591.
  • Local Rust tests / cargo fmt were not run: Cargo and Rust toolchains are absent on this Windows machine, and Docker Desktop is not running. This draft PR requests the project's GitHub CI as the compilation, test, and formatting authority. I will address any related CI findings before marking ready for review.

Checklist

  • Commit includes required DCO Signed-off-by.
  • Tests added for new behavior and documented uncovered producer paths.
  • Existing human diagnostic output and schema retained by design.
  • No compiler/std licensing boundary changes.

AI assistance

AI assistance was used to inspect the existing constructor and rendering code and prepare the minimal patch and focused tests. The contributor is responsible for reviewing the changes and following up on CI.

@erenbati
erenbati marked this pull request as ready for review October 25, 2026 08:02
@LunaStev
LunaStev merged commit 3307308 into wavefnd:master Oct 25, 2026
50 checks passed
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.

Preserve expected and found values in constructed type-mismatch diagnostics

2 participants