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

  • Add InstallationsService and AsyncInstallationsService for the /public/v1/integration/installations endpoint
  • Introduce Installation model (id, name, revision, account, extension, status, configuration, invitation, modules, terms, audit)
  • Add InstallationMixin and AsyncInstallationMixin with lifecycle actions: redeem, renew, token, token_for_account
  • Expose installations property on Integration and AsyncIntegration
  • Add unit tests for the installations service, mixin actions, and Integration/AsyncIntegration integration
  • Add e2e tests for installations (sync and async): get, filter, token endpoints; create/lifecycle workflow tests added but many are skipped/manual in CI
  • Update e2e_config.test.json: set integration.extension.id = EXT-6587-4477 and add integration.installation.id = EXI-0022-3978-5547
  • Update e2e fixtures to source extension clients from mpt_vendor and unskip several extension e2e tests (create/update/delete/download_icon)
  • Update pyproject.toml flake8 per-file-ignores for new e2e installation tests
  • Draft PR depends on PR MPT-19892: add E2E tests for Extension base service - Includes renaming from extensibility -> integrations #277 (MPT-19892 — rename extensibility → integration); draft targets the MPT-19892/e2e-extension-base-service branch until that is merged

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 6e0756a6-8c8b-4a16-bb85-12a5b95c86d3

📥 Commits

Reviewing files that changed from the base of the PR and between 5744f2b and 76009ff.

📒 Files selected for processing (12)
  • e2e_config.test.json
  • 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
💤 Files with no reviewable changes (2)
  • tests/e2e/integration/extensions/test_sync_extensions.py
  • tests/e2e/integration/extensions/test_async_extensions.py
✅ Files skipped from review due to trivial changes (2)
  • pyproject.toml
  • e2e_config.test.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/integration/extensions/conftest.py

📝 Walkthrough

Walkthrough

Adds an "installations" integration resource: a new Installation model, synchronous and asynchronous service classes, installation mixins providing POST actions (redeem/renew/token/token_for_account), integration wiring, unit and E2E tests, Flake8 per-file ignores, and small E2E fixture/test and config updates.

Changes

Installation Resource and Tests

Layer / File(s) Summary
Data Shape
mpt_api_client/resources/integration/installations.py
Adds Installation model with optional fields for metadata, references, lifecycle state, and related data.
Core Mixins
mpt_api_client/resources/integration/mixins/installation_mixin.py
Adds InstallationMixin and AsyncInstallationMixin with redeem, renew, token, and token_for_account methods that POST to per-action endpoints; renew accepts optional request body; token_for_account can include account.id query param.
Service Config & Wiring
mpt_api_client/resources/integration/installations.py
Adds InstallationsServiceConfig (/public/v1/integration/installations, model Installation, collection key data) and InstallationsService/AsyncInstallationsService composed from mixins, managed-resource, and collection behaviors.
Integration Surface
mpt_api_client/resources/integration/integration.py
Imports and exposes Integration.installations and AsyncIntegration.installations properties returning the respective service instances using the parent's HTTP client.
Module Exports
mpt_api_client/resources/integration/mixins/__init__.py
Exports InstallationMixin and AsyncInstallationMixin from the mixins package.
Unit Tests: mixins & service
tests/unit/resources/integration/mixins/test_installation_mixin.py, tests/unit/resources/integration/test_installations.py, tests/unit/resources/integration/test_integration.py
Adds tests that mock POSTs to validate mixin behaviors (redeem/renew/token/token_for_account), service composition and available methods, Installation model parsing for primitives and nested BaseModel fields, and Integration property coverage for installations.
E2E Fixtures for Installations
tests/e2e/integration/installations/conftest.py
Adds sync/async installations_service fixtures, session-scoped installation_id from e2e_config, installation_data payload, and created_installation/async_created_installation create-teardown fixtures with best-effort delete handling.
E2E Tests for Installations
tests/e2e/integration/installations/test_sync_installations.py, tests/e2e/integration/installations/test_async_installations.py
Adds flaky-marked E2E tests for get, filter, token endpoints, and several skipped manual lifecycle/create/redeem/renew/delete tests; async and sync variants included.
E2E Extensions Test Adjustments
tests/e2e/integration/extensions/conftest.py, tests/e2e/integration/extensions/test_sync_extensions.py, tests/e2e/integration/extensions/test_async_extensions.py
Switches extension fixtures to accept mpt_vendor/async_mpt_vendor and removes pytest.mark.skip from several extension create/update/delete/download tests so they run in E2E suite.
Config
e2e_config.test.json
Updates integration.extension.id value and adds new integration.installation.id key.
Lint config
pyproject.toml
Adds Flake8 per-file-ignores for tests/e2e/integration/installations/*.py (WPS453 WPS202).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Jira Issue Key In Title ✅ Passed ✅ Found Jira issue key in the title: MPT-19908
Test Coverage Required ✅ Passed PR modifies 6 code files and includes 9 test files with comprehensive coverage for the new installations service, including unit tests and e2e tests.
Single Commit Required ✅ Passed The PR contains exactly 1 commit (76009ff: "MPT-19908: add e2e tests for /public/v1/integration/installations"), meeting the single-commit requirement.

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 3 times, most recently 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 thread tests/e2e/integration/extensions/test_async_extensions.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

� Conflicts:
�	mpt_api_client/resources/integration/integration.py
�	mpt_api_client/resources/integration/mixins/__init__.py
�	tests/unit/resources/integration/test_integration.py
@albertsola albertsola force-pushed the MPT-19908/integration-installations branch from f58b8f7 to 5744f2b Compare May 5, 2026 13:06
@albertsola albertsola force-pushed the MPT-19908/integration-installations branch from 5744f2b to 76009ff Compare May 5, 2026 14:20
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

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