feat: the user-mode anti-cheat exception needs no earlier sessions - its first two are a trial that ends it for good if one goes badly (D38, schema 0017, Disclaimer 2.9, EULA 1.4) (#248)

The owner deleted their ledger and found GIRLS' FRONTLINE 2 "Not eligible: 0 successful hooked
session(s), two are needed" - for good. D33's rule was a catch-22 for every game it could meet
again: since beta.8 the library sweep blocks a game the moment it is added, a blocked game is
never hooked without a grant (CaptureSession sends it to Tier 2 before the resolver), so it could
never earn the two sessions, and a reset ledger lost the ones it had. Asked with that (2026-10-03),
the owner chose D38: a grant needs no session; the first two hooked sessions under it are a trial;
any end during the trial ends the exception for good.

Agent / Application:
- UserModeExceptionRules: TrialSessions = 2 replaces RequiredSessions; IsEligible(block, verdict,
  trialFailed) - the guard's answer and the trial mark, no count; InTrial(successfulBefore).
- UserModeExceptionLapse.TrialFailed; UserModeExceptionLapsePolicy judges a session against the
  grant in force: during its trial every D33 end, or a stored hooked session with no frames or an
  abnormal exit, revokes it with trialFailed; a session too short to store, or never hooked, is
  not judged. The recorder passes the row it stored (SessionForTrial).
- ISessionRepository.CountSuccessfulUnderGrantAsync (family + started >= grant) replaces
  CountSuccessfulHookedAsync; ac_exception_sessions is now the trial's progress.
- AgentCommandHandler: TooFewSessions is gone; a game whose trial failed is refused before
  anything is scanned (Refused TrialFailed, signal = unix ms). AntiCheatExceptionCommands drops
  the session repository.
- The sweep answers a blocked entry whose executable cannot be read ("PreScanFailed", no bytes in
  the key) instead of leaving it "Checking..." for ever.

Infrastructure: schema 0017 games.ac_exception_trial_failed_at; the revoke sets it once
(COALESCE), eligibility is never written eligible over it and a grant is refused over it, both in
SQL; Change executable does not name it; a twin merge keeps the earlier mark.

App: the disclosure is ac-exception-dialog/2 (Why names no count, a Trial paragraph); the card
says "trial: N of 2", a failed trial "none can be made again", a scan that found nothing "was not
found" (not "could not finish"); an eligible game's Anti-cheat card no longer says "cannot be
turned on" beside Make exception...; the Settings list shows only games it can act on, without
the duplicated count, and Refresh only while a row is checking. Strings en/vi/ja (ja safety text
English until reviewed).

Docs and legal: CLAUDE.md rule 2 amendment, 19_SAFETY, FR-2.8, 06_DATA_MODEL (0017), 07_IPC,
08_UI, 20_OPEN_QUESTIONS, LIMITATIONS, SECURITY, the accuracy block (README, Disclaimer),
Disclaimer 2.9 (2A), EULA 1.4, CHANGELOG.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
poli0981andClaude Opus 5.5 authored and GitHub committed 2026-10-03 10:25:42 +07:00
1 parent 5ab297b7b7
commit 0e03d07dac
66 files changed
+947 -321

No files matched your search

+25
View File
@@ -37,6 +37,31 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
kind. Rules `2026.10.1` — every game is re-checked once, and these games' hooking is turned off like any title-list
finding, never under a user-mode exception (`19_SAFETY` check 3).
### Changed
- **The user-mode anti-cheat exception no longer needs sessions measured before it — its first two sessions are a
trial** (owner decision D38, beta.11). D33 asked for two successful hooked sessions before a grant, but since beta.8 a
game is blocked the moment it is added, so a blocked game could never earn them, and a reset ledger lost the ones it
had: after the owner deleted theirs, GIRLS' FRONTLINE 2 read *"Not eligible: 0 successful hooked session(s), two are
needed"* for good. A grant now needs no session. Until two sessions under it have succeeded, the game page says
*trial: N of 2*, and any end during the trial — a crash, a safety unhook, the Overlay's own stop, a new finding, or a
stored hooked session that recorded no frame or did not end normally — ends the exception **for good** (schema 0017,
`games.ac_exception_trial_failed_at`, set once and never cleared; the Agent refuses a grant with `TrialFailed` and the
store refuses one in SQL; a twin merge keeps the mark). Every other condition is unchanged — one user-mode family, no
`.sys` in the game's folder, no title list — and after the trial an end is what it was. The disclosure is
`ac-exception-dialog/2`: it names no session count and has a *Trial* paragraph (`ja` stays English until reviewed).
**Legal text:** Disclaimer 2.9 (§2A) and EULA 1.4, so the Legal Gate opens once; the accuracy block, `SECURITY.md` and
`LIMITATIONS.md` say the same; CLAUDE.md rule 2 carries the amendment (`19_SAFETY` §The user-mode exception).
### Fixed
- **The exception's card and list say what is true** (found with D38): an eligible game's *Anti-cheat* card said hooking
"cannot be turned on" beside a usable *Make exception…* — it now says hooking is off unless you make one; the Settings
list showed each game's session count twice and listed games that could never qualify, with no action — it lists only
games it can act on; a tolerant scan that found nothing of the family was said as "the check could not finish" — it
says the family was not found; and a blocked game whose executable could not be read stayed *Checking…* for ever — the
sweep now answers it. **Refresh** shows only while a row is being checked, the one time it can change anything.
## [0.1.0-beta.10] - 2026-09-28
**The tenth pre-release: how each game was shown, the agent as administrator if you choose it, and the exact Unreal
+1
View File
@@ -17,6 +17,7 @@ A C++ DLL (`FrameLedger.Overlay.dll`) is injected into games the user explicitly
>
> **A finding turns the game's hooking off** (`19_SAFETY` §What a finding does to the game). An anti-cheat named in the game itself — its process, its title lists, its folder — is written to the row exactly as the pre-scan always wrote it (`hook_enabled = 0`, `hook_blocked_reason`, `hook_prescan_state = 'blocked'`), and since 2026-09-22 also when the guard finds it at a session's start or at the 30 s re-scan (`AntiCheatVerdict.IsFindingAboutTheGame`). A machine-wide driver or service refuses that session only. The notice, the game's page, the session's notes and the Agent's log all say it happened. Nothing clears the block, as before.
> **Amended 2026-09-26 (owner decision D33): one narrow, evidence-bound exception.** Asked with the 2026-09-22 withdrawal and this rule quoted back, the owner chose a per-game exception for anti-cheat that is **user-mode throughout** — a Settings option off by default, then the user ticks each eligible game through a versioned disclosure (bans are possible and can arrive days later). Eligible only when every finding about the game is `BlockedModule` / `AntiCheatFile` / `AntiCheatDirectory` of ONE family whose floor-and-file footprint has no driver, service or `.sys` (`fl::guard::FamilyIsUserModeOnly` — the GUARD decides, from a family NAME the caller passes), no `.sys` is anywhere in the install tree, no title list names the game, and the ledger holds ≥ 2 successful Tier-1 sessions of it. Drivers, services, title lists, the `.sys` rule, the fuzzy tier, scan failures, `TargetUnreadable`, 32-bit, the kill switch and Vulkan are never excepted. The guard runs every check and keeps scanning past the tolerated family (`kAllowedUserModeException`, reason 28); the Overlay learns the family from `Local\FrameLedger.Tolerate.<pid>` before its loader detour exists. A new finding, a crash / safety unhook / floor stop under it, or an executable change ends it; the block is never cleared. **No other form of override is to be added** (`19_SAFETY` §The user-mode exception).
> **Amended 2026-10-03 (owner decision D38): the evidence moved from before the grant to its trial.** "≥ 2 successful Tier-1 sessions" above could never be met by a game blocked at add time — since beta.8 that is every blocked game — nor after a ledger reset. Asked with that, the owner chose: a grant needs no session; the first two hooked sessions under it are a trial, and any end during the trial (a crash, a safety unhook, a floor stop, a new finding, or a stored hooked session with no frames or an abnormal exit) ends the exception **for good** (`games.ac_exception_trial_failed_at`, schema 0017, never cleared). Every other condition above is unchanged, and so is the last sentence.
3. **Never implement evasion.** No manual mapping, no PE header erasure, no thread hiding, no signature obfuscation, no unlinking from the PEB module list. Injection uses documented `LoadLibraryW`. The DLL keeps its real name, real exports, and version info. A performance tool must be *visible* to anti-cheat, not hidden from it. Any PR that makes FrameLedger harder to detect is rejected on principle.
4. **Never read or write game memory outside our own hooks.** We read arguments passed to APIs we hooked and COM/handle objects we legitimately own. No pattern scanning for game internals, no reading player/entity state, no writing to game memory. Ever.
5. **The hook must never crash the game.** Every hook body: SEH-guarded, allocation-free, lock-free, no logging, no exceptions crossing the boundary. On repeated faults, self-disable (`17_HOOK_ENGINE` §Fault policy).
+3 -2
View File
@@ -11,8 +11,9 @@ page lists them in plain words; each item links to the document that has the det
- **Games with anti-cheat.** FrameLedger looks for anti-cheat before it touches a game and refuses when it
finds one — there is no switch that overrides this. The one exception is an anti-cheat that runs entirely
inside the game (no driver, no service), which you can allow per game after a warning and two good
sessions; a ban is still possible and may come days later. Kernel anti-cheat is never allowed.
inside the game (no driver, no service), which you can allow per game after a warning; its first two
sessions are a trial, and one that does not go well ends the exception for good. A ban is still possible and
may come days later. Kernel anti-cheat is never allowed.
([Safety](docs/19_SAFETY_AND_ANTICHEAT.md))
- **Anti-cheat FrameLedger does not know about.** The list of anti-cheat products is FrameLedger's own and
can be incomplete. A game protected by something unknown may be hooked; that is a risk to your account
+2 -2
View File
@@ -78,8 +78,8 @@
> game in the library, before injection, at a session's start or by the 30 s re-check; the game's page says so,
> and nothing turns it back on for that executable — except a user-mode exception you make yourself, per game,
> in Settings (off by default): only where the only finding is one anti-cheat that runs entirely in user mode, with
> no driver file in the game's folder, on a game already measured successfully at least twice. The guard still
> runs every check under it and ends it on anything new; a ban remains possible.
> no driver file in the game's folder. Its first two sessions are a trial, and one that does not go well ends it
> for good. The guard still runs every check under it and ends it on anything new; a ban remains possible.
>
> Where a value is not measured it reads `N/A`, with two exceptions: FPS then shows Presented FPS with a
> note on what it may include, and ray-tracing flags may show a value you set yourself, labelled as
+4 -2
View File
@@ -37,8 +37,10 @@ check. The grant is a record in your own database, like the consent stamp; what
decides itself which family it may let through. So these are security reports too: the guard letting through a family
that has a driver, a service or a `.sys` in the floor or the rules; an exception applying to a game with a kernel
driver in its folder, on a title list, or with a second anti-cheat; the Agent writing a grant on a pipe message
without its own tolerant pre-scan and session count; an exception that survives a new finding, a crash or safety stop
under it, or a changed executable; and the Overlay tolerating a family the guard did not.
without its own tolerant pre-scan; an exception that survives a new finding, a crash or safety stop under it, or a
changed executable; since 0.1.0-beta.11 (D38), an exception that survives a session during its two-session trial that
did not go well, and any grant written for a game whose earlier exception failed its trial; and the Overlay tolerating
a family the guard did not.
## Running the agent as administrator
+1 -1
View File
@@ -18,7 +18,7 @@ Requirement IDs (`FR-x`, `NFR-x`) are referenced by other docs, commits, and tes
- FR-2.3 The runtime guard refuses injection and refuses to continue a session when anti-cheat is detected. **No override exists anywhere in the UI, config, or CLI.** *(Since 2026-09-26 one narrow, evidence-bound exception exists — FR-2.8. It is not an override: the guard still runs every check and decides itself which anti-cheat family it may let through.)*
- FR-2.4 Global "disable all hooking" kill switch in Settings; also honored by the Vulkan layer.
- FR-2.7 (owner decision 2026-09-22; it was a per-game override for one day, withdrawn) A finding about a game — anti-cheat named in its process, on its title lists or in its folder — turns hooking off for that game wherever the guard makes it: at the pre-scan, at a session's start, at the 30 s re-scan, or (since 2026-09-25) at the Agent's pre-scan of the library. The row carries the reason, the game's page and the notice say so, and nothing overrides it (`19_SAFETY` §What a finding does to the game).
- FR-2.8 (owner decision D33, 2026-09-26) **The user-mode anti-cheat exception.** A Settings option, off by default, lets the user grant a per-game exception to a game whose only anti-cheat findings are ONE family that is user-mode throughout (no driver, service or `.sys` in the floor or the rules), whose install tree holds no `.sys`, which is on no title list, and which FrameLedger has measured hooked at least twice (successful Tier-1 sessions). The Agent computes that eligibility itself; the user grants each game through a versioned disclosure that states the ban risk; hooking is then turned on through FR-2.1's dialog as ever. Machine-wide drivers and services, title lists, kernel drivers in the game folder, the fuzzy tier, a scan that could not finish, an unreadable process, a 32-bit game, the kill switch and Vulkan are never excepted. A new finding, a crash / safety unhook / Overlay stop under it, or a changed executable ends it; the option off suspends it; the block itself is never cleared and stays shown (FR-2.2). Sessions under it are marked with the family (`19_SAFETY` §The user-mode exception).
- FR-2.8 (owner decision D33, 2026-09-26) **The user-mode anti-cheat exception.** A Settings option, off by default, lets the user grant a per-game exception to a game whose only anti-cheat findings are ONE family that is user-mode throughout (no driver, service or `.sys` in the floor or the rules), whose install tree holds no `.sys`, which is on no title list, ~~and which FrameLedger has measured hooked at least twice (successful Tier-1 sessions)~~ and no exception of which ever ended during its trial (D38, 2026-10-03: a grant needs no session; its first two hooked sessions are a trial, and an end during the trial — any end below, or a stored hooked session with no frames or an abnormal exit — ends it for good, `games.ac_exception_trial_failed_at`). The Agent computes that eligibility itself; the user grants each game through a versioned disclosure that states the ban risk; hooking is then turned on through FR-2.1's dialog as ever. Machine-wide drivers and services, title lists, kernel drivers in the game folder, the fuzzy tier, a scan that could not finish, an unreadable process, a 32-bit game, the kill switch and Vulkan are never excepted. A new finding, a crash / safety unhook / Overlay stop under it, or a changed executable ends it; the option off suspends it; the block itself is never cleared and stays shown (FR-2.2). Sessions under it are marked with the family (`19_SAFETY` §The user-mode exception).
- FR-2.5 Repeated crashes shortly after injection auto-disable hooking for that game, with an explanation and a manual re-enable path.
- FR-2.6 Users can always see, per session, which tier produced the data.
+16 -2
View File
@@ -69,7 +69,7 @@ CREATE TABLE games (
-- schema 0014 (2026-09-26, D33): the user-mode anti-cheat exception, a layer OVER hook_blocked_reason, never its clearing
ac_exception_eligible INTEGER NOT NULL DEFAULT 0, -- the Agent's sweep: the exception may be granted now
ac_exception_verdict TEXT, -- its tolerant pre-scan, Reason|Family|Signal; NULL = nothing asked
ac_exception_sessions INTEGER NOT NULL DEFAULT 0, -- successful Tier-1 sessions counted
ac_exception_sessions INTEGER NOT NULL DEFAULT 0, -- D38: successful sessions under the grant in force (its trial)
ac_exception_checked_rules_version TEXT, -- the key the verdict was reached under: rules, executable size and
ac_exception_checked_exe_size_bytes INTEGER, -- mtime, and the block text itself
ac_exception_checked_exe_mtime_ms INTEGER,
@@ -81,7 +81,9 @@ CREATE TABLE games (
ac_exception_exe_mtime_ms INTEGER,
ac_exception_lapsed_at INTEGER, -- when and why the last grant ended (UserModeExceptionLapse:
ac_exception_lapsed_reason TEXT, -- Withdrawn|ExecutableChanged|NoLongerEligible|NewFinding|
-- SafetyUnhook|OverlayStopped|SessionCrashed)
-- SafetyUnhook|OverlayStopped|SessionCrashed|TrialFailed)
-- schema 0017 (2026-10-03, D38): an exception of this game ended during its trial — for good; never cleared
ac_exception_trial_failed_at INTEGER,
hook_autodisabled_reason TEXT, -- set after repeated crashes
hook_crash_count INTEGER NOT NULL DEFAULT 0,
capability_flags TEXT, -- JSON: what the game SHIPS — never a measurement. Since P4 PR-1 (2026-09-14) a JSON
@@ -577,6 +579,18 @@ Sequential embedded SQL (`Migrations/0001_init.sql`, `0002_*.sql`, …), applied
> 16; `LedgerDatabaseTests.ScriptSixteenAddsTheDisplayColumnsAndAnEarlierSessionHasNone`,
> `SqliteSessionRepositoryTests.ASessionRoundTripsColumnForColumn`.
> **`0017_exception_trial.sql` (beta.11, 2026-10-03, owner decision D38) — the exception's trial.** One column,
> `games.ac_exception_trial_failed_at`: when an exception of the game ended during its trial (`19_SAFETY` §The user-mode
> exception), NULL when none did. ADD COLUMN only, no data change: a grant made under D33 stays in force and carries no
> mark. Written by the Agent's revoke only (`IGameConsentStore.RevokeAntiCheatExceptionAsync(…, trialFailed)`), set once
> (`COALESCE`), cleared by nothing — not by `ChangeExecutableAsync`, which does not name it — and carried by a twin merge
> (the earlier of two). The store applies it in SQL: no eligibility is written as eligible and no grant is written over
> it. `ac_exception_sessions` (0014) changes meaning without a script: since D38 it is the trial's progress under the grant
> in force, which the sweep rewrites on its first pass. `LatestVersion` is 17;
> `LedgerDatabaseTests.ScriptSeventeenAddsTheTrialMarkAndChangesNoRow`,
> `SqliteGameConsentStoreTests.AnEndDuringTheTrialMarksTheGameAndNothingClearsIt`,
> `SqliteGameMergeTests.AFailedExceptionTrialOnEitherTwinMarksTheSurvivor`.
> **Every open used to migrate, and one that should not have did — 2026-09-16.** The Agent's `--console sessions`,
> a verb that prints, was run against the owner's ledger while the file on disk was at schema 2 and applied 0003 and
> 0004 to it. `LedgerDatabase.OpenReadOnlyAsync` exists since that day: an existing file, `PRAGMA query_only`, no
+1 -1
View File
@@ -391,7 +391,7 @@ Unchanged in spirit from v1, bumped to `v2` for the new message set.
| `SetWatchlist` | UI→A | `{ entries: [{ gameId?, exePath }] }` — ~~full replace~~ **ensure, never remove** (built 2026-09-13, PR-1b): each entry's path is normalised by the Agent, its row ensured with hooking OFF when new, and the ack is `WatchlistAck { games: [{ gameId, exePath, name }], unreadable: [exePath] }`; `gameId` in a request is a hint and never trusted over the path. UI re-sends on connect. **Carries no hooking state** (see §The pipe is not a trust boundary). *Since the App writes `games` rows itself under `06_DATA_MODEL` §Writer ownership (HANDOFF §P3 D15), this is the pipe's way of adding a row, not the only one; the watcher reads the table at 1 Hz either way.* |
| `LaunchGame` | UI→A | `{ gameId, arguments? }` → ~~suspended-launch~~ launch mode as built ("inject late", `04_CAPTURE` §Launch mode) → `LaunchAck { gameId, accepted, outcome, sessionGuid? }` — `outcome` is `Accepted` · `UnknownGame` · `SessionRunning` (one per game at a time) · `Unavailable` · `RecordingOff` (2026-09-23: the entry's recording switch is off, FR-1.6 — FrameLedger does not start what it will not record). *(Built 2026-09-13, PR-1b: `CaptureOrchestrator.LaunchAsync` over an `ILaunchRecorderFactory` the Agent composes with the Vulkan layer's environment — or none when FR-2.4's switch is on — and the launcher election runs after, as the console's `launch` does; the elected session is not addressable by the launch's guid.)* |
| `SetHookEnabled` | UI→A | `{ gameId, enabled, disclosureVersion? }` — Agent re-runs the static AC pre-scan and may reply `Refused`. **The Agent stamps the consent timestamp itself.** *(Built 2026-09-13, PR-1b, as far as it can be: `enabled: false` → `RevokeAsync` → `HookEnabledAck { gameId, enabled: false, outcome }`; `enabled: true` → the pre-scan of the executable's directory, a refusal or a "could not verify" recorded through `RecordGuardBlockAsync` and answered `Refused { gameId, reason, family?, signal? }`; a clean scan → ~~**`Error DisclosureUnavailable`, nothing stamped** — the reviewed FR-2.1 text does not exist, and a client's `disclosureVersion` is a claim, not a disclosure shown. PR-4 replaces that last branch with the stamp~~ **since PR-4 (2026-09-13): the client's `disclosureVersion` compared with the Agent's own `SafetyDisclosure.Version`; equal → the stamp from the Agent's clock with `ConsentProvenance.ConsentDialog`, answered `HookEnabledAck { enabled, outcome, prescan: "clean" }`; anything else → `Error DisclosureVersionMismatch`, nothing written (D14). `DisclosureUnavailable` remains for a composition that wired no version, which `--serve` never is.)* **Since beta.8 (2026-09-25):** the pre-scan is of the executable (the guard resolves the install root, PR-2 of that train), and BEFORE it an executable known not to run as x64 is answered `Refused { gameId, reason: "ExecutableNotX64", signal: "x86" | "anycpu32" | "arm64" | "arm" }` with nothing scanned and nothing written — not a guard reason and not a block (`05_DETECTION` §What the files say about themselves). **Since D33 (2026-09-26):** for a blocked game whose user-mode exception is in force for the executable on disk (the option on, a grant made on these bytes, the block naming that family) the pre-scan NAMES the family, and a pass under it is stamped as ever and answered `prescan: "exception"`; a finding about the game under it also ends the exception. |
| `SetAntiCheatException` | UI→A | **Added 2026-09-26 (D33).** `{ gameId, enabled, disclosureVersion? }` — grant or withdraw a game's user-mode anti-cheat exception (`19_SAFETY` §The user-mode exception). `enabled: false` → the exception ends (`Withdrawn`), hooking goes off while the block stands → `AntiCheatExceptionAck { gameId, granted: false, outcome, family? }`. `enabled: true` → `Error DisclosureVersionMismatch` unless `disclosureVersion` is the Agent's `AntiCheatExceptionDisclosure.Version`; `Error ExceptionsOff` while `hooking.usermode_ac_exceptions` is off; `Refused { reason: "BlockNotExceptionable" }` for a title list or an unreadable block; then the Agent's OWN facts — a tolerant pre-scan of the executable on disk naming the block's family (`Refused { reason, family, signal }` unless the guard let exactly that family through) and the successful Tier-1 sessions (`Refused { reason: "TooFewSessions", signal: <count> }` under two) — and the store writes the grant only over facts that make the game eligible → `AntiCheatExceptionAck { granted, outcome, family }`. **A grant turns nothing on**: hooking is FR-2.1's `SetHookEnabled`, afterwards. Not answered (`UnknownType`) by an Agent composed without the exception. |
| `SetAntiCheatException` | UI→A | **Added 2026-09-26 (D33).** `{ gameId, enabled, disclosureVersion? }` — grant or withdraw a game's user-mode anti-cheat exception (`19_SAFETY` §The user-mode exception). `enabled: false` → the exception ends (`Withdrawn`), hooking goes off while the block stands → `AntiCheatExceptionAck { gameId, granted: false, outcome, family? }`. `enabled: true` → `Error DisclosureVersionMismatch` unless `disclosureVersion` is the Agent's `AntiCheatExceptionDisclosure.Version`; `Error ExceptionsOff` while `hooking.usermode_ac_exceptions` is off; `Refused { reason: "BlockNotExceptionable" }` for a title list or an unreadable block; then the Agent's OWN facts — ~~the successful Tier-1 sessions (`Refused { reason: "TooFewSessions", signal: <count> }` under two)~~ *(D38, 2026-10-03: no session is needed)*; a game an exception of which ended during its trial is refused before anything is scanned (`Refused { reason: "TrialFailed", family, signal: <unix ms> }`); a tolerant pre-scan of the executable on disk naming the block's family (`Refused { reason, family, signal }` unless the guard let exactly that family through) — and the store writes the grant only over facts that make the game eligible, and never over a failed trial → `AntiCheatExceptionAck { granted, outcome, family }`. **A grant turns nothing on**: hooking is FR-2.1's `SetHookEnabled`, afterwards. Not answered (`UnknownType`) by an Agent composed without the exception. |
| `PauseCapture` / `ResumeCapture` | UI→A | global → `PauseAck { paused }`; `StatusAck.paused` reports it. *(Built 2026-09-13, PR-1b: one in-memory flag, `CapturePause`, read by every session loop at its tick and told to the ring once per transition; supervision — the guard scan, the kill switch, the safety stop — never pauses. Not persisted: an Agent that restarts resumes.)* |
| `StopSession` | UI→A | `{ sessionGuid }` — graceful ~~unhook~~ stop + finalize → `StopAck { sessionGuid, accepted, reason? }`. *(Built 2026-09-13, PR-1b: the orchestrator names every session it starts and cancels THAT session's stop token; the loop reads it at its next tick, drains once more, and ends as `SessionEndReason.StoppedByUser` — `exit_status = normal`, the row stored like any other, the target left running. A guid nobody runs is `accepted: false`. Distinct from the host's cancellation, which leaves a `.partial`.)* |
| `UpdateRules` | UI→A | **no payload** — a trigger, not a source. The Agent re-reads only its own `%LOCALAPPDATA%\FrameLedger\rules\` copy → `UpdateRulesAck { outcome }`. *(Built 2026-09-13, PR-1b: the seeder's `EnsureSeededAsync` outcome; a payload naming a path is ignored, and a test sends one to prove it.)* |
+17
View File
@@ -228,6 +228,16 @@ All screens are `Page`s registered with the navigation page provider and navigat
> blocked row: its one action could only be refused. Tests: `GameDetailViewModelTests` (hidden, shown, the card
> pill), `BlockedReasonTextTests`, `PagesLoadTests.AnAntiCheatGamesPageRendersTheFindingInPlaceOfTheHookingCard`.
>
> **D38 (2026-10-03, beta.11): the trial.** *Not eligible: N successful hooked session(s), two are needed* is gone — a
> grant needs no session. The card reads *Exception in force since … — trial: N of 2 good sessions so far* until the
> trial is over, *Not eligible: an exception of this game ended during its trial on …, so none can be made again* after
> a failed one, and *Not eligible now: {family} was not found in the game's folder when it was checked* where the
> tolerant scan found nothing of the family (it used to say the check "could not finish"). The **Anti-cheat** card of an
> eligible game says hooking is off *unless you make a user-mode exception for it (below)* — "cannot be turned on" beside
> a usable *Make exception…* contradicted itself. The disclosure (`ac-exception-dialog/2`) names no session count and
> has a **Trial** paragraph. Tests: `GameDetailViewModelTests.WhyAGameIsNotEligibleIsSaidOnItsPage`,
> `SettingsViewModelTests.TheExceptionOptionIsOffByDefaultAndItsListFollowsTheAgentsColumns`, `AntiCheatExceptionsTests`.
>
> **The user-mode exception (2026-09-26, beta.9, owner decision D33).** While Settings' option is on, a blocked
> game's page shows a **User-mode exception** card with the Agent's answer about it (`Services.ExceptionView` over
> `GameRow.AcException` — the App reads those columns and writes none): *Eligible — no exception made* with **Make
@@ -501,6 +511,13 @@ Agent section: elevation state with a plain explanation of what elevation *optio
> the option off only kept exceptions are listed, *suspended*. *Checking…* shows until the Agent has answered about
> every blocked game, and **Refresh** re-reads the list (the Agent's sweep runs every 15 s). The option is an
> Agent-read key and takes effect at the next session start and command.
>
> **2026-10-03 (beta.11, D38):** the option reads *Allow hooking in games whose only anti-cheat runs in user mode*, and
> its body names the trial. The list shows **only rows with an action** — eligible (**Make exception…**) or carrying an
> exception (**Withdraw**); "held back only by the session count" is gone with the count, and a game that can never
> qualify is explained on its own page. Each row is the game, its finding and its state — the state carries a grant's
> trial (*Exception in force since … — trial: 1 of 2 good sessions so far*), so the separate count line that repeated it
> is gone. **Refresh** shows only while a row is *Checking…*, the one time it can change anything.
### First-run flow
1. Legal Gate (FR-11): four documents, scrollable, links to GitHub-hosted versions, single Accept.
+36 -6
View File
@@ -483,10 +483,19 @@ unmeasured rule — NetEase Yidun, `AntiCheatFile NEP2.dll` — after FrameLedge
normal Tier-1 sessions in the owner's ledger, 474,143 frames). The owner asked for a way to keep measuring a game like
that, and chose, against the rule this document had kept since 2026-09-22 and with that rule quoted back to them, **an
exception the user grants per game, bound to evidence, and only for anti-cheat that is user-mode throughout.** The
reasons D22 withdrew the override are answered one by one: it "did nothing where it was wanted" — an exception is only
offered where FrameLedger has already measured the game hooked; it "only exposed the user to the risk its own disclosure
described" — that risk stands, and the disclosure says so, including that a ban can arrive days later and that FrameLedger
cannot know.
reasons D22 withdrew the override are answered one by one: it "did nothing where it was wanted" — ~~an exception is only
offered where FrameLedger has already measured the game hooked~~ *(D38 below: the measurement now comes under the grant,
as its trial)*; it "only exposed the user to the risk its own disclosure described" — that risk stands, and the disclosure
says so, including that a ban can arrive days later and that FrameLedger cannot know.
> **Amended 2026-10-03 (owner decision D38): the evidence comes after the grant, as a trial.** The owner deleted their
> ledger and found *GIRLS' FRONTLINE 2* "Not eligible: 0 successful hooked session(s), two are needed" — for good. The rule
> below was a catch-22 for every game it could ever meet again: since beta.8 the library sweep blocks a game the moment
> it is added, a blocked game is never hooked without a grant (`CaptureSession` sends it to Tier 2 before the resolver),
> so it can never earn the two sessions, and a reset ledger loses the ones it had. D33's evidence was reachable only for a
> game measured before its block, and only while those rows lasted. Asked with that, the owner chose: **a grant needs no
> session; the first two hooked sessions under it are a trial; any of them that does not go well ends the exception for
> good** (`games.ac_exception_trial_failed_at`, schema 0017, which nothing clears). Every other condition is unchanged.
**What may be excepted — all of it must hold:**
@@ -499,8 +508,10 @@ cannot know.
- no `*.sys` anywhere in the install tree — the kernel-driver rule (D30) is never excepted, whichever family a driver
belongs to (so *Aniimo*, which unpacks `NEPKernel.sys` beside `NEP2.dll` on its first run, stays blocked);
- the game is on no title list (`BlockedExecutable`, `BlockedStoreId` — the notorious titles are there by design);
- the ledger holds **at least two successful Tier-1 sessions** of the game: hooked, frames recorded, `exit_status = normal`
(which since beta.8 includes End task's exit code 1 and a user's stop), never crashed, never unhooked for safety.
- ~~the ledger holds **at least two successful Tier-1 sessions** of the game: hooked, frames recorded, `exit_status = normal`
(which since beta.8 includes End task's exit code 1 and a user's stop), never crashed, never unhooked for safety.~~
**Since D38 (2026-10-03): no session is needed** — and no exception of the game has ever ended during its trial
(`ac_exception_trial_failed_at` is NULL).
**Never excepted, whatever the user ticked:** a machine-wide `BlockedDriver` or `BlockedService`, the fuzzy tier
(`SuspiciousUnsigned`), a scan that could not look or finish, unusable rules, `TargetUnreadable` (D21), a 32-bit target,
@@ -525,6 +536,18 @@ in-process floor stop revokes it; an executable change ends it with the consent
the option off suspends every exception. **The block itself is never cleared** — the exception is a separate layer over
it, and the finding stays on the game's page (FR-2.2).
**The trial (D38).** Until two sessions under a grant have succeeded — hooked, stored, frames recorded, `normal`
(`ISessionRepository.CountSuccessfulUnderGrantAsync`: under that family, started at or after the grant) — the grant is in
its trial, and the App says so ("trial: 1 of 2"). During the trial **any** end of the list above ends the exception
**for good**, and so does a stored hooked session that recorded no frame or did not end normally
(`UserModeExceptionLapse.TrialFailed`, decided by `UserModeExceptionLapsePolicy` when the recorder stores the row): the
end is recorded with its own reason and `ac_exception_trial_failed_at` is set. While it is set the sweep writes the game
not eligible, the Agent refuses a grant (`Refused.reason = TrialFailed`, the signal is when) and the store refuses one in
SQL; withdrawing, a game update, *Change executable* and a twin merge all keep it. A session too short to be stored, or
one that was never hooked, proves nothing either way and is not judged. After the trial, an end is what it was under
D33: the exception may be made again once the sweep finds the game eligible. Deleting sessions can only lengthen a trial
— the count is read, never stored as a grant's own fact.
**What it is not.** Not a bypass of a live refusal, not a global switch (a Settings option off by default enables the list,
and the user ticks each game), not reachable from the command line, and not evasion: the DLL stays `LoadLibraryW`-loaded,
named and visible (rule 3). `InjectViaLoadLibrary` still has internal linkage in `fl_guard.cpp`; `tools/chokepoint-check.ps1`
@@ -539,6 +562,13 @@ option and the list in Settings, the versioned disclosure (`Safety_Exception_*`,
game page's exception card and its usable switch under an exception in force, the marks, and the legal text
(Disclaimer §2A 2.7, EULA 1.3, the accuracy block, SECURITY.md) — `08_UI` §Games.*
*D38 in beta.11 (2026-10-03): `UserModeExceptionRules.TrialSessions` replaces `RequiredSessions`; eligibility is the
guard's answer and the trial mark; `ac_exception_sessions` is the trial's progress; schema 0017
(`ac_exception_trial_failed_at`); `Refused.reason` `TrialFailed` replaces `TooFewSessions`; the disclosure is
`ac-exception-dialog/2` (its `Why` names no count, a new `Trial` paragraph); the Settings list shows only games it can act
on; and a sweep that cannot read the executable answers "could not verify" instead of leaving the row "checking" for ever.
Legal text: Disclaimer §2A 2.9, EULA 1.4, the accuracy block, SECURITY.md, LIMITATIONS.md.*
### The floor data cannot remove
+3 -1
View File
@@ -45,7 +45,9 @@ Rules for this document:
> library sweep blocked a game FrameLedger had measured hooked (GIRLS' FRONTLINE 2: EXILIUM, NetEase Yidun `NEP2.dll`),
> and the owner chose an evidence-bound, per-game exception for anti-cheat that is user-mode throughout (`19_SAFETY`
> §The user-mode exception; CLAUDE.md rule 2's amendment). The two reasons D22 gave are answered: it is offered only
> where FrameLedger has already measured the game hooked, and its risk is stated in its own disclosure. **What stays
> where FrameLedger has already measured the game hooked, and its risk is stated in its own disclosure. *(2026-10-03,
> D38: the first of the two no longer holds as written — a game blocked at add time could never be measured, so the
> measurement moved under the grant as a two-session trial whose failure is for good.)* **What stays
> open, and is the owner's:** the `ja` text of `Safety_Exception_*`, which ships as English until a reviewer signs;
> whether a family the rules file makes kernel-level later should end existing exceptions at once (today it does, at
> the sweep's next pass and at every session start); and a real-hardware check that NEP2.dll's load time relative to
+2 -2
View File
@@ -84,8 +84,8 @@
> game in the library, before injection, at a session's start or by the 30 s re-check; the game's page says so,
> and nothing turns it back on for that executable — except a user-mode exception you make yourself, per game,
> in Settings (off by default): only where the only finding is one anti-cheat that runs entirely in user mode, with
> no driver file in the game's folder, on a game already measured successfully at least twice. The guard still
> runs every check under it and ends it on anything new; a ban remains possible.
> no driver file in the game's folder. Its first two sessions are a trial, and one that does not go well ends it
> for good. The guard still runs every check under it and ends it on anything new; a ban remains possible.
>
> Where a value is not measured it reads `N/A`, with two exceptions: FPS then shows Presented FPS with a
> note on what it may include, and ray-tracing flags may show a value you set yourself, labelled as
+11 -8
View File
@@ -1,6 +1,6 @@
# FrameLedger — Disclaimer
**Version:** 2.8 · **Effective:** {{RELEASE_DATE}}
**Version:** 2.9 · **Effective:** {{RELEASE_DATE}}
> **How this document is kept true.** The statement of what FrameLedger measures (§4) is `legal/ACCURACY.md`,
> embedded here and in `README.md` and bound to its source by `tools/accuracy-check.ps1`, which fails the build when a
@@ -92,11 +92,14 @@ notes.
**Since 0.1.0-beta.9 there is one exception, and it is not a way past the guard.** A Settings option, off unless you
turn it on, lets you make an exception — one game at a time, after a disclosure you must accept — for a game whose only
finding is a single anti-cheat that works entirely in user mode (no kernel driver, no service, and no driver file
anywhere in the game's folder), that is on no list of titles FrameLedger refuses, and that FrameLedger has already
measured successfully at least twice. Under it the guard still runs every check, before injecting and every 30
seconds, and still refuses anything else it finds; the exception ends by itself when something new is found, when a
session under it crashes or is stopped for safety, or when the game is updated, and turning the option off suspends
it. Sessions recorded under it are marked with the anti-cheat they ran beside.
anywhere in the game's folder) and that is on no list of titles FrameLedger refuses. Since 0.1.0-beta.11 the game does
not need to have been measured before: **the first two sessions under the exception are a trial**, and if one of them
does not go well — it crashes, records nothing, does not end normally, is stopped for safety, or something new is found
— the exception ends and can never be made again for that game. Under it the guard still runs every check, before
injecting and every 30 seconds, and still refuses anything else it finds; after the trial the exception ends by itself
when something new is found, when a session under it crashes or is stopped for safety, or when the game is updated, and
turning the option off suspends it. Sessions recorded under it are marked with the anti-cheat they ran beside. **Two
good sessions are not evidence that the anti-cheat did not notice** — a ban may still come later.
**It exists because users asked for it, and it carries exactly the risk this document describes.** That anti-cheat
may still detect FrameLedger in the game and warn, block or permanently ban your account — possibly days later — and
@@ -187,8 +190,8 @@ Frame timing is derived from high-resolution timestamps taken at the moment the
> game in the library, before injection, at a session's start or by the 30 s re-check; the game's page says so,
> and nothing turns it back on for that executable — except a user-mode exception you make yourself, per game,
> in Settings (off by default): only where the only finding is one anti-cheat that runs entirely in user mode, with
> no driver file in the game's folder, on a game already measured successfully at least twice. The guard still
> runs every check under it and ends it on anything new; a ban remains possible.
> no driver file in the game's folder. Its first two sessions are a trial, and one that does not go well ends it
> for good. The guard still runs every check under it and ends it on anything new; a ban remains possible.
>
> Where a value is not measured it reads `N/A`, with two exceptions: FPS then shows Presented FPS with a
> note on what it may include, and ray-tracing flags may show a value you set yourself, labelled as
+2 -2
View File
@@ -1,6 +1,6 @@
# FrameLedger — End User License Agreement (EULA)
**Version:** 1.3 · **Effective:** {{RELEASE_DATE}}
**Version:** 1.4 · **Effective:** {{RELEASE_DATE}}
This End User License Agreement ("Agreement") applies to **FrameLedger** ("the Software"), developed and published by **poli0981** ("the Developer"), contactable at <contact@poli0981.dev> — see <https://poli0981.dev/> for other contact channels.
@@ -14,7 +14,7 @@ The Software records game performance data, hardware telemetry (temperatures, lo
## 2A. Code injection — your responsibility
To measure rendering settings accurately, the Software can load a component into a game process, **but only for games you have individually enabled**, after a consent prompt that explains the risk. The Software refuses to do so when it detects anti-cheat or anti-tamper software, turns hooking off for that game, and provides no means to override that refusal — except a narrow, per-game exception for anti-cheat that works entirely in user mode, which you may make yourself, after a separate disclosure, for a game the Software has already measured successfully, and under which the Software still runs every check (Disclaimer §2A). By making such an exception you accept, for that game, the risk described in (b) below.
To measure rendering settings accurately, the Software can load a component into a game process, **but only for games you have individually enabled**, after a consent prompt that explains the risk. The Software refuses to do so when it detects anti-cheat or anti-tamper software, turns hooking off for that game, and provides no means to override that refusal — except a narrow, per-game exception for anti-cheat that works entirely in user mode, which you may make yourself, after a separate disclosure, whose first two sessions are a trial that ends it for good if one of them does not go well, and under which the Software still runs every check (Disclaimer §2A). By making such an exception you accept, for that game, the risk described in (b) below.
By enabling this feature for a game, you confirm that:
@@ -121,7 +121,7 @@ internal static class AgentServices
{
services.AddSingleton<IUserModeExceptionSwitch, SettingsUserModeExceptionSwitch>();
services.AddSingleton<IOverlayToleranceChannel>(static _ => new OverlayToleranceChannel(static line => Serilog.Log.Information("{Line}", line)));
services.AddSingleton(static sp => new UserModeExceptionLapsePolicy(sp.GetRequiredService<IGameConsentStore>()));
services.AddSingleton(static sp => new UserModeExceptionLapsePolicy(sp.GetRequiredService<IGameConsentStore>(), sp.GetRequiredService<ISessionRepository>()));
}
/// <summary>
@@ -269,10 +269,9 @@ internal static class AgentServices
sp.GetRequiredService<ExecutableRelocator>(),
// beta.8: an executable that cannot run as x64 is refused before anything is scanned or stamped.
new PeArchitectureSource(),
// D33: the user-mode exception's option, evidence and disclosure version.
// D33: the user-mode exception's option and disclosure version (D38: no session count any more).
new AntiCheatExceptionCommands(
sp.GetRequiredService<IUserModeExceptionSwitch>(),
sp.GetRequiredService<ISessionRepository>(),
AntiCheatExceptionDisclosure.Version));
/// <summary>
@@ -17,6 +17,7 @@
<StackPanel>
<ui:TextBlock Text="{Binding Intro}" TextWrapping="Wrap" />
<ui:TextBlock Margin="0,14,0,0" Text="{Binding Why}" TextWrapping="Wrap" />
<ui:TextBlock Margin="0,8,0,0" FontWeight="SemiBold" Text="{x:Static vm:AntiCheatExceptionDialogViewModel.Trial}" TextWrapping="Wrap" />
<Border Margin="0,14,0,0" Padding="12" CornerRadius="6" Background="{DynamicResource CardBackgroundFillColorDefaultBrush}">
<ui:TextBlock FontWeight="SemiBold" Text="{Binding Risk}" TextWrapping="Wrap" />
+3 -2
View File
@@ -102,7 +102,6 @@
<StackPanel Grid.Column="0">
<ui:TextBlock FontTypography="BodyStrong" Text="{Binding Name}" />
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{Binding FindingText}" />
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{Binding SessionsText}" />
<ui:TextBlock Appearance="Secondary" TextWrapping="Wrap" Text="{Binding StateText}" />
<ui:TextBlock Appearance="Tertiary" TextWrapping="Wrap" Text="{Binding LapseText}"
Visibility="{Binding LapseText, Converter={StaticResource NullToCollapsed}}" />
@@ -121,10 +120,12 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Only while the Agent is still answering: the sweep publishes nothing, so this is how its answer arrives. -->
<ui:Button Margin="0,8,0,0"
Appearance="Secondary"
Command="{Binding ViewModel.RefreshExceptionsCommand}"
Content="{x:Static res:Strings.Settings_Exceptions_Refresh}" />
Content="{x:Static res:Strings.Settings_Exceptions_Refresh}"
Visibility="{Binding ViewModel.ExceptionsChecking, Converter={StaticResource BoolToVis}}" />
</StackPanel>
</ui:CardExpander>
@@ -1,4 +1,7 @@
namespace FrameLedger.App.Services;
/// <summary>D33: what the exception's disclosure names — the game, the anti-cheat family and its signal, and the evidence.</summary>
public sealed record AntiCheatExceptionFacts(string GameName, string Family, string Signal, int Sessions);
/// <summary>
/// D33: what the exception's disclosure names — the game, the anti-cheat family and its signal. (D38 took the session count
/// out: a grant needs no session, and its first two are a trial the disclosure describes.)
/// </summary>
public sealed record AntiCheatExceptionFacts(string GameName, string Family, string Signal);
@@ -26,7 +26,7 @@ public sealed record AntiCheatExceptionResult(AntiCheatExceptionOutcome Outcome,
_ => null,
};
/// <summary>Why no exception was made, in the user's language: the session count, the finding, or the block's kind.</summary>
/// <summary>Why no exception was made, in the user's language: a failed trial (D38), the finding, or the block's kind.</summary>
public string? RefusalText()
{
if (Refusal is null)
@@ -36,11 +36,17 @@ public sealed record AntiCheatExceptionResult(AntiCheatExceptionOutcome Outcome,
return Refusal.Reason switch
{
"TooFewSessions" => string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_TooFew_Format, Refusal.Signal ?? "0"),
"TrialFailed" => string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_TrialFailed_Format, TrialFailedDate(Refusal.Signal)),
"BlockNotExceptionable" => Strings.Exception_State_NotAsked,
"PreScanFailed" or "RulesUnreadable" or "RulesMalformed" or "RulesIncomplete" => Strings.Exception_State_CouldNotVerify,
_ => string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_Refused_Format,
Refusal.Family ?? Formats.GuardReasonText(Refusal.Reason), Refusal.Signal ?? Strings.Common_NotAvailable),
};
}
/// <summary>D38: the Agent sends when the trial failed as unix milliseconds; anything else reads as not available.</summary>
private static string TrialFailedDate(string? unixMs) =>
long.TryParse(unixMs, NumberStyles.Integer, CultureInfo.InvariantCulture, out long ms)
? Formats.Date(DateTimeOffset.FromUnixTimeMilliseconds(ms))
: Strings.Common_NotAvailable;
}
+34 -16
View File
@@ -6,9 +6,10 @@ using FrameLedger.Domain.AntiCheat;
namespace FrameLedger.App.Services;
/// <summary>
/// D33 (owner decision 2026-09-26): a blocked game's user-mode exception as the App shows it — in force, eligible, being
/// checked, or why not — read from the Agent's columns (<see cref="GameRow.AcException"/>). The App decides nothing here:
/// every state is a reading of what the Agent wrote, and the grant itself is the Agent's to make.
/// D33 (owner decision 2026-09-26): a blocked game's user-mode exception as the App shows it — in force (and, since D38, how
/// far its trial has come), eligible, being checked, or why not — read from the Agent's columns
/// (<see cref="GameRow.AcException"/>). The App decides nothing here: every state is a reading of what the Agent wrote, and
/// the grant itself is the Agent's to make.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
public sealed record ExceptionView(ExceptionViewKind Kind, string Text, string? Family, string? Signal, int Sessions, string? LapseText)
@@ -21,7 +22,8 @@ public sealed record ExceptionView(ExceptionViewKind Kind, string Text, string?
/// <summary>
/// The row's exception, or null for a row it says nothing about (not blocked). Granted first — a grant stays until the
/// Agent or the user ends it — then the block's kind, then the sweep's answer about THIS block.
/// Agent or the user ends it — then the block's kind, then a failed trial (D38: for good, whatever a check says), then
/// the sweep's answer about THIS block.
/// </summary>
public static ExceptionView? Of(GameRow row)
{
@@ -38,8 +40,7 @@ public sealed record ExceptionView(ExceptionViewKind Kind, string Text, string?
: null;
if (x.IsGranted)
{
return new(ExceptionViewKind.Granted, string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_Granted_Format, Formats.Date(x.GrantedAt!.Value)),
x.Family, block?.Signal, x.Sessions, lapse);
return new(ExceptionViewKind.Granted, GrantedText(x), x.Family, block?.Signal, x.Sessions, lapse);
}
if (block is not { IsExceptionable: true } b)
@@ -47,14 +48,27 @@ public sealed record ExceptionView(ExceptionViewKind Kind, string Text, string?
return new(ExceptionViewKind.NotEligible, Strings.Exception_State_NotAsked, block?.Family, block?.Signal, x.Sessions, lapse);
}
if (x.TrialFailedAt is { } failed)
{
return new(ExceptionViewKind.NotEligible, string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_TrialFailed_Format, Formats.Date(failed)),
b.Family, b.Signal, x.Sessions, lapse);
}
if (!string.Equals(x.CheckedBlock, row.HookBlockedReason, StringComparison.Ordinal))
{
return new(ExceptionViewKind.Checking, Strings.Exception_State_Checking, b.Family, b.Signal, x.Sessions, lapse);
}
return x.Eligible
? new(ExceptionViewKind.Eligible, Strings.Exception_State_Eligible, b.Family, b.Signal, x.Sessions, lapse)
: new(NotEligibleKind(x), WhyNot(b, x), b.Family, b.Signal, x.Sessions, lapse);
if (x.Eligible)
{
return new(ExceptionViewKind.Eligible, Strings.Exception_State_Eligible, b.Family, b.Signal, x.Sessions, lapse);
}
// A guard that let the family through over a row that does not say eligible is an answer from before D38 (it
// counted sessions); the Agent's next pass rewrites it, so until then it is being checked.
return StoredBlock.Parse(x.Verdict) is { Reason: AntiCheatRefusalReason.AllowedUnderUserModeException }
? new(ExceptionViewKind.Checking, Strings.Exception_State_Checking, b.Family, b.Signal, x.Sessions, lapse)
: new(ExceptionViewKind.NotEligible, WhyNot(b, x), b.Family, b.Signal, x.Sessions, lapse);
}
/// <summary>Why the last grant ended, in words.</summary>
@@ -67,14 +81,16 @@ public sealed record ExceptionView(ExceptionViewKind Kind, string Text, string?
UserModeExceptionLapse.SafetyUnhook => Strings.Exception_Lapse_SafetyUnhook,
UserModeExceptionLapse.OverlayStopped => Strings.Exception_Lapse_OverlayStopped,
UserModeExceptionLapse.SessionCrashed => Strings.Exception_Lapse_SessionCrashed,
UserModeExceptionLapse.TrialFailed => Strings.Exception_Lapse_TrialFailed,
_ => reason,
};
/// <summary>The guard let the family through and only the evidence is short — the one "not yet" the Settings list shows.</summary>
private static ExceptionViewKind NotEligibleKind(AntiCheatExceptionState x) =>
StoredBlock.Parse(x.Verdict) is { Reason: AntiCheatRefusalReason.AllowedUnderUserModeException }
? ExceptionViewKind.TooFewSessions
: ExceptionViewKind.NotEligible;
/// <summary>D38: a grant in its trial says how far it has come; one past it says only since when.</summary>
private static string GrantedText(AntiCheatExceptionState x) =>
UserModeExceptionRules.InTrial(x.Sessions)
? string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_GrantedTrial_Format, Formats.Date(x.GrantedAt!.Value), x.Sessions,
UserModeExceptionRules.TrialSessions)
: string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_Granted_Format, Formats.Date(x.GrantedAt!.Value));
private static string WhyNot(StoredBlock block, AntiCheatExceptionState x)
{
@@ -84,9 +100,11 @@ public sealed record ExceptionView(ExceptionViewKind Kind, string Text, string?
return Strings.Exception_State_NotAsked;
}
if (verdict.Value.Reason == AntiCheatRefusalReason.AllowedUnderUserModeException)
// A plain pass: the tolerant scan found nothing of the family, so it confirmed nothing — the check DID finish
// (it used to be said as "could not finish").
if (verdict.Value.Reason == AntiCheatRefusalReason.Allow)
{
return string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_TooFew_Format, x.Sessions);
return string.Format(CultureInfo.CurrentCulture, Strings.Exception_State_NotFound_Format, block.Family);
}
if (!verdict.Value.IsExceptionable && verdict.Value.Family.Length == 0)
@@ -1,17 +1,18 @@
namespace FrameLedger.App.Services;
/// <summary>D33: the states a blocked game's user-mode exception is shown in (<see cref="ExceptionView"/>).</summary>
/// <remarks>
/// D38 (2026-10-03) removed <c>TooFewSessions</c>: a grant needs no session any more, so "not yet" is no longer a state —
/// a game is eligible, being checked, or not eligible for a reason that says whether it can change.
/// </remarks>
public enum ExceptionViewKind
{
/// <summary>An exception is on the row.</summary>
/// <summary>An exception is on the row (in its trial or past it).</summary>
Granted,
/// <summary>The Agent found the game eligible; no exception has been made.</summary>
Eligible,
/// <summary>The guard would let the family through, and the game has fewer than two successful hooked sessions.</summary>
TooFewSessions,
/// <summary>The Agent has not answered about this block yet (the option was just turned on, or the block changed).</summary>
Checking,
+14 -5
View File
@@ -244,20 +244,22 @@ public static class Strings
nameof(Exception_Lapse_OverlayStopped),
nameof(Exception_Lapse_SafetyUnhook),
nameof(Exception_Lapse_SessionCrashed),
nameof(Exception_Lapse_TrialFailed),
nameof(Exception_Lapse_Withdrawn),
nameof(Exception_Lapsed_Format),
nameof(Exception_Result_Granted_Format),
nameof(Exception_Result_Refused_Format),
nameof(Exception_Result_Withdrawn_Format),
nameof(Exception_Sessions_Format),
nameof(Exception_State_Checking),
nameof(Exception_State_CouldNotVerify),
nameof(Exception_State_Eligible),
nameof(Exception_State_Granted_Format),
nameof(Exception_State_GrantedTrial_Format),
nameof(Exception_State_NotAsked),
nameof(Exception_State_NotFound_Format),
nameof(Exception_State_NotUserMode_Format),
nameof(Exception_State_Refused_Format),
nameof(Exception_State_TooFew_Format),
nameof(Exception_State_TrialFailed_Format),
nameof(Exe_DriveMissing_Format),
nameof(Exe_FileMissing_Format),
nameof(Exit_Code_Format),
@@ -358,6 +360,7 @@ public static class Strings
nameof(Fps_Native_Tooltip),
nameof(Fps_None_Tooltip),
nameof(Fps_Presented_Format),
nameof(GameDetail_AntiCheat_Exceptionable_Format),
nameof(GameDetail_AntiCheat_Format),
nameof(GameDetail_AntiCheat_Header),
nameof(GameDetail_Back),
@@ -1318,6 +1321,8 @@ public static class Strings
public static string Exception_Lapse_SessionCrashed => ResourceManager.GetString(nameof(Exception_Lapse_SessionCrashed), Culture) ?? nameof(Exception_Lapse_SessionCrashed);
public static string Exception_Lapse_TrialFailed => ResourceManager.GetString(nameof(Exception_Lapse_TrialFailed), Culture) ?? nameof(Exception_Lapse_TrialFailed);
public static string Exception_Lapse_Withdrawn => ResourceManager.GetString(nameof(Exception_Lapse_Withdrawn), Culture) ?? nameof(Exception_Lapse_Withdrawn);
public static string Exception_Lapsed_Format => ResourceManager.GetString(nameof(Exception_Lapsed_Format), Culture) ?? nameof(Exception_Lapsed_Format);
@@ -1328,8 +1333,6 @@ public static class Strings
public static string Exception_Result_Withdrawn_Format => ResourceManager.GetString(nameof(Exception_Result_Withdrawn_Format), Culture) ?? nameof(Exception_Result_Withdrawn_Format);
public static string Exception_Sessions_Format => ResourceManager.GetString(nameof(Exception_Sessions_Format), Culture) ?? nameof(Exception_Sessions_Format);
public static string Exception_State_Checking => ResourceManager.GetString(nameof(Exception_State_Checking), Culture) ?? nameof(Exception_State_Checking);
public static string Exception_State_CouldNotVerify => ResourceManager.GetString(nameof(Exception_State_CouldNotVerify), Culture) ?? nameof(Exception_State_CouldNotVerify);
@@ -1338,13 +1341,17 @@ public static class Strings
public static string Exception_State_Granted_Format => ResourceManager.GetString(nameof(Exception_State_Granted_Format), Culture) ?? nameof(Exception_State_Granted_Format);
public static string Exception_State_GrantedTrial_Format => ResourceManager.GetString(nameof(Exception_State_GrantedTrial_Format), Culture) ?? nameof(Exception_State_GrantedTrial_Format);
public static string Exception_State_NotAsked => ResourceManager.GetString(nameof(Exception_State_NotAsked), Culture) ?? nameof(Exception_State_NotAsked);
public static string Exception_State_NotFound_Format => ResourceManager.GetString(nameof(Exception_State_NotFound_Format), Culture) ?? nameof(Exception_State_NotFound_Format);
public static string Exception_State_NotUserMode_Format => ResourceManager.GetString(nameof(Exception_State_NotUserMode_Format), Culture) ?? nameof(Exception_State_NotUserMode_Format);
public static string Exception_State_Refused_Format => ResourceManager.GetString(nameof(Exception_State_Refused_Format), Culture) ?? nameof(Exception_State_Refused_Format);
public static string Exception_State_TooFew_Format => ResourceManager.GetString(nameof(Exception_State_TooFew_Format), Culture) ?? nameof(Exception_State_TooFew_Format);
public static string Exception_State_TrialFailed_Format => ResourceManager.GetString(nameof(Exception_State_TrialFailed_Format), Culture) ?? nameof(Exception_State_TrialFailed_Format);
public static string Exe_DriveMissing_Format => ResourceManager.GetString(nameof(Exe_DriveMissing_Format), Culture) ?? nameof(Exe_DriveMissing_Format);
@@ -1546,6 +1553,8 @@ public static class Strings
public static string Fps_Presented_Format => ResourceManager.GetString(nameof(Fps_Presented_Format), Culture) ?? nameof(Fps_Presented_Format);
public static string GameDetail_AntiCheat_Exceptionable_Format => ResourceManager.GetString(nameof(GameDetail_AntiCheat_Exceptionable_Format), Culture) ?? nameof(GameDetail_AntiCheat_Exceptionable_Format);
public static string GameDetail_AntiCheat_Format => ResourceManager.GetString(nameof(GameDetail_AntiCheat_Format), Culture) ?? nameof(GameDetail_AntiCheat_Format);
public static string GameDetail_AntiCheat_Header => ResourceManager.GetString(nameof(GameDetail_AntiCheat_Header), Culture) ?? nameof(GameDetail_AntiCheat_Header);
+22 -10
View File
@@ -2681,6 +2681,10 @@
<value>検出: {0}。このゲームのフックはオフで、オンにすることはできません。セッションにはプレイ時間とセンサーの値だけが記録されます。</value>
<comment>review</comment>
</data>
<data name="GameDetail_AntiCheat_Exceptionable_Format" xml:space="preserve">
<value>検出: {0}。ユーザーモードの例外を作成しない限り(下記)、このゲームのフックはオフです。例外がなければ、セッションにはプレイ時間とセンサーの値だけが記録されます。</value>
<comment>review</comment>
</data>
<data name="Games_Card_AntiCheat" xml:space="preserve">
<value>アンチチート</value>
<comment>review</comment>
@@ -3298,11 +3302,11 @@
<comment>review</comment>
</data>
<data name="Settings_Exceptions_Label" xml:space="preserve">
<value>以前に計測できたユーザーモードのアンチチート搭載ゲームでフックを許可する</value>
<value>アンチチートがユーザーモードのみで動作するゲームでフックを許可する</value>
<comment>review</comment>
</data>
<data name="Settings_Exceptions_Body" xml:space="preserve">
<value>既定ではオフです。オンにすると、アンチチートがユーザーモードのみで動作し(カーネルドライバーがなく、ほかに何も検出されない)、フックで2回以上計測できたゲームに、開示を確認したうえでゲームごとに例外を与えられます。ガードはすべてのチェックを続け、アカウント停止の可能性は残ります。</value>
<value>既定ではオフです。オンにすると、アンチチートがユーザーモードのみで動作する(カーネルドライバーがなく、ほかに何も検出されない)ゲームに、開示を確認したうえでゲームごとに例外を与えられます。最初の2回のフックセッションは試用期間で、うまくいかなかったセッションが1回でもあると例外は永久に終了します。ガードはすべてのチェックを続け、アカウント停止の可能性は残ります。</value>
<comment>review</comment>
</data>
<data name="Settings_Exceptions_Header" xml:space="preserve">
@@ -3329,14 +3333,14 @@
<value>{0} — {1}</value>
<comment>review</comment>
</data>
<data name="Exception_Sessions_Format" xml:space="preserve">
<value>フック計測の成功 {0} 回</value>
<comment>review</comment>
</data>
<data name="Exception_State_Granted_Format" xml:space="preserve">
<value>{0} から例外が有効</value>
<comment>review</comment>
</data>
<data name="Exception_State_GrantedTrial_Format" xml:space="preserve">
<value>{0} から例外が有効 — 試用中: 良好なセッション {1}/{2} 回</value>
<comment>review</comment>
</data>
<data name="Exception_State_Eligible" xml:space="preserve">
<value>対象 — 例外は未作成</value>
<comment>review</comment>
@@ -3345,10 +3349,6 @@
<value>確認中…</value>
<comment>review</comment>
</data>
<data name="Exception_State_TooFew_Format" xml:space="preserve">
<value>対象外: フック計測の成功は {0} 回で、2 回必要です</value>
<comment>review</comment>
</data>
<data name="Exception_State_Refused_Format" xml:space="preserve">
<value>対象外: ガードは {0}({1})も検出しました</value>
<comment>review</comment>
@@ -3365,6 +3365,14 @@
<value>現在は対象外: 確認を完了できませんでした。自動で再実行されます</value>
<comment>review</comment>
</data>
<data name="Exception_State_TrialFailed_Format" xml:space="preserve">
<value>対象外: このゲームの例外は {0} に試用期間中に終了したため、再び作成することはできません</value>
<comment>review</comment>
</data>
<data name="Exception_State_NotFound_Format" xml:space="preserve">
<value>現在は対象外: 確認時にゲームのフォルダーで {0} が見つかりませんでした。ブロックは維持されます</value>
<comment>review</comment>
</data>
<data name="Exception_Lapsed_Format" xml:space="preserve">
<value>直近の例外は {0} に終了しました: {1}</value>
<comment>review</comment>
@@ -3397,6 +3405,10 @@
<value>例外下のセッションがクラッシュしました</value>
<comment>review</comment>
</data>
<data name="Exception_Lapse_TrialFailed" xml:space="preserve">
<value>試用期間中のセッションがうまくいきませんでした(フレームが記録されなかったか、正常に終了しませんでした)</value>
<comment>review</comment>
</data>
<data name="Exception_Result_Granted_Format" xml:space="preserve">
<value>{0} の例外を作成しました。計測するときは、ゲームのページでフックをオンにしてください。</value>
<comment>review</comment>
+17 -8
View File
@@ -2021,6 +2021,9 @@ The documents below are the full terms; this summary does not replace them.</val
<data name="GameDetail_AntiCheat_Format" xml:space="preserve">
<value>Found: {0}. Hooking is off for this game and cannot be turned on; its sessions record play time and sensors only.</value>
</data>
<data name="GameDetail_AntiCheat_Exceptionable_Format" xml:space="preserve">
<value>Found: {0}. Hooking is off for this game unless you make a user-mode exception for it (below); without one, its sessions record play time and sensors only.</value>
</data>
<data name="Games_Card_AntiCheat" xml:space="preserve">
<value>Anti-cheat</value>
</data>
@@ -2484,10 +2487,10 @@ The documents below are the full terms; this summary does not replace them.</val
<value>W</value>
</data>
<data name="Settings_Exceptions_Label" xml:space="preserve">
<value>Allow hooking in games with user-mode anti-cheat that were measured before</value>
<value>Allow hooking in games whose only anti-cheat runs in user mode</value>
</data>
<data name="Settings_Exceptions_Body" xml:space="preserve">
<value>Off by default. On, a game whose only anti-cheat runs in user mode — no kernel driver, nothing else found — and that was measured hooked at least twice can be given an exception below, one game at a time, after a disclosure. The guard still runs every check, and a ban remains possible.</value>
<value>Off by default. On, a game whose only anti-cheat runs in user mode — no kernel driver, nothing else found — can be given an exception below, one game at a time, after a disclosure. Its first two hooked sessions are a trial: one that does not go well ends the exception for good. The guard still runs every check, and a ban remains possible.</value>
</data>
<data name="Settings_Exceptions_Header" xml:space="preserve">
<value>User-mode exceptions</value>
@@ -2507,21 +2510,18 @@ The documents below are the full terms; this summary does not replace them.</val
<data name="Exception_Finding_Format" xml:space="preserve">
<value>{0} — {1}</value>
</data>
<data name="Exception_Sessions_Format" xml:space="preserve">
<value>{0} successful hooked sessions</value>
</data>
<data name="Exception_State_Granted_Format" xml:space="preserve">
<value>Exception in force since {0}</value>
</data>
<data name="Exception_State_GrantedTrial_Format" xml:space="preserve">
<value>Exception in force since {0} — trial: {1} of {2} good sessions so far</value>
</data>
<data name="Exception_State_Eligible" xml:space="preserve">
<value>Eligible — no exception made</value>
</data>
<data name="Exception_State_Checking" xml:space="preserve">
<value>Checking…</value>
</data>
<data name="Exception_State_TooFew_Format" xml:space="preserve">
<value>Not eligible: {0} successful hooked session(s), two are needed</value>
</data>
<data name="Exception_State_Refused_Format" xml:space="preserve">
<value>Not eligible: the guard also found {0} ({1})</value>
</data>
@@ -2534,6 +2534,12 @@ The documents below are the full terms; this summary does not replace them.</val
<data name="Exception_State_CouldNotVerify" xml:space="preserve">
<value>Not eligible now: the check could not finish; it runs again by itself</value>
</data>
<data name="Exception_State_TrialFailed_Format" xml:space="preserve">
<value>Not eligible: an exception of this game ended during its trial on {0}, so none can be made again</value>
</data>
<data name="Exception_State_NotFound_Format" xml:space="preserve">
<value>Not eligible now: {0} was not found in the game's folder when it was checked; the block stays</value>
</data>
<data name="Exception_Lapsed_Format" xml:space="preserve">
<value>The last exception ended on {0}: {1}</value>
</data>
@@ -2558,6 +2564,9 @@ The documents below are the full terms; this summary does not replace them.</val
<data name="Exception_Lapse_SessionCrashed" xml:space="preserve">
<value>a session under it crashed</value>
</data>
<data name="Exception_Lapse_TrialFailed" xml:space="preserve">
<value>a session during its trial did not go well (no frames recorded, or it did not end normally)</value>
</data>
<data name="Exception_Result_Granted_Format" xml:space="preserve">
<value>Exception made for {0}. Turn hooking on for the game on its page when you want to measure it.</value>
</data>
+17 -8
View File
@@ -2016,6 +2016,9 @@ Các tài liệu bên dưới là điều khoản đầy đủ; phần tóm tắ
<data name="GameDetail_AntiCheat_Format" xml:space="preserve">
<value>Đã phát hiện: {0}. Hooking đã tắt cho game này và không thể bật; các phiên của nó chỉ ghi thời gian chơi và cảm biến.</value>
</data>
<data name="GameDetail_AntiCheat_Exceptionable_Format" xml:space="preserve">
<value>Đã phát hiện: {0}. Hooking đã tắt cho game này trừ khi bạn tạo ngoại lệ user-mode cho nó (bên dưới); nếu không, các phiên của nó chỉ ghi thời gian chơi và cảm biến.</value>
</data>
<data name="Games_Card_AntiCheat" xml:space="preserve">
<value>Anti-cheat</value>
</data>
@@ -2479,10 +2482,10 @@ Các tài liệu bên dưới là điều khoản đầy đủ; phần tóm tắ
<value>W</value>
</data>
<data name="Settings_Exceptions_Label" xml:space="preserve">
<value>Cho phép hooking ở game có anti-cheat user-mode đã từng đo thành công</value>
<value>Cho phép hooking ở game chỉ có anti-cheat chạy ở user mode</value>
</data>
<data name="Settings_Exceptions_Body" xml:space="preserve">
<value>Mặc định tắt. Khi bật, game có anti-cheat duy nhất chạy ở user mode — không có kernel driver, không phát hiện gì khác — và đã được đo ở chế độ hook ít nhất hai lần có thể được cấp ngoại lệ bên dưới, từng game một, sau một bản công bố rủi ro. Bộ bảo vệ vẫn chạy mọi bước kiểm tra, và vẫn có thể bị khoá tài khoản.</value>
<value>Mặc định tắt. Khi bật, game có anti-cheat duy nhất chạy ở user mode — không có kernel driver, không phát hiện gì khác — có thể được cấp ngoại lệ bên dưới, từng game một, sau một bản công bố rủi ro. Hai phiên hook đầu tiên là phiên thử: một phiên không ổn sẽ kết thúc ngoại lệ vĩnh viễn. Bộ bảo vệ vẫn chạy mọi bước kiểm tra, và vẫn có thể bị khoá tài khoản.</value>
</data>
<data name="Settings_Exceptions_Header" xml:space="preserve">
<value>Ngoại lệ user-mode</value>
@@ -2502,21 +2505,18 @@ Các tài liệu bên dưới là điều khoản đầy đủ; phần tóm tắ
<data name="Exception_Finding_Format" xml:space="preserve">
<value>{0} — {1}</value>
</data>
<data name="Exception_Sessions_Format" xml:space="preserve">
<value>{0} phiên hook thành công</value>
</data>
<data name="Exception_State_Granted_Format" xml:space="preserve">
<value>Ngoại lệ có hiệu lực từ {0}</value>
</data>
<data name="Exception_State_GrantedTrial_Format" xml:space="preserve">
<value>Ngoại lệ có hiệu lực từ {0} — đang thử: đã có {1}/{2} phiên tốt</value>
</data>
<data name="Exception_State_Eligible" xml:space="preserve">
<value>Đủ điều kiện — chưa tạo ngoại lệ</value>
</data>
<data name="Exception_State_Checking" xml:space="preserve">
<value>Đang kiểm tra…</value>
</data>
<data name="Exception_State_TooFew_Format" xml:space="preserve">
<value>Chưa đủ điều kiện: {0} phiên hook thành công, cần hai</value>
</data>
<data name="Exception_State_Refused_Format" xml:space="preserve">
<value>Không đủ điều kiện: bộ bảo vệ còn phát hiện {0} ({1})</value>
</data>
@@ -2529,6 +2529,12 @@ Các tài liệu bên dưới là điều khoản đầy đủ; phần tóm tắ
<data name="Exception_State_CouldNotVerify" xml:space="preserve">
<value>Hiện chưa đủ điều kiện: lần kiểm tra không hoàn tất; nó sẽ tự chạy lại</value>
</data>
<data name="Exception_State_TrialFailed_Format" xml:space="preserve">
<value>Không đủ điều kiện: một ngoại lệ của game này đã kết thúc trong thời gian thử vào {0}, nên không thể tạo lại</value>
</data>
<data name="Exception_State_NotFound_Format" xml:space="preserve">
<value>Hiện không đủ điều kiện: lúc kiểm tra không thấy {0} trong thư mục game; lệnh chặn vẫn giữ nguyên</value>
</data>
<data name="Exception_Lapsed_Format" xml:space="preserve">
<value>Ngoại lệ gần nhất đã kết thúc ngày {0}: {1}</value>
</data>
@@ -2553,6 +2559,9 @@ Các tài liệu bên dưới là điều khoản đầy đủ; phần tóm tắ
<data name="Exception_Lapse_SessionCrashed" xml:space="preserve">
<value>một phiên dưới ngoại lệ bị crash</value>
</data>
<data name="Exception_Lapse_TrialFailed" xml:space="preserve">
<value>một phiên trong thời gian thử không ổn (không ghi được frame nào, hoặc không kết thúc bình thường)</value>
</data>
<data name="Exception_Result_Granted_Format" xml:space="preserve">
<value>Đã tạo ngoại lệ cho {0}. Khi muốn đo, hãy bật hooking cho game trên trang của nó.</value>
</data>
@@ -6,8 +6,8 @@ using SafetyStrings = FrameLedger.Shared.Strings;
namespace FrameLedger.App.ViewModels;
/// <summary>
/// D33's disclosure content (<c>19_SAFETY</c> §The user-mode exception): why the exception is offered, the risk at the same
/// grain as FR-2.1's dialog, what is still refused, how it ends, and that it turns nothing on. <see cref="Accepted"/> — the
/// D33's disclosure content (<c>19_SAFETY</c> §The user-mode exception): why the exception is offered, its trial (D38), the
/// risk at the same grain as FR-2.1's dialog, what is still refused, how it ends, and that it turns nothing on. <see cref="Accepted"/> — the
/// user ticking "I accept the risk of a ban for this game" — is the one thing that enables the dialog's primary button.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime; a cached CompositeFormat would pin the first culture")]
@@ -22,7 +22,7 @@ public sealed partial class AntiCheatExceptionDialogViewModel : ObservableObject
Facts = facts;
Title = string.Format(CultureInfo.CurrentCulture, SafetyStrings.Safety_Exception_Title_Format, facts.GameName);
Intro = string.Format(CultureInfo.CurrentCulture, SafetyStrings.Safety_Exception_Intro_Format, facts.Family, facts.Signal);
Why = string.Format(CultureInfo.CurrentCulture, SafetyStrings.Safety_Exception_Why_Format, facts.Family, facts.Sessions);
Why = string.Format(CultureInfo.CurrentCulture, SafetyStrings.Safety_Exception_Why_Format, facts.Family);
Risk = string.Format(CultureInfo.CurrentCulture, SafetyStrings.Safety_Exception_Risk_Format, facts.Family);
Still = string.Format(CultureInfo.CurrentCulture, SafetyStrings.Safety_Exception_Still_Format, facts.Family);
}
@@ -39,6 +39,9 @@ public sealed partial class AntiCheatExceptionDialogViewModel : ObservableObject
public string Still { get; }
/// <summary>D38: the grant's first two sessions are a trial, and one that does not go well ends it for good.</summary>
public static string Trial => SafetyStrings.Safety_Exception_Trial;
public static string Ends => SafetyStrings.Safety_Exception_Ends;
public static string Next => SafetyStrings.Safety_Exception_Next;
@@ -5,8 +5,9 @@ using FrameLedger.App.Services;
namespace FrameLedger.App.ViewModels;
/// <summary>
/// One row of Settings ▸ Capture's user-mode exception list (D33): the game, what was found, the evidence, the state — and
/// the one action the state allows, making the exception (through its disclosure) or withdrawing it.
/// One row of Settings ▸ Capture's user-mode exception list (D33): the game, what was found, the state — which carries a
/// grant's trial since D38, so no separate count line repeats it — and the one action the state allows, making the
/// exception (through its disclosure) or withdrawing it.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1863:Use 'CompositeFormat'", Justification = "the format strings are resources that follow the UI culture, which changes at runtime")]
public sealed partial class ExceptionGameViewModel
@@ -23,7 +24,6 @@ public sealed partial class ExceptionGameViewModel
_grant = grant ?? throw new ArgumentNullException(nameof(grant));
_withdraw = withdraw ?? throw new ArgumentNullException(nameof(withdraw));
FindingText = string.Format(CultureInfo.CurrentCulture, Strings.Exception_Finding_Format, view.Family ?? Strings.Common_NotAvailable, view.Signal ?? Strings.Common_NotAvailable);
SessionsText = string.Format(CultureInfo.CurrentCulture, Strings.Exception_Sessions_Format, view.Sessions);
}
public long GameId { get; }
@@ -34,8 +34,6 @@ public sealed partial class ExceptionGameViewModel
public string FindingText { get; }
public string SessionsText { get; }
public string StateText => View.Text;
public string? LapseText => View.LapseText;
@@ -731,8 +731,8 @@ public sealed partial class GameDetailViewModel : ObservableObject
{
AntiCheatExceptionResult result = _exceptions is null
? AntiCheatExceptionResult.Of(AntiCheatExceptionOutcome.AgentUnavailable)
: await _exceptions.GrantAsync(Game.Id, new AntiCheatExceptionFacts(Game.Name, view.Family ?? string.Empty, view.Signal ?? string.Empty,
view.Sessions)).ConfigureAwait(true);
: await _exceptions.GrantAsync(Game.Id, new AntiCheatExceptionFacts(Game.Name, view.Family ?? string.Empty, view.Signal ?? string.Empty))
.ConfigureAwait(true);
Notice(result, Game.Name);
}
finally
@@ -957,8 +957,12 @@ public sealed partial class GameDetailViewModel : ObservableObject
// by default it gives way to the finding alone. The setting off keeps the card, with the finding under it.
HookingSectionVisible = !(blocked && _hideAntiCheatHooking) || exceptionInForce;
PresentException(exception, exceptionInForce);
// 2026-10-03: "cannot be turned on" beside a usable "Make exception…" contradicted itself; an eligible game's card
// says what would turn it on.
AntiCheatText = found is not null && !HookingSectionVisible
? string.Format(CultureInfo.CurrentCulture, Strings.GameDetail_AntiCheat_Format, found)
? string.Format(CultureInfo.CurrentCulture,
_exceptionsOn && exception is { Kind: ExceptionViewKind.Eligible } ? Strings.GameDetail_AntiCheat_Exceptionable_Format : Strings.GameDetail_AntiCheat_Format,
found)
: null;
// Its "Turn hooking back on" could only be refused once anti-cheat was found, or for an executable that cannot run
// as x64, so neither row offers it.
@@ -570,9 +570,11 @@ public sealed partial class SettingsViewModel : ObservableObject
}
checking |= view.Kind == ExceptionViewKind.Checking;
// With the option off only a kept grant is listed (suspended): nothing may be made while it is off.
// With the option off only a kept grant is listed (suspended): nothing may be made while it is off. On, a row is
// listed only when it has an action — make or withdraw (2026-10-03: a game that can never qualify was listed with
// none, and its page says why).
bool listed = UserModeExceptions
? view.Kind is ExceptionViewKind.Granted or ExceptionViewKind.Eligible or ExceptionViewKind.TooFewSessions
? view.Kind is ExceptionViewKind.Granted or ExceptionViewKind.Eligible
: view.Kind == ExceptionViewKind.Granted;
if (listed)
{
@@ -590,7 +592,7 @@ public sealed partial class SettingsViewModel : ObservableObject
AntiCheatExceptionResult result = _exceptions is null
? AntiCheatExceptionResult.Of(AntiCheatExceptionOutcome.AgentUnavailable)
: await _exceptions.GrantAsync(game.GameId, new AntiCheatExceptionFacts(game.Name, game.View.Family ?? string.Empty,
game.View.Signal ?? string.Empty, game.View.Sessions)).ConfigureAwait(true);
game.View.Signal ?? string.Empty)).ConfigureAwait(true);
await ReportExceptionAsync(game.Name, result).ConfigureAwait(true);
}
@@ -169,18 +169,23 @@ public sealed class AntiCheatPreScanSweep : IDisposable
/// <summary>
/// D33: the exception question about one BLOCKED entry. A grant made on bytes that are no longer on disk ends whether
/// or not the option is on; the rest runs only while it is — a tolerant pre-scan naming the block's family when the
/// rules, the executable or the block changed since the last one, and the session count every pass — and ends a grant
/// the facts no longer support. A scan that could not answer ends nothing: the session start runs the full check anyway.
/// rules, the executable or the block changed since the last one, and (D38) the trial's progress under the grant in
/// force every pass — and ends a grant the facts no longer support. A scan that could not answer ends nothing: the
/// session start runs the full check anyway.
/// </summary>
private async ValueTask<AntiCheatPreScanReport> ExceptionPassAsync(GameRow game, string rulesVersion, AntiCheatPreScanReport report,
CancellationToken ct)
{
if (_sessions is null || game.HookBlockedReason is not { Length: > 0 } block || _isRecording(game.Id)
|| _identity.Read(game.Fingerprint.ExePath) is not { } onDisk)
if (_sessions is null || game.HookBlockedReason is not { Length: > 0 } block || _isRecording(game.Id))
{
return report;
}
if (_identity.Read(game.Fingerprint.ExePath) is not { } onDisk)
{
return await UnreadableAsync(game, block, rulesVersion, report, ct).ConfigureAwait(false);
}
AntiCheatExceptionState state = game.AcException;
bool granted = state.IsGranted;
if (granted && !state.GrantCovers(onDisk))
@@ -195,7 +200,10 @@ public sealed class AntiCheatPreScanSweep : IDisposable
}
StoredBlock? parsed = StoredBlock.Parse(block);
int sessions = await _sessions.CountSuccessfulHookedAsync(game.Id, ct).ConfigureAwait(false);
// D38: the trial's progress under the grant in force — what the App shows; eligibility no longer counts sessions.
int sessions = granted && state.Family is { Length: > 0 } family && state.GrantedAt is { } grantedAt
? await _sessions.CountSuccessfulUnderGrantAsync(game.Id, family, grantedAt, ct).ConfigureAwait(false)
: 0;
bool fresh = state.IsCheckedFor(onDisk, rulesVersion, block);
AntiCheatVerdict? verdict = parsed is not { IsExceptionable: true } b
? null
@@ -203,7 +211,7 @@ public sealed class AntiCheatPreScanSweep : IDisposable
? stored
: await _guard.PreScanGameAsync(onDisk.ExePath, b.Family, ct).ConfigureAwait(false);
bool eligible = verdict is { } v && UserModeExceptionRules.IsEligible(parsed, v, sessions);
bool eligible = verdict is { } v && UserModeExceptionRules.IsEligible(parsed, v, state.TrialFailed);
if (!fresh || eligible != state.Eligible || sessions != state.Sessions)
{
if (await _consent.RecordExceptionEligibilityAsync(onDisk, block, verdict, sessions, rulesVersion, ct).ConfigureAwait(false)
@@ -211,7 +219,9 @@ public sealed class AntiCheatPreScanSweep : IDisposable
{
report = report with { ExceptionsChecked = report.ExceptionsChecked + 1 };
_log($"prescan: {game.Name} — user-mode exception {(eligible ? "eligible" : "not eligible")} "
+ $"({(verdict is { } said ? Said(said) : "not a module, file or folder finding")}; {sessions} successful hooked sessions)");
+ $"({(verdict is { } said ? Said(said) : "not a module, file or folder finding")}"
+ (state.TrialFailed ? "; an earlier exception failed its trial" : string.Empty)
+ (granted ? $"; trial {sessions} of {UserModeExceptionRules.TrialSessions}" : string.Empty) + ")");
}
}
@@ -221,9 +231,40 @@ public sealed class AntiCheatPreScanSweep : IDisposable
: report;
}
/// <summary>
/// 2026-10-03: a blocked entry whose executable cannot be read is ANSWERED while the option is on — "the check could not
/// run" (<c>PreScanFailed</c>, no family), keyed on no bytes so the first readable pass scans again — rather than left
/// "checking" for ever, which is what returning early did. A grant is left alone: the session start runs the full check.
/// </summary>
private async ValueTask<AntiCheatPreScanReport> UnreadableAsync(GameRow game, string block, string rulesVersion, AntiCheatPreScanReport report,
CancellationToken ct)
{
AntiCheatExceptionState state = game.AcException;
if (_exceptions is null || state.IsGranted || !await _exceptions.IsOnAsync(ct).ConfigureAwait(false))
{
return report;
}
if (string.Equals(state.CheckedBlock, block, StringComparison.Ordinal)
&& StoredBlock.Parse(state.Verdict) is { Reason: AntiCheatRefusalReason.PreScanFailed, Family.Length: 0 })
{
return report; // already said, and nothing has changed that a pass could see
}
var nothingRead = new ExecutableFingerprint { ExePath = game.Fingerprint.ExePath, SizeBytes = 0, MtimeUnixMs = 0 };
AntiCheatVerdict couldNotRun = AntiCheatVerdict.Refused(AntiCheatRefusalReason.PreScanFailed, string.Empty, Path.GetFileName(game.Fingerprint.ExePath));
if (await _consent.RecordExceptionEligibilityAsync(nothingRead, block, couldNotRun, 0, rulesVersion, ct).ConfigureAwait(false) == ConsentWriteOutcome.Written)
{
_log($"prescan: {game.Name} — user-mode exception not checked: the executable could not be read");
report = report with { ExceptionsChecked = report.ExceptionsChecked + 1 };
}
return report;
}
private async ValueTask<AntiCheatPreScanReport> EndAsync(GameRow game, string lapse, string why, AntiCheatPreScanReport report, CancellationToken ct)
{
if (await _consent.RevokeAntiCheatExceptionAsync(game.Fingerprint.ExePath, lapse, ct).ConfigureAwait(false) != ConsentWriteOutcome.Written)
if (await _consent.RevokeAntiCheatExceptionAsync(game.Fingerprint.ExePath, lapse, ct: ct).ConfigureAwait(false) != ConsentWriteOutcome.Written)
{
return report;
}
@@ -12,7 +12,7 @@ public static class UserModeExceptionLapse
/// <summary>The executable is not the one the grant was made on: a game update, or <i>Change executable</i>.</summary>
public const string ExecutableChanged = "ExecutableChanged";
/// <summary>The guard no longer lets the game through under it: a new finding, a <c>.sys</c>, the family turned kernel-level, too few sessions.</summary>
/// <summary>The guard no longer lets the game through under it: a new finding, a <c>.sys</c>, the family turned kernel-level.</summary>
public const string NoLongerEligible = "NoLongerEligible";
/// <summary>A finding about the game at a session's start, at the 30 s re-scan or when hooking was turned on.</summary>
@@ -26,4 +26,11 @@ public static class UserModeExceptionLapse
/// <summary>A session under it ended in a crash.</summary>
public const string SessionCrashed = "SessionCrashed";
/// <summary>
/// D38: a session in its trial did not succeed — hooked and stored, but it recorded no frame or did not end normally —
/// and nothing more specific said why. Any end during the trial, this one or another, also marks the game so that no
/// exception can be made for it again (<c>games.ac_exception_trial_failed_at</c>).
/// </summary>
public const string TrialFailed = "TrialFailed";
}
@@ -4,10 +4,10 @@ using FrameLedger.Domain.Consent;
namespace FrameLedger.Application.AntiCheat;
/// <summary>
/// D33 (owner decision 2026-09-26): the managed rules of the user-mode exception — what a grant needs before the guard is
/// even asked to tolerate a family, and the words its end is recorded in. The guard's own rules (which family is user-mode,
/// what is never excepted, scanning past what it lets through) are native and are not repeated here
/// (<c>19_SAFETY</c> §The user-mode exception).
/// D33 (owner decision 2026-09-26) as amended by D38 (2026-10-03): the managed rules of the user-mode exception — what a
/// grant needs before the guard is even asked to tolerate a family, and how long its trial lasts. The guard's own rules
/// (which family is user-mode, what is never excepted, scanning past what it lets through) are native and are not repeated
/// here (<c>19_SAFETY</c> §The user-mode exception).
/// </summary>
/// <remarks>
/// <para>
@@ -16,16 +16,27 @@ namespace FrameLedger.Application.AntiCheat;
/// user-mode, and it refuses on anything else it finds. There is no path from this class to an injection that the
/// guard did not pass.
/// </para>
/// <para>
/// <b>D38: the evidence comes after the grant, not before it.</b> D33 asked for two successful Tier-1 sessions before a
/// grant; since beta.8's library sweep blocks a game the moment it is added, a blocked game could never be hooked to earn
/// them, and a reset ledger lost them — the exception was unreachable for every game blocked from the start. A grant now
/// needs no session; its first <see cref="TrialSessions"/> hooked sessions are a trial, and one of them ending badly ends
/// the exception for good (<c>games.ac_exception_trial_failed_at</c>, which nothing clears).
/// </para>
/// </remarks>
public static class UserModeExceptionRules
{
/// <summary>The owner's threshold: successful Tier-1 sessions of the game before its exception may be granted.</summary>
/// <summary>
/// The owner's trial (D38): the hooked sessions under a grant that must each succeed before the exception is past its
/// trial. Until then any session under it that does not succeed ends it and marks the game so that no exception can
/// be made for it again.
/// </summary>
/// <remarks>
/// "Successful" is <c>ISessionRepository.CountSuccessfulHookedAsync</c>'s: hooked, frames recorded, <c>exit_status =
/// "Succeed" is <c>ISessionRepository.CountSuccessfulUnderGrantAsync</c>'s: hooked, frames recorded, <c>exit_status =
/// normal</c> — which since beta.8 includes End task's exit code 1 and a user's stop, and never a crash, a safety
/// unhook, a degraded or an interrupted session.
/// </remarks>
public const int RequiredSessions = 2;
public const int TrialSessions = 2;
/// <summary>
/// The family the game's exception covers for a session against <paramref name="observed"/>, or null: the option is
@@ -50,12 +61,18 @@ public static class UserModeExceptionRules
/// <summary>
/// Whether <paramref name="verdict"/> — a tolerant pre-scan asked about <paramref name="block"/>'s family — makes the
/// game eligible, given <paramref name="sessions"/> successful Tier-1 sessions: the guard passed and named that same
/// family as what it let through, and the evidence reaches <see cref="RequiredSessions"/>.
/// game eligible: the guard passed and named that same family as what it let through, and no earlier exception of the
/// game failed its trial (<paramref name="trialFailed"/>, D38).
/// </summary>
public static bool IsEligible(StoredBlock? block, AntiCheatVerdict verdict, int sessions) =>
block is { IsExceptionable: true } b
public static bool IsEligible(StoredBlock? block, AntiCheatVerdict verdict, bool trialFailed) =>
!trialFailed
&& block is { IsExceptionable: true } b
&& verdict.RanUnderException
&& string.Equals(verdict.Family, b.Family, StringComparison.Ordinal)
&& sessions >= RequiredSessions;
&& string.Equals(verdict.Family, b.Family, StringComparison.Ordinal);
/// <summary>
/// Whether a grant with <paramref name="successfulBefore"/> successful sessions under it — not counting the session
/// being judged — is still in its trial (D38).
/// </summary>
public static bool InTrial(int successfulBefore) => successfulBefore < TrialSessions;
}
@@ -18,9 +18,6 @@ public sealed record AntiCheatExceptionGrantRequest
/// <summary>The guard's tolerant pre-scan, asked about the block's family just now.</summary>
public required AntiCheatVerdict Verdict { get; init; }
/// <summary>Successful Tier-1 sessions of the game, counted just now.</summary>
public required int Sessions { get; init; }
/// <summary>The disclosure the user accepted — the Agent's own version, checked before this request exists.</summary>
public required string DisclosureVersion { get; init; }
@@ -138,8 +138,10 @@ public interface IGameConsentStore
/// <summary>
/// D33 (owner decision 2026-09-26): the sweep's answer about one BLOCKED game — whether its user-mode exception may be
/// granted — from the facts it gathered: <paramref name="verdict"/>, a tolerant pre-scan asked about the block's family
/// (null when the block is not of a kind worth asking about), and <paramref name="sessions"/> successful Tier-1 sessions.
/// The rule is <c>UserModeExceptionRules.IsEligible</c>, applied here so the row cannot say "eligible" over facts that are not.
/// (null when the block is not of a kind worth asking about). The rule is <c>UserModeExceptionRules.IsEligible</c>,
/// applied here so the row cannot say "eligible" over facts that are not — and since D38 (2026-10-03) a row whose
/// exception once failed its trial is never written eligible, in SQL. <paramref name="sessions"/> is the trial's progress
/// under the grant in force (0 with none), stored for the App to show.
/// </summary>
/// <remarks>
/// Written with the key it was reached under — <paramref name="rulesVersion"/>, the executable's size and mtime in
@@ -151,12 +153,13 @@ public interface IGameConsentStore
ExecutableFingerprint scanned, string block, AntiCheatVerdict? verdict, int sessions, string rulesVersion, CancellationToken ct = default);
/// <summary>
/// D33: grant a game's user-mode exception, on facts gathered just now — the tolerant pre-scan and the session count in
/// <paramref name="grant"/> — after the user accepted its disclosure.
/// D33: grant a game's user-mode exception, on facts gathered just now — the tolerant pre-scan in
/// <paramref name="grant"/> — after the user accepted its disclosure. D38: the grant starts its trial at zero sessions.
/// </summary>
/// <remarks>
/// <see cref="ConsentWriteOutcome.NotEligible"/> and nothing written unless <c>UserModeExceptionRules.IsEligible</c> holds for
/// those facts; <see cref="ConsentWriteOutcome.NotFound"/> when the row no longer carries the block the facts are about.
/// those facts and no exception of the game failed its trial (read from the row in the same transaction);
/// <see cref="ConsentWriteOutcome.NotFound"/> when the row no longer carries the block the facts are about.
/// It never clears the block, never enables hooking and never stamps consent: turning hooking on is FR-2.1's own
/// dialog, afterwards.
/// </remarks>
@@ -165,8 +168,11 @@ public interface IGameConsentStore
/// <summary>
/// D33: end a game's user-mode exception, for <paramref name="reason"/> (<c>UserModeExceptionLapse</c>), and turn its
/// hooking off while the block stands. The consent stamp is preserved, as a block preserves it; the family, the
/// disclosure and the executable the grant was made on stay on the row as history.
/// disclosure and the executable the grant was made on stay on the row as history. D38: <paramref name="trialFailed"/>
/// — the end came during the grant's trial — also marks the game (<c>ac_exception_trial_failed_at</c>), and no exception
/// can be made for it again.
/// </summary>
/// <remarks><see cref="ConsentWriteOutcome.NotFound"/> when there was no exception in force.</remarks>
ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, CancellationToken ct = default);
ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, bool trialFailed = false,
CancellationToken ct = default);
}
@@ -53,8 +53,12 @@ public sealed class AgentCommandHandler
/// </summary>
public const string BlockNotExceptionableReason = "BlockNotExceptionable";
/// <summary>D33: <c>Refused.reason</c> for an exception asked with fewer successful hooked sessions than the owner's threshold; <c>signal</c> carries the count.</summary>
public const string TooFewSessionsReason = "TooFewSessions";
/// <summary>
/// D38 (owner decision 2026-10-03): <c>Refused.reason</c> for an exception asked for a game an earlier exception of which
/// ended during its trial — for good; <c>signal</c> carries when (unix ms). (D33's <c>TooFewSessions</c> is gone with the
/// session threshold it named.)
/// </summary>
public const string TrialFailedReason = "TrialFailed";
/// <summary>
/// <c>disclosureVersion</c> is the version of FR-2.1's reviewed disclosure this Agent carries
@@ -231,7 +235,7 @@ public sealed class AgentCommandHandler
await _consent.RecordGuardBlockAsync(fingerprint, verdict, ct).ConfigureAwait(false);
if (tolerated is not null && verdict.IsFindingAboutTheGame)
{
await _consent.RevokeAntiCheatExceptionAsync(fingerprint.ExePath, UserModeExceptionLapse.NewFinding, ct).ConfigureAwait(false);
await _consent.RevokeAntiCheatExceptionAsync(fingerprint.ExePath, UserModeExceptionLapse.NewFinding, ct: ct).ConfigureAwait(false);
}
await ReconcileLayerAsync(ct).ConfigureAwait(false);
@@ -277,7 +281,7 @@ public sealed class AgentCommandHandler
if (!payload.Enabled)
{
ConsentWriteOutcome withdrawn = await _consent.RevokeAntiCheatExceptionAsync(game.Fingerprint.ExePath, UserModeExceptionLapse.Withdrawn, ct)
ConsentWriteOutcome withdrawn = await _consent.RevokeAntiCheatExceptionAsync(game.Fingerprint.ExePath, UserModeExceptionLapse.Withdrawn, ct: ct)
.ConfigureAwait(false);
await ReconcileLayerAsync(ct).ConfigureAwait(false);
return IpcCodec.Encode(IpcMessageType.AntiCheatExceptionAck, request.Id,
@@ -297,8 +301,9 @@ public sealed class AgentCommandHandler
/// <summary>
/// D33: the facts a grant rests on, gathered here and now — the block on the row, a tolerant pre-scan of the executable on
/// disk naming the block's family, and the successful Tier-1 sessions — each refusal said as what it is; the store then
/// writes the grant only when they make the game eligible, and only while the row still carries that block.
/// disk naming the block's family — each refusal said as what it is; the store then writes the grant only when they make
/// the game eligible, and only while the row still carries that block. D38: no session is needed any more — the grant's
/// first sessions are its trial — and a game whose exception once failed its trial is refused before anything is scanned.
/// </summary>
private async ValueTask<byte[]> GrantExceptionAsync(IpcEnvelope request, GameRow game, AntiCheatExceptionCommands exceptions, CancellationToken ct)
{
@@ -308,6 +313,12 @@ public sealed class AgentCommandHandler
return IpcCodec.Encode(IpcMessageType.Refused, request.Id, new RefusedAck(game.Id, BlockNotExceptionableReason, Family: null, Signal: null));
}
if (game.AcException.TrialFailedAt is { } failedAt)
{
return IpcCodec.Encode(IpcMessageType.Refused, request.Id, new RefusedAck(game.Id, TrialFailedReason, block.Family,
failedAt.ToUnixTimeMilliseconds().ToString(System.Globalization.CultureInfo.InvariantCulture)));
}
if (_identity.Read(path) is not { } fingerprint)
{
return Error(request, IpcErrorCode.ExecutableUnreadable, $"{path} could not be read, so nothing can be scanned or granted");
@@ -320,19 +331,11 @@ public sealed class AgentCommandHandler
return IpcCodec.Encode(IpcMessageType.Refused, request.Id, new RefusedAck(game.Id, reason, NullIfEmpty(verdict.Family), NullIfEmpty(verdict.Signal)));
}
int sessions = await exceptions.Sessions.CountSuccessfulHookedAsync(game.Id, ct).ConfigureAwait(false);
if (sessions < UserModeExceptionRules.RequiredSessions)
{
return IpcCodec.Encode(IpcMessageType.Refused, request.Id, new RefusedAck(game.Id, TooFewSessionsReason, block.Family,
sessions.ToString(System.Globalization.CultureInfo.InvariantCulture)));
}
ConsentWriteOutcome outcome = await _consent.GrantAntiCheatExceptionAsync(new AntiCheatExceptionGrantRequest
{
Fingerprint = fingerprint,
Block = game.HookBlockedReason!,
Verdict = verdict,
Sessions = sessions,
DisclosureVersion = exceptions.DisclosureVersion,
GrantedAt = _clock.GetUtcNow(),
}, ct).ConfigureAwait(false);
@@ -1,14 +1,12 @@
using FrameLedger.Application.Capture;
using FrameLedger.Application.Persistence;
namespace FrameLedger.Application.Ipc;
/// <summary>
/// D33 (owner decision 2026-09-26): what <see cref="AgentCommandHandler"/> needs to answer for a game's user-mode exception —
/// the option, the evidence, and the disclosure version this Agent grants against. One parameter rather than three, so a
/// composition either has the exception or does not.
/// the option and the disclosure version this Agent grants against. One parameter rather than two, so a composition either
/// has the exception or does not. (D38 took the session count out: a grant needs no session any more.)
/// </summary>
/// <param name="Switch"><c>hooking.usermode_ac_exceptions</c>, read on every command.</param>
/// <param name="Sessions">Where the successful Tier-1 sessions are counted.</param>
/// <param name="DisclosureVersion"><c>Shared.Safety.AntiCheatExceptionDisclosure.Version</c> under <c>--serve</c>.</param>
public sealed record AntiCheatExceptionCommands(IUserModeExceptionSwitch Switch, ISessionRepository Sessions, string DisclosureVersion);
public sealed record AntiCheatExceptionCommands(IUserModeExceptionSwitch Switch, string DisclosureVersion);
@@ -3,9 +3,10 @@ using FrameLedger.Domain.Consent;
namespace FrameLedger.Application.Persistence;
/// <summary>
/// D33 (owner decision 2026-09-26): <c>games.ac_exception_*</c> as read (schema 0014) — the Agent's eligibility answer
/// about a blocked game, the user's grant of its user-mode exception, and how the last grant ended. Read-only here: every
/// write is the consent store's (<c>IGameConsentStore</c>) or a downgrade in <c>ChangeExecutableAsync</c>.
/// D33 (owner decision 2026-09-26): <c>games.ac_exception_*</c> as read (schema 0014, and 0017 for D38's trial) — the
/// Agent's eligibility answer about a blocked game, the user's grant of its user-mode exception, how far its trial has come,
/// and how the last grant ended. Read-only here: every write is the consent store's (<c>IGameConsentStore</c>) or a
/// downgrade in <c>ChangeExecutableAsync</c>.
/// </summary>
public sealed record AntiCheatExceptionState
{
@@ -18,7 +19,11 @@ public sealed record AntiCheatExceptionState
/// <summary>The guard's tolerant pre-scan behind <see cref="Eligible"/>, as <c>Reason|Family|Signal</c>; null when nothing was asked.</summary>
public string? Verdict { get; init; }
/// <summary>Successful Tier-1 sessions of the game when the sweep last counted.</summary>
/// <summary>
/// D38: successful hooked sessions under the grant in force when the sweep last counted — its trial's progress against
/// <c>UserModeExceptionRules.TrialSessions</c>; 0 with no grant. (D33 counted every successful Tier-1 session of the game
/// here, the evidence a grant needed before D38.)
/// </summary>
public int Sessions { get; init; }
/// <summary>The rules version <see cref="Verdict"/> was reached under.</summary>
@@ -54,6 +59,15 @@ public sealed record AntiCheatExceptionState
/// <summary>Why the last grant ended (<c>UserModeExceptionLapse</c>).</summary>
public string? LapsedReason { get; init; }
/// <summary>
/// D38 (schema 0017): when an exception of this game ended during its trial; null when none did. Never cleared — not by
/// a withdrawal, a game update or <i>Change executable</i> — and while it is set no exception can be made for the game.
/// </summary>
public DateTimeOffset? TrialFailedAt { get; init; }
/// <summary>D38: an exception of this game failed its trial, so none can be made again.</summary>
public bool TrialFailed => TrialFailedAt is not null;
/// <summary>An exception is in force on the row (whether the option lets it apply is the capture path's question).</summary>
public bool IsGranted => GrantedAt is not null && !string.IsNullOrEmpty(Family);
@@ -40,12 +40,14 @@ public interface ISessionRepository
ValueTask<long> CountSinceAsync(DateTimeOffset since, CancellationToken ct = default);
/// <summary>
/// D33 (owner decision 2026-09-26): the game's successful Tier-1 sessions — hooked, frames recorded, <c>exit_status =
/// normal</c> — the evidence a user-mode exception needs <c>UserModeExceptionRules.RequiredSessions</c> of. Since beta.8
/// <c>normal</c> includes End task's exit code 1 and a user's stop; a crashed, unhooked-for-safety, degraded or
/// interrupted session never counts.
/// D38 (owner decision 2026-10-03): the game's successful sessions under ONE grant of its user-mode exception — hooked
/// under <paramref name="family"/> (<c>sessions.ac_exception_family</c>), started at or after <paramref name="grantedAt"/>,
/// frames recorded, <c>exit_status = normal</c>: how far that grant's trial has come against
/// <c>UserModeExceptionRules.TrialSessions</c>. Since beta.8 <c>normal</c> includes End task's exit code 1 and a user's
/// stop; a crashed, unhooked-for-safety, degraded or interrupted session never counts, and neither does a session from
/// before the grant or under an earlier one.
/// </summary>
ValueTask<int> CountSuccessfulHookedAsync(long gameId, CancellationToken ct = default);
ValueTask<int> CountSuccessfulUnderGrantAsync(long gameId, string family, DateTimeOffset grantedAt, CancellationToken ct = default);
ValueTask<int> SweepRetentionAsync(long gameId, int keep, CancellationToken ct = default);
@@ -0,0 +1,10 @@
namespace FrameLedger.Application.Recording;
/// <summary>
/// D38: the session the recorder just finished, as the exception's trial needs it — the game row it was stored under,
/// whether it was stored as a hooked session, and the frames it recorded.
/// </summary>
/// <param name="GameId">The <c>games</c> row the session belongs to.</param>
/// <param name="StoredHooked">It was hooked AND its row was written (a session too short to keep proves nothing).</param>
/// <param name="FrameCount">Frames the row records.</param>
public readonly record struct SessionForTrial(long GameId, bool StoredHooked, long FrameCount);
@@ -217,10 +217,12 @@ public sealed class SessionRecorder : ISessionRecorder
}
// D33: a session under the game's user-mode exception that ended badly ends the exception — after the row is
// stored, so the session that ended it is on the page the exception is gone from.
// stored, so the session that ended it is on the page the exception is gone from. D38: during the grant's trial a
// stored hooked session that did not succeed ends it too, and any end then is for good.
var trial = new SessionForTrial(ownerId, hooked && saved.Status == FinalizeStatus.Saved, built.Row.FrameCount);
string? lapsed = _exceptionLapse is null
? null
: await _exceptionLapse.ApplyAsync(request.NormalisedExePath, outcome, exit, ct).ConfigureAwait(false);
: await _exceptionLapse.ApplyAsync(request.NormalisedExePath, outcome, exit, trial, ct).ConfigureAwait(false);
return new RecordedSession
{
@@ -1,34 +1,47 @@
using FrameLedger.Application.AntiCheat;
using FrameLedger.Application.Capture;
using FrameLedger.Application.Consent;
using FrameLedger.Application.Persistence;
using FrameLedger.Domain.Consent;
using FrameLedger.Domain.Sessions;
using FrameLedger.Shared;
namespace FrameLedger.Application.Recording;
/// <summary>
/// D33 (owner decision 2026-09-26): what a session under a game's user-mode exception does to the exception when it ends
/// badly (<c>19_SAFETY</c> §The user-mode exception, What ends it). A finding about the game at its start or at the 30 s
/// re-scan, a safety unhook, the Overlay's own stop on another anti-cheat's module, and a crash while hooked each end it —
/// the evidence the exception rests on said "this game is safe to measure", and each of those says otherwise.
/// D33 (owner decision 2026-09-26) as amended by D38 (2026-10-03): what a session under a game's user-mode exception does to
/// the exception when it ends (<c>19_SAFETY</c> §The user-mode exception, What ends it). A finding about the game at its
/// start or at the 30 s re-scan, a safety unhook, the Overlay's own stop on another anti-cheat's module, and a crash while
/// hooked each end it — the trust the exception rests on said "this game is safe to measure", and each of those says
/// otherwise. D38: during the grant's trial (its first <see cref="UserModeExceptionRules.TrialSessions"/> successful
/// sessions) a hooked session that recorded no frame or did not end normally ends it too, and any end during the trial
/// marks the game so that no exception can be made for it again.
/// </summary>
/// <remarks>
/// <para>
/// <b>It only ever ends an exception.</b> Nothing here grants one or clears a block; the end turns the game's hooking off
/// while its block stands and keeps the consent stamp, as a block keeps it. The user may grant it again once the sweep
/// finds the game eligible again, through the disclosure.
/// while its block stands and keeps the consent stamp, as a block keeps it. After the trial the user may grant it again
/// once the sweep finds the game eligible again, through the disclosure; after an end during the trial, never.
/// </para>
/// <para>
/// A session that ran under no exception is left alone, and so is an ordinary end under one — the game exited, the user
/// stopped it, End task (beta.8's <c>normal</c>), a refusal that found nothing about the game.
/// stopped it, End task (beta.8's <c>normal</c>), a refusal that found nothing about the game — and a session too short to
/// be stored, which proves nothing either way.
/// </para>
/// </remarks>
public sealed class UserModeExceptionLapsePolicy
{
private readonly IGameConsentStore _consent;
private readonly ISessionRepository? _sessions;
public UserModeExceptionLapsePolicy(IGameConsentStore consent) =>
/// <summary>The policy over the store that holds the exception, and the sessions its trial is counted in.</summary>
/// <param name="consent">Where the exception lives.</param>
/// <param name="sessions">Where a grant's trial is counted (D38); without it no end is judged against a trial.</param>
public UserModeExceptionLapsePolicy(IGameConsentStore consent, ISessionRepository? sessions = null)
{
_consent = consent ?? throw new ArgumentNullException(nameof(consent));
_sessions = sessions;
}
/// <summary>Why <paramref name="outcome"/> ends the exception it ran under (<see cref="UserModeExceptionLapse"/>), or null.</summary>
public static string? LapseOf(CaptureOutcome outcome, ExitStatus exit)
@@ -60,18 +73,75 @@ public sealed class UserModeExceptionLapsePolicy
: null;
}
/// <summary>End the exception when <see cref="LapseOf"/> says so; the reason, when it was ended.</summary>
public async ValueTask<string?> ApplyAsync(string normalisedExePath, CaptureOutcome outcome, ExitStatus exit, CancellationToken ct = default)
/// <summary>
/// D38: whether the session in <paramref name="session"/> succeeded as a trial counts it — stored hooked, frames
/// recorded, <c>normal</c> (<c>ISessionRepository.CountSuccessfulUnderGrantAsync</c>'s rule, for the row just written).
/// </summary>
public static bool Succeeded(SessionForTrial session, ExitStatus exit) =>
session.StoredHooked && exit == ExitStatus.Normal && session.FrameCount > 0;
/// <summary>
/// The end <paramref name="outcome"/> brings its exception, given whether the grant is still in its trial: a reason
/// from <see cref="LapseOf"/>, or <see cref="UserModeExceptionLapse.TrialFailed"/> for a stored hooked session that did
/// not succeed during the trial, or null. Pure, for the tests and for <see cref="ApplyAsync"/>.
/// </summary>
public static string? EndOf(CaptureOutcome outcome, ExitStatus exit, SessionForTrial? session, bool inTrial)
{
string? lapse = LapseOf(outcome, exit);
if (lapse is not null || !inTrial || session is not { } s || outcome.ExceptionFamily is null)
{
return lapse;
}
return s.StoredHooked && !Succeeded(s, exit) ? UserModeExceptionLapse.TrialFailed : null;
}
/// <summary>
/// End the exception when <see cref="EndOf"/> says so — marking the game when the end came during the trial — and
/// return the reason when it was ended. <paramref name="session"/> is the row the recorder just wrote (null when it
/// wrote none it can describe).
/// </summary>
public async ValueTask<string?> ApplyAsync(string normalisedExePath, CaptureOutcome outcome, ExitStatus exit, SessionForTrial? session = null,
CancellationToken ct = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(normalisedExePath);
string? lapse = LapseOf(outcome, exit);
ArgumentNullException.ThrowIfNull(outcome);
if (outcome.ExceptionFamily is null)
{
return null;
}
bool inTrial = await InTrialAsync(normalisedExePath, session, exit, ct).ConfigureAwait(false);
string? lapse = EndOf(outcome, exit, session, inTrial);
if (lapse is null)
{
return null;
}
return await _consent.RevokeAntiCheatExceptionAsync(normalisedExePath, lapse, ct).ConfigureAwait(false) == ConsentWriteOutcome.Written
return await _consent.RevokeAntiCheatExceptionAsync(normalisedExePath, lapse, trialFailed: inTrial, ct).ConfigureAwait(false) == ConsentWriteOutcome.Written
? lapse
: null;
}
/// <summary>
/// D38: the grant in force right now is still in its trial — fewer than <see cref="UserModeExceptionRules.TrialSessions"/>
/// successful sessions under it besides this one. No grant, no count: not in a trial.
/// </summary>
private async ValueTask<bool> InTrialAsync(string normalisedExePath, SessionForTrial? session, ExitStatus exit, CancellationToken ct)
{
if (_sessions is null || session is not { } s)
{
return false;
}
GameConsentRecord record = await _consent.FindAsync(normalisedExePath, ct).ConfigureAwait(false);
if (record.Exception is not { } grant)
{
return false;
}
int counted = await _sessions.CountSuccessfulUnderGrantAsync(s.GameId, grant.Family, grant.GrantedAt, ct).ConfigureAwait(false);
int before = Succeeded(s, exit) ? Math.Max(0, counted - 1) : counted;
return UserModeExceptionRules.InTrial(before);
}
}
@@ -0,0 +1,17 @@
-- 0017 (2026-10-03, beta.11, owner decision D38): the user-mode anti-cheat exception's trial (19_SAFETY §The user-mode
-- exception).
--
-- D33 asked for two successful Tier-1 sessions before an exception could be granted. Since beta.8 the library sweep
-- blocks a game the moment it is added, so a blocked game could never be hooked to earn them, and a reset ledger lost the
-- ones it had: the exception was unreachable for every game blocked from the start. D38 grants without them; the first two
-- hooked sessions under a grant are its trial, and an end during the trial — a crash, a safety unhook, the Overlay's own
-- stop, a new finding, or a session that recorded no frame or did not end normally — ends the exception for good.
--
-- ac_exception_trial_failed_at is that "for good": when an exception of this game ended during its trial, NULL when none
-- did. Nothing clears it — not a withdrawal, a game update, Change executable or the end of a later grant (there is none:
-- while it is set the Agent finds the game not eligible and the store refuses a grant in SQL). A twin merge keeps the
-- earlier of two. ac_exception_sessions (0014) is now the trial's progress under the grant in force.
--
-- Written by the Agent only (06_DATA_MODEL §Writer ownership: the exception's columns are the Agent's); ADD COLUMN only.
ALTER TABLE games ADD COLUMN ac_exception_trial_failed_at INTEGER;
@@ -81,22 +81,28 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
// D33 (schema 0014). The eligibility and the grant are each bound to the block they were reached about — the WHERE is
// the guarantee, so a block rewritten between the caller's read and this write leaves the row alone. Neither names
// hook_blocked_reason, hook_enabled or the consent columns in its SET list.
// hook_blocked_reason, hook_enabled or the consent columns in its SET list. D38 (schema 0017): a game an exception of
// which failed its trial is never eligible and is never granted one — in SQL, whatever the caller read.
private const string _exceptionEligibility =
"UPDATE games SET ac_exception_eligible = @eligible, ac_exception_verdict = @verdict, ac_exception_sessions = @sessions, "
"UPDATE games SET ac_exception_eligible = CASE WHEN ac_exception_trial_failed_at IS NULL THEN @eligible ELSE 0 END, "
+ "ac_exception_verdict = @verdict, ac_exception_sessions = @sessions, "
+ "ac_exception_checked_rules_version = @rules, ac_exception_checked_exe_size_bytes = @size, ac_exception_checked_exe_mtime_ms = @mtime, "
+ "ac_exception_checked_block = @block, updated_at = @at WHERE exe_path = @path AND hook_blocked_reason = @block";
private const string _exceptionGrant =
"UPDATE games SET ac_exception_at = @at, ac_exception_family = @family, ac_exception_disclosure_version = @disclosure, "
+ "ac_exception_exe_size_bytes = @size, ac_exception_exe_mtime_ms = @mtime, ac_exception_lapsed_at = NULL, ac_exception_lapsed_reason = NULL, "
+ "ac_exception_eligible = 1, ac_exception_verdict = @verdict, ac_exception_sessions = @sessions, updated_at = @at "
+ "WHERE exe_path = @path AND hook_blocked_reason = @block";
+ "ac_exception_eligible = 1, ac_exception_verdict = @verdict, ac_exception_sessions = 0, updated_at = @at "
+ "WHERE exe_path = @path AND hook_blocked_reason = @block AND ac_exception_trial_failed_at IS NULL";
private const string _trialFailedOf = "SELECT ac_exception_trial_failed_at FROM games WHERE exe_path = @path";
// The end of an exception keeps the consent stamp, as a block does, and turns hooking off while the block stands. The
// grant's family, disclosure and bytes stay as history; ac_exception_at going NULL is what ends it.
// grant's family, disclosure and bytes stay as history; ac_exception_at going NULL is what ends it. D38: an end during
// the trial also sets ac_exception_trial_failed_at, once, and nothing ever clears it.
private const string _exceptionRevoke =
"UPDATE games SET ac_exception_at = NULL, ac_exception_lapsed_at = @at, ac_exception_lapsed_reason = @reason, "
+ "ac_exception_trial_failed_at = CASE WHEN @trialFailed = 1 THEN COALESCE(ac_exception_trial_failed_at, @at) ELSE ac_exception_trial_failed_at END, "
+ "hook_enabled = CASE WHEN hook_blocked_reason IS NOT NULL THEN 0 ELSE hook_enabled END, updated_at = @at "
+ "WHERE exe_path = @path AND ac_exception_at IS NOT NULL";
@@ -306,7 +312,8 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
{
ArgumentException.ThrowIfNullOrWhiteSpace(block);
ArgumentException.ThrowIfNullOrWhiteSpace(rulesVersion);
bool eligible = verdict is { } v && UserModeExceptionRules.IsEligible(StoredBlock.Parse(block), v, sessions);
// The trial mark (D38) is the row's, and the SQL applies it: this says what the verdict alone allows.
bool eligible = verdict is { } v && UserModeExceptionRules.IsEligible(StoredBlock.Parse(block), v, trialFailed: false);
try
{
return await _db.WriteAsync(async (c, tx, token) =>
@@ -340,9 +347,10 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
ArgumentException.ThrowIfNullOrWhiteSpace(grant.DisclosureVersion, nameof(grant));
// THE STORE APPLIES THE RULE ITSELF: a grant over facts that do not make the game eligible is refused here, not
// only by the caller that gathered them.
// only by the caller that gathered them — and a game whose exception once failed its trial (D38) is refused from
// the row, in the same transaction as the write.
StoredBlock? block = StoredBlock.Parse(grant.Block);
if (!UserModeExceptionRules.IsEligible(block, grant.Verdict, grant.Sessions))
if (!UserModeExceptionRules.IsEligible(block, grant.Verdict, trialFailed: false))
{
return ConsentWriteOutcome.NotEligible;
}
@@ -351,6 +359,13 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
{
return await _db.WriteAsync(async (c, tx, token) =>
{
long? trialFailedAt = await c.ExecuteScalarAsync<long?>(new CommandDefinition(_trialFailedOf, new { path = grant.Fingerprint.ExePath }, tx,
cancellationToken: token)).ConfigureAwait(false);
if (trialFailedAt is not null)
{
return ConsentWriteOutcome.NotEligible;
}
var p = new
{
path = grant.Fingerprint.ExePath,
@@ -360,7 +375,6 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
size = grant.Fingerprint.SizeBytes,
mtime = grant.Fingerprint.MtimeUnixMs,
verdict = BlockText(grant.Verdict),
sessions = grant.Sessions,
at = grant.GrantedAt.ToUnixTimeMilliseconds(),
};
int rows = await c.ExecuteAsync(new CommandDefinition(_exceptionGrant, p, tx, cancellationToken: token)).ConfigureAwait(false);
@@ -374,7 +388,8 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
}
/// <inheritdoc />
public async ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, CancellationToken ct = default)
public async ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, bool trialFailed = false,
CancellationToken ct = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(normalisedExePath);
ArgumentException.ThrowIfNullOrWhiteSpace(reason);
@@ -382,7 +397,7 @@ public sealed class SqliteGameConsentStore : IGameConsentStore
{
return await _db.WriteAsync(async (c, tx, token) =>
{
var p = new { path = normalisedExePath, reason, at = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() };
var p = new { path = normalisedExePath, reason, trialFailed = trialFailed ? 1 : 0, at = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() };
int rows = await c.ExecuteAsync(new CommandDefinition(_exceptionRevoke, p, tx, cancellationToken: token)).ConfigureAwait(false);
return rows == 0 ? ConsentWriteOutcome.NotFound : ConsentWriteOutcome.Written;
}, ct).ConfigureAwait(false);
@@ -28,18 +28,22 @@ namespace FrameLedger.Infrastructure.Persistence;
/// <b>The recording switch (schema 0009) follows the same direction:</b> off on either entry is off on the survivor. The
/// user turned it off for this executable under one of its two names.
/// </para>
/// <para>
/// <b>So does a failed exception trial (schema 0017, D38):</b> an exception of either entry that ended during its trial
/// marks the survivor, the earlier of two — a merge must not be the way a game's "never again" disappears.
/// </para>
/// </remarks>
public sealed class SqliteGameMerge : IGameMerge
{
private const string _read =
"SELECT id, exe_path, exe_size_bytes, exe_mtime_ms, removed_at, hook_enabled, hook_blocked_reason, hook_autodisabled_reason, "
+ "hook_autodisabled_at, hook_crash_count, hook_last_injected_at, record_sessions FROM games WHERE id = @id";
+ "hook_autodisabled_at, hook_crash_count, hook_last_injected_at, record_sessions, ac_exception_trial_failed_at FROM games WHERE id = @id";
private const string _reparent = "UPDATE sessions SET game_id = @keep WHERE game_id = @drop";
private const string _carry =
"UPDATE games SET hook_blocked_reason = @blocked, hook_autodisabled_reason = @autoReason, hook_autodisabled_at = @autoAt, "
+ "hook_crash_count = @crashes, hook_last_injected_at = @injected, record_sessions = @record, "
+ "hook_crash_count = @crashes, hook_last_injected_at = @injected, record_sessions = @record, ac_exception_trial_failed_at = @trialFailed, "
+ "hook_enabled = CASE WHEN @hookOff THEN 0 ELSE hook_enabled END, "
+ "hook_prescan_state = CASE WHEN @blockCarried THEN 'blocked' ELSE hook_prescan_state END, "
+ "updated_at = @now WHERE id = @keep";
@@ -81,6 +85,7 @@ public sealed class SqliteGameMerge : IGameMerge
crashes = keep.CrashCount + drop!.CrashCount,
injected = Later(keep.LastInjectedAt, drop.LastInjectedAt),
record = keep.RecordSessions && drop.RecordSessions ? 1 : 0,
trialFailed = Earlier(keep.TrialFailedAt, drop.TrialFailedAt),
hookOff = blockCarried || autoCarried,
blockCarried,
now,
@@ -112,6 +117,8 @@ public sealed class SqliteGameMerge : IGameMerge
private static long? Later(long? a, long? b) => a is null ? b : b is null ? a : Math.Max(a.Value, b.Value);
private static long? Earlier(long? a, long? b) => a is null ? b : b is null ? a : Math.Min(a.Value, b.Value);
private static Task<Twin?> ReadAsync(SqliteConnection c, SqliteTransaction tx, long id, CancellationToken ct) =>
SqliteReaders.ReadOneAsync(c, new CommandDefinition(_read, new { id }, tx, cancellationToken: ct), Read);
@@ -127,7 +134,8 @@ public sealed class SqliteGameMerge : IGameMerge
SqliteReaders.Int64(r, 8),
r.GetInt32(9),
SqliteReaders.Int64(r, 10),
r.GetInt64(11) != 0);
r.GetInt64(11) != 0,
SqliteReaders.Int64(r, 12));
private sealed record Twin(
long Id,
@@ -141,5 +149,6 @@ public sealed class SqliteGameMerge : IGameMerge
long? AutoDisabledAt,
int CrashCount,
long? LastInjectedAt,
bool RecordSessions);
bool RecordSessions,
long? TrialFailedAt);
}
@@ -30,7 +30,7 @@ public sealed class SqliteGameRepository : IGameRepository
+ "ac_exception_eligible, ac_exception_verdict, ac_exception_sessions, ac_exception_checked_rules_version, "
+ "ac_exception_checked_exe_size_bytes, ac_exception_checked_exe_mtime_ms, ac_exception_checked_block, ac_exception_at, "
+ "ac_exception_family, ac_exception_disclosure_version, ac_exception_exe_size_bytes, ac_exception_exe_mtime_ms, "
+ "ac_exception_lapsed_at, ac_exception_lapsed_reason, engine_version_source";
+ "ac_exception_lapsed_at, ac_exception_lapsed_reason, engine_version_source, ac_exception_trial_failed_at";
private const string _selectByPath = $"SELECT {_columns} FROM games WHERE exe_path = @path";
@@ -373,8 +373,8 @@ public sealed class SqliteGameRepository : IGameRepository
ExeFileVersion = SqliteReaders.String(r, 36),
ExeProductVersion = SqliteReaders.String(r, 37),
Libraries = LibraryVersionsJson.Parse(SqliteReaders.String(r, 38)),
AcException = ReadException(r),
EngineVersionSource = SqliteReaders.String(r, 53), // schema 0015, the last column in _columns
AcException = ReadException(r) with { TrialFailedAt = At(SqliteReaders.Int64(r, 54)) }, // schema 0017, the last column
EngineVersionSource = SqliteReaders.String(r, 53), // schema 0015
};
/// <summary>Schema 0014's columns, 39 onwards in <see cref="_columns"/>' order.</summary>
@@ -165,10 +165,14 @@ public sealed class SqliteSessionRepository : ISessionRepository
_db.ReadAsync((c, token) => c.ExecuteScalarAsync<long>(new CommandDefinition(
"SELECT COUNT(*) FROM sessions WHERE started_at >= @since", new { since = since.ToUnixTimeMilliseconds() }, cancellationToken: token)), ct);
public ValueTask<int> CountSuccessfulHookedAsync(long gameId, CancellationToken ct = default) =>
_db.ReadAsync((c, token) => c.ExecuteScalarAsync<int>(new CommandDefinition(
"SELECT COUNT(*) FROM sessions WHERE game_id = @gameId AND capture_tier = 1 AND exit_status = 'normal' AND frame_count > 0",
new { gameId }, cancellationToken: token)), ct);
public ValueTask<int> CountSuccessfulUnderGrantAsync(long gameId, string family, DateTimeOffset grantedAt, CancellationToken ct = default)
{
ArgumentException.ThrowIfNullOrWhiteSpace(family);
return _db.ReadAsync((c, token) => c.ExecuteScalarAsync<int>(new CommandDefinition(
"SELECT COUNT(*) FROM sessions WHERE game_id = @gameId AND ac_exception_family = @family AND started_at >= @since "
+ "AND capture_tier = 1 AND exit_status = 'normal' AND frame_count > 0",
new { gameId, family, since = grantedAt.ToUnixTimeMilliseconds() }, cancellationToken: token)), ct);
}
public ValueTask<IReadOnlyList<SegmentRow>> FindSegmentsAsync(long sessionId, CancellationToken ct = default) =>
_db.ReadAsync((c, token) => SqliteReaders.ReadAllAsync(
@@ -12,5 +12,5 @@ namespace FrameLedger.Shared.Safety;
/// </remarks>
public static class AntiCheatExceptionDisclosure
{
public const string Version = "ac-exception-dialog/1";
public const string Version = "ac-exception-dialog/2";
}
+3
View File
@@ -61,6 +61,7 @@ public static class Strings
nameof(Safety_Exception_Risk_Format),
nameof(Safety_Exception_Still_Format),
nameof(Safety_Exception_Title_Format),
nameof(Safety_Exception_Trial),
nameof(Safety_Exception_VersionMismatch),
nameof(Safety_Exception_Why_Format),
nameof(Safety_HookingTurnedOff),
@@ -142,6 +143,8 @@ public static class Strings
public static string Safety_Exception_Title_Format => ResourceManager.GetString(nameof(Safety_Exception_Title_Format), Culture) ?? nameof(Safety_Exception_Title_Format);
public static string Safety_Exception_Trial => ResourceManager.GetString(nameof(Safety_Exception_Trial), Culture) ?? nameof(Safety_Exception_Trial);
public static string Safety_Exception_VersionMismatch => ResourceManager.GetString(nameof(Safety_Exception_VersionMismatch), Culture) ?? nameof(Safety_Exception_VersionMismatch);
public static string Safety_Exception_Why_Format => ResourceManager.GetString(nameof(Safety_Exception_Why_Format), Culture) ?? nameof(Safety_Exception_Why_Format);
+3 -2
View File
@@ -34,10 +34,11 @@
<data name="Safety_Refused_TargetUnreadable" xml:space="preserve"><value>The game is running, but Windows would not let FrameLedger open its process: it is protected by an anti-cheat driver, or it runs as administrator while FrameLedger does not. Nothing was injected and this run was not measured. FrameLedger will not work around another product's protection. If the game itself runs as administrator, the agent's admin mode in Settings lets FrameLedger open it; a protected process stays closed.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Title_Format" xml:space="preserve"><value>Make a user-mode exception for {0}?</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Intro_Format" xml:space="preserve"><value>FrameLedger found {0} in this game ({1}) and turned its hooking off. This dialog asks whether to make an exception for this game only. It recommends neither choice.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Why_Format" xml:space="preserve"><value>The exception is offered because {0} runs entirely in user mode — no kernel driver, no service and no driver file in the game's folder — and FrameLedger has already measured this game hooked, successfully, {1} times.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Why_Format" xml:space="preserve"><value>The exception is offered because {0} runs entirely in user mode — no kernel driver, no service and no driver file in the game's folder.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Trial" xml:space="preserve"><value>The first two sessions you play hooked under the exception are a trial. If either one does not go well — it crashes, records no frames, does not end normally, is stopped for safety, or something new is found — the exception ends, and no exception can be made for this game again. Two good sessions do not prove that the anti-cheat did not notice.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Risk_Format" xml:space="preserve"><value>The risk is the same as before, and it is yours. {0} is anti-cheat. It may detect FrameLedger in the game and warn, block or permanently ban your account — possibly days later, and FrameLedger cannot know whether it did. Sessions that went well before are no promise about the next one, or about the next update of the anti-cheat.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Still_Format" xml:space="preserve"><value>Under the exception the guard still runs every check, and still refuses a kernel driver in the game's folder, any other anti-cheat, an anti-cheat driver or service on this machine, a scan it cannot finish, and a title it refuses by name. The exception covers {0} and nothing else.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Ends" xml:space="preserve"><value>The exception ends by itself when something new is found, when a session under it crashes or is stopped for safety, when FrameLedger stops observing because another anti-cheat loaded, or when the game is updated. Turning the option off in Settings suspends it. You can withdraw it at any time.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Ends" xml:space="preserve"><value>After the trial, the exception ends by itself when something new is found, when a session under it crashes or is stopped for safety, when FrameLedger stops observing because another anti-cheat loaded, or when the game is updated; you may then make it again. Turning the option off in Settings suspends it. You can withdraw it at any time.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Next" xml:space="preserve"><value>Making the exception does not turn hooking on. You turn hooking on for this game afterwards, through the usual consent dialog.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Online" xml:space="preserve"><value>FrameLedger is intended for offline and single-player play. Do not use this exception with a game you play online or competitively unless you accept losing that account.</value><comment>safety: human review required</comment></data>
<data name="Safety_Exception_Accept" xml:space="preserve"><value>I accept the risk of a ban for this game</value><comment>safety: human review required</comment></data>
+3 -2
View File
@@ -39,10 +39,11 @@
<data name="Safety_Refused_TargetUnreadable" xml:space="preserve"><value>The game is running, but Windows would not let FrameLedger open its process: it is protected by an anti-cheat driver, or it runs as administrator while FrameLedger does not. Nothing was injected and this run was not measured. FrameLedger will not work around another product's protection. If the game itself runs as administrator, the agent's admin mode in Settings lets FrameLedger open it; a protected process stays closed.</value></data>
<data name="Safety_Exception_Title_Format" xml:space="preserve"><value>Make a user-mode exception for {0}?</value></data>
<data name="Safety_Exception_Intro_Format" xml:space="preserve"><value>FrameLedger found {0} in this game ({1}) and turned its hooking off. This dialog asks whether to make an exception for this game only. It recommends neither choice.</value></data>
<data name="Safety_Exception_Why_Format" xml:space="preserve"><value>The exception is offered because {0} runs entirely in user mode — no kernel driver, no service and no driver file in the game's folder — and FrameLedger has already measured this game hooked, successfully, {1} times.</value></data>
<data name="Safety_Exception_Why_Format" xml:space="preserve"><value>The exception is offered because {0} runs entirely in user mode — no kernel driver, no service and no driver file in the game's folder.</value></data>
<data name="Safety_Exception_Trial" xml:space="preserve"><value>The first two sessions you play hooked under the exception are a trial. If either one does not go well — it crashes, records no frames, does not end normally, is stopped for safety, or something new is found — the exception ends, and no exception can be made for this game again. Two good sessions do not prove that the anti-cheat did not notice.</value></data>
<data name="Safety_Exception_Risk_Format" xml:space="preserve"><value>The risk is the same as before, and it is yours. {0} is anti-cheat. It may detect FrameLedger in the game and warn, block or permanently ban your account — possibly days later, and FrameLedger cannot know whether it did. Sessions that went well before are no promise about the next one, or about the next update of the anti-cheat.</value></data>
<data name="Safety_Exception_Still_Format" xml:space="preserve"><value>Under the exception the guard still runs every check, and still refuses a kernel driver in the game's folder, any other anti-cheat, an anti-cheat driver or service on this machine, a scan it cannot finish, and a title it refuses by name. The exception covers {0} and nothing else.</value></data>
<data name="Safety_Exception_Ends" xml:space="preserve"><value>The exception ends by itself when something new is found, when a session under it crashes or is stopped for safety, when FrameLedger stops observing because another anti-cheat loaded, or when the game is updated. Turning the option off in Settings suspends it. You can withdraw it at any time.</value></data>
<data name="Safety_Exception_Ends" xml:space="preserve"><value>After the trial, the exception ends by itself when something new is found, when a session under it crashes or is stopped for safety, when FrameLedger stops observing because another anti-cheat loaded, or when the game is updated; you may then make it again. Turning the option off in Settings suspends it. You can withdraw it at any time.</value></data>
<data name="Safety_Exception_Next" xml:space="preserve"><value>Making the exception does not turn hooking on. You turn hooking on for this game afterwards, through the usual consent dialog.</value></data>
<data name="Safety_Exception_Online" xml:space="preserve"><value>FrameLedger is intended for offline and single-player play. Do not use this exception with a game you play online or competitively unless you accept losing that account.</value></data>
<data name="Safety_Exception_Accept" xml:space="preserve"><value>I accept the risk of a ban for this game</value></data>
+3 -2
View File
@@ -33,10 +33,11 @@
<data name="Safety_Refused_TargetUnreadable" xml:space="preserve"><value>Game đang chạy, nhưng Windows không cho FrameLedger mở tiến trình của nó: tiến trình được driver anti-cheat bảo vệ, hoặc game chạy với quyền quản trị còn FrameLedger thì không. Không có gì được inject và lần chạy này không được đo. FrameLedger sẽ không tìm cách vượt qua cơ chế bảo vệ của sản phẩm khác. Nếu chính game chạy với quyền quản trị, chế độ quản trị của agent trong Cài đặt cho phép FrameLedger mở nó; tiến trình được bảo vệ vẫn đóng.</value></data>
<data name="Safety_Exception_Title_Format" xml:space="preserve"><value>Tạo ngoại lệ user-mode cho {0}?</value></data>
<data name="Safety_Exception_Intro_Format" xml:space="preserve"><value>FrameLedger đã phát hiện {0} trong game này ({1}) và đã tắt hooking cho nó. Hộp thoại này hỏi bạn có muốn tạo ngoại lệ cho riêng game này không. Nó không khuyến nghị lựa chọn nào.</value></data>
<data name="Safety_Exception_Why_Format" xml:space="preserve"><value>Ngoại lệ được đề xuất vì {0} chạy hoàn toàn ở user mode — không có kernel driver, không có service và không có tệp driver nào trong thư mục game — và FrameLedger đã đo game này ở chế độ hook thành công {1} lần.</value></data>
<data name="Safety_Exception_Why_Format" xml:space="preserve"><value>Ngoại lệ được đề xuất vì {0} chạy hoàn toàn ở user mode — không có kernel driver, không có service và không có tệp driver nào trong thư mục game.</value></data>
<data name="Safety_Exception_Trial" xml:space="preserve"><value>Hai phiên đầu tiên bạn chơi có hook dưới ngoại lệ là phiên thử. Nếu một trong hai không ổn — bị crash, không ghi được frame nào, không kết thúc bình thường, bị dừng vì an toàn, hoặc phát hiện điều gì mới — ngoại lệ sẽ kết thúc và không thể tạo ngoại lệ cho game này nữa. Hai phiên tốt không chứng minh rằng anti-cheat đã không phát hiện.</value></data>
<data name="Safety_Exception_Risk_Format" xml:space="preserve"><value>Rủi ro vẫn như trước, và bạn là người chịu. {0} là anti-cheat. Nó có thể phát hiện FrameLedger trong game và cảnh báo, chặn hoặc khoá vĩnh viễn tài khoản của bạn — có thể sau nhiều ngày, và FrameLedger không thể biết điều đó có xảy ra hay không. Các phiên đã chạy ổn trước đây không bảo đảm gì cho phiên tiếp theo, hay cho bản cập nhật tiếp theo của anti-cheat.</value></data>
<data name="Safety_Exception_Still_Format" xml:space="preserve"><value>Dưới ngoại lệ, bộ bảo vệ vẫn chạy mọi bước kiểm tra, và vẫn từ chối khi có kernel driver trong thư mục game, bất kỳ anti-cheat nào khác, driver hay service anti-cheat trên máy này, một lần quét không hoàn tất, và các tựa game bị từ chối theo tên. Ngoại lệ chỉ áp dụng cho {0}, không gì khác.</value></data>
<data name="Safety_Exception_Ends" xml:space="preserve"><value>Ngoại lệ tự kết thúc khi phát hiện điều gì mới, khi một phiên dưới ngoại lệ bị crash hoặc bị dừng vì an toàn, khi FrameLedger ngừng quan sát vì một anti-cheat khác được nạp, hoặc khi game được cập nhật. Tắt tuỳ chọn trong Cài đặt sẽ tạm ngưng nó. Bạn có thể rút lại bất cứ lúc nào.</value></data>
<data name="Safety_Exception_Ends" xml:space="preserve"><value>Sau thời gian thử, ngoại lệ tự kết thúc khi phát hiện điều gì mới, khi một phiên dưới ngoại lệ bị crash hoặc bị dừng vì an toàn, khi FrameLedger ngừng quan sát vì một anti-cheat khác được nạp, hoặc khi game được cập nhật; khi đó bạn có thể tạo lại. Tắt tuỳ chọn trong Cài đặt sẽ tạm ngưng nó. Bạn có thể rút lại bất cứ lúc nào.</value></data>
<data name="Safety_Exception_Next" xml:space="preserve"><value>Tạo ngoại lệ không bật hooking. Sau đó bạn tự bật hooking cho game này qua hộp thoại đồng ý thông thường.</value></data>
<data name="Safety_Exception_Online" xml:space="preserve"><value>FrameLedger dành cho chơi offline và chơi đơn. Đừng dùng ngoại lệ này với game bạn chơi online hoặc thi đấu, trừ khi bạn chấp nhận mất tài khoản đó.</value></data>
<data name="Safety_Exception_Accept" xml:space="preserve"><value>Tôi chấp nhận rủi ro bị khoá tài khoản cho game này</value></data>
@@ -17,7 +17,7 @@ public sealed class AntiCheatExceptionsTests
{
private static CancellationToken Ct => TestContext.Current.CancellationToken;
private static readonly AntiCheatExceptionFacts _gf2 = new("GIRLS' FRONTLINE 2: EXILIUM", "NetEase Yidun", "NEP2.dll", 3);
private static readonly AntiCheatExceptionFacts _gf2 = new("GIRLS' FRONTLINE 2: EXILIUM", "NetEase Yidun", "NEP2.dll");
private static HelloAck Hello(string? exceptionDisclosure) =>
new("agent", IpcProtocol.Version, 1, false, "b", false, "l1", false, SafetyDisclosure.Version, exceptionDisclosure);
@@ -102,13 +102,14 @@ public sealed class AntiCheatExceptionsTests
var agent = new FakeAgent
{
Hello = Hello(AntiCheatExceptionDisclosure.Version),
Answer = static _ => Ack(IpcMessageType.Refused, new RefusedAck(56, "TooFewSessions", "NetEase Yidun", "1")),
// D38: a game whose exception once failed its trial is refused for good; the signal is when, in unix ms.
Answer = static _ => Ack(IpcMessageType.Refused, new RefusedAck(56, "TrialFailed", "NetEase Yidun", "1759449600000")),
};
var exceptions = new AntiCheatExceptions(agent, new FakePrompt { Accepts = true });
AntiCheatExceptionResult few = await exceptions.GrantAsync(56, _gf2, Ct);
few.Outcome.Should().Be(AntiCheatExceptionOutcome.Refused);
few.RefusalText().Should().Contain("1");
AntiCheatExceptionResult failed = await exceptions.GrantAsync(56, _gf2, Ct);
failed.Outcome.Should().Be(AntiCheatExceptionOutcome.Refused);
failed.RefusalText().Should().Contain("trial").And.Contain(Formats.Date(DateTimeOffset.FromUnixTimeMilliseconds(1759449600000)));
agent.Answer = static _ => throw new IpcRequestException(IpcErrorCode.ExceptionsOff, "off");
(await exceptions.GrantAsync(56, _gf2, Ct)).Outcome.Should().Be(AntiCheatExceptionOutcome.OptionOff);
@@ -140,7 +141,8 @@ public sealed class AntiCheatExceptionsTests
viewModel.Accepted.Should().BeFalse("the dialog opens with the risk unaccepted");
viewModel.Intro.Should().Contain("NetEase Yidun").And.Contain("NEP2.dll");
viewModel.Why.Should().Contain("3");
viewModel.Why.Should().Contain("NetEase Yidun").And.NotContain("{1}", "D38: the disclosure names no session count");
AntiCheatExceptionDialogViewModel.Trial.Should().Contain("trial", "D38: the grant's first two sessions are a trial, and the disclosure says so");
viewModel.Risk.Should().Contain("NetEase Yidun");
viewModel.Accepted = true;
viewModel.Accepted.Should().BeTrue();
@@ -474,7 +474,11 @@ public sealed class GameDetailViewModelTests
}
}
/// <summary>D33: a game the guard would let through but with one hooked session says so; a kernel-level family says why not.</summary>
/// <summary>
/// D33: why a game is not eligible is said on its page — a kernel-level family, a guard that also found something else.
/// D38 (2026-10-03): a failed trial says it is for good; a scan that found nothing of the family says so (it finished);
/// and an ELIGIBLE game's anti-cheat card no longer says hooking "cannot be turned on" beside its Make exception button.
/// </summary>
[Fact]
public async Task WhyAGameIsNotEligibleIsSaidOnItsPage()
{
@@ -483,47 +487,33 @@ public sealed class GameDetailViewModelTests
try
{
await using ScratchLedger s = await ScratchLedger.OpenAsync();
GameRow few = await s.GameAsync("Few");
GameRow aniimo = await s.GameAsync("Aniimo");
GameRow eac = await s.GameAsync("Eac");
await s.Db.WriteAsync(async (c, tx, ct) =>
{
const string sql = "UPDATE games SET hook_blocked_reason = @block, hook_prescan_state = 'blocked', ac_exception_verdict = @verdict, "
+ "ac_exception_sessions = @sessions, ac_exception_checked_block = @block WHERE id = @id";
await Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(sql, new
{
id = few.Id,
block = "AntiCheatFile|NetEase Yidun|NEP2.dll",
verdict = "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll",
sessions = 1
}, tx, cancellationToken: ct)).ConfigureAwait(false);
await Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(sql, new
{
id = aniimo.Id,
block = "AntiCheatFile|NetEase Yidun|NEP2.dll",
verdict = "AntiCheatFile|Kernel driver in the game folder|NEPKernel.sys",
sessions = 1
}, tx, cancellationToken: ct)).ConfigureAwait(false);
await Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(sql, new
{
id = eac.Id,
block = "AntiCheatDirectory|Easy Anti-Cheat|EasyAntiCheat",
verdict = "AntiCheatDirectory|Easy Anti-Cheat|EasyAntiCheat",
sessions = 4
}, tx, cancellationToken: ct)).ConfigureAwait(false);
return 0;
}, Ct);
const string yidun = "AntiCheatFile|NetEase Yidun|NEP2.dll";
const string through = "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll";
long failed = await BlockedWithAnswerAsync(s, "Failed", yidun, through, eligible: false, trialFailedAt: 1_759_449_600_000);
long gone = await BlockedWithAnswerAsync(s, "Gone", yidun, "Allow||", eligible: false);
long eligible = await BlockedWithAnswerAsync(s, "GF2", yidun, through, eligible: true);
long aniimo = await BlockedWithAnswerAsync(s, "Aniimo", yidun, "AntiCheatFile|Kernel driver in the game folder|NEPKernel.sys", eligible: false);
long eac = await BlockedWithAnswerAsync(s, "Eac", "AntiCheatDirectory|Easy Anti-Cheat|EasyAntiCheat", "AntiCheatDirectory|Easy Anti-Cheat|EasyAntiCheat",
eligible: false);
var settings = new RegisteredSettings(new MemorySettings());
await settings.SetAsync(SettingsRegistry.HookingUserModeExceptions, true, Ct);
(GameDetailViewModel vm, _, _, _, _) = await BuildAsync(s, few.Id, settings: settings);
vm.ExceptionText.Should().Contain("1").And.Contain("two");
(GameDetailViewModel vm, _, _, _, _) = await BuildAsync(s, failed, settings: settings);
vm.ExceptionText.Should().Contain("trial").And.Contain("none can be made again");
vm.CanGrantException.Should().BeFalse();
vm.AntiCheatText.Should().Contain("cannot be turned on", "nothing can be made for it");
(vm, _, _, _, _) = await BuildAsync(s, aniimo.Id, settings: settings);
(vm, _, _, _, _) = await BuildAsync(s, gone, settings: settings);
vm.ExceptionText.Should().Contain("NetEase Yidun").And.Contain("was not found", "the check finished and confirmed nothing");
(vm, _, _, _, _) = await BuildAsync(s, eligible, settings: settings);
vm.CanGrantException.Should().BeTrue("D38: no session is needed");
vm.AntiCheatText.Should().Contain("unless you make a user-mode exception").And.NotContain("cannot be turned on");
(vm, _, _, _, _) = await BuildAsync(s, aniimo, settings: settings);
vm.ExceptionText.Should().Contain("Kernel driver in the game folder").And.Contain("NEPKernel.sys");
(vm, _, _, _, _) = await BuildAsync(s, eac.Id, settings: settings);
(vm, _, _, _, _) = await BuildAsync(s, eac, settings: settings);
vm.ExceptionText.Should().Contain("Easy Anti-Cheat").And.Contain("not user-mode");
}
finally
@@ -532,6 +522,17 @@ public sealed class GameDetailViewModelTests
}
}
/// <summary>A blocked game the Agent has answered about: the block, the tolerant verdict, eligibility and a D38 trial mark.</summary>
private static async Task<long> BlockedWithAnswerAsync(ScratchLedger s, string name, string block, string verdict, bool eligible, long? trialFailedAt = null)
{
GameRow game = await s.GameAsync(name).ConfigureAwait(false);
const string sql = "UPDATE games SET hook_blocked_reason = @block, hook_prescan_state = 'blocked', ac_exception_verdict = @verdict, "
+ "ac_exception_eligible = @eligible, ac_exception_trial_failed_at = @failedAt, ac_exception_checked_block = @block WHERE id = @id";
await s.Db.WriteAsync((c, tx, ct) => Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(sql,
new { id = game.Id, block, verdict, eligible = eligible ? 1 : 0, failedAt = trialFailedAt }, tx, cancellationToken: ct)), Ct).ConfigureAwait(false);
return game.Id;
}
/// <summary>The library card says "Anti-cheat" for such a game (beta.8) — after "Not recorded", which says more.</summary>
[Fact]
public async Task TheLibraryCardSaysAntiCheatForAGameTheGuardFoundItIn()
@@ -173,8 +173,9 @@ public sealed class SettingsViewModelTests
/// <summary>
/// D33 (owner decision 2026-09-26): the option is one Agent-read settings row, off by default; on, the list names the
/// games the exception concerns — eligible, held back only by the session count, in force — and off, only a kept
/// exception, said to be suspended. The App reads the Agent's columns and writes none.
/// games it can act on — eligible, in force — and off, only a kept exception, said to be suspended. A game that can
/// never qualify (here: D38's failed trial; or a kernel-level family) is not listed: its page says why. The App reads
/// the Agent's columns and writes none.
/// </summary>
[Fact]
public async Task TheExceptionOptionIsOffByDefaultAndItsListFollowsTheAgentsColumns()
@@ -186,7 +187,8 @@ public sealed class SettingsViewModelTests
await s.Db.WriteAsync(async (c, tx, ct) =>
{
const string sql = "UPDATE games SET hook_blocked_reason = @block, hook_prescan_state = 'blocked', ac_exception_eligible = @eligible, "
+ "ac_exception_verdict = @verdict, ac_exception_sessions = @sessions, ac_exception_checked_block = @block WHERE id = @id";
+ "ac_exception_verdict = @verdict, ac_exception_sessions = @sessions, ac_exception_checked_block = @block, "
+ "ac_exception_trial_failed_at = CASE WHEN @sessions = 1 THEN 1759449600000 END WHERE id = @id";
const string yidun = "AntiCheatFile|NetEase Yidun|NEP2.dll";
await Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(sql, new
{
@@ -224,9 +226,8 @@ public sealed class SettingsViewModelTests
await pending;
(await h.Settings.GetBooleanAsync(SettingsRegistry.HookingUserModeExceptions, Ct)).Should().BeTrue();
h.Vm.ExceptionGames.Select(static g => g.Name).Should().Equal("Few", "GF2");
h.Vm.ExceptionGames.Single(static g => string.Equals(g.Name, "GF2", StringComparison.Ordinal)).CanGrant.Should().BeTrue();
h.Vm.ExceptionGames.Single(static g => string.Equals(g.Name, "Few", StringComparison.Ordinal)).CanGrant.Should().BeFalse("one session is not the owner's two");
h.Vm.ExceptionGames.Select(static g => g.Name).Should().Equal(["GF2"], "a row with no action is not listed");
h.Vm.ExceptionGames.Single().CanGrant.Should().BeTrue();
h.Vm.ExceptionsChecking.Should().BeFalse("the Agent answered about every blocked game");
await s.Db.WriteAsync((c, tx, ct) => Dapper.SqlMapper.ExecuteAsync(c, new Dapper.CommandDefinition(
@@ -126,7 +126,7 @@ public sealed class AntiCheatPreScanSweepTests
return ValueTask.FromResult(ConsentWriteOutcome.NotFound);
}
bool eligible = verdict is { } v && UserModeExceptionRules.IsEligible(StoredBlock.Parse(block), v, sessions);
bool eligible = verdict is { } v && UserModeExceptionRules.IsEligible(StoredBlock.Parse(block), v, row.AcException.TrialFailed);
string? text = verdict is { } said ? $"{said.Reason}|{said.Family}|{said.Signal}" : null;
Eligibility.Add((eligible, text, sessions));
games.Rows[scanned.ExePath] = row with
@@ -148,7 +148,8 @@ public sealed class AntiCheatPreScanSweepTests
public ValueTask<ConsentWriteOutcome> GrantAntiCheatExceptionAsync(AntiCheatExceptionGrantRequest grant, CancellationToken ct = default) =>
throw new NotSupportedException("the sweep never grants");
public ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, CancellationToken ct = default)
public ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, bool trialFailed = false,
CancellationToken ct = default)
{
GameRow row = games.Rows[normalisedExePath];
if (!row.AcException.IsGranted)
@@ -160,7 +161,13 @@ public sealed class AntiCheatPreScanSweepTests
games.Rows[normalisedExePath] = row with
{
HookEnabled = row.HookBlockedReason is null && row.HookEnabled,
AcException = row.AcException with { GrantedAt = null, LapsedReason = reason, LapsedAt = DateTimeOffset.UnixEpoch },
AcException = row.AcException with
{
GrantedAt = null,
LapsedReason = reason,
LapsedAt = DateTimeOffset.UnixEpoch,
TrialFailedAt = trialFailed ? row.AcException.TrialFailedAt ?? DateTimeOffset.UnixEpoch : row.AcException.TrialFailedAt,
},
};
return ValueTask.FromResult(ConsentWriteOutcome.Written);
}
@@ -333,8 +340,11 @@ public sealed class AntiCheatPreScanSweepTests
private static readonly AntiCheatVerdict _letThrough = AntiCheatVerdict.AllowedUnderException("NetEase Yidun", "NEP2.dll");
/// <summary>D33: a blocked entry, with the exception's evidence and option composed; optionally granted on the bytes on disk.</summary>
private static async Task<Rig> BlockedAsync(string block = _yidun, int sessions = 3, bool granted = false, bool optionOn = true)
/// <summary>
/// D33: a blocked entry, with the exception's option composed; optionally granted on the bytes on disk with
/// <paramref name="trial"/> successful sessions under the grant (D38), or marked as having failed a trial.
/// </summary>
private static async Task<Rig> BlockedAsync(string block = _yidun, int trial = 0, bool granted = false, bool optionOn = true, bool trialFailed = false)
{
var games = new FakeGameRepository();
GameRow row = await games.EnsureAsync(new ExecutableFingerprint { ExePath = _exe, SizeBytes = 5, MtimeUnixMs = 5 }, "Title", Ct).ConfigureAwait(false);
@@ -345,10 +355,12 @@ public sealed class AntiCheatPreScanSweepTests
HookEnabled = granted,
AcException = granted
? new AntiCheatExceptionState { GrantedAt = DateTimeOffset.UnixEpoch, Family = "NetEase Yidun", ExeSizeBytes = 5, ExeMtimeMs = 5 }
: AntiCheatExceptionState.None,
: trialFailed
? AntiCheatExceptionState.None with { TrialFailedAt = DateTimeOffset.UnixEpoch, LapsedReason = UserModeExceptionLapse.TrialFailed }
: AntiCheatExceptionState.None,
};
var rig = new Rig(games, exceptions: true);
rig.Sessions.SuccessfulHooked[row.Id] = sessions;
rig.Sessions.SuccessfulUnderGrant[row.Id] = trial;
rig.Option.On = optionOn;
rig.Guard.TolerantAnswer = _letThrough;
return rig;
@@ -356,8 +368,9 @@ public sealed class AntiCheatPreScanSweepTests
/// <summary>
/// D33 (owner decision 2026-09-26): with the option on, a blocked entry is asked one question — a pre-scan NAMING its
/// block's family — and eligible when the guard let exactly that family through and the evidence reaches two sessions.
/// It is never scanned for a new block, and nothing is granted.
/// block's family — and eligible when the guard let exactly that family through. D38 (2026-10-03): with no session at
/// all — the GIRLS' FRONTLINE 2 shape on a fresh ledger, which D33's two sessions made unreachable. It is never scanned
/// for a new block, and nothing is granted.
/// </summary>
[Fact]
public async Task WithTheOptionOnABlockedEntryIsAskedAboutItsExceptionAndNothingElse()
@@ -371,7 +384,8 @@ public sealed class AntiCheatPreScanSweepTests
report.ExceptionsChecked.Should().Be(1);
r.Guard.Tolerated.Should().Equal("NetEase Yidun");
r.Consent.Writes.Should().BeEmpty("the pre-scan's own columns are not written over a block");
r.Consent.Eligibility.Should().ContainSingle().Which.Should().Be((true, "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll", 3));
r.Consent.Eligibility.Should().ContainSingle().Which.Should().Be((true, "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll", 0));
r.Sessions.GrantCounts.Should().BeEmpty("no grant, no trial to count");
r.Games.Rows[_exe].AcException.IsGranted.Should().BeFalse("eligibility grants nothing; the user does, through the disclosure");
r.Games.Rows[_exe].HookBlockedReason.Should().Be(_yidun, "nothing clears a block");
}
@@ -386,28 +400,68 @@ public sealed class AntiCheatPreScanSweepTests
r.Consent.Eligibility.Should().BeEmpty();
}
/// <summary>The answer is keyed like the pre-scan: rules, executable and the block itself; the count is re-read every pass.</summary>
/// <summary>
/// The answer is keyed like the pre-scan: rules, executable and the block itself; D38: the trial of a grant in force is
/// counted every pass, under that grant's family and time, and written when it moves.
/// </summary>
[Fact]
public async Task TheExceptionQuestionIsKeyedAndTheCountIsLive()
public async Task TheExceptionQuestionIsKeyedAndTheTrialIsCountedLive()
{
using Rig r = await BlockedAsync(sessions: 1);
using Rig r = await BlockedAsync(granted: true);
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Consent.Eligibility.Should().ContainSingle().Which.Eligible.Should().BeFalse("one session is not the owner's two");
r.Consent.Eligibility.Should().ContainSingle().Which.Should().Be((true, "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll", 0));
r.Sessions.GrantCounts.Should().ContainSingle().Which.Should().Be((r.Games.Rows[_exe].Id, "NetEase Yidun", DateTimeOffset.UnixEpoch));
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Guard.Scanned.Should().ContainSingle("nothing in the key changed");
r.Consent.Eligibility.Should().ContainSingle("and neither did the answer");
r.Sessions.SuccessfulHooked[r.Games.Rows[_exe].Id] = 2;
r.Sessions.SuccessfulUnderGrant[r.Games.Rows[_exe].Id] = 1;
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Guard.Scanned.Should().ContainSingle("a new session is counted, not scanned for");
r.Consent.Eligibility[^1].Should().Be((true, "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll", 2));
r.Guard.Scanned.Should().ContainSingle("a session under the grant is counted, not scanned for");
r.Consent.Eligibility[^1].Should().Be((true, "AllowedUnderUserModeException|NetEase Yidun|NEP2.dll", 1));
r.Games.Rows[_exe].AcException.IsGranted.Should().BeTrue("a count never ends a grant");
r.Rules.Version = "2026.09.6";
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Guard.Scanned.Should().HaveCount(2, "new rules may have turned the family kernel-level");
}
/// <summary>D38: a game an exception of which failed its trial is never eligible again, whatever the guard says.</summary>
[Fact]
public async Task AGameWhoseTrialFailedIsNeverEligibleAgain()
{
using Rig r = await BlockedAsync(trialFailed: true);
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Guard.Tolerated.Should().Equal("NetEase Yidun");
r.Consent.Eligibility.Should().ContainSingle().Which.Eligible.Should().BeFalse("the trial's end was for good");
}
/// <summary>
/// 2026-10-03: an executable the sweep cannot read is answered — the check could not run — instead of leaving the
/// row "checking" for ever; once, and the first readable pass scans it.
/// </summary>
[Fact]
public async Task AnUnreadableExecutableIsAnsweredNotLeftChecking()
{
using Rig r = await BlockedAsync();
r.Identity.OnDisk = null;
(await r.Sweep.SweepOnceAsync(Ct)).ExceptionsChecked.Should().Be(1);
(await r.Sweep.SweepOnceAsync(Ct)).ExceptionsChecked.Should().Be(0, "said once, not every pass");
r.Guard.Scanned.Should().BeEmpty("nothing could be read, so nothing was scanned");
r.Consent.Eligibility.Should().ContainSingle().Which.Should().Be((false, "PreScanFailed||" + Path.GetFileName(_exe), 0));
r.Games.Rows[_exe].AcException.CheckedBlock.Should().Be(_yidun, "the row is answered about its block, so the App stops saying it is checking");
r.Identity.OnDisk = new ExecutableFingerprint { ExePath = _exe, SizeBytes = 5, MtimeUnixMs = 5 };
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Guard.Tolerated.Should().Equal("NetEase Yidun");
r.Consent.Eligibility[^1].Eligible.Should().BeTrue("readable again, and asked again");
}
[Fact]
public async Task ATitleListBlockIsNeverAskedAndNeverEligible()
{
@@ -416,7 +470,7 @@ public sealed class AntiCheatPreScanSweepTests
_ = await r.Sweep.SweepOnceAsync(Ct);
r.Guard.Scanned.Should().BeEmpty("the notorious titles are on the lists by design");
r.Consent.Eligibility.Should().ContainSingle().Which.Should().Be((false, (string?)null, 3));
r.Consent.Eligibility.Should().ContainSingle().Which.Should().Be((false, (string?)null, 0));
}
[Fact]
@@ -8,8 +8,8 @@ namespace FrameLedger.Application.Tests.AntiCheat;
/// <summary>
/// D33 (owner decision 2026-09-26): the managed half of the user-mode exception can only narrow. A family is named to the
/// guard only when the option is on, a grant is on the row for these bytes, and the block is a module, file or folder
/// finding of that family; a game is eligible only when the guard let exactly that family through and the evidence
/// reaches the owner's two sessions.
/// finding of that family; a game is eligible only when the guard let exactly that family through — D38 (2026-10-03):
/// with no session needed, and never once an exception of the game failed its trial.
/// </summary>
public sealed class UserModeExceptionRulesTests
{
@@ -25,7 +25,7 @@ public sealed class UserModeExceptionRulesTests
{
Family = family,
GrantedAt = DateTimeOffset.UnixEpoch,
DisclosureVersion = "ac-exception-dialog/1",
DisclosureVersion = "ac-exception-dialog/2",
ExeSizeBytes = size,
ExeMtimeUnixMs = mtime,
};
@@ -46,20 +46,30 @@ public sealed class UserModeExceptionRulesTests
}
[Fact]
public void EligibleMeansTheGuardLetThatFamilyThroughAndTwoSessions()
public void EligibleMeansTheGuardLetThatFamilyThroughAndNoTrialFailed()
{
StoredBlock? block = StoredBlock.Parse(_block);
AntiCheatVerdict through = AntiCheatVerdict.AllowedUnderException("NetEase Yidun", "NEP2.dll");
UserModeExceptionRules.IsEligible(block, through, sessions: 2).Should().BeTrue();
UserModeExceptionRules.IsEligible(block, through, sessions: 1).Should().BeFalse("the owner's threshold is two");
UserModeExceptionRules.IsEligible(block, AntiCheatVerdict.Allowed(), sessions: 3).Should().BeFalse("a plain pass let nothing through, so it confirmed nothing");
UserModeExceptionRules.IsEligible(block, AntiCheatVerdict.AllowedUnderException("Anybrain", "x.dll"), sessions: 3).Should().BeFalse();
UserModeExceptionRules.IsEligible(block, through, trialFailed: false).Should().BeTrue("D38: no session is needed before a grant");
UserModeExceptionRules.IsEligible(block, through, trialFailed: true).Should().BeFalse("an exception that failed its trial is never made again");
UserModeExceptionRules.IsEligible(block, AntiCheatVerdict.Allowed(), trialFailed: false).Should().BeFalse("a plain pass let nothing through, so it confirmed nothing");
UserModeExceptionRules.IsEligible(block, AntiCheatVerdict.AllowedUnderException("Anybrain", "x.dll"), trialFailed: false).Should().BeFalse();
UserModeExceptionRules.IsEligible(block, AntiCheatVerdict.Refused(AntiCheatRefusalReason.AntiCheatFile, "Kernel driver in the game folder", "NEPKernel.sys"),
sessions: 3).Should().BeFalse("the Aniimo shape");
UserModeExceptionRules.IsEligible(StoredBlock.Parse("BlockedExecutable|Valve VAC|cs2.exe"), through, sessions: 3).Should().BeFalse();
UserModeExceptionRules.IsEligible(null, through, sessions: 3).Should().BeFalse();
UserModeExceptionRules.RequiredSessions.Should().Be(2);
trialFailed: false).Should().BeFalse("the Aniimo shape");
UserModeExceptionRules.IsEligible(StoredBlock.Parse("BlockedExecutable|Valve VAC|cs2.exe"), through, trialFailed: false).Should().BeFalse();
UserModeExceptionRules.IsEligible(null, through, trialFailed: false).Should().BeFalse();
}
/// <summary>D38: the owner's trial is two good sessions under the grant; until then it is a trial.</summary>
[Fact]
public void TheTrialIsTheGrantsFirstTwoGoodSessions()
{
UserModeExceptionRules.TrialSessions.Should().Be(2);
UserModeExceptionRules.InTrial(0).Should().BeTrue();
UserModeExceptionRules.InTrial(1).Should().BeTrue();
UserModeExceptionRules.InTrial(2).Should().BeFalse();
UserModeExceptionRules.InTrial(9).Should().BeFalse();
}
[Fact]
@@ -1186,8 +1186,7 @@ public sealed class CaptureSessionTests : IAsyncDisposable
Fingerprint = Fingerprint,
Block = _yidunBlock,
Verdict = AntiCheatVerdict.AllowedUnderException("NetEase Yidun", "NEP2.dll"),
Sessions = 3,
DisclosureVersion = "ac-exception-dialog/1",
DisclosureVersion = "ac-exception-dialog/2",
GrantedAt = DateTimeOffset.UnixEpoch,
}, ct).ConfigureAwait(false)).Should().Be(ConsentWriteOutcome.Written);
(await store.RecordOperatorAcknowledgementAsync(new OperatorAcknowledgement
@@ -183,7 +183,7 @@ public sealed class AgentCommandHandlerTests : IAsyncDisposable
var handler = new AgentCommandHandler(games, consent, guard, identity, orchestrator, pause, lifetime,
_ => { h.RulesUpdates++; return ValueTask.FromResult("AlreadyCurrent"); },
disclosureVersion, new FakeClock(), sweepRetention: sweep, architecture: architecture,
exceptions: exceptions ? new AntiCheatExceptionCommands(option, sessions, _exceptionDisclosure) : null);
exceptions: exceptions ? new AntiCheatExceptionCommands(option, _exceptionDisclosure) : null);
h = new Harness
{
Handler = handler,
@@ -486,20 +486,28 @@ public sealed class AgentCommandHandlerTests : IAsyncDisposable
Encoding.UTF8.GetString(IpcCodec.Encode(IpcMessageType.Ping, "9")).Should().NotContain("payload");
}
private const string _exceptionDisclosure = "ac-exception-dialog/1";
private const string _exceptionDisclosure = "ac-exception-dialog/2";
private const string _yidunBlock = "AntiCheatFile|NetEase Yidun|NEP2.dll";
/// <summary>D33: the owner's GIRLS' FRONTLINE 2 as beta.8 left it — consented, then blocked for NetEase Yidun — on both views of the row.</summary>
private async Task<Harness> BlockedAsync(int sessions = 3, string block = _yidunBlock, string? disclosureVersion = null)
/// <summary>
/// D33: the owner's GIRLS' FRONTLINE 2 as beta.8 left it — consented, then blocked for NetEase Yidun — on both views of the
/// row, with no session at all (D38: the shape a fresh ledger has); optionally marked as having failed an earlier trial.
/// </summary>
private async Task<Harness> BlockedAsync(string block = _yidunBlock, string? disclosureVersion = null, bool trialFailed = false)
{
Harness h = await BuildAsync(disclosureVersion: disclosureVersion, exceptions: true).ConfigureAwait(false);
StoredBlock parsed = StoredBlock.Parse(block)!.Value;
await h.Consent.RecordGuardBlockAsync(h.Identity.Read(_exe)!.Value, AntiCheatVerdict.Refused(parsed.Reason, parsed.Family, parsed.Signal), Ct)
.ConfigureAwait(false);
GameRow row = h.Games.Rows[_exe];
h.Games.Rows[_exe] = row with { HookBlockedReason = block, HookPrescanState = "blocked", HookEnabled = false };
h.Sessions.SuccessfulHooked[row.Id] = sessions;
h.Games.Rows[_exe] = row with
{
HookBlockedReason = block,
HookPrescanState = "blocked",
HookEnabled = false,
AcException = trialFailed ? row.AcException with { TrialFailedAt = DateTimeOffset.FromUnixTimeMilliseconds(1_759_449_600_000) } : row.AcException,
};
return h;
}
@@ -526,7 +534,10 @@ public sealed class AgentCommandHandlerTests : IAsyncDisposable
(await h.Consent.FindAsync(_exe, Ct).ConfigureAwait(true)).Exception.Should().BeNull();
}
/// <summary>The facts are the Agent's own — a tolerant pre-scan of the file on disk, the session count — and a grant turns nothing on.</summary>
/// <summary>
/// The facts are the Agent's own — a tolerant pre-scan of the file on disk — and a grant turns nothing on. D38: the row has
/// no session at all, and the grant is made: its first two sessions are its trial.
/// </summary>
[Fact]
public async Task AGrantRestsOnFactsTheAgentGathersAndTurnsNothingOn()
{
@@ -546,15 +557,18 @@ public sealed class AgentCommandHandlerTests : IAsyncDisposable
}
[Fact]
public async Task TooFewSessionsATitleListOrAGuardThatLetsNothingThroughIsRefused()
public async Task AFailedTrialOrAGuardThatLetsNothingThroughIsRefused()
{
Harness one = await BlockedAsync(sessions: 1).ConfigureAwait(true);
IpcEnvelope few = await AskAsync(one.Handler, IpcMessageType.SetAntiCheatException, Grant(one)).ConfigureAwait(true);
few.Type.Should().Be(IpcMessageType.Refused);
IpcCodec.Payload<RefusedAck>(few).Should().Be(new RefusedAck(one.Games.Rows[_exe].Id, AgentCommandHandler.TooFewSessionsReason, "NetEase Yidun", "1"));
// D38: an exception of this game ended during its trial — for good, and before anything is scanned.
Harness failed = await BlockedAsync(trialFailed: true).ConfigureAwait(true);
IpcEnvelope again = await AskAsync(failed.Handler, IpcMessageType.SetAntiCheatException, Grant(failed)).ConfigureAwait(true);
again.Type.Should().Be(IpcMessageType.Refused);
IpcCodec.Payload<RefusedAck>(again).Should().Be(new RefusedAck(failed.Games.Rows[_exe].Id, AgentCommandHandler.TrialFailedReason, "NetEase Yidun",
"1759449600000"));
failed.Guard.Scanned.Should().BeEmpty();
Harness one = await BlockedAsync().ConfigureAwait(true);
one.Guard.TolerantPreScan = AntiCheatVerdict.Refused(AntiCheatRefusalReason.AntiCheatFile, "Kernel driver in the game folder", "NEPKernel.sys");
one.Sessions.SuccessfulHooked[one.Games.Rows[_exe].Id] = 3;
RefusedAck driver = IpcCodec.Payload<RefusedAck>(await AskAsync(one.Handler, IpcMessageType.SetAntiCheatException, Grant(one)).ConfigureAwait(true))!;
driver.Reason.Should().Be(nameof(AntiCheatRefusalReason.AntiCheatFile), "the Aniimo shape: D30 is never excepted");
driver.Signal.Should().Be("NEPKernel.sys");
@@ -91,11 +91,20 @@ internal sealed class FakeSessionRepository : ISessionRepository
public ValueTask<long> CountSinceAsync(DateTimeOffset since, CancellationToken ct = default) =>
ValueTask.FromResult((long)Stored.Count(s => s.Row.StartedAt >= since));
/// <summary>D33: each game's successful Tier-1 sessions, as the tests say; a game not named has none.</summary>
public Dictionary<long, int> SuccessfulHooked { get; } = [];
/// <summary>D38: each game's successful sessions under its grant in force, as the tests say; a game not named has none.</summary>
public Dictionary<long, int> SuccessfulUnderGrant { get; } = [];
public ValueTask<int> CountSuccessfulHookedAsync(long gameId, CancellationToken ct = default) =>
ValueTask.FromResult(SuccessfulHooked.GetValueOrDefault(gameId));
/// <summary>D38: the count for a game the dictionary does not name (the recorder's own row ids are not the test's).</summary>
public int UnderGrantDefault { get; set; }
/// <summary>D38: every count asked for, in order — the family and grant time it was asked about.</summary>
public List<(long GameId, string Family, DateTimeOffset GrantedAt)> GrantCounts { get; } = [];
public ValueTask<int> CountSuccessfulUnderGrantAsync(long gameId, string family, DateTimeOffset grantedAt, CancellationToken ct = default)
{
GrantCounts.Add((gameId, family, grantedAt));
return ValueTask.FromResult(SuccessfulUnderGrant.GetValueOrDefault(gameId, UnderGrantDefault));
}
public ValueTask<IReadOnlyList<SegmentRow>> FindSegmentsAsync(long sessionId, CancellationToken ct = default) =>
ValueTask.FromResult(sessionId >= 1 && sessionId <= Stored.Count ? Stored[(int)sessionId - 1].Segments : []);
@@ -297,7 +297,7 @@ public sealed class SessionRecorderTests : IAsyncDisposable
new SessionFinalizer(sessions, new RawSeriesCodec()), new NoCrashEvents(),
_ => poller ? new FakePoller(clockStepsOnDrain ? clock : null) : null, clock,
new RecorderOptions { PartialFlushInterval = TimeSpan.FromSeconds(10) }, profiles: profiles,
exceptionLapse: new UserModeExceptionLapsePolicy(store));
exceptionLapse: new UserModeExceptionLapsePolicy(store, sessions));
return new Harness { Recorder = recorder, Games = games, Sessions = sessions, Partials = partials, Clock = clock, Store = store };
}
@@ -312,8 +312,7 @@ public sealed class SessionRecorderTests : IAsyncDisposable
Fingerprint = Fingerprint,
Block = "AntiCheatFile|NetEase Yidun|NEP2.dll",
Verdict = AntiCheatVerdict.AllowedUnderException("NetEase Yidun", "NEP2.dll"),
Sessions = 2,
DisclosureVersion = "ac-exception-dialog/1",
DisclosureVersion = "ac-exception-dialog/2",
GrantedAt = DateTimeOffset.UnixEpoch,
}, ct).ConfigureAwait(false);
await store.RecordOperatorAcknowledgementAsync(new OperatorAcknowledgement
@@ -367,6 +366,32 @@ public sealed class SessionRecorderTests : IAsyncDisposable
after.HookEnabled.Should().BeFalse("the block stands, so hooking goes off with the exception");
after.BlockedReason.Should().Be("AntiCheatFile|NetEase Yidun|NEP2.dll", "nothing clears a block");
after.ConsentedAt.Should().NotBeNull("the end of an exception keeps the consent stamp, as a block does");
GameRow row = (await new SqliteGameRepository(_db!).FindAsync(_exe, TestContext.Current.CancellationToken))!;
row.AcException.TrialFailed.Should().BeTrue("D38: the grant had no good session yet, so a crash ends it for good");
}
/// <summary>
/// D38 (owner decision 2026-10-03): during the trial a stored hooked session that recorded no frame ends the exception for
/// good; past the trial (two good sessions under the grant) the same session leaves it in force.
/// </summary>
[Theory]
[InlineData(0, true)]
[InlineData(1, true)]
[InlineData(2, false)]
public async Task ASessionThatRecordedNothingEndsTheExceptionOnlyDuringItsTrial(int goodSoFar, bool ends)
{
Harness h = await MakeAsync(verdict: AntiCheatVerdict.AllowedUnderException("NetEase Yidun", "NEP2.dll"), excepted: true, records: 0);
h.Sessions.UnderGrantDefault = goodSoFar;
RecordedSession r = await h.Recorder.RecordAsync(Request(), TestContext.Current.CancellationToken);
r.Row.Tier.Should().Be(CaptureTier.Hooked);
r.Row.FrameCount.Should().Be(0);
r.Finalize.Status.Should().Be(FinalizeStatus.Saved, "only a stored session is judged");
r.ExceptionLapse.Should().Be(ends ? UserModeExceptionLapse.TrialFailed : null);
GameRow after = (await new SqliteGameRepository(_db!).FindAsync(_exe, TestContext.Current.CancellationToken))!;
after.AcException.IsGranted.Should().Be(!ends);
after.AcException.TrialFailed.Should().Be(ends);
}
[Fact]
@@ -9,7 +9,8 @@ namespace FrameLedger.Application.Tests.Recording;
/// <summary>
/// D33: which ends of a session under a game's user-mode exception end the exception — a finding about the game, a safety
/// unhook, the Overlay's own stop, a crash while hooked — and that nothing else does.
/// unhook, the Overlay's own stop, a crash while hooked — and that nothing else does; D38: during the grant's trial, a
/// stored hooked session that recorded no frame or did not end normally ends it too.
/// </summary>
public sealed class UserModeExceptionLapsePolicyTests
{
@@ -42,4 +43,37 @@ public sealed class UserModeExceptionLapsePolicyTests
[Fact]
public void ASessionUnderNoExceptionIsNeverTheExceptionsBusiness() =>
UserModeExceptionLapsePolicy.LapseOf(Under(SessionEndReason.SafetyUnhook, turnedOff: true, family: null), ExitStatus.UnhookedSafety).Should().BeNull();
private static readonly SessionForTrial _stored = new(GameId: 7, StoredHooked: true, FrameCount: 5_000);
[Theory]
[InlineData(ExitStatus.Normal, 0L)]
[InlineData(ExitStatus.Degraded, 5_000L)]
[InlineData(ExitStatus.Interrupted, 5_000L)]
public void DuringTheTrialAStoredSessionThatDidNotSucceedEndsIt(ExitStatus exit, long frames) =>
UserModeExceptionLapsePolicy.EndOf(Under(SessionEndReason.TargetExited), exit, _stored with { FrameCount = frames }, inTrial: true)
.Should().Be(UserModeExceptionLapse.TrialFailed);
[Fact]
public void ASucceededSessionOrOneNotStoredOrOnePastTheTrialIsNotATrialFailure()
{
UserModeExceptionLapsePolicy.EndOf(Under(SessionEndReason.TargetExited), ExitStatus.Normal, _stored, inTrial: true).Should().BeNull("it succeeded");
UserModeExceptionLapsePolicy.EndOf(Under(SessionEndReason.TargetExited), ExitStatus.Normal, _stored with { StoredHooked = false, FrameCount = 0 }, inTrial: true)
.Should().BeNull("a session too short to keep proves nothing either way");
UserModeExceptionLapsePolicy.EndOf(Under(SessionEndReason.TargetExited), ExitStatus.Normal, _stored with { FrameCount = 0 }, inTrial: false)
.Should().BeNull("past the trial only the D33 ends end it");
UserModeExceptionLapsePolicy.EndOf(Under(SessionEndReason.TargetExited, family: null), ExitStatus.Normal, _stored with { FrameCount = 0 }, inTrial: true)
.Should().BeNull("a session under no exception is never the exception's business");
UserModeExceptionLapsePolicy.EndOf(Under(SessionEndReason.TargetExited), ExitStatus.Crashed, _stored, inTrial: true)
.Should().Be(UserModeExceptionLapse.SessionCrashed, "a more specific reason is said as itself, and still marks the trial failed");
}
[Fact]
public void SucceededIsTheTrialCountsRule()
{
UserModeExceptionLapsePolicy.Succeeded(_stored, ExitStatus.Normal).Should().BeTrue();
UserModeExceptionLapsePolicy.Succeeded(_stored, ExitStatus.Crashed).Should().BeFalse();
UserModeExceptionLapsePolicy.Succeeded(_stored with { FrameCount = 0 }, ExitStatus.Normal).Should().BeFalse();
UserModeExceptionLapsePolicy.Succeeded(_stored with { StoredHooked = false }, ExitStatus.Normal).Should().BeFalse();
}
}
@@ -46,7 +46,8 @@ public sealed class VkLayerReconcilerTests
public ValueTask<ConsentWriteOutcome> GrantAntiCheatExceptionAsync(AntiCheatExceptionGrantRequest grant, CancellationToken ct = default) =>
throw new NotSupportedException();
public ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, CancellationToken ct = default) =>
public ValueTask<ConsentWriteOutcome> RevokeAntiCheatExceptionAsync(string normalisedExePath, string reason, bool trialFailed = false,
CancellationToken ct = default) =>
throw new NotSupportedException();
}
@@ -134,6 +134,43 @@ public sealed class LedgerDatabaseTests
cancellationToken: Ct)).ConfigureAwait(false);
}
/// <summary>
/// Schema 0017 (2026-10-03, beta.11, D38): <c>games.ac_exception_trial_failed_at</c>, NULL on every row written before — a
/// grant made under D33 keeps everything it had and carries no failed trial.
/// </summary>
[Fact]
public async Task ScriptSeventeenAddsTheTrialMarkAndChangesNoRow()
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
MigrationRunner.LatestVersion.Should().BeGreaterThanOrEqualTo(17);
string path = f.Path;
await f.Db.DisposeAsync().ConfigureAwait(true);
var c16 = new SqliteConnection(new SqliteConnectionStringBuilder { DataSource = path, Pooling = false }.ToString());
await using (c16.ConfigureAwait(true))
{
await c16.OpenAsync(Ct).ConfigureAwait(true);
await RewindToAsync(c16, 16).ConfigureAwait(true);
await c16.ExecuteAsync(new CommandDefinition(
"INSERT INTO games (name, exe_path, hook_blocked_reason, hook_prescan_state, ac_exception_at, ac_exception_family, ac_exception_sessions, "
+ "added_at, updated_at) VALUES ('GF2', 'C:\\GF2\\GF2_Exilium.exe', 'AntiCheatFile|NetEase Yidun|NEP2.dll', 'blocked', 1000, 'NetEase Yidun', 3, 0, 0)",
cancellationToken: Ct)).ConfigureAwait(true);
}
LedgerDatabase migrated = await LedgerDatabase.OpenAsync(path, ct: Ct).ConfigureAwait(true);
await using (migrated.ConfigureAwait(true))
{
migrated.SchemaVersion.Should().Be(MigrationRunner.LatestVersion);
long columns = await migrated.ReadAsync((c, ct) => c.ExecuteScalarAsync<long>(new CommandDefinition(
"SELECT COUNT(*) FROM pragma_table_info('games') WHERE name = 'ac_exception_trial_failed_at'", cancellationToken: ct)), Ct).ConfigureAwait(true);
columns.Should().Be(1);
GameRow row = (await new SqliteGameRepository(migrated).FindAsync(@"C:\GF2\GF2_Exilium.exe", Ct).ConfigureAwait(true))!;
row.AcException.IsGranted.Should().BeTrue("0017 edits no row: a D33 grant stays in force");
row.AcException.Sessions.Should().Be(3);
row.AcException.TrialFailedAt.Should().BeNull();
}
}
/// <summary>
/// Schema 0016 (2026-09-27, beta.10): the display mode's fifteen columns, ADD COLUMN only — a session written before it
/// has none of them (N/A, never a zero), and a new one writes and reads each.
@@ -251,7 +288,7 @@ public sealed class LedgerDatabaseTests
IReadOnlyList<string> games = await migrated.ReadAsync(async (c, ct) =>
(IReadOnlyList<string>)[.. await c.QueryAsync<string>(new CommandDefinition(
"SELECT name FROM pragma_table_info('games') WHERE name LIKE 'ac_exception_%'", cancellationToken: ct)).ConfigureAwait(false)], Ct).ConfigureAwait(true);
games.Should().HaveCount(14);
games.Should().HaveCount(15, "0014's fourteen, and since 0017 the trial mark");
long sessions = await migrated.ReadAsync((c, ct) => c.ExecuteScalarAsync<long>(new CommandDefinition(
"SELECT COUNT(*) FROM pragma_table_info('sessions') WHERE name = 'ac_exception_family'", cancellationToken: ct)), Ct).ConfigureAwait(true);
sessions.Should().Be(1);
@@ -376,13 +376,12 @@ public sealed class SqliteGameConsentStoreTests
private static readonly AntiCheatVerdict _letThrough = AntiCheatVerdict.AllowedUnderException("NetEase Yidun", "NEP2.dll");
private static AntiCheatExceptionGrantRequest GrantOf(ExecutableFingerprint? fp = null, string block = _yidun, AntiCheatVerdict? verdict = null, int sessions = 3) => new()
private static AntiCheatExceptionGrantRequest GrantOf(ExecutableFingerprint? fp = null, string block = _yidun, AntiCheatVerdict? verdict = null) => new()
{
Fingerprint = fp ?? Fingerprint(),
Block = block,
Verdict = verdict ?? _letThrough,
Sessions = sessions,
DisclosureVersion = "ac-exception-dialog/1",
DisclosureVersion = "ac-exception-dialog/2",
GrantedAt = DateTimeOffset.FromUnixTimeMilliseconds(1_000),
};
@@ -402,7 +401,6 @@ public sealed class SqliteGameConsentStoreTests
await using LedgerFixture f = await LedgerFixture.OpenAsync();
SqliteGameConsentStore store = await BlockedAsync(f);
(await store.GrantAntiCheatExceptionAsync(GrantOf(sessions: 1), Ct)).Should().Be(ConsentWriteOutcome.NotEligible, "the owner's threshold is two");
(await store.GrantAntiCheatExceptionAsync(GrantOf(verdict: AntiCheatVerdict.Allowed()), Ct)).Should().Be(ConsentWriteOutcome.NotEligible,
"a pass that let nothing through confirmed nothing");
(await store.GrantAntiCheatExceptionAsync(GrantOf(block: "BlockedStoreId|Valve VAC|steam:730"), Ct)).Should().Be(ConsentWriteOutcome.NotEligible);
@@ -410,6 +408,7 @@ public sealed class SqliteGameConsentStoreTests
"the facts are about a block the row does not carry");
(await store.FindAsync(Fingerprint().ExePath, Ct)).Exception.Should().BeNull();
// D38: no session is asked for — the row has none, the GIRLS' FRONTLINE 2 shape on a fresh ledger.
(await store.GrantAntiCheatExceptionAsync(GrantOf(), Ct)).Should().Be(ConsentWriteOutcome.Written);
GameConsentRecord r = await store.FindAsync(Fingerprint().ExePath, Ct);
@@ -417,7 +416,7 @@ public sealed class SqliteGameConsentStoreTests
{
Family = "NetEase Yidun",
GrantedAt = DateTimeOffset.FromUnixTimeMilliseconds(1_000),
DisclosureVersion = "ac-exception-dialog/1",
DisclosureVersion = "ac-exception-dialog/2",
ExeSizeBytes = 90_000,
ExeMtimeUnixMs = 1_700_000_000_000,
});
@@ -452,11 +451,11 @@ public sealed class SqliteGameConsentStoreTests
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
SqliteGameConsentStore store = await BlockedAsync(f);
(await store.RevokeAntiCheatExceptionAsync(Fingerprint().ExePath, "SessionCrashed", Ct)).Should().Be(ConsentWriteOutcome.NotFound, "nothing in force");
(await store.RevokeAntiCheatExceptionAsync(Fingerprint().ExePath, "SessionCrashed", ct: Ct)).Should().Be(ConsentWriteOutcome.NotFound, "nothing in force");
await store.GrantAntiCheatExceptionAsync(GrantOf(), Ct);
await store.RecordOperatorAcknowledgementAsync(Ack(), Ct);
(await store.RevokeAntiCheatExceptionAsync(Fingerprint().ExePath, "SessionCrashed", Ct)).Should().Be(ConsentWriteOutcome.Written);
(await store.RevokeAntiCheatExceptionAsync(Fingerprint().ExePath, "SessionCrashed", ct: Ct)).Should().Be(ConsentWriteOutcome.Written);
GameConsentRecord r = await store.FindAsync(Fingerprint().ExePath, Ct);
r.Exception.Should().BeNull();
@@ -467,6 +466,36 @@ public sealed class SqliteGameConsentStoreTests
row.AcException.LapsedAt.Should().NotBeNull();
row.AcException.Family.Should().Be("NetEase Yidun", "the family stays as history");
row.AcException.IsGranted.Should().BeFalse();
row.AcException.TrialFailed.Should().BeFalse("an end after the trial is not a failed trial");
(await store.GrantAntiCheatExceptionAsync(GrantOf(), Ct)).Should().Be(ConsentWriteOutcome.Written, "after its trial an exception may be made again");
}
/// <summary>
/// D38 (owner decision 2026-10-03, schema 0017): an end during the trial marks the game for good — the store writes no
/// eligibility and no grant over it, in SQL, and neither Change executable nor a later end clears the mark.
/// </summary>
[Fact]
public async Task AnEndDuringTheTrialMarksTheGameAndNothingClearsIt()
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
SqliteGameConsentStore store = await BlockedAsync(f);
(await store.GrantAntiCheatExceptionAsync(GrantOf(), Ct)).Should().Be(ConsentWriteOutcome.Written);
(await store.RevokeAntiCheatExceptionAsync(Fingerprint().ExePath, "TrialFailed", trialFailed: true, ct: Ct)).Should().Be(ConsentWriteOutcome.Written);
var games = new SqliteGameRepository(f.Db);
GameRow row = (await games.FindAsync(Fingerprint().ExePath, Ct))!;
row.AcException.TrialFailed.Should().BeTrue();
row.AcException.LapsedReason.Should().Be("TrialFailed");
DateTimeOffset marked = row.AcException.TrialFailedAt!.Value;
(await store.RecordExceptionEligibilityAsync(Fingerprint(), _yidun, _letThrough, 0, "2026.10.1", Ct)).Should().Be(ConsentWriteOutcome.Written);
(await games.FindAsync(Fingerprint().ExePath, Ct))!.AcException.Eligible.Should().BeFalse("the store applies the mark whatever the caller computed");
(await store.GrantAntiCheatExceptionAsync(GrantOf(), Ct)).Should().Be(ConsentWriteOutcome.NotEligible, "never again for this game");
(await store.FindAsync(Fingerprint().ExePath, Ct)).Exception.Should().BeNull();
(await games.ChangeExecutableAsync(row.Id, Fingerprint(@"C:\Games\Title\other.exe"), DateTimeOffset.UnixEpoch, Ct)).Should().BeTrue();
(await games.FindByIdAsync(row.Id, Ct))!.AcException.TrialFailedAt.Should().Be(marked, "Change executable is not a way past a failed trial");
}
[Fact]
@@ -145,6 +145,22 @@ public sealed class SqliteGameMergeTests
(await repo.FindByIdAsync(stale.Id, Ct))!.RecordSessions.Should().BeFalse();
}
/// <summary>
/// D38 (schema 0017): an exception of either twin that failed its trial marks the survivor, the earlier mark of two — a
/// merge is not the way a game's "never again" disappears.
/// </summary>
[Fact]
public async Task AFailedExceptionTrialOnEitherTwinMarksTheSurvivor()
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
(SqliteGameRepository repo, GameRow stale, GameRow twin) = await TwinsAsync(f, staleAdded: 1_000, twinAdded: 2_000);
await SetAsync(f, twin.Id, "ac_exception_trial_failed_at = 5000");
(await new SqliteGameMerge(f.Db).MergeAsync(await PlanAsync(repo, stale, twin), Ct)).Should().Be(0);
(await repo.FindByIdAsync(stale.Id, Ct))!.AcException.TrialFailedAt.Should().Be(DateTimeOffset.FromUnixTimeMilliseconds(5000));
}
[Fact]
public async Task ARowThatIsNotWhatThePlanSawIsNotMergedAndNothingIsWritten()
{
@@ -395,15 +395,17 @@ public sealed class SqliteSessionRepositoryTests
}
/// <summary>
/// D33 (owner decision 2026-09-26): the evidence a user-mode exception needs — hooked, frames recorded, <c>normal</c> —
/// and nothing else: a crash, a safety unhook, a Tier-2 session and a hooked session that recorded no frame do not count.
/// D38 (owner decision 2026-10-03): a grant's trial counts its own sessions — hooked under that family, from the grant on,
/// frames recorded, <c>normal</c> — and nothing else: a crash, a safety unhook, a degraded or Tier-2 session, one that
/// recorded no frame, one under no exception or another family, and one from before the grant do not count.
/// </summary>
[Fact]
public async Task OnlyHookedNormalSessionsWithFramesAreSuccessful()
public async Task OnlyHookedNormalSessionsWithFramesUnderTheGrantCount()
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
(long gameId, long snapshotId) = await SeedAsync(f);
var repo = new SqliteSessionRepository(f.Db);
DateTimeOffset granted = DateTimeOffset.FromUnixTimeMilliseconds(1_700_000_000_000);
SessionRow[] rows =
[
Row(gameId, snapshotId),
@@ -412,14 +414,18 @@ public sealed class SqliteSessionRepositoryTests
Row(gameId, snapshotId) with { ExitStatus = ExitStatus.Degraded },
Row(gameId, snapshotId) with { Tier = CaptureTier.NotHooked },
Row(gameId, snapshotId) with { FrameCount = 0, AppFrameCount = 0, DisplayedFrameCount = 0 },
Row(gameId, snapshotId),
Row(gameId, snapshotId) with { AcExceptionFamily = null },
Row(gameId, snapshotId) with { AcExceptionFamily = "Anybrain" },
Row(gameId, snapshotId, started: granted.AddMinutes(-5)),
Row(gameId, snapshotId, started: granted.AddHours(1)),
];
foreach (SessionRow row in rows)
{
await repo.InsertFinalizedAsync(new FinalizedSession { Row = row }, Ct);
}
(await repo.CountSuccessfulHookedAsync(gameId, Ct)).Should().Be(2);
(await repo.CountSuccessfulHookedAsync(gameId + 1, Ct)).Should().Be(0);
(await repo.CountSuccessfulUnderGrantAsync(gameId, "NetEase Yidun", granted, Ct)).Should().Be(2);
(await repo.CountSuccessfulUnderGrantAsync(gameId, "NetEase Yidun", granted.AddMinutes(30), Ct)).Should().Be(1, "a later grant starts its own trial");
(await repo.CountSuccessfulUnderGrantAsync(gameId + 1, "NetEase Yidun", granted, Ct)).Should().Be(0);
}
}