test(reconciliation): pin inclusive (>=) cursor reads at the site (audit + site-calls); EventId/upsert dedup absorbs boundary duplicates
This commit is contained in:
@@ -712,4 +712,26 @@ public class SqliteAuditWriterWriteTests
|
||||
var row = Assert.Single(rows);
|
||||
Assert.Equal(AuditOutcome.Success, row.Outcome);
|
||||
}
|
||||
|
||||
// ── Task 24: pin the inclusive (>=) reconciliation cursor boundary ──
|
||||
|
||||
[Fact]
|
||||
public async Task ReadPendingSince_BoundaryTimestamp_IsInclusive_EventIdDedupAbsorbsDuplicates()
|
||||
{
|
||||
// Two rows share one OccurredAtUtc; a pull whose sinceUtc equals that
|
||||
// timestamp MUST return both (inclusive >= read). Central reconciliation
|
||||
// dedups on EventId (insert-if-not-exists), so re-reading the boundary row
|
||||
// is a safe no-op — but an exclusive (>) read would silently and
|
||||
// permanently lose the same-timestamp row. This test pins the >= contract.
|
||||
var (writer, _) = CreateWriter(nameof(ReadPendingSince_BoundaryTimestamp_IsInclusive_EventIdDedupAbsorbsDuplicates));
|
||||
await using var _w = writer;
|
||||
|
||||
var boundary = DateTime.UtcNow;
|
||||
await writer.WriteAsync(NewEvent(id: Guid.NewGuid(), occurredAtUtc: boundary));
|
||||
await writer.WriteAsync(NewEvent(id: Guid.NewGuid(), occurredAtUtc: boundary));
|
||||
|
||||
var rows = await writer.ReadPendingSinceAsync(boundary, batchSize: 10);
|
||||
|
||||
Assert.Equal(2, rows.Count);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user