Skip to content

Treat an unknown ACK code in an XML response as invalid - #577

Open
Hisham-InfoGleam wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
Hisham-InfoGleam:fix/560-xml-unknown-ack-code
Open

Hisham-InfoGleam wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
Hisham-InfoGleam:fix/560-xml-unknown-ack-code

Conversation

@Hisham-InfoGleam

Copy link
Copy Markdown

Part of #560 (item 2). Items 1 and 3 are not touched.

HL7v2ResponseValidator handles ER7 and XML responses in separate branches. On the ER7 path, an ACK code that is not in the successful, error or rejected lists makes the response invalid. The XML path had no such fallthrough. It left the status unchanged, so the destination stayed SENT.

This change gives the XML path the same fallthrough: the response is QUEUED with "Invalid HL7 v2.x acknowledgement received." Both paths now call one small helper for this.

Behaviour change to note
An XML response with no MSA.1 value also becomes invalid, because an empty code matches none of the lists. This matches the ER7 path, where a missing MSA segment is already invalid. Before this change, such a response kept its status.

Tests

  • testXmlUnknownAckCodeLeavesStatusUnchanged is replaced by testXmlUnknownAckCodeIsInvalid.
  • New: testXmlMissingMsaIsInvalid.
  • Both fail without the fix and pass with it.
  • ./gradlew :server:test passes locally (850 tests).

HL7v2ResponseValidator handles ER7 and XML responses in separate
branches. The ER7 branch marks a response as invalid when MSA.1 is not
one of the configured successful, error or rejected codes. The XML
branch had no such fallthrough: it left the response status unchanged,
so a destination that received an XML ACK with an unknown code stayed
SENT.

Give the XML branch the same fallthrough. The response is QUEUED with
"Invalid HL7 v2.x acknowledgement received.", as on the ER7 path. Both
branches now share one helper for this. An XML response with no MSA.1
value is invalid too, which matches a missing MSA segment in ER7.

The test that pinned the old behaviour now expects the invalid result.
A second test covers an XML response without an MSA segment.

Part of OpenIntegrationEngine#560 (item 2)

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Hisham Alrashdan <hisham@infogleam.com>
@Hisham-InfoGleam
Hisham-InfoGleam marked this pull request as ready for review November 13, 2026 05:32
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