fix: code quality issue#266
Open
Priyanka-Microsoft wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes small code-quality cleanups across the repo, primarily simplifying test registrations in the processor’s AppContext unit tests and removing unused imports in both backend and frontend.
Changes:
- Simplifies
AppContexttest registrations by passing class references directly instead of lambdas. - Adds a clarifying comment during async task cancellation cleanup in a queue service internal test.
- Removes unused imports in a backend test and a frontend component.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/processor/src/tests/unit/services/test_queue_service_internals.py |
Adds a comment in a cancellation cleanup block while awaiting a cancelled task. |
src/processor/src/tests/unit/libs/application/test_application_context_extras.py |
Simplifies singleton registration in tests by passing class references instead of lambda factories. |
src/frontend/src/components/batchHistoryPanel.tsx |
Removes unused useSelector import. |
src/backend-api/src/tests/base/test_sk_logic_base.py |
Removes unused Type import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
189
to
+192
| try: | ||
| await task | ||
| except (asyncio.CancelledError, Exception): | ||
| pass | ||
| pass # Expected during task cancellation cleanup |
Comment on lines
119
to
122
| def test_create_async_instance_with_callable_factory(): | ||
| async def _run(): | ||
| ctx = AppContext().add_async_singleton(_AsyncSvc, lambda: _AsyncSvc()) | ||
| ctx = AppContext().add_async_singleton(_AsyncSvc, _AsyncSvc) | ||
| a = await ctx.get_service_async(_AsyncSvc) |
Comment on lines
153
to
156
| def test_create_instance_with_factory_callable(): | ||
| ctx = AppContext().add_singleton(_S, lambda: _S()) | ||
| ctx = AppContext().add_singleton(_S, _S) | ||
| a = ctx.get_service(_S) | ||
| assert isinstance(a, _S) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request includes minor test and import cleanup changes across both backend and frontend code. The main updates are simplifications in test factories, a comment clarification, and a small frontend import cleanup.
Test code simplifications:
test_application_context_extras.pyto pass class references directly instead of using lambda factories for singleton registration, making the tests clearer and more concise. [1] [2]test_queue_service_internals.py.Type) intest_sk_logic_base.py.Frontend code cleanup:
useSelectorimport frombatchHistoryPanel.tsx.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information