Repository navigation
Fix continuous history export skipping out-of-order completions - #830
Bernd Verst (berndverst) wants to merge 2 commits into
Conversation
Scope creation-order pagination to persistent completion-time windows. Adopt the new traversal at a replay-safe continue-as-new boundary and reconcile legacy checkpoints from their original completion filter. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The README overstates recovery of out-of-order completions and needs to document export gaps caused by delayed visibility or clock skew, advising users to retain source histories and reconcile exports before purging.
1 open issue
What changed in this PR
Addresses #827 by replacing continuous history export’s lifetime creation-order cursor with fixed completion-time windows, allowing later completions of earlier-created instances to be found.
Changes:
- Persist completion-window bounds alongside pagination checkpoints.
- Enable the new traversal for new runners and migrate existing runners at continue-as-new boundaries.
- Add regression coverage and document migration, repeated writes, and counter semantics.
| File | Description |
|---|---|
test/ExportHistory.Tests/Orchestrations/ExportJobOrchestratorTests.cs |
Tests out-of-order completions, window pagination, recovery, and legacy behavior. |
test/ExportHistory.Tests/Models/ExportCheckpointTests.cs |
Tests legacy deserialization and window-checkpoint round trips. |
test/ExportHistory.Tests/Entity/ExportJobTests.cs |
Verifies new runners enable completion-time windows. |
src/ExportHistory/Orchestrations/ExportJobOrchestrator.cs |
Implements window traversal and replay-safe adoption. |
src/ExportHistory/Models/ExportCheckpoint.cs |
Adds nullable completion-window bounds. |
src/ExportHistory/Entity/ExportJob.cs |
Enables window traversal when scheduling runners. |
samples/ExportHistoryWebApp/README.md |
Documents continuous traversal, migration, and repeated-export semantics. |
Review effort: Balanced
Use null-conditional checkpoint key access and document potential export gaps from delayed query visibility or clock skew, including reconciliation before purging. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Traversal completeness relies on DTS visibility and completion-timestamp guarantees not established by public contracts, requiring maintainer confirmation and live-service validation beyond mocked regressions.
No open issues 🎉
1 resolved since last review
Review effort: Balanced

Summary
What changed?
ExportCheckpointwith nullableCompletedTimeFromandCompletedTimeToproperties. Keep both bounds fixed while paging; preserve them alongside the cursor across entity checkpoints and continue-as-new.ExportJobRunRequest.UseCompletionTimeWindows. Newly scheduled runners enable it immediately; legacy inputs default tofalseand adopt it at their next continue-as-new boundary.completedTimeFrominstead of retaining a cursor that may already have skipped instances.Why is this change needed?
Example
Issues / work items
Project checklist
release_notes.mdRelease-note and backport decisions are left to maintainers. Automated SDK regression coverage is included; a live DTS end-to-end test was not run.
AI-assisted code disclosure (required)
Was an AI tool used? (select one)
If AI was used:
src/ExportHistory/Models/ExportCheckpoint.cs,src/ExportHistory/Orchestrations/ExportJobOrchestrator.cs,src/ExportHistory/Entity/ExportJob.cs, the corresponding checkpoint/entity/orchestration tests, andsamples/ExportHistoryWebApp/README.md.AI verification (required if AI was used):
Checked verification items describe agent verification; the human understanding/approval item remains unchecked for the author/reviewer.
Testing
Automated tests
dotnet test test\ExportHistory.Tests\ExportHistory.Tests.csproj --no-restore --verbosity quiet— passed, 163 tests, 0 failed, 0 skipped.dotnet build src\ExportHistory\ExportHistory.csproj --no-restore --verbosity quiet -clp:ErrorsOnly— passed for the project'snet6.0,net8.0, andnet10.0targets. Latest incremental run: 0 warnings, 0 errors.git --no-pager diff --check— passed.Added coverage includes:
Manual validation (only if runtime/behavior changed)
Notes for reviewers
context.CurrentUtcDateTime: replay-safe, but not a server-issued snapshot watermark. If an instance becomes query-visible only after its window has been scanned, with a completion timestamp older than the advanced lower bound, it can still be omitted. Worker/service clock skew can create a similar situation. The public listing/protobuf contract does not establish a stable snapshot or bounded visibility delay, and the mocked regression assumes immediate visibility. Please confirm DTS guarantees before treating this as unconditional lossless export.ExportedInstancescounts successful operations, not unique blobs.UseCompletionTimeWindows = false, retaining their current sequence of activity/entity/timer calls. The next continue-as-new suppliestrue; persisted window checkpoints then survive later restarts. No nondeterministic clock or I/O was introduced into the new orchestration path.Breaking Change
Type: behavioral
Impact: Continuous export adopts completion-time-window traversal and legacy-checkpoint reconciliation. Reconciliation and inclusive-boundary overlap can repeat export operations and increase counters while preserving idempotent blob destinations.
Migration: Upgrade the worker, allow existing jobs to reach their next continue-as-new boundary, and retain source histories during reconciliation. Consumers must not interpret export-operation counters as a count of distinct destination blobs.