Skip to content

Keep the saga ETag when an audit instance lacks the saga - #6048

Merged
warwickschroeder merged 1 commit into
masterfrom
warwick/audit-data-versioning
Oct 23, 2026
Merged

warwickschroeder merged 1 commit into
masterfrom
warwick/audit-data-versioning

Conversation

@warwickschroeder

Copy link
Copy Markdown
Contributor

What this fixes

A saga usually lives on one audit instance, and every other instance answered /api/sagas/{id} with a 204 and no ETag. The primary tried to parse that empty body, counted the instance as failed, and the merged saga history went out as incomplete with no ETag. Every audit instance now versions a missing saga, and the primary reads a 204 as an answer.

  • A missing saga reports a version on RavenDB, SQL Server and PostgreSQL, so a client holding it sees the saga when its first change arrives.
  • The primary treats a remote 204 as "found nothing", keeping the remote's ETag instead of marking the instance incomplete.
  • An older audit instance that sends no ETag still counts as answered, though the merged result then carries no version.
  • The design doc records why audit rows are versioned by CreatedOn and Id alone: they are inserted and deleted, never updated.

Tests

  • ServiceControl.Audit.Persistence.Tests (shared by all three backends): a missing saga has a version; saga and message-list versions hold across repeated reads and move when a change or message arrives, including when only Total-Count moves under an unchanged page.
  • ServiceControl.Audit.Persistence.Tests/EFCore: the message-list and saga versions move when a retention sweep and an arrival leave the count unchanged.
  • ServiceControl.Audit.Persistence.Tests.RavenDB: the message-list version moves when expiration removes a message.
  • ServiceControl.UnitTests/ScatterGather: an instance without the saga answers rather than fails, with and without an ETag.

@warwickschroeder
warwickschroeder merged commit 5ce2756 into master Oct 23, 2026
69 of 70 checks passed
@warwickschroeder
warwickschroeder deleted the warwick/audit-data-versioning branch October 23, 2026 07:39
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