@dreamboard-games/sdk 0.4.0-alpha.11 → 0.4.0-alpha.13
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/REFERENCE.md +444 -9
- package/dist/authoring/index.js +3 -3
- package/dist/authoring-compiler.js +4 -4
- package/dist/authoring-materialize-cli.js +4 -4
- package/dist/{chunk-THTFQZZ3.js → chunk-42HQLHVA.js} +3 -3
- package/dist/{chunk-RP6QDQGI.js → chunk-7JBPOJOF.js} +46 -1
- package/dist/chunk-7JBPOJOF.js.map +1 -0
- package/dist/{chunk-SACZWUA6.js → chunk-HIH6Y4FA.js} +86 -1224
- package/dist/{chunk-SACZWUA6.js.map → chunk-HIH6Y4FA.js.map} +1 -1
- package/dist/{chunk-RU3Z5J6V.js → chunk-KZFHTUI5.js} +4 -4
- package/dist/{chunk-HRWI2DIJ.js → chunk-MLFHVYF7.js} +2 -2
- package/dist/{chunk-3OY46H7D.js → chunk-OFIDC7DJ.js} +3 -3
- package/dist/{chunk-CP3BF3B2.js → chunk-THWT4V3Z.js} +2 -2
- package/dist/{chunk-CP3BF3B2.js.map → chunk-THWT4V3Z.js.map} +1 -1
- package/dist/{chunk-4IIY742N.js → chunk-UTSBXZAM.js} +2 -2
- package/dist/chunk-VWTKGIYF.js +90 -0
- package/dist/chunk-VWTKGIYF.js.map +1 -0
- package/dist/codegen.js +1 -1
- package/dist/{index-CRfZ21dM.d.ts → index-CR69MyWr.d.ts} +1 -1
- package/dist/index.js +2 -2
- package/dist/package-set.d.ts +2 -2
- package/dist/package-set.js +2 -2
- package/dist/reducer/advanced.js +7 -82
- package/dist/reducer/advanced.js.map +1 -1
- package/dist/reducer-contract.js +1 -1
- package/dist/reference-game-compiler.js +2 -2
- package/dist/reference-game-source-manifest-cli.js +2 -2
- package/dist/runtime/workspace-contract.d.ts +342 -10
- package/dist/runtime/workspace-contract.js +7 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +7 -3
- package/dist/runtime.js.map +1 -1
- package/dist/testing-runtime.js +2 -2
- package/dist/testing.d.ts +84 -20
- package/dist/testing.js +167 -23
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-RP6QDQGI.js.map +0 -1
- /package/dist/{chunk-THTFQZZ3.js.map → chunk-42HQLHVA.js.map} +0 -0
- /package/dist/{chunk-RU3Z5J6V.js.map → chunk-KZFHTUI5.js.map} +0 -0
- /package/dist/{chunk-HRWI2DIJ.js.map → chunk-MLFHVYF7.js.map} +0 -0
- /package/dist/{chunk-3OY46H7D.js.map → chunk-OFIDC7DJ.js.map} +0 -0
- /package/dist/{chunk-4IIY742N.js.map → chunk-UTSBXZAM.js.map} +0 -0
package/dist/testing.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { g as ScenarioIdentity, f as PerspectiveSelector, e as InspectScenarioRe
|
|
|
5
5
|
export { I as InspectAction, b as InspectInteraction, c as InspectInteractionInput, j as assertScenario, p as probeScenarioCommand, r as replayScenario } from './types-B-FI0jrx.js';
|
|
6
6
|
import { w as wire, a as ReducerBundleContract } from './index.d-C7Ztirg6.js';
|
|
7
7
|
import { R as RuntimeJson } from './runtime-json-CQ9QbLZ5.js';
|
|
8
|
-
import { B, y, z as z$1, v, E } from './protocol-Bcas2Xa8.js';
|
|
8
|
+
import { B, y, z as z$1, v, e, E } from './protocol-Bcas2Xa8.js';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { r as BrowserInteractionIntentRequest, l as BrowserInteractionEffectRequest } from './types-DJj5MJkl.js';
|
|
11
11
|
import { b as PluginTransport, P as PluginRuntimeClient } from './types-CR9yEmXt.js';
|
|
@@ -646,44 +646,106 @@ interface UIParityViewport {
|
|
|
646
646
|
readonly width: number;
|
|
647
647
|
readonly height: number;
|
|
648
648
|
}
|
|
649
|
-
interface
|
|
649
|
+
interface UIParityObservationEnvironment {
|
|
650
650
|
readonly project: string;
|
|
651
651
|
readonly viewport: UIParityViewport;
|
|
652
652
|
}
|
|
653
|
-
interface
|
|
653
|
+
interface UIParityDiagnostic {
|
|
654
654
|
readonly code: string;
|
|
655
655
|
readonly message: string;
|
|
656
656
|
}
|
|
657
|
-
interface
|
|
657
|
+
interface UIParityObservationCheckpoint {
|
|
658
658
|
readonly stepId: string;
|
|
659
659
|
readonly interactionKey?: string;
|
|
660
660
|
readonly interactionId?: string;
|
|
661
661
|
readonly actuatorId?: string;
|
|
662
662
|
readonly descriptorDigest?: string;
|
|
663
663
|
readonly draftDigest?: string;
|
|
664
|
-
readonly
|
|
665
|
-
readonly actionSetVersion: string;
|
|
666
|
-
readonly perspectivePlayerId: string | null;
|
|
664
|
+
readonly basis: e;
|
|
667
665
|
readonly projectionDigest: string;
|
|
668
666
|
readonly semanticDigest: string;
|
|
669
667
|
readonly submissionDigest?: string;
|
|
670
668
|
readonly screenshot?: string;
|
|
671
669
|
}
|
|
672
|
-
interface
|
|
670
|
+
interface UIParityObservationProvenance {
|
|
673
671
|
readonly kind: "fixture-expectation" | "source-workbench" | "packed-real-host";
|
|
674
672
|
readonly evidence?: string;
|
|
675
673
|
}
|
|
676
|
-
interface
|
|
677
|
-
readonly schemaVersion:
|
|
674
|
+
interface UIParityObservation {
|
|
675
|
+
readonly schemaVersion: 2;
|
|
678
676
|
readonly scenarioId: string;
|
|
679
677
|
readonly fixtureDigest: string;
|
|
680
678
|
readonly sdkCandidateDigest: string;
|
|
681
679
|
readonly pluginRuntimeProtocol: 4;
|
|
682
680
|
readonly browserInteractionProtocol: string;
|
|
683
|
-
readonly environment:
|
|
684
|
-
readonly provenance:
|
|
685
|
-
readonly checkpoints: readonly
|
|
686
|
-
readonly diagnostics: readonly
|
|
681
|
+
readonly environment: UIParityObservationEnvironment;
|
|
682
|
+
readonly provenance: UIParityObservationProvenance;
|
|
683
|
+
readonly checkpoints: readonly UIParityObservationCheckpoint[];
|
|
684
|
+
readonly diagnostics: readonly UIParityDiagnostic[];
|
|
685
|
+
}
|
|
686
|
+
interface UIParityArtifactReference {
|
|
687
|
+
readonly path: string;
|
|
688
|
+
readonly sha256: string;
|
|
689
|
+
}
|
|
690
|
+
interface UIParityRunScenario {
|
|
691
|
+
readonly id: string;
|
|
692
|
+
readonly fixture: UIParityArtifactReference;
|
|
693
|
+
readonly renderModule: UIParityArtifactReference;
|
|
694
|
+
readonly expectation: UIParityArtifactReference;
|
|
695
|
+
readonly source: UIParityArtifactReference;
|
|
696
|
+
}
|
|
697
|
+
interface UIParityRunInput {
|
|
698
|
+
readonly schemaVersion: 2;
|
|
699
|
+
readonly sdk: {
|
|
700
|
+
readonly tarball: UIParityArtifactReference;
|
|
701
|
+
};
|
|
702
|
+
readonly referenceBundle: UIParityArtifactReference;
|
|
703
|
+
readonly fixtureBundle: {
|
|
704
|
+
readonly index: UIParityArtifactReference;
|
|
705
|
+
readonly scenarios: readonly UIParityRunScenario[];
|
|
706
|
+
};
|
|
707
|
+
readonly project: string;
|
|
708
|
+
}
|
|
709
|
+
interface UIParityReceiptComparison {
|
|
710
|
+
readonly scenarioId: string;
|
|
711
|
+
readonly actual: string;
|
|
712
|
+
readonly comparison: string;
|
|
713
|
+
readonly evidence?: string;
|
|
714
|
+
}
|
|
715
|
+
interface UIParityRealHostReceipt {
|
|
716
|
+
readonly schemaVersion: 2;
|
|
717
|
+
readonly kind: "dreamboard-ui-real-host-parity";
|
|
718
|
+
readonly mode: "real-host-parity";
|
|
719
|
+
readonly result: "passed";
|
|
720
|
+
readonly realHostExecutor: true;
|
|
721
|
+
readonly input: UIParityArtifactReference;
|
|
722
|
+
readonly sdkTarballSha256: string;
|
|
723
|
+
readonly fixtureBundleSha256: string;
|
|
724
|
+
readonly scenarios: readonly {
|
|
725
|
+
readonly id: string;
|
|
726
|
+
readonly fixtureDigest: string;
|
|
727
|
+
}[];
|
|
728
|
+
readonly source: {
|
|
729
|
+
readonly result: "passed";
|
|
730
|
+
readonly comparisons: readonly UIParityReceiptComparison[];
|
|
731
|
+
};
|
|
732
|
+
readonly internal: {
|
|
733
|
+
readonly result: "passed";
|
|
734
|
+
readonly comparisons: ReadonlyArray<{
|
|
735
|
+
readonly scenarioId: string;
|
|
736
|
+
readonly actual: string;
|
|
737
|
+
readonly expectationComparison: string;
|
|
738
|
+
readonly sourceComparison: string;
|
|
739
|
+
}>;
|
|
740
|
+
};
|
|
741
|
+
readonly project: string;
|
|
742
|
+
readonly host: {
|
|
743
|
+
readonly route: string;
|
|
744
|
+
readonly pluginIframe: true;
|
|
745
|
+
readonly pluginSessionGateway: true;
|
|
746
|
+
readonly playwright: "chromium";
|
|
747
|
+
readonly webLogPath: string;
|
|
748
|
+
};
|
|
687
749
|
}
|
|
688
750
|
type UIParityFailureCode = "candidate-mismatch" | "fixture-source-mismatch" | "protocol-mismatch" | "interaction-resolution-mismatch" | "preparation-mismatch" | "draft-mismatch" | "submission-mismatch" | "projection-mismatch" | "semantic-snapshot-mismatch" | "visual-mismatch" | "host-setup-failure";
|
|
689
751
|
interface UIParityComparisonFailure {
|
|
@@ -704,14 +766,16 @@ type UIParityComparisonResult = {
|
|
|
704
766
|
interface CreateUIParityObservationFromFixtureOptions {
|
|
705
767
|
readonly fixture: UIScenarioFixture;
|
|
706
768
|
readonly sdkCandidateDigest: string;
|
|
707
|
-
readonly environment:
|
|
769
|
+
readonly environment: UIParityObservationEnvironment;
|
|
708
770
|
readonly fixtureDigest?: string;
|
|
709
771
|
readonly screenshotsByStepId?: Readonly<Record<string, string>>;
|
|
710
|
-
readonly diagnostics?: readonly
|
|
772
|
+
readonly diagnostics?: readonly UIParityDiagnostic[];
|
|
711
773
|
}
|
|
712
|
-
declare function createUIParityObservationFromFixture({ fixture, sdkCandidateDigest, environment, fixtureDigest, screenshotsByStepId, diagnostics, }: CreateUIParityObservationFromFixtureOptions):
|
|
713
|
-
declare function
|
|
714
|
-
declare function compareUIParityObservations(expected:
|
|
774
|
+
declare function createUIParityObservationFromFixture({ fixture, sdkCandidateDigest, environment, fixtureDigest, screenshotsByStepId, diagnostics, }: CreateUIParityObservationFromFixtureOptions): UIParityObservation;
|
|
775
|
+
declare function parseUIParityObservation(value: unknown): UIParityObservation;
|
|
776
|
+
declare function compareUIParityObservations(expected: UIParityObservation, actual: UIParityObservation): UIParityComparisonResult;
|
|
777
|
+
declare function parseUIParityRunInput(value: unknown): UIParityRunInput;
|
|
778
|
+
declare function parseUIParityRealHostReceipt(value: unknown): UIParityRealHostReceipt;
|
|
715
779
|
|
|
716
780
|
interface FixtureHostEvent {
|
|
717
781
|
readonly sequence: number;
|
|
@@ -811,4 +875,4 @@ declare function drag(options: DragReplayStepOptions): UIScenarioReplayStep;
|
|
|
811
875
|
declare function submit(options: ReplayStepOptions): UIScenarioReplayStep;
|
|
812
876
|
declare function assertStep(stepId: string, expect: UIStepExpectation): UIScenarioReplayStep;
|
|
813
877
|
|
|
814
|
-
export { ActorRef, type CompilePluginProtocolTapeOptions, type CompileUIScenarioFixtureOptions, type CreateFixtureHostHarnessOptions, type CreateReducerScenarioRunnerOptions, type DeterministicIdFactory, ExpectFn, type ExploreScenarioOptions, type ExploreScenarioResult, type ExploreSeedResult, type ExploreTransitionResult, type FixtureEnvironmentInit, type FixtureHostEvent, type FixtureHostHarness, FixturePluginRuntime, FlowDiagnostic, InspectEntropy, InspectNode, type InspectScenarioOptions, InspectScenarioResult, PerspectiveRef, PerspectiveSelector, type PluginProtocolTape, type PortableSemanticReplayStep, type ProtocolUIScenarioAuthority, type ReducerScenarioBundle, type ReducerScenarioDiagnostic, type ReducerScenarioExchange, type ReducerScenarioFrame, type ReducerScenarioOperation, type ReducerScenarioRunner, type ReducerScenarioTrace, type ReducerScenarioViewer, type ReducerUIScenarioAuthority, ScenarioAssertionError, ScenarioCheckpoint, ScenarioCommand, ScenarioDispatchTraceEntry, ScenarioIdentity, ScenarioReplayDefinition, Sha256Digest, SnapshotMatcherHandler, type UIFixtureFrame, type UIFixtureProtocolStep, type UIReplayExecution, type UIReplayIdentityCandidate, type UIReplayRequest, type UIResolvedReplayIdentity, type UIScenarioAuthority, type UIScenarioAuthorityKind, type UIScenarioDefinition, type UIScenarioEnvironmentDefinition, type UIScenarioFixture, type UIScenarioFixtureBundleIndex, type UIScenarioReplayStep, type UIStepExpectation, UI_SCENARIO_FIXTURE_BUNDLE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_PLUGIN_RUNTIME_PROTOCOL, UI_SCENARIO_FIXTURE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_SUPPORTED_BROWSER_PROTOCOL_MAJOR, activate, assertDeterministicUIScenarioFixture, assertStep, assertSupportedBrowserInteractionProtocol, assertUIStepExpectationSatisfied, assertUniqueReplayIdentity, canonicalUIFixtureJson, canonicalizeUIFixtureJson, canonicalizeUIScenarioFixture, compareUIParityObservations, compilePluginProtocolTape, compileUIScenarioFixture, createDeterministicIdFactory, createExpectApi, createFixtureHostHarness, createReducerScenarioRunner, createUIParityObservationFromFixture, defaultFixtureEnvironmentInit, defineUIScenario, digestPluginProtocolTape, digestUIFixtureJson, digestUIFixtureRequest, digestUIFixtureTransportRequest, digestUIScenarioFixture, drag, exploreScenario, fill, fixtureEnvironmentInitFor, inspectScenario, isSha256Digest,
|
|
878
|
+
export { ActorRef, type CompilePluginProtocolTapeOptions, type CompileUIScenarioFixtureOptions, type CreateFixtureHostHarnessOptions, type CreateReducerScenarioRunnerOptions, type CreateUIParityObservationFromFixtureOptions, type DeterministicIdFactory, ExpectFn, type ExploreScenarioOptions, type ExploreScenarioResult, type ExploreSeedResult, type ExploreTransitionResult, type FixtureEnvironmentInit, type FixtureHostEvent, type FixtureHostHarness, FixturePluginRuntime, FlowDiagnostic, InspectEntropy, InspectNode, type InspectScenarioOptions, InspectScenarioResult, PerspectiveRef, PerspectiveSelector, type PluginProtocolTape, type PortableSemanticReplayStep, type ProtocolUIScenarioAuthority, type ReducerScenarioBundle, type ReducerScenarioDiagnostic, type ReducerScenarioExchange, type ReducerScenarioFrame, type ReducerScenarioOperation, type ReducerScenarioRunner, type ReducerScenarioTrace, type ReducerScenarioViewer, type ReducerUIScenarioAuthority, ScenarioAssertionError, ScenarioCheckpoint, ScenarioCommand, ScenarioDispatchTraceEntry, ScenarioIdentity, ScenarioReplayDefinition, Sha256Digest, SnapshotMatcherHandler, type UIFixtureFrame, type UIFixtureProtocolStep, type UIParityArtifactReference, type UIParityComparisonFailure, type UIParityComparisonResult, type UIParityDiagnostic, type UIParityFailureCode, type UIParityObservation, type UIParityObservationCheckpoint, type UIParityObservationEnvironment, type UIParityObservationProvenance, type UIParityRealHostReceipt, type UIParityReceiptComparison, type UIParityRunInput, type UIParityRunScenario, type UIParityViewport, type UIReplayExecution, type UIReplayIdentityCandidate, type UIReplayRequest, type UIResolvedReplayIdentity, type UIScenarioAuthority, type UIScenarioAuthorityKind, type UIScenarioDefinition, type UIScenarioEnvironmentDefinition, type UIScenarioFixture, type UIScenarioFixtureBundleIndex, type UIScenarioReplayStep, type UIStepExpectation, UI_SCENARIO_FIXTURE_BUNDLE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_PLUGIN_RUNTIME_PROTOCOL, UI_SCENARIO_FIXTURE_SCHEMA_VERSION, UI_SCENARIO_FIXTURE_SUPPORTED_BROWSER_PROTOCOL_MAJOR, activate, assertDeterministicUIScenarioFixture, assertStep, assertSupportedBrowserInteractionProtocol, assertUIStepExpectationSatisfied, assertUniqueReplayIdentity, canonicalUIFixtureJson, canonicalizeUIFixtureJson, canonicalizeUIScenarioFixture, compareUIParityObservations, compilePluginProtocolTape, compileUIScenarioFixture, createDeterministicIdFactory, createExpectApi, createFixtureHostHarness, createReducerScenarioRunner, createUIParityObservationFromFixture, defaultFixtureEnvironmentInit, defineUIScenario, digestPluginProtocolTape, digestUIFixtureJson, digestUIFixtureRequest, digestUIFixtureTransportRequest, digestUIScenarioFixture, drag, exploreScenario, fill, fixtureEnvironmentInitFor, inspectScenario, isSha256Digest, parseUIParityObservation, parseUIParityRealHostReceipt, parseUIParityRunInput, parseUIScenarioFixture, parseUIScenarioFixtureBundleIndex, pluginProtocolTapeSchema, portableSemanticReplayStepSchema, press, serializeUIScenarioFixture, submit, uiFixtureFrameSchema, uiFixtureProtocolStepSchema, uiReplayExecutionSchema, uiReplayRequestSchema, uiResolvedReplayIdentitySchema, uiScenarioFixtureBundleIndexSchema, uiScenarioFixtureSchema, uiScenarioReplayStepSchema, uiStepExpectationSchema };
|
package/dist/testing.js
CHANGED
|
@@ -20,12 +20,12 @@ import {
|
|
|
20
20
|
replayScenario,
|
|
21
21
|
resolveScenarioCheckpoint,
|
|
22
22
|
toScenarioReplayDefinition
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-5XTAQ4EQ.js";
|
|
23
|
+
} from "./chunk-KZFHTUI5.js";
|
|
25
24
|
import {
|
|
26
25
|
StaleContractArtifactError,
|
|
27
26
|
isStaleContractArtifactError
|
|
28
27
|
} from "./chunk-XDGRC6OR.js";
|
|
28
|
+
import "./chunk-5XTAQ4EQ.js";
|
|
29
29
|
import "./chunk-YNW3KBDE.js";
|
|
30
30
|
import {
|
|
31
31
|
BROWSER_INTERACTION_ACTUATOR_KINDS,
|
|
@@ -872,9 +872,10 @@ var checkpointComparisons = [
|
|
|
872
872
|
{ path: "interactionId", code: "interaction-resolution-mismatch" },
|
|
873
873
|
{ path: "actuatorId", code: "interaction-resolution-mismatch" },
|
|
874
874
|
{ path: "descriptorDigest", code: "interaction-resolution-mismatch" },
|
|
875
|
-
{ path: "
|
|
876
|
-
{ path: "
|
|
877
|
-
{ path: "
|
|
875
|
+
{ path: "basis.generation", code: "projection-mismatch" },
|
|
876
|
+
{ path: "basis.version", code: "projection-mismatch" },
|
|
877
|
+
{ path: "basis.actionSetVersion", code: "projection-mismatch" },
|
|
878
|
+
{ path: "basis.perspectivePlayerId", code: "projection-mismatch" },
|
|
878
879
|
{ path: "projectionDigest", code: "projection-mismatch" },
|
|
879
880
|
{ path: "semanticDigest", code: "semantic-snapshot-mismatch" },
|
|
880
881
|
{ path: "draftDigest", code: "draft-mismatch" },
|
|
@@ -923,9 +924,7 @@ function createUIParityObservationFromFixture({
|
|
|
923
924
|
actuatorId: identity?.actuatorId,
|
|
924
925
|
descriptorDigest: identity?.descriptorDigest,
|
|
925
926
|
draftDigest: step.expect.draftDigest ?? identity?.draftDigest,
|
|
926
|
-
|
|
927
|
-
actionSetVersion: frame.frame.basis.actionSetVersion,
|
|
928
|
-
perspectivePlayerId: frame.frame.basis.perspectivePlayerId,
|
|
927
|
+
basis: frame.frame.basis,
|
|
929
928
|
projectionDigest,
|
|
930
929
|
semanticDigest,
|
|
931
930
|
submissionDigest,
|
|
@@ -933,7 +932,7 @@ function createUIParityObservationFromFixture({
|
|
|
933
932
|
};
|
|
934
933
|
});
|
|
935
934
|
return {
|
|
936
|
-
schemaVersion:
|
|
935
|
+
schemaVersion: 2,
|
|
937
936
|
scenarioId: fixture.id,
|
|
938
937
|
fixtureDigest,
|
|
939
938
|
sdkCandidateDigest,
|
|
@@ -947,10 +946,10 @@ function createUIParityObservationFromFixture({
|
|
|
947
946
|
diagnostics
|
|
948
947
|
};
|
|
949
948
|
}
|
|
950
|
-
function
|
|
949
|
+
function parseUIParityObservation(value) {
|
|
951
950
|
const observation = assertRecord(value, "observation");
|
|
952
|
-
if (observation.schemaVersion !==
|
|
953
|
-
throw new Error("UI parity observation schemaVersion must be
|
|
951
|
+
if (observation.schemaVersion !== 2) {
|
|
952
|
+
throw new Error("UI parity observation schemaVersion must be 2.");
|
|
954
953
|
}
|
|
955
954
|
assertString(observation.scenarioId, "scenarioId");
|
|
956
955
|
assertString(observation.fixtureDigest, "fixtureDigest");
|
|
@@ -977,6 +976,9 @@ function parseUIParityObservationV1(value) {
|
|
|
977
976
|
);
|
|
978
977
|
}
|
|
979
978
|
assertOptionalString(provenance.evidence, "observation.provenance.evidence");
|
|
979
|
+
if (typeof provenance.evidence === "string") {
|
|
980
|
+
assertPortablePath(provenance.evidence, "observation.provenance.evidence");
|
|
981
|
+
}
|
|
980
982
|
const checkpoints = assertArray(observation.checkpoints, "checkpoints");
|
|
981
983
|
for (let index = 0; index < checkpoints.length; index += 1) {
|
|
982
984
|
const checkpoint = assertRecord(
|
|
@@ -1004,16 +1006,7 @@ function parseUIParityObservationV1(value) {
|
|
|
1004
1006
|
checkpoint.draftDigest,
|
|
1005
1007
|
`checkpoints[${index}].draftDigest`
|
|
1006
1008
|
);
|
|
1007
|
-
|
|
1008
|
-
assertString(
|
|
1009
|
-
checkpoint.actionSetVersion,
|
|
1010
|
-
`checkpoints[${index}].actionSetVersion`
|
|
1011
|
-
);
|
|
1012
|
-
if (checkpoint.perspectivePlayerId !== null && typeof checkpoint.perspectivePlayerId !== "string") {
|
|
1013
|
-
throw new Error(
|
|
1014
|
-
`checkpoints[${index}].perspectivePlayerId must be a string or null.`
|
|
1015
|
-
);
|
|
1016
|
-
}
|
|
1009
|
+
parseGameplayBasis(checkpoint.basis, `checkpoints[${index}].basis`);
|
|
1017
1010
|
assertString(
|
|
1018
1011
|
checkpoint.projectionDigest,
|
|
1019
1012
|
`checkpoints[${index}].projectionDigest`
|
|
@@ -1086,6 +1079,86 @@ function compareUIParityObservations(expected, actual) {
|
|
|
1086
1079
|
}
|
|
1087
1080
|
return { ok: true };
|
|
1088
1081
|
}
|
|
1082
|
+
function parseUIParityRunInput(value) {
|
|
1083
|
+
const input = assertRecord(value, "input");
|
|
1084
|
+
if (input.schemaVersion !== 2) {
|
|
1085
|
+
throw new Error("UI parity run input schemaVersion must be 2.");
|
|
1086
|
+
}
|
|
1087
|
+
const sdk = assertRecord(input.sdk, "input.sdk");
|
|
1088
|
+
parseArtifactReference(sdk.tarball, "input.sdk.tarball");
|
|
1089
|
+
parseArtifactReference(input.referenceBundle, "input.referenceBundle");
|
|
1090
|
+
const fixtureBundle = assertRecord(
|
|
1091
|
+
input.fixtureBundle,
|
|
1092
|
+
"input.fixtureBundle"
|
|
1093
|
+
);
|
|
1094
|
+
parseArtifactReference(fixtureBundle.index, "input.fixtureBundle.index");
|
|
1095
|
+
const scenarios = assertArray(
|
|
1096
|
+
fixtureBundle.scenarios,
|
|
1097
|
+
"input.fixtureBundle.scenarios"
|
|
1098
|
+
);
|
|
1099
|
+
if (scenarios.length === 0) {
|
|
1100
|
+
throw new Error("input.fixtureBundle.scenarios must not be empty.");
|
|
1101
|
+
}
|
|
1102
|
+
const ids = /* @__PURE__ */ new Set();
|
|
1103
|
+
for (let index = 0; index < scenarios.length; index += 1) {
|
|
1104
|
+
const path = `input.fixtureBundle.scenarios[${index}]`;
|
|
1105
|
+
const scenario = assertRecord(scenarios[index], path);
|
|
1106
|
+
assertString(scenario.id, `${path}.id`);
|
|
1107
|
+
const id = scenario.id;
|
|
1108
|
+
if (ids.has(id)) {
|
|
1109
|
+
throw new Error(`${path}.id duplicates scenario '${id}'.`);
|
|
1110
|
+
}
|
|
1111
|
+
ids.add(id);
|
|
1112
|
+
parseArtifactReference(scenario.fixture, `${path}.fixture`);
|
|
1113
|
+
parseArtifactReference(scenario.renderModule, `${path}.renderModule`);
|
|
1114
|
+
parseArtifactReference(scenario.expectation, `${path}.expectation`);
|
|
1115
|
+
parseArtifactReference(scenario.source, `${path}.source`);
|
|
1116
|
+
}
|
|
1117
|
+
assertString(input.project, "input.project");
|
|
1118
|
+
return input;
|
|
1119
|
+
}
|
|
1120
|
+
function parseUIParityRealHostReceipt(value) {
|
|
1121
|
+
const receipt = assertRecord(value, "receipt");
|
|
1122
|
+
if (receipt.schemaVersion !== 2) {
|
|
1123
|
+
throw new Error("UI parity real-host receipt schemaVersion must be 2.");
|
|
1124
|
+
}
|
|
1125
|
+
if (receipt.kind !== "dreamboard-ui-real-host-parity" || receipt.mode !== "real-host-parity" || receipt.result !== "passed" || receipt.realHostExecutor !== true) {
|
|
1126
|
+
throw new Error(
|
|
1127
|
+
"UI parity real-host receipt must be a passing real-host proof."
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
parseArtifactReference(receipt.input, "receipt.input");
|
|
1131
|
+
assertString(receipt.sdkTarballSha256, "receipt.sdkTarballSha256");
|
|
1132
|
+
assertString(receipt.fixtureBundleSha256, "receipt.fixtureBundleSha256");
|
|
1133
|
+
assertString(receipt.project, "receipt.project");
|
|
1134
|
+
const scenarios = assertArray(receipt.scenarios, "receipt.scenarios");
|
|
1135
|
+
if (scenarios.length === 0) {
|
|
1136
|
+
throw new Error("receipt.scenarios must not be empty.");
|
|
1137
|
+
}
|
|
1138
|
+
for (let index = 0; index < scenarios.length; index += 1) {
|
|
1139
|
+
const scenario = assertRecord(
|
|
1140
|
+
scenarios[index],
|
|
1141
|
+
`receipt.scenarios[${index}]`
|
|
1142
|
+
);
|
|
1143
|
+
assertString(scenario.id, `receipt.scenarios[${index}].id`);
|
|
1144
|
+
assertString(
|
|
1145
|
+
scenario.fixtureDigest,
|
|
1146
|
+
`receipt.scenarios[${index}].fixtureDigest`
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1149
|
+
parseReceiptComparisonGroup(receipt.source, "receipt.source", false);
|
|
1150
|
+
parseReceiptComparisonGroup(receipt.internal, "receipt.internal", true);
|
|
1151
|
+
const host = assertRecord(receipt.host, "receipt.host");
|
|
1152
|
+
assertString(host.route, "receipt.host.route");
|
|
1153
|
+
assertString(host.webLogPath, "receipt.host.webLogPath");
|
|
1154
|
+
assertPortablePath(host.webLogPath, "receipt.host.webLogPath");
|
|
1155
|
+
if (host.pluginIframe !== true || host.pluginSessionGateway !== true || host.playwright !== "chromium") {
|
|
1156
|
+
throw new Error(
|
|
1157
|
+
"receipt.host must prove PluginIframe, PluginSessionGateway, and Chromium."
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
return receipt;
|
|
1161
|
+
}
|
|
1089
1162
|
function comparePath(expected, actual, comparison, options = {}) {
|
|
1090
1163
|
const expectedValue = getPath(expected, comparison.path);
|
|
1091
1164
|
const actualValue = getPath(actual, comparison.path);
|
|
@@ -1125,6 +1198,70 @@ function getPath(value, path) {
|
|
|
1125
1198
|
return current[key];
|
|
1126
1199
|
}, value);
|
|
1127
1200
|
}
|
|
1201
|
+
function parseGameplayBasis(value, path) {
|
|
1202
|
+
const basis = assertRecord(value, path);
|
|
1203
|
+
assertNonNegativeInteger(basis.generation, `${path}.generation`);
|
|
1204
|
+
assertNonNegativeInteger(basis.version, `${path}.version`);
|
|
1205
|
+
assertString(basis.actionSetVersion, `${path}.actionSetVersion`);
|
|
1206
|
+
assertString(basis.perspectivePlayerId, `${path}.perspectivePlayerId`);
|
|
1207
|
+
return basis;
|
|
1208
|
+
}
|
|
1209
|
+
function parseArtifactReference(value, path) {
|
|
1210
|
+
const reference = assertRecord(value, path);
|
|
1211
|
+
assertString(reference.path, `${path}.path`);
|
|
1212
|
+
assertPortablePath(reference.path, `${path}.path`);
|
|
1213
|
+
assertString(reference.sha256, `${path}.sha256`);
|
|
1214
|
+
if (!reference.sha256.startsWith("sha256:")) {
|
|
1215
|
+
throw new Error(`${path}.sha256 must be a sha256 digest.`);
|
|
1216
|
+
}
|
|
1217
|
+
return reference;
|
|
1218
|
+
}
|
|
1219
|
+
function parseReceiptComparisonGroup(value, path, internal) {
|
|
1220
|
+
const group = assertRecord(value, path);
|
|
1221
|
+
if (group.result !== "passed") {
|
|
1222
|
+
throw new Error(`${path}.result must be passed.`);
|
|
1223
|
+
}
|
|
1224
|
+
const comparisons = assertArray(group.comparisons, `${path}.comparisons`);
|
|
1225
|
+
for (let index = 0; index < comparisons.length; index += 1) {
|
|
1226
|
+
const itemPath = `${path}.comparisons[${index}]`;
|
|
1227
|
+
const comparison = assertRecord(comparisons[index], itemPath);
|
|
1228
|
+
assertString(comparison.scenarioId, `${itemPath}.scenarioId`);
|
|
1229
|
+
assertString(comparison.actual, `${itemPath}.actual`);
|
|
1230
|
+
assertPortablePath(comparison.actual, `${itemPath}.actual`);
|
|
1231
|
+
if (internal) {
|
|
1232
|
+
assertString(
|
|
1233
|
+
comparison.expectationComparison,
|
|
1234
|
+
`${itemPath}.expectationComparison`
|
|
1235
|
+
);
|
|
1236
|
+
assertString(comparison.sourceComparison, `${itemPath}.sourceComparison`);
|
|
1237
|
+
assertPortablePath(
|
|
1238
|
+
comparison.expectationComparison,
|
|
1239
|
+
`${itemPath}.expectationComparison`
|
|
1240
|
+
);
|
|
1241
|
+
assertPortablePath(
|
|
1242
|
+
comparison.sourceComparison,
|
|
1243
|
+
`${itemPath}.sourceComparison`
|
|
1244
|
+
);
|
|
1245
|
+
} else {
|
|
1246
|
+
assertString(comparison.comparison, `${itemPath}.comparison`);
|
|
1247
|
+
assertOptionalString(comparison.evidence, `${itemPath}.evidence`);
|
|
1248
|
+
assertPortablePath(
|
|
1249
|
+
comparison.comparison,
|
|
1250
|
+
`${itemPath}.comparison`
|
|
1251
|
+
);
|
|
1252
|
+
if (typeof comparison.evidence === "string") {
|
|
1253
|
+
assertPortablePath(comparison.evidence, `${itemPath}.evidence`);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
function assertPortablePath(value, path) {
|
|
1259
|
+
if (value.length === 0 || value.startsWith("/") || value.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(value) || value.split(/[\\/]+/).includes("..")) {
|
|
1260
|
+
throw new Error(
|
|
1261
|
+
`${path} must be a relative path within its portable bundle.`
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1128
1265
|
function assertRecord(value, path) {
|
|
1129
1266
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1130
1267
|
throw new Error(`${path} must be an object.`);
|
|
@@ -1152,6 +1289,11 @@ function assertNumber(value, path) {
|
|
|
1152
1289
|
throw new Error(`${path} must be a finite number.`);
|
|
1153
1290
|
}
|
|
1154
1291
|
}
|
|
1292
|
+
function assertNonNegativeInteger(value, path) {
|
|
1293
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
1294
|
+
throw new Error(`${path} must be a non-negative integer.`);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1155
1297
|
|
|
1156
1298
|
// src/testing/ui-fixture/create-fixture-host-harness.ts
|
|
1157
1299
|
var DEFAULT_CHANNEL_ID = "fixture-channel";
|
|
@@ -1976,7 +2118,9 @@ export {
|
|
|
1976
2118
|
inspectScenario,
|
|
1977
2119
|
isSha256Digest,
|
|
1978
2120
|
isStaleContractArtifactError,
|
|
1979
|
-
|
|
2121
|
+
parseUIParityObservation,
|
|
2122
|
+
parseUIParityRealHostReceipt,
|
|
2123
|
+
parseUIParityRunInput,
|
|
1980
2124
|
parseUIScenarioFixture,
|
|
1981
2125
|
parseUIScenarioFixtureBundleIndex,
|
|
1982
2126
|
pluginProtocolTapeSchema,
|