Skip to content

CCM-22090: Recipient response message retrieval API - #1090

Open
rhyscoxnhs wants to merge 6 commits into
releasefrom
feature/CCM-22090
Open

CCM-22090: Recipient response message retrieval API#1090
rhyscoxnhs wants to merge 6 commits into
releasefrom
feature/CCM-22090

Conversation

@rhyscoxnhs

@rhyscoxnhs rhyscoxnhs commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds proxy configuration for new recipient response message retrieval API.

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Checklist

  • Brief description of work completed, and any technical decisions made as part of the PR
  • PR link added as a comment to the relevant JIRA ticket
  • PR link shared on Slack and/or Teams
  • 2 reviews received
  • Tester approval

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

Comment thread proxies/shared/policies/ExtractVariables.MessageResponses.Get.Request.xml Outdated
Comment thread proxies/shared/policies/AssignMessage.MessageResponses.Get.Request.xml Outdated
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread specification/documentation/APIDescription.md Outdated
Comment thread specification/documentation/GetResponses.md Outdated
Comment thread specification/schemas/components/ResponseItem.yaml
Comment thread specification/responses/2xx/200_Responses.yaml Outdated
Comment thread specification/communications-manager.yaml Outdated
Comment thread sandbox/handlers/message_responses.js Outdated
Comment thread specification/schemas/responses/GetResponsesSuccess.yaml Outdated
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@rhyscoxnhs
rhyscoxnhs requested a review from cgitim August 12, 2026 10:44
Comment thread specification/documentation/GetMessageResponses.md
Comment thread specification/documentation/GetMessageResponses.md Outdated
@@ -0,0 +1,24 @@
description: |+
There are too many responses associated with this message to return in a single response. This error occurs when more than 1000 responses exist for the given message ID.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The problem with documenting this scenario is we really need some guidance on what to do in this scenario. I don't know what that guidance is though! It's raise a support query with us / NHS App but I don't think we want to document that.
My first question as a dev writing code to implement response handling is what do I do with this response code.
Baking it into the sandbox makes you think its something you'll need to deal with and test but the reality is it shouldn't ever happen.
I think we are better changing the code to return a 500 so the generic 500 documentation catches it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My personal view is if it's > HTTP 300 then it's an error, as an integrator you'd log it and go through failure handling. I'd personally treat any 4xx other than a 401 / 403 as an explicit error.

Technically that would be the case in this situation, we should never realistically have > 1000 responses, but also you could argue that this wouldn't always be our failure, it could be upstream triggering it.

I'm leaning towards a 500 being the right call, but it does imply a critical failure with our system. Is that appropriate?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It could be a failure with our system (e.g. rogue response event is processed multiple times) or more likely a failure with the NHS App. Either way it isn't the clients fault and we probably need to take responsibility for it.
What do you think @cgitim ?

@rhyscoxnhs rhyscoxnhs Aug 14, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I think that's a good point - 4xx usually implies it's the fault of the caller of the API, whereas 5xx implies the inverse. This makes me lean much more towards a 5xx error code, although 500 still implies a crash or some critical fault in my view.

Maybe a 503 is more appropriate? It does indicate a bit more clearly that this is a temporary, resolvable situation.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think its that temporary or retryable. We'll need a fairly hard change at our end do something about it.
I think we did discuss it in refinement and the ticket does have "If >100 responses are received return a 500"
https://nhsd-jira.digital.nhs.uk/browse/CCM-22090

Comment thread specification/endpoints/get_responses.yaml Outdated
Comment thread specification/responses/4xx/message_responses/400_UnableToGetResponses.yaml Outdated
Comment thread specification/schemas/enums/ErrorTooManyResponses.yaml Outdated
Comment thread sandbox/handlers/message_responses.js
Comment thread specification/documentation/APIDescription.md Outdated
Comment thread tests/sandbox/message_responses/test_success.py
@github-actions

Copy link
Copy Markdown

This branch is work on a ticket in the NHS Digital APM JIRA Project. Here's a handy link to the ticket:

CCM-22090

@rhyscoxnhs
rhyscoxnhs requested a review from mjewildnhs August 14, 2026 13:37

@mjewildnhs mjewildnhs left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I've paused reviewing until we get an answer on whether we should be following the JSON:API convention as per my review comment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The error responses we are re-using all have CM_ prefix error codes.
I think we still need to take an decision on our deviation away from the JSON:API convention used by the other endpoints.
Does CM_ stand for comms-mgr?
I think its this list of error codes: https://github.com/NHSDigital/comms-mgr/blob/main/packages/libs/ingestion-lib/src/error-responses.ts#L95-L94
As it stands we are re-using the following error codes:

401 Access denied → CM_DENIED
403 Forbidden → CM_FORBIDDEN or CM_SERVICE_BAN
404 Not found → CM_NOT_FOUND
405 Method not allowed → CM_NOT_ALLOWED
408 Request timeout → CM_TIMEOUT
415 Unsupported media → CM_UNSUPPORTED_MEDIA
429 Too many requests → CM_QUOTA
500 Internal server error → CM_INTERNAL_SERVER_ERROR
503 Service unavailable → CM_SERVICE_UNAVAILABLE
504 Service timeout → CM_TIMEOUT

We'd need to check what error message and what API gateway does for some of these scenarios.

However I think for now we need to stop and have a conversation about our deviation from the JSON:API convention before making further change.
I suspect we don't want to return CM_ errors which would be a bit annoying as the CM_ errors have occupied specification/schemas/enums and might need moving/scoping.

If none of the JSON:API stuff has been discussed already then I think we need some input from @cgitim

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