Skip to content

add bug report, add script to download bug reports #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2025
Merged

Conversation

seveibar
Copy link
Contributor

No description provided.

Copy link

vercel bot commented May 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
capacity-node-autorouter ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2025 6:05pm

Comment on lines +73 to +74
try {
const response = await fetch(downloadUrl)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code doesn't check the HTTP response status before attempting to parse JSON. If the API returns a non-200 status (like 404 or 500), this could lead to confusing errors. Consider adding a response status check before processing:

if (!response.ok) {
  console.error(`API returned error: ${response.status} ${response.statusText}`);
  process.exit(1);
}

This would provide clearer error messages and fail gracefully when the API request doesn't succeed.

Suggested change
try {
const response = await fetch(downloadUrl)
try {
const response = await fetch(downloadUrl)
if (!response.ok) {
console.error(`API returned error: ${response.status} ${response.statusText}`)
process.exit(1)
}

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

const data = await response.json()
fs.writeFileSync(
jsonFilePath,
JSON.stringify(data.autorouting_bug_report, null, 2),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is writing data.autorouting_bug_report to the JSON file, but based on the example bug report JSON in this PR, the response data appears to be at the root level, not nested under an autorouting_bug_report property. This mismatch could cause the generated fixture file to reference incorrect or missing data. Consider either:

  1. Modifying the script to save data directly instead of data.autorouting_bug_report, or
  2. Confirming the actual API response structure to ensure it matches the expected format

This will ensure the fixture files correctly reference the bug report data structure.

Suggested change
JSON.stringify(data.autorouting_bug_report, null, 2),
JSON.stringify(data, null, 2),

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@seveibar seveibar merged commit 1bf98b3 into main May 14, 2025
6 checks passed
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.

1 participant