feat(decider): add typed decider primitives#164
Conversation
yordis
commented
May 16, 2026
- Event-sourced workflows need a shared typed decision boundary so command handling stays consistent across crates.
- Multi-step decisions need to preserve state progression and write preconditions without leaking persistence concerns.
PR SummaryMedium Risk Overview Adds an Reviewed by Cursor Bugbot for commit ff590a6. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
WalkthroughThe PR introduces a complete new Rust crate, ChangesDecider Framework
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Code Coverage SummaryDetailsDiff against mainResults for commit: ff590a6 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@rsworkspace/crates/trogon-decider/src/decision.rs`:
- Around line 20-31: DecisionFailure is missing Display and std::error::Error
impls; add implementations so callers can inspect error context and chain
sources. Implement fmt::Display for DecisionFailure<DecideError, EvolveError> to
print a concise message that delegates to the inner error's Display (e.g.
"decide failed: {}" or "evolve failed: {}"), and implement std::error::Error
with a source(&self) -> Option<&(dyn std::error::Error + 'static)> that returns
Some(&inner) for the matching variant and None otherwise; add appropriate trait
bounds on DecideError and EvolveError (e.g. they must implement
std::error::Error + fmt::Display + 'static) on these impls so the source
chaining works. Ensure you reference the DecisionFailure enum and DecisionResult
type (they already exist) when adding these impls.
In `@rsworkspace/crates/trogon-decider/src/lib.rs`:
- Around line 116-120: The DecideError and EvolveError associated types on the
trait must be constrained to implement std::error::Error to enforce proper error
types; update the trait declaration so DecideError and EvolveError include a
bound like "std::error::Error" (and any project-required Send/Sync/'static
bounds) on those associated types, and then update any test or impls that used
unit `()` to use a proper error type (e.g., a custom unit struct that implements
std::error::Error or a boxed/anyhow error) so implementations of the trait
(functions referencing DecideError and EvolveError) compile against the new
bounds.
🪄 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: de854636-9084-4729-b416-be331fdc7427
⛔ Files ignored due to path filters (1)
rsworkspace/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
rsworkspace/crates/trogon-decider/Cargo.tomlrsworkspace/crates/trogon-decider/src/act.rsrsworkspace/crates/trogon-decider/src/decision.rsrsworkspace/crates/trogon-decider/src/events.rsrsworkspace/crates/trogon-decider/src/lib.rsrsworkspace/crates/trogon-decider/src/write_precondition.rs
5a75684 to
d094082
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
d094082 to
ff590a6
Compare