Files
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

43 lines
1.5 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FluentAssertions;
using FrameLedger.App.Update;
namespace FrameLedger.App.Tests.Update;
/// <summary>
/// beta.14: an update waits while a game still holds a library FrameLedger loads into games. A file another process keeps
/// open stands in for a mapped image here — both refuse the exclusive write the check asks for.
/// </summary>
public sealed class PayloadInUseTests : IDisposable
{
private readonly string _dir = Path.Combine(Path.GetTempPath(), "fl-payload-" + Guid.NewGuid().ToString("N"));
public PayloadInUseTests()
{
Directory.CreateDirectory(_dir);
foreach (string name in PayloadInUse.Files)
{
File.WriteAllBytes(Path.Combine(_dir, name), [0x4D, 0x5A]);
}
}
public void Dispose() => Directory.Delete(_dir, recursive: true);
[Fact]
public void NothingHoldsThePayloadAfterTheGamesHaveExited() => PayloadInUse.Find(_dir).Should().BeNull();
[Fact]
public void AnOverlayAGameStillHoldsIsNamed()
{
using var game = new FileStream(Path.Combine(_dir, "FrameLedger.Overlay.dll"), FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
PayloadInUse.Find(_dir).Should().Be("FrameLedger.Overlay.dll");
}
[Fact]
public void AFolderWithoutThePayloadHoldsNothing() => PayloadInUse.Find(Path.GetTempPath()).Should().BeNull("a library that is not there is not in use");
}