Skip to content

MPT-24263 add accounts services service - #388

Merged
jentyk merged 3 commits into
mainfrom
feature/MPT-24263/add-accounts-account-users-services
Sep 18, 2026
Merged

jentyk merged 3 commits into
mainfrom
feature/MPT-24263/add-accounts-account-users-services

Conversation

@jentyk

@jentyk jentyk commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

🤖 AI-generated PR — Please review carefully.

What was done

/public/v1/accounts/services is documented in the Marketplace OpenAPI spec but had no client
service, so it was unreachable from MPTClient / AsyncMPTClient. This PR adds it.

Endpoint Module Group property Service classes
/public/v1/accounts/services mpt_api_client/resources/accounts/services.py accounts.services ServicesService / AsyncServicesService

The module follows the existing resource-service pattern: a Model subclass with the
documented attributes, a shared ServicesServiceConfig (_endpoint, _model_class,
_collection_key = "data"), and a sync service plus its async mirror, exposed as @property
on Accounts and AsyncAccounts.

Verified against the spec served by TEST

The swagger served by api.s1.show documents GET on the collection and on /{id} only, so the
service is read-only: GetMixin + CollectionMixin, no create/update/delete. Live checks agree:
POST, PUT and DELETE answer 405.

ServiceIdentity declares every ServiceQueryModel property: name, status, description,
icon, revision, audit. Streaming comes with CollectionMixin: stream_snapshot() on
TEST returns all 16 service identities with a matching MPT-Item-Count.

The model is named ServiceIdentity rather than Service because mpt_api_client.http.Service
is the service base class imported in the same module. The spec itself calls the resource a
"service identity" (List service identities / Get service identity by ID).

Why account-users was dropped from this PR

MPT-24263 also named /public/v1/accounts/account-users. An AccountUsersService was added in
the first commit and removed again after verification against TEST:

  • the swagger served by TEST tags every /v1/accounts/account-users* operation
    AccountUsersLegacy and marks it deprecated: true;
  • on TEST every route under /public/v1/accounts/account-users answers 404 Not Found for the
    vendor, client and operations tokens alike — paged and MPT-Streaming collection GET, GET by
    id, and POST with a valid body.

The platform no longer routes the endpoint, so shipping a client for it would give consumers a
service that cannot succeed. The non-deprecated replacement, the nested
/accounts/accounts/{accountId}/users family, is already covered by accounts_users.py
(AccountsUsersService), which is untouched.

E2E tests

tests/e2e/accounts/services/ covers ServicesService / AsyncServicesService against TEST:
get by id, 404 on an unknown id, paged listing, and RQL filter with iterate(). The service
identity the tests read (SVC-0001, the platform service) is registered as
accounts.service.id in e2e_config.test.json. All 8 tests pass locally against TEST.

Documentation

No docs were changed, deliberately. Neither docs/usage.md nor docs/architecture.md
enumerates individual services: usage.md has no service list, and the resource tree in
architecture.md is group-granular with ellipses
(accounts/ # Account, Users, Buyers, Sellers, API Tokens, …), so the new service is already
covered by the existing text.

Testing

make check passes — ruff format, ruff, flake8/WPS, mypy, uv lock --check. Full unit suite:
3422 passed, 99% coverage, services.py at 100%.

Unit tests:

  • tests/unit/resources/accounts/test_services.py — path, get present, write methods absent.
  • tests/unit/resources/accounts/test_accounts.py — services added to the sync and async
    parametrized group-property lists.

No pyproject.toml change was needed: mpt_api_client/resources/accounts/*.py already carries
WPS214/WPS235 in the per-file ignores.

MPT-24263

🤖 Generated with Claude Code

  • Adds read-only /public/v1/accounts/services support to MPTClient and AsyncMPTClient.
  • Adds ServiceIdentity, ServicesService, and AsyncServicesService.
  • Exposes services through Accounts.services and AsyncAccounts.services.
  • Adds unit and end-to-end coverage for retrieval, listing, filtering, async usage, and error handling.
  • Removes the deprecated /accounts/account-users service.

@coderabbitai

coderabbitai Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

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: Essentials

Run ID: 36b4608e-efdb-4855-99fc-6609efd0d334

📥 Commits

Reviewing files that changed from the base of the PR and between 99911f0 and 2505450.

📒 Files selected for processing (8)
  • e2e_config.test.json
  • mpt_api_client/resources/accounts/accounts.py
  • mpt_api_client/resources/accounts/services.py
  • tests/e2e/accounts/services/conftest.py
  • tests/e2e/accounts/services/test_async_services.py
  • tests/e2e/accounts/services/test_sync_services.py
  • tests/unit/resources/accounts/test_accounts.py
  • tests/unit/resources/accounts/test_services.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • softwareone-platform/mpt-extension-skills (manual)

Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
For each subsequent commit in this PR, explicitly verify if previous review comments have been resolved

⚙️ CodeRabbit configuration file

Files:

  • e2e_config.test.json
  • tests/e2e/accounts/services/test_async_services.py
  • tests/e2e/accounts/services/test_sync_services.py
  • mpt_api_client/resources/accounts/services.py
  • tests/e2e/accounts/services/conftest.py
  • mpt_api_client/resources/accounts/accounts.py
  • tests/unit/resources/accounts/test_accounts.py
  • tests/unit/resources/accounts/test_services.py
🧠 Learnings (1)
📚 Learning: 2026-02-02T13:05:41.144Z
Learnt from: albertsola
Repo: softwareone-platform/mpt-api-python-client PR: 201
File: tests/unit/resources/accounts/mixins/test_activatable_mixin.py:132-139
Timestamp: 2026-02-02T13:05:41.144Z
Learning: In the mpt-api-python-client repository, tests are configured to use pytest asyncio mode auto, which auto-detects async test functions and runs them without requiring pytest.mark.asyncio. Reviewers should rely on this behavior for all Python test files under tests/, and avoid adding unnecessary asyncio markers in async tests. Ensure test files in tests/ adhere to this convention unless a specific test requires an explicit marker.

Applied to files:

  • tests/e2e/accounts/services/test_async_services.py
🔇 Additional comments (8)
mpt_api_client/resources/accounts/services.py (1)

1-55: LGTM!

mpt_api_client/resources/accounts/accounts.py (1)

13-13: LGTM!

Also applies to: 77-81, 138-142

tests/unit/resources/accounts/test_accounts.py (1)

18-18: LGTM!

Also applies to: 49-49, 72-72

tests/unit/resources/accounts/test_services.py (1)

1-55: LGTM!

e2e_config.test.json (1)

12-12: LGTM!

tests/e2e/accounts/services/conftest.py (1)

1-21: LGTM!

tests/e2e/accounts/services/test_async_services.py (1)

1-29: LGTM!

tests/e2e/accounts/services/test_sync_services.py (1)

1-29: LGTM!


📝 Walkthrough

Walkthrough

Added synchronous and asynchronous accounts services resources. The change defines service identity models, exposes account accessors, configures the services endpoint, and adds unit and end-to-end tests.

Changes

Accounts services access

Layer / File(s) Summary
Service resource and client definitions
mpt_api_client/resources/accounts/services.py
Defines ServiceIdentity, configures /public/v1/accounts/services with data collection extraction, and provides synchronous and asynchronous collection and get clients.
Account service accessors
mpt_api_client/resources/accounts/accounts.py
Imports the service clients and exposes Accounts.services and AsyncAccounts.services.
Service resource validation
e2e_config.test.json, tests/e2e/accounts/services/*, tests/unit/resources/accounts/*
Adds service ID fixtures and validates accessors, endpoint paths, supported methods, retrieval, listing, filtering, and 404 Not Found handling.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 25054

The new read-only services client has synchronous, asynchronous, unit, and end-to-end coverage in the supplied context. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Documentation Up To Date ⚠️ Warning The PR adds documented public behavior without updating the matching user documentation. The diff adds Accounts.services and AsyncAccounts.services, plus the new read-only `/public/v1/accounts/ser… Update docs/usage.md with the client.accounts.services and async usage paths, the supported get() and collection operations, and the service-identity model or endpoint reference. Update docs/architecture.md if the resource-module st…
✅ Passed checks (2 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.
Full details: Documentation Up To Date

Explanation

The PR adds documented public behavior without updating the matching user documentation. The diff adds Accounts.services and AsyncAccounts.services, plus the new read-only /public/v1/accounts/services service. The documentation rules state that public behavior maps to README.md or docs/usage.md; neither file changed, and a repository search found no accounts.services, ServicesService, or service-identity usage guidance. docs/architecture.md also remains unchanged, although it describes the resource structure. The existing generic group list does not document how to use this new public service.

Resolution

Update docs/usage.md with the client.accounts.services and async usage paths, the supported get() and collection operations, and the service-identity model or endpoint reference. Update docs/architecture.md if the resource-module structure is intended to list the new accounts service. Include any required E2E configuration guidance only if e2e_config.test.json is part of the documented test setup.

  • Fix all pre-merge checks with AI

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

@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Warnings
⚠️

This PR contains 3 commits.

Please squash them into a single commit to keep the git history clean and easy to follow.

Multiple commits are acceptable only in the following cases:

  1. One commit is a technical refactoring, and another introduces business logic changes.
  2. You are doing a complex multi-step refactoring (although in this case we still recommend splitting it into separate PRs).

✅ Found Jira issue key in the title: MPT-24263

Generated by 🚫 dangerJS against 2505450

@jentyk
jentyk force-pushed the feature/MPT-24263/add-accounts-account-users-services branch from a30a3a0 to 69f1c19 Compare August 27, 2026 08:31
@jentyk
jentyk force-pushed the feature/MPT-24263/add-accounts-account-users-services branch 2 times, most recently from 550aa77 to 1201063 Compare September 17, 2026 08:22
The accounts group had no service for the top-level
/public/v1/accounts/account-users and /public/v1/accounts/services
endpoints, so both collections were unreachable from MPTClient and
AsyncMPTClient.

Add AccountUsersService and ServicesService (plus their async mirrors)
following the existing resource-service pattern, and expose them as
`account_users` and `services` properties on both Accounts and
AsyncAccounts.

Mixins are picked from what the OpenAPI spec documents for each
endpoint rather than assuming full CRUD: account-users supports
list, create, get, delete and the invite actions but no update, and
services is read-only with list and get.

The new module is account_users.py, distinct from the pre-existing
accounts_users.py, which serves the nested
/public/v1/accounts/accounts/{account_id}/users resource.

Streaming support for these endpoints is tracked separately in
MPT-24241 and is not part of this change.

MPT-24263

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jentyk
jentyk force-pushed the feature/MPT-24263/add-accounts-account-users-services branch from 1201063 to e86bc88 Compare September 17, 2026 16:02
Cover the new ServicesService against TEST: get by id, 404 on an
unknown id, paged listing and RQL filter with iterate, in both the
sync and async flavours. Register the service identity the tests
read in e2e_config.test.json.

The account-users service gets no e2e coverage on purpose. The
endpoint is tagged AccountUsersLegacy and marked deprecated in the
OpenAPI spec served by TEST, and every route under
/public/v1/accounts/account-users answers 404 there for the vendor,
client and operations tokens, so no live test can exercise it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jentyk jentyk changed the title MPT-24263 add accounts account-users and services services MPT-24263 add accounts services service Sep 17, 2026
…ervices

Remove AccountUsersService and its async mirror before they ship. The
OpenAPI document served by TEST tags every /v1/accounts/account-users
operation AccountUsersLegacy with deprecated: true, and on TEST every
route under /public/v1/accounts/account-users answers 404 for the
vendor, client and operations tokens alike, so the service would target
an endpoint the platform no longer routes. The live replacement is the
nested /accounts/accounts/{accountId}/users family, which
AccountsUsersService already covers.

Add revision to the ServiceIdentity model to match ServiceQueryModel in
the spec and the sibling exchange models, which declare it too.

No published version exposed accounts.account_users, so this is not a
breaking change for consumers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jentyk
jentyk force-pushed the feature/MPT-24263/add-accounts-account-users-services branch from f851d20 to 2505450 Compare September 17, 2026 16:25
@sonarqubecloud

Copy link
Copy Markdown

@jentyk
jentyk marked this pull request as ready for review September 17, 2026 16:53
@jentyk
jentyk requested a review from a team as a code owner September 17, 2026 16:53
@jentyk
jentyk merged commit 816f5b0 into main Sep 18, 2026
6 checks passed
@jentyk
jentyk deleted the feature/MPT-24263/add-accounts-account-users-services branch September 18, 2026 08:10
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