Skip to content

MPT-19903: add /integration/extensions/{id}/instances service#283

Merged
d3rky merged 2 commits into
mainfrom
MPT-19903/integration-extension-instances
May 11, 2026
Merged

MPT-19903: add /integration/extensions/{id}/instances service#283
d3rky merged 2 commits into
mainfrom
MPT-19903/integration-extension-instances

Conversation

@albertsola
Copy link
Copy Markdown
Contributor

@albertsola albertsola commented Apr 7, 2026

Summary

Implements the /public/v1/integration/extensions/{extensionId}/instances endpoint group as part of MPT-13310.

Changes

  • mpt_api_client/resources/integration/extension_instances.py — CreateMixin + GetMixin + CollectionMixin
  • Updated extensions.py to expose instances(extension_id) accessor
  • Unit tests: tests/unit/resources/integration/test_extension_instances.py
  • E2e tests: tests/e2e/integration/extension_instances/

Depends on

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

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

Closes MPT-19903

  • Implements the /public/v1/integration/extensions/{extensionId}/instances endpoint group
  • Adds ExtensionInstance model with attributes for identity, relationships, and state
  • Introduces ExtensionInstancesService and AsyncExtensionInstancesService with create, get, and list operations
  • Exposes instances(extension_id) accessor methods on both synchronous and asynchronous extensions services
  • Adds unit tests covering service mixins, model field mapping, and accessor methods
  • Adds end-to-end integration tests for both sync and async workflows (create, filter, and get operations)
  • Updates e2e configuration with extension instance identifier mapping

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

This PR adds comprehensive support for managing extension instances as a sub-resource within the extensions API. It introduces the ExtensionInstance data model, synchronous and asynchronous service implementations, integration with the parent ExtensionsService, and both unit and end-to-end test coverage.

Changes

Extension Instances Feature

Layer / File(s) Summary
Data Model & Service Configuration
mpt_api_client/resources/integration/extension_instances.py
Defines ExtensionInstance model with typed fields (id, name, revision, external_id, status, extension, meta, channel, audit) and ExtensionInstancesServiceConfig binding to the /public/v1/integration/extensions/{extension_id}/instances endpoint.
Sync/Async Service Implementation
mpt_api_client/resources/integration/extension_instances.py
Implements ExtensionInstancesService (sync) and AsyncExtensionInstancesService (async) composed from create/get/list mixins, both parameterized with ExtensionInstance.
Extensions Service Integration
mpt_api_client/resources/integration/extensions.py
Adds instances(extension_id: str) methods to ExtensionsService and AsyncExtensionsService that instantiate and return the corresponding instance service configured with the provided extension ID.
E2E Test Configuration & Fixtures
e2e_config.test.json, tests/e2e/integration/extension_instances/conftest.py
Adds test instance ID configuration and pytest fixtures for instance ID, service accessors (sync/async), and instance payload data.
Unit Tests
tests/unit/resources/integration/test_extension_instances.py
Validates model field mapping, service mixin presence, create/iterate operations via mocked HTTP, and accessor methods on both sync and async extensions services.
E2E Tests (Sync)
tests/e2e/integration/extension_instances/test_sync_extension_instances.py
E2E integration tests for synchronous API: create (skipped), filter/iteration, and get operations, all marked as flaky.
E2E Tests (Async)
tests/e2e/integration/extension_instances/test_async_extension_instances.py
E2E integration tests for asynchronous API: async create (skipped), filter/iteration, and get operations, all marked as flaky.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 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-19903
Test Coverage Required ✅ Passed PR modifies 3 code files (extension_instances.py, extensions.py, e2e_config.test.json) and includes comprehensive test coverage with 4 test files: unit tests, E2E sync/async tests, and test fixtures.
Single Commit Required ✅ Passed PR contains exactly 1 commit (ed5bcd7). Single commit requirement satisfied.

✏️ 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-19903/integration-extension-instances branch from 31116ac to d8a55d6 Compare April 7, 2026 12:04
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

…ces endpoint

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

� Conflicts:
�	mpt_api_client/resources/integration/extensions.py
@albertsola albertsola force-pushed the MPT-19903/integration-extension-instances branch 2 times, most recently from 593d89e to d2e5f68 Compare May 11, 2026 15:55
@albertsola albertsola force-pushed the MPT-19903/integration-extension-instances branch from d2e5f68 to ed5bcd7 Compare May 11, 2026 15:58
@albertsola albertsola marked this pull request as ready for review May 11, 2026 15:59
@albertsola albertsola requested a review from a team as a code owner May 11, 2026 15:59
@albertsola albertsola requested review from jentyk and svazquezco May 11, 2026 15:59
@sonarqubecloud
Copy link
Copy Markdown

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.

🧹 Nitpick comments (1)
tests/e2e/integration/extension_instances/test_sync_extension_instances.py (1)

10-14: ⚡ Quick win

Consider using xfail instead of hard skip for known backend issues.

Line 10 uses skip which hides the test completely; using xfail(strict=False) keeps the test visible and will surface when the backend issue is fixed. Apply the same change in the async counterpart too. Replace the placeholder with an actual issue ticket ID for tracking.

Proposed change
-@pytest.mark.skip(reason="returns 500 error")
+@pytest.mark.xfail(
+    reason="Known backend 500 for create extension instance (link issue ID)",
+    strict=False,
+)
 def test_create_extension_instance(extension_instances_service, instance_data):
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/integration/extension_instances/test_sync_extension_instances.py`
around lines 10 - 14, Replace the hard skip on the failing test by marking it
xfail so it still runs and will surface when fixed: remove pytest.mark.skip on
test_create_extension_instance and use
pytest.mark.xfail(reason="BACKEND-<ISSUE_ID>: returns 500 error", strict=False)
instead; apply the same change to the async counterpart test (the async test
that uses extension_instances_service and instance_data) so both tests remain
visible while tracking the backend ticket ID.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/e2e/integration/extension_instances/test_sync_extension_instances.py`:
- Around line 10-14: Replace the hard skip on the failing test by marking it
xfail so it still runs and will surface when fixed: remove pytest.mark.skip on
test_create_extension_instance and use
pytest.mark.xfail(reason="BACKEND-<ISSUE_ID>: returns 500 error", strict=False)
instead; apply the same change to the async counterpart test (the async test
that uses extension_instances_service and instance_data) so both tests remain
visible while tracking the backend ticket ID.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 58c3f5cf-1438-4178-9434-2f11999ac446

📥 Commits

Reviewing files that changed from the base of the PR and between c61b7b9 and ed5bcd7.

📒 Files selected for processing (8)
  • e2e_config.test.json
  • mpt_api_client/resources/integration/extension_instances.py
  • mpt_api_client/resources/integration/extensions.py
  • tests/e2e/integration/extension_instances/__init__.py
  • tests/e2e/integration/extension_instances/conftest.py
  • tests/e2e/integration/extension_instances/test_async_extension_instances.py
  • tests/e2e/integration/extension_instances/test_sync_extension_instances.py
  • tests/unit/resources/integration/test_extension_instances.py

@d3rky d3rky merged commit 0b42833 into main May 11, 2026
4 checks passed
@d3rky d3rky deleted the MPT-19903/integration-extension-instances branch May 11, 2026 16:07
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.

2 participants