Owner request 2026-10-05: audit the update logic (no failure reported). Read against Velopack 1.2.0 and the owner's own updater log. - update.channel defaulted to stable while every release is a GitHub pre-release: a copy left on its defaults never found one (the log: "No releases found" since the ledger reset). Owner decision D47: default `auto` (choices auto/stable/beta) - UpdateChannelPolicy: a pre-release copy asks for pre-releases, a release for releases; a stored stable/beta wins. Settings lists "Automatic (Beta)". - VelopackApp applied a downloaded package at the next start (SetAutoApplyOnStartup is ON by default) inside Run(), before FR-12 and the Agent's stop - the log shows the Agent killed. Off now; the package is adopted at start (UpdateService.AdoptPending over UpdateManager.UpdatePendingRestart, no feed request) and goes Ready/Deferred like any other. - OnBeforeUpdateFastCallback asks the Agent to stop before Velopack replaces the version (installer over an installed copy); Velopack's diagnostics go to the App's log (VelopackSerilogLogger). - The apply waits while a game still has FrameLedger.Overlay.dll (or the Vulkan layer) loaded from the install folder (PayloadInUse: a mapped image refuses an exclusive write; no process opened), and while an Agent waits on the administrator prompt (ElevationMarker, beside the instance lock). - Stop budget = IpcProtocol.AgentShutdownGrace (15 s, the Agent's host reads it too) + 5 s; was 10 s. - The offer states the delta's size (UpdateInfo.DeltasToTarget) with the full package as fallback. - IOException is Offline only from the network (HttpIOException, a socket error); the uninstaller removes the "Start FrameLedger with Windows" Run value. Tests: UpdateChannelPolicyTests, UpdateServiceTests (pre-release copy asks for pre-releases; a stable choice wins; a pending package is Ready without a feed request and applies; deferred under a session; a held Overlay keeps it Ready, leaves the Agent alone and says why; the elevation marker holds the folder; the stop budget outlasts the grace), VelopackHooksTests (private fields of the pinned 1.2.0 builder: _autoApply false, the logger, the before-update hook), UpdatePromptsTests, PayloadInUseTests, UpdateFailureMapperTests, UninstallHookTests, SettingsViewModelTests, SettingsRegistryTests. Strings en/vi/ja (ja marked review). Docs: 11_UPDATER (the update audit, beta.14), 06_DATA_MODEL, 08_UI, 12_BUILD, LIMITATIONS, guide/01-install, CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
3.0 KiB
C#
51 lines
3.0 KiB
C#
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
|
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Net.Sockets;
|
|
using FluentAssertions;
|
|
using FrameLedger.App.Update;
|
|
using Velopack.Exceptions;
|
|
|
|
namespace FrameLedger.App.Tests.Update;
|
|
|
|
/// <summary><c>11_UPDATER</c> §Error mapping, row by row, from the exception the client threw — including one wrapped by a source.</summary>
|
|
public sealed class UpdateFailureMapperTests
|
|
{
|
|
public static TheoryData<Exception, UpdateFailure> Rows => new()
|
|
{
|
|
{ new HttpRequestException("gone", null, HttpStatusCode.NotFound), UpdateFailure.NotFound },
|
|
{ new HttpRequestException("quota", null, HttpStatusCode.Forbidden), UpdateFailure.RateLimited },
|
|
{ new HttpRequestException("quota", null, HttpStatusCode.TooManyRequests), UpdateFailure.RateLimited },
|
|
{ new HttpRequestException("down", null, HttpStatusCode.ServiceUnavailable), UpdateFailure.Server },
|
|
{ new HttpRequestException("down", null, HttpStatusCode.BadGateway), UpdateFailure.Server },
|
|
{ new HttpRequestException("no such host"), UpdateFailure.Offline },
|
|
{ new TaskCanceledException("timeout"), UpdateFailure.Offline },
|
|
{ new SocketException(10060), UpdateFailure.Offline },
|
|
{ new TimeoutException(), UpdateFailure.Offline },
|
|
{ new HttpIOException(HttpRequestError.ResponseEnded, "the response ended prematurely"), UpdateFailure.Offline },
|
|
{ new System.IO.IOException("Unable to read data from the transport connection", new SocketException(10054)), UpdateFailure.Offline },
|
|
// beta.14: an I/O error that is not the network's — a full disk, a file held by another process — is not "offline".
|
|
{ new System.IO.IOException("There is not enough space on the disk."), UpdateFailure.Unknown },
|
|
{ new InvalidOperationException("wrapped by the source", new HttpRequestException("gone", null, HttpStatusCode.NotFound)), UpdateFailure.NotFound },
|
|
{ new HttpRequestException("odd", null, HttpStatusCode.Unauthorized), UpdateFailure.Unknown },
|
|
{ new InvalidOperationException("no idea"), UpdateFailure.Unknown },
|
|
{ new ChecksumFailedException("FrameLedger-0.2.0-full.nupkg", "hash mismatch"), UpdateFailure.Corrupt },
|
|
};
|
|
|
|
[Theory]
|
|
[MemberData(nameof(Rows))]
|
|
public void TheExceptionMapsToItsRow(Exception exception, UpdateFailure expected) => UpdateFailureMapper.Map(exception).Should().Be(expected);
|
|
|
|
[Fact]
|
|
public void TheClientsExceptionCarriesTheRowAndTheCause()
|
|
{
|
|
var cause = new HttpRequestException("gone", null, HttpStatusCode.NotFound);
|
|
var ex = new UpdateException(UpdateFailureMapper.Map(cause), cause.Message, cause);
|
|
ex.Failure.Should().Be(UpdateFailure.NotFound);
|
|
ex.InnerException.Should().BeSameAs(cause);
|
|
new UpdateException("bare").Failure.Should().Be(UpdateFailure.Unknown, "the standard constructors classify nothing");
|
|
}
|
|
}
|