Files
frameledger/FrameLedger.Guard.targets
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

85 lines
4.4 KiB
XML

<Project>
<!--
Ships FrameLedger.Guard.dll beside the importing project's output.
§S18 blocker 3, ratified 2026-08-04: **the Agent is the sole host of the
guard.** This used to live in FrameLedger.Infrastructure.csproj as a plain
`None` item, which MSBuild flows to every project that references
Infrastructure — so FrameLedger.exe (the WPF UI) received it too, purely as a
side effect of also wanting SQLite and detection.
That is what made §S18 hard. `GetCurrentProcessId()` was rejected as an
identity because more than one FrameLedger binary carried the guard, so the
fix had to be a property of the DIRECTORY rather than of the process. Making
the Agent the only host does not remove the need for the install-root check —
the Agent is still the game's parent in launch mode, and still inside the
§S16 scan set — but it shrinks the exposed surface instead of widening a
carve-out, which §S18 itself called "the only candidate that shrinks the
problem".
Imported by exactly three projects, and each for a reason:
- FrameLedger.Agent — the host. It runs the guard.
- FrameLedger.Infrastructure.Tests — GuardMirrorTests and
RulesPathAgreementTests P/Invoke into the real DLL, so it has to be
beside the test binary.
- FrameLedger.CaptureHost — added 2026-08-06. The unshipped driver of
the guard loop (docs/HANDOFF.md item 1). NativeAntiCheatGuard loads the DLL
by absolute path from AppContext.BaseDirectory and never falls back to a
search, so it has to actually be there.
THE THIRD IMPORT NEEDS §S18 BLOCKER 3 RE-READ, and this is that reading rather
than a quiet exception.
What blocker 3 was FOR was the WPF UI acquiring the guard as a SIDE EFFECT of
wanting SQLite and detection — a `None` item in Infrastructure.csproj flowing to
every referencing project. FrameLedger.CaptureHost is the opposite case: a
deliberate host that exists to run the guard, in the same class as the test
project that has imported this since it was written.
And the fix blocker 3 produced is a property of the DIRECTORY, not of the
process: `GetCurrentProcessId()` was rejected as an identity precisely because
more than one binary carries the guard. A third one does not weaken it.
WHAT IS NOT RE-DECIDED HERE: reversing a ratified decision is the owner's, not a
PR's, and 20_OPEN_QUESTIONS §S24 records it as an open owner decision. What this
comment does is stop the file asserting a count that stopped being true.
NOT a cross-process hazard either, which a design panel proposed a named mutex
for: §S28's fail-open is a race on PROCESS-LOCAL statics inside ParseRules and
EvaluateImpl, and a second process gets its own image of the DLL with its own
copies — which §S28 already concedes for the Vulkan layer in as many words.
NOT imported by FrameLedger.App. FR-2.2's advisory pre-scan reaches the guard
through the Agent over IPC when that exists (07_IPC); until then the App has
no call site for it, so removing the DLL costs nothing today and prevents it
quietly acquiring one.
NativeAntiCheatGuard loads it BY ABSOLUTE PATH from AppContext.BaseDirectory
and never falls back to a search, so it has to actually be there — which is
the point: a guard that could be "not found" and shrugged off would be a
guard with an off switch.
-->
<PropertyGroup>
<FlNativeOutDir>$(MSBuildThisFileDirectory)build\native\x64-release\FrameLedger.Injector\</FlNativeOutDir>
</PropertyGroup>
<ItemGroup>
<None Include="$(FlNativeOutDir)FrameLedger.Guard.dll" Condition="Exists('$(FlNativeOutDir)FrameLedger.Guard.dll')">
<Link>FrameLedger.Guard.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<!--
Warn rather than fail: build.ps1 runs the native build first, so by the time
this evaluates the DLL exists. A hard error here would make `dotnet build` on
a fresh clone fail for a reason that has nothing to do with the managed code.
-->
<Target Name="FlWarnOnMissingGuard" AfterTargets="Build"
Condition="!Exists('$(FlNativeOutDir)FrameLedger.Guard.dll')">
<Warning Text="FrameLedger.Guard.dll was not found at $(FlNativeOutDir). Run build.ps1 native first; anything that calls the guard will fail to resolve it." />
</Target>
</Project>