Reject non-orchestrator job ids from $import status endpoint - #5800
Merged
Richa Bansal (rbans96) merged 4 commits intoSep 11, 2026
Merged
Conversation
GET /_operations/import/{id} threw an unhandled ArgumentNullException
(Parameter 'uriString') and returned HTTP 500 when status was requested using a
processing job id instead of the orchestrator's.
The handler fetches the job by the requested id, then reads the rest of the
group and excludes that job. When the requested id belongs to a processing job,
the excluded record is that worker rather than the orchestrator, so the
orchestrator stayed in the list and its definition was deserialized as an
ImportProcessingJobDefinition. ImportOrchestratorJobDefinition has no
resourceLocation property, so ResourceLocation was null and new Uri(null) threw.
The previous fix (#5748) tolerated the null location downstream, which stopped
the 500 but returned a partial body built from the wrong job: a null Request, the
worker's create date as TransactionTime, and the polled worker missing from its
own output. This reverts that change and enforces the contract at the entry
point instead. A processing job id was never a valid import job id, so it is now
rejected with 404, matching the behavior of the bulk delete and bulk update
status handlers, which read the group directly and are structurally immune.
The queue assigns the orchestrator a job id equal to its group id, and processing
jobs are enqueued into that same group, so Id != GroupId identifies a processing
job. CreateImportRequestHandler only ever returns the orchestrator id to callers.
Adds a unit test asserting 404 for a processing job id, and an E2E test that runs
a real import, reads a processing job id from its group, and asserts the status
endpoint returns 404 for it.
Adds a debugging rule to AGENTS.md covering invariant identification and
entry-point validation when fixing unhandled exceptions.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…mport E2E test Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5800 +/- ##
==========================================
+ Coverage 78.29% 78.85% +0.56%
==========================================
Files 1016 1016
Lines 36911 36901 -10
Branches 5617 5612 -5
==========================================
+ Hits 28898 29098 +200
+ Misses 6635 6419 -216
- Partials 1378 1384 +6 🚀 New features to boost your workflow:
|
SergeyGaluzo
approved these changes
Sep 11, 2026
Mikael Weaver (mikaelweave)
approved these changes
Sep 11, 2026
Richa Bansal (rbans96)
deleted the
rbans96-reject-non-orchestrator-import-job-ids
branch
September 11, 2026 20:08
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.
Description
GET /_operations/import/{id} threw an unhandled ArgumentNullException (Parameter 'uriString') and returned HTTP 500 when status was requested using a processing job id instead of the orchestrator's.
The handler fetches the job by the requested id, then reads the rest of the group and excludes that job. When the requested id belongs to a processing job, the excluded record is that worker rather than the orchestrator, so the orchestrator stayed in the list and its definition was deserialized as an ImportProcessingJobDefinition. ImportOrchestratorJobDefinition has no resourceLocation property, so ResourceLocation was null and new Uri(null) threw.
The previous fix (#5748) tolerated the null location downstream, which stopped the 500 but not the absolute fix.
Adds a debugging rule to AGENTS.md covering invariant identification and entry-point validation when fixing unhandled exceptions.
Related issues
Addresses #204980
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)