Conversation
PR SummaryMedium Risk Overview Tightens validation and safety: rejects invalid Updates tests and docs to cover separate state-module aggregates and snapshotting behavior, and relaxes an OTel exception-message assertion. Test DB config now reads Postgres hostname from Reviewed by Cursor Bugbot for commit 6b98b7c. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
225442e to
3c5fe1a
Compare
37b9a69 to
c91cfd8
Compare
7dfe246 to
920fe04
Compare
6a546e4 to
c768361
Compare
0378f18 to
5b638a0
Compare
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5b638a0. Configure here.
5b638a0 to
b456d01
Compare
b456d01 to
6b98b7c
Compare

Summary
In upstream Commanded, the aggregate module serves dual purposes: it defines both the state struct (via
defstruct) and the behavior (execute/2,apply/2). This coupling is a hard blocker when aggregate state comes from an external source like protobuf—generated modules cannot be modified without being overwritten on regeneration.This PR adds an
initial_stateoption to the router'sdispatchmacro. When provided,initial_state.initial_state/0is called to build the aggregate's initial state instead ofstruct(AggregateModule), fully decoupling the aggregate behavior module from the state representation. Ifinitial_stateis omitted the existing behavior is unchanged.Note
This aligns with the Functional Decider Pattern, where an aggregate is a set of pure functions (
execute,apply,initial_state) operating on state, rather than a stateful object that owns its data structure.Related
Commanded.Aggregate.Identityprotocol #43 -- related: addsCommanded.Aggregate.Identityprotocol, also motivated by protobuf / external struct use cases