Skip to content

MPT-19030 Add helpdesk chat participants service and tests#238

Open
jentyk wants to merge 1 commit intomainfrom
feat/MPT-19030
Open

MPT-19030 Add helpdesk chat participants service and tests#238
jentyk wants to merge 1 commit intomainfrom
feat/MPT-19030

Conversation

@jentyk
Copy link
Member

@jentyk jentyk commented Mar 19, 2026

Summary

  • Add ChatParticipantsService and AsyncChatParticipantsService for /public/v1/helpdesk/chats/{chat_id}/participants
  • Wire participants(chat_id) into sync and async chat services
  • Add unit tests for participants service and update chat service nested-resource tests
  • Add e2e participants test fixtures and sync/async test cases following existing helpdesk patterns

Testing

  • uv run pytest tests/unit/resources/helpdesk/test_chat_participants.py tests/unit/resources/helpdesk/test_chats.py
  • make check-all
  • e2e tests: Not run (not requested)

Closes MPT-19030

  • Added ChatParticipantsService and AsyncChatParticipantsService to manage helpdesk chat participants at /public/v1/helpdesk/chats/{chat_id}/participants
  • Wired participants(chat_id) accessors into ChatsService and AsyncChatsService for nested resource access
  • Added unit tests validating service path resolution and presence of CRUD/iterate methods for sync and async services
  • Added e2e fixtures and flaky sync/async e2e tests covering list, create, update, delete, and not-found error cases
  • Minor pyproject.toml formatting and lint ignore adjustments

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 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: 038b1c87-11a2-4b7c-82a5-42e5b02ded8a

📥 Commits

Reviewing files that changed from the base of the PR and between 00665aa and 6f113c3.

📒 Files selected for processing (9)
  • mpt_api_client/resources/helpdesk/chat_participants.py
  • mpt_api_client/resources/helpdesk/chats.py
  • pyproject.toml
  • tests/e2e/helpdesk/chats/participants/__init__.py
  • tests/e2e/helpdesk/chats/participants/conftest.py
  • tests/e2e/helpdesk/chats/participants/test_async_participants.py
  • tests/e2e/helpdesk/chats/participants/test_sync_participants.py
  • tests/unit/resources/helpdesk/test_chat_participants.py
  • tests/unit/resources/helpdesk/test_chats.py
✅ Files skipped from review due to trivial changes (3)
  • tests/unit/resources/helpdesk/test_chats.py
  • tests/unit/resources/helpdesk/test_chat_participants.py
  • tests/e2e/helpdesk/chats/participants/init.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • mpt_api_client/resources/helpdesk/chats.py

📝 Walkthrough

Walkthrough

Adds a Helpdesk Chat Participants resource (model, sync and async services), wires participants accessors into ChatsService/AsyncChatsService, and adds unit and end-to-end tests with pytest fixtures.

Changes

Cohort / File(s) Summary
New Chat Participants Resource
mpt_api_client/resources/helpdesk/chat_participants.py
Introduce ChatParticipant model, ChatParticipantsServiceConfig with endpoint /public/v1/helpdesk/chats/{chat_id}/participants, and ChatParticipantsService / AsyncChatParticipantsService providing create/update/delete and collection/list operations.
Service Integration
mpt_api_client/resources/helpdesk/chats.py
Add participants(chat_id: str) accessor methods to ChatsService and AsyncChatsService returning configured participant service instances.
Unit Tests
tests/unit/resources/helpdesk/test_chat_participants.py, tests/unit/resources/helpdesk/test_chats.py
Add tests verifying service .path, presence of CRUD/iterate methods on sync/async services, and that chats_service.participants(chat_id) returns the participant service with correct endpoint_params.
E2E Test Fixtures
tests/e2e/helpdesk/chats/participants/conftest.py
Add fixtures exposing sync/async participants services, participant payload builder, created-resource lifecycle fixtures (create/delete), and an invalid participant ID constant.
E2E Tests
tests/e2e/helpdesk/chats/participants/test_sync_participants.py, tests/e2e/helpdesk/chats/participants/test_async_participants.py, tests/e2e/helpdesk/chats/participants/__init__.py
Add flaky-marked synchronous and asynchronous E2E tests covering list, create, update, delete, and 404 negative-path scenarios.
Project Config
pyproject.toml
Formatting/whitespace adjustments and add flake8 per-file-ignores for mpt_api_client/resources/helpdesk/*.py (WPS204 WPS215); no runtime behavior changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 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-19030) in the required format at the beginning.
Test Coverage Required ✅ Passed PR modifies code files and comprehensively includes test file changes with 5 new test files and 1 updated test file.
Single Commit Required ✅ Passed The pull request contains exactly one commit with a clean git history meeting organization requirements.

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

📝 Coding Plan
  • Generate coding plan for human review comments

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

@jentyk jentyk changed the title Add helpdesk chat participants service and tests MPT-19030 Add helpdesk chat participants service and tests Mar 19, 2026
@jentyk jentyk marked this pull request as ready for review March 19, 2026 11:05
@jentyk jentyk requested a review from a team as a code owner March 19, 2026 11:05
@jentyk jentyk requested review from albertsola and robcsegal March 19, 2026 11:05
Copy link

@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 (2)
tests/e2e/helpdesk/chats/participants/test_async_participants.py (1)

14-15: Good use of synchronous def for fixture-only test; consider lint.external for AAA01.

Correctly declared as def rather than async def since there's no await statement—pytest-asyncio resolves async fixtures automatically. However, like the sync file, the # noqa: AAA01 directive triggers a Ruff warning (RUF102) because AAA01 is a flake8-aaa rule. Add it to lint.external in pyproject.toml if the plugin is active. Based on learnings: tests with async fixtures but no await should be declared as def.

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

In `@tests/e2e/helpdesk/chats/participants/test_async_participants.py` around
lines 14 - 15, The test function test_create_chat_participant is correctly
synchronous (no await) but uses a noqa for the flake8-aaa rule AAA01; update
project lint config instead of scattering noqa comments by adding "AAA01" to the
lint.external list in pyproject.toml so that the linter ignores this flake8-aaa
rule project-wide, leaving the test signature test_create_chat_participant
unchanged and removing the inline "# noqa: AAA01" directive.
tests/e2e/helpdesk/chats/participants/test_sync_participants.py (1)

14-15: Consider adding AAA01 to Ruff's lint.external configuration.

The # noqa: AAA01 directive suppresses a rule from the flake8-aaa plugin, but Ruff doesn't recognize it as a valid rule code. To avoid the RUF102 warning, add AAA01 to the lint.external list in pyproject.toml if this plugin is in use, or remove the comment if it's not needed.

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

In `@tests/e2e/helpdesk/chats/participants/test_sync_participants.py` around lines
14 - 15, The test function test_create_chat_participant contains a "# noqa:
AAA01" suppression that Ruff doesn't recognize; either add "AAA01" to the
lint.external list in pyproject.toml so Ruff accepts this external rule code or
remove the comment if flake8-aaa isn't used. Edit pyproject.toml and update the
lint.external configuration to include the string "AAA01" (or delete the "#
noqa: AAA01" from test_create_chat_participant if the rule suppression is
unnecessary).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/e2e/helpdesk/chats/participants/test_async_participants.py`:
- Around line 14-15: The test function test_create_chat_participant is correctly
synchronous (no await) but uses a noqa for the flake8-aaa rule AAA01; update
project lint config instead of scattering noqa comments by adding "AAA01" to the
lint.external list in pyproject.toml so that the linter ignores this flake8-aaa
rule project-wide, leaving the test signature test_create_chat_participant
unchanged and removing the inline "# noqa: AAA01" directive.

In `@tests/e2e/helpdesk/chats/participants/test_sync_participants.py`:
- Around line 14-15: The test function test_create_chat_participant contains a
"# noqa: AAA01" suppression that Ruff doesn't recognize; either add "AAA01" to
the lint.external list in pyproject.toml so Ruff accepts this external rule code
or remove the comment if flake8-aaa isn't used. Edit pyproject.toml and update
the lint.external configuration to include the string "AAA01" (or delete the "#
noqa: AAA01" from test_create_chat_participant if the rule suppression is
unnecessary).

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 54084ee1-d6a2-4b89-9175-f034845b0ce2

📥 Commits

Reviewing files that changed from the base of the PR and between c68796f and 00665aa.

📒 Files selected for processing (8)
  • mpt_api_client/resources/helpdesk/chat_participants.py
  • mpt_api_client/resources/helpdesk/chats.py
  • tests/e2e/helpdesk/chats/participants/__init__.py
  • tests/e2e/helpdesk/chats/participants/conftest.py
  • tests/e2e/helpdesk/chats/participants/test_async_participants.py
  • tests/e2e/helpdesk/chats/participants/test_sync_participants.py
  • tests/unit/resources/helpdesk/test_chat_participants.py
  • tests/unit/resources/helpdesk/test_chats.py
✅ Files skipped from review due to trivial changes (4)
  • tests/e2e/helpdesk/chats/participants/init.py
  • tests/unit/resources/helpdesk/test_chat_participants.py
  • tests/unit/resources/helpdesk/test_chats.py
  • tests/e2e/helpdesk/chats/participants/conftest.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • mpt_api_client/resources/helpdesk/chats.py
  • mpt_api_client/resources/helpdesk/chat_participants.py

@sonarqubecloud
Copy link

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