Commit Graph
10 Commits
Author SHA1 Message Date
poli0981andClaude Fable 5.2 c4318b69d5 feat(telemetry): the reader behind Advanced metrics - one for the Agent, on its own thread, only while held; LibreHardwareMonitor's card, processor, memory and board groups; measured before anything composes it (Advanced PR-3, D103/D107) (#389)
Nothing calls it yet: no Agent code composes the reader, so nothing a user
sees or records changes.

- Application.Advanced: the port IAdvancedHardware (Acquire, Latest,
  ReadSessionFacts), AdvancedSnapshot, AdvancedSources and the status of
  each source - Reading, NotPresent, NotElevated, PawnIoMissing, Faulted.
  A source that is not there is a state, never an exception and never a
  value in its place.
- Infrastructure: AdvancedHardwareHub - one reader for the whole Agent on
  a thread of its own (fl-advanced), started by the first holder and
  closed a linger after the last lets go (D107), so a PC idling with
  FrameLedger in the tray reads nothing for this. AdvancedHardwareReader -
  one tick of NVAPI and of LibreHardwareMonitor. LhmAdvancedReader over a
  Computer of its own: every sensor of the graphics card, and as
  administrator with PawnIO the processor, memory and motherboard groups
  (D103). LhmGroups has a member for those four and no other.
- Storage is not opened (D103's outcome, written before any run):
  LibreHardwareMonitor 0.9.6's StorageGroup lists every drive through
  DiskInfoToolkit with no filter by bus and follows drives plugged in
  later. lhm.storage.* is Deferred in the catalog; a drive's temperature
  will read N/A with that reason.
- A device that throws twice is left alone and the others go on; NVAPI
  answering with no field twice running, after it had answered, is
  released and initialised again once (20_OPEN_QUESTIONS M12).
- FrameLedger.CaptureHost probe-advanced (unshipped): runs that reader on
  the caller's own rights and prints what it read and what it cost. On the
  dev box (RTX 5080, unelevated): 35 facts, 58 readings a tick; one NVAPI
  live read 0.4 ms of processor time; one refresh of the sensor library's
  graphics-card group 14 ms (62 ms elapsed) - 1.4% of one core at one a
  second, above NFR-2. So NVAPI is read every tick and the sensor library
  every fifth (0.28%), with no value repeated between.
- The same refresh is what the L2 telemetry layer does once a second in
  every session. That cost is not this train's: recorded as
  20_OPEN_QUESTIONS M16, with the owner's choices.
- PrivilegeFootprintTests: opening every group this project can name
  enables no powerful privilege (the real thing on the elevated CI runner).
- docs: 18_GPU_VENDOR_APIS (the reader, D103 as found, L2's line),
  20_OPEN_QUESTIONS (M13 half answered, M16 new), HANDOFF, CLAUDE.md,
  CHANGELOG.

Hook overhead: not applicable - nothing in code loaded into a game
changes.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 08:58:39 +00:00
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
poli0981andClaude Opus 5.5 ff949afc6f feat(legal): NOTICE with the GPLv3 section 7 additional terms, the licence header in every source file, and the documents for people who build, contribute or redistribute (D45, beta.12 PR-1) (#253)
- NOTICE: copyright, GPL-3.0-only, and three additional terms of the kinds section 7 permits - (b) preserve the
  notices and the attribution in the program's legal notices, (c) mark a modified version as different and do not
  call it "FrameLedger" alone, (e) no trademark rights in the name. Shipped as licenses\NOTICE.txt; release.yml
  refuses a published tree without it.
- Section 7 wants additional terms named in the source files: every first-party .cs .cpp .h .inl .ps1 .xaml file
  (1,053; src/native/third_party excluded) opens with the SPDX line and a pointer to NOTICE. tools/notice-check.ps1
  is the gate (six self-test cases, both directions; -Fix writes a missing header) and tools/resx-gen.ps1 generates
  the string accessors with the header.
- The native VERSIONINFO LegalCopyright said GPL-3.0-or-later; it now names the real licence.
- CONTRIBUTING.md, FORKING.md, CODE_OF_CONDUCT.md (Contributor Covenant 2.1 by reference), legal/TRADEMARKS.md.
- 12_BUILD gate list, CLAUDE.md layout and conventions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 22:16:00 +07:00
poli0981andClaude Opus 5 dad3adbff6 feat(agent): the Agent host -- --serve (watcher -> orchestrator -> recorder), --console verbs, the consent grant (D4) and the kill switch as the gate's fourth input (D7) (P2 PR-F) (#150)
FrameLedger.Agent is a Generic Host now. Composition.AgentServices registers
every Application port to its one shipped Infrastructure adapter;
WatcherHostedService runs PartialRecovery first and then
Application.Watch.CaptureOrchestrator: one process snapshot per second
(ToolhelpProcessSnapshotSource), ProcessWatcher (exact normalised path, or
the file name when exactly one games row carries it -> StalePath, keyed on
the real path), ProcessTree (a child that started before its parent is a
reused pid), DescendantElection (the newest tracked descendant; a launcher's
consent does not extend to what it spawns), ONE session per game at a time
through the new ISessionRecorder port. The orchestrator decides nothing
about hooking: the recorder's loop reaches HookedCaptureGate as a console
verb does.

--console carries consent list|grant|revoke, capture, launch (with the
election after LaunchTargetExited / LaunchNoPresentationRuntime), recover,
sessions, db path, games add, killswitch on|off|status, and --data-dir under
--console only (decision D6). --diag, --install-task, --uninstall-task,
--register-vklayer, --unregister-vklayer answer "not implemented in P2",
exit 2. The surface is pinned by AgentCommandLineSurfaceTests.

D4: Agent --console consent grant shows OperatorDisclosure (moved to
Application.Consent; one text, an OperatorSurface for the first line and the
stamp), refuses redirected stdin, and records the new
ConsentProvenance.AgentConsoleOperator with the Agent's clock.
OperatorAcknowledgement carries its provenance; SqliteGameConsentStore
writes that name and refuses NotRecorded.

D7: FR-2.4 is HookRequest.FromConsent's fourth input --
AntiCheatRefusalReason.KillSwitchEngaged (27, added to the native reason
table so GuardMirrorTests holds), checked before consent is read. IKillSwitch
(Infrastructure.Settings.SettingsKillSwitch over settings.hooking.kill_switch)
is read by CaptureSession before the request and at every guard-scan
boundary, where an engaged switch publishes unhookRequested and ends the
session as KillSwitchEngaged (RefusedKillSwitch when refused up front).
ProcessLauncher(enableVulkanLayer: false) keeps the Vulkan layer off by never
setting FRAMELEDGER_ENABLE_VK_LAYER. A bounded --console capture --seconds N
lowers the discard threshold to N.

Tests: AgentEndToEndTests (Integration, in the gate) runs the shipped
FrameLedger.Agent.exe against hook-harness with a scratch ledger and reads
back ONE hooked sessions row -- the milestone's technical half -- plus the
kill-switch refusal with no ring in the target, consent grant refusing
redirected stdin, the unbuilt flags' exit 2. ProcessWatcherTests,
ProcessTreeAndElectionTests, CaptureOrchestratorTests,
ToolhelpProcessSnapshotSourceTests, SettingsKillSwitchTests, the gate's
kill-switch case, the loop's mid-session case, the store's provenance
round-trip; GameConsentRecordTests pins three provenance names.

Docs: 04_CAPTURE (watcher built, election, threading row), 12_BUILD (the
surface), 07_IPC (pipe is P3), 19_SAFETY (D4/D7 built), 20_OPEN_QUESTIONS
(S27 restated for PR-F, S24 answers, G Agent lifecycle), 01_ARCHITECTURE,
06_DATA_MODEL (third provenance, settings key), 15_ROADMAP (milestone's
technical half), CLAUDE.md, HANDOFF (D4/D7 built, two traps), CHANGELOG.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 08:43:06 +07:00
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
poli0981andClaude Fable 5.1 f61d35f7f6 feat(injector): launch mode as "inject late" -- the guard waits for a presentation runtime, then runs in full (P1 item 2, §S1 / §S13(c)) (#139)
A CREATE_SUSPENDED target has loaded nothing and EnumProcessModulesEx fails
against it (§S1, measured), so launch mode cannot be create -> guard -> inject
-> resume. Built shape: start -> the guard WAITS -> the full guard -> inject.

Guard: GuardedInjectWhenReady(pid, dll, timeoutMs) / ABI FlGuardedInjectWhenReady
polls the target every 50 ms through the module seam -- matching no blocklist;
a failing enumeration is "not yet", never a pass -- until dxgi+d3d11/d3d12,
opengl32 or vulkan-1 is mapped, then runs GuardedInjectImpl unchanged. Two new
reasons end the poll with nothing injected: LaunchTargetExited (24) and
LaunchNoPresentationRuntime (25). ctest fl_guard [launch], five cases: injects
on the first enumeration showing the runtime and not one before; exit-first and
budget-out each answer their own reason; anti-cheat mapped beside the runtime is
the full scan's refusal; the real seam against hook-harness injects in 15 ms.

Overlay: FlWriterState.dxgiPresentsBeforeHook @60 -- GetLastPresentCount at the
first hooked present on the first hooked chain, i.e. presents that ran before
the hook was in; 0xFFFFFFFF until a present is seen, set BEFORE the present
hooks go in (the first placement, after them, lost the race to an 8 ms
presenter -- caught by the fixture). Took the last reserved word; no layout
bump; the writer state now has no slack.

CaptureHost: `launch --exe <path> [--args "..."] [--seconds n]`; ProcessLauncher
(handle held from birth, FRAMELEDGER_ENABLE_VK_LAYER=1; the host never
terminates what it launched); CaptureLoop.RunLaunchedAsync sharing the gate,
attach and drain with attach mode; HookRequest.WaitForPresentationRuntimeMs
routes the same gate through IAntiCheatGuard.GuardedInjectWhenReadyAsync (the
port's fourth method, primitives only); the report prints the wait and the
before-hook count (LaunchNote). NoSecondMatcherTests 3 -> 4 as a reviewed act.

Docs: 04_CAPTURE §Launch mode (the shape, why not CREATE_SUSPENDED, what it
measures), 01_ARCHITECTURE, 19_SAFETY item 1, 20_OPEN_QUESTIONS §S1 ◐ /
§S13(c) ✅ / §S24, 17_HOOK_ENGINE, 15_ROADMAP, HANDOFF, spike-notes, CHANGELOG.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 17:42:01 +07:00
poli0981andClaude Fable 5.1 f32b1e8b83 feat(telemetry): the first source, and §M5 answered — GPU sensors work unelevated, without PawnIO, on NVIDIA (#101)
FrameLedger.Application.Telemetry gains the port 18_GPU_VENDOR_APIS specified
(IGpuTelemetrySource, GpuSample, GpuCapabilities, TelemetryLayer) and
FrameLedger.Infrastructure.Telemetry gains LhmTelemetrySource (L2): GPU group
only, its own poller thread, 1 Hz and never under 500 ms, throws-or-hangs-twice
disables the layer for the session, capabilities value-derived and monotonic so
a sensor that never reports is never a capability. ILhmComputer is the seam that
lets every fault-policy branch run on CI, which has no GPU.

The instrument is `FrameLedger.CaptureHost probe-lhm [--seconds n]`: raw tree,
then mapped sample, then a verdict against the decision table pre-committed in
20_OPEN_QUESTIONS §M5 BEFORE the run.

Row R1, twice. RTX 5080 / 616.56 / LHM 0.9.6: eight fields unelevated (core and
memory temp, load, VRAM used, core and memory clock, package power, fan), the
identical eight in the elevated UAC control, PawnIO installed and never opened.
The three user-facing telemetry sentences stand; README names the fields on
NVIDIA; OperatorDisclosure.Version stays /2. Hotspot temperature is absent on
this box and recorded as N/A. One defect the raw tree caught before the verdict:
D3D Shared Memory Used (system RAM) was mapped to adapter VRAM by a fragment
rule — fixed, pinned by SharedMemoryIsNotVram.

HANDOFF's §M5 START HERE is struck; the live head recorded there is the
FPS-display rule + runtime census decided by the owner on 2026-09-03.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 18:37:06 +07:00
poli0981andClaude Opus 5 c26a1b0db1 feat(consent): the texts now say what DECLINING costs, and the rule against nudging is normative (#98)
README's safety row, legal/DISCLAIMER.md, legal/EULA.md and 19_SAFETY's
User-facing consent section all called a no-injection mode "the default". That
mode does not exist. The operator disclosure said it too, and added a second
sentence that is worse:

    "Nothing here is required to measure frame times."

It told someone about to type I ACCEPT THE INJECTION RISK that the risk was
optional. With the ladder at two rungs, hooking is the ONLY frame-time path.
Nothing in this tree was more wrong in a place that mattered more.

THE HARD PART IS NOT THE CORRECTION, IT IS NOT TURNING IT INTO PRESSURE.
Removing the fallback makes declining genuinely more costly, and naming a
concrete cost next to a request to accept is textbook framing. So 19_SAFETY gains
a NORMATIVE rule rather than a note, because a note will not survive translation
review: both options are enumerated at the same grain; neither is recommended;
"limited", "reduced" and "degraded" are not acceptable descriptions of Tier 2; no
sentence describes what the user LOSES by declining; and Tier 2 is never
described as temporary or pending a better mechanism, because a user deciding
today decides against what exists today.

The fourth required statement changes from "Tier-2 capture is available and is
the default for anything the guard is unsure about" -- which bundled a claim that
was false in the sense a reader takes from a frame-time tool, with a claim that
was conditional on an elevation state they could not evaluate -- to what actually
happens if they decline: the session is still recorded, with duration and
whatever telemetry the machine provides, and every frame-derived value reads N/A.

AND THE DISCLOSURE IS REORDERED, which is a smaller change that does more than it
looks. The Tier-2 sentence used to be the last thing before the prompt, so
whatever it said read as the set-up for accepting. Anti-cheat risk and terms of
service sit there now.

OperatorDisclosure.Version bumps /1 -> /2. Not a formality: /1 carried two
sentences that were FALSE rather than differently phrased, and two texts sharing
one version defeat the only property the field has. Traced while doing it, and
worth writing down because it is not what the type's own comment implies:
NOTHING RE-PROMPTS ON A VERSION MISMATCH. The field is written by Program, merged
forward by the store, cleared on revoke, and read by exactly one non-test
caller -- the `consent list` status line. HookRequest.FromConsent never sees it,
so a record stamped /1 still yields consent today. Whether that is acceptable is
an owner decision; the realistic population is one developer's build tree, which
git clean removes. The limit is now in the type instead of being assumed.

TWO CHECKLISTS WERE BOXES THAT COULD NOT FAIL -- 19_SAFETY's review checklist and
the pull-request template both asked "Is there a Tier-2 degradation path if the
hook is unavailable?" Under a two-rung ladder the answer is always yes. Replaced
with something falsifiable: does the session record N/A rather than a fabricated
value, AND record why.

AND THE TEST GUARDING THE DISCLOSURE COULD NOT FAIL FOR THE THING THAT CHANGED.
CommandLineSurfaceTests asserted Contain("Tier-2") while its comment claimed to
guard 19_SAFETY's four statements -- so any rewrite keeping that literal token
passes while the claim behind it changes completely. It now pins the substance:
that N/A is stated, that "Tier 3" is absent, and that neither removed sentence
came back. CANARIED rather than asserted: putting one of the two false sentences
back turns it red, and I checked that before trusting it, because I changed the
text and the test in the same pass and would otherwise never have seen it fail.

Not touched: HookedCaptureGate, HookRequest, GameConsentRecord,
FileGameConsentStore. Rule 1 is unchanged -- injection stays opt-in per game.
This changes what the user is TOLD, not what the code enforces.

./build.ps1 check with no switches: PASSED, 24/24 native tests, one skipped gate
(resx-audit, which does not exist). No .resx exists yet, so the en/vi/ja review
this wording will need is spec-only today -- but this IS the wording that becomes
the Safety_* strings, and 09_I18N reviews it as legal text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 12:29:27 +07:00
poli0981andClaude Opus 5 59ab7ac914 feat(overlay): the DLSS quality preset, and the vendor enum whose zero means something else (#74)
* feat(overlay): render resolution gets a producer, from the tags a title sets globally

FL_MEASURED_UPSCALER_PARAMS had no producer, and render -> output resolution is
one of the five values P0 exit criterion 1 names. A second inventory row detours
sl.interposer.dll!slSetTag, reads the kBufferTypeScalingInputColor extent, and
publishes renderW/H.

slSetTag WAS SCHEDULED FOR DEFERRAL AND IS INCLUDED INSTEAD, on measured
grounds. sl_core_api.h documents the local tags in slEvaluateFeature's `inputs`
as merely ALLOWED -- "they do NOT interact with same tags sent in the global
scope using slSetTag API" -- and only FOUR of the ten Streamline titles installed
on this machine route DLSS super-resolution through Streamline at all. An
inputs-only producer could have shipped with a hit rate of zero and nobody would
have known until a real-title run.

THE INSTALLER HAD TO BE RESTRUCTURED FIRST, AND IT WAS A LATENT MIS-BIND. The
expansion over FL_HOOK_INVENTORY ignored the `family` column entirely, stopped at
the FIRST row that resolved, hooked it with Hook_SlEvaluateFeature and OR'd a
hardcoded FL_HOOK_UPSCALER_IDENTITY. Correct while the table had one row, and
silently wrong the moment it did not: slSetTag would have been detoured by a body
that reads argument 1 as a feature id -- the same class as #71's SL1 break,
reached from the other direction. Each row now carries its own detour, family bit
and latch, and a row whose family has no detour installs NOTHING rather than
borrowing a neighbour's body. The install-after-stop guard is factored out for
the same reason: a second lazy installer that forgot it would have reopened the
window silently.

TWO CONDITIONS TO PUBLISH, AND THE SECOND IS THE ONE THAT IS EASY TO DROP: the
params hook live, AND an evaluation seen THIS FRAME. A tag is viewport state that
outlives any one frame, so publishing on the tag alone would report a render
resolution for every frame after a title stopped upscaling -- stale state dressed
as a measurement, which is the failure class layout v3 exists to prevent.

upscalerQuality is 0xFF and NEVER 0: 0 is NGX MaxPerf, a real preset, so it would
publish "DLSS Performance" as a measurement. upscalerSharpness is 0xFF
PERMANENTLY -- DLSSOptions::sharpness is deprecated as unsupported and
optimalSharpness is Streamline's recommendation, not what the title applied.

`claimedParams == 0` IS INVERTED, NOT DELETED. That was the honest assertion
while renderW/H had no source, and it is the line a reviewer should see change.
It now asserts the EXACT tagged extent, the honesty invariant on every claiming
record, and the reverse direction -- a value set while its bit is clear.

TWO FIXTURE BUGS THE TEST FOUND RATHER THAN REASONING. Tagging ONCE at startup
landed before injection and left the bit set on 0 of 43 records -- and
eValidUntilPresent means the tag expires AT present, so a real title re-tags every
frame and tagging once was simply wrong about the vendor contract, not a shortcut.
Then a floor of `> size - 3` hid a real 6-record window where identity was live
and params was not; the drain now waits for BOTH families and asserts equality,
which eliminates the window instead of tolerating it.

Proved red by canary: hardcoding a plausible 1920x1080 trips `wrongExtent` on all
40 records, and it compiles.

No #pragma for C4996 on the deprecated slSetTag, and that is measured rather than
assumed: /std:c++20 WITHOUT /Zc:__cplusplus makes MSVC report 199711L, so the
attribute's `#if __cplusplus >= 201402L` guard never opens. A pragma would
suppress a warning that is not emitted, and its comment would assert a compile
behaviour that does not occur. The condition that would change it is recorded at
the declaration.

Hook-path cost: one bounded walk of at most 64 tags per slSetTag call, and one
relaxed atomic load per present. Nothing allocates, nothing locks.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(overlay): the local tags slSetTag never sees, and the malformed input that must not fault

sl_core_api.h:258 is explicit that buffer tags passed to slEvaluateFeature are
"local" and "do NOT interact with same tags sent in the global scope using
slSetTag API". They are alternative integration styles, not layers: a
locally-tagging title yields nothing from the slSetTag hook, and a globally-
tagging one yields nothing from here. Both are now read. The local one wins when
present, because it is scoped to the evaluation rather than to the viewport and
therefore cannot be older than the frame being measured.

IN A HEADER, PRECISELY SO IT CAN BE TESTED WITHOUT A GAME. Every branch in this
walk dereferences pointers somebody else's process supplied, under bounds we
chose. A fault lands in FL_HOOK_GUARD and burns one of the three that
self-disable the Overlay -- so malformed input that faults is a BUG, not
acceptable degradation. A static function in dllmain's anonymous namespace could
only be reached by injecting it; here hook-harness calls it directly.

ctest fl_sl_inputs drives twelve shapes in microseconds: a null array, a zero
count, a null element mid-array, a wrong buffer type, a wrong struct GUID, a
structVersion below kStructVersion1, a whole-resource extent, a tag reached
through `next`, a SELF-REFERENTIAL next, a TWO-NODE CYCLE, and a numInputs of
0xFFFFFFFF. Both cycle shapes matter: a self-reference check alone misses the
second.

THE CYCLE HANDLING IS THE DEPTH CAP, and that is a decision rather than a
shortcut. A visited-set would allocate, which a hook path may not. And a cycle is
worse than a fault: no exception, no self-disable, just a frozen present thread
with our DLL in it.

WHAT THE CAP DOES NOT BUY, WRITTEN DOWN RATHER THAN IMPLIED. It turns
numInputs = 4 billion into 32 reads instead of a guaranteed access violation. It
does NOT protect against a count of 5 with a 2-element array -- nothing in the
ABI carries the allocation's length, so the count is the only statement of it and
a wrong one in that direction is unprotectable from here. Same for a structure
whose GUID matches and whose allocation is shorter than the declaration. Both are
the vendor's contract to keep. "Bounded" reads as safer than it is, so the
residual is named.

A whole-resource tag yields the honest unknown rather than a 0x0 resolution:
sl_core_types.h documents extent as "the area of the tagged resource to use (if
using the entire resource leave as null)" and it is a value member defaulting to
all-zero, which is exactly the in-band unknown fl_shm.h already defines for
renderW/H.

Stacked on the slSetTag producer: this reads the same packed word and the same
publish rule, so the two land in order rather than rewriting each other's block.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(overlay): the DLSS quality preset, and the vendor enum whose zero means something else

The last piece of HANDOFF item 2b that could be built. The bounded inputs walk
now also matches sl::DLSSOptions and reads `mode`, so upscalerQuality carries a
real preset for titles that chain their options rather than setting them out of
band through slDLSSSetOptions.

VENDORED THE WAY THE PROCESS REQUIRES, NOT APPROXIMATELY. sl_dlss.h from upstream
NVIDIA-RTX/Streamline@main: 8,489 bytes, CRLF preserved, git hash-object
3aac47be62. Its include closure is EMPTY --
verified on the upstream file, not assumed -- so it drags in no other header, and
it relies on sl.h having been included first. None of 18_GPU_VENDOR_APIS
§Checklist step 2's four needles ("solely for", "indemnify", "terminate",
"reverse engineer") appear in it, so step 1 applies and step 3's re-declaration
prohibition is unreachable. THIRD_PARTY_NOTICES, the vendoring README and
17_HOOK_ENGINE are corrected in this same commit -- nine headers to ten -- because
the alternative is the present-but-marked-absent drift license-check already
caught once.

DLSSMode::eOff IS 0, AND upscalerQuality RESERVES 0 FOR "NOBODY LOOKED". Storing
the vendor enum verbatim would make "the title turned DLSS off" and "no hook ran"
the same byte -- and 0 decodes as NGX MaxPerf, so it would publish "DLSS
Performance" as a measurement about a title that had upscaling switched off.
QualityFromMode maps eOff and anything at or beyond eCount to 0xFF.

That is the SECOND time this exact collision has appeared in a vendor enum:
D3D12_RAYTRACING_TIER_NOT_SUPPORTED is also 0, against rtTier's "not queried".
Both are resolved the same way and for the same reason -- at the WRITER, where
the two states are still distinguishable, rather than at the reader where they no
longer are.

Asserted exhaustively rather than by example: every DLSSMode value from 0 through
eCount+2 is checked, and none may map to 0. A single mistake here publishes a
wrong preset rather than an absence, which is the failure this field's whole
design exists to prevent.

The walk no longer returns on its first hit. Extent and quality arrive in
DIFFERENT structures and a title may chain them in either order, so an early
return made quality depend on chain order -- a property of the title rather than
of what it is doing.

upscalerSharpness is untouched and stays 0xFF permanently: DLSSOptions::sharpness
carries SR_DEPRECATED_SHARPENING in the vendored header, confirming there is no
in-policy route to what a title actually applied.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(host): a bounded capture, because a real-title measurement could not end

CaptureLoop honoured CaptureOptions.MaxDuration and CaptureLoopTests covered it.
NOTHING COULD SET IT. So `capture` against a running game ran until the game was
closed -- and the report is only printed at the end, so an operator taking a
bounded measurement had no way to take one. Found by trying to take one.

--seconds <n> is a DURATION BOUND, NOT A SAFETY BYPASS, and the distinction is
the one CommandLine's own header draws. The options this host refuses -- --pid,
--payload, --force, --yes -- each widen WHAT may be injected or skip a check.
This narrows HOW LONG an already-consented, already-guarded session runs, and can
only make a session shorter. Absent, the behaviour is unchanged: 0 means until
the target exits.

A NON-POSITIVE OR NON-NUMERIC VALUE IS AN ERROR, NEVER A SILENT 0, and that is
the whole risk in this option. Zero means "unbounded", so leniency would not
produce a shorter session than asked for -- it would produce an UNBOUNDED one,
the opposite of what an operator typing --seconds wants. Eight rejected forms are
listed in the test, including "0", "+9" and " 9", because "it parsed as 0" and
"it was refused" are indistinguishable from the exit code alone.

TheAcceptedOptionsAreExactlyThese went red, which is the gate working: the
comment on AcceptedOptions says "a test pins it", and adding an option had to be
a deliberate reviewed act rather than a diff nobody noticed. Updated with the
reasoning at the assertion.

AND THE REPORT COULD NOT TELL TWO VERY DIFFERENT THINGS APART. Every N/A has two
causes and one wording: the hook never installed, or it installed LATE and the
consumer requires its bit on EVERY record -- feature hooks install lazily on a
1 Hz watchdog, so the opening second of a session predates them. Against
Cyberpunk 2077 the host said "no upscaler hook ran" while ~3,870 records were
drained, and nothing in the output could say which cause it was. It now prints
hooksInstalledMask, apiMask, rtTier and the per-bit record counts, so a partial
count reads as "came up mid-session" instead of "never ran".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(host): print the raw params values, so a real-title run can be checked against the game

The report renders N/A for anything the consumer will not vouch for, which is
correct and useless for verification: a real-title run needs to compare what the
WRITER said against the game's own settings file, and nothing printed that.

Grouped rather than sampled. One record could be a transient; what a verification
run needs is what the writer said for most of the session, and the modal group is
that.

MEASURED IMMEDIATELY, against Cyberpunk 2077 in combat, 40 s, 10,169 presents,
0 gaps, 0 dropped:

    render 1485x835  quality=0xFF  upscaler=Unknown  on 2461 record(s)

1485x835 is the answer. The title's own UserSettings.json says DLSS = Balanced at
2560x1440, and Balanced is 0.58: 2560*0.58 = 1484.8, 1440*0.58 = 835.2. Render ->
output resolution, one of exit criterion 1's five values, measured correctly from
a real game for the first time.

quality = 0xFF is also an answer, and it is the honest one: Cyberpunk does not
chain sl::DLSSOptions into slEvaluateFeature's inputs -- it sets the preset out of
band through slDLSSSetOptions. The route HANDOFF §2b refused is the only one that
would reach it, so 0xFF is not a gap in this code, it is the true state. The
DLSSOptions half of the walk has a ZERO hit rate on this title.

upscaler = Unknown is NOT an answer and is recorded as a defect rather than a
result. Cyberpunk is running DLSS; the writer should say DLSS. Every one of the
2461 params-carrying presents decoded to UNKNOWN, which means g_slSeen held
DLSS_G / DLSS_RR / OTHER but not kFeatureDLSS on the present that drained it --
i.e. the per-present exchange(0) attributes a frame to whichever feature happened
to evaluate most recently. Honest (never NONE) and wrong, and exit criterion 1
asks for the CORRECT upscaler. It belongs to item 3, which restructures that
drain anyway.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 20:39:44 +00:00
poli0981 44f3dc1120 feat(capture): the consent gate gets a real source, and guardTicks a driver that is not a test (#60)
docs/HANDOFF.md queue item 1, all six parts. HookedCaptureGate's three inputs
(hook_enabled, hook_consent_at, hook_blocked_reason) come from IGameConsentStore
instead of a `games` table that existed in 06_DATA_MODEL and in no .cs file, and
FlControlBlock.guardTicks is advanced by a NON-TEST binary for the first time --
the sending half of the 30 s re-scan 19_SAFETY calls the most important runtime
behaviour in the capture layer. Both ends of that field existed and were tested
since #46/#50; only the loop was missing, and a missing loop reads as a missing
subsystem.

FrameLedger.CaptureHost is a separate project nothing publishes, and
tools/package-closure-check.ps1 is what keeps that true rather than remembered.
§S27 was closed on the grounds that no shipped binary carries an injecting entry
point; the host IS one, so its absence from the package is the load-bearing
clause. The gate walks the transitive ProjectReference closure of the two publish
roots and names the edge -- proven by planting a reference from the Agent, which
leaves the build green and turns the gate red.

WHAT THE PRE-BUILD PANEL CHANGED, because it changed what got built:

  - `new HookRequest { HookEnabled = true, ConsentedAt = UtcNow }` still compiled
    and reached GuardedInjectAsync -- verbatim the synthesis §S27 named and
    rejected. A store, a record and a provenance flag only add an honest path
    BESIDE the dishonest one. HookRequest is now get-only behind a private
    constructor with one factory, so the expression is a compile error.
  - GameConsentRecord.Stored is internal: Domain is inside both publish closures,
    so a public minting factory would be a blessed SHIPPED API for producing
    consent nobody gave, and the closure gate cannot see it.
  - An acknowledgement takes a DTO carrying neither BlockedReason nor
    PreScanUnverified, so `consent grant` structurally cannot clear a block --
    the "I understand, continue anyway" button rule 2 forbids, arrived at by
    omission.
  - frameIndex is process-global, so an interval rule keyed on "+1" would exclude
    every interval in a multi-swapchain title and report no duration at all.

WHAT THE ADVERSARIAL REVIEW OF THE DIFF CAUGHT, 17 of 23 candidates surviving a
refuter told to default to refuted. The worst was MEASURED, not argued:
Process.GetProcessById holds NO handle and HasExited opens one and closes it
again, so the pid was never pinned -- §S29(e) had been closed on a mechanism that
did not exist, asserted in three source comments, the ledger and the changelog.
HeldProcessHandle now opens SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION and
keeps it; a pid that cannot be pinned is a refusal. Also: "could not read the
executable" passed the fingerprint check by comparing the record with itself;
Enum.TryParse accepts numeric strings, so "provenance": "1" walked round the
two-member enum; an unreadable consent file silently cleared a persisted block
and dropped every other game's record; a guard exception discarded the whole
session's drained frames; StreamSegmenter cut a spurious 0x0 segment; and three
of the new tests could not fail for the property they named.

CLOSED: §S29(c) by deleting ShouldUnhookAsync (zero production callers, strictly
weaker than ScanOnceAsync, and inverted in polarity), §S29(e) host-side with no
ABI change. §S29(f)'s premise corrected in place -- layout v3 put rtTier and
hooksInstalledMask in FlWriterState, neither has a producer, so RT `Yes` is
unreachable as well as `No`.

Also: ShmRingReader.SetPaused had no test at all and now has both halves;
ShmHandshakeValidator never compared handshake.Pid, so a ring left by a finished
session validated Ok; the drop branch runs against the real Overlay for the first
time, which needed --present-interval-ms on hook-harness (uncapped, the harness
does 171,636 presents in 3 s, so the ring laps in under a second instead of 68).

Docs corrected in the same PR: 04_CAPTURE's "consent lives in SQLite" was the only
line in the tree saying where consent lives; 12_BUILD and 13_CI_CD both said the
struct-mirror gate does not exist while build.ps1 throws on it; 12_BUILD's gate
list omitted four gates and claimed Directory.Build.props sets RuntimeIdentifier;
13_CI_CD documented a release.yml that does not exist; 03_METRICS still listed
dlss_rr, named the retired rtPsoAlive bit, and had no rung 0 on the FG ladder.

./build.ps1 check with no switches: PASSED, 78 s, 1 pre-existing skip.
Native 16/16. Managed 252, up from 160 -- Domain 60, Application 39,
Infrastructure 82, CaptureHost 71. Every new gate proven red-then-green with the
build's exit code read BEFORE the test's.

NOT MEASURED HERE, and stated rather than left to be inferred: the nine
Category=Integration cases do not run on CI (§S19(b)), and package-closure-check
reads ProjectReference only -- it does not follow <Import> or
Directory.Build.props, so a .targets staging a foreign binary is outside what it
sees. Both are written into the script, 12_BUILD and HANDOFF.

Six owner decisions are recorded in §S24. One was taken because it cannot be
retrofitted: a consent record carries a disclosure/wording version from the first
record written.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>


Follow-up in the same branch: 15_ROADMAP's status header is dated forward with what
changed AND with what did not — items 4, 6 and 7 are exactly where they were, because
the writer still measures nothing but output resolution and its own present arguments.
A status line that only ever grows is how that file came to lag its own repository
twice.
2026-08-09 12:57:19 +07:00