Skip to content
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

refactor(api): module live data type #17234

Merged
merged 7 commits into from
Jan 9, 2025
Merged

refactor(api): module live data type #17234

merged 7 commits into from
Jan 9, 2025

Conversation

ahiuchingau
Copy link
Contributor

Overview

This PR defines each module's live data into more specific TypedDicts. Doing so allows us to (1) better visualize what data are expected from the module hardware, (2) simplify the _add_module_substate function in the protocol engine module state store. This is particular important when we are about to add a new module.

I also added from_live_data class generator method to some of the substates (as this is the only time module live data is used). Any concerns regarding pushing this logic down to the individual substate?

@ahiuchingau ahiuchingau marked this pull request as ready for review January 9, 2025 21:41
@ahiuchingau ahiuchingau requested a review from a team as a code owner January 9, 2025 21:41
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, though I'm confused why we would return empty/unknown module data if the validator doesn't pass and not log and ignore it

Copy link
Contributor

@vegano1 vegano1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah this will simplify validating the live data

@ahiuchingau
Copy link
Contributor Author

Looks good, though I'm confused why we would return empty/unknown module data if the validator doesn't pass and not log and ignore it

I'm not sure why either, but I didn't want to change the behavior too much in this PR so i kept it like this.

@ahiuchingau ahiuchingau requested a review from a team as a code owner January 9, 2025 22:21
Copy link
Contributor

@CaseyBatten CaseyBatten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refactor looks good, definitely makes more sense to structure this this way instead of the open returned data structures we had before.

@ahiuchingau ahiuchingau merged commit 27957a9 into edge Jan 9, 2025
69 checks passed
@ahiuchingau ahiuchingau deleted the module_live-data branch January 9, 2025 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants