• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

medplum / medplum / 26255510787
92%

Build:
DEFAULT BRANCH: main
Ran 21 May 2026 10:03PM UTC
Jobs 1
Files 786
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 May 2026 09:41PM UTC coverage: 92.032%. Remained the same
26255510787

push

github

web-flow
Soft-delete draft MR on order-medication failure (#9273)

* feat(medication-order): soft-delete draft MR on order-medication failure

When `$order-medication` throws after the draft `MedicationRequest` has been
created, hard-deleting the orphan record races against vendor acceptance — if
the vendor side already created (and possibly transmitted) the prescription
before the response was lost, we lose the only local handle that an inbound
vendor webhook can use to reconcile.

Replace the hard `DELETE` in `OrderMedicationPage.submitSingle`'s `catch`
branch with `updateResource({ ...mr, status: 'unknown', statusReason })`.
The `statusReason` carries a canonical CodeableConcept built by the new
`buildMedicationRequestResponseLostStatusReason()` helper in
`@medplum/core/medication-order-utils`, which exports two new constants:

  - `MEDICATION_REQUEST_STATUS_REASON_SYSTEM`
    (`https://medplum.com/fhir/CodeSystem/medication-request-status-reason`)
  - `MEDICATION_REQUEST_STATUS_REASON_RESPONSE_NOT_RECEIVED`
    (`'response-not-received'`)

`status: 'unknown'` is a valid FHIR R4 MedicationRequest status; PUT is
idempotent so retries are safe; update failures are still swallowed so the
user sees the original error. The compound flow is untouched (it doesn't
pre-create a draft MR). `MedicationsPage` filters that hide non-active
prescriptions must treat `'unknown'` as inactive alongside `'draft'`;
vendor webhook bots that observe an order whose pending-id matches an MR
with this `statusReason` coding should transition it to the live status.

Closes the first deferred row from PR #8999 review comment r3276980997.

Tests:
- packages/core: 4 new tests for the new constants + helper shape, system
  stability, code stability, and fresh-object-per-call (35/35).
- medplum-provider: existing failure-path test rewritten to assert
  \`updateResource\` was called with \`status: 'unknown'\` + the canonical
  \`statusReason.coding[0]\` system/code, and that \`deleteResourc... (continued)

21432 of 24152 branches covered (88.74%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

35213 of 37397 relevant lines covered (94.16%)

23573.88 hits per line

Jobs
ID Job ID Ran Files Coverage
1 26255510787.1 21 May 2026 10:03PM UTC 916
92.28
GitHub Action Run
Source Files on build 26255510787
  • Tree
  • List 786
  • Changed 85
  • Source Changed 1
  • Coverage Changed 85
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #26255510787
  • 654ef728 on github
  • Prev Build on gh-readonly-queue/main/pr-9261-3cc002cc35c8ff128a7b1376c227eefa35b5b8b1 (#26253924766)
  • Next Build on main (#26313848800)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc