Skip to content

ACAS-923: Preserve protocol experiment 404 responses#1248

Open
bffrost wants to merge 1 commit into
masterfrom
ACAS-923
Open

ACAS-923: Preserve protocol experiment 404 responses#1248
bffrost wants to merge 1 commit into
masterfrom
ACAS-923

Conversation

@bffrost

@bffrost bffrost commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Description

The route for fetching experiments by protocol code was returning 500 error when protocol didn't exist. I papered over this with acasclient code to convert 500 errors into None results, which then obfuscated real 500 errors like those caused by Java OOM errors.

The getFromACASServerInternal function (used very widely in this codebase) converts any non-200 responses into 500s, so instead of changing that ubiquitous behavior, I've added a narrow alternative that preserves status codes on responses.

This PR is part 2 of 3:

Related Issue

How Has This Been Tested?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a narrowly scoped alternative to the widely-used getFromACASServerInternal helper so that specific routes (notably experiments-by-protocol-codename) can preserve upstream HTTP status codes (e.g., 404) instead of coercing all non-200 responses into a 500.

Changes:

  • Added getFromACASServerInternalPreserveResponseStatus to return (response.statusCode, body) for any upstream response.
  • Updated the experiments-by-protocol-codename route to use the new helper so 404s remain 404s.
  • Added a Mocha spec to validate that a 404 response is preserved.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
modules/ServerAPI/src/server/routes/ServerUtilityFunctions.coffee Adds a new GET helper that preserves upstream HTTP status codes.
modules/ServerAPI/src/server/routes/ExperimentServiceRoutes.coffee Switches the protocol-codename experiments fetch to the new helper.
modules/ServerAPI/spec/serviceTests/ServerUtilityFunctionsMochaSpec.coffee Adds test coverage for preserved 404 behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +164 to 165
serverUtilityFunctions.getFromACASServerInternalPreserveResponseStatus baseurl, (statusCode, value) ->
callback(statusCode, value)
console.log 'got ajax error'
console.log error
console.log json
callback 500, {error: true, message:error}

@brianbolt brianbolt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

3 participants