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

  • Add ChatParticipantsService and AsyncChatParticipantsService for the /public/v1/helpdesk/chats/{chat_id}/participants endpoint, including ChatParticipant model and service config.
  • Wire participants(chat_id) accessors into ChatsService and AsyncChatsService for nested resource access.
  • Add unit tests verifying service path resolution and presence of create/update/delete/iterate methods for both sync and async participants services.
  • Add e2e fixtures and flaky sync/async e2e tests (list, create, update, delete, and not-found error cases); tests are marked skipped pending MPT-19124.
  • Update pyproject.toml formatting and add flake8 per-file-ignores for mpt_api_client/resources/helpdesk/*.py.

@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Helpdesk Chat Participants resource (model, sync and async services), wires participants(chat_id) accessors into ChatsService/AsyncChatsService, and introduces unit and end-to-end tests plus pytest fixtures; updates project lint config formatting and adds per-file flake8 ignores for helpdesk resource files.

Changes

Cohort / File(s) Summary
New Chat Participants Resource
mpt_api_client/resources/helpdesk/chat_participants.py
Add ChatParticipant model, ChatParticipantsServiceConfig (endpoint /public/v1/helpdesk/chats/{chat_id}/participants, response collection key data), ChatParticipantsService and AsyncChatParticipantsService with create/update/delete and collection/list behavior.
Service Integration
mpt_api_client/resources/helpdesk/chats.py
Import participant services and add participants(self, chat_id) accessors on 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 unit tests asserting participant service .path, presence of create/update/delete/iterate on sync/async services, and that chats_service.participants(chat_id) / async_chats_service.participants(chat_id) return services 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) for sync and async, 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 sync and async E2E tests (currently skipped) covering list, create, update, delete, and 404 negative-path scenarios.
Project Config
pyproject.toml
Whitespace/formatting adjustments; add Flake8 per-file-ignores entry for mpt_api_client/resources/helpdesk/*.py (WPS204 WPS215); Ruff formatting edits to lists; no functional 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 in the required format MPT-XXXX (MPT-19030), which is properly formatted.
Test Coverage Required ✅ Passed PR modifies 2 code files and includes 5 comprehensive test files covering unit and end-to-end tests for synchronous and asynchronous implementations.
Single Commit Required ✅ Passed The PR contains one commit that properly consolidates all changes for the helpdesk chat participants service feature.

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

@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

@jentyk jentyk force-pushed the feat/MPT-19030 branch 3 times, most recently from d90c9d0 to bddc175 Compare March 20, 2026 13:25
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.

Actionable comments posted: 1

🤖 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/helpdesk/chats/participants/test_async_participants.py`:
- Around line 15-16: Move the "# noqa: AAA01" suppression from the function
definition to the decorator line so flake8-aaa applies; update the
`@pytest.mark.skip`(...) line (above test_create_chat_participant) to include the
noqa comment (e.g., "@pytest.mark.skip(reason=...,  # noqa: AAA01") ensuring the
suppression is adjacent to the decorator that triggers AAA01.
🪄 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: 98846ec3-9a7f-47a8-81e8-fb9657cb52d5

📥 Commits

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

📒 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 (5)
  • tests/e2e/helpdesk/chats/participants/init.py
  • pyproject.toml
  • tests/unit/resources/helpdesk/test_chat_participants.py
  • mpt_api_client/resources/helpdesk/chat_participants.py
  • tests/e2e/helpdesk/chats/participants/conftest.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/unit/resources/helpdesk/test_chats.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.

2 participants