Skip to content

feat(core): add structured error diagnostics - #340

Merged
justin13888 merged 2 commits into
masterfrom
feat/254-error-diagnostic-context
Aug 6, 2026
Merged

feat(core): add structured error diagnostics#340
justin13888 merged 2 commits into
masterfrom
feat/254-error-diagnostic-context

Conversation

@justin13888

@justin13888 justin13888 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add stable ErrorKind classification and an owned Diagnostic context wrapper while preserving the existing allocation-free Error variants
  • propagate crate origin, parser-relative byte offsets, and dynamic details through the active producer chain; classify fallback behavior by kind and preserve accepted backend errors unchanged
  • document the Rust and planned FFI diagnostic contract, including compatibility and traversal semantics

Top-down scope

  • Public foundation: gamut-core::Error, ErrorKind, and Diagnostic, re-exported through gamut::core
  • Shared producers: core, color, tonemap, IFD, ISOBMFF, RIFF, and XMP
  • Format producers: AV1, AVIF, DNG, HEIC, JPEG, JXL, PNG, TIFF, and WebP
  • Consumers: semantic fallback checks and codec-ABI adapters now use stable classification while retaining exact external backend failures
  • Boundary documentation: the FFI design/header/status mapping describes kind plus contextual text without expanding the current FFI implementation

AV2 and VVC remain declaration-only stubs. The dependency-free codec ABI and separate metadata error domains stay unchanged except where XMP converts into the core error type. CLI and WASM behavior are outside this change.

Compatibility

The three legacy variants remain source-compatible and allocation-free. Structured context is additive through the non-exhaustive Context variant; decorators are first-write-wins and preserve the source chain.

Validation

  • mise run fmt-check
  • mise run lint
  • mise run test
  • mise run coverage — 97.22% lines
  • mise run check-msrv
  • mise run check-ffi
  • mise run check-ffi-features
  • mise run check-ffi-header
  • mise run check-ffi-seams
  • mise run check-release-deps
  • mise run check-commits
  • targeted mutation rechecks caught every previously missed or timed-out coordinate, including the hardened CCITT non-progress guard
  • GitHub incremental mutation gate passed the complete PR diff

Closes #254

@justin13888
justin13888 merged commit 4472974 into master Aug 6, 2026
5 checks passed
@justin13888
justin13888 deleted the feat/254-error-diagnostic-context branch August 14, 2026 21:34
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.

gamut-core: structured diagnostic context in Error

1 participant