Skip to content

Conversation

@albertsola
Copy link
Contributor

@albertsola albertsola commented Feb 2, 2026

Closes MPT-16437

Changes

  • Reorganized billing mixins module: Refactored the monolithic mpt_api_client/resources/billing/mixins.py file (426 lines) into a modular package structure with separate files for each mixin type:

    • Created mpt_api_client/resources/billing/mixins/ package with individual mixin modules
    • acceptable_mixin.py: AcceptableMixin and AsyncAcceptableMixin for accept/queue operations
    • regeneratable_mixin.py: RegeneratableMixin and AsyncRegeneratableMixin for regenerate/submit/enquiry/accept operations
    • recalculatable_mixin.py: RecalculatableMixin and AsyncRecalculatableMixin for recalculate/accept/queue operations
    • issuable_mixin.py: IssuableMixin and AsyncIssuableMixin for issue/cancel/error/pending/queue/retry/recalculate operations
    • attachment_mixin.py: AttachmentMixin and AsyncAttachmentMixin combining file CRUD and retrieval operations
  • Centralized exports: Created mpt_api_client/resources/billing/mixins/__init__.py to re-export all mixin classes, maintaining the same public API

  • Reorganized tests: Refactored test suite structure:

    • Deleted monolithic tests/unit/resources/billing/test_mixins.py (637 lines)
    • Created dedicated test files under tests/unit/resources/billing/mixins/ for each mixin type with comprehensive unit tests covering both synchronous and asynchronous variants
  • Maintained backward compatibility: Public API remains unchanged; all previously exported mixins are still available through the updated module structure

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

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

The monolithic billing mixins module is refactored into a package structure with individual modules for each mixin capability (regeneratable, recalculatable, issuable, acceptable, attachment). A new __init__.py re-exports all mixins to maintain API compatibility. Tests are reorganized from a single comprehensive file into separate per-mixin test modules.

Changes

Cohort / File(s) Summary
Monolithic Module Removal
mpt_api_client/resources/billing/mixins.py
Deleted monolithic mixins file containing 10 mixin classes (RegeneratableMixin, AsyncRegeneratableMixin, RecalculatableMixin, AsyncRecalculatableMixin, IssuableMixin, AsyncIssuableMixin, AcceptableMixin, AsyncAcceptableMixin, AttachmentMixin, AsyncAttachmentMixin).
New Mixins Package Structure
mpt_api_client/resources/billing/mixins/__init__.py, mpt_api_client/resources/billing/mixins/acceptable_mixin.py, mpt_api_client/resources/billing/mixins/attachment_mixin.py, mpt_api_client/resources/billing/mixins/issuable_mixin.py, mpt_api_client/resources/billing/mixins/recalculatable_mixin.py, mpt_api_client/resources/billing/mixins/regeneratable_mixin.py
Created new package with individual mixin modules. Package __init__.py centralizes re-exports of all 10 mixin classes. Each module defines synchronous and asynchronous mixin pairs with resource action methods (accept/queue, issue/cancel/error/pending/queue/retry/recalculate, recalculate/accept/queue, regenerate/submit/enquiry/accept, file CRUD operations).
Test Reorganization
Removed: tests/unit/resources/billing/test_mixins.py
Deleted monolithic test file containing comprehensive parametrized tests for all mixin classes covering sync/async paths and data presence scenarios.
New Test Modules
tests/unit/resources/billing/mixins/test_acceptable_mixin.py, tests/unit/resources/billing/mixins/test_issuable_mixin.py, tests/unit/resources/billing/mixins/test_recalculatable_mixin.py, tests/unit/resources/billing/mixins/test_regeneratable_mixin.py
Created per-mixin test modules with dedicated test services, fixtures, and parametrized test suites validating POST request formation, payload handling, response deserialization, and sync/async behavior for each mixin's action methods.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 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 (MPT-16437) in the correct MPT-XXXX format at the beginning.
Test Coverage Required ✅ Passed PR modifies 7 code files reorganizing billing mixins and includes 4 new dedicated test files with 660+ lines of test coverage replacing the old consolidated test file.
Single Commit Required ✅ Passed The pull request contains exactly one commit (e81d45a) beyond the main branch, satisfying the single commit requirement.

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


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 ae5f76d into main Feb 2, 2026
4 checks passed
@albertsola albertsola deleted the MPT-16437/Reorganise-resource-billing-mixins-structure branch February 2, 2026 16:05
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