Skip to content

Add Complete() method to IAuditIngestionUnitOfWork - #5918

Merged
rbev merged 1 commit into
masterfrom
rhys/audit-seam-review
Sep 25, 2026
Merged

rbev merged 1 commit into
masterfrom
rhys/audit-seam-review

Conversation

@rbev

@rbev rbev commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces a new Complete method to the IAuditIngestionUnitOfWork interface and implements it across all audit ingestion unit of work classes.

Why

As preparation work for implementing audit ingestion on entity framework, this aligns the ingestion unit of work with it's sibling for error ingestion in the Primary instance.

While the current RavenDB ingestor makes use of a BulkInsertOperation that does not provide a full transactional rollback the upcoming SQL pipeline will.

API and Interface Changes

  • Added a Complete(CancellationToken cancellationToken = default) method to the IAuditIngestionUnitOfWork interface to signal when all records have been added and the unit of work should commit.
  • Implemented the new Complete method in both InMemoryAuditIngestionUnitOfWork (as a no-op, since writes are immediate) and RavenAuditIngestionUnitOfWork (which flushes and disposes the bulk insert, ensuring all records are written). [1] [2]
  • Updated AuditPersister to call unitOfWork.Complete() after persisting audit records, ensuring the commit point is respected.
  • Refactored all test usages of audit ingestion unit of work to use await using for proper disposal and replaced explicit DisposeAsync() calls with the new Complete() method, improving resource management and consistency with the new API.

@rbev
rbev added this pull request to stack #5920 September 24, 2026 06:42
@rbev
rbev marked this pull request as ready for review September 25, 2026 05:53
@rbev rbev changed the title [SQL Audit Ingestion 1] Add Complete() to IAuditIngestionUnitOfWork Add Complete() method to IAuditIngestionUnitOfWork Sep 25, 2026
@rbev
rbev merged commit 98a093f into master Sep 25, 2026
102 of 104 checks passed
@rbev
rbev deleted the rhys/audit-seam-review branch September 25, 2026 05:54
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