Repository navigation
fix(types): prevent invalid dispatch metadata from bypassing Dialyzer - #73
Conversation
yordis
commented
Apr 14, 2026
- Tightens the public dispatch contract so invalid metadata shapes are visible to static analysis before they fail at runtime
- Keeps the documented API expectation for dispatch metadata aligned with the exposed typespecs instead of hiding it behind a generic keyword list
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
PR SummaryLow Risk Overview Expands Reviewed by Cursor Bugbot for commit 5ce0842. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThree Elixir modules updated to narrow type contracts for dispatch functions and introduce explicit dispatch option and return types in the Router; a successful dispatch may now be typed as Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@lib/commanded/commands/router.ex`:
- Around line 394-410: The public type dispatch_return() allows :events but
dispatch_resp() lacks a corresponding success shape, causing a type hole; update
dispatch_resp() to include the :events case (e.g., a variant representing
successful event lists) so Dialyzer knows the shape returned when {:returning,
:events} is used—locate the dispatch_return()/dispatch_resp() type definitions
and add an events-success variant (with an appropriate typed list element
matching your event type or map) to dispatch_resp() and any places that
pattern-match on its result.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a30177d5-8e74-4415-8653-c227cc3e7e5a
📒 Files selected for processing (3)
lib/application.exlib/commanded/commands/composite_router.exlib/commanded/commands/router.ex
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>