Skip to content

fix: fixed CodQL issues for Container Migration.#210

Merged
Roopan-Microsoft merged 4 commits intodevfrom
psl-codequlity-cmv2
May 7, 2026
Merged

fix: fixed CodQL issues for Container Migration.#210
Roopan-Microsoft merged 4 commits intodevfrom
psl-codequlity-cmv2

Conversation

@VishalS-Microsoft
Copy link
Copy Markdown
Contributor

Purpose

This pull request includes a variety of improvements and refactors across both backend and frontend codebases, primarily focused on code cleanup, dependency injection simplification, and UI logic streamlining. The changes remove unused code, clarify error handling, and standardize service registration. There are also minor bug fixes and improvements to error/warning rendering and file processing logic in the frontend.

Backend Improvements

  • Dependency Injection:
    • Simplified singleton registration for InMemoryDataService by passing the class directly instead of a lambda in both application.py and its corresponding test, ensuring consistent DI behavior. [1] [2]
  • Base Logic Refactoring:
    • Fixed the method signature for execute in SKLogicBase to include self, and replaced placeholder ellipses with pass in overloads for execute_thread, clarifying abstract method expectations. [1] [2] [3]
  • Protocol and Parsing:
    • Added a body to include_router in FastAPIWithContext for better type checking, and clarified comments in JSON parsing error handling in validate_bicep_params.py. [1] [2]

Frontend Improvements

  • UI Logic Cleanup:
    • Removed unused or redundant state and functions in components such as batchView.tsx, uploadButton.tsx, and landingPage.tsx, streamlining file selection, warning rendering, and upload state handling. [1] [2] [3] [4] [5] [6] [7]
    • Removed unused imports and variables across several frontend files for clarity and maintainability. [1] [2] [3] [4] [5] [6]
  • Error and Progress Handling:
    • Improved error filtering logic in renderErrorContent to check for error count greater than zero, and adjusted progress modal logic to show 100% on completion regardless of error state. [1] [2]
  • Batch History Refactor:
    • Removed unused batch categorization logic and standardized header declaration in batchHistoryPanel.tsx. [1] [2]
  • Miscellaneous:
    • Updated logic in main.jsx to avoid always using defaultConfig and instead use the loaded config if available.
    • Removed a large unused function for file status tracking in modernizationPage.tsx.
    • Minor logic correction in config endpoint to remove unused variable.

These changes collectively enhance code clarity, maintainability, and reliability across the project.

Does this introduce a breaking change?

  • Yes
  • No

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.

What to Check

Verify that the following are valid

  • ...

Other Information

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
application.py34340%1–2, 4–11, 16–17, 20–21, 24, 30–31, 33–34, 36, 44, 50, 52, 60–62, 65, 74, 81–82, 84, 91, 139–140
libs/base
   SKLogicBase.py46460%1–2, 4–5, 14–15, 18, 21–24, 28, 35–36, 38–40, 42–43, 56–57, 59–60, 64–65, 69, 71, 76, 78, 82, 84–85, 87–88, 95, 97–98, 105, 107–108, 114, 116–120
   fastapi_protocol.py10100%4, 6–7, 10, 16, 19–20, 23, 36–37
TOTAL274024789% 

Tests Skipped Failures Errors Time
44 0 💤 0 ❌ 0 🔥 16.220s ⏱️

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

This PR aims to clean up and harden the container-migration codebase by removing dead code, replacing silent exception swallowing with debug logging, and simplifying a handful of frontend/backend typing and DI paths.

Changes:

  • Replaced several bare pass exception handlers with debug logging across processor and backend helpers.
  • Simplified backend DI/type-hint code and removed unused code/imports in multiple frontend pages/components.
  • Adjusted frontend status/progress rendering and config/bootstrap logic.

Reviewed changes

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

Show a summary per file
File Description
src/processor/src/utils/agent_telemetry.py Removes commented-out code, adds explicit None return, and logs previously swallowed exceptions.
src/processor/src/tests/conftest.py Clarifies the intentional sitecustomize side-effect import for tests.
src/processor/src/steps/migration_processor.py Replaces silent exception swallowing with debug logging and adds an explicit trailing return.
src/processor/src/services/queue_service.py Adds debug logging around best-effort shutdown/cancellation paths.
src/processor/src/services/control_api.py Adds debug logging during control API shutdown cleanup.
src/processor/src/libs/reporting/migration_report_generator.py Logs file-size lookup failures instead of swallowing them.
src/processor/src/libs/mcp_server/mermaid/mcp_mermaid.py Documents why non-JSON Mermaid CLI output is ignored.
src/processor/src/libs/mcp_server/datetime/mcp_datetime.py Removes unreachable fallback returns in error paths.
src/processor/src/libs/agent_framework/qdrant_memory_store.py Logs collection-delete failures during close.
src/processor/src/libs/agent_framework/azure_openai_response_retry.py Logs response-stream close failures.
src/processor/src/libs/agent_framework/agent_framework_helper.py Replaces overload stub ellipses with pass.
src/frontend/vite.config.js Removes an unused path import.
src/frontend/src/pages/processPage.tsx Removes unused imports/state from the process page.
src/frontend/src/pages/modernizationPage.tsx Cleans up state/helpers and changes summary/progress rendering logic.
src/frontend/src/pages/landingPage.tsx Removes unused UI code and changes start-translation navigation handling.
src/frontend/src/pages/batchView.tsx Removes unused warning/content helpers and slightly simplifies summary branching.
src/frontend/src/msal-auth/apiHeaders.ts Removes an unused MSAL import.
src/frontend/src/main.jsx Tweaks config bootstrap to prefer loaded config over an unconditional default.
src/frontend/src/components/uploadButton.tsx Removes unused imports/state/helper code from upload UI.
src/frontend/src/components/bottomBar.tsx Removes an unused React hook import.
src/frontend/src/components/batchHistoryPanel.tsx Cleans up formatting and removes unused batch categorization code.
src/frontend/src/commonComponents/ProgressModal/progressModal.tsx Adjusts completion-progress calculation logic.
src/frontend/src/api/utils.tsx Tightens error-file filtering to explicit positive counts.
src/frontend/frontend_server.py Removes unused response/import variables from the frontend server.
src/backend-api/src/tests/application/test_dependency_injection.py Updates DI test registration to use the class directly.
src/backend-api/src/app/libs/base/SKLogicBase.py Fixes execute signature and replaces overload ellipses with pass.
src/backend-api/src/app/libs/base/fastapi_protocol.py Gives the protocol’s include_router stub an explicit body.
src/backend-api/src/app/application.py Simplifies singleton registration for InMemoryDataService.
scripts/validate_bicep_params.py Clarifies the JSON parse fallback comment.

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

Comment thread src/frontend/src/pages/modernizationPage.tsx
Comment thread src/frontend/src/commonComponents/ProgressModal/progressModal.tsx Outdated
Comment thread src/frontend/src/pages/modernizationPage.tsx Outdated
Co-authored-by: Copilot <copilot@github.com>
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

Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.

Comment thread src/frontend/src/pages/modernizationPage.tsx
Comment thread src/frontend/src/pages/modernizationPage.tsx
Comment thread src/backend-api/src/app/libs/base/SKLogicBase.py
Comment thread src/frontend/frontend_server.py
@Roopan-Microsoft Roopan-Microsoft merged commit f9b4b68 into dev May 7, 2026
16 checks passed
@Roopan-Microsoft Roopan-Microsoft deleted the psl-codequlity-cmv2 branch May 7, 2026 10:57
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