Api: Add $archive-import zip enumeration#77
Draft
losolio wants to merge 1 commit into
Draft
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates Ignis.Api’s $archive-import operation to open an uploaded zip stream, enumerate entries, and publish progress/completion/error events via the operations SignalR hub, with corresponding integration tests validating the hub events.
Changes:
- Replace the import service stub with zip archive enumeration + per-entry
Progressevents and a finalCompleted(orErroron invalid zip) event. - Update the import controller to pass the uploaded file stream into the import service and clarify the endpoint’s “enumeration-only” behavior in docs.
- Add integration tests that upload a valid/invalid zip and assert expected hub events are published.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/Ignis.Api.Tests/ImportControllerTests.cs | Adds SignalR-based integration tests for valid zip enumeration and invalid zip error reporting. |
| src/Ignis.Api/Services/Import/ImportService.cs | Implements zip enumeration with progress/completed/error notifications and entry-name truncation. |
| src/Ignis.Api/Services/Import/IImportService.cs | Updates the import API to accept an archive Stream and documents the new slice behavior. |
| src/Ignis.Api/Controllers/ImportController.cs | Wires the uploaded file stream into the new import method and updates endpoint documentation. |
Comments suppressed due to low confidence (1)
tests/Ignis.Api.Tests/ImportControllerTests.cs:131
- The hub callbacks ignore the
operationIdargument and append toList<string>from the SignalR callback thread. This can make the test flaky (picking up messages from other operations) andList<T>is not thread-safe. Consider filtering messages by the operation id returned in the HTTPOperationOutcome, and using a thread-safe collection (or locking) forprogressMessages.
var progressMessages = new List<string>();
var completedTcs = new TaskCompletionSource<string>();
hub.On<Guid, string, OperationProgress?>(
OperationProgressHubMethods.Progress,
(_, msg, _) => progressMessages.Add(msg));
hub.On<Guid, string>(
OperationProgressHubMethods.Completed,
(_, msg) => completedTcs.TrySetResult(msg));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+61
to
+62
| await using var stream = file.OpenReadStream(); | ||
| await importService.ImportZipArchiveAsync(operationId, stream); |
Contributor
Author
There was a problem hiding this comment.
Thanks for pointing this out. I think we should before merging this establish a background worker, and will in a separate PR do the plumbing for a background worker.
9b8e3bb to
82bc251
Compare
ImportService now opens the uploaded stream as a ZipArchive, emits a Progress event per entry plus an overall Completed event on the operations hub, and surfaces invalid zip content as a clean Error event. Per-entry handling routes through an IngestEntryAsync stub that a later slice will replace with FHIR resource parsing and ingestion. Entry names are truncated before reaching hub events.
82bc251 to
88dc8f1
Compare
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.
ImportService now opens the uploaded stream as a ZipArchive, emits a Progress event per entry plus an overall Completed event on the operations hub, and surfaces invalid zip content as a clean Error event.
Per-entry handling routes through an IngestEntryAsync stub that a later slice will replace with FHIR resource parsing and ingestion. Entry names are truncated before reaching hub events.