Skip to content

fix: Resolved the code quality Issues #922

Open
Ashwal-Microsoft wants to merge 2 commits intodev-v4from
macae_code_quality_01
Open

fix: Resolved the code quality Issues #922
Ashwal-Microsoft wants to merge 2 commits intodev-v4from
macae_code_quality_01

Conversation

@Ashwal-Microsoft
Copy link
Copy Markdown

@Ashwal-Microsoft Ashwal-Microsoft commented Apr 14, 2026

This pull request simplifies the cancellation logic in two async test cases by removing unnecessary nested async functions and redundant task management. The tests now directly create and cancel the target tasks, resulting in clearer and more maintainable code.

Test simplification:

  • Refactored test_wait_for_approval_cancelled to remove the inner cancel_task coroutine and directly create and cancel the approval task, simplifying the test structure.
  • Refactored test_wait_for_clarification_cancelled in the same way, removing the inner coroutine and redundant task handle, making the test more straightforward.## Purpose
  • ...

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR aims to simplify async cancellation tests by removing nested cancellation coroutines and redundant task handles.

Changes:

  • Refactored test_wait_for_approval_cancelled to cancel the approval task directly.
  • Refactored test_wait_for_clarification_cancelled similarly to directly cancel the clarification task.
  • Adjusted indentation of a post-exception assertion in a database base test.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/tests/backend/v4/config/test_settings.py Simplifies async cancellation tests by removing nested cancellation coroutine/task handle.
src/tests/backend/common/database/test_database_base.py Indentation change around a “close should have been called” assertion after an exception.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tests/backend/v4/config/test_settings.py
Comment thread src/tests/backend/common/database/test_database_base.py Outdated
Comment thread src/tests/backend/common/database/test_database_base.py Outdated
@Ashwal-Microsoft
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

1 similar comment
@Ashwal-Microsoft
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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