Skip to content

Add opt-in durable update report replay - #543

Open
JusterZhu wants to merge 1 commit into
masterfrom
justerzhu-reliable-failure-report-retry
Open

JusterZhu wants to merge 1 commit into
masterfrom
justerzhu-reliable-failure-report-retry

Conversation

@JusterZhu

Copy link
Copy Markdown
Collaborator

Summary

  • Add an explicitly configured, disk-backed FIFO reporter and instance-based bootstrap registration; replay is host-driven and works across processes using the same queue.
  • Require HTTP success and GeneralSpace code: 200 / body: true before acknowledging reports; preserve best-effort behavior for the default reporter.
  • Document storage, authentication, ordering and delivery limitations, and cover rejection, offline recovery, duplicate delivery, corruption, concurrency, cancellation and bootstrap registration.

Delivery semantics

At-least-once, not exactly-once: a lost response or crash after acceptance can result in repeated failure counts. Server-side event IDs and deduplication are required for exactly-once effects. Ordering covers only reporters sharing the queue; the host must register the reporter in every reporting process and schedule replay. Reports are recoverable after their flushed queue file has been published, subject to filesystem durability.

Verification

  • Core builds for netstandard2.0, net8.0 and net10.0.
  • 12 focused tests passed.
  • Separate-process smoke test: terminate a worker after server acceptance, restart, replay the pending report, and verify duplicate delivery and removal.
  • Native AOT publish reached the native link step but could not complete because this environment lacks the Visual C++ platform linker. Source-generated JSON is used; existing analyzer and NuGet warnings remain.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An unhandled reporting failure can abort package processing, skip ZIP cleanup, and prevent manifest writeback and application launch even when patching succeeds.

4 open issues
What changed in this PR

Adds opt-in durable reporting to the update workflow, with disk-backed storage and host-driven replay across processes sharing a queue.

Changes:

  • Adds FIFO report persistence and replay with explicit at-least-once delivery semantics.
  • Requires HTTP and business-level success before acknowledging delivery, while retaining best-effort default reporting.
  • Adds configured reporter registration, focused tests, and operational documentation.
File Description
tests/​CoreTest/​Download/​PersistentUpdateReporterTests.cs Covers rejection, recovery, duplicates, concurrency, corruption, cancellation, and registration.
src/​GeneralUpdate.Core/​Download/​Reporting/​PersistentUpdateReporter.cs Implements disk-backed queuing, locking, and ordered replay.
src/​GeneralUpdate.Core/​Download/​Reporting/​IUpdateReporter.cs Adds strict delivery confirmation and response disposal.
src/​GeneralUpdate.Core/​Configuration/​AbstractBootstrap.cs Supports configured reporter instances and replacement registration.
README.md Documents setup, replay responsibilities, and delivery limitations.

Review effort: Balanced

{
if (File.Exists(temp)) File.Delete(temp);
}
await ReplayLockedAsync(token).ConfigureAwait(false);
public TBootstrap UpdateReporter(Download.Reporting.IUpdateReporter reporter)
{
if (reporter == null) throw new ArgumentNullException(nameof(reporter));
_instances[typeof(Download.Reporting.IUpdateReporter)] = reporter;
Comment on lines +65 to +66
using (await AcquireLockAsync(token).ConfigureAwait(false))
await ReplayLockedAsync(token).ConfigureAwait(false);
Comment on lines +62 to +67
var handler = new Handler(_ => throw new HttpRequestException("offline"));
var tasks = Enumerable.Range(1, 8).Select(async i =>
{
await Assert.ThrowsAsync<HttpRequestException>(() => Create(handler).ReportAsync(new UpdateReport(i, 3)));
});
await Task.WhenAll(tasks);
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