Skip to content

Conversation

@albertsola
Copy link
Contributor

@albertsola albertsola commented Feb 2, 2026

Closes MPT-16437

  • Reorganized commerce mixins from a monolithic file into a modular package structure with separate modules for each mixin type (render, template, terminate)
  • Moved TerminateMixin, RenderMixin, TemplateMixin and their async counterparts (AsyncTerminateMixin, AsyncRenderMixin, AsyncTemplateMixin) into individual module files within mpt_api_client/resources/commerce/mixins/
  • Created mpt_api_client/resources/commerce/mixins/__init__.py to re-export all mixins, maintaining backward compatibility and the public API
  • Reorganized unit tests from a single test file into separate test modules within tests/unit/resources/commerce/mixins/ directory, with dedicated test files for each mixin type
  • Updated pyproject.toml to remove linter suppression rule for the old test location
  • All mixin functionality and behavior remain unchanged; this is purely a structural refactoring to improve code organization and maintainability

@albertsola albertsola requested a review from a team as a code owner February 2, 2026 17:24
@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

This change refactors the monolithic mixin module into a modular structure with separate files for RenderMixin, TemplateMixin, and TerminateMixin (along with async variants). Each mixin is now in its own focused module under mpt_api_client/resources/commerce/mixins/ with an __init__.py re-exporting the public API. Tests are reorganized to match this structure, and a linter suppression rule is removed from the configuration.

Changes

Cohort / File(s) Summary
Mixin Module Refactoring
mpt_api_client/resources/commerce/mixins/render_mixin.py, mpt_api_client/resources/commerce/mixins/template_mixin.py, mpt_api_client/resources/commerce/mixins/terminate_mixin.py
New modules split from monolithic mixins file, each containing synchronous and asynchronous mixin classes with render, template, and terminate resource operations respectively.
Package Initialization
mpt_api_client/resources/commerce/mixins/__init__.py
Re-exports all six mixin classes (RenderMixin, AsyncRenderMixin, TemplateMixin, AsyncTemplateMixin, TerminateMixin, AsyncTerminateMixin) from submodules via __all__.
Old Monolithic Mixins File
mpt_api_client/resources/commerce/mixins.py
Deleted; functionality moved to separate mixin modules.
Test Suite Reorganization
tests/unit/resources/commerce/mixins/test_render_mixin.py, tests/unit/resources/commerce/mixins/test_template_mixin.py, tests/unit/resources/commerce/mixins/test_terminate_mixin.py
New focused test modules for individual mixin classes, replacing consolidated test coverage.
Old Consolidated Tests
tests/unit/resources/commerce/test_mixins.py
Deleted; tests moved to mixin-specific modules.
Configuration
pyproject.toml
Removed linter suppression rule for tests/unit/resources/*/test_mixins.py.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Jira Issue Key In Title ✅ Passed The PR title contains exactly one Jira issue key in the required MPT-XXXX format at the beginning.
Test Coverage Required ✅ Passed Code files were modified (6 changes including mixin reorganization) and test files were included (3 new test files created, 1 removed). Check criteria met.
Single Commit Required ✅ Passed The pull request contains exactly one commit titled 'MPT-16437 Reorganise resource commerce mixins structure', meeting clean git history requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • MPT-16437: Cannot read properties of undefined (reading 'map')

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 2, 2026

@albertsola albertsola merged commit 9cca473 into main Feb 2, 2026
4 checks passed
@albertsola albertsola deleted the MPT-16437/Reorganise-resource-commerce-mixins-structure branch February 2, 2026 17:43
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