Compare commits

...
Author SHA1 Message Date
poli0981andClaude Opus 5 0fccd01dcc fix(fg): FgSteadyState drops its unreachable branches and checks its arguments (coverage 94.7 % -> 100 %)
CI's coverage gate refused the steady-state PR: FgSteadyState at 94.7 %
against the 95 % per-calculator floor. The misses were branches that cannot
run: an empty state after re-drawing around the pooled factor (a weighted mean
of members within 10 % of the centre always has a member within 10 % of
itself), a zero presenting time (a valid start always yields a slice), a
before-origin QPC and an infinite slice factor that the active check
short-circuits before reading. They are gone; an out-of-range start throws
instead of returning null, and a direct-call test covers the arguments and the
no-active-window case. Behaviour for every reachable input is unchanged:
Domain 165 and Application 246 green, 100 % line coverage on the class.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 11:39:25 +07:00
poli0981andClaude Fable 5.1 36995d37bd feat(fg): a session whose frame-generation state changed publishes its steady state, with its share (schema 0006)
The owner saw the live card show the FG factor all session and the finished
session show "factor not counted" most of the time, and suspected the path from
the hook to the UI. The path is whole: the stored per-frame counts of all nine
hooked sessions of 2026-09-16 read 2.00 / 3.00 / 4.00 inside gameplay. The live
card looks at five seconds; the stored row looked at the whole session, split
it in eight and refused it when one bucket departed — and every real session
opens with a splash, a menu or a loading screen. The refusal is right (Wukong
averages to 2.22; its gameplay ran x4.1) and stays; the gameplay's number is no
longer thrown away with the average.

- Domain.Metrics.FgSteadyState: five-second windows (the live card's own), the
  ACTIVE windows agreeing within 10 % that hold the most time, published at
  >= 10 s and >= 10 % of the presenting time, with Native and Displayed counted
  over the state's own windows. Only behind a NonUniform refusal; never beside
  a published session factor; never for an unattributed or saturated set.
- FgWindow: BucketTolerance 25 % -> 10 % (a x3-then-x4 session published 3.69;
  the one published session read x2.04 for a gameplay of 2.00);
  MultipleStreams refuses only when the chains' samples INTERLEAVE — Onimusha
  recreates its swapchain on entering gameplay and was refused on every session.
- Row: fg_factor_scope ('session' | 'steady') and fg_steady_share, schema 0006;
  fg_refusal and its detail stay beside a steady factor. FgLadder: a steady
  state without an identity is ActiveUnidentified.
- UI: the generated shape with the chip "x2.0 FG · 75%" — the share is never
  omitted — and a tooltip saying why there is no session-wide factor.
- Replayed over the owner's nine sessions through the real FgWindow: eight
  publish (Onimusha x4.00 60 -> 240, Lies of P x2.00, Hell Is Us x3.03, Cronos
  x2.00 225 -> 451, Wukong x4.11); the ninth had nine seconds of gameplay.
- CLAUDE.md rule 6 amended (owner decision 2026-09-17). Docs: 03_METRICS §The
  steady state, 08_UI, 06_DATA_MODEL, CHANGELOG. Two strings en/vi/ja.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-17 11:23:32 +07:00
24 changed files with 616 additions and 20 deletions

No files matched your search

+24
View File
@@ -27,6 +27,30 @@ under a `## [x.y.z] - date` heading in the same commit that bumps `VERSION`, the
## [Unreleased]
### Added
- **A session whose frame-generation state changed publishes its steady state, with its share (2026-09-17, owner
decision — `03_METRICS` §The steady state).** The owner saw the live card show the FG factor all session and the
finished session show "factor not counted" most of the time, and suspected the path from the hook to the UI. The
path is whole: the stored per-frame counts of all nine hooked sessions of 2026-09-16 read 2.00 / 3.00 / 4.00 inside
gameplay. The live card looks at five seconds; the stored row looked at the whole session, split it in eight and
refused it when one bucket departed — and every real session opens with a splash, a menu or a loading screen, so
one session in nine published. The refusal is right (Wukong's session averages to 2.22; its gameplay ran ×4.1) and
stays; what changes is that the gameplay's number is no longer thrown away with the average.
`Domain.Metrics.FgSteadyState`: five-second windows (the live card's own), the ACTIVE windows agreeing within 10 %
that hold the most time, published at ≥ 10 s and ≥ 10 % of the presenting time — `fg_factor` / `native_fps` /
`displayed_fps` from that state's own windows, `fg_factor_scope = 'steady'`, `fg_steady_share` (schema **0006**),
the refusal and its detail kept beside it. The readout is the generated shape with the chip **`×2.0 FG · 75%`** —
the share is never omitted — and a tooltip saying why there is no session-wide factor. Replayed over the nine
sessions through the real `FgWindow`: eight publish (Onimusha ×4.00 60 → 240, Lies of P ×2.00, Hell Is Us ×3.03,
Cronos ×2.00 225 → 451, Wukong ×4.11); the ninth had nine seconds of gameplay. **Two constants moved with it:**
`BucketTolerance` 25 % → 10 % (at 25 % a ×3-then-×4 session published 3.69, and the one published session read
×2.04 for a gameplay of 2.00), and `MultipleStreams` refuses only when the chains' samples interleave — Onimusha
recreates its swapchain on entering gameplay, one stream at a time, and had been refused as two on every session.
CLAUDE.md rule 6 amended. Two strings (en/vi/ja). Tests: `FgSteadyStateTests`, `FgWindowTests` (interleaved vs
sequential), `SessionAggregatorTests`, `FpsPresentationTests`, `LedgerDatabaseTests` (script six), the repository
round trip. Existing rows are not re-aggregated.
### Changed
- **The first tag ran (2026-09-16).** `v0.1.0-beta.1` on `becc208`; `release.yml` run 35111939019. The first attempt
+2
View File
@@ -22,6 +22,8 @@ A C++ DLL (`FrameLedger.Overlay.dll`) is injected into games the user explicitly
> **Amended 2026-09-05.** A counted `none` (`presents = application frames`) is **withheld** — Presented FPS with a third qualifier, "this number counts application frames; the Displayed rate is unknown" — on the one shape measured to produce a false `none`: Streamline ≥ 2.8.0 with `sl.dlss_g.dll` loaded (Dying Light: The Beast, five captures, DLSS FG ×4 per the owner). `docs/03_METRICS.md` §Frame Generation carries the key and why it is the Streamline plugin rather than `nvngx_dlssg.dll`; `20_OPEN_QUESTIONS` §H5 carries the session that keeps or withdraws it.
>
> **Amended 2026-09-06 (Leg 0 landed): narrowed, not withdrawn.** `sl.dlss_g.dll` is a startup-time load on that title (frame generation off, census unchanged, twice), and the same morning's ×4 capture measured the discriminator the gate lacked: the 2.8.0 pacer's generated presents are DXGI presents on the hooked chain (§H5 row P1-DXGI), counted through `dxgiUnseen` into `Native 70.52 → Displayed 282.08 (×4 FG)`. So a counted `none` beside a READ `IDXGISwapChain::GetLastPresentCount` with zero unseen is `none`, printed with DXGI's agreement; it is withheld only when the counter was not read.
>
> **Amended 2026-09-17 (owner decision): the steady state.** A session whose frame-generation state changed (menus, loading, a settings change) has no session-wide factor — averaging ×1 menus with ×4 gameplay is the inflated-or-deflated single number this rule forbids — but it is no longer left with none: *Native → Displayed (×N FG)* is shown for the state the session spent most of its generating time in, **always with the share of the session it covers** (`62 → 118 FPS (×1.9 FG · 75%)`), never as a session average (`docs/03_METRICS.md` §The steady state).
7. **RT / PT / RR are tri-state** (`Yes` / `No` / `N/A`) with manual override. They are now *measured*, not guessed — but where measurement is genuinely impossible, the honest answer is still `N/A`. Never fabricate `Yes`.
> **Amended 2026-08-20 with the PR that wrote the hooks, per the owner ruling of 2026-08-14.** This rule named *"inline RayQuery without DXIL scan"* as one of the impossible cases, and that conflated two questions. **Whether rays are being traced is measurable** — `BuildRaytracingAccelerationStructure` is called by RayQuery titles and by `DispatchRays` titles alike, which is why both hooks exist and why the `No` branch requires the AS-build hook to have been *installed*. What needs a DXIL scan is **classifying the technique as RayQuery**, and that stays `N/A`. So the impossible cases are: naming the technique, and path-tracing classification, which has no API-level signature at all (`03_METRICS` §RT/PT/RR — a confidence score that may only ever *suggest*).
+31 -1
View File
@@ -27,7 +27,7 @@ Let `D` = session duration (first → last present), `F_app` = frames the *game*
| **Native FPS (avg)** | `count(F_app) / D` | 1 |
| **Displayed FPS (avg)** | `count(F_disp) / D` | 1 |
| **Presented FPS (avg)** | `presents / D` — **numerically Displayed FPS; the name for the one number that stands alone.** "Native" and "Displayed" are printed only *together* (rule 6); when frame generation is not measured, this is the headline, with a mandatory qualifier (§Frame Generation, rung 0's qualifier) | 1 |
| **FG factor** | `DisplayedFPS / NativeFPS`, shown `×N.N`; `—` when FG inactive; **`N/A` when FG is not measured** — and **`N/A` when FG was *identified* but the count refused** (`fg_mode` a technology, `fg_factor` NULL, `fg_refusal` the reason — schema 0003, 2026-09-14 — and `fg_refusal_detail` its numbers: the bucket that departed, its ratio and the window's — schema 0005, 2026-09-16): the one number is then Presented FPS with a warning chip naming the technology, exactly rung 0's third row, because the identity says generated frames may be in the presents and the count cannot say how many. Never `×0.0`, never "Native" | 1 |
| **FG factor** | `DisplayedFPS / NativeFPS`, shown `×N.N`; `—` when FG inactive; **`N/A` when FG is not measured** — and **`N/A` when FG was *identified* but the count refused** (`fg_mode` a technology, `fg_factor` NULL, `fg_refusal` the reason — schema 0003, 2026-09-14 — and `fg_refusal_detail` its numbers: the bucket that departed, its ratio and the window's — schema 0005, 2026-09-16): the one number is then Presented FPS with a warning chip naming the technology, exactly rung 0's third row, because the identity says generated frames may be in the presents and the count cannot say how many. Never `×0.0`, never "Native". **Since 2026-09-17 a session refused as `non_uniform` publishes its STEADY STATE instead** — `fg_factor_scope = steady`, the share beside it (§The steady state, below) | 1 |
| **Avg FPS** (headline) | = Native FPS when `fg_mode` is measured (`api` rung) or `none`; **= Presented FPS, labelled, when `fg_mode` is `N/A`**. Time-based, **not** the mean of instantaneous FPS values | 1 |
| **Median FPS** | `1000 / p50(ft_app)` | 1 |
| **1% Low** | `1000 / p99(ft_app)` | 1 |
@@ -369,6 +369,36 @@ F_app = Σ fgEvaluations (APPLICATION frames, counted at the
> its verdict on the line under the ratio so the number cannot be read without it. A guard keyed
> on a quantity that is zero on the route that runs is not a guard.
>
> ### The steady state — owner decision 2026-09-17
>
> **The refusal was right and its consequence was wrong.** A session that ran its menus at ×1 and its gameplay at
> ×4 averages to a number no configuration had (Black Myth: Wukong, 2026-09-16: 2.22 over a session whose gameplay
> read ×4.1 for two thirds of it), so the session-level factor is refused — and until this date the gameplay's own
> number was thrown away with the average. Every real play session opens with a splash, a menu or a loading screen,
> so on the owner's machine the shipped Agent published a factor on **one hooked session in nine** while the live
> card, which looks at five seconds at a time, showed it throughout; the owner read that as a broken data path. It
> was not: the nine sessions' stored per-frame counts read **2.00 / 3.00 / 4.00 to two decimals** inside gameplay.
>
> **The rule.** When — and only when — the session-level factor is refused as `NonUniform`, `FgSteadyState` cuts the
> claimed span into **five-second windows (the live card's own)**, classifies each by its own `presents ÷ tokens`,
> and takes the set of ACTIVE windows (≥ 1.5) agreeing within **10 %** that holds the most time. It is published when
> it covers **≥ 10 s and ≥ 10 % of the presenting time**: `fg_factor`, `native_fps` and `displayed_fps` are that
> state's own (counted over its windows, independently), `fg_factor_scope = 'steady'`, `fg_steady_share` the fraction,
> and `fg_refusal` / `fg_refusal_detail` stay set as the reason the number is not session-wide. ×3 and ×4 are 25 %
> apart and never pool; a factor that wanders forms no state and the refusal stands alone; any other refusal
> (unattributed, saturated, interleaved streams) gets no steady state — slicing does not make a record set
> trustworthy. **Never a session average, and never shown without its share.** Replayed over the nine sessions:
> eight publish (Onimusha ×4.00 60 → 240, Lies of P ×2.00, Hell Is Us ×3.03, Cronos ×2.00 225 → 451, Wukong ×4.11),
> the ninth had nine seconds of gameplay.
>
> **Two constants moved with it.** `BucketTolerance` is **10 %**, the steady state's own, down from 25 %: at 25 % a
> session that ran ×3 then ×4 published 3.69, and the owner's one published session read ×2.04 because its opening
> bucket (2.35) sat inside the tolerance while its gameplay read 2.00 — tightening was unaffordable while a refusal
> meant no number, and is free now. And **`MultipleStreams` refuses only when the chains' samples INTERLEAVE**:
> the hazard is a process-wide drain word with two chains presenting at once, and Onimusha recreates its swapchain
> on entering gameplay — chain 1 for the menus, chain 2 after, not one sample interleaved in three sessions — which
> is one stream at a time and was refused as two.
>
> **This also leaves §RT/PT/RR without a settled denominator.** `rt_frame_pct`,
> `rays_per_pixel` and the `≥ 5% of frames` gate are per-APPLICATION-frame quantities, and
> dividing them by presents dilutes each by the frame-generation factor — at ×4 a title that
+7
View File
@@ -431,6 +431,13 @@ Sequential embedded SQL (`Migrations/0001_init.sql`, `0002_*.sql`, …), applied
> beside `fg_refusal`, read by the UI's tooltip (`FpsPresentation.RefusalDetailText`), never an input to a number.
> Existing rows keep NULL. `LatestVersion` is 5; `LedgerDatabaseTests` asserts the column.
> **`0006_fg_steady_state.sql` (2026-09-17) — `sessions.fg_factor_scope` / `fg_steady_share`.** `fg_factor` was
> session-wide or NULL, and on real play it was almost always NULL (`03_METRICS` §The steady state). `session` = one
> state for the whole claimed span; `steady` = `fg_factor` / `native_fps` / `displayed_fps` describe the state the
> session spent most of its generating time in, `fg_steady_share` of the presenting time, with `fg_refusal` and its
> detail still set beside it. A reader that ignores the scope reads a steady factor as a session one, which is why
> every surface prints the share. Existing rows keep NULL. `LatestVersion` is 6.
> **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
View File
@@ -113,6 +113,7 @@ Reusable control `FpsReadout` (custom control styled with WPF UI theme brushes):
- FG **measured `none`** (a hook ran and saw no frame generation — no producer exists yet) → `144 FPS`, nothing else.
- FG **not measured** (`fg_mode = N/A`, every title today) → `144 FPS` as **Presented FPS**, with a mandatory qualifier chip from the runtime census: muted **"FG not observed"** when no frame-generation runtime was loaded in the process (tooltip: *"no frame-generation runtime was loaded; this number cannot include in-process generated frames — statically linked FSR3-FG and driver-level AFMF excepted"*), or a **⚠ warning chip "FG runtime loaded — may include generated frames"** naming the module when one was. Never the word "Native", never a factor, never `—`.
- FG detected → **`62 → 118 FPS (×1.9 FG)`** — Native first and visually primary (`FontTypography="Subtitle"`), Displayed second, factor as a small accent chip. Tooltip: "Native: frames rendered by the game · Displayed: frames shown on screen incl. generated frames".
- **A steady-state factor carries its share (2026-09-17).** When `fg_factor_scope = steady` the readout is the generated shape — `58 → 116 FPS` with the chip **`×2.0 FG · 75%`** — and the share is never omitted: the number describes the state the session spent most of its generating time in, not the session. Tooltip: why there is no session-wide factor (menus, loading, a settings change), what the number covers, and the refusal's own numbers. The "factor not counted" chip below remains for a session with no state long enough (`03_METRICS` §The steady state).
- **FG identified, count refused (2026-09-14 — a fourth shape, `FpsReadoutKind.IdentifiedUncounted`).** `fg_mode` names a technology and `fg_factor` is NULL: the owner's Black Myth: Wukong and Onimusha rows, where the tags named DLSS-G and the token count did not resolve. Until this date the readout fell into the "detected" shape and printed **`N/A → N/A FPS (×0.0 FG)`** — a factor nobody counted — while the game page said `DLSS-G ` and the grid said N/A. Now: **`304 FPS`** as Presented FPS with a **⚠ warning chip "DLSS-G active — factor not counted"**, tooltip = the row's `fg_refusal` in plain words ("no application-frame token was counted", "the frame-generation state changed mid-session", …) plus "read it as Displayed, not Native" — **and since 2026-09-16 the refusal's numbers from `fg_refusal_detail`** ("Bucket 3 of 8 measured 2.25 against 3.65 for the whole session, over 53 samples.", "2 swapchains presented during the session."), because the owner's four DLSS-G rows all read the same sentence and the sentence could not say why; the game page's measured row reads **`DLSS-G · factor not counted`**; Displayed and FG× say `N/A` (no factor exists, and it is not a measured none). Never the word "Native", never a factor. The `fg_runtime_loaded` chip also **names the module** now (`FG runtime loaded (sl.dlss_g.dll) — may include generated frames`) from `fg_runtime_census`, as this rule always asked. `FpsPresentation.FrameGenerationLabel` is the one place the page and the live card build the label.
- Tables get three columns (Native / Displayed / FG×); Displayed and FG× render `—` when `fg_mode = none` and **`N/A` when it is not measured** — the two are different negatives and the table must not collapse them. The Native column carries the Presented figure with its qualifier when FG is not measured.
- Charts: Native series default; "Displayed" toggle appears only when displayed data exists (FR-5.4).
@@ -34,7 +34,7 @@ public static class FpsPresentation
return FpsReadoutModel.Unavailable;
}
return Shape(row.FgMode, row.NativeFps, row.DisplayedFps, row.FgFactor, row.PresentedFps ?? row.NativeFps, ParseQualifier(row.PresentedQualifier), row.FgRefusal, row.FgRuntimeCensus, row.FgRefusalDetail);
return Shape(row.FgMode, row.NativeFps, row.DisplayedFps, row.FgFactor, row.PresentedFps ?? row.NativeFps, ParseQualifier(row.PresentedQualifier), row.FgRefusal, row.FgRuntimeCensus, row.FgRefusalDetail, IsSteady(row) ? row.FgSteadyShare : null);
}
/// <summary>The live card's shape from a 1 Hz progress event (<c>07_IPC</c>: the FG fields are set only when measured).</summary>
@@ -82,7 +82,7 @@ public static class FpsPresentation
FpsReadoutModel m = FromRow(row);
return m.Kind switch
{
FpsReadoutKind.Generated => Strings.Fps_Native_Tooltip,
FpsReadoutKind.Generated => m.QualifierTooltip ?? Strings.Fps_Native_Tooltip,
FpsReadoutKind.None => Strings.Fps_None_Tooltip,
FpsReadoutKind.Presented or FpsReadoutKind.IdentifiedUncounted => m.QualifierTooltip,
_ => Strings.Tier_NA_Tooltip,
@@ -109,7 +109,24 @@ public static class FpsPresentation
public static string PresentedLine(double? presented) => string.Format(CultureInfo.CurrentCulture, Strings.Fps_Presented_Format, Formats.Fps(presented));
public static string FactorChip(double factor) => string.Format(CultureInfo.CurrentCulture, Strings.Fps_Fg_Chip_Format, factor);
public static string FactorChip(double factor) => FactorChip(factor, steadyShare: null);
/// <summary>The factor chip; a steady-state factor always carries the share of the session it describes: <c>×2.0 FG · 75%</c>.</summary>
public static string FactorChip(double factor, double? steadyShare) => steadyShare is double share
? string.Format(CultureInfo.CurrentCulture, Strings.Fps_Fg_Chip_Steady_Format, factor, share * 100)
: string.Format(CultureInfo.CurrentCulture, Strings.Fps_Fg_Chip_Format, factor);
/// <summary>
/// The tooltip of a steady-state readout: why there is no session-wide factor, what the number is and over how much
/// of the session, and the refusal's own numbers when the row stored them.
/// </summary>
public static string SteadyTooltip(double factor, double share, string? refusalDetail)
{
string text = string.Format(CultureInfo.CurrentCulture, Strings.Fps_Fg_Steady_Tooltip_Format, factor, share * 100);
return RefusalDetailText(FgRefusalDetail.Parse(refusalDetail)) is { } numbers ? text + " " + numbers : text;
}
private static bool IsSteady(SessionRow row) => string.Equals(row.FgFactorScope, "steady", StringComparison.Ordinal);
/// <summary>The census chip; a loaded frame-generation runtime is named when the census says which (<c>08_UI</c> §FPS display rule).</summary>
public static string QualifierText(FpsQualifier qualifier, long? runtimeCensus = null) => qualifier switch
@@ -245,7 +262,7 @@ public static class FpsPresentation
_ => FpsQualifier.CensusNotRun,
};
private static FpsReadoutModel Shape(string? fgMode, double? native, double? displayed, double? factor, double? presented, FpsQualifier qualifier, string? refusal, long? runtimeCensus, string? refusalDetail = null)
private static FpsReadoutModel Shape(string? fgMode, double? native, double? displayed, double? factor, double? presented, FpsQualifier qualifier, string? refusal, long? runtimeCensus, string? refusalDetail = null, double? steadyShare = null)
{
// fg_mode: 'na' = not measured; 'none' = measured none; a technology with a factor = counted generation;
// a technology WITHOUT a factor = identified, and the count refused (fg_refusal says why).
@@ -273,6 +290,6 @@ public static class FpsPresentation
};
}
return new FpsReadoutModel { Kind = FpsReadoutKind.Generated, Native = native, Displayed = displayed, Factor = factor };
return new FpsReadoutModel { Kind = FpsReadoutKind.Generated, Native = native, Displayed = displayed, Factor = factor, SteadyShare = steadyShare, Refusal = refusal, RefusalDetail = refusalDetail };
}
}
@@ -24,6 +24,13 @@ public sealed record FpsReadoutModel
/// <summary>The row's <c>fg_refusal</c> token when the count refused; the chip's tooltip names it.</summary>
public string? Refusal { get; init; }
/// <summary>
/// Set when the factor is the session's STEADY STATE rather than a session-wide one (<c>fg_factor_scope = steady</c>,
/// schema 0006): the fraction of the presenting time it covers. The chip prints it, always — a steady factor is
/// never shown without saying which part of the session it describes (<c>08_UI</c> §FPS display rule).
/// </summary>
public double? SteadyShare { get; init; }
/// <summary>The row's <c>fg_refusal_detail</c> JSON (schema 0005) when stored; the tooltip's numbers. Null on the live card.</summary>
public string? RefusalDetail { get; init; }
@@ -60,11 +67,12 @@ public sealed record FpsReadoutModel
{
FpsReadoutKind.Presented when Qualifier is FpsQualifier q => FpsPresentation.QualifierTooltip(q),
FpsReadoutKind.IdentifiedUncounted => FpsPresentation.IdentifiedTooltip(Technology, Refusal, RefusalDetail),
FpsReadoutKind.Generated when Factor is double f && SteadyShare is double share => FpsPresentation.SteadyTooltip(f, share, RefusalDetail),
_ => null,
};
/// <summary>True when the stand-alone number may include generated frames and the chip must warn.</summary>
public bool QualifierIsWarning => Kind == FpsReadoutKind.IdentifiedUncounted || Qualifier is FpsQualifier.RuntimeLoaded or FpsQualifier.Withheld;
public string? FactorChip => Kind == FpsReadoutKind.Generated && Factor is double f ? FpsPresentation.FactorChip(f) : null;
public string? FactorChip => Kind == FpsReadoutKind.Generated && Factor is double f ? FpsPresentation.FactorChip(f, SteadyShare) : null;
}
+6
View File
@@ -230,9 +230,11 @@ public static class Strings
nameof(Fps_Census_Withheld),
nameof(Fps_Census_Withheld_Tooltip),
nameof(Fps_Fg_Chip_Format),
nameof(Fps_Fg_Chip_Steady_Format),
nameof(Fps_Fg_Format),
nameof(Fps_Fg_Identified_Format),
nameof(Fps_Fg_Identified_Tooltip_Format),
nameof(Fps_Fg_Steady_Tooltip_Format),
nameof(Fps_Native_Tooltip),
nameof(Fps_None_Tooltip),
nameof(Fps_Presented_Format),
@@ -1000,12 +1002,16 @@ public static class Strings
public static string Fps_Fg_Chip_Format => ResourceManager.GetString(nameof(Fps_Fg_Chip_Format), Culture) ?? nameof(Fps_Fg_Chip_Format);
public static string Fps_Fg_Chip_Steady_Format => ResourceManager.GetString(nameof(Fps_Fg_Chip_Steady_Format), Culture) ?? nameof(Fps_Fg_Chip_Steady_Format);
public static string Fps_Fg_Format => ResourceManager.GetString(nameof(Fps_Fg_Format), Culture) ?? nameof(Fps_Fg_Format);
public static string Fps_Fg_Identified_Format => ResourceManager.GetString(nameof(Fps_Fg_Identified_Format), Culture) ?? nameof(Fps_Fg_Identified_Format);
public static string Fps_Fg_Identified_Tooltip_Format => ResourceManager.GetString(nameof(Fps_Fg_Identified_Tooltip_Format), Culture) ?? nameof(Fps_Fg_Identified_Tooltip_Format);
public static string Fps_Fg_Steady_Tooltip_Format => ResourceManager.GetString(nameof(Fps_Fg_Steady_Tooltip_Format), Culture) ?? nameof(Fps_Fg_Steady_Tooltip_Format);
public static string Fps_Native_Tooltip => ResourceManager.GetString(nameof(Fps_Native_Tooltip), Culture) ?? nameof(Fps_Native_Tooltip);
public static string Fps_None_Tooltip => ResourceManager.GetString(nameof(Fps_None_Tooltip), Culture) ?? nameof(Fps_None_Tooltip);
+8
View File
@@ -709,6 +709,14 @@
<value>×{0:0.0} FG</value>
<comment>review</comment>
</data>
<data name="Fps_Fg_Chip_Steady_Format" xml:space="preserve">
<value>×{0:0.0} FG · {1:0}%</value>
<comment>review</comment>
</data>
<data name="Fps_Fg_Steady_Tooltip_Format" xml:space="preserve">
<value>セッション全体でフレーム生成が一つの状態ではなかったため(メニュー、ロード画面、設定変更)、セッション全体の倍率は公開されません。×{0:0.0} は定常状態で、ゲームが present していた時間の {1:0}% で測定されました。Native と Displayed はその状態自体のレートです。</value>
<comment>review</comment>
</data>
<data name="Fps_Fg_Format" xml:space="preserve">
<value>{0} → {1} FPS (×{2:0.0} FG)</value>
<comment>review</comment>
+6
View File
@@ -537,6 +537,12 @@
<data name="Fps_Fg_Chip_Format" xml:space="preserve">
<value>×{0:0.0} FG</value>
</data>
<data name="Fps_Fg_Chip_Steady_Format" xml:space="preserve">
<value>×{0:0.0} FG · {1:0}%</value>
</data>
<data name="Fps_Fg_Steady_Tooltip_Format" xml:space="preserve">
<value>Frame generation was not in one state for the whole session (menus, loading screens or a settings change), so no session-wide factor is published. ×{0:0.0} is the steady state, measured over {1:0}% of the time the game was presenting; Native and Displayed are that state's own rates.</value>
</data>
<data name="Fps_Fg_Format" xml:space="preserve">
<value>{0} → {1} FPS (×{2:0.0} FG)</value>
</data>
+6
View File
@@ -532,6 +532,12 @@
<data name="Fps_Fg_Chip_Format" xml:space="preserve">
<value>×{0:0.0} FG</value>
</data>
<data name="Fps_Fg_Chip_Steady_Format" xml:space="preserve">
<value>×{0:0.0} FG · {1:0}%</value>
</data>
<data name="Fps_Fg_Steady_Tooltip_Format" xml:space="preserve">
<value>Frame generation không ở một trạng thái trong suốt phiên (menu, màn hình tải hoặc đổi thiết lập), nên không công bố hệ số cho cả phiên. ×{0:0.0} là trạng thái ổn định, đo trên {1:0}% thời gian game present; Native và Displayed là tốc độ của riêng trạng thái đó.</value>
</data>
<data name="Fps_Fg_Format" xml:space="preserve">
<value>{0} → {1} FPS (×{2:0.0} FG)</value>
</data>
@@ -120,6 +120,17 @@ public sealed record SessionRow
/// </summary>
public string? FgRefusalDetail { get; init; }
/// <summary>
/// Which part of the session <see cref="FgFactor"/>, <see cref="NativeFps"/> and <see cref="DisplayedFps"/> describe
/// (schema 0006): <c>session</c> — one frame-generation state for the whole claimed span; <c>steady</c> — the state
/// the session spent most of its generating time in, published because the session as a whole was refused as
/// non-uniform (<c>Domain.Metrics.FgSteadyState</c>); null when no factor is published.
/// </summary>
public string? FgFactorScope { get; init; }
/// <summary>The fraction (0..1) of the presenting time the steady state covers; null unless <see cref="FgFactorScope"/> is <c>steady</c>.</summary>
public double? FgSteadyShare { get; init; }
public double? PresentedFps { get; init; }
public string? PresentedQualifier { get; init; }
@@ -196,6 +196,7 @@ public static class FgLadder
return FgVerdict.Named;
}
return fg?.IsActive == true ? FgVerdict.ActiveUnidentified : FgVerdict.NotMeasured;
// A steady state (2026-09-17) is an ACTIVE state by construction: counted generation, identity unknown.
return fg?.IsActive == true || fg?.Steady is not null ? FgVerdict.ActiveUnidentified : FgVerdict.NotMeasured;
}
}
@@ -80,15 +80,21 @@ public static class SessionAggregator
{
FgWindow? fg = c.Fg;
bool usable = fg is { Refusal: null } && c.Verdict is FgVerdict.Named or FgVerdict.ActiveUnidentified or FgVerdict.None or FgVerdict.NoneInputsTagged;
// 03_METRICS §Frame Generation (2026-09-17): a session refused as non-uniform still publishes the state it
// spent most of its generating time in, scoped and with its share -- never the session average.
FgSteadyState? steady = !usable && c.Verdict is FgVerdict.Named or FgVerdict.ActiveUnidentified ? fg?.Steady : null;
return row with
{
FgMode = Vocabulary.FgMode(c.Verdict, c.FgIdentity),
FgSource = Vocabulary.FgSource(c.Verdict),
FgFactor = usable ? fg!.Factor : null,
NativeFps = usable ? fg!.NativeFps : null,
DisplayedFps = usable ? fg!.DisplayedFps : null,
FgFactor = usable ? fg!.Factor : steady?.Factor,
NativeFps = usable ? fg!.NativeFps : steady?.NativeFps,
DisplayedFps = usable ? fg!.DisplayedFps : steady?.DisplayedFps,
FgFactorScope = usable && fg!.Factor is not null ? "session" : steady is not null ? "steady" : null,
FgSteadyShare = steady?.Share,
DisplayedP1LowFps = usable && c.Verdict is FgVerdict.Named or FgVerdict.ActiveUnidentified ? c.Stats.P1LowFps : null,
DisplayedCountedBy = usable ? (fg!.DxgiCounted ? "dxgi" : "hook") : null,
DisplayedCountedBy = usable || steady is not null ? (fg!.DxgiCounted ? "dxgi" : "hook") : null,
FgNoneWithheldReason = c.Withheld,
FgRefusal = usable ? null : fg?.Refusal is { } refusal ? Vocabulary.FgRefusal(refusal.Kind) : null,
FgRefusalDetail = usable ? null : fg?.Refusal is { } detail ? FgRefusalDetail.ToJson(detail) : null,
@@ -0,0 +1,158 @@
using System.Runtime.InteropServices;
namespace FrameLedger.Domain.Metrics;
/// <summary>
/// The frame-generation state a session spent most of its generating time in, when the session as a whole had more
/// than one (<c>03_METRICS</c> §Frame Generation, owner decision 2026-09-17).
/// </summary>
/// <remarks>
/// <para>
/// <b>Why it exists.</b> <see cref="FgWindow"/> refuses a session-level factor when any of its eight buckets departs
/// from the whole — correctly: a session that ran its menus at ×1 and its gameplay at ×4 averages to a number no
/// configuration ever had (Black Myth: Wukong, 2026-09-16: 2.22 over a session whose gameplay read ×4.1 for 60 % of
/// it). But the refusal threw the gameplay's own number away with the average, and on real play every session opens
/// with a splash, a menu or a loading screen — so the shipped Agent published a factor on one hooked session in nine
/// while the live card, which looks at five seconds at a time, showed it throughout. Measured on those nine sessions'
/// stored per-frame counts: inside gameplay the five-second factor read 2.00, 3.00, 4.00 to two decimals.
/// </para>
/// <para>
/// <b>What it is.</b> The claimed span cut into <see cref="WindowSeconds"/>-second windows — the live card's own window —
/// each classified by its own <c>presents ÷ tokens</c>; the ACTIVE windows (≥ <see cref="FgWindow.ActiveThreshold"/>)
/// that agree with one another within <see cref="StateTolerance"/> form a state, and the state holding the most time
/// is this record, with the share of the presenting time it covers. ×3 and ×4 are 25 % apart and never pool; a
/// factor that wanders (a dynamic multiplier) forms no state long enough and the refusal stands alone.
/// </para>
/// <para>
/// <b>What it is not.</b> Not a session average, never blended with the windows outside it, and never published
/// without its <see cref="Share"/> beside it — the reader is told which part of the session the number describes.
/// <see cref="NativeFps"/> and <see cref="DisplayedFps"/> are counted over the state's own windows, independently,
/// as <see cref="FgWindow"/> counts its own.
/// </para>
/// </remarks>
/// <param name="Factor">Pooled <c>Σ displayed ÷ Σ tokens</c> over the state's windows.</param>
/// <param name="NativeFps"><c>Σ tokens ÷ seconds</c> over those windows.</param>
/// <param name="DisplayedFps"><c>Σ displayed ÷ seconds</c> over those windows.</param>
/// <param name="Seconds">Time the state's windows cover.</param>
/// <param name="Share">That time as a fraction of the time the title was presenting (every non-empty window).</param>
/// <param name="Windows">How many windows formed the state.</param>
public sealed record FgSteadyState(double Factor, double NativeFps, double DisplayedFps, double Seconds, double Share, int Windows)
{
/// <summary>The live card's window (<c>SessionProgressCalculator.WindowSeconds</c>): what the user watched is what is cut.</summary>
public const double WindowSeconds = 5;
/// <summary>How far a window's factor may sit from the state's before it belongs to another state. ×3 vs ×4 is 25 %.</summary>
public const double StateTolerance = 0.10;
/// <summary>A state shorter than this is a transition, not a configuration.</summary>
public const double MinSeconds = 10;
/// <summary>A state covering less of the presenting time than this does not speak for the session.</summary>
public const double MinShare = 0.10;
[StructLayout(LayoutKind.Auto)]
private readonly record struct Slice(long Displayed, long Tokens, int Samples, double Seconds)
{
/// <summary>Read only on active slices, which have tokens.</summary>
public double Factor => Displayed / (double)Tokens;
public bool IsActive => Samples >= FgWindow.MinPerBucket && Tokens > 0 && Displayed >= Tokens * FgWindow.ActiveThreshold;
}
/// <summary>The dominant active state over <paramref name="all"/> from <paramref name="start"/>, or null when none qualifies.</summary>
public static FgSteadyState? From(IReadOnlyList<FrameSample> all, int start, long qpcFrequency)
{
ArgumentNullException.ThrowIfNull(all);
ArgumentOutOfRangeException.ThrowIfNegative(start);
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(start, all.Count);
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(qpcFrequency);
List<Slice> slices = Cut(all, start, qpcFrequency);
List<Slice> active = [.. slices.Where(static s => s.IsActive)];
if (active.Count == 0)
{
return null;
}
// The state is the set of mutually agreeing windows holding the most time. Every active window is tried as
// the centre; the winner is pooled and the set re-drawn once around the pooled factor, so the centre's own
// noise does not decide membership.
double centre = active[0].Factor;
double best = -1;
foreach (Slice candidate in active)
{
double seconds = Within(active, candidate.Factor).Sum(static s => s.Seconds);
if (seconds > best)
{
best = seconds;
centre = candidate.Factor;
}
}
// Never empty: the pooled factor is a weighted mean of members within 10 % of the centre, and a mean always has a
// member within 10 % of itself (a member below it and one above it cannot both be further than that).
List<Slice> state = [.. Within(active, Pooled([.. Within(active, centre)]))];
long displayed = state.Sum(static s => s.Displayed);
long tokens = state.Sum(static s => s.Tokens);
double stateSeconds = state.Sum(static s => s.Seconds);
double share = stateSeconds / slices.Sum(static s => s.Seconds);
return stateSeconds < MinSeconds || share < MinShare
? null
: new FgSteadyState(displayed / (double)tokens, tokens / stateSeconds, displayed / stateSeconds, stateSeconds, share, state.Count);
}
private static IEnumerable<Slice> Within(List<Slice> active, double factor) =>
active.Where(s => Math.Abs(s.Factor - factor) <= factor * StateTolerance);
private static double Pooled(List<Slice> slices) =>
slices.Sum(static s => s.Displayed) / (double)Math.Max(1, slices.Sum(static s => s.Tokens));
/// <summary>
/// Fixed wall-clock windows from the first claimed sample. A window's seconds are its nominal length, except the
/// last, which ends at the last sample; a window with no sample in it (the title minimised) is not a window.
/// </summary>
private static List<Slice> Cut(IReadOnlyList<FrameSample> all, int start, long qpcFrequency)
{
ulong origin = all[start].Qpc;
ulong last = all[^1].Qpc;
double ticksPerWindow = WindowSeconds * qpcFrequency;
var slices = new List<Slice>();
long index = -1;
long displayed = 0;
long tokens = 0;
int samples = 0;
void Close()
{
if (samples == 0)
{
return;
}
// A window's length is nominal, except the last, which ends at the last sample (and may be zero long).
double windowStart = origin + (index * ticksPerWindow);
slices.Add(new Slice(displayed, tokens, samples, Math.Clamp((last - windowStart) / qpcFrequency, 0, WindowSeconds)));
}
for (int i = start; i < all.Count; i++)
{
FrameSample s = all[i];
long at = (long)(Math.Max(0d, (double)s.Qpc - origin) / ticksPerWindow);
if (at != index)
{
Close();
index = at;
displayed = 0;
tokens = 0;
samples = 0;
}
displayed += 1 + (s.Claims(MeasuredFields.DxgiPresents) ? s.DxgiUnseen : 0);
tokens += s.FgEvaluations;
samples++;
}
Close();
return slices;
}
}
+60 -3
View File
@@ -45,6 +45,16 @@ public sealed record FgWindow
/// <summary>Distinct identified swapchains presenting inside the span.</summary>
public required int Streams { get; init; }
/// <summary>
/// True when those swapchains presented CONCURRENTLY — their samples interleave — rather than one after another.
/// Only the concurrent case is the hazard <see cref="FgRefusalKind.MultipleStreams"/> names: the drain word is
/// process-wide, so with two chains presenting at once one's present can drain the other's evaluation. A title
/// that RECREATES its swapchain — Onimusha: Way of the Sword, 2026-09-16: chain 1 for the menus, chain 2 from
/// the first gameplay frame, not one sample interleaved across three sessions — has one stream at a time, and
/// refusing it for having had two was a misdiagnosis that cost every session of that title its factor.
/// </summary>
public required bool StreamsInterleaved { get; init; }
/// <summary>Samples whose count hit the byte's ceiling.</summary>
public required int Saturated { get; init; }
@@ -89,6 +99,14 @@ public sealed record FgWindow
/// <summary>Why no factor may be published, or null when one may.</summary>
public required FgRefusal? Refusal { get; init; }
/// <summary>
/// When the session-level factor is refused as <see cref="FgRefusalKind.NonUniform"/>: the frame-generation state
/// the session spent most of its generating time in, with its share — or null when no state qualifies. Never
/// set beside a published <see cref="Factor"/>, and never for any other refusal: an unattributed or saturated
/// record set is not made trustworthy by slicing it.
/// </summary>
public FgSteadyState? Steady { get; init; }
/// <summary><c>presents / Σ evaluations</c>, or null.</summary>
public double? Factor =>
Refusal is null && Evaluations > 0 ? DisplayedPresents / (double)Evaluations : null;
@@ -131,7 +149,15 @@ public sealed record FgWindow
public const int MinSamplesToCheck = Buckets * MinPerBucket;
/// <summary>How far a bucket's factor may sit from the window's before this refuses.</summary>
public const double BucketTolerance = 0.25;
/// <remarks>
/// 0.25 until 2026-09-17, and that let two things through: a session that ran x3 and then x4 published 3.69 —
/// a multiplier no title offers, since the two are exactly 25 % apart — and the owner's one published session
/// (Lies of P, 2026-09-16) read x2.04 because a bucket at 2.35, its opening, sat inside the tolerance, while its
/// gameplay read 2.00 in every five-second window. It could not be tightened while a refusal meant no number at
/// all; with <see cref="FgSteadyState"/> behind it a refusal now costs the average and keeps the measurement, so
/// the tolerance is the one the steady state uses for the same question.
/// </remarks>
public const double BucketTolerance = FgSteadyState.StateTolerance;
/// <summary>
/// At or above this, frame generation is ACTIVE: <c>03_METRICS</c>' cadence threshold, and the value below
@@ -163,7 +189,9 @@ public sealed record FgWindow
}
FgWindow tallied = Tally(all, start, qpcFrequency);
return tallied with { Refusal = RefusalFor(tallied) };
FgRefusal? refusal = RefusalFor(tallied);
bool mixedStates = refusal is { Kind: FgRefusalKind.NonUniform, Subject: FgRefusalSubject.Factor };
return tallied with { Refusal = refusal, Steady = mixedStates ? FgSteadyState.From(all, start, qpcFrequency) : null };
}
private static FgWindow Nothing(FgRefusal refusal) => new()
@@ -174,6 +202,7 @@ public sealed record FgWindow
Seconds = 0,
Unidentified = 0,
Streams = 0,
StreamsInterleaved = false,
Saturated = 0,
DxgiUnseen = 0,
DxgiClaiming = 0,
@@ -232,6 +261,7 @@ public sealed record FgWindow
Seconds = RecordWindow.SecondsOf(all, start, qpcFrequency),
Unidentified = unidentified,
Streams = streams.Count,
StreamsInterleaved = Interleaved(all, start, streams.Count),
Saturated = saturated,
DxgiUnseen = dxgiUnseen,
DxgiClaiming = dxgiClaiming,
@@ -243,6 +273,33 @@ public sealed record FgWindow
};
}
/// <summary>
/// Did the identified chains present at once? N chains one after another change hands N−1 times; any more and
/// two of them were presenting concurrently. Its own pass, as the DXGI tally is: it is its own question.
/// </summary>
private static bool Interleaved(IReadOnlyList<FrameSample> all, int start, int streams)
{
uint previous = 0;
int changes = 0;
for (int i = start; i < all.Count; i++)
{
uint id = all[i].SwapchainId;
if (id == 0)
{
continue;
}
if (previous != 0 && id != previous)
{
changes++;
}
previous = id;
}
return changes > Math.Max(0, streams - 1);
}
/// <summary>
/// Σ <c>dxgiUnseen</c>, the samples claiming it, and the ones at the 255 sentinel — the DXGI half of the
/// tally, in its own pass because it is its own measurement.
@@ -342,7 +399,7 @@ public sealed record FgWindow
return new FgRefusal(FgRefusalKind.Unattributed, subject, Count: w.Unidentified);
}
if (w.Streams > 1)
if (w.Streams > 1 && w.StreamsInterleaved)
{
return new FgRefusal(FgRefusalKind.MultipleStreams, subject, Count: w.Streams);
}
@@ -0,0 +1,27 @@
-- 0006 (2026-09-17): which part of the session fg_factor describes.
--
-- Until this date fg_factor was session-wide or NULL. On real play it was almost always NULL: every session opens
-- with a splash, a menu or a loading screen, FgWindow (rightly) refuses to average x1 menus with x4 gameplay, and
-- the refusal took the gameplay's own number with it -- one hooked session in nine published a factor on the
-- owner's machine (2026-09-16) while the live card, five seconds at a time, showed it throughout. The per-frame
-- counts in frame_blobs read 2.00 / 3.00 / 4.00 inside gameplay on every one of them.
--
-- Owner decision 2026-09-17 (03_METRICS §Frame Generation): when the session-level factor is refused as
-- non_uniform, publish the STEADY STATE -- the frame-generation state the session spent most of its generating
-- time in (Domain.Metrics.FgSteadyState: five-second windows, the live card's own; windows agreeing within 10 %;
-- at least 10 s and 10 % of the presenting time) -- and say so:
--
-- fg_factor_scope 'session' = one state for the whole claimed span (the only meaning fg_factor had before);
-- 'steady' = fg_factor / native_fps / displayed_fps describe the steady state only;
-- NULL = no factor published, or the writer predates the column.
-- fg_steady_share the fraction of the presenting time the steady state covers (0..1); NULL unless 'steady'.
--
-- fg_refusal and fg_refusal_detail stay set beside a 'steady' factor: they are why the number is not session-wide.
-- A reader that ignores these columns reads a steady factor as a session one, which is why every surface that
-- prints it prints the share beside it (08_UI §FPS display rule). Existing rows keep NULL: they are not
-- re-aggregated, though their frame_blobs would allow it.
--
-- ALTER TABLE ADD COLUMN only: earlier scripts are applied on real machines and are never edited (§Migrations).
ALTER TABLE sessions ADD COLUMN fg_factor_scope TEXT;
ALTER TABLE sessions ADD COLUMN fg_steady_share REAL;
@@ -13,10 +13,10 @@ namespace FrameLedger.Infrastructure.Persistence;
internal static class SessionRowColumns
{
public const string Insert =
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct) "
+ "VALUES (@session_guid, @game_id, @snapshot_id, @started_at, @ended_at, @duration_s, @qpc_epoch, @qpc_frequency, @capture_tier, @capture_mode, @capture_notes, @late_attach, @telemetry_source, @overlay_build_id, @exit_status, @drain_ticks, @foreground_ticks, @records_before_attach, @dxgi_presents_before_hook, @gap_count, @guard_ticks_published, @launch_wait_ms, @api, @present_mode, @swap_effect, @hdr_flag, @hdr_source, @sync_interval_mode, @upscaler, @upscaler_quality, @upscaler_sharpness, @upscaler_driver_reported, @render_w, @render_h, @output_w, @output_h, @upscale_ratio, @settings_changed_midsession, @fg_mode, @fg_source, @fg_factor, @fg_driver_reported, @fg_runtime_census, @fg_none_withheld_reason, @fg_refusal, @fg_refusal_detail, @presented_fps, @presented_qualifier, @dxgi_unseen_total, @dxgi_present_samples, @displayed_counted_by, @sl_tag_census, @sl_interposer_version, @runtime_modules, @executable_markers, @ngx_driver_words, @rt_flag, @rt_source, @pt_flag, @pt_source, @pt_confidence, @rr_flag, @rr_source, @rt_frame_pct, @rays_per_pixel, @rt_pso_count, @rt_tier, @hooks_installed_mask, @raster_pso_count, @frame_count, @app_frame_count, @displayed_frame_count, @dropped_frames, @native_fps, @displayed_fps, @median_fps, @p1_low_fps, @p01_low_fps, @displayed_p1_low_fps, @min_fps, @max_fps, @frametime_stddev_ms, @stutter_count, @stutter_time_pct, @pso_stutter_pct, @reflex_active, @latency_avg_us, @latency_p95_us, @dropped_records, @fault_count, @data_quality_warnings, @writer_status_at_end, @early_stop_family, @loader_signals, @vram_proc_avg_mb, @vram_proc_max_mb, @vram_budget_exceeded_pct, @vram_adapter_max_mb, @avg_cpu_temp, @max_cpu_temp, @avg_gpu_temp, @max_gpu_temp, @max_gpu_hotspot, @avg_gpu_load, @avg_cpu_load, @avg_ram_mb, @avg_gpu_power_w, @throttle_pct) RETURNING id";
"INSERT INTO sessions (session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct) "
+ "VALUES (@session_guid, @game_id, @snapshot_id, @started_at, @ended_at, @duration_s, @qpc_epoch, @qpc_frequency, @capture_tier, @capture_mode, @capture_notes, @late_attach, @telemetry_source, @overlay_build_id, @exit_status, @drain_ticks, @foreground_ticks, @records_before_attach, @dxgi_presents_before_hook, @gap_count, @guard_ticks_published, @launch_wait_ms, @api, @present_mode, @swap_effect, @hdr_flag, @hdr_source, @sync_interval_mode, @upscaler, @upscaler_quality, @upscaler_sharpness, @upscaler_driver_reported, @render_w, @render_h, @output_w, @output_h, @upscale_ratio, @settings_changed_midsession, @fg_mode, @fg_source, @fg_factor, @fg_driver_reported, @fg_runtime_census, @fg_none_withheld_reason, @fg_refusal, @fg_refusal_detail, @fg_factor_scope, @fg_steady_share, @presented_fps, @presented_qualifier, @dxgi_unseen_total, @dxgi_present_samples, @displayed_counted_by, @sl_tag_census, @sl_interposer_version, @runtime_modules, @executable_markers, @ngx_driver_words, @rt_flag, @rt_source, @pt_flag, @pt_source, @pt_confidence, @rr_flag, @rr_source, @rt_frame_pct, @rays_per_pixel, @rt_pso_count, @rt_tier, @hooks_installed_mask, @raster_pso_count, @frame_count, @app_frame_count, @displayed_frame_count, @dropped_frames, @native_fps, @displayed_fps, @median_fps, @p1_low_fps, @p01_low_fps, @displayed_p1_low_fps, @min_fps, @max_fps, @frametime_stddev_ms, @stutter_count, @stutter_time_pct, @pso_stutter_pct, @reflex_active, @latency_avg_us, @latency_p95_us, @dropped_records, @fault_count, @data_quality_warnings, @writer_status_at_end, @early_stop_family, @loader_signals, @vram_proc_avg_mb, @vram_proc_max_mb, @vram_budget_exceeded_pct, @vram_adapter_max_mb, @avg_cpu_temp, @max_cpu_temp, @avg_gpu_temp, @max_gpu_temp, @max_gpu_hotspot, @avg_gpu_load, @avg_cpu_load, @avg_ram_mb, @avg_gpu_power_w, @throttle_pct) RETURNING id";
public const string Select = "SELECT id, session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct FROM sessions";
public const string Select = "SELECT id, session_guid, game_id, snapshot_id, started_at, ended_at, duration_s, qpc_epoch, qpc_frequency, capture_tier, capture_mode, capture_notes, late_attach, telemetry_source, overlay_build_id, exit_status, drain_ticks, foreground_ticks, records_before_attach, dxgi_presents_before_hook, gap_count, guard_ticks_published, launch_wait_ms, api, present_mode, swap_effect, hdr_flag, hdr_source, sync_interval_mode, upscaler, upscaler_quality, upscaler_sharpness, upscaler_driver_reported, render_w, render_h, output_w, output_h, upscale_ratio, settings_changed_midsession, fg_mode, fg_source, fg_factor, fg_driver_reported, fg_runtime_census, fg_none_withheld_reason, fg_refusal, fg_refusal_detail, fg_factor_scope, fg_steady_share, presented_fps, presented_qualifier, dxgi_unseen_total, dxgi_present_samples, displayed_counted_by, sl_tag_census, sl_interposer_version, runtime_modules, executable_markers, ngx_driver_words, rt_flag, rt_source, pt_flag, pt_source, pt_confidence, rr_flag, rr_source, rt_frame_pct, rays_per_pixel, rt_pso_count, rt_tier, hooks_installed_mask, raster_pso_count, frame_count, app_frame_count, displayed_frame_count, dropped_frames, native_fps, displayed_fps, median_fps, p1_low_fps, p01_low_fps, displayed_p1_low_fps, min_fps, max_fps, frametime_stddev_ms, stutter_count, stutter_time_pct, pso_stutter_pct, reflex_active, latency_avg_us, latency_p95_us, dropped_records, fault_count, data_quality_warnings, writer_status_at_end, early_stop_family, loader_signals, vram_proc_avg_mb, vram_proc_max_mb, vram_budget_exceeded_pct, vram_adapter_max_mb, avg_cpu_temp, max_cpu_temp, avg_gpu_temp, max_gpu_temp, max_gpu_hotspot, avg_gpu_load, avg_cpu_load, avg_ram_mb, avg_gpu_power_w, throttle_pct FROM sessions";
public static Dictionary<string, object?> Parameters(SessionRow s)
{
@@ -83,6 +83,8 @@ internal static class SessionRowColumns
d["fg_none_withheld_reason"] = s.FgNoneWithheldReason;
d["fg_refusal"] = s.FgRefusal;
d["fg_refusal_detail"] = s.FgRefusalDetail;
d["fg_factor_scope"] = s.FgFactorScope;
d["fg_steady_share"] = s.FgSteadyShare;
d["presented_fps"] = s.PresentedFps;
d["presented_qualifier"] = s.PresentedQualifier;
d["dxgi_unseen_total"] = s.DxgiUnseenTotal;
@@ -208,6 +210,8 @@ internal static class SessionRowColumns
FgNoneWithheldReason = S(r, "fg_none_withheld_reason"),
FgRefusal = S(r, "fg_refusal"),
FgRefusalDetail = S(r, "fg_refusal_detail"),
FgFactorScope = S(r, "fg_factor_scope"),
FgSteadyShare = D(r, "fg_steady_share"),
PresentedFps = D(r, "presented_fps"),
PresentedQualifier = S(r, "presented_qualifier"),
DxgiUnseenTotal = L(r, "dxgi_unseen_total"),
@@ -207,6 +207,34 @@ public sealed class FpsPresentationTests
InEnglish(() => FpsPresentation.IdentifiedTooltip("DLSS-G", "non_uniform", "not json")).Should().Be(InEnglish(() => FpsPresentation.IdentifiedTooltip("DLSS-G", "non_uniform")), "an unparsable detail is the old tooltip, never an exception");
}
/// <summary>
/// 2026-09-17: a steady-state factor (<c>fg_factor_scope = steady</c>) is the generated shape — Native, Displayed and
/// the factor together, as rule 6 asks — and its chip ALWAYS says how much of the session it describes; the tooltip
/// says why there is no session-wide number. A session-wide factor keeps the plain chip.
/// </summary>
[Fact]
public void ASteadyStateFactorIsTheGeneratedShapeWithItsShareOnTheChip()
{
string detail = "{\"Kind\":\"non_uniform\",\"Subject\":\"factor\",\"Count\":8000,\"BucketIndex\":0,\"BucketCount\":8,\"BucketValue\":1.0,\"Overall\":1.6}";
SessionRow row = Hooked("dlssg", native: 58.2, displayed: 116.4, factor: 2.0, presented: 101, qualifier: "fg_runtime_loaded", refusal: "non_uniform")
with
{ FgFactorScope = "steady", FgSteadyShare = 0.75, FgRefusalDetail = detail };
FpsReadoutModel m = InEnglish(() => FpsPresentation.FromRow(row));
m.Kind.Should().Be(FpsReadoutKind.Generated);
InEnglish(() => m.Line).Should().Be("58 → 116 FPS (×2.0 FG)");
InEnglish(() => m.FactorChip).Should().Be("×2.0 FG · 75%");
InEnglish(() => m.QualifierTooltip).Should().Contain("steady state").And.Contain("75%").And.Contain("Bucket 1 of 8 measured 1.00 against 1.60");
InEnglish(() => FpsPresentation.ColumnTooltip(row)).Should().Be(InEnglish(() => m.QualifierTooltip));
InEnglish(() => FpsPresentation.FactorColumn(row)).Should().Be("×2.0");
SessionRow session = Hooked("dlssg", native: 58.2, displayed: 116.4, factor: 2.0) with { FgFactorScope = "session" };
FpsReadoutModel s = InEnglish(() => FpsPresentation.FromRow(session));
InEnglish(() => s.FactorChip).Should().Be("×2.0 FG", "a session-wide factor needs no share");
s.QualifierTooltip.Should().BeNull();
}
/// <summary>A counted factor keeps the generated shape; the label carries the chip, without a trailing space.</summary>
[Fact]
public void ACountedFactorKeepsTheGeneratedLabelWithItsChip()
@@ -86,6 +86,42 @@ public sealed class SessionAggregatorTests
counted.FgRefusalDetail.Should().BeNull("a published factor has nothing to explain");
}
/// <summary>
/// 2026-09-17 (03_METRICS §Frame Generation): a real play session opens with a menu, the session-level factor is
/// refused as non-uniform, and until now the gameplay's own number went with it — one hooked session in nine
/// published a factor on the owner's machine. The row now carries the STEADY state, scoped and with its share,
/// and keeps the refusal that says why it is not session-wide.
/// </summary>
[Fact]
public void AMenuThenGameplayPublishesTheSteadyStateScopedAndWithItsShare()
{
var writer = new FlWriterState { Status = 1, HooksInstalledMask = 0xB, RuntimeCensus = (uint)(FlRuntimeCensus.Ran | FlRuntimeCensus.SlInterposer | FlRuntimeCensus.SlDlssG) };
FlMeasured claims = _presentOnly | FlMeasured.Fg | FlMeasured.FgCounts;
// 100 presents per second in these fixtures: 20 s of menu at x1, then 60 s of gameplay at x2.
List<FlFrameRecord> menu = SessionFixtures.Stream(2_000, claims, fgPerBatch: 1);
List<FlFrameRecord> play = [.. SessionFixtures.Stream(6_000, claims, fgPerBatch: 2)
.Select((r, i) => r with { Qpc = menu[^1].Qpc + ((ulong)(i + 1) * 100_000), FrameIndex = (uint)(2_000 + i), FgMode = (byte)FlFgMode.DlssG })];
SessionRow row = SessionAggregator.Aggregate(SessionFixtures.Skeleton(seconds: 80), SessionFixtures.Hooked([.. menu, .. play], writer)).Row;
row.FgMode.Should().Be("dlssg");
row.FgFactorScope.Should().Be("steady");
row.FgFactor.Should().BeApproximately(2.0, 0.01, "the gameplay's own factor, never the 1.6 the whole session averages to");
row.FgSteadyShare.Should().BeApproximately(0.75, 0.03);
row.NativeFps.Should().BeApproximately(50, 1);
row.DisplayedFps.Should().BeApproximately(100, 1);
row.FgRefusal.Should().Be("non_uniform", "the refusal stays: it is why the number is not session-wide");
row.FgRefusalDetail.Should().NotBeNull();
row.DisplayedCountedBy.Should().Be("hook");
// A uniform session is scoped 'session' and carries no share.
SessionRow uniform = SessionAggregator.Aggregate(SessionFixtures.Skeleton(), SessionFixtures.Hooked(SessionFixtures.Stream(2_000, claims, fgPerBatch: 2), writer)).Row;
uniform.FgFactorScope.Should().Be("session");
uniform.FgSteadyShare.Should().BeNull();
uniform.FgRefusal.Should().BeNull();
}
[Fact]
public void ACountedNoneAndACountedFactorLandAsTheRowSpellsThem()
{
@@ -0,0 +1,136 @@
using FluentAssertions;
using FrameLedger.Domain.Metrics;
using static FrameLedger.Domain.Tests.Metrics.SampleFixtures;
namespace FrameLedger.Domain.Tests.Metrics;
/// <summary>
/// <c>03_METRICS</c> §Frame Generation, the steady state (2026-09-17). The shapes below are the owner's nine hooked
/// sessions of 2026-09-16, rebuilt from their stored per-frame counts: every one opened with a splash, a menu or a
/// loading screen, the whole-session factor was refused as non-uniform (rightly — 2.22 on a session whose gameplay
/// read ×4.1), and the gameplay's own number went with it. 240 presents per second in these fixtures, so five seconds
/// is 1,200 presents.
/// </summary>
public sealed class FgSteadyStateTests
{
private const int _presentsPerSecond = 240;
/// <summary><paramref name="seconds"/> of presents at factor <paramref name="k"/> (1 = every present carries a token).</summary>
private static List<FrameSample> Play(int seconds, int k, uint swapchain = 1) =>
FgStream(appFrames: seconds * _presentsPerSecond / k, k: k, swapchain: swapchain);
/// <summary><paramref name="seconds"/> of presents with the count claimed and no token at all: a splash, a video, a loading screen.</summary>
private static List<FrameSample> NoTokens(int seconds) =>
FgStream(appFrames: seconds * _presentsPerSecond, k: 1, evalsPerFrame: 0);
[Fact]
public void AMenuThenGameplayIsRefusedAsASessionAndPublishedAsItsSteadyState()
{
// Cronos, 2026-09-16: menus at x1.0, then x2.00 for three quarters of the session.
List<FrameSample> session = Concat(Play(20, 1), Play(60, 2));
FgWindow w = FgWindow.From(session, Frequency);
w.Factor.Should().BeNull("1.0 and 2.0 average to a configuration that never existed");
w.Refusal!.Kind.Should().Be(FgRefusalKind.NonUniform);
w.Steady.Should().NotBeNull();
w.Steady!.Factor.Should().BeApproximately(2.0, 0.01);
w.Steady.Share.Should().BeApproximately(0.75, 0.03);
w.Steady.Seconds.Should().BeApproximately(60, 5);
w.Steady.NativeFps.Should().BeApproximately(120, 2, "tokens per second over the state's own windows");
w.Steady.DisplayedFps.Should().BeApproximately(240, 3);
(w.Steady.NativeFps * w.Steady.Factor).Should().BeApproximately(w.Steady.DisplayedFps, 1, "counted independently, and they agree");
}
[Fact]
public void AnOpeningWithNoTokensAtAllDoesNotCostTheGameplayItsNumber()
{
// Hell is Us, 2026-09-16: seven windows with no token, then x3.00.
FgWindow w = FgWindow.From(Concat(NoTokens(15), Play(45, 3)), Frequency);
w.Refusal!.Kind.Should().Be(FgRefusalKind.NonUniform);
w.Steady!.Factor.Should().BeApproximately(3.0, 0.02);
w.Steady.Share.Should().BeGreaterThan(0.7);
}
[Fact]
public void TwoMultipliersNeverPoolAndTheLongerOneSpeaks()
{
// x3 and x4 are 25 % apart; pooled they would read 3.4, which no title offers.
FgWindow w = FgWindow.From(Concat(Play(20, 3), Play(60, 4)), Frequency);
w.Refusal!.Kind.Should().Be(FgRefusalKind.NonUniform);
w.Steady!.Factor.Should().BeApproximately(4.0, 0.02);
w.Steady.Share.Should().BeApproximately(0.75, 0.03);
}
[Fact]
public void ABurstShorterThanTenSecondsOrUnderATenthOfTheSessionIsNotAState()
{
FgWindow.From(Concat(Play(60, 1), Play(6, 4)), Frequency).Steady.Should().BeNull("six seconds is a transition, not a configuration");
FgWindow.From(Concat(Play(300, 1), Play(20, 4)), Frequency).Steady.Should().BeNull("twenty seconds of three hundred and twenty does not speak for the session");
}
[Fact]
public void AUniformSessionPublishesItsOwnFactorAndCarriesNoSteadyState()
{
FgWindow w = FgWindow.From(Play(60, 2), Frequency);
w.Refusal.Should().BeNull();
w.Factor.Should().BeApproximately(2.0, 0.01);
w.Steady.Should().BeNull("the steady state is what a refused session falls back to, never a second number beside a published one");
}
[Fact]
public void ASessionThatNeverGeneratedHasNoSteadyState()
{
FgWindow w = FgWindow.From(Concat(NoTokens(15), Play(45, 1)), Frequency);
w.Refusal!.Kind.Should().Be(FgRefusalKind.NonUniform);
w.Steady.Should().BeNull("only an ACTIVE state is published this way; a none beside a gap keeps its refusal");
}
[Fact]
public void ARecreatedSwapchainIsOneStreamAtATimeAndNoLongerRefuses()
{
// Onimusha, 2026-09-16: chain 1 for the menus, chain 2 from the first gameplay frame, nothing interleaved.
FgWindow w = FgWindow.From(Concat(Play(20, 1, swapchain: 1), Play(60, 4, swapchain: 2)), Frequency);
w.Streams.Should().Be(2);
w.StreamsInterleaved.Should().BeFalse();
w.Refusal!.Kind.Should().Be(FgRefusalKind.NonUniform, "the honest refusal for this session is that its state changed, not that it had two streams");
w.Steady!.Factor.Should().BeApproximately(4.0, 0.02);
FgWindow uniform = FgWindow.From(Concat(Play(30, 2, swapchain: 1), Play(30, 2, swapchain: 2)), Frequency);
uniform.Refusal.Should().BeNull("two chains one after another at one factor is a uniform session");
uniform.Factor.Should().BeApproximately(2.0, 0.01);
}
[Fact]
public void CalledDirectlyItChecksItsArgumentsAndFindsNoStateWhereNothingGenerated()
{
List<FrameSample> none = Play(30, 1);
FgSteadyState.From(none, 0, Frequency).Should().BeNull("no window reaches the active threshold");
Action nullSamples = () => FgSteadyState.From(null!, 0, Frequency);
nullSamples.Should().Throw<ArgumentNullException>();
Action pastTheEnd = () => FgSteadyState.From(none, none.Count, Frequency);
pastTheEnd.Should().Throw<ArgumentOutOfRangeException>();
Action negative = () => FgSteadyState.From(none, -1, Frequency);
negative.Should().Throw<ArgumentOutOfRangeException>();
Action noClock = () => FgSteadyState.From(none, 0, 0);
noClock.Should().Throw<ArgumentOutOfRangeException>();
}
[Fact]
public void ARefusalThatIsNotAboutUniformityGetsNoSteadyState()
{
List<FrameSample> interleaved = Concat(Play(20, 1), Play(60, 4));
interleaved.Insert(9_000, interleaved[9_000] with { SwapchainId = 2, Qpc = interleaved[9_000].Qpc - 1 });
FgWindow w = FgWindow.From(interleaved, Frequency);
w.Refusal!.Kind.Should().Be(FgRefusalKind.MultipleStreams);
w.Steady.Should().BeNull("a record set that cannot be attributed is not made trustworthy by slicing it");
}
}
@@ -159,8 +159,9 @@ public sealed class FgWindowTests
[Fact]
public void ASecondStreamInTheSpanRefusesBecauseTheDrainWordIsProcessWide()
{
// INTERLEAVED: chain 2 presents in the middle of chain 1's run, so the two were presenting at once.
List<FrameSample> stream = [.. FgStream(appFrames: 40, k: 4)];
stream.Add(stream[^1] with { SwapchainId = 2, Qpc = stream[^1].Qpc + (ulong)Step });
stream.Insert(80, stream[80] with { SwapchainId = 2, Qpc = stream[80].Qpc - 1 });
FgWindow w = FgWindow.From(stream, Frequency);
@@ -251,7 +252,7 @@ public sealed class FgWindowTests
public void TheProxyRefusesOnTheSameAttributionFactsTheFactorDoes()
{
List<FrameSample> stream = [.. FgStream(appFrames: 40, k: 4, evalsPerFrame: 0)];
stream.Add(stream[^1] with { SwapchainId = 2, Qpc = stream[^1].Qpc + (ulong)Step });
stream.Insert(80, stream[80] with { SwapchainId = 2, Qpc = stream[80].Qpc - 1 });
FgWindow w = FgWindow.From(stream, Frequency);
@@ -73,6 +73,19 @@ public sealed class LedgerDatabaseTests
columns.Should().Contain("fg_refusal_detail").And.Contain("fg_refusal", "0005 appends beside 0003's column, it edits nothing");
}
/// <summary>Schema 0006 (2026-09-17): which part of the session <c>fg_factor</c> describes, and how much of it.</summary>
[Fact]
public async Task ScriptSixAddsTheFgScopeColumns()
{
await using LedgerFixture f = await LedgerFixture.OpenAsync();
MigrationRunner.LatestVersion.Should().BeGreaterThanOrEqualTo(6);
IReadOnlyList<string> columns = await f.Db.ReadAsync(async (c, ct) =>
(IReadOnlyList<string>)[.. await c.QueryAsync<string>(new CommandDefinition(
"SELECT name FROM pragma_table_info('sessions')", cancellationToken: ct)).ConfigureAwait(false)], Ct);
columns.Should().Contain("fg_factor_scope").And.Contain("fg_steady_share").And.Contain("fg_refusal_detail", "0006 appends beside 0005's column, it edits nothing");
}
[Fact]
public async Task ReopeningIsANoOp()
{
@@ -46,6 +46,9 @@ public sealed class SqliteSessionRepositoryTests
FgMode = "none",
FgSource = "none",
FgFactor = 1.0,
FgFactorScope = "steady",
FgSteadyShare = 0.75,
FgRefusalDetail = "{}",
RtFlag = "yes",
RtSource = "measured",
NativeFps = 60.0,