Skip to content

ID-240: add client and server update and delete tests - #47

Merged
karlnaden merged 14 commits into
mainfrom
id-240-update-and-delete
Oct 13, 2026
Merged

karlnaden merged 14 commits into
mainfrom
id-240-update-and-delete

Conversation

@karlnaden

@karlnaden karlnaden commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds tests for FHIR Subscription update (PUT and PATCH (json)) and delete transactions to both the Subscriptions client and server tests.

Additionally it

  • upgrades to the latest version of inferno_core
  • updates the client suite Subscription endpoints to return FHIR OperationOutcomes
  • adds "no_custom_extension" validator definitions so that when testers provide content (Subscription for server tests, Notifications for client tests) custom extensions are not allowed.

Testing Guidance

  • Run the client and server tests against each other to demonstrate the update and delete tests.
  • Add custom extensions to the Subscription and Notification and confirm that
    • The Subscription extensions cause errors on the server tests but only warnings on the client tests
    • The Notification extensions cause errors on the client tests but only warnings on the server tests

Subscription Workflow" group first.
)

JSON.parse(creation_requests.first.response_body)['id']

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.

.first returns the oldest successful Subscription creation in the session. The group description says to re-run "Demonstrate the Subscription Workflow" before re-running this group. But after that re-run, .first still points at the Subscription this group already deleted. So the PUT test's read gets a 404/410 and fails.

The subscription_creation tag is also shared with the event-notification groups, so this isn't necessarily the workflow group's Subscription anyway. Could this use .last, with the descriptions changed to say "the most recently created Subscription"? A spec for the re-run case would be good too.

Suggested change
JSON.parse(creation_requests.first.response_body)['id']
JSON.parse(creation_requests.last.response_body)['id']

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

addressed - add a specific "workflow" tag so that there's only ever one subscription tagged in this way and added a spec test to help ensure future updates don't change that.

current_status = current_subscription_status_code(current_subscription)
current_hash = current_subscription.source_hash.deep_dup.merge('status' => current_status)
Hana::Patch.new(patch).apply(current_hash)
rescue Hana::Patch::Exception, Hana::Pointer::Exception => e

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.

parse_json_patch only checks that each operation has a string op. Hana reads value and from with Hash#fetch, so a patch like [{"op":"add","path":"/reason"}] raises KeyError. That isn't rescued here, so the client gets a 500 instead of a 4xx. Could we add KeyError to the rescue and add a spec for a missing value?

Suggested change
rescue Hana::Patch::Exception, Hana::Pointer::Exception => e
rescue Hana::Patch::Exception, Hana::Pointer::Exception, KeyError => e

@karlnaden karlnaden Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There were other potential issues that didn't raise a KeyError, so implemented this with some manual checks before sending to Hana in added a broad rescue around it.

@karlnaden
karlnaden marked this pull request as ready for review October 13, 2026 12:08
@karlnaden
karlnaden requested a review from ljtucker October 13, 2026 12:08

@ljtucker ljtucker 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.

Image All changes look good. There was one error on the testing scenario "Notification bundle extensions should cause errors in Client Suite but Warnings in Server Suite" as seen above, but given that the error was specifically about my use of a dummy URL, not sure if it really applies.

@karlnaden

Copy link
Copy Markdown
Contributor Author

All changes look good. There was one error on the testing scenario "Notification bundle extensions should cause errors in Client Suite but Warnings in Server Suite" as seen above, but given that the error was specifically about my use of a dummy URL, not sure if it really applies.

Reproduced that server suite error and it is mirrored on the client suite with the additional "no custom extensions" error, so it is fine.

@karlnaden
karlnaden merged commit 03a887f into main Oct 13, 2026
8 checks passed
@karlnaden
karlnaden deleted the id-240-update-and-delete branch October 13, 2026 16:41
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