fix(rest): create ignores the client-supplied id, per spec - #707
Merged
Conversation
Per http.html#create the server ignores the id provided in the resource and assigns its own. Honoring it made a second POST of the same document answer 409, which failed whole Synthea transaction bundles - consecutive patient bundles repeat shared Organizations/Practitioners under fixed ids as plain POST entries, so the first bundle committed and every later one refused (#448's transaction leg, 1 of 10 sample bundles). The strip happens at the REST boundary - create_handler and the one bundle-entry parser both batch and transaction go through - so the storage create contract is untouched: spec conformance seeding relies on caller-supplied ids and AlreadyExists for its idempotency, and goes straight to storage. Closes #647
Main carries two ten-argument mount_with_conformance_source sites whose fixes ride the unmerged UI PRs; this branch needs them compiling now.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
smunini
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #647.
Per http.html#create "the server ignores the id provided in the resource" and assigns its own. HFS honored the client id and answered 409 on reuse, which failed whole Synthea transaction bundles: consecutive patient bundles repeat shared Organizations/Practitioners under fixed ids as plain POST entries, so the first bundle committed and every later one refused (found in #448's transaction leg — 1 of 10 sample bundles).
Where the strip lives: the REST boundary —
create_handlerandparse_bundle_entry(the one parser both batch and transaction go through), so it covers direct POSTs and bundle POST entries on every backend in one place. The storagecreatecontract is deliberately untouched: spec conformance seeding relies on caller-supplied ids +AlreadyExistsfor its idempotency and goes straight to storage.Of the two options the issue offered (spec behavior vs. documented deviation), this takes the spec: a FHIR server that 409s standard transaction ingestion is the worse deviation, and anyone relying on client-assigned ids has PUT — which keeps update-or-create semantics unchanged.
Tests (
create_client_id.rs): the exact POST that used to 409 now answers 201 twice with distinct server ids and nothing stored under the client id; and two consecutive transactions repeating the same fixed-id Organization both commit. Fullhelios-resttargeted tests green locally.