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

71 lines
3.4 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.Persistence;
using FrameLedger.Application.TriState;
using FrameLedger.Domain.Consent;
using FrameLedger.Domain.Metrics;
using FrameLedger.Domain.Sessions;
namespace FrameLedger.Application.Tests.TriState;
/// <summary>FR-8.3's precedence: manual, then measured, then the game's default marked inherited, then N/A.</summary>
public sealed class TriStateResolutionTests
{
[Theory]
[InlineData(Tri.No, Tri.Yes, Tri.Yes, Tri.No, TriStateSource.Manual)]
[InlineData(Tri.NotApplicable, Tri.Yes, Tri.No, Tri.NotApplicable, TriStateSource.Manual)]
[InlineData(null, Tri.Yes, Tri.No, Tri.Yes, TriStateSource.Measured)]
[InlineData(null, Tri.No, Tri.Yes, Tri.No, TriStateSource.Measured)]
[InlineData(null, Tri.NotApplicable, Tri.Yes, Tri.Yes, TriStateSource.Inherited)]
[InlineData(null, Tri.NotApplicable, Tri.NotApplicable, Tri.NotApplicable, TriStateSource.NotApplicable)]
public void TheRule(Tri? manual, Tri measured, Tri gameDefault, Tri expected, TriStateSource source) => TriStateResolution.Resolve(manual, measured, gameDefault).Should().Be(new ResolvedTriState(expected, source));
[Fact]
public void AnExplicitManualNotApplicableIsStillManualNotAFallThrough() =>
// The user saying "N/A" is a statement (this title's RT is not classifiable), not the absence of one.
TriStateResolution.Resolve(Tri.NotApplicable, Tri.Yes, Tri.Yes).Source.Should().Be(TriStateSource.Manual);
[Fact]
public void OverStoredRowsEachKindReadsItsOwnColumns()
{
var game = new GameRow
{
Id = 1,
Name = "T",
Fingerprint = new ExecutableFingerprint { ExePath = @"C:\t.exe", SizeBytes = 1, MtimeUnixMs = 1 },
HookEnabled = false,
HookCrashCount = 0,
AddedAt = DateTimeOffset.UnixEpoch,
UpdatedAt = DateTimeOffset.UnixEpoch,
RtDefault = Tri.NotApplicable,
PtDefault = Tri.Yes,
RrDefault = Tri.No,
};
var session = new SessionRow
{
SessionGuid = Guid.NewGuid(),
GameId = 1,
SnapshotId = 1,
StartedAt = DateTimeOffset.UnixEpoch,
EndedAt = DateTimeOffset.UnixEpoch.AddMinutes(1),
QpcEpoch = 0,
QpcFrequency = 1,
Tier = CaptureTier.Hooked,
Mode = CaptureMode.Attach,
ExitStatus = ExitStatus.Normal,
RtFlag = "yes",
RtSource = "measured",
PtFlag = "na",
RrFlag = "na",
};
var annotation = new SessionAnnotation { SessionId = 1, RrOverride = Tri.Yes };
TriStateResolution.Resolve(TriStateKind.RayTracing, session, annotation, game).Should().Be(new ResolvedTriState(Tri.Yes, TriStateSource.Measured));
TriStateResolution.Resolve(TriStateKind.PathTracing, session, annotation, game).Should().Be(new ResolvedTriState(Tri.Yes, TriStateSource.Inherited));
TriStateResolution.Resolve(TriStateKind.RayReconstruction, session, annotation, game).Should().Be(new ResolvedTriState(Tri.Yes, TriStateSource.Manual));
TriStateResolution.Resolve(TriStateKind.RayReconstruction, session, null, game).Should().Be(new ResolvedTriState(Tri.No, TriStateSource.Inherited), "no annotation row at all");
}
}