Skip to content

Api: Add $archive-import zip enumeration#77

Draft
losolio wants to merge 1 commit into
incendilabs:mainfrom
losol:feature/zip-archive-import
Draft

Api: Add $archive-import zip enumeration#77
losolio wants to merge 1 commit into
incendilabs:mainfrom
losol:feature/zip-archive-import

Conversation

@losolio
Copy link
Copy Markdown
Contributor

@losolio losolio commented May 17, 2026

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.

Copilot AI review requested due to automatic review settings May 17, 2026 14:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Progress events and a final Completed (or Error on 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 operationId argument and append to List<string> from the SignalR callback thread. This can make the test flaky (picking up messages from other operations) and List<T> is not thread-safe. Consider filtering messages by the operation id returned in the HTTP OperationOutcome, and using a thread-safe collection (or locking) for progressMessages.
        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 thread src/Ignis.Api/Services/Import/ImportService.cs Outdated
Comment thread src/Ignis.Api/Services/Import/ImportService.cs
Comment on lines +61 to +62
await using var stream = file.OpenReadStream();
await importService.ImportZipArchiveAsync(operationId, stream);
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.

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.

Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs
@losolio losolio marked this pull request as draft May 17, 2026 15:06
@losolio losolio force-pushed the feature/zip-archive-import branch from 9b8e3bb to 82bc251 Compare May 17, 2026 17:24
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.
@losolio losolio force-pushed the feature/zip-archive-import branch from 82bc251 to 88dc8f1 Compare May 17, 2026 17:32
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.

2 participants