@threenative/playtest 0.3.8 → 0.3.10

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/index.js CHANGED
@@ -2219,17 +2219,26 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
2219
2219
  );
2220
2220
  }
2221
2221
  if (assertion.minFps !== void 0) {
2222
- const exact = fpsFromFrameTimes(frameTimes);
2223
- const observed2 = exact === void 0 ? void 0 : Math.floor(exact * 100) / 100;
2222
+ const onXvfb = lane?.display === "virtual" && lane.target !== "android" && lane.target !== "ios";
2223
+ const costP95 = onXvfb ? frameCost(observed, samples.length, lane).costP95 : void 0;
2224
+ const virtual = costP95 !== void 0 && costP95 > 0;
2225
+ const exact = virtual ? 1e3 / costP95 : fpsFromFrameTimes(frameTimes);
2226
+ const observedFps = exact === void 0 ? void 0 : Math.floor(exact * 100) / 100;
2224
2227
  const pass = samplesPass && exact !== void 0 && exact >= assertion.minFps;
2225
2228
  results.push({
2226
- details: { actual: observed2 ?? null, expected: assertion.minFps, sampleCount: samples.length, unit: "fps" },
2229
+ details: {
2230
+ actual: observedFps ?? null,
2231
+ expected: assertion.minFps,
2232
+ sampleCount: samples.length,
2233
+ unit: "fps",
2234
+ ...virtual ? { basis: "frame-cost", interval: { gated: false, p95: frameMsP95 ?? null, reason: XVFB_CADENCE } } : {}
2235
+ },
2227
2236
  id: "performance.minFps",
2228
2237
  pass
2229
2238
  });
2230
2239
  if (!pass) diagnostics.push({
2231
2240
  code: "TN_PLAYTEST_PERFORMANCE_ASSERTION_FAILED",
2232
- message: `performance.minFps expected at least ${assertion.minFps} fps, observed ${observed2 ?? "unavailable"}.`,
2241
+ message: `performance.minFps expected at least ${assertion.minFps} fps, observed ${observedFps ?? "unavailable"}${virtual ? " from frame cost on a virtual display" : ""}.`,
2233
2242
  observedRuntimePath: path,
2234
2243
  severity: "error",
2235
2244
  sourcePath,
@@ -2296,15 +2305,19 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
2296
2305
  }
2297
2306
  var HITCH_MS = 2e3;
2298
2307
  var XVFB_CADENCE = "display cadence, not gated: the runner's private Xvfb paces frames on its own timer, not the game's cost";
2299
- function emitFrameBound(ceiling, intervalP95, observed, sampleCount, samplesPass, lane, results, diagnostics, path, sourcePath) {
2308
+ function frameCost(observed, sampleCount, lane) {
2300
2309
  const cpu = observed.flatMap(({ phases }) => phases === void 0 || typeof phases.update !== "number" || typeof phases.render !== "number" ? [] : [phases.update + phases.render]);
2301
2310
  const hitches = observed.filter(({ frameMs, phases }) => phases === void 0 && frameMs >= HITCH_MS).length;
2302
2311
  const cpuP95 = cpu.length > 0 && cpu.length + hitches === sampleCount ? nearestRank(cpu, 0.95) : void 0;
2312
+ const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
2313
+ return { costP95, cpuP95, hitches };
2314
+ }
2315
+ function emitFrameBound(ceiling, intervalP95, observed, sampleCount, samplesPass, lane, results, diagnostics, path, sourcePath) {
2316
+ const { costP95, cpuP95, hitches } = frameCost(observed, sampleCount, lane);
2303
2317
  const missing = [
2304
2318
  ...cpuP95 === void 0 ? ["the CPU frame split (phases.update and phases.render)"] : [],
2305
2319
  ...lane.gpuP95 === void 0 ? ["the GPU time (a TN_FRAME_BUDGET window with a gpu reading)"] : []
2306
2320
  ];
2307
- const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
2308
2321
  const virtual = lane.display === "virtual";
2309
2322
  const costPass = costP95 !== void 0 && costP95 <= ceiling;
2310
2323
  const intervalPass = virtual || intervalP95 !== void 0 && intervalP95 <= ceiling;
@@ -3613,7 +3626,7 @@ function emitPerfSignalsWorld(ctx) {
3613
3626
  budget.maxFrameMsP95 === void 0 ? scenarioAssertions.performance : { ...scenarioAssertions.performance, maxFrameMsP95: budget.maxFrameMsP95 },
3614
3627
  input.report.observations?.performanceSeries,
3615
3628
  input.scenario.sourcePath,
3616
- { display: frameDisplay(), foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
3629
+ { display: frameDisplay(), target: input.report.target, foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
3617
3630
  );
3618
3631
  assertions.push(...result.assertions.map((row) => row.id === "performance.samples" || row.id === "performance.maxFrameMsP95" ? { ...row, details: { ...row.details, frameBudget: budget } } : row));
3619
3632
  diagnostics.push(...result.diagnostics);
@@ -558,6 +558,8 @@ interface IPlaytestFramePassSample {
558
558
  interface IPlaytestRuntimeDiagnosticsSample {
559
559
  drawCalls?: number;
560
560
  frameMs: number;
561
+ /** The frame's number in this run, when the engine counts them. */
562
+ sequence?: number;
561
563
  /**
562
564
  * Supplied by an engine that measures its own frame — `@threenative/core` fills it from the
563
565
  * frame budget. Absent for a plain Three.js bridge.
@@ -2731,17 +2731,26 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
2731
2731
  );
2732
2732
  }
2733
2733
  if (assertion.minFps !== void 0) {
2734
- const exact = fpsFromFrameTimes(frameTimes);
2735
- const observed2 = exact === void 0 ? void 0 : Math.floor(exact * 100) / 100;
2734
+ const onXvfb = lane?.display === "virtual" && lane.target !== "android" && lane.target !== "ios";
2735
+ const costP95 = onXvfb ? frameCost(observed, samples.length, lane).costP95 : void 0;
2736
+ const virtual = costP95 !== void 0 && costP95 > 0;
2737
+ const exact = virtual ? 1e3 / costP95 : fpsFromFrameTimes(frameTimes);
2738
+ const observedFps = exact === void 0 ? void 0 : Math.floor(exact * 100) / 100;
2736
2739
  const pass = samplesPass && exact !== void 0 && exact >= assertion.minFps;
2737
2740
  results.push({
2738
- details: { actual: observed2 ?? null, expected: assertion.minFps, sampleCount: samples.length, unit: "fps" },
2741
+ details: {
2742
+ actual: observedFps ?? null,
2743
+ expected: assertion.minFps,
2744
+ sampleCount: samples.length,
2745
+ unit: "fps",
2746
+ ...virtual ? { basis: "frame-cost", interval: { gated: false, p95: frameMsP95 ?? null, reason: XVFB_CADENCE } } : {}
2747
+ },
2739
2748
  id: "performance.minFps",
2740
2749
  pass
2741
2750
  });
2742
2751
  if (!pass) diagnostics.push({
2743
2752
  code: "TN_PLAYTEST_PERFORMANCE_ASSERTION_FAILED",
2744
- message: `performance.minFps expected at least ${assertion.minFps} fps, observed ${observed2 ?? "unavailable"}.`,
2753
+ message: `performance.minFps expected at least ${assertion.minFps} fps, observed ${observedFps ?? "unavailable"}${virtual ? " from frame cost on a virtual display" : ""}.`,
2745
2754
  observedRuntimePath: path2,
2746
2755
  severity: "error",
2747
2756
  sourcePath,
@@ -2806,15 +2815,19 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
2806
2815
  addPassBound("triangles", kind, ceiling);
2807
2816
  return { assertions: results, diagnostics };
2808
2817
  }
2809
- function emitFrameBound(ceiling, intervalP95, observed, sampleCount, samplesPass, lane, results, diagnostics, path2, sourcePath) {
2818
+ function frameCost(observed, sampleCount, lane) {
2810
2819
  const cpu = observed.flatMap(({ phases }) => phases === void 0 || typeof phases.update !== "number" || typeof phases.render !== "number" ? [] : [phases.update + phases.render]);
2811
2820
  const hitches = observed.filter(({ frameMs, phases }) => phases === void 0 && frameMs >= HITCH_MS).length;
2812
2821
  const cpuP95 = cpu.length > 0 && cpu.length + hitches === sampleCount ? nearestRank(cpu, 0.95) : void 0;
2822
+ const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
2823
+ return { costP95, cpuP95, hitches };
2824
+ }
2825
+ function emitFrameBound(ceiling, intervalP95, observed, sampleCount, samplesPass, lane, results, diagnostics, path2, sourcePath) {
2826
+ const { costP95, cpuP95, hitches } = frameCost(observed, sampleCount, lane);
2813
2827
  const missing = [
2814
2828
  ...cpuP95 === void 0 ? ["the CPU frame split (phases.update and phases.render)"] : [],
2815
2829
  ...lane.gpuP95 === void 0 ? ["the GPU time (a TN_FRAME_BUDGET window with a gpu reading)"] : []
2816
2830
  ];
2817
- const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
2818
2831
  const virtual = lane.display === "virtual";
2819
2832
  const costPass = costP95 !== void 0 && costP95 <= ceiling;
2820
2833
  const intervalPass = virtual || intervalP95 !== void 0 && intervalP95 <= ceiling;
@@ -4204,7 +4217,7 @@ function emitPerfSignalsWorld(ctx) {
4204
4217
  budget.maxFrameMsP95 === void 0 ? scenarioAssertions.performance : { ...scenarioAssertions.performance, maxFrameMsP95: budget.maxFrameMsP95 },
4205
4218
  input.report.observations?.performanceSeries,
4206
4219
  input.scenario.sourcePath,
4207
- { display: frameDisplay(), foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
4220
+ { display: frameDisplay(), target: input.report.target, foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
4208
4221
  );
4209
4222
  assertions.push(...result.assertions.map((row) => row.id === "performance.samples" || row.id === "performance.maxFrameMsP95" ? { ...row, details: { ...row.details, frameBudget: budget } } : row));
4210
4223
  diagnostics.push(...result.diagnostics);
@@ -12181,6 +12194,7 @@ var AdbAndroidDriver = class _AdbAndroidDriver {
12181
12194
  lastError = error.message;
12182
12195
  if (isAdbRefusal(lastError) || attempt === LOGCAT_ATTEMPTS) break;
12183
12196
  await this.adb(["wait-for-device"]).catch(() => void 0);
12197
+ await delay(LOGCAT_RETRY_MS);
12184
12198
  }
12185
12199
  }
12186
12200
  if (output === void 0) throw failedLogcat(args.join(" "), lastError);
@@ -12410,9 +12424,8 @@ ${excerpt}`
12410
12424
  return stdout;
12411
12425
  } catch (error) {
12412
12426
  const detail = error;
12413
- throw new Error(
12414
- `adb ${args.join(" ")} failed: ${detail.stderr || detail.stdout || detail.message}`
12415
- );
12427
+ const silent = `${detail.message.trim()} (exit ${String(detail.code)}, signal ${String(detail.signal)})`;
12428
+ throw new Error(`adb ${args.join(" ")} failed: ${detail.stderr || detail.stdout || silent}`);
12416
12429
  }
12417
12430
  }
12418
12431
  async waitForScreenRecorder() {
@@ -12494,7 +12507,8 @@ function isPlatformWebViewNoise(text) {
12494
12507
  return !/:CONSOLE\(|Mystral|THREENATIVE/u.test(text);
12495
12508
  }
12496
12509
  var TOUCH_AXIS_MAX = 32767;
12497
- var LOGCAT_ATTEMPTS = 2;
12510
+ var LOGCAT_ATTEMPTS = 4;
12511
+ var LOGCAT_RETRY_MS = 1e3;
12498
12512
  var LOGCAT_ERROR_LIMIT = 2e3;
12499
12513
  function parseAndroidTouchViewport(output) {
12500
12514
  const match = /Viewport\s+INTERNAL:\s*displayId=0,[\s\S]*?(?:orientation=(\d+),\s*)?logicalFrame=\[\s*(-?\d+),\s*(-?\d+),\s*(-?\d+),\s*(-?\d+)\s*\],\s*physicalFrame=\[\s*(-?\d+),\s*(-?\d+),\s*(-?\d+),\s*(-?\d+)\s*\],\s*deviceSize=\[\s*(\d+),\s*(\d+)\s*\]/u.exec(output);
@@ -16901,6 +16915,12 @@ var SOFTWARE_DEVICE_LOSS = /TN_DEVICE_LOST|TN_WASM_DEVICE_LOST|WebGPU Device Los
16901
16915
  function isSoftwareDeviceLossEntry(entry) {
16902
16916
  return (entry.type === "error" || entry.type === "assert" || entry.type === "pageerror") && SOFTWARE_DEVICE_LOSS.test(entry.text);
16903
16917
  }
16918
+ function framesAfterBaseline(before, after) {
16919
+ if (after === void 0 || before === void 0) return after ?? before;
16920
+ const baseline = before.at(-1)?.sequence;
16921
+ if (baseline === void 0 || before === after) return after;
16922
+ return after.filter(({ sequence }) => sequence === void 0 || sequence > baseline);
16923
+ }
16904
16924
  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) {
16905
16925
  const movementSample = isAnonymousMovementScenario(scenario) ? observedMovementSample(movementSamples) : void 0;
16906
16926
  const entity = scenario.assert?.movement?.entity ?? scenario.subject ?? movementSample?.entity ?? "";
@@ -16921,7 +16941,7 @@ function buildReport(config, scenario, beforeSnapshot, afterSnapshot, consoleEnt
16921
16941
  }
16922
16942
  const movementDelta = beforePosition === void 0 || afterPosition === void 0 ? void 0 : subtract(afterPosition, beforePosition);
16923
16943
  const distance = movementDelta === void 0 ? 0 : length(movementDelta);
16924
- const performanceSeries = scenario.assert?.performance === void 0 && scenario.assert?.parity === void 0 ? void 0 : afterSnapshot?.runtimeDiagnosticsSeries ?? beforeSnapshot?.runtimeDiagnosticsSeries;
16944
+ const performanceSeries = scenario.assert?.performance === void 0 && scenario.assert?.parity === void 0 ? void 0 : framesAfterBaseline(beforeSnapshot?.runtimeDiagnosticsSeries, afterSnapshot?.runtimeDiagnosticsSeries);
16925
16945
  const softwareAdapter = capture?.rendererKind === "webgpu" ? softwareAdapterName(capture.adapter) : void 0;
16926
16946
  const softwareLane = config.allowSoftwareAdapter === true && softwareAdapter !== void 0;
16927
16947
  const deviceLossEntries = softwareLane ? consoleEntries.filter(isSoftwareDeviceLossEntry) : [];
@@ -2398,17 +2398,26 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
2398
2398
  );
2399
2399
  }
2400
2400
  if (assertion.minFps !== void 0) {
2401
- const exact = fpsFromFrameTimes(frameTimes);
2402
- const observed2 = exact === void 0 ? void 0 : Math.floor(exact * 100) / 100;
2401
+ const onXvfb = lane?.display === "virtual" && lane.target !== "android" && lane.target !== "ios";
2402
+ const costP95 = onXvfb ? frameCost(observed, samples.length, lane).costP95 : void 0;
2403
+ const virtual = costP95 !== void 0 && costP95 > 0;
2404
+ const exact = virtual ? 1e3 / costP95 : fpsFromFrameTimes(frameTimes);
2405
+ const observedFps = exact === void 0 ? void 0 : Math.floor(exact * 100) / 100;
2403
2406
  const pass = samplesPass && exact !== void 0 && exact >= assertion.minFps;
2404
2407
  results.push({
2405
- details: { actual: observed2 ?? null, expected: assertion.minFps, sampleCount: samples.length, unit: "fps" },
2408
+ details: {
2409
+ actual: observedFps ?? null,
2410
+ expected: assertion.minFps,
2411
+ sampleCount: samples.length,
2412
+ unit: "fps",
2413
+ ...virtual ? { basis: "frame-cost", interval: { gated: false, p95: frameMsP95 ?? null, reason: XVFB_CADENCE } } : {}
2414
+ },
2406
2415
  id: "performance.minFps",
2407
2416
  pass
2408
2417
  });
2409
2418
  if (!pass) diagnostics.push({
2410
2419
  code: "TN_PLAYTEST_PERFORMANCE_ASSERTION_FAILED",
2411
- message: `performance.minFps expected at least ${assertion.minFps} fps, observed ${observed2 ?? "unavailable"}.`,
2420
+ message: `performance.minFps expected at least ${assertion.minFps} fps, observed ${observedFps ?? "unavailable"}${virtual ? " from frame cost on a virtual display" : ""}.`,
2412
2421
  observedRuntimePath: path2,
2413
2422
  severity: "error",
2414
2423
  sourcePath,
@@ -2475,15 +2484,19 @@ function evaluatePerformanceAssertion(assertion, series, sourcePath, lane) {
2475
2484
  }
2476
2485
  var HITCH_MS = 2e3;
2477
2486
  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) {
2487
+ function frameCost(observed, sampleCount, lane) {
2479
2488
  const cpu = observed.flatMap(({ phases }) => phases === void 0 || typeof phases.update !== "number" || typeof phases.render !== "number" ? [] : [phases.update + phases.render]);
2480
2489
  const hitches = observed.filter(({ frameMs, phases }) => phases === void 0 && frameMs >= HITCH_MS).length;
2481
2490
  const cpuP95 = cpu.length > 0 && cpu.length + hitches === sampleCount ? nearestRank(cpu, 0.95) : void 0;
2491
+ const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
2492
+ return { costP95, cpuP95, hitches };
2493
+ }
2494
+ function emitFrameBound(ceiling, intervalP95, observed, sampleCount, samplesPass, lane, results, diagnostics, path2, sourcePath) {
2495
+ const { costP95, cpuP95, hitches } = frameCost(observed, sampleCount, lane);
2482
2496
  const missing = [
2483
2497
  ...cpuP95 === void 0 ? ["the CPU frame split (phases.update and phases.render)"] : [],
2484
2498
  ...lane.gpuP95 === void 0 ? ["the GPU time (a TN_FRAME_BUDGET window with a gpu reading)"] : []
2485
2499
  ];
2486
- const costP95 = cpuP95 === void 0 || lane.gpuP95 === void 0 ? void 0 : Math.max(cpuP95, lane.gpuP95);
2487
2500
  const virtual = lane.display === "virtual";
2488
2501
  const costPass = costP95 !== void 0 && costP95 <= ceiling;
2489
2502
  const intervalPass = virtual || intervalP95 !== void 0 && intervalP95 <= ceiling;
@@ -3879,7 +3892,7 @@ function emitPerfSignalsWorld(ctx) {
3879
3892
  budget.maxFrameMsP95 === void 0 ? scenarioAssertions.performance : { ...scenarioAssertions.performance, maxFrameMsP95: budget.maxFrameMsP95 },
3880
3893
  input.report.observations?.performanceSeries,
3881
3894
  input.scenario.sourcePath,
3882
- { display: frameDisplay(), foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
3895
+ { display: frameDisplay(), target: input.report.target, foreignGpu: foreignGpuProcesses(), ...gpuLane((input.report.observations?.console ?? []).map(({ text }) => text)) }
3883
3896
  );
3884
3897
  assertions.push(...result.assertions.map((row) => row.id === "performance.samples" || row.id === "performance.maxFrameMsP95" ? { ...row, details: { ...row.details, frameBudget: budget } } : row));
3885
3898
  diagnostics.push(...result.diagnostics);
@@ -10749,6 +10762,7 @@ var AdbAndroidDriver = class _AdbAndroidDriver {
10749
10762
  lastError = error.message;
10750
10763
  if (isAdbRefusal(lastError) || attempt === LOGCAT_ATTEMPTS) break;
10751
10764
  await this.adb(["wait-for-device"]).catch(() => void 0);
10765
+ await delay(LOGCAT_RETRY_MS);
10752
10766
  }
10753
10767
  }
10754
10768
  if (output === void 0) throw failedLogcat(args.join(" "), lastError);
@@ -10978,9 +10992,8 @@ ${excerpt}`
10978
10992
  return stdout;
10979
10993
  } catch (error) {
10980
10994
  const detail = error;
10981
- throw new Error(
10982
- `adb ${args.join(" ")} failed: ${detail.stderr || detail.stdout || detail.message}`
10983
- );
10995
+ const silent = `${detail.message.trim()} (exit ${String(detail.code)}, signal ${String(detail.signal)})`;
10996
+ throw new Error(`adb ${args.join(" ")} failed: ${detail.stderr || detail.stdout || silent}`);
10984
10997
  }
10985
10998
  }
10986
10999
  async waitForScreenRecorder() {
@@ -11065,7 +11078,8 @@ function isPlatformWebViewNoise(text) {
11065
11078
  return !/:CONSOLE\(|Mystral|THREENATIVE/u.test(text);
11066
11079
  }
11067
11080
  var TOUCH_AXIS_MAX = 32767;
11068
- var LOGCAT_ATTEMPTS = 2;
11081
+ var LOGCAT_ATTEMPTS = 4;
11082
+ var LOGCAT_RETRY_MS = 1e3;
11069
11083
  var LOGCAT_ERROR_LIMIT = 2e3;
11070
11084
  function parseAndroidTouchViewport(output) {
11071
11085
  const match = /Viewport\s+INTERNAL:\s*displayId=0,[\s\S]*?(?:orientation=(\d+),\s*)?logicalFrame=\[\s*(-?\d+),\s*(-?\d+),\s*(-?\d+),\s*(-?\d+)\s*\],\s*physicalFrame=\[\s*(-?\d+),\s*(-?\d+),\s*(-?\d+),\s*(-?\d+)\s*\],\s*deviceSize=\[\s*(\d+),\s*(\d+)\s*\]/u.exec(output);
@@ -14470,6 +14484,12 @@ var SOFTWARE_DEVICE_LOSS = /TN_DEVICE_LOST|TN_WASM_DEVICE_LOST|WebGPU Device Los
14470
14484
  function isSoftwareDeviceLossEntry(entry) {
14471
14485
  return (entry.type === "error" || entry.type === "assert" || entry.type === "pageerror") && SOFTWARE_DEVICE_LOSS.test(entry.text);
14472
14486
  }
14487
+ function framesAfterBaseline(before, after) {
14488
+ if (after === void 0 || before === void 0) return after ?? before;
14489
+ const baseline = before.at(-1)?.sequence;
14490
+ if (baseline === void 0 || before === after) return after;
14491
+ return after.filter(({ sequence }) => sequence === void 0 || sequence > baseline);
14492
+ }
14473
14493
  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) {
14474
14494
  const movementSample = isAnonymousMovementScenario(scenario) ? observedMovementSample(movementSamples) : void 0;
14475
14495
  const entity = scenario.assert?.movement?.entity ?? scenario.subject ?? movementSample?.entity ?? "";
@@ -14490,7 +14510,7 @@ function buildReport(config, scenario, beforeSnapshot, afterSnapshot, consoleEnt
14490
14510
  }
14491
14511
  const movementDelta = beforePosition === void 0 || afterPosition === void 0 ? void 0 : subtract(afterPosition, beforePosition);
14492
14512
  const distance = movementDelta === void 0 ? 0 : length(movementDelta);
14493
- const performanceSeries = scenario.assert?.performance === void 0 && scenario.assert?.parity === void 0 ? void 0 : afterSnapshot?.runtimeDiagnosticsSeries ?? beforeSnapshot?.runtimeDiagnosticsSeries;
14513
+ const performanceSeries = scenario.assert?.performance === void 0 && scenario.assert?.parity === void 0 ? void 0 : framesAfterBaseline(beforeSnapshot?.runtimeDiagnosticsSeries, afterSnapshot?.runtimeDiagnosticsSeries);
14494
14514
  const softwareAdapter = capture?.rendererKind === "webgpu" ? softwareAdapterName(capture.adapter) : void 0;
14495
14515
  const softwareLane = config.allowSoftwareAdapter === true && softwareAdapter !== void 0;
14496
14516
  const deviceLossEntries = softwareLane ? consoleEntries.filter(isSoftwareDeviceLossEntry) : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threenative/playtest",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "license": "MIT",
5
5
  "description": "Scenario-driven playtest harness for Three.js games. Runs on plain Three.js with zero ThreeNative dependencies.",
6
6
  "keywords": [
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "playwright": ">=1.60.0 <2",
67
- "three": ">=0.185.0 <0.186.0"
67
+ "three": ">=0.187.0 <0.188.0"
68
68
  },
69
69
  "peerDependenciesMeta": {
70
70
  "playwright": {
@@ -76,10 +76,10 @@
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/pngjs": "6.0.5",
79
- "@types/three": "0.185.3",
79
+ "@types/three": "0.187.0",
80
80
  "playwright": "1.62.1",
81
81
  "publint": "0.3.22",
82
- "three": "0.185.1",
82
+ "three": "0.187.0",
83
83
  "tsup": "8.5.1",
84
84
  "typescript": "npm:@typescript/typescript6@6.0.2",
85
85
  "@typescript/native": "npm:typescript@7.0.2"