fix: Code Quality Fix#411
Conversation
There was a problem hiding this comment.
Pull request overview
This PR focuses on small code-quality cleanups and minor logic tweaks across the frontend and backend to reduce redundant state/assignments and make unexpected states easier to diagnose.
Changes:
- Frontend: removed unused component state and simplified the file-fetch handler + loading timeout dependencies.
- Backend: removed a redundant assignment in
convert_scriptand added an explicit “should be unreachable” error increate_batch. - Scripts: added clarifying comments around JSON parsing fallback behavior in
validate_bicep_params.py.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/frontend/src/pages/modernizationPage.tsx | Removes unused Redux/state plumbing, simplifies file loading, and adjusts the loading timeout effect dependencies. |
| src/backend/sql_agents/convert_script.py | Removes a redundant is_complete assignment immediately before a break. |
| src/backend/common/database/cosmosdb.py | Adds an explicit RuntimeError for an “unexpected/unreachable” state in create_batch. |
| scripts/validate_bicep_params.py | Adds comments clarifying behavior when JSON parsing fails in env var extraction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const ModernizationPage = () => { | ||
| const { batchId } = useParams<{ batchId: string }>(); | ||
| const navigate = useNavigate(); | ||
|
|
||
| // Redux state to listen for start processing completion | ||
| const batchState = useSelector((state: any) => state.batch); | ||
|
|
||
| const [batchSummary, setBatchSummary] = useState<BatchSummary | null>(null); |
There was a problem hiding this comment.
batchState/Redux selector usage was removed in this block, but the file still imports useSelector from react-redux (and it’s no longer referenced anywhere). This will typically trip TS/ESLint “unused import” checks—please remove the unused useSelector import (and any other now-unused Redux imports, if present).
|
🎉 This PR is included in version 1.8.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Purpose
This pull request includes several code quality improvements and minor logic corrections across the backend and frontend. The main focus is on improving error handling, simplifying state management, and removing unused or redundant code.
Backend improvements:
create_batchby adding an explicitRuntimeErrorfor unreachable code paths, making unexpected states easier to diagnose.parse_parameters_env_varsto explain behavior when JSON parsing fails, ensuring maintainability.is_completeinconvert_script, as the loop is always broken immediately after.Frontend cleanup and simplification:
batchState) andprogressPercentagestate fromModernizationPage, simplifying component state management. [1] [2]ModernizationPageby removing an unnecessary variable assignment in the file fetch handler.showLoading, making the effect less brittle and easier to understand.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information