Skip to content

Api: Add $archive-import zip enumeration#77

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

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 thread src/Ignis.Api/Controllers/ImportController.cs Outdated
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs Outdated
@losolio losolio marked this pull request as draft May 17, 2026 15:06
@losolio losolio force-pushed the feature/zip-archive-import branch 4 times, most recently from 60c9a70 to 3db0e50 Compare May 20, 2026 21:17
@losolio losolio requested a review from Copilot May 20, 2026 21:18
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Comment thread src/Ignis.Api/Controllers/ImportController.cs Outdated
Comment thread src/Ignis.Api/Controllers/ImportController.cs Outdated
Comment thread src/Ignis.Api/Controllers/ImportController.cs Outdated
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs Outdated
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs Outdated
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs Outdated
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs Outdated
@losolio losolio force-pushed the feature/zip-archive-import branch from 3db0e50 to 19acf4b Compare May 21, 2026 16:35
@losolio losolio requested a review from Copilot May 21, 2026 17:15
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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Comment thread src/Ignis.Api/Controllers/ImportController.cs
Comment thread src/Ignis.Api/Services/Import/ImportService.cs
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs Outdated
Comment thread tests/Ignis.Api.Tests/ImportControllerTests.cs
ImportController accepts a zip upload, buffers it to memory, queues
ingestion via BackgroundTaskQueue, and returns 202 Accepted with an
OperationOutcome carrying the operation id. The background worker
opens the zip as a ZipArchive, emits per-entry Progress events and
an overall Completed event on the operations hub, and surfaces
invalid zip content as a clean Error event.

A per-action upload cap (default 50 MiB, configurable via
ImportSettings:MaxUploadSizeBytes) is enforced by
ImportRequestSizeLimitFilter, which raises the per-request limit
above the global Kestrel default for this endpoint only.

Only one import runs at a time,
a second concurrent caller gets 429 Too Many Requests instead of
stacking another upload buffer ahead of the single-reader drainer.

Per-entry handling routes through an IngestEntryAsync stub that a
later slice will replace with FHIR resource parsing and ingestion.
@losolio losolio force-pushed the feature/zip-archive-import branch from 19acf4b to 6bbebc0 Compare May 21, 2026 18:20
@losolio losolio marked this pull request as ready for review May 21, 2026 18:49
@losolio losolio requested a review from kennethmyhra May 21, 2026 20:28
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