Files
poli0981andClaude Fable 5.2 1342979353 ci: Qodana - JetBrains' code analysis from a workflow of its own, and what its first run reported settled (D93) (#373)
* ci: Qodana - a workflow of its own from JetBrains' template, Qodana Community for .NET over FrameLedger.slnx (D93)

The first run: the linter in its Linux container, EnableWindowsTargeting passed
to it, no quality gate yet - what it builds and what it reports decides the rest.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* ci: Qodana's gate is zero problems, and the inspections this project argues with are off in .editorconfig, each with its reason (D93)

Pushed before the fixes on purpose: the run this starts has the settings and
none of the fixes, so it shows the gate failing on what is left.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: what Qodana's first run reported, settled - about 400 fixes in 181 files, none changing behaviour; the documents (D93)

Redundant qualifiers, casts, using directives, nullable suppressions and unsafe
modifiers removed from the report's own positions; var for built-in types and
one-line block bodies brought to .editorconfig's style by dotnet format; every
XAML item template names its DataType and a binding that reached its page through
DataContext.ViewModel names the page's type; two unread fields, two overwritten
initialisers and an unused parameter removed; SpokenTextAutomationPeer no longer
assumes the base peer's name is a string.

docs/13_CI_CD.md §Qodana, CLAUDE.md, the wiki's workflow table, HANDOFF's
decisions index (D93) and the changelog entry.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 16:13:04 +00:00

91 lines
5.2 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.Application.Recording;
namespace FrameLedger.Application.Tests.Recording;
/// <summary>
/// The words of <c>capture_notes</c>, read back so a row can say why it ended and, for Tier 2, why it measured nothing
/// (2026-09-22) — the three-slot guard word since beta.8, and the rows written before it.
/// </summary>
public sealed class CaptureNotesTests
{
[Fact]
public void TheThreeSlotGuardWordReadsBackWhateverIsEmpty()
{
CaptureNotes n = CaptureNotes.Parse("end=RefusedByGuard; tier2: attach=NotEvaluated; guard=BlockedModule|Easy Anti-Cheat|EasyAntiCheat_EOS.dll");
(n.End, n.GuardReason, n.GuardFamily, n.GuardSignal).Should().Be(("RefusedByGuard", "BlockedModule", "Easy Anti-Cheat", "EasyAntiCheat_EOS.dll"));
CaptureNotes familyless = CaptureNotes.Parse("end=RefusedByGuard; guard=ProcessUnreadable||Access is denied, twice");
(familyless.GuardReason, familyless.GuardFamily, familyless.GuardSignal).Should().Be(("ProcessUnreadable", null, "Access is denied, twice"));
CaptureNotes blocked = CaptureNotes.Parse("end=RefusedHookNotEnabled; guard=PreviouslyBlocked||AntiCheatDirectory|Easy Anti-Cheat|EasyAntiCheat");
blocked.GuardSignal.Should().Be("AntiCheatDirectory|Easy Anti-Cheat|EasyAntiCheat", "the signal is the last slot and keeps its own bars");
}
[Fact]
public void TheCrashReporterSlotsReadBack()
{
// beta.14: the reporter that made the session crashed, and one that was only seen.
CaptureNotes counted = CaptureNotes.Parse("end=TargetExited; exit_code=3; crash_reporter=CrashReportClient.exe");
(counted.CrashReporter, counted.CrashReporterSeen).Should().Be(("CrashReportClient.exe", null));
CaptureNotes seen = CaptureNotes.Parse("end=TargetExited; exit_code=0; crash_reporter_seen=CrashReporter.exe");
(seen.CrashReporter, seen.CrashReporterSeen).Should().Be((null, "CrashReporter.exe"));
}
[Fact]
public void TheScanAtExitSlotReadsBack()
{
// D48(b), beta.14: a session that ended as the game's exit though its last re-scan could not read the game's tree.
CaptureNotes n = CaptureNotes.Parse("end=TargetExited; exit_code=3; scan_at_exit=ProcessUnreadable");
(n.End, n.ExitCode, n.ScanAtExit).Should().Be(("TargetExited", 3, "ProcessUnreadable"));
CaptureNotes.Parse("end=TargetExited; exit_code=0").ScanAtExit.Should().BeNull();
}
[Fact]
public void TheRecorderWritesEverySlotAndNoSemicolonInsideOne()
{
CaptureNotes.GuardSlot("PreScanFailed", null, "could not list; access denied").Should().Be("guard=PreScanFailed||could not list, access denied");
CaptureNotes round = CaptureNotes.Parse("end=RefusedByGuard; " + CaptureNotes.GuardSlot("PreScanFailed", "", "could not list; access denied"));
(round.GuardReason, round.GuardFamily, round.GuardSignal).Should().Be(("PreScanFailed", null, "could not list, access denied"));
}
/// <summary>
/// A row from before beta.8: '/' between the parts and an empty family dropped, so a familyless reason's second part was its
/// signal. A finding names a family and the gate's own refusals carry a label there — that is how the two are told apart.
/// </summary>
[Fact]
public void ARowFromBeforeReadsTheSecondPartAsTheSignalUnlessTheReasonNamesAFamily()
{
CaptureNotes unreadable = CaptureNotes.Parse("end=RefusedByGuard; tier2: attach=NotEvaluated; guard=ProcessUnreadable/Access is denied");
(unreadable.GuardReason, unreadable.GuardFamily, unreadable.GuardSignal).Should().Be(("ProcessUnreadable", null, "Access is denied"),
"until beta.8 this read as a family called 'Access is denied'");
CaptureNotes bare = CaptureNotes.Parse("end=RefusedHookNotEnabled; tier2: attach=NotEvaluated; guard=HookNotEnabled/not enabled");
(bare.GuardFamily, bare.GuardSignal).Should().Be(("not enabled", null), "the gate's own label sits in the family slot");
CaptureNotes finding = CaptureNotes.Parse("end=RefusedByGuard; guard=BlockedDriver/Riot Vanguard");
(finding.GuardFamily, finding.GuardSignal).Should().Be(("Riot Vanguard", null));
CaptureNotes path = CaptureNotes.Parse("end=SafetyUnhook; guard=AntiCheatFile/BattlEye/C:/Games/BEService/BEService.exe");
path.GuardSignal.Should().Be("C:/Games/BEService/BEService.exe", "only the first two slashes split");
CaptureNotes none = CaptureNotes.Parse(null);
none.End.Should().BeNull();
CaptureNotes hooked = CaptureNotes.Parse("end=Running");
(hooked.End, hooked.GuardReason).Should().Be(("Running", null));
}
[Fact]
public void TheExitCodeTheWitnessAndTheLaunchErrorAreReadBack()
{
CaptureNotes n = CaptureNotes.Parse("end=TargetExited; exit_code=-1073741819; crash_event=application_log");
(n.ExitCode, n.CrashEvent).Should().Be((-1073741819, true));
CaptureNotes launch = CaptureNotes.Parse("end=LaunchCannotStart; launch_error=740");
(launch.LaunchError, launch.ExitCode, launch.CrashEvent).Should().Be((740, null, false));
}
}