Files
frameledger/tests/FrameLedger.CaptureHost.Tests/Capture/NgxDriverProbeTests.cs
T
poli0981andClaude Fable 5.1 97fc9d9707 refactor(capture): promote the capture path into Application and Infrastructure -- CaptureSession over ports, the CaptureHost a thin shell (P2 PR-C) (#147)
A pure move. CaptureLoop -- every hooked session's driver since 2026-08-06
-- is now Application.Capture.CaptureSession, over ports instead of
delegates so the Agent's composition root can supply the adapters:
IRingAttacher, ITargetLivenessSource, ITargetResolver, IProcessLauncher,
IRuntimeModuleSnapshot, INgxDriverProbe, IExecutableMarkerScan. ICaptureSink,
CaptureOptions, CaptureOutcome (was CaptureResult), SessionEndReason,
SessionEndClassifier, FocusTally, RuntimeModuleSet/Info, CensusNames,
SlTagCensusNames, ExecutableMarkers/Marker, NgxDriverState/NgxOverrideFlags/
NgxProbeOutcome move beside it.

Infrastructure.Capture holds the OS adapters: ShmRingAttacher + ShmCaptureSink
over ShmRingReader (no interface, no second consumer), HeldProcessLivenessSource
+ ProcessTargetLiveness (§S29(e)), TargetResolver (path only, never a pid; its
one report line through a callback, not the host's console) + ChromiumGpuProcess,
ProcessLauncher (an instance over the Vulkan layer's environment; the duplicated
enable-variable constant is gone), RuntimeModuleSnapshot, ExecutableMarkerScan.
DrainResult moves to Shared so Application can read it.

Report text stays with the report (NgxDriverStateText, ExecutableMarkersText);
NgxDriverProbe stays in the host until PR-E2 puts it in-process. The loop's
tests move with it -- CaptureSessionTests / CaptureSessionLaunchTests in
Application.Tests, driven through the real SQLite consent adapter (a test
project on Domain's InternalsVisibleTo would be a second mint) -- and the
report fixtures are byte-identical. Two new pins: HookRequestSoleProducerTests
(no public constructor, no setter, exactly one factory) and
NoSecondRingReaderTests (nothing but ShmRingReader opens the ring).

04_CAPTURE §Frame source abstraction now describes what exists (IFrameSource
never did) and gains §Threading model; §S27 restated a second time (the loop
ships; the entry point is PR-F's); CLAUDE.md §Solution layout. Hook-path
overhead: none (managed only).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-09 19:02:43 +00:00

38 lines
1.5 KiB
C#

using FluentAssertions;
using FrameLedger.Application.Capture;
using FrameLedger.CaptureHost.Capture;
using FrameLedger.CaptureHost.Consume;
namespace FrameLedger.CaptureHost.Tests.Capture;
/// <summary>
/// The out-of-process probe as the loop calls it: every way it can fail is an outcome on the result, never a throw.
/// </summary>
public sealed class NgxDriverProbeTests
{
[Fact]
public void AMissingProbeIsAnOutcomeThatNamesThePath()
{
NgxDriverState s = NgxDriverProbe.Run(Environment.ProcessId, @"C:\nowhere\fl-probe-nvapi.exe");
s.Outcome.Should().Be(NgxProbeOutcome.ProbeMissing);
s.Detail.Should().Contain("fl-probe-nvapi.exe");
s.SrCreatedAndEvaluated.Should().BeFalse();
}
[Fact]
public void RunAgainstThisTestProcessNeverThrowsAndNeverClaimsAFeature()
{
// The real binary is staged beside the host by the project file when the native build ran
// first (CI does; a fresh clone may not). Whichever it is, this process renders nothing
// through NGX, so the only honest outcomes are the ones that say so.
NgxDriverState s = NgxDriverProbe.Run(Environment.ProcessId);
s.Outcome.Should().BeOneOf(NgxProbeOutcome.Unanswered, NgxProbeOutcome.Degraded, NgxProbeOutcome.ProbeMissing,
NgxProbeOutcome.ProbeFailed);
s.SrCreatedAndEvaluated.Should().BeFalse();
s.Readings.Should().Be(1);
s.Describe().Should().StartWith(" NVIDIA driver NGX state");
}
}