Skip to content

Conversation

@cpaniaguam
Copy link
Collaborator

@cpaniaguam cpaniaguam commented Jan 27, 2026

This pull request refactors and centralizes the logic for handling missing data and deadline processing in the HSSM codebase. The main changes introduce a new MissingDataMixin to encapsulate all missing data and deadline-related logic, and update both the HSSMBase and HSSM classes to use this mixin. This improves code organization, maintainability, and reusability by avoiding code duplication and clarifying responsibilities.

Refactoring and centralization of missing data logic:

  • Introduced a new MissingDataMixin in src/hssm/missing_data_mixin.py that provides methods for handling missing data and deadline logic, including _handle_missing_data_and_deadline, _set_missing_data_and_deadline, and _process_missing_data_and_deadline. This mixin consolidates logic previously scattered in HSSMBase and DataValidatorMixin.
  • Updated HSSMBase and HSSM classes to inherit from MissingDataMixin, replacing their internal missing data and deadline logic with calls to the new mixin methods. This removes redundant code and ensures consistent handling across classes. [1] [2] [3] [4]

Code cleanup and organization:

  • Removed the old _handle_missing_data_and_deadline method from DataValidatorMixin and related logic from HSSMBase, as this functionality is now provided by the mixin. [1] [2]
  • Improved code readability in HSSMBase.__init__ by grouping initialization steps into logical regions using comments, and delegating missing data/deadline processing to the mixin. [1] [2] [3]

Test updates:

  • Removed tests for the old _handle_missing_data_and_deadline method from test_data_validator.py, as this logic is now handled by the mixin and tested elsewhere.
  • Marked a flaky test in test_hssmbase.py as expected to fail in CI to improve test reliability.

@AlexanderFengler
Copy link
Member

Small question: The branch this gets merged into doesn't have a PR itself? (or maybe I was blind) @cpaniaguam

Copy link
Collaborator

@digicosmos86 digicosmos86 left a comment

Choose a reason for hiding this comment

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

Generally this looks good! I think MissingDataMixin should hold internal properties related to missing data and deadline, so that _set_missing_data_and_deadline does not have to be a static method

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if MissingDataMixin should manage its internal properties instead of just an encapsulation of functions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought of this but it seems like mixins should be stateless. And I tend to agree with this school of thought as it could be difficult to handle __init__ collisions in the MRO. This way we won't have to manage complex super() chains across multiple inherited entities.

@cpaniaguam cpaniaguam merged commit aa827c8 into cp-main-sb Feb 4, 2026
4 checks passed
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.

3 participants