Skip to content

Conversation

@goransle
Copy link
Member

No description provided.

@goransle goransle requested a review from Copilot October 15, 2025 07:32
Copy link

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 enhances auth token handling by making token usage conditional and adds rate limit monitoring and propagation throughout the application. The changes also modify all error responses to return 200 status codes instead of 404.

  • Conditional auth token usage when token is available
  • Rate limit information extraction and propagation through response chain
  • Status code changes from 404 to 200 for error responses

Reviewed Changes

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

File Description
app/message.json Changes notFound status from 404 to 200
app/handlers.js Adds rate limit utilities and propagates rate limit metadata through request flow
app/download.js Makes auth token conditional and adds rate limit logging
app/dashboards.js Changes error status codes from 404 to 200

},
"notFound": {
"status": 404,
"status": 200,
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Changing the status code from 404 to 200 for 'Not found' responses is misleading and violates HTTP semantics. A 404 status code correctly indicates that the requested resource was not found, while 200 suggests the request was successful.

Suggested change
"status": 200,
"status": 404,

Copilot uses AI. Check for mistakes.
result = {
status: 404,
result = applyRateLimitMeta({
status: 200,
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Returning status 200 for 'Not Found' contradicts HTTP standards. The status should remain 404 to properly indicate that the requested resource was not found.

Suggested change
status: 200,
status: 404,

Copilot uses AI. Check for mistakes.
}

return { status: 404, body: 'could not find' }
return { status: 200, body: 'could not find' }
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Status code 200 is inappropriate when a file 'could not find'. This should return 404 to accurately represent that the requested resource was not found.

Suggested change
return { status: 200, body: 'could not find' }
return { status: 404, body: 'could not find' }

Copilot uses AI. Check for mistakes.
return { status: 200, file: pathOutputFile }
}).catch(() => {
return { status: 404, body: 'Server busy, try again in a few minutes' }
return { status: 200, body: 'Server busy, try again in a few minutes' }
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Status code 200 is incorrect for a server busy condition. This should return 503 (Service Unavailable) to indicate that the server is temporarily unable to handle the request.

Suggested change
return { status: 200, body: 'Server busy, try again in a few minutes' }
return { status: 503, body: 'Server busy, try again in a few minutes' }

Copilot uses AI. Check for mistakes.
}
}
return respondToClient({ status: 404, body: 'no output folder found for this commit' }, res, req)
return respondToClient({ status: 200, body: 'no output folder found for this commit' }, res, req)
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Status code 200 is misleading when no output folder is found. This should return 404 to correctly indicate that the requested resource does not exist.

Suggested change
return respondToClient({ status: 200, body: 'no output folder found for this commit' }, res, req)
return respondToClient({ status: 404, body: 'no output folder found for this commit' }, res, req)

Copilot uses AI. Check for mistakes.

if (!commit) {
res.sendStatus(404)
res.status(200).send('No matching commit or branch found')
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Returning status 200 when no matching commit or branch is found violates HTTP semantics. This should return 404 to properly indicate that the requested resource was not found.

Suggested change
res.status(200).send('No matching commit or branch found')
res.status(404).send('No matching commit or branch found')

Copilot uses AI. Check for mistakes.
})
} else {
return res.sendStatus(404)
return res.status(200).send('Unable to access cached dashboard files')
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Status code 200 is inappropriate when unable to access cached files. This should return either 404 (Not Found) if the files don't exist or 500 (Internal Server Error) if there's a server-side issue accessing them.

Suggested change
return res.status(200).send('Unable to access cached dashboard files')
return res.status(500).send('Unable to access cached dashboard files')

Copilot uses AI. Check for mistakes.
@goransle goransle marked this pull request as ready for review October 15, 2025 07:52
@goransle goransle merged commit f252724 into master Oct 15, 2025
1 check 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.

2 participants