Skip to content

MPT-19908: add /integration/installations service#281

Open
albertsola wants to merge 2 commits intomainfrom
MPT-19908/integration-installations
Open

MPT-19908: add /integration/installations service#281
albertsola wants to merge 2 commits intomainfrom
MPT-19908/integration-installations

Conversation

@albertsola
Copy link
Copy Markdown
Contributor

@albertsola albertsola commented Apr 7, 2026

Summary

Implements the /public/v1/integration/installations endpoint group as part of MPT-13310.

Changes

  • mpt_api_client/resources/integration/installations.pyInstallationsService / AsyncInstallationsService
  • mpt_api_client/resources/integration/mixins/installation_mixin.py — lifecycle actions: invite, install, uninstall, expire
  • Updated integration.py to expose installations property
  • Unit tests: tests/unit/resources/integration/test_installations.py + test_installation_mixin.py
  • E2e tests: tests/e2e/integration/installations/

Depends on

#277 (MPT-19892 — rename extensibility → integration)

⚠️ Draft — targets MPT-19892/e2e-extension-base-service until PR #277 merges.

Closes MPT-19908

  • Added new InstallationsService and AsyncInstallationsService to expose /public/v1/integration/installations endpoint
  • Introduced Installation model with fields for account, extension, lifecycle status, configuration, invitation, modules, terms, and audit metadata
  • Created InstallationMixin and AsyncInstallationMixin with lifecycle action methods: invite, install, uninstall, and expire
  • Exposed installations property on Integration and AsyncIntegration classes
  • Added comprehensive unit tests for installations service, mixin behavior, and service integration
  • Added end-to-end tests for synchronous and asynchronous installation operations (get, filter, create, invite, install, uninstall, expire, delete)
  • Updated E2E test configuration to reference new integration extension ID (EXT-6587-4477) and installation ID (EXI-0022-3978-5547)
  • Updated E2E extension test fixtures to source from mpt_vendor instead of mpt_ops
  • Enabled previously skipped E2E extension tests (create, update, delete, download_icon operations)
  • Updated Flake8 configuration to suppress linting warnings for new E2E installation test modules

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

This PR adds end-to-end support for integration installations to the MPT API Python client. It introduces a new Installation resource model with associated synchronous and asynchronous service classes, installation lifecycle operation mixins (invite, install, uninstall, expire), integrates the installations service into the Integration/AsyncIntegration modules, and provides comprehensive unit and E2E test coverage. Additionally, extension E2E tests are unskipped and extension fixtures are refactored to use mpt_vendor.

Changes

Cohort / File(s) Summary
Installation Resource Core
mpt_api_client/resources/integration/installations.py, mpt_api_client/resources/integration/mixins/installation_mixin.py, mpt_api_client/resources/integration/mixins/__init__.py
Added Installation model with nested fields, InstallationsService/AsyncInstallationsService classes, and InstallationMixin/AsyncInstallationMixin providing lifecycle methods (invite, install, uninstall, expire) that POST to respective endpoints.
Integration Module Integration
mpt_api_client/resources/integration/integration.py
Added installations property to both Integration and AsyncIntegration to expose corresponding service instances via shared HTTP client.
Configuration Updates
e2e_config.test.json, pyproject.toml
Updated E2E test config to reference new extension ID and added integration.installation.id identifier; added Flake8 ignore rules for new installations E2E test module.
Extension E2E Tests
tests/e2e/integration/extensions/conftest.py, tests/e2e/integration/extensions/test_sync_extensions.py, tests/e2e/integration/extensions/test_async_extensions.py
Refactored extension service fixtures to use mpt_vendor/async_mpt_vendor instead of mpt_ops/async_mpt_ops; removed skip decorators from create/update/delete/download tests to enable execution.
Installation E2E Tests
tests/e2e/integration/installations/conftest.py, tests/e2e/integration/installations/test_sync_installations.py, tests/e2e/integration/installations/test_async_installations.py
New E2E test suite with fixtures providing installation service instances, session-scoped installation ID, and creation/teardown fixtures; tests cover get, filter, and (skipped) lifecycle operations.
Installation Unit Tests
tests/unit/resources/integration/test_installations.py, tests/unit/resources/integration/mixins/test_installation_mixin.py, tests/unit/resources/integration/test_integration.py
New unit tests validating Installation model, service method composition, mixin behavior for lifecycle operations, and installations property on Integration/AsyncIntegration classes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Jira Issue Key In Title ✅ Passed PR title contains exactly one Jira issue key (MPT-19908) in the correct format at the beginning.
Test Coverage Required ✅ Passed PR modifies 6 code files and includes 9 test files covering both unit and end-to-end tests for new installation service functionality.
Single Commit Required ✅ Passed The PR contains exactly one commit (f58b8f7) with all changes related to the /public/v1/integration/installations endpoint, including service modules, mixins, unit tests, and end-to-end tests.

✏️ 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.

Base automatically changed from MPT-19892/e2e-extension-base-service to main April 7, 2026 12:00
@albertsola albertsola force-pushed the MPT-19908/integration-installations branch from 0ea416d to 1c86e4e Compare April 7, 2026 12:04
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

@albertsola albertsola force-pushed the MPT-19908/integration-installations branch from 1c86e4e to 7d07055 Compare April 7, 2026 16:27
albertsola and others added 2 commits April 7, 2026 17:28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@albertsola albertsola force-pushed the MPT-19908/integration-installations branch from 7d07055 to f58b8f7 Compare April 7, 2026 16:28
@albertsola albertsola marked this pull request as ready for review April 7, 2026 16:29
@albertsola albertsola requested a review from a team as a code owner April 7, 2026 16:29
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/unit/resources/integration/mixins/test_installation_mixin.py (1)

46-66: Consider adding one case that verifies JSON payload forwarding.

These tests currently validate action routing and response parsing, but not that resource_data is sent through to post(..., json=...). Adding one payload case (sync + async) would close that gap.

Also applies to: 72-91

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unit/resources/integration/mixins/test_installation_mixin.py` around
lines 46 - 66, Add a test variant that checks the request JSON payload is
forwarded: in the test_post_actions function (and the async counterpart if
present), include a resource_data dict and call getattr(installation_service,
action)(installation_id, resource_data=resource_data) (or await for async), then
assert the mocked respx.post received json==resource_data (e.g., inspect
mock_route.calls[0].request.read() or .json()) and keep existing assertions on
method, call_count, and response parsing to ensure post(..., json=...) is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/e2e/integration/extensions/test_async_extensions.py`:
- Around line 9-11: The test file has three consecutive blank lines before the
top-level test function test_create_extension causing ruff format --check to
fail; edit the file to remove one blank line so there are exactly two blank
lines separating top-level definitions (ensure there are two blank lines
immediately before def test_create_extension and no leftover `@pytest.mark.skip`
or stray blank lines).

---

Nitpick comments:
In `@tests/unit/resources/integration/mixins/test_installation_mixin.py`:
- Around line 46-66: Add a test variant that checks the request JSON payload is
forwarded: in the test_post_actions function (and the async counterpart if
present), include a resource_data dict and call getattr(installation_service,
action)(installation_id, resource_data=resource_data) (or await for async), then
assert the mocked respx.post received json==resource_data (e.g., inspect
mock_route.calls[0].request.read() or .json()) and keep existing assertions on
method, call_count, and response parsing to ensure post(..., json=...) is used.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 7638d5c8-b871-4f3d-b269-3aec3a657875

📥 Commits

Reviewing files that changed from the base of the PR and between f543c53 and f58b8f7.

📒 Files selected for processing (16)
  • e2e_config.test.json
  • mpt_api_client/resources/integration/installations.py
  • mpt_api_client/resources/integration/integration.py
  • mpt_api_client/resources/integration/mixins/__init__.py
  • mpt_api_client/resources/integration/mixins/installation_mixin.py
  • pyproject.toml
  • tests/e2e/integration/extensions/conftest.py
  • tests/e2e/integration/extensions/test_async_extensions.py
  • tests/e2e/integration/extensions/test_sync_extensions.py
  • tests/e2e/integration/installations/__init__.py
  • tests/e2e/integration/installations/conftest.py
  • tests/e2e/integration/installations/test_async_installations.py
  • tests/e2e/integration/installations/test_sync_installations.py
  • tests/unit/resources/integration/mixins/test_installation_mixin.py
  • tests/unit/resources/integration/test_installations.py
  • tests/unit/resources/integration/test_integration.py
💤 Files with no reviewable changes (1)
  • tests/e2e/integration/extensions/test_sync_extensions.py

Comment on lines 9 to 11

@pytest.mark.skip(reason="unable to create extensions for testing")

def test_create_extension(async_created_extension, extension_data):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix formatting to resolve pipeline failure.

The pipeline reports ruff format --check failed. Removing the @pytest.mark.skip decorator left an extra blank line, resulting in 3 consecutive blank lines before test_create_extension. Ruff format expects exactly 2 blank lines between top-level definitions.

🛠️ Proposed fix
 pytestmark = [pytest.mark.flaky]
 
 
-
 def test_create_extension(async_created_extension, extension_data):
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/integration/extensions/test_async_extensions.py` around lines 9 -
11, The test file has three consecutive blank lines before the top-level test
function test_create_extension causing ruff format --check to fail; edit the
file to remove one blank line so there are exactly two blank lines separating
top-level definitions (ensure there are two blank lines immediately before def
test_create_extension and no leftover `@pytest.mark.skip` or stray blank lines).

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.

1 participant