Skip to content

Commit d76e4ea

Browse files
fix: address Copilot review comments on PR #259
- infra/main.parameters.json, infra/main.waf.parameters.json: change tags value from a string placeholder to an empty object {} to match the Bicep object parameter type and avoid deployment-time type errors. - .github/workflows/test.yml: fix coverage XML path prefixing so we don't produce paths like src/backend-api/src/app/src/app/... Use repo-root prefix (src/backend-api/ and src/processor/) and strip any leading src/ from the original filename before prefixing. - src/frontend/src/components/bottomBar.tsx: remove unused useNavigate import flagged by linting. - src/frontend/src/pages/batchView.tsx: add null guard for batchSummary before reading batchSummary.error_count to avoid render-time crashes during initial load. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2743196 commit d76e4ea

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,17 @@ jobs:
8989
python <<'PY'
9090
import xml.etree.ElementTree as ET
9191
path = "src/backend-api/reports/coverage.xml"
92-
prefix = "src/backend-api/src/app/"
92+
prefix = "src/backend-api/"
9393
tree = ET.parse(path)
9494
root = tree.getroot()
9595
for cls in root.iter("class"):
9696
fname = cls.attrib.get("filename", "")
97-
if fname and not fname.startswith(prefix):
98-
cls.attrib["filename"] = prefix + fname
97+
if not fname or fname.startswith(prefix):
98+
continue
99+
# Strip any leading "src/" so we don't double-prefix when coverage
100+
# already emits filenames like "src/app/..." relative to the cwd.
101+
normalized = fname[len("src/"):] if fname.startswith("src/") else fname
102+
cls.attrib["filename"] = prefix + "src/" + normalized
99103
tree.write(path, xml_declaration=True, encoding="utf-8")
100104
PY
101105
@@ -164,13 +168,17 @@ jobs:
164168
python <<'PY'
165169
import xml.etree.ElementTree as ET
166170
path = "src/processor/reports/coverage.xml"
167-
prefix = "src/processor/src/"
171+
prefix = "src/processor/"
168172
tree = ET.parse(path)
169173
root = tree.getroot()
170174
for cls in root.iter("class"):
171175
fname = cls.attrib.get("filename", "")
172-
if fname and not fname.startswith(prefix):
173-
cls.attrib["filename"] = prefix + fname
176+
if not fname or fname.startswith(prefix):
177+
continue
178+
# Strip any leading "src/" so we don't double-prefix when coverage
179+
# already emits filenames like "src/..." relative to the cwd.
180+
normalized = fname[len("src/"):] if fname.startswith("src/") else fname
181+
cls.attrib["filename"] = prefix + "src/" + normalized
174182
tree.write(path, xml_declaration=True, encoding="utf-8")
175183
PY
176184

infra/main.parameters.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"value": "${AZURE_ENV_IMAGE_TAG}"
4343
},
4444
"tags": {
45-
"value": "${AZURE_ENV_TAGS}"
45+
"value": {}
4646
}
4747
}
4848
}

infra/main.waf.parameters.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"value": "${AZURE_ENV_VM_SIZE}"
5858
},
5959
"tags": {
60-
"value": "${AZURE_ENV_TAGS}"
60+
"value": {}
6161
}
6262
}
6363
}

src/frontend/src/components/bottomBar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Button, Card, Dropdown, DropdownProps, Option } from "@fluentui/react-components"
22
import React from "react"
3-
import { useNavigate } from "react-router-dom"
43

54
// Define possible upload states
65
const UploadState = {

src/frontend/src/pages/batchView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ const BatchStoryPage = () => {
566566
}
567567

568568
// Show the summary page when summary is selected
569-
if (selectedFile.id === "summary") {
569+
if (selectedFile.id === "summary" && batchSummary) {
570570
// Check if there are no errors and all JSON/YAML files are processed successfully
571571
const noErrors = (batchSummary.error_count === 0);
572572
const jsonYamlFileCount = getJsonYamlFileCount();

0 commit comments

Comments
 (0)