Skip to content

Commit f9a4828

Browse files
Refactor error handling and clean up unused state variables in various scripts
1 parent e9891d7 commit f9a4828

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

scripts/validate_bicep_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def parse_parameters_env_vars(json_path: Path) -> dict[str, list[str]]:
110110
data = json.loads(sanitized)
111111
params = data.get("parameters", {})
112112
except json.JSONDecodeError:
113+
# If JSON parsing fails, params remains empty and no variables will be found.
114+
# This is acceptable as the function will return an empty result dict.
113115
pass
114116

115117
# Walk each top-level parameter and scan its entire serialized value

src/backend/common/database/cosmosdb.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ async def create_batch(self, user_id: str, batch_id: UUID) -> BatchRecord:
109109

110110
self.logger.info("Returning existing batch record", batch_id=str(batch_id))
111111
return BatchRecord.fromdb(batchexists)
112+
113+
# This line should never be reached as all paths above either return or raise
114+
raise RuntimeError(f"Unexpected state while processing batch {batch_id}")
112115

113116
except Exception as e:
114117
self.logger.error("Failed to create batch", error=str(e))

src/backend/sql_agents/convert_script.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ async def convert_script(
271271
FileResult.ERROR,
272272
),
273273
)
274-
is_complete = True
275274
break
276275

277276
if comms_manager.group_chat.is_complete:

src/frontend/src/pages/modernizationPage.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,6 @@ const getPrintFileStatus = (status: string): string => {
478478
const ModernizationPage = () => {
479479
const { batchId } = useParams<{ batchId: string }>();
480480
const navigate = useNavigate();
481-
482-
// Redux state to listen for start processing completion
483-
const batchState = useSelector((state: any) => state.batch);
484481

485482
const [batchSummary, setBatchSummary] = useState<BatchSummary | null>(null);
486483
const styles = useStyles();
@@ -497,7 +494,6 @@ const ModernizationPage = () => {
497494
const [fileId, setFileId] = React.useState<string>("");
498495
const [expandedSections, setExpandedSections] = React.useState<string[]>([]);
499496
const [allFilesCompleted, setAllFilesCompleted] = useState(false);
500-
const [progressPercentage, setProgressPercentage] = useState(0);
501497
const [isZipButtonDisabled, setIsZipButtonDisabled] = useState(true);
502498
const [fileLoading, setFileLoading] = useState(false);
503499
const [lastActivityTime, setLastActivityTime] = useState<number>(Date.now());
@@ -514,7 +510,7 @@ const ModernizationPage = () => {
514510
const selectedFile = files.find((f) => f.id === selectedFileId);
515511
if (!selectedFile || !selectedFile.translatedCode) {
516512
setFileLoading(true);
517-
const newFileUpdate = await fetchFileFromAPI(selectedFile?.fileId || "");
513+
await fetchFileFromAPI(selectedFile?.fileId || "");
518514
setFileLoading(false);
519515
} else {
520516

@@ -970,13 +966,13 @@ useEffect(() => {
970966
// Set a timeout for initial loading - if no progress after 30 seconds, show error
971967
useEffect(() => {
972968
const loadingTimeout = setTimeout(() => {
973-
if (progressPercentage < 5 && showLoading) {
969+
if (showLoading) {
974970
setLoadingError('Processing is taking longer than expected. You can continue waiting or try again later.');
975971
}
976972
}, 30000);
977973

978974
return () => clearTimeout(loadingTimeout);
979-
}, [progressPercentage, showLoading]);
975+
}, [showLoading]);
980976

981977
// Poll summary status during inactivity, but do not force completion/navigation by timeout.
982978
useEffect(() => {

0 commit comments

Comments
 (0)