fix: Use runtime struct matching for cross-package error types #99
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The v2 branch fails to compile when used as a dependency because
lib/jido/error.exuses compile-time struct pattern matching on external packages (jido_signal, jido_action).Root Cause
Patterns like
%Jido.Signal.Error.InvalidInputError{}require the struct module to be compiled before the pattern is expanded. When jido is pulled as a hex/git dependency, compilation order isn't guaranteed relative to the external packages.Key Finding: The modules DO exist in jido_signal 1.1.0 and jido_action 1.0.0. This is NOT a missing module - it's a compile-time vs runtime struct expansion issue.
The v2 branch works fine when developing locally (because the maintainers have jido_signal/jido_action as local path deps), but fails when used as an external dependency.
Fix
Replace
%Module.Name{}with%{__struct__: Module.Name}for cross-package structs. This defers struct checking to runtime instead of compile-time, allowing the code to compile before external packages are loaded.Testing
🤖 Generated with Claude Code