-
Notifications
You must be signed in to change notification settings - Fork 2.2k
protofsm: add ConfMapper to allow conf attribute projection for new events #9725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
In this commit, we add a new ConfMapper which is useful for state machines that want to project some of the conf attributes into a new event to be sent post conf.
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This commit introduces a new generic type assertion function `assertState` to the state machine tests. This function asserts that the state machine is currently in the expected state type and returns the state cast to that type. This allows us to directly access the fields of the state without having to perform a type assertion manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new ConfMapper to the protofsm package allowing state machines to project confirmation attributes into custom events, and it adds accompanying tests for both the new ConfMapper and the existing SpendMapper.
- Added new types and mapping functions (ConfMapper, confDetailsEvent, registerConf) to support confirmation event handling.
- Updated state machine logic to utilize the ConfMapper when processing confirmation notifications.
- Extended unit test coverage to verify both confirmation and spend event mapping.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
protofsm/state_machine_test.go | Tests added for ConfMapper functionality, including state transitions and event mapping. |
protofsm/state_machine.go | Updated confirmation event handling to utilize the new ConfMapper. |
protofsm/daemon_events.go | Added the ConfMapper type and updated comments in the RegisterConf struct. |
@Roasbeef, remember to re-request review from reviewers when ready |
In this PR, we add a new ConfMapper which is useful for state
machines that want to project some of the conf attributes into a new
event to be sent post conf.
We then unit tests for the existing
SpendMapper
alongside thenew tests for the
ConfMapper
.