Files
frameledger/tests/FrameLedger.App.Tests/Update/UpdateChannelPolicyTests.cs
poli0981andClaude Opus 5.5 544a6c6202 fix(update): the channel follows the running copy, no update is applied at start behind FR-12, and the apply waits for a game still holding the Overlay (beta.14 PR-3, D47) (#265)
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>
2026-10-06 01:46:24 +07:00

35 lines
1.3 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using FluentAssertions;
using FrameLedger.App.Update;
namespace FrameLedger.App.Tests.Update;
/// <summary>
/// D47 (beta.14): the update channel follows the running copy unless the user chose one. Every release so far is a GitHub
/// pre-release, and the old default — stable — found none of them.
/// </summary>
public sealed class UpdateChannelPolicyTests
{
[Theory]
[InlineData("0.1.0-beta.14", true)]
[InlineData("0.1.0-beta.9", true)]
[InlineData("1.0.0-rc.1+abc123", true)]
[InlineData("0.1.0", false)]
[InlineData("1.2.3+build-7", false)]
[InlineData("", false)]
[InlineData(null, false)]
public void APrereleaseHasADashBeforeAnyBuildMetadata(string? version, bool prerelease) =>
UpdateChannelPolicy.IsPrerelease(version).Should().Be(prerelease);
[Theory]
[InlineData("auto", "0.1.0-beta.14", true)]
[InlineData("auto", "0.1.0", false)]
[InlineData("stable", "0.1.0-beta.14", false)]
[InlineData("beta", "0.1.0", true)]
[InlineData("auto", null, false)]
public void AutomaticFollowsTheCopyAndAChoiceWins(string channel, string? running, bool prereleases) =>
UpdateChannelPolicy.IncludesPrereleases(channel, running).Should().Be(prereleases);
}