@threenative/playtest 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capture.d.ts +1 -1
- package/dist/{diagnostics-BhS6v2n1.d.ts → diagnostics-BKg7C6Lf.d.ts} +36 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1058 -126
- package/dist/protocol.d.ts +73 -1
- package/dist/runner/cli.d.ts +3 -3
- package/dist/runner/cli.js +2080 -550
- package/dist/runner/index.d.ts +85 -10
- package/dist/runner/index.js +1936 -536
- package/dist/{schema-base-B5mr_Yr9.d.ts → schema-base-B26KSBoa.d.ts} +106 -0
- package/dist/{shared-DK12BZyS.d.ts → shared-Dg-3kiU8.d.ts} +22 -69
- package/dist/three/index.js +138 -25
- package/package.json +1 -1
package/dist/runner/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { writeFile, stat, mkdtemp, rm, mkdir, readFile, rename, access, unlink, open, readdir, copyFile, rmdir } from 'fs/promises';
|
|
3
|
-
import { join, resolve, relative, dirname, isAbsolute, basename } from 'path';
|
|
4
2
|
import { existsSync, readdirSync, rmSync, constants, readFileSync } from 'fs';
|
|
3
|
+
import { join, resolve, relative, dirname, isAbsolute, basename } from 'path';
|
|
5
4
|
import { execFile, spawnSync, spawn } from 'child_process';
|
|
5
|
+
import { writeFile, stat, mkdtemp, rm, mkdir, readFile, access, unlink, rename, open, readdir, copyFile, rmdir } from 'fs/promises';
|
|
6
6
|
import { tmpdir, homedir } from 'os';
|
|
7
7
|
import { promisify } from 'util';
|
|
8
8
|
import { PNG } from 'pngjs';
|
|
@@ -380,7 +380,7 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
380
380
|
example: { visual: [{ frameDiff: { baselineImage: "artifacts/baseline.png", minChangedPixelRatio: 0.01 }, entityVisible: { entity: "board.e4", minProjectedPixels: 20, throughoutFrames: true }, region: { element: { id: "error" }, minNonblankPixelRatio: 2e-3 } }] },
|
|
381
381
|
fields: [
|
|
382
382
|
{ description: "Before/after or baseline-image changed-pixel ratio bounds.", name: "frameDiff", type: "{ baselineImage?: project-relative PNG, minChangedPixelRatio?: number, maxChangedPixelRatio?: number }" },
|
|
383
|
-
{ description: "Static pixel bounds, or a DOM element whose bounds are captured beside the screenshot; the latter accepts exactly one id or selector. Both forms accept nonblank, dark-pixel, and luminance thresholds.", name: "region", type: "static bounds { x: number, y: number, width: number, height: number, minNonblankPixelRatio?: number, maxDarkPixelRatio?: number, minDarkPixelRatio?: number, maxLuminance?: number } or element bounds { element: { id?: string, selector?: string }, minNonblankPixelRatio?: number, maxDarkPixelRatio?: number, minDarkPixelRatio?: number, maxLuminance?: number }" },
|
|
383
|
+
{ description: "Static pixel bounds, or a DOM element whose bounds are captured beside the screenshot; the latter accepts exactly one id or selector. Both forms accept nonblank, dark-pixel, and luminance thresholds. A static region also takes `minSharpness` (a ratio, start at 0.3): the share of luminance detail that survives at full resolution against half resolution in the final frame. In-focus frames read 0.39-0.61, a frame a post stage smears reads 0.21-0.24.", name: "region", type: "static bounds { x: number, y: number, width: number, height: number, minSharpness?: number, minNonblankPixelRatio?: number, maxDarkPixelRatio?: number, minDarkPixelRatio?: number, maxLuminance?: number } or element bounds { element: { id?: string, selector?: string }, minNonblankPixelRatio?: number, maxDarkPixelRatio?: number, minDarkPixelRatio?: number, maxLuminance?: number }" },
|
|
384
384
|
{ description: "Entity projected-pixel floor, optionally across all captured samples.", name: "entityVisible", type: "{ entity: string, minProjectedPixels: number, throughoutFrames?: boolean }" }
|
|
385
385
|
],
|
|
386
386
|
cardinality: "array",
|
|
@@ -474,7 +474,7 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
474
474
|
{ description: "Substring expected in the observed value.", name: "textIncludes", type: "string" },
|
|
475
475
|
{ description: "Require before and after values to differ or remain equal.", name: "changed", type: "boolean" },
|
|
476
476
|
{ description: "Require the value assertion after every labeled scenario step.", name: "throughoutSteps", type: "boolean" },
|
|
477
|
-
{ description: "Expected values at named scenario-step samples.", name: "atSteps", type: "Array<{ label: string, equals?: json, textIncludes?: string }>" },
|
|
477
|
+
{ description: "Expected values at named scenario-step samples.", name: "atSteps", type: "Array<{ label: string, equals?: json, lte?: number, textIncludes?: string }>" },
|
|
478
478
|
{ description: "Written reason for a held invariant whose initial value intentionally satisfies the assertion.", name: "allowTrivial", type: "triviality reason" },
|
|
479
479
|
{ description: "Require at least one alternative path assertion on this resource id.", name: "anyOf", type: "Array<{ path: string, equals?: json, gte?: number, lte?: number, textIncludes?: string, changed?: boolean }>" }
|
|
480
480
|
],
|
|
@@ -610,7 +610,8 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
610
610
|
description: "Proves a live render sample exists and optionally bounds frame time, an fps floor, per-phase frame budget, whole-frame or per-pass draw calls and triangles.",
|
|
611
611
|
example: { performance: { maxPassDrawCalls: { shadow: 400 }, maxPhaseMsP95: { render: 12 }, minFps: 30 } },
|
|
612
612
|
fields: [
|
|
613
|
-
{ description: "Maximum nearest-rank 95th-percentile frame time in milliseconds.", name: "maxFrameMsP95", type: "number" },
|
|
613
|
+
{ description: "Maximum nearest-rank 95th-percentile frame time in milliseconds. Unset, the budget is 16.7 ms (one 60 Hz frame, 60 fps) on every tier; a software adapter is unmeasurable and fails closed. On the runner's virtual display the bound judges the engine's own cost (update plus render, or GPU time when larger) and reports the rAF interval as `gated: false`; on a real display (`TN_PLAYTEST_HOST_DISPLAY=1`) the interval and the cost must both hold. A missing CPU split or GPU reading fails closed. `frameBudget` in the `performance.samples` details reports which applied. A value above 16.7 is an override and needs `maxFrameMsReason`.", name: "maxFrameMsP95", type: "number" },
|
|
614
|
+
{ description: "Why this scenario cannot hold 60 fps. Required when `maxFrameMsP95` is above 16.7; printed in the report.", name: "maxFrameMsReason", type: "non-empty string" },
|
|
614
615
|
{ description: "Minimum sustained frames per second, from the median sampled frame.", name: "minFps", type: "number" },
|
|
615
616
|
{ description: "Per-phase millisecond ceilings at nearest-rank p95. Phases: hostGap, update, render, overlay, residual.", name: "maxPhaseMsP95", type: "{ [phase]: number }" },
|
|
616
617
|
{ description: "Maximum observed renderer draw-call count across every pass combined.", name: "maxDrawCalls", type: "number" },
|
|
@@ -764,6 +765,7 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
764
765
|
fields: [
|
|
765
766
|
{ description: "Entity id. Defaults to scenario subject.", name: "entity", type: "string" },
|
|
766
767
|
{ description: "Animation clip id or name.", name: "clip", type: "string" },
|
|
768
|
+
{ description: "Labeled step whose animation report is judged; default is the last sample.", name: "atStep", type: "string" },
|
|
767
769
|
{ description: "Require entering the animation state.", name: "entered", type: "boolean" },
|
|
768
770
|
{ description: "Require animation advancement evidence.", name: "advancedFrames", type: "number" },
|
|
769
771
|
{ description: "Require the observed clip to report its completion state.", name: "finished", type: "boolean" },
|
|
@@ -821,6 +823,79 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
821
823
|
triviality: "not-applicable",
|
|
822
824
|
trivialityRationale: "A node's presence, visibility, framing and texture state are properties of the scene as built; a crate that is already on screen is the assertion holding, not a trivial pass."
|
|
823
825
|
},
|
|
826
|
+
{
|
|
827
|
+
cardinality: "array",
|
|
828
|
+
description: "Bounds how far a planted foot slides while the subject moves, measured every tick from named foot nodes' world positions, so it holds a procedural rig to the feet-meet-the-floor convention as well as a clip. Browser target only; another target fails it as unobserved.",
|
|
829
|
+
example: { footSlip: [{ atStep: "run", feet: ["footL", "footR"], maxSlip: 0.35 }] },
|
|
830
|
+
fields: [
|
|
831
|
+
{ description: "Label of the input step to measure; it is advanced one tick at a time and must move the subject at least 0.5 m.", name: "atStep", type: "string" },
|
|
832
|
+
{ description: "Exact Object3D names of the nodes at the soles, one per foot.", name: "feet", type: "Array<string>" },
|
|
833
|
+
{ description: "Ceiling on planted-foot travel over body travel while a foot is in the lowest quarter of its lift below the body: 0 is planted, 1 skates with the body, above 1 the legs cycle faster than the ground moves. Set this, `maxSlideSpeed`, or both.", name: "maxSlip", type: "positive number" },
|
|
834
|
+
{ description: "Ceiling on a planted foot's world speed in metres per second (planted-foot travel over planted time), independent of the body's speed and of the game's own stride report. A starter-kit character holds 1.", name: "maxSlideSpeed", type: "positive number" },
|
|
835
|
+
{ description: "Seconds per fixed tick, which turns planted ticks into planted time for `maxSlideSpeed`. Default 1/60, the engine's default `step`; name it when the game sets another.", name: "stepSeconds", type: "positive number" },
|
|
836
|
+
{ description: "The moving entity; defaults to the scenario subject.", name: "entity", type: "string" }
|
|
837
|
+
],
|
|
838
|
+
kind: "footSlip",
|
|
839
|
+
observationPath: "footSlip",
|
|
840
|
+
requiredCapabilities: ["entity.observe", "scene.nodes"],
|
|
841
|
+
resultIdPrefix: "footSlip",
|
|
842
|
+
supportedOn: ["web"],
|
|
843
|
+
triviality: "not-applicable",
|
|
844
|
+
trivialityRationale: "The measurement needs the subject to cover ground during the step, so a standing subject fails as unmeasured instead of passing."
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
cardinality: "object",
|
|
848
|
+
description: "Bounds the share of the run in which solid geometry stood between the camera and the subject's world bounds centre, so a camera that clips through a pillar or a wall that eats the framing fails. Browser target only; another target fails it as unobserved.",
|
|
849
|
+
example: { sightLine: { maxBlockedRatio: 0.02 } },
|
|
850
|
+
fields: [
|
|
851
|
+
{ description: "The entity whose world bounds centre the camera should see; defaults to the scenario subject.", name: "entity", type: "string" },
|
|
852
|
+
{ description: "Share of samples, 0..1, that may have any solid between the lens and the subject before the run fails; 0 requires a clear line on every sample.", name: "maxBlockedRatio", required: true, type: "number" }
|
|
853
|
+
],
|
|
854
|
+
kind: "sightLine",
|
|
855
|
+
observationPath: "sightLine",
|
|
856
|
+
requiredCapabilities: ["camera.observe", "entity.observe"],
|
|
857
|
+
resultIdPrefix: "sightLine",
|
|
858
|
+
supportedOn: ["web"],
|
|
859
|
+
triviality: "not-applicable",
|
|
860
|
+
trivialityRationale: "The measurement needs the runtime camera and subject to stay framed over time; an initial pose cannot satisfy a temporal share of clear lines."
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
cardinality: "object",
|
|
864
|
+
description: "Bounds the engine's own work counters, read off each TN_FRAME_BUDGET window's counters.engine (and counters.bridgeCrossings): JS-to-Wasm crossings, children reads, scene-walk visits, hierarchy moves, matrix composes, handle shares, content classification, GPU allocations, physics crossings and any counter an engine module adds to globalThis.__tnEngineCost. Each window must hold every bound; a run with fewer windows than minWindows, or a window missing a bounded counter, fails closed. A failure names the counter, the window and the top caller of the TN_BRIDGE_CENSUS before it.",
|
|
865
|
+
example: { engineCost: { maxPerFrame: { bridgeCrossings: 2e3, childrenReads: 60 }, skipWindows: 1, source: "shooter after-value 1,024 per frame on 2026-10-27, about 2x headroom" } },
|
|
866
|
+
fields: [
|
|
867
|
+
{ description: "Counter name to its bound on a window's per-frame mean.", name: "maxPerFrame", type: "{ [counter: string]: number }" },
|
|
868
|
+
{ description: "Counter name to its bound on any single frame of a window.", name: "maxInFrame", type: "{ [counter: string]: number }" },
|
|
869
|
+
{ description: "Windows the run must report; default 1.", name: "minWindows", type: "positive integer" },
|
|
870
|
+
{ description: "Windows left unbounded first, the boot (loading, first builds); still and moving count after them. Default 0.", name: "skipWindows", type: "non-negative integer" },
|
|
871
|
+
{ description: "Per-frame bounds on the first `windows` windows only, which the scenario keeps still.", name: "still", type: "{ windows: positive integer, maxPerFrame: { [counter: string]: number } }" },
|
|
872
|
+
{ description: "Bounds on the windows after the still ones, which the scenario fills with play; needs still.", name: "moving", type: "{ maxPerFrame?: { [counter: string]: number }, maxInFrame?: { [counter: string]: number } }" },
|
|
873
|
+
{ description: "Where the bounds came from: the measured after-values and the headroom on them.", name: "source", required: true, type: "string" }
|
|
874
|
+
],
|
|
875
|
+
kind: "engineCost",
|
|
876
|
+
observationPath: "console",
|
|
877
|
+
requiredCapabilities: ["browser.console"],
|
|
878
|
+
resultIdPrefix: "engineCost.",
|
|
879
|
+
supportedOn: ["web"],
|
|
880
|
+
triviality: "not-applicable",
|
|
881
|
+
trivialityRationale: "The counters are measured across the run's frames; an initial value has no frames to count."
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
cardinality: "object",
|
|
885
|
+
description: "Audits the text the page draws for the player: developer left-overs such as debug, TODO, placeholder or an unresolved undefined, and text whose colour is too close to its backing colour. Browser target only; another target fails it as unobserved.",
|
|
886
|
+
example: { hudAudit: { minContrast: 3, noDebugText: true } },
|
|
887
|
+
fields: [
|
|
888
|
+
{ description: "WCAG 2.x contrast ratio, 1..21, that every text item over a real backing colour must reach; text drawn straight on the canvas is counted as unjudged.", name: "minContrast", type: "number" },
|
|
889
|
+
{ description: "Require that no text reads like developer copy. Only true is accepted.", name: "noDebugText", type: "true" }
|
|
890
|
+
],
|
|
891
|
+
kind: "hudAudit",
|
|
892
|
+
observationPath: "hudAudit",
|
|
893
|
+
requiredCapabilities: ["browser.dom"],
|
|
894
|
+
resultIdPrefix: "hudAudit.",
|
|
895
|
+
supportedOn: ["web"],
|
|
896
|
+
triviality: "not-applicable",
|
|
897
|
+
trivialityRationale: "The audit reads the live document the player sees, so an initial value cannot prove that developer text never appeared or that a colour stays readable."
|
|
898
|
+
},
|
|
824
899
|
{
|
|
825
900
|
cardinality: "array",
|
|
826
901
|
description: "Relates a tick-stamped effect to the tick-stamped cause that must precede it \u2014 the 'because' a terminal state needs.",
|
|
@@ -854,7 +929,9 @@ var PLAYTEST_ASSERTION_REGISTRY = [
|
|
|
854
929
|
fields: [
|
|
855
930
|
{ description: "Ceiling on when the start scene's enter() returned, in ms since navigation.", name: "maxEnteredMs", type: "number" },
|
|
856
931
|
{ description: "Ceiling on when first-use compilation settled or its budget expired, in ms since navigation.", name: "maxCompileSettledMs", type: "number" },
|
|
857
|
-
{ description: "Ceiling on when startup readiness resolved, in ms since navigation.", name: "maxReadyMs", type: "number" }
|
|
932
|
+
{ description: "Ceiling on when startup readiness resolved, in ms since navigation.", name: "maxReadyMs", type: "number" },
|
|
933
|
+
{ description: "Ceiling on the bytes the reveal waited for through ctx.assets that the spawn camera does not show, from the runtime's own measurement; 0 asserts everything awaited is in view.", name: "maxOffscreenBytes", type: "number" },
|
|
934
|
+
{ description: "true: every frame the browser presented between navigation and readiness matches the last one before readiness (the loading cover), so a black, blank or page-background frame fails, and no frame between readiness and the first world frame shows page UI (a HUD) over the cover. Browser target only; elsewhere it fails as unobserved.", name: "steadyCover", type: "boolean" }
|
|
858
935
|
],
|
|
859
936
|
cardinality: "object",
|
|
860
937
|
kind: "startup",
|
|
@@ -1168,6 +1245,37 @@ function format(value) {
|
|
|
1168
1245
|
return value === null ? "unknown" : String(value);
|
|
1169
1246
|
}
|
|
1170
1247
|
|
|
1248
|
+
// src/evaluators/perf-warnings.ts
|
|
1249
|
+
var SCENE_WARNING = "TN_SCENE_WARNING";
|
|
1250
|
+
var BRIDGE_WARNING = "TN_BRIDGE_WARNING";
|
|
1251
|
+
var HOT_CALL = "TN_HOT_CALL";
|
|
1252
|
+
var PROJECTION = "TN_RENDER_PROJECTION:";
|
|
1253
|
+
function perfWarnings(consoleLines) {
|
|
1254
|
+
const found = [];
|
|
1255
|
+
for (const line of consoleLines) {
|
|
1256
|
+
if (typeof line !== "string") continue;
|
|
1257
|
+
for (const marker of [SCENE_WARNING, BRIDGE_WARNING, HOT_CALL]) {
|
|
1258
|
+
const warning = line.indexOf(marker);
|
|
1259
|
+
if (warning !== -1) found.push(line.slice(warning).trim());
|
|
1260
|
+
}
|
|
1261
|
+
const at = line.indexOf(PROJECTION);
|
|
1262
|
+
if (at === -1) continue;
|
|
1263
|
+
const text = line.slice(at).trim();
|
|
1264
|
+
let report;
|
|
1265
|
+
try {
|
|
1266
|
+
report = JSON.parse(line.slice(at + PROJECTION.length));
|
|
1267
|
+
} catch {
|
|
1268
|
+
found.push(`${text} (unreadable)`);
|
|
1269
|
+
continue;
|
|
1270
|
+
}
|
|
1271
|
+
if (report.projecting !== false || report.reasonCode === "disabled") continue;
|
|
1272
|
+
if (report.reasonCode === "belowMeshFloor") continue;
|
|
1273
|
+
const cause = report.cause === void 0 ? "" : ` [cause ${report.cause.code ?? "?"}: ${report.cause.hint ?? "no hint"}]`;
|
|
1274
|
+
found.push(`${text}${cause}`);
|
|
1275
|
+
}
|
|
1276
|
+
return found;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1171
1279
|
// src/evaluators/measures.ts
|
|
1172
1280
|
function horizontalRadius(transform, direction) {
|
|
1173
1281
|
const halfExtents = transform?.halfExtents ?? (transform?.scale === void 0 ? void 0 : transform.scale.map((value) => Math.abs(value) * 0.5));
|
|
@@ -1453,6 +1561,15 @@ function evaluateDiagnosticsPolicy(report, policy) {
|
|
|
1453
1561
|
suggestion: "Inspect console.json and fix the first TN_V8_FRAME_FAILED error."
|
|
1454
1562
|
});
|
|
1455
1563
|
}
|
|
1564
|
+
const warnings = perfWarnings((report.observations?.console ?? []).map(({ text }) => text));
|
|
1565
|
+
if (warnings.length > 0) {
|
|
1566
|
+
diagnostics.push({
|
|
1567
|
+
code: "TN_PLAYTEST_PERF_WARNING",
|
|
1568
|
+
message: `${warnings.length} engine performance warning(s): ${warnings.slice(0, 3).join(" | ")}`,
|
|
1569
|
+
severity: "error",
|
|
1570
|
+
suggestion: "Fix what the warning names (a unique geometry or material splitting a batch, a CPU-bound scene) or set renderer.projection: false when the game measured projection as a loss."
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1456
1573
|
const capturedConsoleErrors = consoleErrors(report.observations?.console ?? []);
|
|
1457
1574
|
if (policy.noConsoleErrors && capturedConsoleErrors.length > 0) {
|
|
1458
1575
|
diagnostics.push({
|
|
@@ -1825,12 +1942,17 @@ function strideReading(observed) {
|
|
|
1825
1942
|
return {
|
|
1826
1943
|
clipGroundSpeed: stride.clipGroundSpeed,
|
|
1827
1944
|
groundSpeed: stride.groundSpeed,
|
|
1945
|
+
inPlace: stride.inPlace === true,
|
|
1828
1946
|
overridden: stride.overridden,
|
|
1829
1947
|
rate: stride.rate,
|
|
1830
1948
|
synced: stride.synced
|
|
1831
1949
|
};
|
|
1832
1950
|
}
|
|
1833
1951
|
var STRIDE_GROUND_SPEED_FLOOR = 1e-3;
|
|
1952
|
+
function strideHasNoFootPlant(reading) {
|
|
1953
|
+
return reading.inPlace && Math.abs(reading.clipGroundSpeed) <= STRIDE_GROUND_SPEED_FLOOR && Math.abs(reading.groundSpeed) > STRIDE_GROUND_SPEED_FLOOR;
|
|
1954
|
+
}
|
|
1955
|
+
var NO_FOOT_PLANT_DETAIL = "no foot plant found: stride sync is off";
|
|
1834
1956
|
function appliedStrideRate(reading) {
|
|
1835
1957
|
return reading.synced ? reading.rate : 1;
|
|
1836
1958
|
}
|
|
@@ -1849,6 +1971,8 @@ function strideFailure(assertion, observed) {
|
|
|
1849
1971
|
code: "TN_PLAYTEST_STRIDE_UNOBSERVED",
|
|
1850
1972
|
detail: "the runtime reported no stride for this clip, so neither the feet nor the ground were measured"
|
|
1851
1973
|
};
|
|
1974
|
+
if (assertion.strideSynced !== false && strideHasNoFootPlant(reading))
|
|
1975
|
+
return { code: "TN_PLAYTEST_STRIDE_NO_FOOT_PLANT", detail: NO_FOOT_PLANT_DETAIL };
|
|
1852
1976
|
if (assertion.strideSynced !== void 0 && reading.synced !== assertion.strideSynced)
|
|
1853
1977
|
return {
|
|
1854
1978
|
code: "TN_PLAYTEST_STRIDE_NOT_SYNCED",
|
|
@@ -1959,6 +2083,240 @@ function assertJsonSafe(value, path2 = "$") {
|
|
|
1959
2083
|
}
|
|
1960
2084
|
throw new TypeError(`${path2} must be JSON-safe.`);
|
|
1961
2085
|
}
|
|
2086
|
+
var DEFAULT_XVFB_SCREEN = "1600x900x24";
|
|
2087
|
+
var HOST_DISPLAY_ENV = "TN_PLAYTEST_HOST_DISPLAY";
|
|
2088
|
+
var STRIPPED_WAYLAND_VARS = ["WAYLAND_DISPLAY", "WAYLAND_SOCKET", "XDG_SESSION_TYPE"];
|
|
2089
|
+
function decideDisplayStrategy(input) {
|
|
2090
|
+
if (input.platform !== "linux") return { kind: "host" };
|
|
2091
|
+
const privateXvfb = {
|
|
2092
|
+
kind: "private-xvfb",
|
|
2093
|
+
screen: input.env.TN_XVFB_SCREEN ?? DEFAULT_XVFB_SCREEN
|
|
2094
|
+
};
|
|
2095
|
+
if (!hostDisplayRequested(input.env)) return privateXvfb;
|
|
2096
|
+
const display = input.env.DISPLAY;
|
|
2097
|
+
if (display === void 0 || display.length === 0) {
|
|
2098
|
+
throw new Error("TN_PLAYTEST_HOST_DISPLAY_UNAVAILABLE: the requested host display requires DISPLAY.");
|
|
2099
|
+
}
|
|
2100
|
+
const available = input.displaySocketExists?.(display) ?? x11DisplayIsUsable(display, input.env);
|
|
2101
|
+
if (!available) {
|
|
2102
|
+
throw new Error(`TN_PLAYTEST_HOST_DISPLAY_UNAVAILABLE: cannot connect to requested DISPLAY=${display}. Refusing to substitute a private Xvfb.`);
|
|
2103
|
+
}
|
|
2104
|
+
return { display, kind: "existing" };
|
|
2105
|
+
}
|
|
2106
|
+
function hostDisplayRequested(env) {
|
|
2107
|
+
const value = env[HOST_DISPLAY_ENV];
|
|
2108
|
+
return value === "1" || value?.toLowerCase() === "true";
|
|
2109
|
+
}
|
|
2110
|
+
function x11DisplayIsUsable(display, env) {
|
|
2111
|
+
const probe = spawnSync("xdpyinfo", ["-display", display], { env, stdio: "ignore", timeout: 2e3 });
|
|
2112
|
+
if (probe.error) {
|
|
2113
|
+
throw new Error(`TN_PLAYTEST_HOST_DISPLAY_UNAVAILABLE: cannot verify DISPLAY=${display}: xdpyinfo ${probe.error.message}.`);
|
|
2114
|
+
}
|
|
2115
|
+
return probe.status === 0;
|
|
2116
|
+
}
|
|
2117
|
+
function childEnvForDisplay(env, display) {
|
|
2118
|
+
const child = { ...env };
|
|
2119
|
+
for (const name of STRIPPED_WAYLAND_VARS) delete child[name];
|
|
2120
|
+
child.DISPLAY = display;
|
|
2121
|
+
return child;
|
|
2122
|
+
}
|
|
2123
|
+
function runNeedsPixels(config, scenario) {
|
|
2124
|
+
if (config.headless !== true) return true;
|
|
2125
|
+
const takesScreenshot = scenario.artifacts?.screenshots !== false || scenario.steps.some(({ screenshot }) => screenshot !== void 0);
|
|
2126
|
+
const evaluatesVisual = (scenario.assert?.visual?.length ?? 0) > 0 || (scenario.assert?.tone?.length ?? 0) > 0;
|
|
2127
|
+
return takesScreenshot || evaluatesVisual || scenario.assert?.framebufferCoverage !== void 0;
|
|
2128
|
+
}
|
|
2129
|
+
async function provideDisplay(options = {}) {
|
|
2130
|
+
const env = options.env ?? process.env;
|
|
2131
|
+
const platform = options.platform ?? process.platform;
|
|
2132
|
+
const strategy = decideDisplayStrategy({
|
|
2133
|
+
displaySocketExists: options.displaySocketExists,
|
|
2134
|
+
env,
|
|
2135
|
+
platform
|
|
2136
|
+
});
|
|
2137
|
+
if (strategy.kind === "host") {
|
|
2138
|
+
return {
|
|
2139
|
+
compositor: void 0,
|
|
2140
|
+
display: void 0,
|
|
2141
|
+
env: { ...env },
|
|
2142
|
+
release: async () => void 0,
|
|
2143
|
+
strategy
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
if (strategy.kind === "existing") {
|
|
2147
|
+
return {
|
|
2148
|
+
compositor: void 0,
|
|
2149
|
+
display: strategy.display,
|
|
2150
|
+
env: childEnvForDisplay(env, strategy.display),
|
|
2151
|
+
release: async () => void 0,
|
|
2152
|
+
strategy
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const commandExists = options.commandExists ?? defaultCommandExists;
|
|
2156
|
+
if (!commandExists("Xvfb")) {
|
|
2157
|
+
throw new Error(
|
|
2158
|
+
"No usable X display is available and Xvfb is not installed, so this pixel-producing run cannot start (Debian/Ubuntu 'xvfb', Arch 'xorg-server-xvfb', Fedora 'xorg-x11-server-Xvfb'). Refusing to render blind."
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
const spawnProcess = options.spawnProcess ?? spawn;
|
|
2162
|
+
const xvfb = spawnProcess("Xvfb", [
|
|
2163
|
+
"-displayfd",
|
|
2164
|
+
"3",
|
|
2165
|
+
"-nolisten",
|
|
2166
|
+
"tcp",
|
|
2167
|
+
// COMPOSITE and SHAPE are what a compositing manager needs before it can blend anything, and
|
|
2168
|
+
// the native desktop runtime refuses to attach its UI overlay to a display without one. Xvfb
|
|
2169
|
+
// does not enable them by default, so every native UI run on a private display reported
|
|
2170
|
+
// `TN_UI_OVERLAY:{"attached":false,"reason":"no compositing manager is running"}` — including
|
|
2171
|
+
// the starter template's own shipped native-playtests/react-hud scenario, which failed out of
|
|
2172
|
+
// the box on a freshly scaffolded project. A browser run does not care either way.
|
|
2173
|
+
"+extension",
|
|
2174
|
+
"COMPOSITE",
|
|
2175
|
+
"+extension",
|
|
2176
|
+
"SHAPE",
|
|
2177
|
+
"-screen",
|
|
2178
|
+
"0",
|
|
2179
|
+
strategy.screen
|
|
2180
|
+
], { stdio: ["ignore", "ignore", "pipe", "pipe"] });
|
|
2181
|
+
xvfb.on?.("error", () => void 0);
|
|
2182
|
+
try {
|
|
2183
|
+
const number = await readXvfbDisplayNumber(xvfb);
|
|
2184
|
+
const display = `:${number}`;
|
|
2185
|
+
const compositor = await startCompositor(display, { commandExists, env, spawnProcess });
|
|
2186
|
+
return {
|
|
2187
|
+
compositor: compositor?.name,
|
|
2188
|
+
display,
|
|
2189
|
+
env: childEnvForDisplay(env, display),
|
|
2190
|
+
release: async () => {
|
|
2191
|
+
if (compositor !== void 0) await stopChild(compositor.child);
|
|
2192
|
+
await stopChild(xvfb);
|
|
2193
|
+
},
|
|
2194
|
+
strategy
|
|
2195
|
+
};
|
|
2196
|
+
} catch (error) {
|
|
2197
|
+
await stopChild(xvfb);
|
|
2198
|
+
throw error;
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
var COMPOSITORS = [
|
|
2202
|
+
{ args: ["-n"], name: "xcompmgr" },
|
|
2203
|
+
{ args: [], name: "picom" },
|
|
2204
|
+
{ args: [], name: "compton" }
|
|
2205
|
+
];
|
|
2206
|
+
var COMPOSITOR_SETTLE_MS = 250;
|
|
2207
|
+
async function startCompositor(display, options) {
|
|
2208
|
+
const choice = COMPOSITORS.find(({ name }) => options.commandExists(name));
|
|
2209
|
+
if (choice === void 0) return void 0;
|
|
2210
|
+
const child = options.spawnProcess(choice.name, [...choice.args], {
|
|
2211
|
+
env: { ...options.env, DISPLAY: display },
|
|
2212
|
+
stdio: "ignore"
|
|
2213
|
+
});
|
|
2214
|
+
let spawnFailed = false;
|
|
2215
|
+
child.on?.("error", () => {
|
|
2216
|
+
spawnFailed = true;
|
|
2217
|
+
});
|
|
2218
|
+
await new Promise((settle) => setTimeout(settle, COMPOSITOR_SETTLE_MS));
|
|
2219
|
+
if (spawnFailed) return void 0;
|
|
2220
|
+
if ((child.exitCode ?? null) !== null || (child.signalCode ?? null) !== null) return void 0;
|
|
2221
|
+
return { child, name: choice.name };
|
|
2222
|
+
}
|
|
2223
|
+
var XVFB_DISPLAY_TIMEOUT_MS = 3e4;
|
|
2224
|
+
async function readXvfbDisplayNumber(xvfb) {
|
|
2225
|
+
const report = xvfb.stdio[3];
|
|
2226
|
+
if (report === null || report === void 0 || typeof report.on !== "function") {
|
|
2227
|
+
throw new Error("Xvfb was spawned without a display-report descriptor to read.");
|
|
2228
|
+
}
|
|
2229
|
+
const stream = report;
|
|
2230
|
+
return new Promise((resolveDisplay, rejectDisplay) => {
|
|
2231
|
+
let settled = false;
|
|
2232
|
+
const finish = (settle) => {
|
|
2233
|
+
if (settled) return;
|
|
2234
|
+
settled = true;
|
|
2235
|
+
clearTimeout(timer);
|
|
2236
|
+
stream.removeListener("data", onData);
|
|
2237
|
+
stream.removeListener("close", onClose);
|
|
2238
|
+
settle();
|
|
2239
|
+
};
|
|
2240
|
+
const onData = (chunk) => {
|
|
2241
|
+
const number = Number.parseInt(String(chunk).trim(), 10);
|
|
2242
|
+
if (Number.isInteger(number) && number >= 0) finish(() => resolveDisplay(number));
|
|
2243
|
+
};
|
|
2244
|
+
const onClose = () => finish(() => rejectDisplay(new Error("Xvfb exited before it reported a display.")));
|
|
2245
|
+
const timer = setTimeout(() => finish(() => {
|
|
2246
|
+
rejectDisplay(new Error(`Xvfb did not report a display within ${XVFB_DISPLAY_TIMEOUT_MS}ms.`));
|
|
2247
|
+
}), XVFB_DISPLAY_TIMEOUT_MS);
|
|
2248
|
+
stream.on("data", onData);
|
|
2249
|
+
stream.on("close", onClose);
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
async function stopChild(child) {
|
|
2253
|
+
const exitedAlready = () => (child.exitCode ?? null) !== null || (child.signalCode ?? null) !== null;
|
|
2254
|
+
if (exitedAlready()) return;
|
|
2255
|
+
child.kill("SIGTERM");
|
|
2256
|
+
const started = Date.now();
|
|
2257
|
+
while (Date.now() - started < 1e3 && !exitedAlready()) {
|
|
2258
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, 25));
|
|
2259
|
+
}
|
|
2260
|
+
if (!exitedAlready()) child.kill("SIGKILL");
|
|
2261
|
+
}
|
|
2262
|
+
function defaultCommandExists(command) {
|
|
2263
|
+
const paths = (process.env.PATH ?? "").split(":").filter((segment) => segment.length > 0);
|
|
2264
|
+
return paths.some((directory) => existsSync(join(directory, command)));
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
// src/evaluators/frame-cost.ts
|
|
2268
|
+
var FRAME_BUDGET = "TN_FRAME_BUDGET:";
|
|
2269
|
+
function frameDisplay(env = process.env, platform = process.platform) {
|
|
2270
|
+
return platform === "linux" && !hostDisplayRequested(env) ? "virtual" : "real";
|
|
2271
|
+
}
|
|
2272
|
+
function foreignGpuProcesses(ownPid = process.pid, procRoot = "/proc", platform = process.platform) {
|
|
2273
|
+
if (platform !== "linux") return [];
|
|
2274
|
+
const read = (pid, file) => {
|
|
2275
|
+
try {
|
|
2276
|
+
return readFileSync(join(procRoot, pid, file), "utf8");
|
|
2277
|
+
} catch {
|
|
2278
|
+
return void 0;
|
|
2279
|
+
}
|
|
2280
|
+
};
|
|
2281
|
+
const parentOf = (pid) => {
|
|
2282
|
+
const stat4 = read(String(pid), "stat");
|
|
2283
|
+
const ppid = stat4 === void 0 ? void 0 : Number(stat4.slice(stat4.lastIndexOf(")") + 2).split(" ")[1]);
|
|
2284
|
+
return ppid === void 0 || !Number.isSafeInteger(ppid) ? void 0 : ppid;
|
|
2285
|
+
};
|
|
2286
|
+
const ours = (pid) => {
|
|
2287
|
+
for (let current = pid, hops = 0; current !== void 0 && current > 1 && hops < 64; hops++) {
|
|
2288
|
+
if (current === ownPid) return true;
|
|
2289
|
+
current = parentOf(current);
|
|
2290
|
+
}
|
|
2291
|
+
return false;
|
|
2292
|
+
};
|
|
2293
|
+
return readdirSync(procRoot).filter((entry) => {
|
|
2294
|
+
const argv = /^\d+$/u.test(entry) ? (read(entry, "cmdline") ?? "").split("\0") : [];
|
|
2295
|
+
return argv.includes("--type=gpu-process") && (argv[0] ?? "").includes("ms-playwright");
|
|
2296
|
+
}).map(Number).filter((pid) => !ours(pid)).sort((a, b) => a - b);
|
|
2297
|
+
}
|
|
2298
|
+
var MIN_GPU_SAMPLES = 3;
|
|
2299
|
+
function gpuWindows(consoleLines) {
|
|
2300
|
+
const windows = [];
|
|
2301
|
+
let samples;
|
|
2302
|
+
for (const line of consoleLines) {
|
|
2303
|
+
if (typeof line !== "string") continue;
|
|
2304
|
+
const at = line.indexOf(FRAME_BUDGET);
|
|
2305
|
+
if (at === -1) continue;
|
|
2306
|
+
let report;
|
|
2307
|
+
try {
|
|
2308
|
+
report = JSON.parse(line.slice(at + FRAME_BUDGET.length));
|
|
2309
|
+
} catch {
|
|
2310
|
+
continue;
|
|
2311
|
+
}
|
|
2312
|
+
const p95 = report.gpu?.p95;
|
|
2313
|
+
if (typeof p95 === "number" && Number.isFinite(p95) && (typeof report.gpu?.samples !== "number" || report.gpu.samples > 0)) {
|
|
2314
|
+
windows.push(p95);
|
|
2315
|
+
samples = typeof report.gpu?.samples === "number" ? report.gpu.samples : void 0;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
return windows.length === 0 ? { windows } : { p95: windows[windows.length - 1], ...samples === void 0 ? {} : { samples }, windows };
|
|
2319
|
+
}
|
|
1962
2320
|
|
|
1963
2321
|
// src/evaluators/render-evidence.ts
|
|
1964
2322
|
function projectedPixelsForEntity(snapshot, entity, viewport) {
|
|
@@ -1977,7 +2335,7 @@ function countMatchingEntries(effectLog, tokens) {
|
|
|
1977
2335
|
return tokens.every((token) => text.includes(token));
|
|
1978
2336
|
}).length;
|
|
1979
2337
|
}
|
|
1980
|
-
function evaluatePerformanceAssertion(assertion, series, sourcePath) {
|
|
2338
|
+
function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
|
|
1981
2339
|
const samples = series ?? [];
|
|
1982
2340
|
const validSamples = samples.length > 0 && samples.every(isRuntimeDiagnosticsSample);
|
|
1983
2341
|
const observed = validSamples ? samples : [];
|
|
@@ -2018,13 +2376,17 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath) {
|
|
|
2018
2376
|
});
|
|
2019
2377
|
};
|
|
2020
2378
|
if (assertion.maxFrameMsP95 !== void 0) {
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2379
|
+
if (lane === void 0) {
|
|
2380
|
+
addBound(
|
|
2381
|
+
"performance.maxFrameMsP95",
|
|
2382
|
+
assertion.maxFrameMsP95,
|
|
2383
|
+
frameMsP95,
|
|
2384
|
+
"ms",
|
|
2385
|
+
samplesPass && frameMsP95 !== void 0 && frameMsP95 <= assertion.maxFrameMsP95
|
|
2386
|
+
);
|
|
2387
|
+
} else {
|
|
2388
|
+
emitFrameBound(assertion.maxFrameMsP95, frameMsP95, observed, samples.length, samplesPass, lane, results, diagnostics, path2, sourcePath);
|
|
2389
|
+
}
|
|
2028
2390
|
}
|
|
2029
2391
|
if (assertion.maxDrawCalls !== void 0) {
|
|
2030
2392
|
addBound(
|
|
@@ -2111,16 +2473,64 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath) {
|
|
|
2111
2473
|
addPassBound("triangles", kind, ceiling);
|
|
2112
2474
|
return { assertions: results, diagnostics };
|
|
2113
2475
|
}
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
}
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2476
|
+
var HITCH_MS = 2e3;
|
|
2477
|
+
var XVFB_CADENCE = "display cadence, not gated: the runner's private Xvfb paces frames on its own timer, not the game's cost";
|
|
2478
|
+
function emitFrameBound(ceiling, intervalP95, observed, sampleCount, samplesPass, lane, results, diagnostics, path2, sourcePath) {
|
|
2479
|
+
const cpu = observed.flatMap(({ phases }) => phases === void 0 || typeof phases.update !== "number" || typeof phases.render !== "number" ? [] : [phases.update + phases.render]);
|
|
2480
|
+
const hitches = observed.filter(({ frameMs, phases }) => phases === void 0 && frameMs >= HITCH_MS).length;
|
|
2481
|
+
const cpuP95 = cpu.length > 0 && cpu.length + hitches === sampleCount ? nearestRank(cpu, 0.95) : void 0;
|
|
2482
|
+
const missing = [
|
|
2483
|
+
...cpuP95 === void 0 ? ["the CPU frame split (phases.update and phases.render)"] : [],
|
|
2484
|
+
...lane.gpuP95 === void 0 ? ["the GPU time (a TN_FRAME_BUDGET window with a gpu reading)"] : []
|
|
2485
|
+
];
|
|
2486
|
+
const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
|
|
2487
|
+
const virtual = lane.display === "virtual";
|
|
2488
|
+
const costPass = costP95 !== void 0 && costP95 <= ceiling;
|
|
2489
|
+
const intervalPass = virtual || intervalP95 !== void 0 && intervalP95 <= ceiling;
|
|
2490
|
+
const thinGpu = lane.gpuP95 !== void 0 && !(lane.gpuSamples !== void 0 && lane.gpuSamples >= MIN_GPU_SAMPLES);
|
|
2491
|
+
const pass = samplesPass && costPass && intervalPass && !thinGpu;
|
|
2492
|
+
const round2 = (value) => value === void 0 ? null : Math.round(value * 100) / 100;
|
|
2493
|
+
results.push({
|
|
2494
|
+
details: {
|
|
2495
|
+
actual: round2(virtual || !costPass ? costP95 : intervalP95),
|
|
2496
|
+
cost: { cpuP95: round2(cpuP95), gpuP95: round2(lane.gpuP95), gpuSamples: lane.gpuSamples ?? null, hitchFrames: hitches, p95: round2(costP95) },
|
|
2497
|
+
display: lane.display,
|
|
2498
|
+
expected: ceiling,
|
|
2499
|
+
interval: virtual ? { gated: false, p95: round2(intervalP95), reason: XVFB_CADENCE } : { gated: true, p95: round2(intervalP95) },
|
|
2500
|
+
sampleCount,
|
|
2501
|
+
unit: "ms"
|
|
2502
|
+
},
|
|
2503
|
+
id: "performance.maxFrameMsP95",
|
|
2504
|
+
pass
|
|
2505
|
+
});
|
|
2506
|
+
if (pass) return;
|
|
2507
|
+
const foreign = lane.foreignGpu ?? [];
|
|
2508
|
+
const contended = missing.length === 0 && !costPass && foreign.length > 0;
|
|
2509
|
+
const detail = missing.length > 0 ? `cannot be judged: the run did not measure ${missing.join(" or ")}` : !costPass ? `cost p95 ${round2(costP95)} ms (CPU ${round2(cpuP95)}, GPU ${round2(lane.gpuP95)}) is over ${ceiling} ms${contended ? ` while ${foreign.length} other GPU process${foreign.length === 1 ? "" : "es"} ran (${foreign.join(", ")})` : ""}` : `rAF interval p95 ${round2(intervalP95)} ms on a real display is over ${ceiling} ms`;
|
|
2510
|
+
const fewSamples = missing.length === 0 && costPass && thinGpu;
|
|
2511
|
+
diagnostics.push({
|
|
2512
|
+
code: fewSamples ? "TN_PLAYTEST_PERF_FEW_GPU_SAMPLES" : "TN_PLAYTEST_PERFORMANCE_ASSERTION_FAILED",
|
|
2513
|
+
message: `performance.maxFrameMsP95 ${fewSamples ? fewGpuSamples(lane.gpuSamples) : detail}.`,
|
|
2514
|
+
observedRuntimePath: path2,
|
|
2515
|
+
severity: "error",
|
|
2516
|
+
sourcePath,
|
|
2517
|
+
suggestion: fewSamples ? "Keep the scene moving through the judged window (hold a move input or loop a route): the engine skips static frames and takes no GPU sample on them." : contended ? "Other GPU work shared this measurement, so the cost holds its load too: rerun this scenario when they exit, before you change the game. A contended number is not the game's cost, so do not trade its look to pass it." : missing.length > 0 ? "Keep the engine frame budget installed and run on an adapter with timestamp queries: an unmeasured cost is not a zero." : "Read the TN_FRAME_BUDGET marker for this run: it names which frame phase or GPU pass owns the time."
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
function fewGpuSamples(samples) {
|
|
2521
|
+
const held = samples === void 0 ? "reports no sample count" : `holds ${samples} GPU sample${samples === 1 ? "" : "s"}`;
|
|
2522
|
+
return `cannot be judged: the latest GPU window ${held}, under the minimum of ${MIN_GPU_SAMPLES}`;
|
|
2523
|
+
}
|
|
2524
|
+
function isRuntimeDiagnosticsSample(value) {
|
|
2525
|
+
if (!isRecord(value) || typeof value.frameMs !== "number" || !Number.isFinite(value.frameMs) || value.frameMs <= 0) {
|
|
2526
|
+
return false;
|
|
2527
|
+
}
|
|
2528
|
+
return (value.drawCalls === void 0 || typeof value.drawCalls === "number" && Number.isFinite(value.drawCalls) && value.drawCalls >= 0) && (value.triangles === void 0 || typeof value.triangles === "number" && Number.isFinite(value.triangles) && value.triangles >= 0) && isFramePhaseSplit(value.phases) && isFramePassSplit(value.passes);
|
|
2529
|
+
}
|
|
2530
|
+
function isFramePassSplit(value) {
|
|
2531
|
+
if (value === void 0) return true;
|
|
2532
|
+
if (!Array.isArray(value)) return false;
|
|
2533
|
+
return value.every(
|
|
2124
2534
|
(pass) => isRecord(pass) && PLAYTEST_FRAME_PASS_KINDS.includes(pass.kind) && typeof pass.draws === "number" && Number.isFinite(pass.draws) && pass.draws >= 0 && typeof pass.triangles === "number" && Number.isFinite(pass.triangles) && pass.triangles >= 0
|
|
2125
2535
|
);
|
|
2126
2536
|
}
|
|
@@ -2429,6 +2839,17 @@ function emitEvidenceFamilies(ctx) {
|
|
|
2429
2839
|
const pass = observed !== void 0 && observed.nonblankPixelRatio >= minimum;
|
|
2430
2840
|
assertions.push({ id: `visual.${index}.region`, pass, details: { after: pass, expected: { equals: true }, minimum, observed: observed?.nonblankPixelRatio } });
|
|
2431
2841
|
if (!pass) diagnostics.push({ code: "TN_PLAYTEST_REGION_BLANK", message: `Screenshot region at (${staticRegion.x}, ${staticRegion.y}) did not meet nonblank ratio ${minimum}.`, severity: "error", suggestion: "Check camera framing and whether expected geometry renders in the asserted region." });
|
|
2842
|
+
if (staticRegion.minSharpness !== void 0) {
|
|
2843
|
+
const sharpness = observed?.sharpness;
|
|
2844
|
+
const sharpPass = sharpness !== void 0 && sharpness >= staticRegion.minSharpness;
|
|
2845
|
+
assertions.push({ id: `visual.${index}.region.sharpness`, pass: sharpPass, details: { minimum: staticRegion.minSharpness, observed: sharpness ?? null } });
|
|
2846
|
+
if (!sharpPass) diagnostics.push({
|
|
2847
|
+
code: "TN_PLAYTEST_REGION_BLURRED",
|
|
2848
|
+
message: `Screenshot region at (${staticRegion.x}, ${staticRegion.y}) measured sharpness ${sharpness === void 0 ? "unavailable" : sharpness.toFixed(3)}, below the floor ${staticRegion.minSharpness} (luminance Laplacian variance at full resolution over half resolution).`,
|
|
2849
|
+
severity: "error",
|
|
2850
|
+
suggestion: "A post stage that smears the frame (motion blur at rest, a blur or low-resolution pass) or a surface with no detail drops this. Capture the frame and fix the stage; do not lower the floor to pass."
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2432
2853
|
if (staticRegion.minDarkPixelRatio !== void 0) {
|
|
2433
2854
|
const darkPass = observed?.darkPixelRatio !== void 0 && observed.darkPixelRatio >= staticRegion.minDarkPixelRatio;
|
|
2434
2855
|
assertions.push({
|
|
@@ -2491,12 +2912,14 @@ function emitMovementEvidence(ctx) {
|
|
|
2491
2912
|
scenarioAssertions.diagnostics,
|
|
2492
2913
|
input.report.target
|
|
2493
2914
|
);
|
|
2915
|
+
const warningTexts = perfWarnings((input.report.observations?.console ?? []).map(({ text }) => text));
|
|
2494
2916
|
const policyDiagnostics = evaluateDiagnosticsPolicy(input.report, diagnosticsPolicy);
|
|
2495
2917
|
diagnostics.push(...policyDiagnostics);
|
|
2496
2918
|
assertions.push({
|
|
2497
2919
|
details: {
|
|
2498
2920
|
consoleErrors: consoleErrors(input.report.observations?.console ?? []).length,
|
|
2499
2921
|
networkErrors: input.report.observations?.network.length ?? 0,
|
|
2922
|
+
...warningTexts.length === 0 ? {} : { perfWarnings: warningTexts },
|
|
2500
2923
|
policy: diagnosticsPolicy,
|
|
2501
2924
|
runtimeDiagnostics: runtimeDiagnostics(input.report.observations?.runtimeDiagnostics).length
|
|
2502
2925
|
},
|
|
@@ -2907,7 +3330,8 @@ function emitMovementEvidence(ctx) {
|
|
|
2907
3330
|
}
|
|
2908
3331
|
for (const assertion of scenarioAssertions.animation ?? []) {
|
|
2909
3332
|
const entity = assertion.entity ?? input.scenario.subject ?? input.report.entity;
|
|
2910
|
-
const
|
|
3333
|
+
const stepAnimation = runtimeGameplayAtStep(input.report.observations?.runtimeObservations, assertion.atStep)?.animation;
|
|
3334
|
+
const runtime = assertion.atStep === void 0 ? runtimeAnimationObservations(input.report.observations?.runtimeObservations) : isRecord(stepAnimation) ? stepAnimation : void 0;
|
|
2911
3335
|
if (runtime !== void 0) {
|
|
2912
3336
|
const observed = isRecord(runtime[entity]) ? runtime[entity] : void 0;
|
|
2913
3337
|
const clip = typeof observed?.clip === "string" ? observed.clip : void 0;
|
|
@@ -3270,19 +3694,206 @@ function emitParity(ctx) {
|
|
|
3270
3694
|
}
|
|
3271
3695
|
}
|
|
3272
3696
|
|
|
3697
|
+
// src/runner/browser.ts
|
|
3698
|
+
var WEBGPU_BROWSER_ARGS = [
|
|
3699
|
+
"--ozone-platform=x11",
|
|
3700
|
+
"--enable-unsafe-webgpu",
|
|
3701
|
+
"--disable-gpu-sandbox",
|
|
3702
|
+
"--ignore-gpu-blocklist",
|
|
3703
|
+
// Keep Vulkan available on both hardware and software adapters.
|
|
3704
|
+
"--enable-features=Vulkan"
|
|
3705
|
+
// No forced ANGLE/Vulkan (--use-angle=vulkan --use-vulkan --disable-vulkan-surface): on a KDE
|
|
3706
|
+
// Xwayland host display it blacked out the sky while the same NVIDIA adapter drew it without them.
|
|
3707
|
+
];
|
|
3708
|
+
var PERFORMANCE_BROWSER_ARGS = [
|
|
3709
|
+
"--disable-frame-rate-limit",
|
|
3710
|
+
"--disable-gpu-vsync"
|
|
3711
|
+
];
|
|
3712
|
+
function measurementBrowserArgs(performance2, completion, display, gameThread = "page") {
|
|
3713
|
+
const args = completion || performance2 && display === "virtual" ? PERFORMANCE_BROWSER_ARGS : [];
|
|
3714
|
+
return gameThread === "worker" ? args.filter((argument) => argument !== "--disable-frame-rate-limit") : args;
|
|
3715
|
+
}
|
|
3716
|
+
function resolveBrowserArguments(browserArgs) {
|
|
3717
|
+
return [...browserArgs ?? []];
|
|
3718
|
+
}
|
|
3719
|
+
var SOFTWARE_ADAPTER = /swiftshader|llvmpipe|lavapipe|softwarerasterizer|software adapter|basic render/i;
|
|
3720
|
+
function softwareAdapterName(adapter) {
|
|
3721
|
+
if (adapter === void 0) return void 0;
|
|
3722
|
+
for (const value of Object.values(adapter)) {
|
|
3723
|
+
if (typeof value === "string" && SOFTWARE_ADAPTER.test(value)) return value;
|
|
3724
|
+
}
|
|
3725
|
+
return void 0;
|
|
3726
|
+
}
|
|
3727
|
+
function reconcileBrowserPointers(previous, next) {
|
|
3728
|
+
const normalized = new Map(next.map((pointer) => [pointer.id, {
|
|
3729
|
+
buttons: pointer.buttons ?? 1,
|
|
3730
|
+
id: pointer.id,
|
|
3731
|
+
x: pointer.x,
|
|
3732
|
+
y: pointer.y
|
|
3733
|
+
}]));
|
|
3734
|
+
const previousPrimary = previous.keys().next().value;
|
|
3735
|
+
const nextPrimary = normalized.keys().next().value;
|
|
3736
|
+
const changes = [];
|
|
3737
|
+
for (const pointer of previous.values()) {
|
|
3738
|
+
if (!normalized.has(pointer.id)) {
|
|
3739
|
+
changes.push({ isPrimary: pointer.id === previousPrimary, pointer: { ...pointer, buttons: 0 }, type: "pointerup" });
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
for (const pointer of normalized.values()) {
|
|
3743
|
+
const old = previous.get(pointer.id);
|
|
3744
|
+
if (old === void 0) {
|
|
3745
|
+
changes.push({ isPrimary: pointer.id === nextPrimary, pointer, type: "pointerdown" });
|
|
3746
|
+
} else if (old.x !== pointer.x || old.y !== pointer.y || old.buttons !== pointer.buttons) {
|
|
3747
|
+
changes.push({ isPrimary: pointer.id === nextPrimary, pointer, type: "pointermove" });
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
return changes;
|
|
3751
|
+
}
|
|
3752
|
+
|
|
3753
|
+
// src/evaluators/adapter-class.ts
|
|
3754
|
+
function classifyAdapter(report) {
|
|
3755
|
+
const capture = report.capture;
|
|
3756
|
+
if (capture === void 0 || capture.rendererKind !== "webgpu") return {};
|
|
3757
|
+
if (adapterIdentity(capture.adapter) === void 0) return {};
|
|
3758
|
+
const software = softwareAdapterName(capture.adapter);
|
|
3759
|
+
if (software !== void 0) return { adapterClass: "software", softwareAdapter: software };
|
|
3760
|
+
const gpuFamily = gpuFamilyOf(capture.adapter);
|
|
3761
|
+
return gpuFamily === void 0 ? { adapterClass: "hardware" } : { adapterClass: "hardware", gpuFamily };
|
|
3762
|
+
}
|
|
3763
|
+
var ADAPTER_IDENTITY_KEYS = ["architecture", "description", "device", "vendor"];
|
|
3764
|
+
function adapterIdentity(adapter) {
|
|
3765
|
+
if (adapter === void 0) return void 0;
|
|
3766
|
+
for (const key of ADAPTER_IDENTITY_KEYS) {
|
|
3767
|
+
const value = adapter[key];
|
|
3768
|
+
if (typeof value === "string" && value.trim() !== "") return value;
|
|
3769
|
+
}
|
|
3770
|
+
return void 0;
|
|
3771
|
+
}
|
|
3772
|
+
var MALI_MODEL = /\bmali[\s_-]*g?[\s-]*(\d{2,3})/i;
|
|
3773
|
+
var ADRENO_MODEL = /\badreno\W*(?:tm\W*)?(\d)(\d\d|xx)/i;
|
|
3774
|
+
var AMD_INTEGRATED = /radeon(?:\(tm\))?\s+(?:graphics|\d{3}m)\b/i;
|
|
3775
|
+
var INTEL_DISCRETE = /\barc\b|xe2?-hpg|battlemage|alchemist/i;
|
|
3776
|
+
var FAMILY_RULES = [
|
|
3777
|
+
({ architecture, description, device }) => {
|
|
3778
|
+
const number = [description, device, architecture].map((value) => MALI_MODEL.exec(value)?.[1]).find((value) => value !== void 0);
|
|
3779
|
+
if (number === void 0) return void 0;
|
|
3780
|
+
const model = Number(number);
|
|
3781
|
+
if (model >= 710) return "mobile-high";
|
|
3782
|
+
return model < 57 || model === 71 || model === 72 ? "mobile-low" : "mobile-mid";
|
|
3783
|
+
},
|
|
3784
|
+
({ architecture, vendor }) => {
|
|
3785
|
+
if (!/\barm\b/i.test(vendor)) return void 0;
|
|
3786
|
+
if (/midgard|bifrost/i.test(architecture)) return "mobile-low";
|
|
3787
|
+
if (/valhall/i.test(architecture)) return "mobile-mid";
|
|
3788
|
+
return /5th-?gen|immortalis/i.test(architecture) ? "mobile-high" : void 0;
|
|
3789
|
+
},
|
|
3790
|
+
({ architecture, description, device }) => {
|
|
3791
|
+
const match = [description, device, architecture].map((value) => ADRENO_MODEL.exec(value)).find((value) => value !== null && value !== void 0);
|
|
3792
|
+
if (match === null || match === void 0) return void 0;
|
|
3793
|
+
const generation = Number(match[1]);
|
|
3794
|
+
if (generation <= 4) return "mobile-low";
|
|
3795
|
+
if (generation === 5) return "mobile-mid";
|
|
3796
|
+
if (generation === 6) return match[2] !== "xx" && Number(match[2]) >= 30 ? "mobile-high" : "mobile-mid";
|
|
3797
|
+
return "mobile-high";
|
|
3798
|
+
},
|
|
3799
|
+
({ architecture, description, device, vendor }) => /nvidia/i.test(vendor) && ![architecture, description, device].some((value) => /tegra/i.test(value)) ? "discrete" : void 0,
|
|
3800
|
+
({ architecture, description, device, vendor }) => {
|
|
3801
|
+
if (!/intel/i.test(vendor)) return void 0;
|
|
3802
|
+
return [architecture, description, device].some((value) => INTEL_DISCRETE.test(value)) ? "discrete" : "integrated";
|
|
3803
|
+
},
|
|
3804
|
+
// An APU and a card share an architecture name, so an AMD adapter that names no iGPU is `discrete`.
|
|
3805
|
+
({ description, vendor }) => /\b(?:amd|ati)\b/i.test(vendor) ? AMD_INTEGRATED.test(description) ? "integrated" : "discrete" : void 0
|
|
3806
|
+
];
|
|
3807
|
+
function gpuFamilyOf(adapter) {
|
|
3808
|
+
if (adapter === void 0) return void 0;
|
|
3809
|
+
const field = (key) => {
|
|
3810
|
+
const value = adapter[key];
|
|
3811
|
+
return typeof value === "string" ? value : "";
|
|
3812
|
+
};
|
|
3813
|
+
const fields = {
|
|
3814
|
+
architecture: field("architecture"),
|
|
3815
|
+
description: field("description"),
|
|
3816
|
+
device: field("device"),
|
|
3817
|
+
vendor: field("vendor")
|
|
3818
|
+
};
|
|
3819
|
+
for (const rule of FAMILY_RULES) {
|
|
3820
|
+
const family = rule(fields);
|
|
3821
|
+
if (family !== void 0) return family;
|
|
3822
|
+
}
|
|
3823
|
+
return void 0;
|
|
3824
|
+
}
|
|
3825
|
+
function adapterFieldsFromIdentity(identity) {
|
|
3826
|
+
if (typeof identity !== "string") return void 0;
|
|
3827
|
+
const prefix = "webgpu:";
|
|
3828
|
+
if (!identity.startsWith(prefix)) return void 0;
|
|
3829
|
+
const fields = /* @__PURE__ */ Object.create(null);
|
|
3830
|
+
for (const pair of identity.slice(prefix.length).split("|")) {
|
|
3831
|
+
const separator = pair.indexOf("=");
|
|
3832
|
+
if (separator <= 0) return void 0;
|
|
3833
|
+
const key = pair.slice(0, separator);
|
|
3834
|
+
if (!ADAPTER_IDENTITY_KEYS.includes(key) || Object.hasOwn(fields, key)) {
|
|
3835
|
+
return void 0;
|
|
3836
|
+
}
|
|
3837
|
+
let value;
|
|
3838
|
+
try {
|
|
3839
|
+
value = decodeURIComponent(pair.slice(separator + 1));
|
|
3840
|
+
} catch {
|
|
3841
|
+
return void 0;
|
|
3842
|
+
}
|
|
3843
|
+
if (value.trim() === "") return void 0;
|
|
3844
|
+
fields[key] = value;
|
|
3845
|
+
}
|
|
3846
|
+
if (Object.keys(fields).length === 0) return void 0;
|
|
3847
|
+
return fields;
|
|
3848
|
+
}
|
|
3849
|
+
function nativeCaptureProvenance(census, target, viewport) {
|
|
3850
|
+
if (census === void 0 || census === null || typeof census !== "object" || Array.isArray(census)) return void 0;
|
|
3851
|
+
const adapterRecord = census.adapter;
|
|
3852
|
+
if (adapterRecord === void 0 || adapterRecord === null || typeof adapterRecord !== "object" || Array.isArray(adapterRecord)) return void 0;
|
|
3853
|
+
const adapter = adapterFieldsFromIdentity(adapterRecord.identity);
|
|
3854
|
+
if (adapter === void 0) return void 0;
|
|
3855
|
+
return {
|
|
3856
|
+
adapter,
|
|
3857
|
+
// A native launch carries no browser command line; there is no argument list to report and
|
|
3858
|
+
// inventing one would be a flag nobody can check.
|
|
3859
|
+
browserArgs: [],
|
|
3860
|
+
captureMethod: "device.screenshot",
|
|
3861
|
+
rendererKind: "webgpu",
|
|
3862
|
+
target,
|
|
3863
|
+
viewport
|
|
3864
|
+
};
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3273
3867
|
// src/evaluators/perf-signals-world.ts
|
|
3868
|
+
function gpuLane(consoleTexts) {
|
|
3869
|
+
const { p95, samples } = gpuWindows(consoleTexts);
|
|
3870
|
+
return p95 === void 0 ? {} : { gpuP95: p95, ...samples === void 0 ? {} : { gpuSamples: samples } };
|
|
3871
|
+
}
|
|
3274
3872
|
function emitPerfSignalsWorld(ctx) {
|
|
3275
3873
|
const { assertions, diagnostics } = ctx;
|
|
3276
3874
|
const { input, scenarioAssertions } = ctx;
|
|
3277
3875
|
emitTerrainResidency(input.report.observations?.components?.terrain, assertions, diagnostics);
|
|
3278
3876
|
if (scenarioAssertions.performance !== void 0) {
|
|
3877
|
+
const budget = frameBudget(scenarioAssertions.performance.maxFrameMsP95, classifyAdapter(input.report), scenarioAssertions.performance.maxFrameMsReason);
|
|
3279
3878
|
const result = evaluatePerformanceAssertion(
|
|
3280
|
-
scenarioAssertions.performance,
|
|
3879
|
+
budget.maxFrameMsP95 === void 0 ? scenarioAssertions.performance : { ...scenarioAssertions.performance, maxFrameMsP95: budget.maxFrameMsP95 },
|
|
3281
3880
|
input.report.observations?.performanceSeries,
|
|
3282
|
-
input.scenario.sourcePath
|
|
3881
|
+
input.scenario.sourcePath,
|
|
3882
|
+
{ display: frameDisplay(), foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
|
|
3283
3883
|
);
|
|
3284
|
-
assertions.push(...result.assertions);
|
|
3884
|
+
assertions.push(...result.assertions.map((row) => row.id === "performance.samples" || row.id === "performance.maxFrameMsP95" ? { ...row, details: { ...row.details, frameBudget: budget } } : row));
|
|
3285
3885
|
diagnostics.push(...result.diagnostics);
|
|
3886
|
+
if (budget.unmeasurable === true) {
|
|
3887
|
+
assertions.push({ details: { frameBudget: budget }, id: "performance.maxFrameMsP95", pass: false });
|
|
3888
|
+
diagnostics.push({
|
|
3889
|
+
code: "TN_PLAYTEST_PERFORMANCE_UNMEASURABLE",
|
|
3890
|
+
message: `performance.maxFrameMsP95 cannot be judged: ${budget.reason}.`,
|
|
3891
|
+
observedRuntimePath: `${input.scenario.sourcePath ?? "playtest"}/observations.json/performanceSeries`,
|
|
3892
|
+
severity: "error",
|
|
3893
|
+
sourcePath: input.scenario.sourcePath,
|
|
3894
|
+
suggestion: "Run the scenario on a hardware GPU, or set maxFrameMsP95 with a maxFrameMsReason that names the adapter."
|
|
3895
|
+
});
|
|
3896
|
+
}
|
|
3286
3897
|
}
|
|
3287
3898
|
for (const assertion of scenarioAssertions.resources ?? []) {
|
|
3288
3899
|
if (assertion.anyOf !== void 0) {
|
|
@@ -3326,7 +3937,7 @@ function emitPerfSignalsWorld(ctx) {
|
|
|
3326
3937
|
const samples = assertion.atSteps.map((expected) => {
|
|
3327
3938
|
const sample = (input.report.observations?.resourceSeries ?? []).find((candidate) => candidate.label === expected.label);
|
|
3328
3939
|
const value = readPath(sample?.snapshots[assertion.id], assertion.path);
|
|
3329
|
-
const pass2 = sample !== void 0 && (!Object.hasOwn(expected, "equals") || jsonEqual(value, expected.equals)) && (expected.textIncludes === void 0 || String(textValue(value)).includes(expected.textIncludes));
|
|
3940
|
+
const pass2 = sample !== void 0 && (!Object.hasOwn(expected, "equals") || jsonEqual(value, expected.equals)) && (expected.lte === void 0 || typeof value === "number" && value <= expected.lte) && (expected.textIncludes === void 0 || String(textValue(value)).includes(expected.textIncludes));
|
|
3330
3941
|
return { expected, pass: pass2, value };
|
|
3331
3942
|
});
|
|
3332
3943
|
const pass = samples.every((sample) => sample.pass);
|
|
@@ -3411,6 +4022,20 @@ function emitTerrainResidency(component, assertions, diagnostics) {
|
|
|
3411
4022
|
suggestion: "Expose TerrainTiles.debug() through the terrain entity and inspect the residency counters."
|
|
3412
4023
|
});
|
|
3413
4024
|
}
|
|
4025
|
+
var FRAME_BUDGET_MS = 16.7;
|
|
4026
|
+
function frameBudget(explicit, adapter, reason) {
|
|
4027
|
+
const identity = {
|
|
4028
|
+
...adapter.adapterClass === void 0 ? {} : { adapterClass: adapter.adapterClass },
|
|
4029
|
+
...adapter.gpuFamily === void 0 ? {} : { gpuFamily: adapter.gpuFamily }
|
|
4030
|
+
};
|
|
4031
|
+
if (explicit !== void 0) {
|
|
4032
|
+
return { ...identity, maxFrameMsP95: explicit, reason: `maxFrameMsP95 set in the scenario overrides ${FRAME_BUDGET_MS} ms${reason === void 0 ? "" : `: ${reason}`}`, source: "scenario" };
|
|
4033
|
+
}
|
|
4034
|
+
if (adapter.adapterClass === "software") {
|
|
4035
|
+
return { ...identity, reason: `software adapter ${adapter.softwareAdapter ?? ""} is unmeasurable: it cannot carry a frame rate`.replace(" ", " "), source: "adapter", unmeasurable: true };
|
|
4036
|
+
}
|
|
4037
|
+
return { ...identity, maxFrameMsP95: FRAME_BUDGET_MS, reason: `one 60 Hz frame (${FRAME_BUDGET_MS} ms) on every tier`, source: "adapter" };
|
|
4038
|
+
}
|
|
3414
4039
|
|
|
3415
4040
|
// src/evaluators/world-gameplay.ts
|
|
3416
4041
|
function emitWorldGameplay(ctx) {
|
|
@@ -3936,173 +4561,6 @@ function emitWorldTopology(value, assertions, diagnostics) {
|
|
|
3936
4561
|
}
|
|
3937
4562
|
}
|
|
3938
4563
|
|
|
3939
|
-
// src/runner/browser.ts
|
|
3940
|
-
var WEBGPU_BROWSER_ARGS = [
|
|
3941
|
-
"--ozone-platform=x11",
|
|
3942
|
-
"--enable-unsafe-webgpu",
|
|
3943
|
-
"--disable-gpu-sandbox",
|
|
3944
|
-
"--ignore-gpu-blocklist",
|
|
3945
|
-
// Keep Vulkan available on both hardware and software adapters.
|
|
3946
|
-
"--enable-features=Vulkan",
|
|
3947
|
-
// Forced ANGLE/Vulkan selects NVIDIA locally but breaks hosted software adapters, especially headed.
|
|
3948
|
-
// Apply that workaround only when the caller explicitly requests the host display.
|
|
3949
|
-
...typeof process !== "undefined" && process.env.TN_PLAYTEST_HOST_DISPLAY === "1" ? ["--use-angle=vulkan", "--use-vulkan", "--disable-vulkan-surface"] : []
|
|
3950
|
-
];
|
|
3951
|
-
var PERFORMANCE_BROWSER_ARGS = [
|
|
3952
|
-
"--disable-frame-rate-limit",
|
|
3953
|
-
"--disable-gpu-vsync"
|
|
3954
|
-
];
|
|
3955
|
-
function resolveBrowserArguments(browserArgs) {
|
|
3956
|
-
return [...browserArgs ?? []];
|
|
3957
|
-
}
|
|
3958
|
-
var SOFTWARE_ADAPTER = /swiftshader|llvmpipe|lavapipe|softwarerasterizer|software adapter|basic render/i;
|
|
3959
|
-
function softwareAdapterName(adapter) {
|
|
3960
|
-
if (adapter === void 0) return void 0;
|
|
3961
|
-
for (const value of Object.values(adapter)) {
|
|
3962
|
-
if (typeof value === "string" && SOFTWARE_ADAPTER.test(value)) return value;
|
|
3963
|
-
}
|
|
3964
|
-
return void 0;
|
|
3965
|
-
}
|
|
3966
|
-
function reconcileBrowserPointers(previous, next) {
|
|
3967
|
-
const normalized = new Map(next.map((pointer) => [pointer.id, {
|
|
3968
|
-
buttons: pointer.buttons ?? 1,
|
|
3969
|
-
id: pointer.id,
|
|
3970
|
-
x: pointer.x,
|
|
3971
|
-
y: pointer.y
|
|
3972
|
-
}]));
|
|
3973
|
-
const previousPrimary = previous.keys().next().value;
|
|
3974
|
-
const nextPrimary = normalized.keys().next().value;
|
|
3975
|
-
const changes = [];
|
|
3976
|
-
for (const pointer of previous.values()) {
|
|
3977
|
-
if (!normalized.has(pointer.id)) {
|
|
3978
|
-
changes.push({ isPrimary: pointer.id === previousPrimary, pointer: { ...pointer, buttons: 0 }, type: "pointerup" });
|
|
3979
|
-
}
|
|
3980
|
-
}
|
|
3981
|
-
for (const pointer of normalized.values()) {
|
|
3982
|
-
const old = previous.get(pointer.id);
|
|
3983
|
-
if (old === void 0) {
|
|
3984
|
-
changes.push({ isPrimary: pointer.id === nextPrimary, pointer, type: "pointerdown" });
|
|
3985
|
-
} else if (old.x !== pointer.x || old.y !== pointer.y || old.buttons !== pointer.buttons) {
|
|
3986
|
-
changes.push({ isPrimary: pointer.id === nextPrimary, pointer, type: "pointermove" });
|
|
3987
|
-
}
|
|
3988
|
-
}
|
|
3989
|
-
return changes;
|
|
3990
|
-
}
|
|
3991
|
-
|
|
3992
|
-
// src/evaluators/adapter-class.ts
|
|
3993
|
-
function classifyAdapter(report) {
|
|
3994
|
-
const capture = report.capture;
|
|
3995
|
-
if (capture === void 0 || capture.rendererKind !== "webgpu") return {};
|
|
3996
|
-
if (adapterIdentity(capture.adapter) === void 0) return {};
|
|
3997
|
-
const software = softwareAdapterName(capture.adapter);
|
|
3998
|
-
if (software !== void 0) return { adapterClass: "software", softwareAdapter: software };
|
|
3999
|
-
const gpuFamily = gpuFamilyOf(capture.adapter);
|
|
4000
|
-
return gpuFamily === void 0 ? { adapterClass: "hardware" } : { adapterClass: "hardware", gpuFamily };
|
|
4001
|
-
}
|
|
4002
|
-
var ADAPTER_IDENTITY_KEYS = ["architecture", "description", "device", "vendor"];
|
|
4003
|
-
function adapterIdentity(adapter) {
|
|
4004
|
-
if (adapter === void 0) return void 0;
|
|
4005
|
-
for (const key of ADAPTER_IDENTITY_KEYS) {
|
|
4006
|
-
const value = adapter[key];
|
|
4007
|
-
if (typeof value === "string" && value.trim() !== "") return value;
|
|
4008
|
-
}
|
|
4009
|
-
return void 0;
|
|
4010
|
-
}
|
|
4011
|
-
var MALI_MODEL = /\bmali[\s_-]*g?[\s-]*(\d{2,3})/i;
|
|
4012
|
-
var ADRENO_MODEL = /\badreno\W*(?:tm\W*)?(\d)(\d\d|xx)/i;
|
|
4013
|
-
var AMD_INTEGRATED = /radeon(?:\(tm\))?\s+(?:graphics|\d{3}m)\b/i;
|
|
4014
|
-
var INTEL_DISCRETE = /\barc\b|xe2?-hpg|battlemage|alchemist/i;
|
|
4015
|
-
var FAMILY_RULES = [
|
|
4016
|
-
({ architecture, description, device }) => {
|
|
4017
|
-
const number = [description, device, architecture].map((value) => MALI_MODEL.exec(value)?.[1]).find((value) => value !== void 0);
|
|
4018
|
-
if (number === void 0) return void 0;
|
|
4019
|
-
const model = Number(number);
|
|
4020
|
-
if (model >= 710) return "mobile-high";
|
|
4021
|
-
return model < 57 || model === 71 || model === 72 ? "mobile-low" : "mobile-mid";
|
|
4022
|
-
},
|
|
4023
|
-
({ architecture, vendor }) => {
|
|
4024
|
-
if (!/\barm\b/i.test(vendor)) return void 0;
|
|
4025
|
-
if (/midgard|bifrost/i.test(architecture)) return "mobile-low";
|
|
4026
|
-
if (/valhall/i.test(architecture)) return "mobile-mid";
|
|
4027
|
-
return /5th-?gen|immortalis/i.test(architecture) ? "mobile-high" : void 0;
|
|
4028
|
-
},
|
|
4029
|
-
({ architecture, description, device }) => {
|
|
4030
|
-
const match = [description, device, architecture].map((value) => ADRENO_MODEL.exec(value)).find((value) => value !== null && value !== void 0);
|
|
4031
|
-
if (match === null || match === void 0) return void 0;
|
|
4032
|
-
const generation = Number(match[1]);
|
|
4033
|
-
if (generation <= 4) return "mobile-low";
|
|
4034
|
-
if (generation === 5) return "mobile-mid";
|
|
4035
|
-
if (generation === 6) return match[2] !== "xx" && Number(match[2]) >= 30 ? "mobile-high" : "mobile-mid";
|
|
4036
|
-
return "mobile-high";
|
|
4037
|
-
},
|
|
4038
|
-
({ architecture, description, device, vendor }) => /nvidia/i.test(vendor) && ![architecture, description, device].some((value) => /tegra/i.test(value)) ? "discrete" : void 0,
|
|
4039
|
-
({ architecture, description, device, vendor }) => {
|
|
4040
|
-
if (!/intel/i.test(vendor)) return void 0;
|
|
4041
|
-
return [architecture, description, device].some((value) => INTEL_DISCRETE.test(value)) ? "discrete" : "integrated";
|
|
4042
|
-
},
|
|
4043
|
-
// An APU and a card share an architecture name, so an AMD adapter that names no iGPU is `discrete`.
|
|
4044
|
-
({ description, vendor }) => /\b(?:amd|ati)\b/i.test(vendor) ? AMD_INTEGRATED.test(description) ? "integrated" : "discrete" : void 0
|
|
4045
|
-
];
|
|
4046
|
-
function gpuFamilyOf(adapter) {
|
|
4047
|
-
if (adapter === void 0) return void 0;
|
|
4048
|
-
const field = (key) => {
|
|
4049
|
-
const value = adapter[key];
|
|
4050
|
-
return typeof value === "string" ? value : "";
|
|
4051
|
-
};
|
|
4052
|
-
const fields = {
|
|
4053
|
-
architecture: field("architecture"),
|
|
4054
|
-
description: field("description"),
|
|
4055
|
-
device: field("device"),
|
|
4056
|
-
vendor: field("vendor")
|
|
4057
|
-
};
|
|
4058
|
-
for (const rule of FAMILY_RULES) {
|
|
4059
|
-
const family = rule(fields);
|
|
4060
|
-
if (family !== void 0) return family;
|
|
4061
|
-
}
|
|
4062
|
-
return void 0;
|
|
4063
|
-
}
|
|
4064
|
-
function adapterFieldsFromIdentity(identity) {
|
|
4065
|
-
if (typeof identity !== "string") return void 0;
|
|
4066
|
-
const prefix = "webgpu:";
|
|
4067
|
-
if (!identity.startsWith(prefix)) return void 0;
|
|
4068
|
-
const fields = /* @__PURE__ */ Object.create(null);
|
|
4069
|
-
for (const pair of identity.slice(prefix.length).split("|")) {
|
|
4070
|
-
const separator = pair.indexOf("=");
|
|
4071
|
-
if (separator <= 0) return void 0;
|
|
4072
|
-
const key = pair.slice(0, separator);
|
|
4073
|
-
if (!ADAPTER_IDENTITY_KEYS.includes(key) || Object.hasOwn(fields, key)) {
|
|
4074
|
-
return void 0;
|
|
4075
|
-
}
|
|
4076
|
-
let value;
|
|
4077
|
-
try {
|
|
4078
|
-
value = decodeURIComponent(pair.slice(separator + 1));
|
|
4079
|
-
} catch {
|
|
4080
|
-
return void 0;
|
|
4081
|
-
}
|
|
4082
|
-
if (value.trim() === "") return void 0;
|
|
4083
|
-
fields[key] = value;
|
|
4084
|
-
}
|
|
4085
|
-
if (Object.keys(fields).length === 0) return void 0;
|
|
4086
|
-
return fields;
|
|
4087
|
-
}
|
|
4088
|
-
function nativeCaptureProvenance(census, target, viewport) {
|
|
4089
|
-
if (census === void 0 || census === null || typeof census !== "object" || Array.isArray(census)) return void 0;
|
|
4090
|
-
const adapterRecord = census.adapter;
|
|
4091
|
-
if (adapterRecord === void 0 || adapterRecord === null || typeof adapterRecord !== "object" || Array.isArray(adapterRecord)) return void 0;
|
|
4092
|
-
const adapter = adapterFieldsFromIdentity(adapterRecord.identity);
|
|
4093
|
-
if (adapter === void 0) return void 0;
|
|
4094
|
-
return {
|
|
4095
|
-
adapter,
|
|
4096
|
-
// A native launch carries no browser command line; there is no argument list to report and
|
|
4097
|
-
// inventing one would be a flag nobody can check.
|
|
4098
|
-
browserArgs: [],
|
|
4099
|
-
captureMethod: "device.screenshot",
|
|
4100
|
-
rendererKind: "webgpu",
|
|
4101
|
-
target,
|
|
4102
|
-
viewport
|
|
4103
|
-
};
|
|
4104
|
-
}
|
|
4105
|
-
|
|
4106
4564
|
// src/evaluators/render-chain.ts
|
|
4107
4565
|
function emitRenderChain(ctx) {
|
|
4108
4566
|
const assertion = ctx.scenarioAssertions.renderChain;
|
|
@@ -4524,6 +4982,344 @@ function emitPerNode(ctx, id, index, bound, observation, sampled, expected, read
|
|
|
4524
4982
|
});
|
|
4525
4983
|
}
|
|
4526
4984
|
|
|
4985
|
+
// src/evaluators/foot-slip.ts
|
|
4986
|
+
var FOOT_SLIP_MIN_TRAVEL_M = 0.5;
|
|
4987
|
+
var FOOT_SLIP_CONTACT_BAND = 0.25;
|
|
4988
|
+
var MIN_CONTACT_PAIRS = 4;
|
|
4989
|
+
var DEFAULT_STEP_SECONDS = 1 / 60;
|
|
4990
|
+
function measureFootSlip(observation, stepSeconds = DEFAULT_STEP_SECONDS) {
|
|
4991
|
+
const { samples } = observation;
|
|
4992
|
+
let travel = 0;
|
|
4993
|
+
for (let index = 1; index < samples.length; index += 1) {
|
|
4994
|
+
const before = samples[index - 1].body;
|
|
4995
|
+
const after = samples[index].body;
|
|
4996
|
+
if (before !== null && after !== null) travel += Math.hypot(after[0] - before[0], after[2] - before[2]);
|
|
4997
|
+
}
|
|
4998
|
+
if (samples.length < 2 || samples.some(({ body }) => body === null))
|
|
4999
|
+
return { feet: [], travel, unobserved: `the subject '${observation.entity}' was not reported on every tick` };
|
|
5000
|
+
const missing = observation.feet.filter((_name, foot) => samples.some((sample) => sample.feet[foot] === null));
|
|
5001
|
+
if (missing.length > 0)
|
|
5002
|
+
return { feet: [], travel, unobserved: `no node named ${missing.map((name) => `'${name}'`).join(", ")} was found on every tick; name the sole nodes (Object3D.name) the scenario lists` };
|
|
5003
|
+
if (travel < FOOT_SLIP_MIN_TRAVEL_M)
|
|
5004
|
+
return { feet: [], travel, unobserved: `the subject moved ${travel.toFixed(2)} m during the step, under ${FOOT_SLIP_MIN_TRAVEL_M} m; drive it before bounding its feet` };
|
|
5005
|
+
const feet = observation.feet.map((name, foot) => {
|
|
5006
|
+
const heights = samples.map((sample) => sample.feet[foot][1] - sample.body[1]);
|
|
5007
|
+
const low = Math.min(...heights);
|
|
5008
|
+
const lift = Math.max(...heights) - low;
|
|
5009
|
+
const planted = heights.map((height) => height <= low + FOOT_SLIP_CONTACT_BAND * lift);
|
|
5010
|
+
let footTravel = 0;
|
|
5011
|
+
let bodyTravel = 0;
|
|
5012
|
+
let contactPairs = 0;
|
|
5013
|
+
for (let index = 1; index < samples.length; index += 1) {
|
|
5014
|
+
if (!planted[index - 1] || !planted[index]) continue;
|
|
5015
|
+
const [fx0, , fz0] = samples[index - 1].feet[foot];
|
|
5016
|
+
const [fx1, , fz1] = samples[index].feet[foot];
|
|
5017
|
+
const [bx0, , bz0] = samples[index - 1].body;
|
|
5018
|
+
const [bx1, , bz1] = samples[index].body;
|
|
5019
|
+
footTravel += Math.hypot(fx1 - fx0, fz1 - fz0);
|
|
5020
|
+
bodyTravel += Math.hypot(bx1 - bx0, bz1 - bz0);
|
|
5021
|
+
contactPairs += 1;
|
|
5022
|
+
}
|
|
5023
|
+
return {
|
|
5024
|
+
contactPairs,
|
|
5025
|
+
lift,
|
|
5026
|
+
name,
|
|
5027
|
+
...contactPairs < MIN_CONTACT_PAIRS || bodyTravel <= 0 ? {} : { slip: footTravel / bodyTravel, speed: footTravel / (contactPairs * stepSeconds) }
|
|
5028
|
+
};
|
|
5029
|
+
});
|
|
5030
|
+
return { feet, travel };
|
|
5031
|
+
}
|
|
5032
|
+
function emitFootSlip(ctx) {
|
|
5033
|
+
const assertions = ctx.scenarioAssertions.footSlip;
|
|
5034
|
+
if (assertions === void 0 || assertions.length === 0) return;
|
|
5035
|
+
assertions.forEach((assertion, index) => {
|
|
5036
|
+
const id = `footSlip[${index}]`;
|
|
5037
|
+
const observation = ctx.input.report.observations?.footSlip?.find(({ label }) => label === assertion.atStep);
|
|
5038
|
+
const measure = observation === void 0 ? void 0 : measureFootSlip(observation, assertion.stepSeconds);
|
|
5039
|
+
const unmeasured = measure?.feet.find(({ slip }) => slip === void 0);
|
|
5040
|
+
const reason = observation === void 0 ? "the run recorded no per-tick foot samples for this step; footSlip runs only on the browser target" : measure.unobserved ?? (unmeasured === void 0 ? void 0 : `'${unmeasured.name}' was planted on fewer than ${MIN_CONTACT_PAIRS} consecutive ticks`);
|
|
5041
|
+
if (reason !== void 0) {
|
|
5042
|
+
ctx.assertions.push({ details: { atStep: assertion.atStep, reason, ...measure === void 0 ? {} : { travel: measure.travel } }, id: `${id}.observed`, pass: false });
|
|
5043
|
+
ctx.diagnostics.push({
|
|
5044
|
+
code: "TN_PLAYTEST_FOOT_SLIP_UNOBSERVED",
|
|
5045
|
+
message: `footSlip at '${assertion.atStep}' was not measured: ${reason}.`,
|
|
5046
|
+
observedRuntimePath: "observations.json/footSlip",
|
|
5047
|
+
severity: "error",
|
|
5048
|
+
suggestion: "Run on the browser target, name each sole node (Object3D.name, for example footL and footR), and make the step move the subject at a run."
|
|
5049
|
+
});
|
|
5050
|
+
return;
|
|
5051
|
+
}
|
|
5052
|
+
const animation = runtimeGameplaySamples(ctx.input.report.observations?.runtimeObservations).find(({ label }) => label === assertion.atStep)?.gameplay.animation;
|
|
5053
|
+
const stride = isRecord(animation) ? strideReading(animation[observation.entity]) : void 0;
|
|
5054
|
+
if (stride !== void 0 && strideHasNoFootPlant(stride)) {
|
|
5055
|
+
ctx.assertions.push({ details: { atStep: assertion.atStep, reason: NO_FOOT_PLANT_DETAIL, stride, travel: measure.travel }, id: `${id}.observed`, pass: false });
|
|
5056
|
+
ctx.diagnostics.push({
|
|
5057
|
+
code: "TN_PLAYTEST_STRIDE_NO_FOOT_PLANT",
|
|
5058
|
+
message: `footSlip at '${assertion.atStep}' failed closed: ${NO_FOOT_PLANT_DETAIL}.`,
|
|
5059
|
+
observedRuntimePath: "observations.json/runtimeObservations",
|
|
5060
|
+
severity: "error",
|
|
5061
|
+
suggestion: "The clip has no root motion and its feet never plant, so stride sync cannot match it to the ground: author a clip whose feet plant, or drive the stride from distance travelled."
|
|
5062
|
+
});
|
|
5063
|
+
return;
|
|
5064
|
+
}
|
|
5065
|
+
const worst = Math.max(...measure.feet.map(({ slip }) => slip));
|
|
5066
|
+
const worstSpeed = Math.max(...measure.feet.map(({ speed }) => speed));
|
|
5067
|
+
const slipPass = assertion.maxSlip === void 0 || worst <= assertion.maxSlip;
|
|
5068
|
+
const speedPass = assertion.maxSlideSpeed === void 0 || worstSpeed <= assertion.maxSlideSpeed;
|
|
5069
|
+
ctx.assertions.push({
|
|
5070
|
+
details: {
|
|
5071
|
+
atStep: assertion.atStep,
|
|
5072
|
+
expected: { maxSlideSpeed: assertion.maxSlideSpeed, maxSlip: assertion.maxSlip },
|
|
5073
|
+
feet: measure.feet,
|
|
5074
|
+
travel: measure.travel,
|
|
5075
|
+
worst,
|
|
5076
|
+
worstSpeed
|
|
5077
|
+
},
|
|
5078
|
+
id: `${id}.slip`,
|
|
5079
|
+
pass: slipPass && speedPass
|
|
5080
|
+
});
|
|
5081
|
+
if (!slipPass)
|
|
5082
|
+
ctx.diagnostics.push({
|
|
5083
|
+
code: "TN_PLAYTEST_FOOT_SLIP",
|
|
5084
|
+
message: `A planted foot travelled ${worst.toFixed(2)} m per metre of body travel at '${assertion.atStep}', ceiling ${assertion.maxSlip}.`,
|
|
5085
|
+
observedRuntimePath: "observations.json/footSlip",
|
|
5086
|
+
severity: "error",
|
|
5087
|
+
suggestion: "Drive the stride from distance travelled, not from time: the cycle phase should advance by ground speed over stride length, so a planted foot stays put."
|
|
5088
|
+
});
|
|
5089
|
+
if (!speedPass)
|
|
5090
|
+
ctx.diagnostics.push({
|
|
5091
|
+
code: "TN_PLAYTEST_FOOT_SLIP",
|
|
5092
|
+
message: `A planted foot slid at ${worstSpeed.toFixed(2)} m/s at '${assertion.atStep}', ceiling ${assertion.maxSlideSpeed} m/s.`,
|
|
5093
|
+
observedRuntimePath: "observations.json/footSlip",
|
|
5094
|
+
severity: "error",
|
|
5095
|
+
suggestion: "Drive the stride from distance travelled, not from time: the cycle phase should advance by ground speed over stride length, so a planted foot stays put."
|
|
5096
|
+
});
|
|
5097
|
+
});
|
|
5098
|
+
}
|
|
5099
|
+
|
|
5100
|
+
// src/evaluators/sight-line.ts
|
|
5101
|
+
var MAX_BLOCKER_NAMES = 5;
|
|
5102
|
+
function topBlockers(blockers) {
|
|
5103
|
+
const counts = /* @__PURE__ */ new Map();
|
|
5104
|
+
for (const name of blockers) counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
5105
|
+
return [...counts.entries()].sort(([leftName, leftCount], [rightName, rightCount]) => rightCount - leftCount || leftName.localeCompare(rightName)).slice(0, MAX_BLOCKER_NAMES).map(([name]) => name);
|
|
5106
|
+
}
|
|
5107
|
+
function emitSightLine(ctx) {
|
|
5108
|
+
const assertion = ctx.scenarioAssertions.sightLine;
|
|
5109
|
+
if (assertion === void 0) return;
|
|
5110
|
+
const observation = ctx.input.report.observations?.sightLine;
|
|
5111
|
+
const samples = observation?.samples ?? [];
|
|
5112
|
+
if (samples.length === 0) {
|
|
5113
|
+
ctx.assertions.push({ details: { samples: 0 }, id: "sightLine.observed", pass: false });
|
|
5114
|
+
ctx.diagnostics.push({
|
|
5115
|
+
code: "TN_PLAYTEST_SIGHT_LINE_UNOBSERVED",
|
|
5116
|
+
message: "A sightLine assertion was evaluated against a run that sampled no camera-to-subject sight line.",
|
|
5117
|
+
observedRuntimePath: "observations.json/sightLine",
|
|
5118
|
+
severity: "error",
|
|
5119
|
+
suggestion: "Run on the browser target and make sure the scenario advances at least one step whose subject is registered with the bridge."
|
|
5120
|
+
});
|
|
5121
|
+
return;
|
|
5122
|
+
}
|
|
5123
|
+
const blockedCount = samples.filter(({ blocked }) => blocked).length;
|
|
5124
|
+
const ratio = blockedCount / samples.length;
|
|
5125
|
+
const pass = ratio <= assertion.maxBlockedRatio;
|
|
5126
|
+
const blockers = topBlockers(samples.flatMap((sample) => sample.blockers));
|
|
5127
|
+
ctx.assertions.push({
|
|
5128
|
+
details: { blocked: blockedCount, blockers, ratio, samples: samples.length },
|
|
5129
|
+
id: "sightLine",
|
|
5130
|
+
pass
|
|
5131
|
+
});
|
|
5132
|
+
if (!pass) {
|
|
5133
|
+
ctx.diagnostics.push({
|
|
5134
|
+
code: "TN_PLAYTEST_SIGHT_LINE_BLOCKED",
|
|
5135
|
+
message: `Solid geometry blocked the camera's view of '${observation.entity}' on ${blockedCount} of ${samples.length} samples (${(ratio * 100).toFixed(1)}%), ceiling ${assertion.maxBlockedRatio}.`,
|
|
5136
|
+
observedRuntimePath: "observations.json/sightLine",
|
|
5137
|
+
severity: "error",
|
|
5138
|
+
suggestion: "Move the camera along the cast or pull it in past the blocker, so a line from the lens to the subject stays clear."
|
|
5139
|
+
});
|
|
5140
|
+
}
|
|
5141
|
+
}
|
|
5142
|
+
|
|
5143
|
+
// src/evaluators/hud-audit.ts
|
|
5144
|
+
var MAX_OFFENDERS = 5;
|
|
5145
|
+
var JUDGED_BACKGROUND_ALPHA = 0.5;
|
|
5146
|
+
var DEVELOPER_TEXT = /\b(debug|todo|fixme|lorem ipsum|placeholder|probe|raycast|hitbox|wall ray)\b/iu;
|
|
5147
|
+
var UNRESOLVED_TEXT = /\b(undefined|null|NaN)\b/u;
|
|
5148
|
+
var COERCED_OBJECT = /\[object /u;
|
|
5149
|
+
function channelLuminance(channel) {
|
|
5150
|
+
const value = channel / 255;
|
|
5151
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
5152
|
+
}
|
|
5153
|
+
function relativeLuminance([red, green, blue]) {
|
|
5154
|
+
return 0.2126 * channelLuminance(red) + 0.7152 * channelLuminance(green) + 0.0722 * channelLuminance(blue);
|
|
5155
|
+
}
|
|
5156
|
+
function contrastRatio(foreground, background) {
|
|
5157
|
+
const alpha = Math.min(Math.max(foreground[3], 0), 1);
|
|
5158
|
+
const composited = [
|
|
5159
|
+
foreground[0] * alpha + background[0] * (1 - alpha),
|
|
5160
|
+
foreground[1] * alpha + background[1] * (1 - alpha),
|
|
5161
|
+
foreground[2] * alpha + background[2] * (1 - alpha),
|
|
5162
|
+
1
|
|
5163
|
+
];
|
|
5164
|
+
const first = relativeLuminance(composited);
|
|
5165
|
+
const second = relativeLuminance(background);
|
|
5166
|
+
return (Math.max(first, second) + 0.05) / (Math.min(first, second) + 0.05);
|
|
5167
|
+
}
|
|
5168
|
+
function readsAsDeveloperText(text) {
|
|
5169
|
+
return DEVELOPER_TEXT.test(text) || UNRESOLVED_TEXT.test(text) || COERCED_OBJECT.test(text);
|
|
5170
|
+
}
|
|
5171
|
+
function offenders(items) {
|
|
5172
|
+
return items.slice(0, MAX_OFFENDERS).map(({ selector, text }) => ({ selector, text }));
|
|
5173
|
+
}
|
|
5174
|
+
function emitHudAudit(ctx) {
|
|
5175
|
+
const assertion = ctx.scenarioAssertions.hudAudit;
|
|
5176
|
+
if (assertion === void 0) return;
|
|
5177
|
+
const items = ctx.input.report.observations?.hudAudit?.items ?? [];
|
|
5178
|
+
if (items.length === 0) {
|
|
5179
|
+
ctx.assertions.push({ details: { items: 0 }, id: "hudAudit.observed", pass: false });
|
|
5180
|
+
ctx.diagnostics.push({
|
|
5181
|
+
code: "TN_PLAYTEST_HUD_AUDIT_UNOBSERVED",
|
|
5182
|
+
message: "A hudAudit assertion was evaluated against a run that reported no visible page text.",
|
|
5183
|
+
observedRuntimePath: "observations.json/hudAudit",
|
|
5184
|
+
severity: "error",
|
|
5185
|
+
suggestion: "Run on the browser target and make sure the page draws player-facing text in the DOM, outside a canvas."
|
|
5186
|
+
});
|
|
5187
|
+
return;
|
|
5188
|
+
}
|
|
5189
|
+
if (assertion.noDebugText === true) {
|
|
5190
|
+
const found = items.filter(({ text }) => readsAsDeveloperText(text));
|
|
5191
|
+
const pass = found.length === 0;
|
|
5192
|
+
ctx.assertions.push({
|
|
5193
|
+
details: { checked: items.length, offenders: offenders(found) },
|
|
5194
|
+
id: "hudAudit.debugText",
|
|
5195
|
+
pass
|
|
5196
|
+
});
|
|
5197
|
+
if (!pass) {
|
|
5198
|
+
ctx.diagnostics.push({
|
|
5199
|
+
code: "TN_PLAYTEST_HUD_DEBUG_TEXT",
|
|
5200
|
+
message: `Developer text reached the player's HUD in ${found.length} of ${items.length} text items: ${found.slice(0, MAX_OFFENDERS).map(({ text }) => JSON.stringify(text)).join(", ")}.`,
|
|
5201
|
+
observedRuntimePath: "observations.json/hudAudit/items",
|
|
5202
|
+
severity: "error",
|
|
5203
|
+
suggestion: "Replace debug, TODO, placeholder and unresolved values with the copy the player should read, then rerun the scenario."
|
|
5204
|
+
});
|
|
5205
|
+
}
|
|
5206
|
+
}
|
|
5207
|
+
if (assertion.minContrast !== void 0) {
|
|
5208
|
+
const judged = items.filter(({ background }) => background[3] >= JUDGED_BACKGROUND_ALPHA);
|
|
5209
|
+
const unjudged = items.length - judged.length;
|
|
5210
|
+
const worst = judged.map(({ selector, text, background, color }) => ({ ratio: contrastRatio(color, background), selector, text })).sort((left, right) => left.ratio - right.ratio).slice(0, MAX_OFFENDERS);
|
|
5211
|
+
const pass = worst.every(({ ratio }) => ratio >= assertion.minContrast);
|
|
5212
|
+
ctx.assertions.push({
|
|
5213
|
+
details: { judged: judged.length, minContrast: assertion.minContrast, unjudged, worst },
|
|
5214
|
+
id: "hudAudit.contrast",
|
|
5215
|
+
pass
|
|
5216
|
+
});
|
|
5217
|
+
if (!pass) {
|
|
5218
|
+
ctx.diagnostics.push({
|
|
5219
|
+
code: "TN_PLAYTEST_HUD_CONTRAST",
|
|
5220
|
+
message: `HUD text falls below the ${assertion.minContrast}:1 contrast floor: ${worst.filter(({ ratio }) => ratio < assertion.minContrast).map(({ ratio, text }) => `${JSON.stringify(text)} at ${ratio.toFixed(2)}:1`).join(", ")}.`,
|
|
5221
|
+
observedRuntimePath: "observations.json/hudAudit/items",
|
|
5222
|
+
severity: "error",
|
|
5223
|
+
suggestion: "Raise the text colour's contrast against its backing plate, or darken the plate, until every judged item reaches the floor."
|
|
5224
|
+
});
|
|
5225
|
+
}
|
|
5226
|
+
}
|
|
5227
|
+
}
|
|
5228
|
+
|
|
5229
|
+
// src/evaluators/engine-cost.ts
|
|
5230
|
+
var FRAME_BUDGET_MARKER = "TN_FRAME_BUDGET:";
|
|
5231
|
+
var BRIDGE_CENSUS_MARKER = "TN_BRIDGE_CENSUS:";
|
|
5232
|
+
function engineCostWindows(lines) {
|
|
5233
|
+
const windows = [];
|
|
5234
|
+
let top;
|
|
5235
|
+
for (const line of lines) {
|
|
5236
|
+
if (typeof line !== "string") continue;
|
|
5237
|
+
const census = line.indexOf(BRIDGE_CENSUS_MARKER);
|
|
5238
|
+
if (census !== -1) {
|
|
5239
|
+
try {
|
|
5240
|
+
top = JSON.parse(line.slice(census + BRIDGE_CENSUS_MARKER.length)).top;
|
|
5241
|
+
} catch {
|
|
5242
|
+
top = void 0;
|
|
5243
|
+
}
|
|
5244
|
+
continue;
|
|
5245
|
+
}
|
|
5246
|
+
const at = line.indexOf(FRAME_BUDGET_MARKER);
|
|
5247
|
+
if (at === -1) continue;
|
|
5248
|
+
try {
|
|
5249
|
+
const report = JSON.parse(line.slice(at + FRAME_BUDGET_MARKER.length));
|
|
5250
|
+
const engine = report.counters?.engine;
|
|
5251
|
+
if (engine === void 0) continue;
|
|
5252
|
+
if (engine === null || typeof engine !== "object" || Array.isArray(engine)) throw new Error("invalid engine counters");
|
|
5253
|
+
const series = {
|
|
5254
|
+
...engine,
|
|
5255
|
+
...report.counters?.bridgeCrossings === void 0 ? {} : { bridgeCrossings: report.counters.bridgeCrossings }
|
|
5256
|
+
};
|
|
5257
|
+
for (const summary of Object.values(series)) {
|
|
5258
|
+
if (summary === null || typeof summary !== "object" || !Number.isFinite(summary.mean) || summary.mean < 0 || !Number.isFinite(summary.max) || summary.max < 0 || !Number.isSafeInteger(summary.samples) || summary.samples < 1) throw new Error("unmeasured engine counter");
|
|
5259
|
+
}
|
|
5260
|
+
const pick = (field) => Object.fromEntries(Object.entries(series).map(([name, summary]) => [name, summary[field]]));
|
|
5261
|
+
windows.push({ maxFrame: pick("max"), perFrame: pick("mean"), top, ...report.window === void 0 ? {} : { window: report.window } });
|
|
5262
|
+
} catch {
|
|
5263
|
+
windows.push(void 0);
|
|
5264
|
+
}
|
|
5265
|
+
}
|
|
5266
|
+
return windows;
|
|
5267
|
+
}
|
|
5268
|
+
function topCaller(window2) {
|
|
5269
|
+
const top = window2.top?.[0];
|
|
5270
|
+
return top === void 0 ? "no census before this window" : `${top.name ?? "?"} ${top.perFrame ?? "?"}/frame from ${top.caller ?? "unknown"}`;
|
|
5271
|
+
}
|
|
5272
|
+
function emitEngineCost(ctx) {
|
|
5273
|
+
const assertion = ctx.scenarioAssertions.engineCost;
|
|
5274
|
+
if (assertion === void 0) return;
|
|
5275
|
+
const windows = engineCostWindows((ctx.input.report.observations?.console ?? []).map(({ text }) => text));
|
|
5276
|
+
const stillWindows = assertion.still?.windows ?? 0;
|
|
5277
|
+
const skipped = assertion.skipWindows ?? 0;
|
|
5278
|
+
const needed = Math.max(assertion.minWindows ?? 1, skipped + stillWindows + (assertion.moving === void 0 ? 0 : 1));
|
|
5279
|
+
const readable = windows.filter((window2) => window2 !== void 0);
|
|
5280
|
+
const observed = readable.length >= needed && readable.length === windows.length;
|
|
5281
|
+
ctx.assertions.push({ details: { windows: windows.length, unreadable: windows.length - readable.length, needed }, id: "engineCost.observed", pass: observed });
|
|
5282
|
+
if (!observed) {
|
|
5283
|
+
ctx.diagnostics.push({
|
|
5284
|
+
code: "TN_PLAYTEST_ENGINE_COST_UNOBSERVED",
|
|
5285
|
+
message: `engineCost needs ${needed} readable TN_FRAME_BUDGET window(s) with counters.engine; the run printed ${windows.length}, ${windows.length - readable.length} unreadable.`,
|
|
5286
|
+
observedRuntimePath: "observations.json/console",
|
|
5287
|
+
severity: "error",
|
|
5288
|
+
suggestion: "Run with the playtest runner (it sets __THREENATIVE_ENGINE_COST__, which turns the counters on) on a fixed-step clock, long enough for each 300-tick TN_FRAME_BUDGET window the bounds need."
|
|
5289
|
+
});
|
|
5290
|
+
return;
|
|
5291
|
+
}
|
|
5292
|
+
const bounded = readable.slice(skipped);
|
|
5293
|
+
for (const [kind, table, scope, windows2] of [
|
|
5294
|
+
["perFrame", assertion.maxPerFrame, "maxPerFrame", bounded],
|
|
5295
|
+
["maxFrame", assertion.maxInFrame, "maxInFrame", bounded],
|
|
5296
|
+
["perFrame", assertion.still?.maxPerFrame, "still.maxPerFrame", bounded.slice(0, stillWindows)],
|
|
5297
|
+
["perFrame", assertion.moving?.maxPerFrame, "moving.maxPerFrame", bounded.slice(stillWindows)],
|
|
5298
|
+
["maxFrame", assertion.moving?.maxInFrame, "moving.maxInFrame", bounded.slice(stillWindows)]
|
|
5299
|
+
]) {
|
|
5300
|
+
for (const [name, bound] of Object.entries(table ?? {})) {
|
|
5301
|
+
const values = windows2.map((window2) => window2[kind]?.[name]);
|
|
5302
|
+
const missing = values.findIndex((value2) => typeof value2 !== "number" || !Number.isFinite(value2));
|
|
5303
|
+
const worst = windows2.reduce(
|
|
5304
|
+
(top, window2) => (window2[kind]?.[name] ?? -1) > (top?.[kind]?.[name] ?? -1) ? window2 : top,
|
|
5305
|
+
void 0
|
|
5306
|
+
);
|
|
5307
|
+
const value = worst?.[kind]?.[name] ?? Number.NaN;
|
|
5308
|
+
const pass = missing === -1 && value <= bound;
|
|
5309
|
+
const id = `engineCost.${scope}.${name}`;
|
|
5310
|
+
ctx.assertions.push({ details: { bound, value, window: worst?.window, source: assertion.source }, id, pass });
|
|
5311
|
+
if (pass) continue;
|
|
5312
|
+
ctx.diagnostics.push({
|
|
5313
|
+
code: "TN_PLAYTEST_ENGINE_COST_OVER_BOUND",
|
|
5314
|
+
message: missing !== -1 ? `engineCost: window ${windows2[missing]?.window ?? missing + 1} reports no '${name}' (${kind}); a bounded counter must be measured in every window.` : `engineCost: '${name}' ${kind === "perFrame" ? "per frame" : "in one frame"}${scope.startsWith("still") ? " while still" : scope.startsWith("moving") ? " in play" : ""} reached ${value} in window ${worst?.window ?? "?"}, over the bound ${bound} (${assertion.source}). Top crossing: ${topCaller(worst)}.`,
|
|
5315
|
+
observedRuntimePath: "observations.json/console",
|
|
5316
|
+
severity: "error",
|
|
5317
|
+
suggestion: "Read TN_FRAME_BUDGET.counters.engine and the TN_BRIDGE_CENSUS before it: the counter names the cost class, and the top caller names the code that pays it. Fix that code or the engine path under it; never raise the bound to pass."
|
|
5318
|
+
});
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
|
|
4527
5323
|
// src/runner/sceneRoom.ts
|
|
4528
5324
|
var LIT_MATERIAL_PATTERN = /standard|physical|lambert|phong|toon/iu;
|
|
4529
5325
|
function summariseRoom(scene) {
|
|
@@ -4645,12 +5441,47 @@ function emitScene(ctx) {
|
|
|
4645
5441
|
}
|
|
4646
5442
|
|
|
4647
5443
|
// src/evaluators/startup.ts
|
|
5444
|
+
var MB = 1e6;
|
|
5445
|
+
var mb = (bytes) => `${(bytes / MB).toFixed(1)} MB`;
|
|
5446
|
+
function emitOffscreenBytes(ctx) {
|
|
5447
|
+
const ceiling = ctx.scenarioAssertions.startup?.maxOffscreenBytes;
|
|
5448
|
+
const observed = ctx.input.report.observations?.startup?.offscreenBytes;
|
|
5449
|
+
const unsized = observed !== void 0 && observed.awaitedBytes === 0 && observed.unsizedFiles > 0;
|
|
5450
|
+
if (ceiling !== void 0) {
|
|
5451
|
+
const measured = observed !== void 0 && !unsized;
|
|
5452
|
+
const pass = measured && observed.offscreenBytes <= ceiling;
|
|
5453
|
+
ctx.assertions.push({
|
|
5454
|
+
details: { expected: ceiling, observed: measured ? observed.offscreenBytes : void 0 },
|
|
5455
|
+
id: "startup.offscreenBytes",
|
|
5456
|
+
pass
|
|
5457
|
+
});
|
|
5458
|
+
if (!pass) {
|
|
5459
|
+
ctx.diagnostics.push({
|
|
5460
|
+
code: measured ? "TN_PLAYTEST_STARTUP_OFFSCREEN_BYTES" : "TN_PLAYTEST_STARTUP_UNOBSERVABLE",
|
|
5461
|
+
message: measured ? `The reveal waited for ${mb(observed.offscreenBytes)} the spawn camera does not show (${observed.top.map((file) => `${file.path} ${mb(file.bytes)} ${file.reason}`).join(", ")}), past the asserted ceiling of ${mb(ceiling)}.` : observed === void 0 ? "Off-screen startup bytes were not observed: the runtime reported no measurement." : `Off-screen startup bytes were not observable: the runtime awaited ${observed.unsizedFiles} file(s) and the asset manifest records no size for any of them.`,
|
|
5462
|
+
observedRuntimePath: "observations.json/startup/offscreenBytes",
|
|
5463
|
+
severity: "error",
|
|
5464
|
+
suggestion: measured ? observed.fix : "Build the game's assets with the asset pipeline so the manifest records each file's bytes, and keep the playtest bridge installed before startup."
|
|
5465
|
+
});
|
|
5466
|
+
return;
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5469
|
+
if (observed?.warn !== true) return;
|
|
5470
|
+
ctx.diagnostics.push({
|
|
5471
|
+
code: "TN_PLAYTEST_STARTUP_OFFSCREEN_BYTES",
|
|
5472
|
+
message: `Most of the reveal's wait bought nothing on screen: ${mb(observed.offscreenBytes)} of ${mb(observed.awaitedBytes)} awaited is not shown by the spawn camera (${observed.top.map((file) => `${file.path} ${mb(file.bytes)} ${file.reason}`).join(", ")}).`,
|
|
5473
|
+
observedRuntimePath: "observations.json/startup/offscreenBytes",
|
|
5474
|
+
severity: "warning",
|
|
5475
|
+
suggestion: observed.fix
|
|
5476
|
+
});
|
|
5477
|
+
}
|
|
4648
5478
|
var MILESTONES = {
|
|
4649
5479
|
maxCompileSettledMs: "compileSettledMs",
|
|
4650
5480
|
maxEnteredMs: "enteredMs",
|
|
4651
5481
|
maxReadyMs: "readyMs"
|
|
4652
5482
|
};
|
|
4653
5483
|
function emitStartup(ctx) {
|
|
5484
|
+
emitOffscreenBytes(ctx);
|
|
4654
5485
|
const assertion = ctx.scenarioAssertions.startup;
|
|
4655
5486
|
if (assertion === void 0) return;
|
|
4656
5487
|
const timeline = ctx.input.report.observations?.startup?.timeline;
|
|
@@ -4673,6 +5504,28 @@ function emitStartup(ctx) {
|
|
|
4673
5504
|
suggestion: observed === void 0 ? "Keep the playtest bridge installed before startup and let the game reach that milestone inside the run; a runtime without a startup timeline cannot satisfy this assertion." : "Move work out of the critical startup path \u2014 load detail after enter(), share textures across models, keep first-use compilation inside its budget \u2014 or raise the ceiling with the measurement that justifies it."
|
|
4674
5505
|
});
|
|
4675
5506
|
}
|
|
5507
|
+
if (assertion.steadyCover === true) emitSteadyCover(ctx);
|
|
5508
|
+
}
|
|
5509
|
+
function emitSteadyCover(ctx) {
|
|
5510
|
+
const cover = ctx.input.report.observations?.startup?.cover;
|
|
5511
|
+
const observed = cover !== void 0 && cover.frames > 0 && cover.worldMs !== void 0;
|
|
5512
|
+
const uiOverCover = cover?.uiOverCover ?? [];
|
|
5513
|
+
const pass = observed && cover.differing.length === 0 && uiOverCover.length === 0;
|
|
5514
|
+
ctx.assertions.push({
|
|
5515
|
+
details: observed ? { differing: cover.differing.length, first: cover.differing.slice(0, 5), frames: cover.frames, reference: cover.reference, uiOverCover, worldMs: cover.worldMs } : { frames: cover?.frames ?? 0, worldMs: cover?.worldMs },
|
|
5516
|
+
id: "startup.steadyCover",
|
|
5517
|
+
pass
|
|
5518
|
+
});
|
|
5519
|
+
if (pass) return;
|
|
5520
|
+
const first = cover?.differing[0];
|
|
5521
|
+
const ui = uiOverCover[0];
|
|
5522
|
+
ctx.diagnostics.push({
|
|
5523
|
+
code: !observed ? "TN_PLAYTEST_STARTUP_COVER_UNOBSERVED" : first === void 0 && ui !== void 0 ? "TN_PLAYTEST_STARTUP_UI_OVER_COVER" : "TN_PLAYTEST_STARTUP_COVER_BROKEN",
|
|
5524
|
+
message: observed && first !== void 0 ? `${cover.differing.length} of ${cover.frames} frames before readiness differ from the loading cover (mean rgb ${cover.reference.join(",")}); the first at ${first.ms} ms has mean rgb ${first.mean.join(",")}.` : observed && ui !== void 0 ? `${uiOverCover.length} frames after readiness show the world's page UI over the loading cover before the world frame at ${cover.worldMs} ms; the first at ${ui.ms} ms (${(ui.share * 100).toFixed(1)}% of its pixels).` : cover !== void 0 && cover.frames > 0 ? "No world frame was recorded in the hand-off frames after readiness: the cover never gave way to the world." : "No frame presented before readiness was recorded: the browser runner records them only on the browser target, and only when the runtime stamps readyMs.",
|
|
5525
|
+
observedRuntimePath: "observations.json/startup/cover",
|
|
5526
|
+
severity: "error",
|
|
5527
|
+
suggestion: observed && first === void 0 && ui !== void 0 ? "Show page UI only once the world frame is on screen: core publishes state written on whenReady() after the uncovered world frame has left the GPU, so gate the HUD on that state, not on a timer or an earlier signal." : observed ? "Paint the cover on every frame the page presents before readiness: the page background in the cover's colour, and a repaint after any draw made outside the frame loop." : "Run the scenario on the browser target with the playtest bridge installed before startup."
|
|
5528
|
+
});
|
|
4676
5529
|
}
|
|
4677
5530
|
|
|
4678
5531
|
// src/runner/pipeline-summary.ts
|
|
@@ -5880,6 +6733,10 @@ function evaluateRichPlaytestAssertions(input) {
|
|
|
5880
6733
|
emitPipelineCensus(ctx);
|
|
5881
6734
|
emitScene(ctx);
|
|
5882
6735
|
emitSceneNodes(ctx);
|
|
6736
|
+
emitFootSlip(ctx);
|
|
6737
|
+
emitSightLine(ctx);
|
|
6738
|
+
emitHudAudit(ctx);
|
|
6739
|
+
emitEngineCost(ctx);
|
|
5883
6740
|
if (scenarioAssertions.geometry !== void 0) {
|
|
5884
6741
|
const observed = input.report.observations?.geometry;
|
|
5885
6742
|
const status = observed?.status;
|
|
@@ -6385,6 +7242,7 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
|
|
|
6385
7242
|
}),
|
|
6386
7243
|
"performance": Object.freeze({
|
|
6387
7244
|
"maxFrameMsP95": (value) => typeof value === "number" && Number.isFinite(value),
|
|
7245
|
+
"maxFrameMsReason": (value) => typeof value === "string" && value.trim() !== "",
|
|
6388
7246
|
"minFps": (value) => typeof value === "number" && Number.isFinite(value),
|
|
6389
7247
|
"maxPhaseMsP95": (value) => isRecord2(value),
|
|
6390
7248
|
"maxDrawCalls": (value) => typeof value === "number" && Number.isFinite(value),
|
|
@@ -6442,6 +7300,7 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
|
|
|
6442
7300
|
"animation": Object.freeze({
|
|
6443
7301
|
"entity": (value) => typeof value === "string" && value.trim() !== "",
|
|
6444
7302
|
"clip": (value) => typeof value === "string" && value.trim() !== "",
|
|
7303
|
+
"atStep": (value) => typeof value === "string" && value.trim() !== "",
|
|
6445
7304
|
"entered": (value) => typeof value === "boolean",
|
|
6446
7305
|
"advancedFrames": (value) => typeof value === "number" && Number.isFinite(value),
|
|
6447
7306
|
"finished": (value) => typeof value === "boolean",
|
|
@@ -6466,6 +7325,31 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
|
|
|
6466
7325
|
"maxCount": (value) => typeof value === "number" && Number.isFinite(value),
|
|
6467
7326
|
"minTriangles": (value) => typeof value === "number" && Number.isFinite(value)
|
|
6468
7327
|
}),
|
|
7328
|
+
"footSlip": Object.freeze({
|
|
7329
|
+
"atStep": (value) => typeof value === "string" && value.trim() !== "",
|
|
7330
|
+
"feet": (value) => Array.isArray(value),
|
|
7331
|
+
"maxSlip": (value) => typeof value === "number" && Number.isFinite(value) && value > 0,
|
|
7332
|
+
"maxSlideSpeed": (value) => typeof value === "number" && Number.isFinite(value) && value > 0,
|
|
7333
|
+
"stepSeconds": (value) => typeof value === "number" && Number.isFinite(value) && value > 0,
|
|
7334
|
+
"entity": (value) => typeof value === "string" && value.trim() !== ""
|
|
7335
|
+
}),
|
|
7336
|
+
"sightLine": Object.freeze({
|
|
7337
|
+
"entity": (value) => typeof value === "string" && value.trim() !== "",
|
|
7338
|
+
"maxBlockedRatio": (value) => typeof value === "number" && Number.isFinite(value)
|
|
7339
|
+
}),
|
|
7340
|
+
"engineCost": Object.freeze({
|
|
7341
|
+
"maxPerFrame": (value) => isRecord2(value),
|
|
7342
|
+
"maxInFrame": (value) => isRecord2(value),
|
|
7343
|
+
"minWindows": (value) => typeof value === "number" && Number.isInteger(value) && value > 0,
|
|
7344
|
+
"skipWindows": (value) => typeof value === "number" && Number.isInteger(value) && value >= 0,
|
|
7345
|
+
"still": (value) => isRecord2(value),
|
|
7346
|
+
"moving": (value) => isRecord2(value),
|
|
7347
|
+
"source": (value) => typeof value === "string" && value.trim() !== ""
|
|
7348
|
+
}),
|
|
7349
|
+
"hudAudit": Object.freeze({
|
|
7350
|
+
"minContrast": (value) => typeof value === "number" && Number.isFinite(value),
|
|
7351
|
+
"noDebugText": (value) => value === true
|
|
7352
|
+
}),
|
|
6469
7353
|
"causedBy": Object.freeze({
|
|
6470
7354
|
"cause": (value) => isRecord2(value),
|
|
6471
7355
|
"effect": (value) => isRecord2(value),
|
|
@@ -6475,7 +7359,9 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
|
|
|
6475
7359
|
"startup": Object.freeze({
|
|
6476
7360
|
"maxEnteredMs": (value) => typeof value === "number" && Number.isFinite(value),
|
|
6477
7361
|
"maxCompileSettledMs": (value) => typeof value === "number" && Number.isFinite(value),
|
|
6478
|
-
"maxReadyMs": (value) => typeof value === "number" && Number.isFinite(value)
|
|
7362
|
+
"maxReadyMs": (value) => typeof value === "number" && Number.isFinite(value),
|
|
7363
|
+
"maxOffscreenBytes": (value) => typeof value === "number" && Number.isFinite(value),
|
|
7364
|
+
"steadyCover": (value) => typeof value === "boolean"
|
|
6479
7365
|
}),
|
|
6480
7366
|
"pipelineCensus": Object.freeze({
|
|
6481
7367
|
"maxNodeBuildsAfterWarmUpSettled": (value) => typeof value === "number" && Number.isInteger(value) && value >= 0,
|
|
@@ -6507,6 +7393,9 @@ function validateVisualAssertion(value, scenarioPath, objectPath) {
|
|
|
6507
7393
|
if (authoredEdge !== void 0) {
|
|
6508
7394
|
throw invalidScenario(scenarioPath, `'${objectPath}.region.${authoredEdge}' cannot be combined with an element-bound region; the element supplies its bounds.`);
|
|
6509
7395
|
}
|
|
7396
|
+
if (hasKey(regionRecord, "minSharpness")) {
|
|
7397
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.region.minSharpness' measures the rendered frame; bound a static x/y/width/height region instead of an element.`);
|
|
7398
|
+
}
|
|
6510
7399
|
region = {
|
|
6511
7400
|
element,
|
|
6512
7401
|
...present("maxDarkPixelRatio", optionalRatio(regionRecord, "maxDarkPixelRatio", scenarioPath, `${objectPath}.region`)),
|
|
@@ -6525,6 +7414,7 @@ function validateVisualAssertion(value, scenarioPath, objectPath) {
|
|
|
6525
7414
|
}
|
|
6526
7415
|
region = {
|
|
6527
7416
|
...edges,
|
|
7417
|
+
...present("minSharpness", optionalPositiveNumber(regionRecord, "minSharpness", scenarioPath, `${objectPath}.region`)),
|
|
6528
7418
|
...present("maxDarkPixelRatio", optionalRatio(regionRecord, "maxDarkPixelRatio", scenarioPath, `${objectPath}.region`)),
|
|
6529
7419
|
...present("maxLuminance", optionalRatio(regionRecord, "maxLuminance", scenarioPath, `${objectPath}.region`)),
|
|
6530
7420
|
...present("minDarkPixelRatio", optionalRatio(regionRecord, "minDarkPixelRatio", scenarioPath, `${objectPath}.region`)),
|
|
@@ -6726,18 +7616,30 @@ function validateDeviceMetricsAssertion(value, scenarioPath, objectPath) {
|
|
|
6726
7616
|
}
|
|
6727
7617
|
return assertion;
|
|
6728
7618
|
}
|
|
7619
|
+
var LEGACY_SCAFFOLD_FRAME_MS = 33;
|
|
7620
|
+
var LEGACY_SCAFFOLD_FRAME_REASON = "Scaffolded before 0.3.7 with a 33 ms pin, which passes at 30 fps. Drop maxFrameMsP95 to hold this game to 16.7 ms.";
|
|
6729
7621
|
function validatePerformanceAssertion(value, scenarioPath, objectPath) {
|
|
6730
7622
|
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
6731
|
-
rejectUnknownKeys(record4, ["maxDrawCalls", "maxFrameMsP95", "maxPassDrawCalls", "maxPassTriangles", "maxPhaseMsP95", "maxTriangles", "minFps"], scenarioPath, objectPath);
|
|
7623
|
+
rejectUnknownKeys(record4, ["maxDrawCalls", "maxFrameMsP95", "maxFrameMsReason", "maxPassDrawCalls", "maxPassTriangles", "maxPhaseMsP95", "maxTriangles", "minFps"], scenarioPath, objectPath);
|
|
6732
7624
|
const assertion = {
|
|
6733
7625
|
...present("maxDrawCalls", optionalNonNegativeNumber(record4, "maxDrawCalls", scenarioPath, objectPath)),
|
|
6734
7626
|
...present("maxFrameMsP95", optionalNonNegativeNumber(record4, "maxFrameMsP95", scenarioPath, objectPath)),
|
|
7627
|
+
...present("maxFrameMsReason", optionalString(record4, "maxFrameMsReason", scenarioPath, objectPath)),
|
|
6735
7628
|
...present("maxPassDrawCalls", validatePassBudget(record4.maxPassDrawCalls, scenarioPath, `${objectPath}.maxPassDrawCalls`)),
|
|
6736
7629
|
...present("maxPassTriangles", validatePassBudget(record4.maxPassTriangles, scenarioPath, `${objectPath}.maxPassTriangles`)),
|
|
6737
7630
|
...present("maxPhaseMsP95", validatePhaseBudget(record4.maxPhaseMsP95, scenarioPath, `${objectPath}.maxPhaseMsP95`)),
|
|
6738
7631
|
...present("maxTriangles", optionalNonNegativeNumber(record4, "maxTriangles", scenarioPath, objectPath)),
|
|
6739
7632
|
...present("minFps", optionalNonNegativeNumber(record4, "minFps", scenarioPath, objectPath))
|
|
6740
7633
|
};
|
|
7634
|
+
if (assertion.maxFrameMsP95 === LEGACY_SCAFFOLD_FRAME_MS && record4.maxFrameMsReason === void 0) {
|
|
7635
|
+
return { ...assertion, maxFrameMsReason: LEGACY_SCAFFOLD_FRAME_REASON };
|
|
7636
|
+
}
|
|
7637
|
+
if (assertion.maxFrameMsP95 !== void 0 && assertion.maxFrameMsP95 > 16.7 && (assertion.maxFrameMsReason ?? "").trim() === "") {
|
|
7638
|
+
throw invalidScenario(
|
|
7639
|
+
scenarioPath,
|
|
7640
|
+
`'${objectPath}.maxFrameMsP95' is ${assertion.maxFrameMsP95} ms, looser than the 16.7 ms (60 fps) budget every tier gets: set 'maxFrameMsReason' to say why, or drop maxFrameMsP95.`
|
|
7641
|
+
);
|
|
7642
|
+
}
|
|
6741
7643
|
if (Object.keys(assertion).length === 0) {
|
|
6742
7644
|
throw invalidScenario(
|
|
6743
7645
|
scenarioPath,
|
|
@@ -6899,8 +7801,21 @@ function validateStartupAssertion(value, scenarioPath, objectPath) {
|
|
|
6899
7801
|
}
|
|
6900
7802
|
result[key] = ceiling;
|
|
6901
7803
|
}
|
|
7804
|
+
const bytes = record4.maxOffscreenBytes;
|
|
7805
|
+
if (bytes !== void 0) {
|
|
7806
|
+
if (typeof bytes !== "number" || !Number.isInteger(bytes) || bytes < 0) {
|
|
7807
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.maxOffscreenBytes' must be a non-negative integer number of bytes, received ${describeValue(bytes)}.`);
|
|
7808
|
+
}
|
|
7809
|
+
result.maxOffscreenBytes = bytes;
|
|
7810
|
+
}
|
|
7811
|
+
if (record4.steadyCover !== void 0) {
|
|
7812
|
+
if (record4.steadyCover !== true) {
|
|
7813
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.steadyCover' must be true, received ${describeValue(record4.steadyCover)}; leave it out to skip the check.`);
|
|
7814
|
+
}
|
|
7815
|
+
result.steadyCover = true;
|
|
7816
|
+
}
|
|
6902
7817
|
if (Object.keys(result).length === 0) {
|
|
6903
|
-
throw invalidScenario(scenarioPath, `'${objectPath}' must set at least one of ${STARTUP_CEILINGS.join(", ")}; an empty startup assertion observes nothing.`);
|
|
7818
|
+
throw invalidScenario(scenarioPath, `'${objectPath}' must set at least one of ${[...STARTUP_CEILINGS, "maxOffscreenBytes", "steadyCover"].join(", ")}; an empty startup assertion observes nothing.`);
|
|
6904
7819
|
}
|
|
6905
7820
|
return result;
|
|
6906
7821
|
}
|
|
@@ -7209,12 +8124,116 @@ function validateSceneNodesAssertion(value, scenarioPath, objectPath) {
|
|
|
7209
8124
|
);
|
|
7210
8125
|
return result;
|
|
7211
8126
|
}
|
|
8127
|
+
function validateFootSlipAssertion(value, scenarioPath, objectPath) {
|
|
8128
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
8129
|
+
rejectUnknownKeys(record4, ["atStep", "entity", "feet", "maxSlideSpeed", "maxSlip", "stepSeconds"], scenarioPath, objectPath);
|
|
8130
|
+
const feet = record4.feet;
|
|
8131
|
+
if (!Array.isArray(feet) || feet.length === 0 || feet.some((foot) => typeof foot !== "string" || foot.trim() === "") || new Set(feet).size !== feet.length)
|
|
8132
|
+
throw invalidScenario(scenarioPath, `${objectPath}.feet must be a non-empty array of unique node names; got ${describeValue(feet)}.`);
|
|
8133
|
+
const maxSlip = optionalPositiveNumber(record4, "maxSlip", scenarioPath, objectPath);
|
|
8134
|
+
const maxSlideSpeed = optionalPositiveNumber(record4, "maxSlideSpeed", scenarioPath, objectPath);
|
|
8135
|
+
if (maxSlip === void 0 && maxSlideSpeed === void 0)
|
|
8136
|
+
throw invalidScenario(scenarioPath, `${objectPath}.maxSlip or ${objectPath}.maxSlideSpeed is required; a slip measure with no ceiling bounds nothing.`);
|
|
8137
|
+
return {
|
|
8138
|
+
atStep: requireString(record4, "atStep", scenarioPath, objectPath),
|
|
8139
|
+
...present("entity", optionalString(record4, "entity", scenarioPath, objectPath)),
|
|
8140
|
+
feet,
|
|
8141
|
+
...present("maxSlideSpeed", maxSlideSpeed),
|
|
8142
|
+
...present("maxSlip", maxSlip),
|
|
8143
|
+
...present("stepSeconds", optionalPositiveNumber(record4, "stepSeconds", scenarioPath, objectPath))
|
|
8144
|
+
};
|
|
8145
|
+
}
|
|
8146
|
+
function validateSightLineAssertion(value, scenarioPath, objectPath) {
|
|
8147
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
8148
|
+
rejectUnknownKeys(record4, ["entity", "maxBlockedRatio"], scenarioPath, objectPath);
|
|
8149
|
+
const maxBlockedRatio = optionalRatio(record4, "maxBlockedRatio", scenarioPath, objectPath);
|
|
8150
|
+
if (maxBlockedRatio === void 0) throw invalidScenario(scenarioPath, `${objectPath}.maxBlockedRatio is required; a sight line with no allowed blocked share bounds nothing.`);
|
|
8151
|
+
return {
|
|
8152
|
+
...present("entity", optionalString(record4, "entity", scenarioPath, objectPath)),
|
|
8153
|
+
maxBlockedRatio
|
|
8154
|
+
};
|
|
8155
|
+
}
|
|
8156
|
+
function validateEngineCostAssertion(value, scenarioPath, objectPath) {
|
|
8157
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
8158
|
+
rejectUnknownKeys(record4, ["maxInFrame", "maxPerFrame", "minWindows", "moving", "skipWindows", "source", "still"], scenarioPath, objectPath);
|
|
8159
|
+
const bounds = (key, owner = record4, at = objectPath) => {
|
|
8160
|
+
if (!hasKey(owner, key)) return void 0;
|
|
8161
|
+
const table = requireRecord(owner[key], scenarioPath, `${at}.${key}`);
|
|
8162
|
+
const names = Object.keys(table);
|
|
8163
|
+
if (names.length === 0) throw invalidScenario(scenarioPath, `'${at}.${key}' names no counter.`);
|
|
8164
|
+
for (const name of names) {
|
|
8165
|
+
const bound = table[name];
|
|
8166
|
+
if (typeof bound !== "number" || !Number.isFinite(bound) || bound < 0)
|
|
8167
|
+
throw invalidScenario(scenarioPath, `'${at}.${key}.${name}' must be a non-negative number, received ${describeValue(bound)}.`);
|
|
8168
|
+
}
|
|
8169
|
+
return table;
|
|
8170
|
+
};
|
|
8171
|
+
const maxPerFrame = bounds("maxPerFrame");
|
|
8172
|
+
const maxInFrame = bounds("maxInFrame");
|
|
8173
|
+
let still;
|
|
8174
|
+
if (hasKey(record4, "still")) {
|
|
8175
|
+
const at = `${objectPath}.still`;
|
|
8176
|
+
const stillRecord = requireRecord(record4.still, scenarioPath, at);
|
|
8177
|
+
rejectUnknownKeys(stillRecord, ["maxPerFrame", "windows"], scenarioPath, at);
|
|
8178
|
+
const windows = optionalPositiveInteger(stillRecord, "windows", scenarioPath, at);
|
|
8179
|
+
const stillBounds = bounds("maxPerFrame", stillRecord, at);
|
|
8180
|
+
if (windows === void 0 || stillBounds === void 0)
|
|
8181
|
+
throw invalidScenario(scenarioPath, `${at} needs 'windows' and 'maxPerFrame'.`);
|
|
8182
|
+
still = { maxPerFrame: stillBounds, windows };
|
|
8183
|
+
}
|
|
8184
|
+
let moving;
|
|
8185
|
+
if (hasKey(record4, "moving")) {
|
|
8186
|
+
const at = `${objectPath}.moving`;
|
|
8187
|
+
const movingRecord = requireRecord(record4.moving, scenarioPath, at);
|
|
8188
|
+
rejectUnknownKeys(movingRecord, ["maxInFrame", "maxPerFrame"], scenarioPath, at);
|
|
8189
|
+
if (still === void 0) throw invalidScenario(scenarioPath, `${at} needs 'still': the moving windows are the ones after it.`);
|
|
8190
|
+
const movingPerFrame = bounds("maxPerFrame", movingRecord, at);
|
|
8191
|
+
const movingInFrame = bounds("maxInFrame", movingRecord, at);
|
|
8192
|
+
if (movingPerFrame === void 0 && movingInFrame === void 0)
|
|
8193
|
+
throw invalidScenario(scenarioPath, `${at} must bound at least one counter.`);
|
|
8194
|
+
moving = { ...present("maxPerFrame", movingPerFrame), ...present("maxInFrame", movingInFrame) };
|
|
8195
|
+
}
|
|
8196
|
+
if (maxPerFrame === void 0 && maxInFrame === void 0 && still === void 0 && moving === void 0)
|
|
8197
|
+
throw invalidScenario(scenarioPath, `${objectPath} must bound at least one counter in 'maxPerFrame', 'maxInFrame', 'still' or 'moving'.`);
|
|
8198
|
+
const source = requireString(record4, "source", scenarioPath, objectPath);
|
|
8199
|
+
if (source.trim().length < 12)
|
|
8200
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.source' must say where the bounds came from.`);
|
|
8201
|
+
return {
|
|
8202
|
+
...present("maxPerFrame", maxPerFrame),
|
|
8203
|
+
...present("maxInFrame", maxInFrame),
|
|
8204
|
+
...present("minWindows", optionalPositiveInteger(record4, "minWindows", scenarioPath, objectPath)),
|
|
8205
|
+
...present("skipWindows", optionalNonNegativeInteger(record4, "skipWindows", scenarioPath, objectPath)),
|
|
8206
|
+
source,
|
|
8207
|
+
...present("still", still),
|
|
8208
|
+
...present("moving", moving)
|
|
8209
|
+
};
|
|
8210
|
+
}
|
|
8211
|
+
function validateHudAuditAssertion(value, scenarioPath, objectPath) {
|
|
8212
|
+
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
8213
|
+
rejectUnknownKeys(record4, ["minContrast", "noDebugText"], scenarioPath, objectPath);
|
|
8214
|
+
const noDebugText = optionalBoolean(record4, "noDebugText", scenarioPath, objectPath);
|
|
8215
|
+
if (noDebugText === false) {
|
|
8216
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.noDebugText' may only be true; remove the key to stop scanning for developer text.`);
|
|
8217
|
+
}
|
|
8218
|
+
const minContrast = optionalNumber2(record4, "minContrast", scenarioPath, objectPath);
|
|
8219
|
+
if (minContrast !== void 0 && (minContrast < 1 || minContrast > 21)) {
|
|
8220
|
+
throw invalidScenario(scenarioPath, `'${objectPath}.minContrast' must be between 1 and 21, received ${describeValue(minContrast)}.`);
|
|
8221
|
+
}
|
|
8222
|
+
if (noDebugText === void 0 && minContrast === void 0) {
|
|
8223
|
+
throw invalidScenario(scenarioPath, `${objectPath} must declare at least one of 'minContrast' or 'noDebugText'.`);
|
|
8224
|
+
}
|
|
8225
|
+
return {
|
|
8226
|
+
...present("minContrast", minContrast),
|
|
8227
|
+
...noDebugText === void 0 ? {} : { noDebugText: true }
|
|
8228
|
+
};
|
|
8229
|
+
}
|
|
7212
8230
|
function validateAnimationAssertion(value, scenarioPath, objectPath) {
|
|
7213
8231
|
const record4 = requireRecord(value, scenarioPath, objectPath);
|
|
7214
|
-
rejectUnknownKeys(record4, ["advancedFrames", "allowTrivial", "clip", "entered", "entity", "finished", "maxFootSlide", "strideSynced"], scenarioPath, objectPath);
|
|
8232
|
+
rejectUnknownKeys(record4, ["advancedFrames", "allowTrivial", "atStep", "clip", "entered", "entity", "finished", "maxFootSlide", "strideSynced"], scenarioPath, objectPath);
|
|
7215
8233
|
return {
|
|
7216
8234
|
...present("advancedFrames", optionalNumber2(record4, "advancedFrames", scenarioPath, objectPath)),
|
|
7217
8235
|
...present("allowTrivial", optionalTrivialityReason(record4, "allowTrivial", scenarioPath, objectPath)),
|
|
8236
|
+
...present("atStep", optionalString(record4, "atStep", scenarioPath, objectPath)),
|
|
7218
8237
|
...present("clip", optionalString(record4, "clip", scenarioPath, objectPath)),
|
|
7219
8238
|
...present("entered", optionalBoolean(record4, "entered", scenarioPath, objectPath)),
|
|
7220
8239
|
...present("entity", optionalString(record4, "entity", scenarioPath, objectPath)),
|
|
@@ -7244,12 +8263,14 @@ function validatePathAssertion(value, scenarioPath, objectPath) {
|
|
|
7244
8263
|
const atSteps = Array.isArray(record4.atSteps) ? record4.atSteps.map((step, index) => {
|
|
7245
8264
|
const stepPath = `${objectPath}.atSteps[${index}]`;
|
|
7246
8265
|
const entry = requireRecord(step, scenarioPath, stepPath);
|
|
7247
|
-
|
|
7248
|
-
|
|
8266
|
+
const stepLte = optionalNumber2(entry, "lte", scenarioPath, stepPath);
|
|
8267
|
+
if (!hasKey(entry, "equals") && entry.textIncludes === void 0 && stepLte === void 0) {
|
|
8268
|
+
throw invalidScenario(scenarioPath, `'${stepPath}' must set equals, lte or textIncludes; a labeled step with no expectation passes on any value.`);
|
|
7249
8269
|
}
|
|
7250
8270
|
return {
|
|
7251
8271
|
...hasKey(entry, "equals") ? { equals: entry.equals } : {},
|
|
7252
8272
|
label: requireString(entry, "label", scenarioPath, stepPath),
|
|
8273
|
+
...present("lte", stepLte),
|
|
7253
8274
|
...present("textIncludes", optionalString(entry, "textIncludes", scenarioPath, stepPath))
|
|
7254
8275
|
};
|
|
7255
8276
|
}) : void 0;
|
|
@@ -7406,7 +8427,7 @@ function validateNestedAssertionKeys(kind, value, scenarioPath, suffix) {
|
|
|
7406
8427
|
if (Array.isArray(value.atSteps)) {
|
|
7407
8428
|
value.atSteps.forEach((step, index) => {
|
|
7408
8429
|
if (isRecord3(step)) {
|
|
7409
|
-
rejectUnknownKeys(step, kind === "components" ? ["equals", "label"] : ["equals", "label", "textIncludes"], scenarioPath, `assert.${kind}${suffix}.atSteps[${index}]`);
|
|
8430
|
+
rejectUnknownKeys(step, kind === "components" ? ["equals", "label"] : ["equals", "label", "lte", "textIncludes"], scenarioPath, `assert.${kind}${suffix}.atSteps[${index}]`);
|
|
7410
8431
|
}
|
|
7411
8432
|
});
|
|
7412
8433
|
}
|
|
@@ -7415,7 +8436,7 @@ function validateNestedAssertionKeys(kind, value, scenarioPath, suffix) {
|
|
|
7415
8436
|
const fields = {
|
|
7416
8437
|
entityVisible: ["entity", "minProjectedPixels", "throughoutFrames"],
|
|
7417
8438
|
frameDiff: ["baselineImage", "maxChangedPixelRatio", "minChangedPixelRatio"],
|
|
7418
|
-
region: ["element", "height", "maxDarkPixelRatio", "maxLuminance", "minDarkPixelRatio", "minNonblankPixelRatio", "width", "x", "y"]
|
|
8439
|
+
region: ["element", "height", "maxDarkPixelRatio", "maxLuminance", "minDarkPixelRatio", "minNonblankPixelRatio", "minSharpness", "width", "x", "y"]
|
|
7419
8440
|
};
|
|
7420
8441
|
for (const [field, keys] of Object.entries(fields)) {
|
|
7421
8442
|
if (isRecord3(value[field])) {
|
|
@@ -7484,8 +8505,10 @@ var PLAYTEST_ROOT_KEYS = [
|
|
|
7484
8505
|
"assert",
|
|
7485
8506
|
"awaitStartup",
|
|
7486
8507
|
"bootFailure",
|
|
8508
|
+
"clock",
|
|
7487
8509
|
"inputDelivery",
|
|
7488
8510
|
"name",
|
|
8511
|
+
"network",
|
|
7489
8512
|
"parity",
|
|
7490
8513
|
"reducedMotion",
|
|
7491
8514
|
"schemaVersion",
|
|
@@ -7528,12 +8551,25 @@ function validatePlaytestScenario(value, scenarioPath, absolutePath) {
|
|
|
7528
8551
|
if (value.bootFailure !== void 0 && target !== "web") {
|
|
7529
8552
|
throw invalidScenario(scenarioPath, "Scenario bootFailure is browser-only and requires target 'web'.");
|
|
7530
8553
|
}
|
|
8554
|
+
if (value.clock !== void 0 && value.clock !== "wall-clock") {
|
|
8555
|
+
throw invalidScenario(scenarioPath, "Scenario clock must be 'wall-clock' when present.");
|
|
8556
|
+
}
|
|
8557
|
+
if (value.clock !== void 0 && target !== "web") {
|
|
8558
|
+
throw invalidScenario(scenarioPath, "Scenario clock is browser-only and requires target 'web'.");
|
|
8559
|
+
}
|
|
7531
8560
|
if (value.reducedMotion !== void 0 && value.reducedMotion !== "reduce") {
|
|
7532
8561
|
throw invalidScenario(scenarioPath, "Scenario reducedMotion must be 'reduce' when present.");
|
|
7533
8562
|
}
|
|
7534
8563
|
if (value.reducedMotion !== void 0 && target !== "web") {
|
|
7535
8564
|
throw invalidScenario(scenarioPath, "Scenario reducedMotion is browser-only and requires target 'web'.");
|
|
7536
8565
|
}
|
|
8566
|
+
if (value.network !== void 0 && !isRecord3(value.network)) {
|
|
8567
|
+
throw invalidScenario(scenarioPath, "Scenario network must be an object with downloadKbps and latencyMs.");
|
|
8568
|
+
}
|
|
8569
|
+
const network = value.network === void 0 ? void 0 : validateNetworkProfile(value.network, scenarioPath);
|
|
8570
|
+
if (network !== void 0 && target !== "web") {
|
|
8571
|
+
throw invalidScenario(scenarioPath, "Scenario network is browser-only and requires target 'web'.");
|
|
8572
|
+
}
|
|
7537
8573
|
const inputDelivery = value.inputDelivery ?? "deterministic";
|
|
7538
8574
|
if (inputDelivery !== "deterministic" && inputDelivery !== "focused-dom") {
|
|
7539
8575
|
throw invalidScenario(scenarioPath, "Scenario inputDelivery must be deterministic or focused-dom.");
|
|
@@ -7548,7 +8584,7 @@ function validatePlaytestScenario(value, scenarioPath, absolutePath) {
|
|
|
7548
8584
|
throw invalidScenario(scenarioPath, "Scenario subject must be a non-empty entity id when present.");
|
|
7549
8585
|
}
|
|
7550
8586
|
const subject = typeof value.subject === "string" ? value.subject : void 0;
|
|
7551
|
-
const steps = value.steps.map((step, index) => validateStep(step, scenarioPath, index));
|
|
8587
|
+
const steps = value.steps.flatMap((step, index) => isRecord3(step) && step.kind === "explore" ? expandExploreStep(step, scenarioPath, index) : [step]).map((step, index) => validateStep(step, scenarioPath, index));
|
|
7552
8588
|
if (steps.some(({ kind }) => kind === "aimAt") && subject === void 0) {
|
|
7553
8589
|
throw invalidScenario(scenarioPath, "A step with kind 'aimAt' aims the subject player start; declare scenario.subject or replace the step.");
|
|
7554
8590
|
}
|
|
@@ -7560,8 +8596,10 @@ function validatePlaytestScenario(value, scenarioPath, absolutePath) {
|
|
|
7560
8596
|
...assertions === void 0 ? {} : { assert: assertions },
|
|
7561
8597
|
...typeof value.awaitStartup === "boolean" ? { awaitStartup: value.awaitStartup } : {},
|
|
7562
8598
|
...value.bootFailure === "renderer-no-adapter" ? { bootFailure: value.bootFailure } : {},
|
|
8599
|
+
...value.clock === "wall-clock" ? { clock: value.clock } : {},
|
|
7563
8600
|
inputDelivery,
|
|
7564
8601
|
name,
|
|
8602
|
+
...network === void 0 ? {} : { network },
|
|
7565
8603
|
...value.parity === void 0 ? {} : { parity: validateParityConfig(requireRecord(value.parity, scenarioPath, "parity"), scenarioPath) },
|
|
7566
8604
|
...value.reducedMotion === "reduce" ? { reducedMotion: value.reducedMotion } : {},
|
|
7567
8605
|
schemaVersion: 1,
|
|
@@ -7575,6 +8613,55 @@ function validatePlaytestScenario(value, scenarioPath, absolutePath) {
|
|
|
7575
8613
|
warmupFrames: optionalNonNegativeInteger(value, "warmupFrames", scenarioPath, "scenario") ?? 0
|
|
7576
8614
|
};
|
|
7577
8615
|
}
|
|
8616
|
+
function expandExploreStep(value, scenarioPath, index) {
|
|
8617
|
+
rejectUnknownKeys(value, ["actions", "kind", "label", "move", "pointer", "seed", "ticks"], scenarioPath, `steps[${index}]`);
|
|
8618
|
+
const keys = (field) => {
|
|
8619
|
+
const list = value[field];
|
|
8620
|
+
if (list === void 0 && field === "actions") return [];
|
|
8621
|
+
if (!Array.isArray(list) || list.length === 0 || list.some((key) => typeof key !== "string" || key.trim() === "") || new Set(list).size !== list.length) {
|
|
8622
|
+
throw invalidStep(scenarioPath, `Scenario step ${index} with kind 'explore' must define ${field} as a non-empty array of unique key names.`);
|
|
8623
|
+
}
|
|
8624
|
+
return list;
|
|
8625
|
+
};
|
|
8626
|
+
if (!Number.isSafeInteger(value.seed)) throw invalidStep(scenarioPath, `Scenario step ${index} with kind 'explore' must define seed as an integer.`);
|
|
8627
|
+
const ticks = positiveInteger2(value.ticks);
|
|
8628
|
+
if (ticks === void 0) throw invalidStep(scenarioPath, `Scenario step ${index} with kind 'explore' must define ticks as a positive integer.`);
|
|
8629
|
+
if (value.pointer !== void 0 && typeof value.pointer !== "boolean") throw invalidStep(scenarioPath, `Scenario step ${index} with kind 'explore' pointer must be a boolean.`);
|
|
8630
|
+
if (value.label !== void 0 && (typeof value.label !== "string" || value.label.trim() === "")) throw invalidStep(scenarioPath, `Scenario step ${index} label must be a non-empty string.`);
|
|
8631
|
+
const move = keys("move");
|
|
8632
|
+
const actions = keys("actions");
|
|
8633
|
+
let state = value.seed >>> 0;
|
|
8634
|
+
const random = () => {
|
|
8635
|
+
state = state + 1831565813 >>> 0;
|
|
8636
|
+
let t = state;
|
|
8637
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
8638
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
8639
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
8640
|
+
};
|
|
8641
|
+
const pick = (list) => list[Math.floor(random() * list.length)];
|
|
8642
|
+
const steps = [];
|
|
8643
|
+
let heading = pick(move);
|
|
8644
|
+
for (let left = ticks; left > 0; ) {
|
|
8645
|
+
const holdTicks = Math.min(left, 10 + Math.floor(random() * 50));
|
|
8646
|
+
if (random() < 0.2) heading = pick(move);
|
|
8647
|
+
const press = /* @__PURE__ */ new Set([heading]);
|
|
8648
|
+
if (move.length > 1 && random() < 0.35) press.add(pick(move));
|
|
8649
|
+
if (actions.length > 0 && random() < 0.5) {
|
|
8650
|
+
press.add(pick(actions));
|
|
8651
|
+
if (random() < 0.25) press.add(pick(actions));
|
|
8652
|
+
}
|
|
8653
|
+
steps.push({
|
|
8654
|
+
holdTicks,
|
|
8655
|
+
kind: "input",
|
|
8656
|
+
press: [...press],
|
|
8657
|
+
...value.pointer === true ? { pointerPosition: { x: random(), y: random() } } : {},
|
|
8658
|
+
release: true
|
|
8659
|
+
});
|
|
8660
|
+
left -= holdTicks;
|
|
8661
|
+
}
|
|
8662
|
+
if (typeof value.label === "string") steps[steps.length - 1].label = value.label;
|
|
8663
|
+
return steps;
|
|
8664
|
+
}
|
|
7578
8665
|
function validateArtifacts(value, scenarioPath) {
|
|
7579
8666
|
rejectUnknownKeys(value, ["console", "contactSheet", "effectLog", "network", "runtimeTrace", "screenshots"], scenarioPath, "artifacts");
|
|
7580
8667
|
for (const key of ["console", "contactSheet", "network", "runtimeTrace"]) {
|
|
@@ -7657,6 +8744,21 @@ function validateParityTargets(value, scenarioPath, objectPath) {
|
|
|
7657
8744
|
return target;
|
|
7658
8745
|
});
|
|
7659
8746
|
}
|
|
8747
|
+
function validateNetworkProfile(value, scenarioPath) {
|
|
8748
|
+
rejectUnknownKeys(value, ["downloadKbps", "latencyMs"], scenarioPath, "network");
|
|
8749
|
+
const downloadKbps = value.downloadKbps;
|
|
8750
|
+
if (typeof downloadKbps !== "number" || !Number.isFinite(downloadKbps) || downloadKbps <= 0) {
|
|
8751
|
+
throw invalidScenario(
|
|
8752
|
+
scenarioPath,
|
|
8753
|
+
"Scenario network.downloadKbps must be a positive number of kilobits per second."
|
|
8754
|
+
);
|
|
8755
|
+
}
|
|
8756
|
+
const latencyMs = value.latencyMs;
|
|
8757
|
+
if (typeof latencyMs !== "number" || !Number.isFinite(latencyMs) || latencyMs < 0) {
|
|
8758
|
+
throw invalidScenario(scenarioPath, "Scenario network.latencyMs must be a non-negative number.");
|
|
8759
|
+
}
|
|
8760
|
+
return { downloadKbps, latencyMs };
|
|
8761
|
+
}
|
|
7660
8762
|
function validateSetup(value, scenarioPath, subject) {
|
|
7661
8763
|
rejectUnknownKeys(value, ["aim", "entities", "place", "resources", "spawn"], scenarioPath, "setup");
|
|
7662
8764
|
const spawn8 = validateSpawnRequest(value.spawn, scenarioPath);
|
|
@@ -7818,7 +8920,7 @@ var PLAYTEST_STEP_KEYS = [
|
|
|
7818
8920
|
"wheel",
|
|
7819
8921
|
"window"
|
|
7820
8922
|
];
|
|
7821
|
-
var MAX_RESOURCE_WAIT_TIMEOUT_MS =
|
|
8923
|
+
var MAX_RESOURCE_WAIT_TIMEOUT_MS = 3e5;
|
|
7822
8924
|
function validateStep(value, scenarioPath, index) {
|
|
7823
8925
|
if (!isRecord3(value)) {
|
|
7824
8926
|
throw invalidStep(scenarioPath, `Scenario step ${index} must be a JSON object.`);
|
|
@@ -7895,7 +8997,7 @@ function validateStep(value, scenarioPath, index) {
|
|
|
7895
8997
|
const waitTicks = positiveInteger2(value.waitTicks);
|
|
7896
8998
|
const kind = value.kind === "aimAt" ? "aimAt" : value.kind === "click" ? "click" : value.kind === "lifecycle" ? "lifecycle" : value.kind === "wait" ? "wait" : value.kind === "input" ? "input" : void 0;
|
|
7897
8999
|
if (value.kind !== void 0 && kind === void 0) {
|
|
7898
|
-
throw invalidStep(scenarioPath, `Scenario step ${index} kind must be 'aimAt', 'click', 'input', 'lifecycle', or 'wait'.`);
|
|
9000
|
+
throw invalidStep(scenarioPath, `Scenario step ${index} kind must be 'aimAt', 'click', 'explore', 'input', 'lifecycle', or 'wait'.`);
|
|
7899
9001
|
}
|
|
7900
9002
|
const at = validateClickTarget(value.at, scenarioPath, index);
|
|
7901
9003
|
const target = validateAimTarget(value.target, scenarioPath, index);
|
|
@@ -8223,6 +9325,14 @@ function validateStepLabels(steps, assertions, scenarioPath) {
|
|
|
8223
9325
|
for (const [index, assertion] of (assertions.tone ?? []).entries()) {
|
|
8224
9326
|
requireLabel(assertion.atStep, `assert.tone[${index}].atStep`);
|
|
8225
9327
|
}
|
|
9328
|
+
for (const [index, assertion] of (assertions.animation ?? []).entries()) {
|
|
9329
|
+
requireLabel(assertion.atStep, `assert.animation[${index}].atStep`);
|
|
9330
|
+
}
|
|
9331
|
+
for (const [index, assertion] of (assertions.footSlip ?? []).entries()) {
|
|
9332
|
+
requireLabel(assertion.atStep, `assert.footSlip[${index}].atStep`);
|
|
9333
|
+
if (assertions.footSlip.findIndex(({ atStep }) => atStep === assertion.atStep) !== index)
|
|
9334
|
+
throw invalidScenario(scenarioPath, `Assertion 'assert.footSlip[${index}]' repeats atStep '${assertion.atStep}'; list every foot in one assertion.`);
|
|
9335
|
+
}
|
|
8226
9336
|
for (const [index, assertion] of (assertions.signals ?? []).entries()) {
|
|
8227
9337
|
requireLabel(assertion.atStep, `assert.signals[${index}].atStep`);
|
|
8228
9338
|
}
|
|
@@ -8263,6 +9373,9 @@ function validateAssertions(value, scenarioPath) {
|
|
|
8263
9373
|
if (Array.isArray(value.signals) && value.signals.length === 0) {
|
|
8264
9374
|
throw invalidScenario(scenarioPath, "Assertion 'assert.signals' must contain at least one signal assertion.");
|
|
8265
9375
|
}
|
|
9376
|
+
if (Array.isArray(value.footSlip) && value.footSlip.length === 0) {
|
|
9377
|
+
throw invalidScenario(scenarioPath, "Assertion 'assert.footSlip' must contain at least one foot-slip assertion.");
|
|
9378
|
+
}
|
|
8266
9379
|
if (Array.isArray(value.tone) && value.tone.length === 0) {
|
|
8267
9380
|
throw invalidScenario(scenarioPath, "Assertion 'assert.tone' must contain at least one tone assertion.");
|
|
8268
9381
|
}
|
|
@@ -8278,7 +9391,7 @@ function validateAssertions(value, scenarioPath) {
|
|
|
8278
9391
|
);
|
|
8279
9392
|
}
|
|
8280
9393
|
const diagnostics = isRecord3(value.diagnostics) ? value.diagnostics : void 0;
|
|
8281
|
-
const
|
|
9394
|
+
const performance2 = isRecord3(value.performance) ? validatePerformanceAssertion(value.performance, scenarioPath, "assert.performance") : void 0;
|
|
8282
9395
|
const deviceMetrics = value.deviceMetrics === void 0 ? void 0 : validateDeviceMetricsAssertion(value.deviceMetrics, scenarioPath, "assert.deviceMetrics");
|
|
8283
9396
|
const parity = value.parity === void 0 ? void 0 : validateParityAssertion(value.parity, scenarioPath, "assert.parity");
|
|
8284
9397
|
const framebufferCoverage = isRecord3(value.framebufferCoverage) ? validateFramebufferCoverageAssertion(
|
|
@@ -8337,7 +9450,7 @@ function validateAssertions(value, scenarioPath) {
|
|
|
8337
9450
|
...Array.isArray(value.hud) ? {
|
|
8338
9451
|
hud: value.hud.map((entry, index) => validatePathAssertion(entry, scenarioPath, `assert.hud[${index}]`))
|
|
8339
9452
|
} : {},
|
|
8340
|
-
...
|
|
9453
|
+
...performance2 === void 0 ? {} : { performance: performance2 },
|
|
8341
9454
|
...renderChain === void 0 ? {} : { renderChain },
|
|
8342
9455
|
...startup === void 0 ? {} : { startup },
|
|
8343
9456
|
...pipelineCensus === void 0 ? {} : { pipelineCensus },
|
|
@@ -8346,6 +9459,12 @@ function validateAssertions(value, scenarioPath) {
|
|
|
8346
9459
|
...hasKey(value, "causedBy") ? {
|
|
8347
9460
|
causedBy: requireArray(value, "causedBy", scenarioPath, "assert.causedBy").map((entry, index) => validateCausedByAssertion(entry, scenarioPath, `assert.causedBy[${index}]`))
|
|
8348
9461
|
} : {},
|
|
9462
|
+
...hasKey(value, "footSlip") ? {
|
|
9463
|
+
footSlip: requireArray(value, "footSlip", scenarioPath, "assert.footSlip").map((entry, index) => validateFootSlipAssertion(entry, scenarioPath, `assert.footSlip[${index}]`))
|
|
9464
|
+
} : {},
|
|
9465
|
+
...hasKey(value, "sightLine") ? { sightLine: validateSightLineAssertion(value.sightLine, scenarioPath, "assert.sightLine") } : {},
|
|
9466
|
+
...hasKey(value, "hudAudit") ? { hudAudit: validateHudAuditAssertion(value.hudAudit, scenarioPath, "assert.hudAudit") } : {},
|
|
9467
|
+
...hasKey(value, "engineCost") ? { engineCost: validateEngineCostAssertion(value.engineCost, scenarioPath, "assert.engineCost") } : {},
|
|
8349
9468
|
...hasKey(value, "sceneNodes") ? {
|
|
8350
9469
|
sceneNodes: requireArray(value, "sceneNodes", scenarioPath, "assert.sceneNodes").map((entry, index) => validateSceneNodesAssertion(entry, scenarioPath, `assert.sceneNodes[${index}]`))
|
|
8351
9470
|
} : {},
|
|
@@ -8866,7 +9985,7 @@ var STANDALONE_PLAYTEST_OBSERVATION_FIELDS = [
|
|
|
8866
9985
|
"startup",
|
|
8867
9986
|
"visual"
|
|
8868
9987
|
];
|
|
8869
|
-
var HOST_PLAYTEST_OBSERVATION_FIELDS = ["deviceLifecycle", "deviceMetrics", "tone"];
|
|
9988
|
+
var HOST_PLAYTEST_OBSERVATION_FIELDS = ["deviceLifecycle", "deviceMetrics", "footSlip", "hudAudit", "sightLine", "tone"];
|
|
8870
9989
|
|
|
8871
9990
|
// src/runner/setup-confirmation.ts
|
|
8872
9991
|
function unconfirmed(requested, confirmation) {
|
|
@@ -9249,7 +10368,8 @@ async function connectPlaytestBridgeTransport(transport, scenario, timeoutMs = b
|
|
|
9249
10368
|
}
|
|
9250
10369
|
return {
|
|
9251
10370
|
advance: async (ticks, options) => {
|
|
9252
|
-
await transport.call("advance", ticks, advanceTimeoutMs(ticks), options);
|
|
10371
|
+
const result = await transport.call("advance", ticks, advanceTimeoutMs(ticks), options);
|
|
10372
|
+
return typeof result?.ticks === "number" ? result.ticks : void 0;
|
|
9253
10373
|
},
|
|
9254
10374
|
applySetup: async (request) => {
|
|
9255
10375
|
assertBoundedPayload(request);
|
|
@@ -9323,245 +10443,81 @@ function unavailableObservation(scenario) {
|
|
|
9323
10443
|
}
|
|
9324
10444
|
}
|
|
9325
10445
|
}
|
|
9326
|
-
const movement = scenario.assert?.movement;
|
|
9327
|
-
if (movement !== void 0) {
|
|
9328
|
-
const effectLogAssertion = movement.notFacing !== void 0 ? "movement.notFacing" : movement.notFacingPosition !== void 0 ? "movement.notFacingPosition" : movement.facesMovementWithinDegrees !== void 0 ? "movement.facesMovementWithinDegrees" : movement.minResolvedAxisDelta !== void 0 ? "movement.minResolvedAxisDelta" : void 0;
|
|
9329
|
-
if (effectLogAssertion !== void 0) {
|
|
9330
|
-
return {
|
|
9331
|
-
assertion: effectLogAssertion,
|
|
9332
|
-
path: "effectLog",
|
|
9333
|
-
reason: "The standalone runner does not produce an effect log."
|
|
9334
|
-
};
|
|
9335
|
-
}
|
|
9336
|
-
}
|
|
9337
|
-
return void 0;
|
|
9338
|
-
}
|
|
9339
|
-
function requiredObservationPaths(scenario, kind, defaultPath) {
|
|
9340
|
-
const movementStep = scenario.assert?.movement?.reachesPositionWithin?.atStep;
|
|
9341
|
-
if (kind === "movement" && movementStep !== void 0 && scenario.steps.at(-1)?.label !== movementStep) {
|
|
9342
|
-
return ["effectLogSeries"];
|
|
9343
|
-
}
|
|
9344
|
-
if (kind === "contacts" && scenario.assert?.contacts?.some(({ atStep }) => atStep !== void 0) === true) {
|
|
9345
|
-
return ["physicsDebugSeries"];
|
|
9346
|
-
}
|
|
9347
|
-
return [defaultPath];
|
|
9348
|
-
}
|
|
9349
|
-
function assertBoundedPayload(value) {
|
|
9350
|
-
assertJsonSafe(value);
|
|
9351
|
-
if (jsonByteLength(value) > PLAYTEST_PROTOCOL_LIMITS.maxPayloadBytes) {
|
|
9352
|
-
throw new PlaytestBridgeError(playtestDiagnostic(
|
|
9353
|
-
"TN_PLAYTEST_PAYLOAD_TOO_LARGE",
|
|
9354
|
-
`Bridge payload exceeds ${PLAYTEST_PROTOCOL_LIMITS.maxPayloadBytes} bytes.`,
|
|
9355
|
-
"Request fewer entities or return smaller provider observations."
|
|
9356
|
-
));
|
|
9357
|
-
}
|
|
9358
|
-
}
|
|
9359
|
-
async function bridgeCall(page, method, argument, timeoutMs = PLAYTEST_PROTOCOL_LIMITS.operationTimeoutMs, options) {
|
|
9360
|
-
let timeout;
|
|
9361
|
-
try {
|
|
9362
|
-
return await Promise.race([
|
|
9363
|
-
page.evaluate(
|
|
9364
|
-
async ({ argument: argument2, globalName, method: method2, options: options2 }) => {
|
|
9365
|
-
const bridge = globalThis[globalName];
|
|
9366
|
-
const operation = bridge?.[method2];
|
|
9367
|
-
if (typeof operation !== "function") {
|
|
9368
|
-
throw new Error(`Bridge operation '${method2}' is unavailable.`);
|
|
9369
|
-
}
|
|
9370
|
-
return operation.call(bridge, argument2, options2);
|
|
9371
|
-
},
|
|
9372
|
-
{ argument, globalName: PLAYTEST_BRIDGE_GLOBAL, method, options }
|
|
9373
|
-
),
|
|
9374
|
-
new Promise((_resolve, reject) => {
|
|
9375
|
-
timeout = setTimeout(() => reject(new PlaytestBridgeError(playtestDiagnostic(
|
|
9376
|
-
"TN_PLAYTEST_OPERATION_TIMEOUT",
|
|
9377
|
-
`Bridge operation '${method}' exceeded ${timeoutMs}ms.`,
|
|
9378
|
-
"Bound the provider work or return a smaller observation payload."
|
|
9379
|
-
))), timeoutMs);
|
|
9380
|
-
})
|
|
9381
|
-
]);
|
|
9382
|
-
} finally {
|
|
9383
|
-
if (timeout !== void 0) clearTimeout(timeout);
|
|
9384
|
-
}
|
|
9385
|
-
}
|
|
9386
|
-
var DEFAULT_XVFB_SCREEN = "1600x900x24";
|
|
9387
|
-
var HOST_DISPLAY_ENV = "TN_PLAYTEST_HOST_DISPLAY";
|
|
9388
|
-
var STRIPPED_WAYLAND_VARS = ["WAYLAND_DISPLAY", "WAYLAND_SOCKET", "XDG_SESSION_TYPE"];
|
|
9389
|
-
function decideDisplayStrategy(input) {
|
|
9390
|
-
if (input.platform !== "linux") return { kind: "host" };
|
|
9391
|
-
const privateXvfb = {
|
|
9392
|
-
kind: "private-xvfb",
|
|
9393
|
-
screen: input.env.TN_XVFB_SCREEN ?? DEFAULT_XVFB_SCREEN
|
|
9394
|
-
};
|
|
9395
|
-
if (!hostDisplayRequested(input.env)) return privateXvfb;
|
|
9396
|
-
const display = input.env.DISPLAY;
|
|
9397
|
-
if (display === void 0 || display.length === 0) {
|
|
9398
|
-
throw new Error("TN_PLAYTEST_HOST_DISPLAY_UNAVAILABLE: the requested host display requires DISPLAY.");
|
|
9399
|
-
}
|
|
9400
|
-
const available = input.displaySocketExists?.(display) ?? x11DisplayIsUsable(display, input.env);
|
|
9401
|
-
if (!available) {
|
|
9402
|
-
throw new Error(`TN_PLAYTEST_HOST_DISPLAY_UNAVAILABLE: cannot connect to requested DISPLAY=${display}. Refusing to substitute a private Xvfb.`);
|
|
9403
|
-
}
|
|
9404
|
-
return { display, kind: "existing" };
|
|
9405
|
-
}
|
|
9406
|
-
function hostDisplayRequested(env) {
|
|
9407
|
-
const value = env[HOST_DISPLAY_ENV];
|
|
9408
|
-
return value === "1" || value?.toLowerCase() === "true";
|
|
9409
|
-
}
|
|
9410
|
-
function x11DisplayIsUsable(display, env) {
|
|
9411
|
-
const probe = spawnSync("xdpyinfo", ["-display", display], { env, stdio: "ignore", timeout: 2e3 });
|
|
9412
|
-
if (probe.error) {
|
|
9413
|
-
throw new Error(`TN_PLAYTEST_HOST_DISPLAY_UNAVAILABLE: cannot verify DISPLAY=${display}: xdpyinfo ${probe.error.message}.`);
|
|
9414
|
-
}
|
|
9415
|
-
return probe.status === 0;
|
|
9416
|
-
}
|
|
9417
|
-
function childEnvForDisplay(env, display) {
|
|
9418
|
-
const child = { ...env };
|
|
9419
|
-
for (const name of STRIPPED_WAYLAND_VARS) delete child[name];
|
|
9420
|
-
child.DISPLAY = display;
|
|
9421
|
-
return child;
|
|
9422
|
-
}
|
|
9423
|
-
function runNeedsPixels(config, scenario) {
|
|
9424
|
-
if (config.headless !== true) return true;
|
|
9425
|
-
const takesScreenshot = scenario.artifacts?.screenshots !== false || scenario.steps.some(({ screenshot }) => screenshot !== void 0);
|
|
9426
|
-
const evaluatesVisual = (scenario.assert?.visual?.length ?? 0) > 0 || (scenario.assert?.tone?.length ?? 0) > 0;
|
|
9427
|
-
return takesScreenshot || evaluatesVisual || scenario.assert?.framebufferCoverage !== void 0;
|
|
9428
|
-
}
|
|
9429
|
-
async function provideDisplay(options = {}) {
|
|
9430
|
-
const env = options.env ?? process.env;
|
|
9431
|
-
const platform = options.platform ?? process.platform;
|
|
9432
|
-
const strategy = decideDisplayStrategy({
|
|
9433
|
-
displaySocketExists: options.displaySocketExists,
|
|
9434
|
-
env,
|
|
9435
|
-
platform
|
|
9436
|
-
});
|
|
9437
|
-
if (strategy.kind === "host") {
|
|
9438
|
-
return {
|
|
9439
|
-
compositor: void 0,
|
|
9440
|
-
display: void 0,
|
|
9441
|
-
env: { ...env },
|
|
9442
|
-
release: async () => void 0,
|
|
9443
|
-
strategy
|
|
9444
|
-
};
|
|
9445
|
-
}
|
|
9446
|
-
if (strategy.kind === "existing") {
|
|
9447
|
-
return {
|
|
9448
|
-
compositor: void 0,
|
|
9449
|
-
display: strategy.display,
|
|
9450
|
-
env: childEnvForDisplay(env, strategy.display),
|
|
9451
|
-
release: async () => void 0,
|
|
9452
|
-
strategy
|
|
9453
|
-
};
|
|
9454
|
-
}
|
|
9455
|
-
const commandExists = options.commandExists ?? defaultCommandExists;
|
|
9456
|
-
if (!commandExists("Xvfb")) {
|
|
9457
|
-
throw new Error(
|
|
9458
|
-
"No usable X display is available and Xvfb is not installed, so this pixel-producing run cannot start (Debian/Ubuntu 'xvfb', Arch 'xorg-server-xvfb', Fedora 'xorg-x11-server-Xvfb'). Refusing to render blind."
|
|
9459
|
-
);
|
|
9460
|
-
}
|
|
9461
|
-
const spawnProcess = options.spawnProcess ?? spawn;
|
|
9462
|
-
const xvfb = spawnProcess("Xvfb", [
|
|
9463
|
-
"-displayfd",
|
|
9464
|
-
"3",
|
|
9465
|
-
"-nolisten",
|
|
9466
|
-
"tcp",
|
|
9467
|
-
// COMPOSITE and SHAPE are what a compositing manager needs before it can blend anything, and
|
|
9468
|
-
// the native desktop runtime refuses to attach its UI overlay to a display without one. Xvfb
|
|
9469
|
-
// does not enable them by default, so every native UI run on a private display reported
|
|
9470
|
-
// `TN_UI_OVERLAY:{"attached":false,"reason":"no compositing manager is running"}` — including
|
|
9471
|
-
// the starter template's own shipped native-playtests/react-hud scenario, which failed out of
|
|
9472
|
-
// the box on a freshly scaffolded project. A browser run does not care either way.
|
|
9473
|
-
"+extension",
|
|
9474
|
-
"COMPOSITE",
|
|
9475
|
-
"+extension",
|
|
9476
|
-
"SHAPE",
|
|
9477
|
-
"-screen",
|
|
9478
|
-
"0",
|
|
9479
|
-
strategy.screen
|
|
9480
|
-
], { stdio: ["ignore", "ignore", "pipe", "pipe"] });
|
|
9481
|
-
xvfb.on?.("error", () => void 0);
|
|
9482
|
-
try {
|
|
9483
|
-
const number = await readXvfbDisplayNumber(xvfb);
|
|
9484
|
-
const display = `:${number}`;
|
|
9485
|
-
const compositor = await startCompositor(display, { commandExists, env, spawnProcess });
|
|
9486
|
-
return {
|
|
9487
|
-
compositor: compositor?.name,
|
|
9488
|
-
display,
|
|
9489
|
-
env: childEnvForDisplay(env, display),
|
|
9490
|
-
release: async () => {
|
|
9491
|
-
if (compositor !== void 0) await stopChild(compositor.child);
|
|
9492
|
-
await stopChild(xvfb);
|
|
9493
|
-
},
|
|
9494
|
-
strategy
|
|
9495
|
-
};
|
|
9496
|
-
} catch (error) {
|
|
9497
|
-
await stopChild(xvfb);
|
|
9498
|
-
throw error;
|
|
9499
|
-
}
|
|
9500
|
-
}
|
|
9501
|
-
var COMPOSITORS = [
|
|
9502
|
-
{ args: ["-n"], name: "xcompmgr" },
|
|
9503
|
-
{ args: [], name: "picom" },
|
|
9504
|
-
{ args: [], name: "compton" }
|
|
9505
|
-
];
|
|
9506
|
-
var COMPOSITOR_SETTLE_MS = 250;
|
|
9507
|
-
async function startCompositor(display, options) {
|
|
9508
|
-
const choice = COMPOSITORS.find(({ name }) => options.commandExists(name));
|
|
9509
|
-
if (choice === void 0) return void 0;
|
|
9510
|
-
const child = options.spawnProcess(choice.name, [...choice.args], {
|
|
9511
|
-
env: { ...options.env, DISPLAY: display },
|
|
9512
|
-
stdio: "ignore"
|
|
9513
|
-
});
|
|
9514
|
-
let spawnFailed = false;
|
|
9515
|
-
child.on?.("error", () => {
|
|
9516
|
-
spawnFailed = true;
|
|
9517
|
-
});
|
|
9518
|
-
await new Promise((settle) => setTimeout(settle, COMPOSITOR_SETTLE_MS));
|
|
9519
|
-
if (spawnFailed) return void 0;
|
|
9520
|
-
if ((child.exitCode ?? null) !== null || (child.signalCode ?? null) !== null) return void 0;
|
|
9521
|
-
return { child, name: choice.name };
|
|
10446
|
+
const movement = scenario.assert?.movement;
|
|
10447
|
+
if (movement !== void 0) {
|
|
10448
|
+
const effectLogAssertion = movement.notFacing !== void 0 ? "movement.notFacing" : movement.notFacingPosition !== void 0 ? "movement.notFacingPosition" : movement.facesMovementWithinDegrees !== void 0 ? "movement.facesMovementWithinDegrees" : movement.minResolvedAxisDelta !== void 0 ? "movement.minResolvedAxisDelta" : void 0;
|
|
10449
|
+
if (effectLogAssertion !== void 0) {
|
|
10450
|
+
return {
|
|
10451
|
+
assertion: effectLogAssertion,
|
|
10452
|
+
path: "effectLog",
|
|
10453
|
+
reason: "The standalone runner does not produce an effect log."
|
|
10454
|
+
};
|
|
10455
|
+
}
|
|
10456
|
+
}
|
|
10457
|
+
return void 0;
|
|
9522
10458
|
}
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
throw new Error("Xvfb was spawned without a display-report descriptor to read.");
|
|
10459
|
+
function requiredObservationPaths(scenario, kind, defaultPath) {
|
|
10460
|
+
const movementStep = scenario.assert?.movement?.reachesPositionWithin?.atStep;
|
|
10461
|
+
if (kind === "movement" && movementStep !== void 0 && scenario.steps.at(-1)?.label !== movementStep) {
|
|
10462
|
+
return ["effectLogSeries"];
|
|
9528
10463
|
}
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
if (settled) return;
|
|
9534
|
-
settled = true;
|
|
9535
|
-
clearTimeout(timer);
|
|
9536
|
-
stream.removeListener("data", onData);
|
|
9537
|
-
stream.removeListener("close", onClose);
|
|
9538
|
-
settle();
|
|
9539
|
-
};
|
|
9540
|
-
const onData = (chunk) => {
|
|
9541
|
-
const number = Number.parseInt(String(chunk).trim(), 10);
|
|
9542
|
-
if (Number.isInteger(number) && number >= 0) finish(() => resolveDisplay(number));
|
|
9543
|
-
};
|
|
9544
|
-
const onClose = () => finish(() => rejectDisplay(new Error("Xvfb exited before it reported a display.")));
|
|
9545
|
-
const timer = setTimeout(() => finish(() => {
|
|
9546
|
-
rejectDisplay(new Error(`Xvfb did not report a display within ${XVFB_DISPLAY_TIMEOUT_MS}ms.`));
|
|
9547
|
-
}), XVFB_DISPLAY_TIMEOUT_MS);
|
|
9548
|
-
stream.on("data", onData);
|
|
9549
|
-
stream.on("close", onClose);
|
|
9550
|
-
});
|
|
10464
|
+
if (kind === "contacts" && scenario.assert?.contacts?.some(({ atStep }) => atStep !== void 0) === true) {
|
|
10465
|
+
return ["physicsDebugSeries"];
|
|
10466
|
+
}
|
|
10467
|
+
return [defaultPath];
|
|
9551
10468
|
}
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
if (
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
10469
|
+
function assertBoundedPayload(value) {
|
|
10470
|
+
assertJsonSafe(value);
|
|
10471
|
+
if (jsonByteLength(value) > PLAYTEST_PROTOCOL_LIMITS.maxPayloadBytes) {
|
|
10472
|
+
throw new PlaytestBridgeError(playtestDiagnostic(
|
|
10473
|
+
"TN_PLAYTEST_PAYLOAD_TOO_LARGE",
|
|
10474
|
+
`Bridge payload exceeds ${PLAYTEST_PROTOCOL_LIMITS.maxPayloadBytes} bytes.`,
|
|
10475
|
+
"Request fewer entities or return smaller provider observations."
|
|
10476
|
+
));
|
|
9559
10477
|
}
|
|
9560
|
-
if (!exitedAlready()) child.kill("SIGKILL");
|
|
9561
10478
|
}
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
10479
|
+
var PENDING_BRIDGE_OPERATIONS_GLOBAL = "__THREENATIVE_PLAYTEST_PENDING_OPERATIONS__";
|
|
10480
|
+
async function bridgeCall(page, method, argument, timeoutMs = PLAYTEST_PROTOCOL_LIMITS.operationTimeoutMs, options) {
|
|
10481
|
+
let timeout;
|
|
10482
|
+
try {
|
|
10483
|
+
return await Promise.race([
|
|
10484
|
+
page.evaluate(
|
|
10485
|
+
({ argument: argument2, globalName, method: method2, options: options2, pendingOperationsGlobal }) => {
|
|
10486
|
+
const bridge = globalThis[globalName];
|
|
10487
|
+
const operation = bridge?.[method2];
|
|
10488
|
+
if (typeof operation !== "function") {
|
|
10489
|
+
throw new Error(`Bridge operation '${method2}' is unavailable.`);
|
|
10490
|
+
}
|
|
10491
|
+
const result = operation.call(bridge, argument2, options2);
|
|
10492
|
+
if (result === null || typeof result !== "object" && typeof result !== "function") return result;
|
|
10493
|
+
if (typeof result.then !== "function") return result;
|
|
10494
|
+
const host = globalThis;
|
|
10495
|
+
const pending = host[pendingOperationsGlobal] ?? /* @__PURE__ */ new Set();
|
|
10496
|
+
host[pendingOperationsGlobal] = pending;
|
|
10497
|
+
pending.add(result);
|
|
10498
|
+
const forget = () => pending.delete(result);
|
|
10499
|
+
void result.then(forget, forget);
|
|
10500
|
+
return result;
|
|
10501
|
+
},
|
|
10502
|
+
{
|
|
10503
|
+
argument,
|
|
10504
|
+
globalName: PLAYTEST_BRIDGE_GLOBAL,
|
|
10505
|
+
method,
|
|
10506
|
+
options,
|
|
10507
|
+
pendingOperationsGlobal: PENDING_BRIDGE_OPERATIONS_GLOBAL
|
|
10508
|
+
}
|
|
10509
|
+
),
|
|
10510
|
+
new Promise((_resolve, reject) => {
|
|
10511
|
+
timeout = setTimeout(() => reject(new PlaytestBridgeError(playtestDiagnostic(
|
|
10512
|
+
"TN_PLAYTEST_OPERATION_TIMEOUT",
|
|
10513
|
+
`Bridge operation '${method}' exceeded ${timeoutMs}ms.`,
|
|
10514
|
+
"Bound the provider work or return a smaller observation payload."
|
|
10515
|
+
))), timeoutMs);
|
|
10516
|
+
})
|
|
10517
|
+
]);
|
|
10518
|
+
} finally {
|
|
10519
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
10520
|
+
}
|
|
9565
10521
|
}
|
|
9566
10522
|
var execFileAsync = promisify(execFile);
|
|
9567
10523
|
function hostCssUiExtras() {
|
|
@@ -10092,7 +11048,9 @@ function parseAndroidConsoleEntries(output, app) {
|
|
|
10092
11048
|
`(?:^|[^\\w.])${app.packageName.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}(?=[:/\\s,})]|$)`,
|
|
10093
11049
|
"u"
|
|
10094
11050
|
);
|
|
10095
|
-
return output.split(/\r?\n/u).filter(
|
|
11051
|
+
return output.split(/\r?\n/u).filter(
|
|
11052
|
+
(line) => !/^[VDIWEF]\/(?:SurfaceSyncGroup|TransitionController|AppHibernationService)\(/u.test(line)
|
|
11053
|
+
).filter((line) => {
|
|
10096
11054
|
if (app === void 0) return /Mystral|THREENATIVE|chromium/u.test(line);
|
|
10097
11055
|
if (app.pids.size === 0) return line.trim().length > 0;
|
|
10098
11056
|
const pid = /^[VDIWEF]\/[^\n(]+\(\s*(\d+)\)/u.exec(line)?.[1];
|
|
@@ -11112,6 +12070,82 @@ function containsPaintedPixels(screenshot) {
|
|
|
11112
12070
|
}
|
|
11113
12071
|
return false;
|
|
11114
12072
|
}
|
|
12073
|
+
async function sampleHudAudit(page) {
|
|
12074
|
+
return page.evaluate(() => {
|
|
12075
|
+
const MAX_ITEMS = 400;
|
|
12076
|
+
const MAX_TEXT = 120;
|
|
12077
|
+
const parseColour = (value) => {
|
|
12078
|
+
const match = /^rgba?\((.+)\)$/u.exec(value.trim());
|
|
12079
|
+
if (match !== null) {
|
|
12080
|
+
const parts = match[1].split(/[\s,/]+/u).filter((part) => part !== "");
|
|
12081
|
+
const channels = parts.slice(0, 3).map((part) => Number.parseFloat(part));
|
|
12082
|
+
const alphaText = parts[3];
|
|
12083
|
+
const alpha = alphaText === void 0 ? 1 : Number.parseFloat(alphaText);
|
|
12084
|
+
const normalizedAlpha = alpha > 1 ? alpha / 255 : alpha;
|
|
12085
|
+
if (channels.length === 3 && channels.every((channel) => Number.isFinite(channel)) && Number.isFinite(normalizedAlpha)) {
|
|
12086
|
+
return [channels[0], channels[1], channels[2], Math.min(Math.max(normalizedAlpha, 0), 1)];
|
|
12087
|
+
}
|
|
12088
|
+
}
|
|
12089
|
+
const canvas = document.createElement("canvas");
|
|
12090
|
+
canvas.width = 1;
|
|
12091
|
+
canvas.height = 1;
|
|
12092
|
+
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
12093
|
+
if (context === null) return [0, 0, 0, 1];
|
|
12094
|
+
context.clearRect(0, 0, 1, 1);
|
|
12095
|
+
context.fillStyle = value;
|
|
12096
|
+
context.fillRect(0, 0, 1, 1);
|
|
12097
|
+
const data = context.getImageData(0, 0, 1, 1).data;
|
|
12098
|
+
return [data[0], data[1], data[2], data[3] / 255];
|
|
12099
|
+
};
|
|
12100
|
+
const backing = (element) => {
|
|
12101
|
+
let accumulated = [0, 0, 0, 0];
|
|
12102
|
+
for (let current = element; current !== null; current = current.parentElement) {
|
|
12103
|
+
const [r, g, b, a] = parseColour(window.getComputedStyle(current).backgroundColor);
|
|
12104
|
+
if (a > 0 && accumulated[3] < 0.99) {
|
|
12105
|
+
const near = accumulated[3];
|
|
12106
|
+
const total = near + a * (1 - near);
|
|
12107
|
+
if (total > 0) {
|
|
12108
|
+
accumulated = [
|
|
12109
|
+
(accumulated[0] * near + r * a * (1 - near)) / total,
|
|
12110
|
+
(accumulated[1] * near + g * a * (1 - near)) / total,
|
|
12111
|
+
(accumulated[2] * near + b * a * (1 - near)) / total,
|
|
12112
|
+
total
|
|
12113
|
+
];
|
|
12114
|
+
}
|
|
12115
|
+
}
|
|
12116
|
+
if (accumulated[3] >= 0.99 || current === document.documentElement) break;
|
|
12117
|
+
}
|
|
12118
|
+
return accumulated;
|
|
12119
|
+
};
|
|
12120
|
+
const items = [];
|
|
12121
|
+
for (const element of document.body.querySelectorAll("*")) {
|
|
12122
|
+
if (items.length === MAX_ITEMS) break;
|
|
12123
|
+
if (element.closest("script, style, canvas, noscript") !== null) continue;
|
|
12124
|
+
let ownText = "";
|
|
12125
|
+
for (const node of element.childNodes) {
|
|
12126
|
+
if (node.nodeType === 3) ownText += node.textContent ?? "";
|
|
12127
|
+
}
|
|
12128
|
+
const text = ownText.replace(/\s+/gu, " ").trim();
|
|
12129
|
+
if (text === "") continue;
|
|
12130
|
+
const style = window.getComputedStyle(element);
|
|
12131
|
+
if (style.display === "none" || style.visibility !== "visible") continue;
|
|
12132
|
+
const opacity = Number.parseFloat(style.opacity);
|
|
12133
|
+
if (!Number.isFinite(opacity) || opacity <= 0) continue;
|
|
12134
|
+
const rect = element.getBoundingClientRect();
|
|
12135
|
+
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
12136
|
+
if (rect.right <= 0 || rect.bottom <= 0 || rect.left >= window.innerWidth || rect.top >= window.innerHeight) continue;
|
|
12137
|
+
const classes = Array.from(element.classList).slice(0, 2).map((name) => `.${name}`).join("");
|
|
12138
|
+
items.push({
|
|
12139
|
+
background: backing(element),
|
|
12140
|
+
color: parseColour(style.color),
|
|
12141
|
+
fontSizePx: Number.parseFloat(style.fontSize),
|
|
12142
|
+
selector: `${element.tagName.toLowerCase()}${element.id === "" ? "" : `#${element.id}`}${classes}`,
|
|
12143
|
+
text: text.slice(0, MAX_TEXT)
|
|
12144
|
+
});
|
|
12145
|
+
}
|
|
12146
|
+
return { items };
|
|
12147
|
+
});
|
|
12148
|
+
}
|
|
11115
12149
|
async function sampleHud(page, assertions) {
|
|
11116
12150
|
if (assertions.length === 0) return {};
|
|
11117
12151
|
const snapshots = await page.evaluate((requestedAssertions) => Object.fromEntries(requestedAssertions.flatMap(({ id, path: path2 }) => {
|
|
@@ -11667,9 +12701,50 @@ function regionMetrics(png, region) {
|
|
|
11667
12701
|
if (luminance <= maximumLuminance) dark += 1;
|
|
11668
12702
|
}
|
|
11669
12703
|
}
|
|
11670
|
-
return {
|
|
12704
|
+
return {
|
|
12705
|
+
darkPixelRatio: dark / pixels,
|
|
12706
|
+
nonblankPixelRatio: nonblank / pixels,
|
|
12707
|
+
...region.minSharpness === void 0 ? {} : { sharpness: regionSharpness(png, x0, y0, x1, y1) }
|
|
12708
|
+
};
|
|
12709
|
+
}
|
|
12710
|
+
function regionSharpness(png, x0, y0, x1, y1) {
|
|
12711
|
+
const width = x1 - x0;
|
|
12712
|
+
const height = y1 - y0;
|
|
12713
|
+
const luma = new Float64Array(width * height);
|
|
12714
|
+
for (let y = 0; y < height; y += 1) {
|
|
12715
|
+
for (let x = 0; x < width; x += 1) {
|
|
12716
|
+
const offset = ((y0 + y) * png.width + x0 + x) * 4;
|
|
12717
|
+
luma[y * width + x] = 0.2126 * png.data[offset] + 0.7152 * png.data[offset + 1] + 0.0722 * png.data[offset + 2];
|
|
12718
|
+
}
|
|
12719
|
+
}
|
|
12720
|
+
const halfWidth = Math.floor(width / 2);
|
|
12721
|
+
const halfHeight = Math.floor(height / 2);
|
|
12722
|
+
const half = new Float64Array(halfWidth * halfHeight);
|
|
12723
|
+
for (let y = 0; y < halfHeight; y += 1) {
|
|
12724
|
+
for (let x = 0; x < halfWidth; x += 1) {
|
|
12725
|
+
const at = 2 * y * width + 2 * x;
|
|
12726
|
+
half[y * halfWidth + x] = (luma[at] + luma[at + 1] + luma[at + width] + luma[at + width + 1]) / 4;
|
|
12727
|
+
}
|
|
12728
|
+
}
|
|
12729
|
+
const coarse = laplacianVariance(half, halfWidth, halfHeight);
|
|
12730
|
+
return coarse === 0 ? 0 : laplacianVariance(luma, width, height) / coarse;
|
|
12731
|
+
}
|
|
12732
|
+
function laplacianVariance(luma, width, height) {
|
|
12733
|
+
let sum = 0;
|
|
12734
|
+
let squares = 0;
|
|
12735
|
+
let count = 0;
|
|
12736
|
+
for (let y = 1; y < height - 1; y += 1) {
|
|
12737
|
+
for (let x = 1; x < width - 1; x += 1) {
|
|
12738
|
+
const at = y * width + x;
|
|
12739
|
+
const value = luma[at - 1] + luma[at + 1] + luma[at - width] + luma[at + width] - 4 * luma[at];
|
|
12740
|
+
sum += value;
|
|
12741
|
+
squares += value * value;
|
|
12742
|
+
count += 1;
|
|
12743
|
+
}
|
|
12744
|
+
}
|
|
12745
|
+
return count === 0 ? 0 : squares / count - (sum / count) ** 2;
|
|
11671
12746
|
}
|
|
11672
|
-
async function runStep(page, bridge, step, viewport, pathEntity, pathPositions, inputState, movementSampleRequest, finalStep, subject, liveClock = false, cpuWindow,
|
|
12747
|
+
async function runStep(page, bridge, step, viewport, pathEntity, pathPositions, inputState, movementSampleRequest, finalStep, subject, liveClock = false, cpuWindow, stepWindow, sightLine) {
|
|
11673
12748
|
if (step.waitForResource !== void 0) {
|
|
11674
12749
|
if (bridge === void 0 || movementSampleRequest === void 0) {
|
|
11675
12750
|
throw new PlaytestBridgeError(playtestDiagnostic(
|
|
@@ -11685,7 +12760,7 @@ async function runStep(page, bridge, step, viewport, pathEntity, pathPositions,
|
|
|
11685
12760
|
throw new PlaytestBridgeError(playtestDiagnostic(
|
|
11686
12761
|
"TN_PLAYTEST_OBSERVATION_UNAVAILABLE",
|
|
11687
12762
|
`Resource wait for '${wait.id}.${wait.path}' has no timeout.`,
|
|
11688
|
-
"Validate the scenario with timeoutMs as a positive integer no greater than
|
|
12763
|
+
"Validate the scenario with timeoutMs as a positive integer no greater than 300000."
|
|
11689
12764
|
));
|
|
11690
12765
|
}
|
|
11691
12766
|
const after = await waitForResource({
|
|
@@ -11765,8 +12840,8 @@ async function runStep(page, bridge, step, viewport, pathEntity, pathPositions,
|
|
|
11765
12840
|
"Advertise runtime.fixedStep from the bridge so ticks are deterministic, or author the step in waitFrames/holdFrames, which are display frames and say so."
|
|
11766
12841
|
));
|
|
11767
12842
|
}
|
|
11768
|
-
if (
|
|
11769
|
-
await
|
|
12843
|
+
if (stepWindow !== void 0) {
|
|
12844
|
+
await stepWindow(ticks);
|
|
11770
12845
|
} else if (cpuWindow !== void 0) {
|
|
11771
12846
|
if (step.kind !== "wait" || step.waitTicks !== 1e3 || ticks < 1e3 || !fixedStep || bridge === void 0 || liveClock) {
|
|
11772
12847
|
throw new Error("TN_PLAYTEST_CPU_WINDOW_FAILED: measurement requires a fixed-step 1000-tick WAIT");
|
|
@@ -11775,16 +12850,19 @@ async function runStep(page, bridge, step, viewport, pathEntity, pathPositions,
|
|
|
11775
12850
|
await cpuWindow(() => advanceFixedStep(page, bridge, 1e3, true));
|
|
11776
12851
|
await waitFrames(page, 1);
|
|
11777
12852
|
await samplePathPosition(bridge, pathEntity, pathPositions);
|
|
12853
|
+
await sampleSightLine(bridge, sightLine);
|
|
11778
12854
|
} else if (ticks > 0 && fixedStep) {
|
|
11779
12855
|
const sampleTicks = 10;
|
|
11780
12856
|
for (let index = 0; index < ticks; index += sampleTicks) {
|
|
11781
12857
|
const batch = Math.min(sampleTicks, ticks - index);
|
|
11782
12858
|
await advanceFixedStep(page, bridge, batch);
|
|
11783
12859
|
await samplePathPosition(bridge, pathEntity, pathPositions);
|
|
12860
|
+
await sampleSightLine(bridge, sightLine);
|
|
11784
12861
|
}
|
|
11785
12862
|
} else {
|
|
11786
12863
|
await waitFrames(page, Math.max(frames, ticks, 1));
|
|
11787
12864
|
await samplePathPosition(bridge, pathEntity, pathPositions);
|
|
12865
|
+
await sampleSightLine(bridge, sightLine);
|
|
11788
12866
|
}
|
|
11789
12867
|
const afterInput = bridge === void 0 || movementSampleRequest === void 0 ? void 0 : await bridge.sample(movementSampleRequest);
|
|
11790
12868
|
let afterStep = afterInput;
|
|
@@ -11933,11 +13011,11 @@ async function executeAimAtStep(bridge, step, subject) {
|
|
|
11933
13011
|
async function advanceFixedStep(page, bridge, ticks, render = false) {
|
|
11934
13012
|
if (!Number.isInteger(ticks) || ticks <= 0)
|
|
11935
13013
|
throw new Error("advance ticks must be a positive integer.");
|
|
11936
|
-
for (let tick = 0; tick < ticks;
|
|
13014
|
+
for (let tick = 0; tick < ticks; ) {
|
|
11937
13015
|
for (let attempt = 0; ; attempt += 1) {
|
|
11938
13016
|
try {
|
|
11939
|
-
|
|
11940
|
-
|
|
13017
|
+
const advanced = render ? await bridge.advance(1, { render: true }) : await bridge.advance(1);
|
|
13018
|
+
tick += typeof advanced === "number" && advanced > 1 ? advanced : 1;
|
|
11941
13019
|
break;
|
|
11942
13020
|
} catch (error) {
|
|
11943
13021
|
if (!(error instanceof Error) || !error.message.includes(STOPPED_LOOP_ERROR) || attempt >= MAX_FIXED_STEP_STARTUP_RETRIES)
|
|
@@ -11945,7 +13023,7 @@ async function advanceFixedStep(page, bridge, ticks, render = false) {
|
|
|
11945
13023
|
await waitFrames(page, 1);
|
|
11946
13024
|
}
|
|
11947
13025
|
}
|
|
11948
|
-
if (render && tick
|
|
13026
|
+
if (render && tick < ticks) await waitFrames(page, 1);
|
|
11949
13027
|
}
|
|
11950
13028
|
}
|
|
11951
13029
|
function playtestStepDrivesMovement(step, hasHeldInput) {
|
|
@@ -12015,6 +13093,23 @@ async function setPointerButtons(page, inputState, buttons) {
|
|
|
12015
13093
|
}
|
|
12016
13094
|
inputState.pointerButtons = buttons;
|
|
12017
13095
|
}
|
|
13096
|
+
async function sampleFootSlip(page, bridge, ticks, label, entity, feet) {
|
|
13097
|
+
const samples = [];
|
|
13098
|
+
for (let tick = 0; tick < ticks; tick += 1) {
|
|
13099
|
+
await advanceFixedStep(page, bridge, 1);
|
|
13100
|
+
const snapshot = await bridge.sample({ entities: [entity], include: ["entities"], sceneNodes: feet.map((name) => ({ limit: 1, name })) });
|
|
13101
|
+
samples.push({
|
|
13102
|
+
body: entityPosition(snapshot, entity) ?? null,
|
|
13103
|
+
feet: feet.map((_name, index) => snapshot.sceneNodes?.[index]?.nodes[0]?.position ?? null)
|
|
13104
|
+
});
|
|
13105
|
+
}
|
|
13106
|
+
return { entity, feet, label, samples };
|
|
13107
|
+
}
|
|
13108
|
+
async function sampleSightLine(bridge, sightLine) {
|
|
13109
|
+
if (bridge === void 0 || sightLine === void 0) return;
|
|
13110
|
+
const snapshot = await bridge.sample({ sightLine: { entity: sightLine.entity } });
|
|
13111
|
+
if (snapshot.sightLine !== void 0) sightLine.samples.push(snapshot.sightLine);
|
|
13112
|
+
}
|
|
12018
13113
|
async function samplePathPosition(bridge, entity, positions) {
|
|
12019
13114
|
if (bridge === void 0 || entity === void 0) return;
|
|
12020
13115
|
const snapshot = await bridge.sample({ entities: [entity] });
|
|
@@ -12026,18 +13121,49 @@ async function sampleAfterTransition(page, bridge, request) {
|
|
|
12026
13121
|
await waitFrames(page, 1);
|
|
12027
13122
|
return bridge.sample(request);
|
|
12028
13123
|
}
|
|
12029
|
-
async function waitFrames(page, frames) {
|
|
13124
|
+
async function waitFrames(page, frames, timeoutMs) {
|
|
12030
13125
|
if (frames <= 0) return;
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
}
|
|
13126
|
+
let budgetMs;
|
|
13127
|
+
if (timeoutMs === void 0) {
|
|
13128
|
+
budgetMs = advanceTimeoutMs(frames);
|
|
13129
|
+
} else if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
13130
|
+
throw new PlaytestBridgeError(playtestDiagnostic(
|
|
13131
|
+
"TN_PLAYTEST_OPERATION_TIMEOUT",
|
|
13132
|
+
`waitFrames requested ${frames} frame(s) but the supplied remaining budget of ${String(timeoutMs)}ms is not a positive, finite value.`,
|
|
13133
|
+
"Check that the page is producing requestAnimationFrame callbacks; the wait cannot complete while rendering is stalled."
|
|
13134
|
+
));
|
|
13135
|
+
} else {
|
|
13136
|
+
budgetMs = timeoutMs;
|
|
13137
|
+
}
|
|
13138
|
+
let timeout;
|
|
13139
|
+
try {
|
|
13140
|
+
await Promise.race([
|
|
13141
|
+
page.evaluate((count) => new Promise((resolveFrame) => {
|
|
13142
|
+
const schedule = globalThis.requestAnimationFrame;
|
|
13143
|
+
let remaining = count;
|
|
13144
|
+
const next = () => {
|
|
13145
|
+
remaining -= 1;
|
|
13146
|
+
if (remaining <= 0) resolveFrame();
|
|
13147
|
+
else schedule(next);
|
|
13148
|
+
};
|
|
13149
|
+
schedule(next);
|
|
13150
|
+
}), frames),
|
|
13151
|
+
new Promise((_resolve, reject) => {
|
|
13152
|
+
timeout = setTimeout(() => reject(new PlaytestBridgeError(playtestDiagnostic(
|
|
13153
|
+
"TN_PLAYTEST_OPERATION_TIMEOUT",
|
|
13154
|
+
`waitFrames requested ${frames} frame(s) exceeded ${budgetMs}ms.`,
|
|
13155
|
+
"Check that the page is producing requestAnimationFrame callbacks; the wait cannot complete while rendering is stalled."
|
|
13156
|
+
))), budgetMs);
|
|
13157
|
+
})
|
|
13158
|
+
]);
|
|
13159
|
+
} finally {
|
|
13160
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
13161
|
+
}
|
|
13162
|
+
}
|
|
13163
|
+
var WARMUP_FIRST_FRAME_BUDGET_MS = 15e3;
|
|
13164
|
+
var WARMUP_FRAME_BUDGET_MS = 2e4;
|
|
13165
|
+
async function waitWarmupFrames(page, frames) {
|
|
13166
|
+
await waitFrames(page, frames, WARMUP_FIRST_FRAME_BUDGET_MS + frames * WARMUP_FRAME_BUDGET_MS);
|
|
12041
13167
|
}
|
|
12042
13168
|
function completionWindowLabel(scenario, target, live, raw = process.env.TN_PLAYTEST_COMPLETION_WINDOW_LABEL) {
|
|
12043
13169
|
if (raw === void 0) return void 0;
|
|
@@ -12055,16 +13181,20 @@ async function measureCompletionWindow(label, mode, poll, release) {
|
|
|
12055
13181
|
const fail2 = (reason) => {
|
|
12056
13182
|
throw new Error(`TN_PLAYTEST_COMPLETION_WINDOW_FAILED: ${reason}`);
|
|
12057
13183
|
};
|
|
12058
|
-
const bounded = async (operation,
|
|
13184
|
+
const bounded = async (operation, timeoutMs2 = 5e3) => {
|
|
12059
13185
|
let timer;
|
|
12060
13186
|
try {
|
|
12061
13187
|
return await Promise.race([operation(), new Promise((_resolve, reject) => {
|
|
12062
|
-
timer = setTimeout(() => reject(new Error("TN_PLAYTEST_COMPLETION_WINDOW_FAILED: operation timeout")),
|
|
13188
|
+
timer = setTimeout(() => reject(new Error("TN_PLAYTEST_COMPLETION_WINDOW_FAILED: operation timeout")), timeoutMs2);
|
|
12063
13189
|
})]);
|
|
12064
13190
|
} finally {
|
|
12065
13191
|
clearTimeout(timer);
|
|
12066
13192
|
}
|
|
12067
13193
|
};
|
|
13194
|
+
const minimumFrames = Number(process.env.TN_PLAYTEST_COMPLETION_WINDOW_MIN_FRAMES ?? 101);
|
|
13195
|
+
const timeoutMs = Number(process.env.TN_PLAYTEST_COMPLETION_WINDOW_TIMEOUT_MS ?? 1e4);
|
|
13196
|
+
if (!Number.isSafeInteger(minimumFrames) || minimumFrames < 1 || !Number.isSafeInteger(timeoutMs) || timeoutMs < 1)
|
|
13197
|
+
fail2("invalid completion frame count or timeout");
|
|
12068
13198
|
const samples = [];
|
|
12069
13199
|
let previous;
|
|
12070
13200
|
let failure;
|
|
@@ -12080,7 +13210,7 @@ async function measureCompletionWindow(label, mode, poll, release) {
|
|
|
12080
13210
|
const negotiated = await bounded(() => mode("wall-clock"));
|
|
12081
13211
|
if (negotiated?.mode !== "wall-clock" || !Number.isSafeInteger(negotiated.tick) || !Number.isSafeInteger(negotiated.epoch) || negotiated.epoch < 0) fail2("clock negotiation unavailable");
|
|
12082
13212
|
epoch = negotiated.epoch;
|
|
12083
|
-
const deadline = Date.now() +
|
|
13213
|
+
const deadline = Date.now() + timeoutMs;
|
|
12084
13214
|
measurement: while (Date.now() <= deadline) {
|
|
12085
13215
|
const value = await bounded(poll, Math.max(1, deadline - Date.now()));
|
|
12086
13216
|
if (!value || value.clock?.mode !== "wall-clock" || value.valid !== true || !Number.isSafeInteger(value.dropped) || value.dropped < 0 || !Number.isSafeInteger(value.epoch) || value.epoch < 0 || !Array.isArray(value.samples) || !["present-return", "render-callback-return"].includes(value.source ?? "") || value.timebase !== (value.source === "present-return" ? "steady-clock-ms" : "performance-now-ms"))
|
|
@@ -12109,6 +13239,7 @@ async function measureCompletionWindow(label, mode, poll, release) {
|
|
|
12109
13239
|
samples.push({ sequence: sample.sequence, completedAtMs: sample.completedAtMs });
|
|
12110
13240
|
if (sample.completedAtMs - samples[0].completedAtMs >= 5e3) {
|
|
12111
13241
|
if (samples.length < 101) fail2("fewer than 100 complete intervals");
|
|
13242
|
+
if (samples.length < minimumFrames) continue;
|
|
12112
13243
|
const intervals = samples.slice(1).map((entry, index) => entry.completedAtMs - samples[index].completedAtMs).sort((a, b) => a - b);
|
|
12113
13244
|
result = {
|
|
12114
13245
|
label,
|
|
@@ -12670,6 +13801,9 @@ var PlaytestCliUsageError = class extends Error {
|
|
|
12670
13801
|
this.name = "PlaytestCliUsageError";
|
|
12671
13802
|
}
|
|
12672
13803
|
};
|
|
13804
|
+
function withScenarioClock(config, scenario) {
|
|
13805
|
+
return scenario.clock === "wall-clock" && config.liveClock !== true ? { ...config, liveClock: true } : config;
|
|
13806
|
+
}
|
|
12673
13807
|
function formatUsage() {
|
|
12674
13808
|
const flags = Object.entries(PLAYTEST_FLAGS).map(
|
|
12675
13809
|
([name, details]) => ` ${name.padEnd(20)} ${details.summary} (default: ${details.default})`
|
|
@@ -12905,7 +14039,7 @@ function parseStandalonePlaytestArgs(argv, cwd = process.cwd()) {
|
|
|
12905
14039
|
...flags.get("--xcrun")?.[0] === void 0 ? {} : { xcrunPath: flags.get("--xcrun")[0] }
|
|
12906
14040
|
};
|
|
12907
14041
|
}
|
|
12908
|
-
var SCENARIO_GLOB = /[*?[]/u;
|
|
14042
|
+
var SCENARIO_GLOB = /[*?[{]/u;
|
|
12909
14043
|
function expandScenarioPattern(projectPath, pattern) {
|
|
12910
14044
|
if (!SCENARIO_GLOB.test(pattern)) return [pattern];
|
|
12911
14045
|
const normalizedPattern = pattern.replaceAll("\\", "/");
|
|
@@ -12942,14 +14076,21 @@ function matchGlobParts(pattern, file) {
|
|
|
12942
14076
|
return file.length > 0 && segmentMatches(head ?? "", file[0]) && matchGlobParts(tail, file.slice(1));
|
|
12943
14077
|
}
|
|
12944
14078
|
function segmentMatches(pattern, value) {
|
|
12945
|
-
|
|
14079
|
+
return new RegExp(`^${segmentExpression(pattern)}$`, "u").test(value);
|
|
14080
|
+
}
|
|
14081
|
+
function segmentExpression(pattern) {
|
|
14082
|
+
let expression = "";
|
|
12946
14083
|
for (let index = 0; index < pattern.length; index += 1) {
|
|
12947
14084
|
const character = pattern[index];
|
|
12948
|
-
|
|
14085
|
+
const close = character === "{" ? pattern.indexOf("}", index) : -1;
|
|
14086
|
+
if (close > index) {
|
|
14087
|
+
expression += `(?:${pattern.slice(index + 1, close).split(",").map(segmentExpression).join("|")})`;
|
|
14088
|
+
index = close;
|
|
14089
|
+
} else if (character === "*") expression += "[^/]*";
|
|
12949
14090
|
else if (character === "?") expression += "[^/]";
|
|
12950
14091
|
else expression += escapeRegExp(character);
|
|
12951
14092
|
}
|
|
12952
|
-
return
|
|
14093
|
+
return expression;
|
|
12953
14094
|
}
|
|
12954
14095
|
function escapeRegExp(value) {
|
|
12955
14096
|
return value.replace(/[|\\{}()[\]^$+?.]/gu, "\\$&");
|
|
@@ -13016,12 +14157,12 @@ function withPerformanceBudget(scenario, budget) {
|
|
|
13016
14157
|
maxPassTriangles: { ...budget.maxPassTriangles, ...declared?.maxPassTriangles },
|
|
13017
14158
|
maxPhaseMsP95: { ...budget.maxPhaseMsP95, ...declared?.maxPhaseMsP95 }
|
|
13018
14159
|
};
|
|
13019
|
-
const
|
|
14160
|
+
const performance2 = {
|
|
13020
14161
|
...budget,
|
|
13021
14162
|
...declared,
|
|
13022
14163
|
...Object.fromEntries(Object.entries(maps).filter(([, value]) => Object.keys(value).length > 0))
|
|
13023
14164
|
};
|
|
13024
|
-
return { ...scenario, assert: { ...scenario.assert, performance } };
|
|
14165
|
+
return { ...scenario, assert: { ...scenario.assert, performance: performance2 } };
|
|
13025
14166
|
}
|
|
13026
14167
|
|
|
13027
14168
|
// src/runner/camera.ts
|
|
@@ -13325,11 +14466,11 @@ function isJudgeMarkerRequestFailure(method, url, judgeMarkerUrl) {
|
|
|
13325
14466
|
function addPreflightDiagnostic(report, diagnostic) {
|
|
13326
14467
|
return diagnostic === void 0 ? report : { ...report, diagnostics: [diagnostic, ...report.diagnostics] };
|
|
13327
14468
|
}
|
|
13328
|
-
var SOFTWARE_DEVICE_LOSS = /TN_DEVICE_LOST|WebGPU Device Lost|A valid external Instance reference no longer exists|Instance dropped (?:in popErrorScope|error in getCompilationInfo)/iu;
|
|
14469
|
+
var SOFTWARE_DEVICE_LOSS = /TN_DEVICE_LOST|TN_WASM_DEVICE_LOST|WebGPU Device Lost|A valid external Instance reference no longer exists|Instance dropped (?:in popErrorScope|error in getCompilationInfo)/iu;
|
|
13329
14470
|
function isSoftwareDeviceLossEntry(entry) {
|
|
13330
14471
|
return (entry.type === "error" || entry.type === "assert" || entry.type === "pageerror") && SOFTWARE_DEVICE_LOSS.test(entry.text);
|
|
13331
14472
|
}
|
|
13332
|
-
function buildReport(config, scenario, beforeSnapshot, afterSnapshot, consoleEntries, networkEntries, pathLength = void 0, hud = {}, runtimeReady = true, visual = void 0, labeledSamples = [], framebufferCoverage = void 0, capture = void 0, captureFailure = void 0, movementSamples = [], setup = void 0, deviceMetrics = void 0, movementBaselineSnapshot = void 0, startup = void 0, deviceLifecycle = void 0, tone = void 0) {
|
|
14473
|
+
function buildReport(config, scenario, beforeSnapshot, afterSnapshot, consoleEntries, networkEntries, pathLength = void 0, hud = {}, runtimeReady = true, visual = void 0, labeledSamples = [], framebufferCoverage = void 0, capture = void 0, captureFailure = void 0, movementSamples = [], setup = void 0, deviceMetrics = void 0, movementBaselineSnapshot = void 0, startup = void 0, deviceLifecycle = void 0, tone = void 0, footSlip = void 0, sightLine = void 0, hudAudit = void 0) {
|
|
13333
14474
|
const movementSample = isAnonymousMovementScenario(scenario) ? observedMovementSample(movementSamples) : void 0;
|
|
13334
14475
|
const entity = scenario.assert?.movement?.entity ?? scenario.subject ?? movementSample?.entity ?? "";
|
|
13335
14476
|
const wholeRunObserved = isAnonymousMovementScenario(scenario) ? false : entityPosition(beforeSnapshot, entity) !== void 0 && entityPosition(afterSnapshot, entity) !== void 0;
|
|
@@ -13419,6 +14560,9 @@ function buildReport(config, scenario, beforeSnapshot, afterSnapshot, consoleEnt
|
|
|
13419
14560
|
// room does. Never merged with the first: a node that has since been removed is gone, and
|
|
13420
14561
|
// reporting it from the earlier sample would assert against a scene that no longer exists.
|
|
13421
14562
|
...afterSnapshot?.sceneNodes === void 0 && beforeSnapshot?.sceneNodes === void 0 ? {} : { sceneNodes: afterSnapshot?.sceneNodes ?? beforeSnapshot?.sceneNodes },
|
|
14563
|
+
...footSlip === void 0 ? {} : { footSlip },
|
|
14564
|
+
...sightLine === void 0 ? {} : { sightLine },
|
|
14565
|
+
...hudAudit === void 0 ? {} : { hudAudit },
|
|
13422
14566
|
...startup === void 0 ? {} : { startup },
|
|
13423
14567
|
...beforeSnapshot?.gameplay === void 0 && afterSnapshot?.gameplay === void 0 && labeledSamples.every(({ snapshot }) => snapshot.gameplay === void 0) ? {} : {
|
|
13424
14568
|
runtimeObservations: {
|
|
@@ -13509,43 +14653,74 @@ function entityObservedWindow(samples, entity) {
|
|
|
13509
14653
|
// src/runner/startupReady.ts
|
|
13510
14654
|
async function waitForStartupReady(options) {
|
|
13511
14655
|
const { bridge, pump } = options;
|
|
13512
|
-
if (!bridge.description.capabilities.includes("runtime.startup"))
|
|
14656
|
+
if (!bridge.description.capabilities.includes("runtime.startup")) {
|
|
14657
|
+
await options.warmup?.();
|
|
14658
|
+
return void 0;
|
|
14659
|
+
}
|
|
13513
14660
|
const now = options.now ?? (() => Date.now());
|
|
13514
14661
|
const timeoutMs = options.timeoutMs ?? PLAYTEST_STARTUP_READY_TIMEOUT_MS;
|
|
13515
14662
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
13516
14663
|
throw new Error(`TN_PLAYTEST_STARTUP_TIMEOUT_INVALID: ${String(options.timeoutMs)}`);
|
|
14664
|
+
await options.warmup?.();
|
|
13517
14665
|
const deadline = now() + timeoutMs;
|
|
13518
14666
|
const aborted = options.aborted ?? (() => false);
|
|
13519
14667
|
if (aborted()) throw abortedDuringStartup();
|
|
13520
14668
|
const hostAlive = options.hostAlive ?? (async () => void 0);
|
|
13521
|
-
let observed =
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
if
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
|
|
13529
|
-
|
|
13530
|
-
|
|
13531
|
-
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
13537
|
-
|
|
14669
|
+
let observed = BUSY;
|
|
14670
|
+
const timeoutError = () => new PlaytestBridgeError(playtestDiagnostic(
|
|
14671
|
+
"TN_PLAYTEST_STARTUP_NOT_READY",
|
|
14672
|
+
`Application startup stayed '${observed === BUSY ? "unreadable, the bridge kept timing out" : observed.phase}' for ${timeoutMs}ms; the run would have observed a game that has not finished loading.`,
|
|
14673
|
+
"Let the application reach startup readiness \u2014 check that its loading gate can complete headlessly \u2014 or remove the runtime.startup capability if it has no startup phase."
|
|
14674
|
+
));
|
|
14675
|
+
let settled = false;
|
|
14676
|
+
let timeout;
|
|
14677
|
+
const expired = new Promise((_resolve, reject) => {
|
|
14678
|
+
timeout = setTimeout(() => {
|
|
14679
|
+
settled = true;
|
|
14680
|
+
reject(timeoutError());
|
|
14681
|
+
}, timeoutMs);
|
|
14682
|
+
});
|
|
14683
|
+
try {
|
|
14684
|
+
return await Promise.race([expired, (async () => {
|
|
14685
|
+
if (settled) throw timeoutError();
|
|
14686
|
+
if (aborted()) throw abortedDuringStartup();
|
|
14687
|
+
if (settled || now() >= deadline) throw timeoutError();
|
|
14688
|
+
observed = await pollStartup(bridge);
|
|
14689
|
+
while (observed === BUSY || observed.phase !== "ready" || observed.revealed === false) {
|
|
14690
|
+
if (settled) throw timeoutError();
|
|
14691
|
+
if (aborted()) throw abortedDuringStartup();
|
|
14692
|
+
if (observed === BUSY) {
|
|
14693
|
+
const alive = await hostAlive();
|
|
14694
|
+
if (settled) throw timeoutError();
|
|
14695
|
+
if (alive === false) throw hostExitedDuringStartup();
|
|
14696
|
+
}
|
|
14697
|
+
if (settled || now() >= deadline) {
|
|
14698
|
+
throw timeoutError();
|
|
14699
|
+
}
|
|
14700
|
+
try {
|
|
14701
|
+
await pump(deadline - now());
|
|
14702
|
+
} catch (error) {
|
|
14703
|
+
if (error instanceof PlaytestBridgeError && error.diagnostic.code === "TN_PLAYTEST_OPERATION_TIMEOUT") {
|
|
14704
|
+
observed = BUSY;
|
|
14705
|
+
continue;
|
|
14706
|
+
}
|
|
14707
|
+
throw error;
|
|
14708
|
+
}
|
|
14709
|
+
if (settled || now() >= deadline) throw timeoutError();
|
|
14710
|
+
observed = await pollStartup(bridge);
|
|
13538
14711
|
}
|
|
13539
|
-
throw
|
|
13540
|
-
|
|
13541
|
-
|
|
14712
|
+
if (settled || now() >= deadline) throw timeoutError();
|
|
14713
|
+
return {
|
|
14714
|
+
// A declared software lane reaches `ready` on the bounded window rather than on sustained
|
|
14715
|
+
// in-budget frames, so it is labelled for what it is: not a smoothness measurement.
|
|
14716
|
+
rule: options.declaredSoftware === true ? "compile-settled" : "sustained-frames",
|
|
14717
|
+
startup: observed
|
|
14718
|
+
};
|
|
14719
|
+
})()]);
|
|
14720
|
+
} finally {
|
|
14721
|
+
settled = true;
|
|
14722
|
+
if (timeout !== void 0) clearTimeout(timeout);
|
|
13542
14723
|
}
|
|
13543
|
-
return {
|
|
13544
|
-
// A declared software lane reaches `ready` on the bounded window rather than on sustained
|
|
13545
|
-
// in-budget frames, so it is labelled for what it is: not a smoothness measurement.
|
|
13546
|
-
rule: options.declaredSoftware === true ? "compile-settled" : "sustained-frames",
|
|
13547
|
-
startup: observed
|
|
13548
|
-
};
|
|
13549
14724
|
}
|
|
13550
14725
|
function abortedDuringStartup() {
|
|
13551
14726
|
return new PlaytestBridgeError(playtestDiagnostic(
|
|
@@ -13933,6 +15108,23 @@ function createOwnedRunResourceRelease(display, lease) {
|
|
|
13933
15108
|
return releasePromise;
|
|
13934
15109
|
};
|
|
13935
15110
|
}
|
|
15111
|
+
|
|
15112
|
+
// src/runner/network.ts
|
|
15113
|
+
function networkBytesPerSecond(downloadKbps) {
|
|
15114
|
+
return downloadKbps * 1e3 / 8;
|
|
15115
|
+
}
|
|
15116
|
+
function networkEmulation(profile) {
|
|
15117
|
+
const bytesPerSecond = networkBytesPerSecond(profile.downloadKbps);
|
|
15118
|
+
return {
|
|
15119
|
+
connectionType: "cellular3g",
|
|
15120
|
+
downloadThroughput: bytesPerSecond,
|
|
15121
|
+
latency: profile.latencyMs,
|
|
15122
|
+
offline: false,
|
|
15123
|
+
uploadThroughput: bytesPerSecond
|
|
15124
|
+
};
|
|
15125
|
+
}
|
|
15126
|
+
|
|
15127
|
+
// src/runner/server.ts
|
|
13936
15128
|
function startManagedServer(config, dynamicPort) {
|
|
13937
15129
|
const port = dynamicPort ?? managedPort(config);
|
|
13938
15130
|
return spawn(resolveManagedServerCommand(config, dynamicPort), {
|
|
@@ -14055,7 +15247,17 @@ function pageLifecycleDiagnostic(error, lifecycle, url) {
|
|
|
14055
15247
|
"Something moved the document after the run started, so the observations after that point are from a different page. Remove the navigation from the game, or point --url at a server that does not reload itself mid-run."
|
|
14056
15248
|
);
|
|
14057
15249
|
}
|
|
15250
|
+
var throttledPages = /* @__PURE__ */ new WeakMap();
|
|
15251
|
+
async function applyNetworkProfile(page, scenario) {
|
|
15252
|
+
const profile = scenario.network;
|
|
15253
|
+
if (profile === void 0) return;
|
|
15254
|
+
const session = await page.context().newCDPSession(page);
|
|
15255
|
+
await session.send("Network.enable");
|
|
15256
|
+
await session.send("Network.emulateNetworkConditions", networkEmulation(profile));
|
|
15257
|
+
throttledPages.set(page, session);
|
|
15258
|
+
}
|
|
14058
15259
|
async function openPageAndConnectBridge(page, config, scenario) {
|
|
15260
|
+
await applyNetworkProfile(page, scenario);
|
|
14059
15261
|
const attempts = 3;
|
|
14060
15262
|
let lastError;
|
|
14061
15263
|
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
@@ -14155,6 +15357,98 @@ async function retakeWhileBlank(retake, grace, boundMs, now = Date.now) {
|
|
|
14155
15357
|
}
|
|
14156
15358
|
}
|
|
14157
15359
|
}
|
|
15360
|
+
var CHANNEL_TOLERANCE = 48;
|
|
15361
|
+
var DIFFERING_SHARE = 0.25;
|
|
15362
|
+
var UI_OVER_COVER_SHARE = 5e-3;
|
|
15363
|
+
var FIRST_PAINT_SLACK_MS = 8;
|
|
15364
|
+
var HANDOFF_FRAMES = 30;
|
|
15365
|
+
function meanColour(frame) {
|
|
15366
|
+
const sum = [0, 0, 0];
|
|
15367
|
+
const pixels = frame.width * frame.height;
|
|
15368
|
+
for (let i = 0; i < pixels; i += 1) {
|
|
15369
|
+
sum[0] += frame.data[i * 4] ?? 0;
|
|
15370
|
+
sum[1] += frame.data[i * 4 + 1] ?? 0;
|
|
15371
|
+
sum[2] += frame.data[i * 4 + 2] ?? 0;
|
|
15372
|
+
}
|
|
15373
|
+
return sum.map((value) => Math.round(value / Math.max(1, pixels)));
|
|
15374
|
+
}
|
|
15375
|
+
function differingShare(frame, reference) {
|
|
15376
|
+
if (frame.width !== reference.width || frame.height !== reference.height) return 1;
|
|
15377
|
+
const pixels = frame.width * frame.height;
|
|
15378
|
+
let moved = 0;
|
|
15379
|
+
for (let i = 0; i < pixels; i += 1) {
|
|
15380
|
+
for (let channel = 0; channel < 3; channel += 1) {
|
|
15381
|
+
if (Math.abs((frame.data[i * 4 + channel] ?? 0) - (reference.data[i * 4 + channel] ?? 0)) > CHANNEL_TOLERANCE) {
|
|
15382
|
+
moved += 1;
|
|
15383
|
+
break;
|
|
15384
|
+
}
|
|
15385
|
+
}
|
|
15386
|
+
}
|
|
15387
|
+
return moved / Math.max(1, pixels);
|
|
15388
|
+
}
|
|
15389
|
+
function uiShare(frame, cover, world) {
|
|
15390
|
+
if (frame.width !== cover.width || frame.width !== world.width || frame.height !== cover.height || frame.height !== world.height) return 0;
|
|
15391
|
+
const pixels = frame.width * frame.height;
|
|
15392
|
+
let ui = 0;
|
|
15393
|
+
for (let i = 0; i < pixels; i += 1) {
|
|
15394
|
+
let offCover = false;
|
|
15395
|
+
let onWorld = true;
|
|
15396
|
+
for (let channel = 0; channel < 3; channel += 1) {
|
|
15397
|
+
const value = frame.data[i * 4 + channel] ?? 0;
|
|
15398
|
+
if (Math.abs(value - (cover.data[i * 4 + channel] ?? 0)) > CHANNEL_TOLERANCE) offCover = true;
|
|
15399
|
+
if (Math.abs(value - (world.data[i * 4 + channel] ?? 0)) > CHANNEL_TOLERANCE) onWorld = false;
|
|
15400
|
+
}
|
|
15401
|
+
if (offCover && onWorld) ui += 1;
|
|
15402
|
+
}
|
|
15403
|
+
return ui / Math.max(1, pixels);
|
|
15404
|
+
}
|
|
15405
|
+
function compareStartupFrames(frames, readyMs = Number.POSITIVE_INFINITY, firstPaintMs = 0) {
|
|
15406
|
+
const startup = frames.filter((frame) => frame.ms >= firstPaintMs - FIRST_PAINT_SLACK_MS && frame.ms < readyMs);
|
|
15407
|
+
const handOff = frames.filter((frame) => frame.ms >= readyMs);
|
|
15408
|
+
const reference = startup.at(-1);
|
|
15409
|
+
if (reference === void 0) return { differing: [], frames: 0, reference: [0, 0, 0], uiOverCover: [] };
|
|
15410
|
+
const differing = [];
|
|
15411
|
+
for (const frame of startup) {
|
|
15412
|
+
const share = differingShare(frame, reference);
|
|
15413
|
+
if (share > DIFFERING_SHARE) differing.push({ mean: meanColour(frame), ms: Math.round(frame.ms), share: Number(share.toFixed(3)) });
|
|
15414
|
+
}
|
|
15415
|
+
const observation = { differing, frames: startup.length, reference: meanColour(reference), uiOverCover: [] };
|
|
15416
|
+
if (!Number.isFinite(readyMs)) return observation;
|
|
15417
|
+
const worldIndex = handOff.findIndex((frame) => differingShare(frame, reference) > DIFFERING_SHARE);
|
|
15418
|
+
const world = handOff[worldIndex];
|
|
15419
|
+
if (world === void 0) return observation;
|
|
15420
|
+
observation.worldMs = Math.round(world.ms);
|
|
15421
|
+
for (const frame of handOff.slice(0, worldIndex)) {
|
|
15422
|
+
const share = uiShare(frame, reference, world);
|
|
15423
|
+
if (share > UI_OVER_COVER_SHARE) observation.uiOverCover.push({ ms: Math.round(frame.ms), share: Number(share.toFixed(4)) });
|
|
15424
|
+
}
|
|
15425
|
+
return observation;
|
|
15426
|
+
}
|
|
15427
|
+
async function recordStartupCover(page) {
|
|
15428
|
+
const cdp = await page.context().newCDPSession(page);
|
|
15429
|
+
const frames = [];
|
|
15430
|
+
cdp.on("Page.screencastFrame", ({ data, metadata, sessionId }) => {
|
|
15431
|
+
frames.push({ epochMs: (metadata.timestamp ?? Date.now() / 1e3) * 1e3, png: Buffer.from(data, "base64") });
|
|
15432
|
+
void cdp.send("Page.screencastFrameAck", { sessionId }).catch(() => void 0);
|
|
15433
|
+
});
|
|
15434
|
+
await cdp.send("Page.startScreencast", { everyNthFrame: 1, format: "png", maxHeight: 72, maxWidth: 128 });
|
|
15435
|
+
return {
|
|
15436
|
+
async finish(readyMs) {
|
|
15437
|
+
await waitFrames(page, HANDOFF_FRAMES).catch(() => void 0);
|
|
15438
|
+
await cdp.send("Page.stopScreencast").catch(() => void 0);
|
|
15439
|
+
await cdp.detach().catch(() => void 0);
|
|
15440
|
+
const [origin, firstPaint] = await page.evaluate(() => [
|
|
15441
|
+
performance.timeOrigin,
|
|
15442
|
+
performance.getEntriesByName("first-paint")[0]?.startTime ?? 0
|
|
15443
|
+
]);
|
|
15444
|
+
const startup = frames.filter(({ epochMs }) => epochMs >= origin).map(({ epochMs, png }) => {
|
|
15445
|
+
const image = PNG.sync.read(png);
|
|
15446
|
+
return { data: image.data, height: image.height, ms: epochMs - origin, width: image.width };
|
|
15447
|
+
});
|
|
15448
|
+
return compareStartupFrames(startup, readyMs, firstPaint);
|
|
15449
|
+
}
|
|
15450
|
+
};
|
|
15451
|
+
}
|
|
14158
15452
|
var REMOTE_BROWSER_SESSIONS = /* @__PURE__ */ new WeakMap();
|
|
14159
15453
|
function remoteBrowserFor(config) {
|
|
14160
15454
|
return REMOTE_BROWSER_SESSIONS.get(config);
|
|
@@ -14312,6 +15606,14 @@ async function writeObservationArtifacts(artifactDirectory, requested, observati
|
|
|
14312
15606
|
}
|
|
14313
15607
|
return written;
|
|
14314
15608
|
}
|
|
15609
|
+
var WorkerGameRelaunch = class extends Error {
|
|
15610
|
+
};
|
|
15611
|
+
async function runsGameInWorker(page) {
|
|
15612
|
+
for (const worker of page.workers()) {
|
|
15613
|
+
if (await worker.evaluate("typeof globalThis.__tnGamePlatform").catch(() => void 0) === "object") return true;
|
|
15614
|
+
}
|
|
15615
|
+
return false;
|
|
15616
|
+
}
|
|
14315
15617
|
async function runStandalonePlaytest(config, options = {}) {
|
|
14316
15618
|
return runStandalonePlaytestInternal(config, {
|
|
14317
15619
|
...options,
|
|
@@ -14319,12 +15621,25 @@ async function runStandalonePlaytest(config, options = {}) {
|
|
|
14319
15621
|
});
|
|
14320
15622
|
}
|
|
14321
15623
|
async function runStandalonePlaytestInternal(config, options = {}) {
|
|
15624
|
+
try {
|
|
15625
|
+
return await runStandalonePlaytestOnce(config, options);
|
|
15626
|
+
} catch (error) {
|
|
15627
|
+
if (!(error instanceof WorkerGameRelaunch)) throw error;
|
|
15628
|
+
return runStandalonePlaytestOnce(config, { ...options, gameThread: "worker" });
|
|
15629
|
+
}
|
|
15630
|
+
}
|
|
15631
|
+
async function runStandalonePlaytestOnce(config, options) {
|
|
14322
15632
|
const usesFreePort = config.server !== void 0 && config.port === 0;
|
|
14323
|
-
const
|
|
15633
|
+
const resolvedConfig = usesFreePort ? await resolveManagedServerConfig(config) : config;
|
|
14324
15634
|
const scenario = withPerformanceBudget(
|
|
14325
|
-
await loadPlaytestScenario(
|
|
14326
|
-
|
|
15635
|
+
await loadPlaytestScenario(resolvedConfig.projectPath, resolvedConfig.scenarioPath),
|
|
15636
|
+
resolvedConfig.performanceBudget
|
|
14327
15637
|
);
|
|
15638
|
+
let activeConfig = withScenarioClock(resolvedConfig, scenario);
|
|
15639
|
+
const performance2 = scenario.assert?.performance;
|
|
15640
|
+
if ((activeConfig.target ?? "browser") === "browser" && activeConfig.liveClock === void 0 && (performance2?.maxFrameMsP95 !== void 0 || performance2?.minFps !== void 0)) {
|
|
15641
|
+
activeConfig = { ...activeConfig, liveClock: true };
|
|
15642
|
+
}
|
|
14328
15643
|
const cpuLabels = cpuWindowLabels(scenario, "browser", activeConfig.liveClock === true);
|
|
14329
15644
|
if (cpuLabels.length > 0 && options.remoteBrowser !== void 0) {
|
|
14330
15645
|
throw new Error("TN_PLAYTEST_CPU_WINDOW_FAILED: remote browser has no local owned process tree");
|
|
@@ -14334,11 +15649,12 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14334
15649
|
let completionWindow;
|
|
14335
15650
|
const completionDisplay = completionLabel === void 0 ? void 0 : completionWindowEnvironment("browser", activeConfig.headless);
|
|
14336
15651
|
if (completionLabel !== void 0 && options.remoteBrowser !== void 0) throw new Error("TN_PLAYTEST_COMPLETION_WINDOW_FAILED: requires a fresh local browser process");
|
|
14337
|
-
const
|
|
15652
|
+
const measurementArgs = measurementBrowserArgs(scenario.assert?.performance !== void 0, completionLabel !== void 0, frameDisplay(), options.gameThread);
|
|
15653
|
+
const browserConfig = measurementArgs.length === 0 ? activeConfig : {
|
|
14338
15654
|
...activeConfig,
|
|
14339
15655
|
browserArgs: [
|
|
14340
15656
|
...activeConfig.browserArgs ?? [],
|
|
14341
|
-
...
|
|
15657
|
+
...measurementArgs.filter((argument) => !activeConfig.browserArgs?.includes(argument))
|
|
14342
15658
|
]
|
|
14343
15659
|
};
|
|
14344
15660
|
await mkdir(activeConfig.artifactDirectory, { recursive: true });
|
|
@@ -14488,6 +15804,7 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14488
15804
|
await page.addInitScript((liveClock) => {
|
|
14489
15805
|
globalThis.__THREENATIVE_PLAYTEST_RUNNER_EXPECTED__ = true;
|
|
14490
15806
|
if (liveClock) globalThis.__THREENATIVE_PLAYTEST_CLOCK__ = "wall-clock";
|
|
15807
|
+
globalThis.__THREENATIVE_ENGINE_COST__ = true;
|
|
14491
15808
|
window.addEventListener("unhandledrejection", (event) => {
|
|
14492
15809
|
const reason = event.reason instanceof Error ? event.reason.stack || event.reason.message : String(event.reason);
|
|
14493
15810
|
console.error(`__THREENATIVE_PLAYTEST_UNHANDLED_REJECTION__:${reason}`);
|
|
@@ -14524,7 +15841,9 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14524
15841
|
pageLifecycle.closed = true;
|
|
14525
15842
|
});
|
|
14526
15843
|
const activePage = page;
|
|
15844
|
+
const coverRecorder = scenario.assert?.startup?.steadyCover === true ? await recordStartupCover(page) : void 0;
|
|
14527
15845
|
const bridge = await openRunnerPage(page, browserConfig, scenario, options.remoteBrowser);
|
|
15846
|
+
if (options.gameThread === void 0 && measurementArgs.includes("--disable-frame-rate-limit") && await runsGameInWorker(page)) throw new WorkerGameRelaunch();
|
|
14528
15847
|
pageLifecycle.settled = true;
|
|
14529
15848
|
const setupApplication2 = bridge?.setupApplication;
|
|
14530
15849
|
if (scenario.setup !== void 0) {
|
|
@@ -14536,13 +15855,16 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14536
15855
|
));
|
|
14537
15856
|
}
|
|
14538
15857
|
}
|
|
14539
|
-
await waitFrames(page, scenario.warmupFrames);
|
|
15858
|
+
if (bridge === void 0 || scenario.awaitStartup === false) await waitFrames(page, scenario.warmupFrames);
|
|
14540
15859
|
const startupOutcome = bridge === void 0 || scenario.awaitStartup === false ? void 0 : await waitForStartupReady({
|
|
14541
15860
|
aborted: () => tearingDown,
|
|
14542
15861
|
bridge,
|
|
14543
15862
|
declaredSoftware: activeConfig.allowSoftwareAdapter === true,
|
|
14544
|
-
|
|
15863
|
+
warmup: () => waitWarmupFrames(activePage, scenario.warmupFrames),
|
|
15864
|
+
pump: (remainingMs) => waitFrames(activePage, 1, remainingMs)
|
|
14545
15865
|
});
|
|
15866
|
+
const readyMs = startupOutcome?.startup.timeline?.readyMs;
|
|
15867
|
+
const startupCover = coverRecorder === void 0 || readyMs === void 0 ? void 0 : await coverRecorder.finish(readyMs);
|
|
14546
15868
|
await alignScenarioStartTick(bridge, scenario.startTick, activeConfig.liveClock === true);
|
|
14547
15869
|
const runtimeReady = await page.evaluate(
|
|
14548
15870
|
() => document.readyState !== "loading" && document.querySelector("canvas") !== null
|
|
@@ -14731,6 +16053,16 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14731
16053
|
if (activeConfig.cpuProfilePath !== void 0) {
|
|
14732
16054
|
cpuProfile = await startBrowserCpuProfile(activePage, activeConfig.cpuProfilePath);
|
|
14733
16055
|
}
|
|
16056
|
+
const footSlip = [];
|
|
16057
|
+
const footSlipAt = (label) => label === void 0 ? void 0 : scenario.assert?.footSlip?.find(({ atStep }) => atStep === label);
|
|
16058
|
+
const sightLineAssertion = scenario.assert?.sightLine;
|
|
16059
|
+
const sightLineEntity = sightLineAssertion?.entity ?? scenario.subject;
|
|
16060
|
+
const sightLine = sightLineAssertion === void 0 || sightLineEntity === void 0 ? void 0 : { entity: sightLineEntity, samples: [] };
|
|
16061
|
+
const drawnTicks = scenario.assert?.engineCost === void 0 || bridge === void 0 || activeConfig.liveClock === true || !bridge.description.capabilities.includes("runtime.fixedStep") ? void 0 : async (ticks) => {
|
|
16062
|
+
await advanceFixedStep(activePage, bridge, ticks, true);
|
|
16063
|
+
await samplePathPosition(bridge, pathEntity, pathPositions);
|
|
16064
|
+
await sampleSightLine(bridge, sightLine);
|
|
16065
|
+
};
|
|
14734
16066
|
for (const [index, step] of scenario.steps.entries()) {
|
|
14735
16067
|
const framebufferAssertion = scenario.assert?.framebufferCoverage;
|
|
14736
16068
|
if (framebufferAssertion !== void 0 && step.label === framebufferAssertion.window.startStep) {
|
|
@@ -14783,7 +16115,17 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14783
16115
|
}
|
|
14784
16116
|
);
|
|
14785
16117
|
completionWindow.setupSnapshot = setupSnapshot;
|
|
14786
|
-
} : void 0
|
|
16118
|
+
} : footSlipAt(step.label) === void 0 ? drawnTicks : async (ticks) => {
|
|
16119
|
+
const assertion = footSlipAt(step.label);
|
|
16120
|
+
const entity = assertion.entity ?? scenario.subject;
|
|
16121
|
+
if (bridge === void 0 || entity === void 0 || activeConfig.liveClock === true || !bridge.description.capabilities.includes("runtime.fixedStep")) {
|
|
16122
|
+
throw new Error("TN_PLAYTEST_FOOT_SLIP_UNOBSERVED: footSlip needs a fixed-step bridge and a subject entity");
|
|
16123
|
+
}
|
|
16124
|
+
footSlip.push(await sampleFootSlip(activePage, bridge, ticks, step.label, entity, assertion.feet));
|
|
16125
|
+
await samplePathPosition(bridge, pathEntity, pathPositions);
|
|
16126
|
+
await sampleSightLine(bridge, sightLine);
|
|
16127
|
+
},
|
|
16128
|
+
sightLine
|
|
14787
16129
|
);
|
|
14788
16130
|
if (movementBaselineSnapshot === void 0 && movementNeedsBaseline && movementEntity !== void 0) {
|
|
14789
16131
|
const candidate = stepSamples.afterStep ?? stepSamples.afterInput;
|
|
@@ -14827,6 +16169,7 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14827
16169
|
if (position !== void 0) pathPositions.push(position);
|
|
14828
16170
|
}
|
|
14829
16171
|
const afterHud = await sampleHud(page, hudAssertions);
|
|
16172
|
+
const hudAudit = scenario.assert?.hudAudit === void 0 ? void 0 : await sampleHudAudit(page);
|
|
14830
16173
|
const afterScreenshot = scenario.artifacts?.screenshots !== false && artifactFrames || wantsVisual || wantsFinalTone ? wantsVisual || wantsFinalTone ? await captureVisualPage(
|
|
14831
16174
|
"after.png",
|
|
14832
16175
|
scenario.artifacts?.screenshots === false ? void 0 : join(activeConfig.artifactDirectory, "after.png")
|
|
@@ -14861,9 +16204,16 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14861
16204
|
setupApplication2,
|
|
14862
16205
|
deviceMetrics,
|
|
14863
16206
|
movementBaselineSnapshot,
|
|
14864
|
-
startupOutcome === void 0 ? void 0 : {
|
|
16207
|
+
startupOutcome === void 0 ? void 0 : {
|
|
16208
|
+
...startupOutcome.startup,
|
|
16209
|
+
rule: startupOutcome.rule,
|
|
16210
|
+
...startupCover === void 0 ? {} : { cover: startupCover }
|
|
16211
|
+
},
|
|
14865
16212
|
void 0,
|
|
14866
|
-
tone
|
|
16213
|
+
tone,
|
|
16214
|
+
footSlip.length === 0 ? void 0 : footSlip,
|
|
16215
|
+
sightLine === void 0 || sightLine.samples.length === 0 ? void 0 : sightLine,
|
|
16216
|
+
hudAudit
|
|
14867
16217
|
);
|
|
14868
16218
|
if (cpuWindows.length !== cpuLabels.length) throw new Error("TN_PLAYTEST_CPU_WINDOW_FAILED: missing requested CPU window");
|
|
14869
16219
|
if (completionWindow !== void 0) {
|
|
@@ -14874,6 +16224,7 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14874
16224
|
browserArgs: resolveBrowserArguments(browserConfig.browserArgs)
|
|
14875
16225
|
};
|
|
14876
16226
|
}
|
|
16227
|
+
if (options.gameThread !== void 0) report.gameThread = options.gameThread;
|
|
14877
16228
|
report.acquisition = { requestUrls: [...requestUrls], ...cpuLabels.length === 0 ? {} : { cpuWindows }, ...completionWindow === void 0 ? {} : { completionWindow } };
|
|
14878
16229
|
await writeObservationArtifacts(activeConfig.artifactDirectory, scenario.artifacts, {
|
|
14879
16230
|
console: consoleEntries,
|
|
@@ -14886,6 +16237,7 @@ async function runStandalonePlaytestInternal(config, options = {}) {
|
|
|
14886
16237
|
else await page.close();
|
|
14887
16238
|
return addPreflightDiagnostic(report, preflight);
|
|
14888
16239
|
} catch (error) {
|
|
16240
|
+
if (error instanceof WorkerGameRelaunch) throw error;
|
|
14889
16241
|
try {
|
|
14890
16242
|
if (!observationArtifactsWritten) await writeObservationArtifacts(activeConfig.artifactDirectory, scenario.artifacts, {
|
|
14891
16243
|
console: consoleEntries,
|
|
@@ -15312,7 +16664,9 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15312
16664
|
// this the wait reads that as a slow loading gate and burns its whole deadline; with it
|
|
15313
16665
|
// the report names the exit and carries the console tail that says why.
|
|
15314
16666
|
hostAlive: () => target.driver.isAlive().catch(() => void 0),
|
|
15315
|
-
pump: () =>
|
|
16667
|
+
pump: async () => {
|
|
16668
|
+
await attached.advance(1);
|
|
16669
|
+
}
|
|
15316
16670
|
});
|
|
15317
16671
|
await throwIfAborted(target);
|
|
15318
16672
|
for (let frame = 0; frame < scenario.warmupFrames; frame += 1) {
|
|
@@ -15348,7 +16702,7 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15348
16702
|
const before = await bridge.sample(sampleRequest);
|
|
15349
16703
|
if (completionLabel !== void 0 && before.clock.mode !== "fixed-step") throw new Error("TN_PLAYTEST_COMPLETION_WINDOW_FAILED: prefix requires fixed-step clock");
|
|
15350
16704
|
if (scenario.artifacts?.screenshots === "before-after" && config.captureArtifactScreenshots !== false) {
|
|
15351
|
-
await captureDeviceScreenshot(target, join(config.artifactDirectory, "before.png"), tone, "before.png", void 0, renderOnly);
|
|
16705
|
+
await captureDeviceScreenshot(target, join(config.artifactDirectory, "before.png"), tone, "before.png", void 0, renderOnly, scenario.assert?.tone);
|
|
15352
16706
|
}
|
|
15353
16707
|
const pathEntity = scenario.assert?.movement?.pathLength === void 0 ? void 0 : scenario.assert.movement.entity ?? scenario.subject;
|
|
15354
16708
|
const pathPositions = [];
|
|
@@ -15401,12 +16755,14 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15401
16755
|
throw new PlaytestBridgeError(playtestDiagnostic(
|
|
15402
16756
|
"TN_PLAYTEST_OBSERVATION_UNAVAILABLE",
|
|
15403
16757
|
`Resource wait for '${wait.id}.${wait.path}' has no timeout.`,
|
|
15404
|
-
"Validate the scenario with timeoutMs as a positive integer no greater than
|
|
16758
|
+
"Validate the scenario with timeoutMs as a positive integer no greater than 300000."
|
|
15405
16759
|
));
|
|
15406
16760
|
}
|
|
15407
16761
|
const attachedBridge = bridge;
|
|
15408
16762
|
afterInput = await waitForResource({
|
|
15409
|
-
advance: () =>
|
|
16763
|
+
advance: async () => {
|
|
16764
|
+
await attachedBridge.advance(1);
|
|
16765
|
+
},
|
|
15410
16766
|
id: wait.id,
|
|
15411
16767
|
path: wait.path,
|
|
15412
16768
|
predicate: wait,
|
|
@@ -15507,7 +16863,9 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15507
16863
|
const pid = target.driver.processId;
|
|
15508
16864
|
if (pid === void 0) throw new Error("TN_PLAYTEST_CPU_WINDOW_FAILED: native child PID unavailable");
|
|
15509
16865
|
return { rootPid: pid, pid, tid: pid };
|
|
15510
|
-
}, measuredBridge, () =>
|
|
16866
|
+
}, measuredBridge, async () => {
|
|
16867
|
+
await measuredBridge.advance(1e3);
|
|
16868
|
+
}));
|
|
15511
16869
|
} finally {
|
|
15512
16870
|
if (holdRender) await transport.call("_holdAutomaticRender", false);
|
|
15513
16871
|
}
|
|
@@ -15534,7 +16892,7 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15534
16892
|
const wantsStepTone = step.label !== void 0 && scenario.assert?.tone?.some(({ atStep }) => atStep === step.label) === true;
|
|
15535
16893
|
if (step.screenshot !== void 0 || wantsStepTone) {
|
|
15536
16894
|
const label = step.screenshot === void 0 ? `tone-${index}.png` : `${safePart(step.screenshot)}.png`;
|
|
15537
|
-
await captureDeviceScreenshot(target, join(config.artifactDirectory, label), tone, label, step.label, renderOnly);
|
|
16895
|
+
await captureDeviceScreenshot(target, join(config.artifactDirectory, label), tone, label, step.label, renderOnly, scenario.assert?.tone);
|
|
15538
16896
|
}
|
|
15539
16897
|
if (step.release && pressed !== void 0) {
|
|
15540
16898
|
const released = typeof pressed === "string" ? [pressed] : [...pressed];
|
|
@@ -15583,7 +16941,7 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15583
16941
|
metrics?.stop();
|
|
15584
16942
|
await metrics?.sampleNow("after").catch(() => void 0);
|
|
15585
16943
|
if (scenario.artifacts?.screenshots !== false || scenario.assert?.tone?.some(({ atStep }) => atStep === void 0) === true) {
|
|
15586
|
-
await captureDeviceScreenshot(target, join(config.artifactDirectory, "after.png"), tone, "after.png", void 0, renderOnly);
|
|
16944
|
+
await captureDeviceScreenshot(target, join(config.artifactDirectory, "after.png"), tone, "after.png", void 0, renderOnly, scenario.assert?.tone);
|
|
15587
16945
|
}
|
|
15588
16946
|
if (!await target.driver.isAlive()) {
|
|
15589
16947
|
return failureReport(config, scenario, playtestDiagnostic(
|
|
@@ -15717,11 +17075,12 @@ async function runDevicePlaytestInternal(config, target, cleanupState) {
|
|
|
15717
17075
|
if (cleanupErrors.length > 0) cleanupState.error = cleanupFailure(cleanupErrors);
|
|
15718
17076
|
}
|
|
15719
17077
|
}
|
|
15720
|
-
async function captureDeviceScreenshot(target, path2, tone, label, atStep, renderOnly) {
|
|
17078
|
+
async function captureDeviceScreenshot(target, path2, tone, label, atStep, renderOnly, toneAssertions = []) {
|
|
15721
17079
|
await target.driver.screenshot(path2, renderOnly);
|
|
15722
17080
|
const png = await readFile(path2);
|
|
15723
17081
|
const stats = target.name === "desktop" ? assertDesktopCaptureNotBlank(png, path2) : assertCaptureNotBlank(png, path2);
|
|
15724
17082
|
if (stats.tone !== void 0) tone.push({ code: "TN_TONE", label, ...atStep === void 0 ? {} : { atStep }, ...stats.tone });
|
|
17083
|
+
tone.push(...collectRegionalTone(png, toneAssertions, label, atStep));
|
|
15725
17084
|
}
|
|
15726
17085
|
function deviceMetricsRecorder(target) {
|
|
15727
17086
|
if (target.name !== "android") return void 0;
|
|
@@ -16149,21 +17508,15 @@ var LocalDeviceMailbox = class {
|
|
|
16149
17508
|
}
|
|
16150
17509
|
}
|
|
16151
17510
|
async remove(path2) {
|
|
16152
|
-
|
|
16153
|
-
try {
|
|
16154
|
-
await rm(path2, { force: true });
|
|
16155
|
-
return;
|
|
16156
|
-
} catch (error) {
|
|
16157
|
-
if (retry >= 10 || !isTransientMailboxLock(error)) throw error;
|
|
16158
|
-
await delay3(20);
|
|
16159
|
-
}
|
|
16160
|
-
}
|
|
17511
|
+
await retryMailboxLock(() => rm(path2, { force: true }));
|
|
16161
17512
|
}
|
|
16162
17513
|
async write(path2, contents) {
|
|
16163
17514
|
await mkdir(dirname(path2), { recursive: true });
|
|
16164
17515
|
const temporary = `${path2}.tmp`;
|
|
16165
|
-
await
|
|
16166
|
-
|
|
17516
|
+
await retryMailboxLock(async () => {
|
|
17517
|
+
await writeFile(temporary, contents, "utf8");
|
|
17518
|
+
await rename(temporary, path2);
|
|
17519
|
+
});
|
|
16167
17520
|
}
|
|
16168
17521
|
};
|
|
16169
17522
|
var DesktopPlaytestDriver = class {
|
|
@@ -16208,6 +17561,10 @@ var DesktopPlaytestDriver = class {
|
|
|
16208
17561
|
...process.env,
|
|
16209
17562
|
...process.platform === "linux" && process.env.SDL_VIDEODRIVER === void 0 ? { SDL_VIDEODRIVER: "x11" } : {},
|
|
16210
17563
|
MYSTRAL_HEADLESS: "1",
|
|
17564
|
+
// A debug launch, because the run's own warning evaluator reads `TN_SCENE_WARNING` and the
|
|
17565
|
+
// engine prints it only where a developer asked for the dev surfaces. The shell's value must
|
|
17566
|
+
// not decide it: an inherited `DEV_MODE=0` would leave the check blind rather than red.
|
|
17567
|
+
DEV_MODE: "1",
|
|
16211
17568
|
...this.options.env,
|
|
16212
17569
|
TN_PLAYTEST_MAILBOX_ROOT: this.mailboxRoot,
|
|
16213
17570
|
// The host reads the request before it evaluates the game entry, the way the browser runner
|
|
@@ -16405,6 +17762,17 @@ function isProcessExited(child) {
|
|
|
16405
17762
|
function delay3(milliseconds) {
|
|
16406
17763
|
return new Promise((resolve8) => setTimeout(resolve8, milliseconds));
|
|
16407
17764
|
}
|
|
17765
|
+
async function retryMailboxLock(operation) {
|
|
17766
|
+
for (let retry = 0; ; retry += 1) {
|
|
17767
|
+
try {
|
|
17768
|
+
await operation();
|
|
17769
|
+
return;
|
|
17770
|
+
} catch (error) {
|
|
17771
|
+
if (retry >= 100 || !isTransientMailboxLock(error)) throw error;
|
|
17772
|
+
await delay3(20);
|
|
17773
|
+
}
|
|
17774
|
+
}
|
|
17775
|
+
}
|
|
16408
17776
|
function isTransientMailboxLock(error) {
|
|
16409
17777
|
const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
16410
17778
|
return code === "EPERM" || code === "EBUSY";
|
|
@@ -16821,7 +18189,9 @@ var XcrunIosDriver = class {
|
|
|
16821
18189
|
async prepareSimulator(endpoint, mailboxRoot) {
|
|
16822
18190
|
const device = this.device();
|
|
16823
18191
|
await this.run(["simctl", "bootstatus", device, "-b"]);
|
|
18192
|
+
const previous = await this.registeredBundlePath(device);
|
|
16824
18193
|
await this.run(["simctl", "install", device, this.options.appPath]);
|
|
18194
|
+
await this.awaitInstalledBundle(device, previous);
|
|
16825
18195
|
const container = (await this.run([
|
|
16826
18196
|
"simctl",
|
|
16827
18197
|
"get_app_container",
|
|
@@ -16874,6 +18244,28 @@ var XcrunIosDriver = class {
|
|
|
16874
18244
|
]);
|
|
16875
18245
|
this.pid = parseLaunchedPid(output);
|
|
16876
18246
|
}
|
|
18247
|
+
// `simctl install` returns while the simulator still lists the replaced bundle, which it has
|
|
18248
|
+
// moved to `containermanagerd/Dead/`. A launch in that window starts the previous build: a CI
|
|
18249
|
+
// physics scenario ran the input smoke game from a Dead container and failed every assertion.
|
|
18250
|
+
// Every reinstall gets a new bundle container, so launch only once the listed path is new.
|
|
18251
|
+
async awaitInstalledBundle(device, previous) {
|
|
18252
|
+
const deadline = Date.now() + kIosInstallRegistrationMs;
|
|
18253
|
+
for (; ; ) {
|
|
18254
|
+
const listed = await this.run(["simctl", "listapps", device]);
|
|
18255
|
+
const path2 = parseListedBundlePath(listed, this.options.bundleId);
|
|
18256
|
+
if (path2 !== void 0 && path2 !== previous && !path2.includes("/Dead/")) return;
|
|
18257
|
+
if (Date.now() >= deadline) {
|
|
18258
|
+
const at = listed.indexOf(`"${this.options.bundleId}"`);
|
|
18259
|
+
throw new Error(
|
|
18260
|
+
`TN_PLAYTEST_IOS_INSTALL_UNREGISTERED: ${this.options.bundleId} still lists '${path2 ?? "no bundle"}' ${kIosInstallRegistrationMs} ms after simctl install. listapps: ` + listed.slice(Math.max(at, 0), Math.max(at, 0) + 800)
|
|
18261
|
+
);
|
|
18262
|
+
}
|
|
18263
|
+
await new Promise((resolve8) => setTimeout(resolve8, kIosInstallPollMs));
|
|
18264
|
+
}
|
|
18265
|
+
}
|
|
18266
|
+
async registeredBundlePath(device) {
|
|
18267
|
+
return parseListedBundlePath(await this.run(["simctl", "listapps", device]), this.options.bundleId);
|
|
18268
|
+
}
|
|
16877
18269
|
device() {
|
|
16878
18270
|
return this.options.device ?? "booted";
|
|
16879
18271
|
}
|
|
@@ -16881,6 +18273,14 @@ var XcrunIosDriver = class {
|
|
|
16881
18273
|
return this.mailboxRoot === void 0 ? path2 : join(this.mailboxRoot, basename(path2));
|
|
16882
18274
|
}
|
|
16883
18275
|
};
|
|
18276
|
+
var kIosInstallRegistrationMs = 6e4;
|
|
18277
|
+
var kIosInstallPollMs = 250;
|
|
18278
|
+
function parseListedBundlePath(output, bundleId) {
|
|
18279
|
+
const key = new RegExp(`"${bundleId.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")}"\\s*=\\s*\\{`, "u").exec(output);
|
|
18280
|
+
if (key === null) return void 0;
|
|
18281
|
+
const path2 = /\n\s*Path = (?:"([^"]*)"|([^;\s]+));/u.exec(output.slice(key.index));
|
|
18282
|
+
return path2?.[1] ?? path2?.[2];
|
|
18283
|
+
}
|
|
16884
18284
|
function parseLaunchedPid(output) {
|
|
16885
18285
|
const pid = /(?:pid\s+|:\s*)(\d+)\b/iu.exec(output)?.[1];
|
|
16886
18286
|
if (pid === void 0) throw new Error(`iOS launch did not report a process id: ${output.trim()}`);
|
|
@@ -17231,12 +18631,12 @@ async function withBrowserCapture(config, capture, signal) {
|
|
|
17231
18631
|
networkEntries
|
|
17232
18632
|
})}`);
|
|
17233
18633
|
}
|
|
17234
|
-
await stage("warmup", () => waitFrames(activePage, scenario.warmupFrames), startupBudget);
|
|
18634
|
+
await stage("warmup", () => waitFrames(activePage, scenario.warmupFrames, startupBudget), startupBudget);
|
|
17235
18635
|
const startup = await stage("engine startup readiness", () => waitForStartupReady({
|
|
17236
18636
|
aborted: () => controller.signal.aborted,
|
|
17237
18637
|
bridge,
|
|
17238
18638
|
declaredSoftware: active.allowSoftwareAdapter === true,
|
|
17239
|
-
pump: () => waitFrames(activePage, 1)
|
|
18639
|
+
pump: (remainingMs) => waitFrames(activePage, 1, remainingMs)
|
|
17240
18640
|
}), startupBudget);
|
|
17241
18641
|
if (startup === void 0) throw new Error("TN_CAPTURE_SESSION_READINESS_REQUIRED: no startup observation was returned");
|
|
17242
18642
|
const provenance = await stage("adapter provenance", () => readCaptureProvenance(activePage, active, scenario));
|
|
@@ -17301,4 +18701,4 @@ async function withBrowserCapture(config, capture, signal) {
|
|
|
17301
18701
|
}
|
|
17302
18702
|
}
|
|
17303
18703
|
|
|
17304
|
-
export { ANDROID_TRANSPORT_CAPABILITIES, AdbAndroidDriver, DesktopPlaytestDriver, DeviceBridgeTransport, DeviceMailboxTransport, LocalDeviceMailbox, ManagedServerError, PERFORMANCE_BROWSER_ARGS, PIPELINE_CAPTURE_VERSION, PIPELINE_EVENT_MARKER, PLAYTEST_FLAGS, PlaytestBridgeError, PlaytestCliUsageError, PlaywrightTransport, STANDALONE_PLAYTEST_OBSERVATION_FIELDS, WEBGPU_BROWSER_ARGS, XcrunIosDriver, advanceFixedStep, advanceTimeoutMs, androidMailboxPaths, androidTouchBatches, batchArtifactDirectory, boundedTeardownStep, bridgeWaitTimeoutMs, buildReport, captureVisualSurface, connectPlaytestBridge, connectPlaytestBridgeTransport, decideDisplayStrategy, desktopConsoleType, deviceMailboxPaths, deviceTimeoutDiagnostic, discoverAdb, failedDiagnosticsAssertion, formatPipelineSummary, formatUsage, handlePlaytestSignal, initStandalonePlaytest, isRuntimeReadout, keyboardIsShown, openPageAndConnectBridge, pageLifecycleDiagnostic, parseAndroidConsole, parseAndroidTouchViewport, parseLaunchedPid, parsePipelineCapture, parsePipelineEventMarkers, parseStandalonePlaytestArgs, playtestStepDrivesMovement, preflightDisplay, reconcileBrowserPointers, recordToScenario, requireAssertions, resolveBrowserArguments, resolveManagedServerCommand, resolveManagedServerConfig, rotatedTouchPosition, runAndroidPlaytest, runDesktopPlaytest, runDevicePlaytest, runIosPlaytest, runStandalonePlaytest, runStandalonePlaytests, softwareAdapterName, substituteManagedPort, summarizePipelineCapture, tapCommand, touchPositionForViewport, touchRotationFromWindowDump, validateDeviceEndpoint, viewportPresentationCommands, viewportPresentationObserved, viewportRestoreCommands, withBrowserCapture, writeCaptureProvenance, writeObservationArtifacts };
|
|
18704
|
+
export { ANDROID_TRANSPORT_CAPABILITIES, AdbAndroidDriver, DesktopPlaytestDriver, DeviceBridgeTransport, DeviceMailboxTransport, LocalDeviceMailbox, ManagedServerError, PENDING_BRIDGE_OPERATIONS_GLOBAL, PERFORMANCE_BROWSER_ARGS, PIPELINE_CAPTURE_VERSION, PIPELINE_EVENT_MARKER, PLAYTEST_FLAGS, PlaytestBridgeError, PlaytestCliUsageError, PlaywrightTransport, STANDALONE_PLAYTEST_OBSERVATION_FIELDS, WEBGPU_BROWSER_ARGS, XcrunIosDriver, advanceFixedStep, advanceTimeoutMs, androidMailboxPaths, androidTouchBatches, batchArtifactDirectory, boundedTeardownStep, bridgeWaitTimeoutMs, buildReport, captureVisualSurface, connectPlaytestBridge, connectPlaytestBridgeTransport, decideDisplayStrategy, desktopConsoleType, deviceMailboxPaths, deviceTimeoutDiagnostic, discoverAdb, failedDiagnosticsAssertion, formatPipelineSummary, formatUsage, handlePlaytestSignal, initStandalonePlaytest, isRuntimeReadout, keyboardIsShown, openPageAndConnectBridge, pageLifecycleDiagnostic, parseAndroidConsole, parseAndroidTouchViewport, parseLaunchedPid, parsePipelineCapture, parsePipelineEventMarkers, parseStandalonePlaytestArgs, playtestStepDrivesMovement, preflightDisplay, reconcileBrowserPointers, recordToScenario, requireAssertions, resolveBrowserArguments, resolveManagedServerCommand, resolveManagedServerConfig, rotatedTouchPosition, runAndroidPlaytest, runDesktopPlaytest, runDevicePlaytest, runIosPlaytest, runStandalonePlaytest, runStandalonePlaytests, softwareAdapterName, substituteManagedPort, summarizePipelineCapture, tapCommand, touchPositionForViewport, touchRotationFromWindowDump, validateDeviceEndpoint, viewportPresentationCommands, viewportPresentationObserved, viewportRestoreCommands, withBrowserCapture, withScenarioClock, writeCaptureProvenance, writeObservationArtifacts };
|