@threenative/playtest 0.3.3 → 0.3.4

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
@@ -242,7 +242,24 @@ function formatNumber(value) {
242
242
  return Number.isInteger(value) ? String(value) : value.toFixed(3);
243
243
  }
244
244
  function jsonEqual(left, right) {
245
- return JSON.stringify(left) === JSON.stringify(right);
245
+ return JSON.stringify(sortedKeys(left)) === JSON.stringify(sortedKeys(right));
246
+ }
247
+ function sortedKeys(value) {
248
+ if (Array.isArray(value)) {
249
+ return value.map(sortedKeys);
250
+ }
251
+ if (!isRecord(value)) {
252
+ return value;
253
+ }
254
+ const prototype = Object.getPrototypeOf(value);
255
+ if (prototype !== Object.prototype && prototype !== null) {
256
+ return value;
257
+ }
258
+ const sorted = {};
259
+ for (const key of Object.keys(value).sort()) {
260
+ sorted[key] = sortedKeys(value[key]);
261
+ }
262
+ return sorted;
246
263
  }
247
264
  function isRecord(value) {
248
265
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -823,7 +840,8 @@ var PLAYTEST_ASSERTION_REGISTRY = [
823
840
  { description: "Exact render-chain quality tier required after the chain applies.", name: "tier", type: "string" },
824
841
  { description: "Stage ids to include, exclude, or find as an ordered subsequence in the applied chain.", name: "stages", type: "object" },
825
842
  { description: "Applied stage ids whose build returned a different graph node than its input; this is graph evidence, not pixel attribution.", name: "contributions", type: "object" },
826
- { description: "Temporal history rejection ceiling as a fraction from 0 to 1.", name: "velocity", type: "object" }
843
+ { description: "Temporal history rejection ceiling as a fraction from 0 to 1.", name: "velocity", type: "object" },
844
+ { description: "What the chain must be on each adapter class the harness classified from its own adapter.info reading; an unclassifiable adapter fails rather than matching either branch.", name: "perAdapter", type: "object" }
827
845
  ],
828
846
  cardinality: "object",
829
847
  kind: "renderChain",
@@ -3767,34 +3785,65 @@ function emitWorldTopology(value, assertions, diagnostics) {
3767
3785
  }
3768
3786
  }
3769
3787
 
3788
+ // src/runner/browser.ts
3789
+ var SOFTWARE_ADAPTER = /swiftshader|llvmpipe|lavapipe|softwarerasterizer|software adapter|basic render/i;
3790
+ function softwareAdapterName(adapter) {
3791
+ if (adapter === void 0) return void 0;
3792
+ for (const value of Object.values(adapter)) {
3793
+ if (typeof value === "string" && SOFTWARE_ADAPTER.test(value)) return value;
3794
+ }
3795
+ return void 0;
3796
+ }
3797
+
3798
+ // src/evaluators/adapter-class.ts
3799
+ function classifyAdapter(report) {
3800
+ const capture = report.capture;
3801
+ if (capture === void 0 || capture.rendererKind !== "webgpu") return {};
3802
+ if (adapterIdentity(capture.adapter) === void 0) return {};
3803
+ const software = softwareAdapterName(capture.adapter);
3804
+ return software === void 0 ? { adapterClass: "hardware" } : { adapterClass: "software", softwareAdapter: software };
3805
+ }
3806
+ var ADAPTER_IDENTITY_KEYS = ["architecture", "description", "device", "vendor"];
3807
+ function adapterIdentity(adapter) {
3808
+ if (adapter === void 0) return void 0;
3809
+ for (const key of ADAPTER_IDENTITY_KEYS) {
3810
+ const value = adapter[key];
3811
+ if (typeof value === "string" && value.trim() !== "") return value;
3812
+ }
3813
+ return void 0;
3814
+ }
3815
+
3770
3816
  // src/evaluators/render-chain.ts
3771
3817
  function emitRenderChain(ctx) {
3772
3818
  const assertion = ctx.scenarioAssertions.renderChain;
3773
3819
  if (assertion === void 0) return;
3774
3820
  const observed = ctx.input.report.observations?.renderChain;
3775
- if (assertion.tier !== void 0) {
3776
- const pass = observed?.tier === assertion.tier;
3821
+ const selected = selectExpectation(ctx, assertion);
3822
+ const expected = selected.expectation;
3823
+ if (expected.tier !== void 0) {
3824
+ const pass = observed?.tier === expected.tier;
3777
3825
  ctx.assertions.push({
3778
- details: { expected: assertion.tier, observed: observed?.tier },
3826
+ details: { ...selected.provenance, expected: expected.tier, observed: observed?.tier },
3779
3827
  id: "renderChain.tier",
3780
3828
  pass
3781
3829
  });
3782
3830
  if (!pass) {
3783
3831
  ctx.diagnostics.push({
3784
3832
  code: observed === void 0 ? "TN_PLAYTEST_RENDER_CHAIN_UNOBSERVABLE" : "TN_PLAYTEST_RENDER_CHAIN_TIER_FAILED",
3785
- message: observed === void 0 ? "Render-chain tier was not observed because the TN_RENDER_CHAIN marker was absent." : `Render-chain tier '${observed.tier}' did not match the asserted tier '${assertion.tier}'.`,
3833
+ message: observed === void 0 ? "Render-chain tier was not observed because the TN_RENDER_CHAIN marker was absent." : `Render-chain tier '${observed.tier}' did not match the asserted tier '${expected.tier}'.`,
3786
3834
  observedRuntimePath: "observations.json/renderChain/tier",
3787
3835
  severity: "error",
3788
3836
  suggestion: "Install the RenderChain through the renderer seam and keep its marker callback connected to the playtest bridge."
3789
3837
  });
3790
3838
  }
3791
3839
  }
3792
- const stageAssertion = assertion.stages;
3840
+ const stageAssertion = expected.stages;
3793
3841
  if (stageAssertion !== void 0) {
3794
3842
  const observedStages = observed?.stages;
3795
3843
  if (stageAssertion.includes !== void 0) {
3796
3844
  emitStageCheck(
3797
3845
  ctx,
3846
+ selected.provenance,
3798
3847
  observedStages,
3799
3848
  "includes",
3800
3849
  stageAssertion.includes,
@@ -3804,6 +3853,7 @@ function emitRenderChain(ctx) {
3804
3853
  if (stageAssertion.excludes !== void 0) {
3805
3854
  emitStageCheck(
3806
3855
  ctx,
3856
+ selected.provenance,
3807
3857
  observedStages,
3808
3858
  "excludes",
3809
3859
  stageAssertion.excludes,
@@ -3813,6 +3863,7 @@ function emitRenderChain(ctx) {
3813
3863
  if (stageAssertion.order !== void 0) {
3814
3864
  emitStageCheck(
3815
3865
  ctx,
3866
+ selected.provenance,
3816
3867
  observedStages,
3817
3868
  "order",
3818
3869
  stageAssertion.order,
@@ -3820,7 +3871,7 @@ function emitRenderChain(ctx) {
3820
3871
  );
3821
3872
  }
3822
3873
  }
3823
- const contributionAssertion = assertion.contributions;
3874
+ const contributionAssertion = expected.contributions;
3824
3875
  if (contributionAssertion !== void 0) {
3825
3876
  const observedContributions = observed?.contributions;
3826
3877
  const pass = Array.isArray(observedContributions) && contributionAssertion.graphOutputChanged.every(
@@ -3828,6 +3879,7 @@ function emitRenderChain(ctx) {
3828
3879
  );
3829
3880
  ctx.assertions.push({
3830
3881
  details: {
3882
+ ...selected.provenance,
3831
3883
  expected: contributionAssertion.graphOutputChanged,
3832
3884
  observed: observedContributions
3833
3885
  },
@@ -3844,14 +3896,15 @@ function emitRenderChain(ctx) {
3844
3896
  });
3845
3897
  }
3846
3898
  }
3847
- if (assertion.velocity !== void 0) {
3899
+ if (expected.velocity !== void 0) {
3848
3900
  const rejectionFraction = observed?.velocity.rejectionFraction;
3849
3901
  const measurementFrame = observed?.velocity.measurementFrame;
3850
3902
  const hasMeasurement = rejectionFraction !== void 0 && Number.isFinite(rejectionFraction) && typeof measurementFrame === "number" && Number.isInteger(measurementFrame) && measurementFrame >= 0;
3851
- const pass = hasMeasurement && rejectionFraction !== void 0 && rejectionFraction <= assertion.velocity.maxRejectionFraction;
3903
+ const pass = hasMeasurement && rejectionFraction !== void 0 && rejectionFraction <= expected.velocity.maxRejectionFraction;
3852
3904
  ctx.assertions.push({
3853
3905
  details: {
3854
- expected: assertion.velocity.maxRejectionFraction,
3906
+ ...selected.provenance,
3907
+ expected: expected.velocity.maxRejectionFraction,
3855
3908
  measurementFrame,
3856
3909
  observed: rejectionFraction
3857
3910
  },
@@ -3861,17 +3914,47 @@ function emitRenderChain(ctx) {
3861
3914
  if (!pass) {
3862
3915
  ctx.diagnostics.push({
3863
3916
  code: observed === void 0 || !hasMeasurement ? "TN_PLAYTEST_RENDER_CHAIN_UNOBSERVABLE" : "TN_PLAYTEST_RENDER_CHAIN_REJECTION_FAILED",
3864
- message: observed === void 0 ? "Render-chain velocity rejection was not observed because the TN_RENDER_CHAIN marker was absent." : !hasMeasurement ? "Render-chain velocity was provisioned without a fresh completed-frame history-rejection measurement." : `Render-chain history rejection fraction ${rejectionFraction ?? "missing"} exceeded the asserted ceiling ${assertion.velocity.maxRejectionFraction}.`,
3917
+ message: observed === void 0 ? "Render-chain velocity rejection was not observed because the TN_RENDER_CHAIN marker was absent." : !hasMeasurement ? "Render-chain velocity was provisioned without a fresh completed-frame history-rejection measurement." : `Render-chain history rejection fraction ${rejectionFraction ?? "missing"} exceeded the asserted ceiling ${expected.velocity.maxRejectionFraction}.`,
3865
3918
  observedRuntimePath: "observations.json/renderChain/velocity/rejectionFraction",
3866
3919
  severity: "error",
3867
3920
  suggestion: "Publish the temporal stage's measured rejection fraction on the same render-chain marker used for tier reporting."
3868
3921
  });
3869
3922
  }
3870
3923
  }
3924
+ if (assertion.perAdapter !== void 0 && selected.classification === void 0) {
3925
+ ctx.assertions.push({
3926
+ details: { ...selected.provenance, expected: Object.keys(assertion.perAdapter) },
3927
+ id: "renderChain.adapterClass",
3928
+ pass: false
3929
+ });
3930
+ ctx.diagnostics.push({
3931
+ code: "TN_PLAYTEST_RENDER_CHAIN_ADAPTER_UNCLASSIFIED",
3932
+ message: "No adapter.info field named a software rasteriser, so this run is not proven to be either adapter class and was held to the flat render-chain expectation.",
3933
+ observedRuntimePath: "observations.json/capture/adapter",
3934
+ severity: "error",
3935
+ suggestion: "Run on a lane that reports adapter.info, or drop perAdapter and assert one policy for every adapter."
3936
+ });
3937
+ }
3938
+ }
3939
+ function selectExpectation(ctx, assertion) {
3940
+ const flat = {
3941
+ ...assertion.tier === void 0 ? {} : { tier: assertion.tier },
3942
+ ...assertion.stages === void 0 ? {} : { stages: assertion.stages },
3943
+ ...assertion.contributions === void 0 ? {} : { contributions: assertion.contributions },
3944
+ ...assertion.velocity === void 0 ? {} : { velocity: assertion.velocity }
3945
+ };
3946
+ const provenance = classifyAdapter(ctx.input.report);
3947
+ const { adapterClass } = provenance;
3948
+ const branch = adapterClass === void 0 ? void 0 : assertion.perAdapter?.[adapterClass];
3949
+ return {
3950
+ classification: adapterClass,
3951
+ expectation: branch ?? flat,
3952
+ provenance
3953
+ };
3871
3954
  }
3872
- function emitStageCheck(ctx, observed, kind, expected, pass) {
3955
+ function emitStageCheck(ctx, provenance, observed, kind, expected, pass) {
3873
3956
  ctx.assertions.push({
3874
- details: { expected, observed },
3957
+ details: { ...provenance, expected, observed },
3875
3958
  id: `renderChain.stages.${kind}`,
3876
3959
  pass
3877
3960
  });
@@ -4905,7 +4988,8 @@ var GENERATED_ASSERTION_FIELD_VALIDATORS = Object.freeze({
4905
4988
  "tier": (value) => typeof value === "string" && value.trim() !== "",
4906
4989
  "stages": (value) => isRecord2(value),
4907
4990
  "contributions": (value) => isRecord2(value),
4908
- "velocity": (value) => isRecord2(value)
4991
+ "velocity": (value) => isRecord2(value),
4992
+ "perAdapter": (value) => isRecord2(value)
4909
4993
  })
4910
4994
  });
4911
4995
 
@@ -5203,6 +5287,33 @@ function validateParityAssertion(value, scenarioPath, objectPath) {
5203
5287
  }
5204
5288
  function validateRenderChainAssertion(value, scenarioPath, objectPath) {
5205
5289
  const record4 = requireRecord(value, scenarioPath, objectPath);
5290
+ const perAdapter = record4.perAdapter === void 0 ? void 0 : validateRenderChainPerAdapter(record4.perAdapter, scenarioPath, `${objectPath}.perAdapter`);
5291
+ const expectation = validateRenderChainExpectation(record4, scenarioPath, objectPath);
5292
+ return perAdapter === void 0 ? expectation : { ...expectation, perAdapter };
5293
+ }
5294
+ function validateRenderChainPerAdapter(value, scenarioPath, objectPath) {
5295
+ const record4 = requireRecord(value, scenarioPath, objectPath);
5296
+ const entries = Object.entries(record4);
5297
+ if (entries.length === 0) {
5298
+ throw invalidScenario(scenarioPath, `'${objectPath}' must name at least one adapter class.`);
5299
+ }
5300
+ const result = {};
5301
+ for (const [kind, branch] of entries) {
5302
+ if (kind !== "hardware" && kind !== "software") {
5303
+ throw invalidScenario(
5304
+ scenarioPath,
5305
+ `'${objectPath}.${kind}' is not an adapter class this harness can classify; expected hardware or software.`
5306
+ );
5307
+ }
5308
+ result[kind] = validateRenderChainExpectation(
5309
+ requireRecord(branch, scenarioPath, `${objectPath}.${kind}`),
5310
+ scenarioPath,
5311
+ `${objectPath}.${kind}`
5312
+ );
5313
+ }
5314
+ return result;
5315
+ }
5316
+ function validateRenderChainExpectation(record4, scenarioPath, objectPath) {
5206
5317
  const tier = record4.tier;
5207
5318
  if (tier !== void 0 && tier !== "high" && tier !== "medium" && tier !== "low" && tier !== "off") {
5208
5319
  throw invalidScenario(scenarioPath, `'${objectPath}.tier' must be high, medium, low, or off, received ${describeValue(tier)}.`);
@@ -5765,29 +5876,30 @@ function validateNestedAssertionKeys(kind, value, scenarioPath, suffix) {
5765
5876
  `assert.${kind}${suffix}.runtime`
5766
5877
  );
5767
5878
  }
5768
- if (kind === "renderChain" && isRecord3(value.velocity)) {
5769
- rejectUnknownKeys(
5770
- value.velocity,
5771
- ["maxRejectionFraction"],
5772
- scenarioPath,
5773
- `assert.${kind}${suffix}.velocity`
5774
- );
5775
- }
5776
- if (kind === "renderChain" && isRecord3(value.contributions)) {
5777
- rejectUnknownKeys(
5778
- value.contributions,
5779
- ["graphOutputChanged"],
5780
- scenarioPath,
5781
- `assert.${kind}${suffix}.contributions`
5782
- );
5879
+ if (kind === "renderChain") {
5880
+ rejectRenderChainExpectationKeys(value, scenarioPath, `assert.${kind}${suffix}`);
5881
+ if (isRecord3(value.perAdapter)) {
5882
+ const branchPath = `assert.renderChain${suffix}.perAdapter`;
5883
+ rejectUnknownKeys(value.perAdapter, ["hardware", "software"], scenarioPath, branchPath);
5884
+ for (const [adapterKind, branch] of Object.entries(value.perAdapter)) {
5885
+ if (isRecord3(branch)) {
5886
+ rejectUnknownKeys(branch, ["contributions", "stages", "tier", "velocity"], scenarioPath, `${branchPath}.${adapterKind}`);
5887
+ rejectRenderChainExpectationKeys(branch, scenarioPath, `${branchPath}.${adapterKind}`);
5888
+ }
5889
+ }
5890
+ }
5783
5891
  }
5784
- if (kind === "renderChain" && isRecord3(value.stages)) {
5785
- rejectUnknownKeys(
5786
- value.stages,
5787
- ["excludes", "includes", "order"],
5788
- scenarioPath,
5789
- `assert.${kind}${suffix}.stages`
5790
- );
5892
+ }
5893
+ var RENDER_CHAIN_NESTED_KEYS = {
5894
+ contributions: ["graphOutputChanged"],
5895
+ stages: ["excludes", "includes", "order"],
5896
+ velocity: ["maxRejectionFraction"]
5897
+ };
5898
+ function rejectRenderChainExpectationKeys(value, scenarioPath, objectPath) {
5899
+ for (const [field, keys] of Object.entries(RENDER_CHAIN_NESTED_KEYS)) {
5900
+ if (isRecord3(value[field])) {
5901
+ rejectUnknownKeys(value[field], keys, scenarioPath, `${objectPath}.${field}`);
5902
+ }
5791
5903
  }
5792
5904
  }
5793
5905
 
@@ -6088,6 +6200,7 @@ var PLAYTEST_STEP_KEYS = [
6088
6200
  "holdTicks",
6089
6201
  "kind",
6090
6202
  "label",
6203
+ "lifecycle",
6091
6204
  "overlayMessage",
6092
6205
  "pitch",
6093
6206
  "pointerPosition",
@@ -6124,6 +6237,7 @@ function validateStep(value, scenarioPath, index) {
6124
6237
  "holdFrames",
6125
6238
  "holdTicks",
6126
6239
  "kind",
6240
+ "lifecycle",
6127
6241
  "overlayMessage",
6128
6242
  "pitch",
6129
6243
  "pointerPosition",
@@ -6173,9 +6287,9 @@ function validateStep(value, scenarioPath, index) {
6173
6287
  const holdTicks = positiveInteger(value.holdTicks);
6174
6288
  const waitFrames = positiveInteger(value.waitFrames);
6175
6289
  const waitTicks = positiveInteger(value.waitTicks);
6176
- const kind = value.kind === "aimAt" ? "aimAt" : value.kind === "click" ? "click" : value.kind === "wait" ? "wait" : value.kind === "input" ? "input" : void 0;
6290
+ const kind = value.kind === "aimAt" ? "aimAt" : value.kind === "click" ? "click" : value.kind === "lifecycle" ? "lifecycle" : value.kind === "wait" ? "wait" : value.kind === "input" ? "input" : void 0;
6177
6291
  if (value.kind !== void 0 && kind === void 0) {
6178
- throw invalidStep(scenarioPath, `Scenario step ${index} kind must be 'aimAt', 'click', 'input', or 'wait'.`);
6292
+ throw invalidStep(scenarioPath, `Scenario step ${index} kind must be 'aimAt', 'click', 'input', 'lifecycle', or 'wait'.`);
6179
6293
  }
6180
6294
  const at = validateClickTarget(value.at, scenarioPath, index);
6181
6295
  const target = validateAimTarget(value.target, scenarioPath, index);
@@ -6189,6 +6303,10 @@ function validateStep(value, scenarioPath, index) {
6189
6303
  if (isRecord3(value.window)) {
6190
6304
  rejectUnknownKeys(value.window, ["height", "operation", "width"], scenarioPath, `steps[${index}].window`);
6191
6305
  }
6306
+ if (isRecord3(value.lifecycle)) {
6307
+ rejectUnknownKeys(value.lifecycle, ["operation", "rotation"], scenarioPath, `steps[${index}].lifecycle`);
6308
+ }
6309
+ const lifecycle = validateLifecycleStep(value.lifecycle, scenarioPath, index);
6192
6310
  if (kind !== "click" && (at !== void 0 || value.at !== void 0)) {
6193
6311
  throw invalidStep(scenarioPath, `Scenario step ${index} declares at, which belongs to kind 'click'.`);
6194
6312
  }
@@ -6255,8 +6373,38 @@ function validateStep(value, scenarioPath, index) {
6255
6373
  if (value.window !== void 0 && window === void 0) {
6256
6374
  throw invalidStep(scenarioPath, `Scenario step ${index} window must define minimize, restore, or resize with positive width and height.`);
6257
6375
  }
6258
- if (at === void 0 && press === void 0 && overlayMessage === void 0 && pointerPosition === void 0 && pointers === void 0 && wheel === void 0 && window === void 0 && waitFrames === void 0 && waitTicks === void 0 && target === void 0 && waitForResource === void 0) {
6259
- throw invalidStep(scenarioPath, `Scenario step ${index} must define click at, press, overlayMessage, pointerPosition, pointers, wheel, window, aimAt target, or waitFrames/waitTicks.`);
6376
+ if (value.lifecycle !== void 0 && lifecycle === void 0) {
6377
+ throw invalidStep(scenarioPath, `Scenario step ${index} lifecycle must define an operation of 'background', 'foreground', or 'rotate', and 'rotate' must name a rotation from 0 through 3.`);
6378
+ }
6379
+ if (kind !== "lifecycle" && value.lifecycle !== void 0) {
6380
+ throw invalidStep(scenarioPath, `Scenario step ${index} declares lifecycle, which belongs to kind 'lifecycle'.`);
6381
+ }
6382
+ if (kind === "lifecycle") {
6383
+ if (lifecycle === void 0) {
6384
+ throw invalidStep(scenarioPath, `Scenario step ${index} with kind 'lifecycle' must define lifecycle.operation.`);
6385
+ }
6386
+ for (const forbidden of [
6387
+ "holdFrames",
6388
+ "holdTicks",
6389
+ "label",
6390
+ "overlayMessage",
6391
+ "pointerPosition",
6392
+ "pointers",
6393
+ "press",
6394
+ "screenshot",
6395
+ "target",
6396
+ "waitFrames",
6397
+ "waitTicks",
6398
+ "wheel",
6399
+ "window"
6400
+ ]) {
6401
+ if (value[forbidden] !== void 0) {
6402
+ throw invalidStep(scenarioPath, `Scenario step ${index} with kind 'lifecycle' cannot define ${forbidden}; a lifecycle step is one device operation and nothing else.`);
6403
+ }
6404
+ }
6405
+ }
6406
+ if (at === void 0 && press === void 0 && overlayMessage === void 0 && pointerPosition === void 0 && pointers === void 0 && wheel === void 0 && window === void 0 && waitFrames === void 0 && waitTicks === void 0 && target === void 0 && waitForResource === void 0 && lifecycle === void 0) {
6407
+ throw invalidStep(scenarioPath, `Scenario step ${index} must define click at, press, overlayMessage, pointerPosition, pointers, wheel, window, aimAt target, lifecycle operation, or waitFrames/waitTicks.`);
6260
6408
  }
6261
6409
  if (value.holdFrames !== void 0 && holdFrames === void 0) {
6262
6410
  throw invalidStep(scenarioPath, `Scenario step ${index} holdFrames must be a positive integer.`);
@@ -6285,6 +6433,7 @@ function validateStep(value, scenarioPath, index) {
6285
6433
  ...holdTicks === void 0 ? {} : { holdTicks },
6286
6434
  ...typeof value.label === "string" ? { label: value.label } : {},
6287
6435
  ...at === void 0 ? {} : { at },
6436
+ ...lifecycle === void 0 ? {} : { lifecycle },
6288
6437
  ...overlayMessage === void 0 ? {} : { overlayMessage },
6289
6438
  ...pitch === void 0 ? {} : { pitch },
6290
6439
  ...pointerPosition === void 0 ? {} : { pointerPosition },
@@ -6301,6 +6450,22 @@ function validateStep(value, scenarioPath, index) {
6301
6450
  ...window === void 0 ? {} : { window }
6302
6451
  };
6303
6452
  }
6453
+ function validateLifecycleStep(value, scenarioPath, index) {
6454
+ if (!isRecord3(value)) return void 0;
6455
+ const rotation = value.rotation;
6456
+ const rotationValue = typeof rotation === "number" && Number.isInteger(rotation) && rotation >= 0 && rotation <= 3 ? rotation : void 0;
6457
+ if (value.operation === "rotate") {
6458
+ if (rotationValue === void 0) {
6459
+ throw invalidStep(scenarioPath, `Scenario step ${index} lifecycle.operation 'rotate' must name a rotation from 0 through 3.`);
6460
+ }
6461
+ return { operation: "rotate", rotation: rotationValue };
6462
+ }
6463
+ if (value.operation !== "background" && value.operation !== "foreground") return void 0;
6464
+ if (rotation !== void 0) {
6465
+ throw invalidStep(scenarioPath, `Scenario step ${index} lifecycle.operation '${value.operation}' cannot define rotation; only 'rotate' takes one.`);
6466
+ }
6467
+ return { operation: value.operation };
6468
+ }
6304
6469
  function validateResourceWait(value, scenarioPath, index) {
6305
6470
  const objectPath = `steps[${index}].waitForResource`;
6306
6471
  if (!isRecord3(value)) {
@@ -492,6 +492,13 @@ interface IPlaytestObservationSnapshot {
492
492
  snapshot: JsonValue;
493
493
  tick: number;
494
494
  }>;
495
+ /**
496
+ * Steps the physics simulation completed, counted by the plugin that owns it at its own
497
+ * `simulation.step`. Not the game loop's tick: a frame can render with no step, and a step can be
498
+ * refused. Only present when a physics plugin installed, which is what advertises
499
+ * `runtime.physics`.
500
+ */
501
+ physicsSteps?: number;
495
502
  performance?: IPlaytestPerformanceObservation;
496
503
  /** Bounded shader/pipeline creation capture supplied by the engine when diagnostics are enabled. */
497
504
  pipelineCensus?: JsonValue;
@@ -1,6 +1,6 @@
1
- import { I as IStandalonePlaytestConfig, a as IStandalonePlaytestReport } from '../shared-eFOF5bZO.js';
1
+ import { I as IStandalonePlaytestConfig, a as IStandalonePlaytestReport } from '../shared-CHIDDJpp.js';
2
+ import '../diagnostics-BXhYI2sc.js';
2
3
  import '../protocol.js';
3
- import '../diagnostics-Bpy15z5f.js';
4
4
 
5
5
  interface IRunnerDiagnostic {
6
6
  code: string;