A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
test(sdk): the test corpus is inside a type checker, on a ratchet
yhheb57953eb327
diff --git a/sdk/tests/README.md b/sdk/tests/README.mdindex e9cc8a83e..84679f0ba 100644--- a/sdk/tests/README.md+++ b/sdk/tests/README.md@@ -1,5 +1,22 @@# Estella SDK Tests+## Types++vitest strips types and never checks them, and `tsconfig.json` compiles `src/`+only — so a fixture can go stale against the API it tests and stay green. One+did: literal schemas missing a field the handshake had gained, passing because+both sides read `undefined`.++```bash+node tools/check-sdk-test-types.mjs # check (a gate runs this)+node tools/check-sdk-test-types.mjs --update # bank debt you paid off+```++It is a ratchet over `tools/baselines/sdk-test-types.json`, not a demand for+zero: no new diagnostics, and fixed ones must be banked so they cannot return.+The networking suites (`net-*`, `replication*`, `websocket`) carry **no** debt+and `--update` refuses to add any.+## Running Tests```bashdiff --git a/sdk/tests/net-binary.test.ts b/sdk/tests/net-binary.test.tsindex 32af6225d..b53cd2345 100644--- a/sdk/tests/net-binary.test.ts+++ b/sdk/tests/net-binary.test.ts@@ -104,7 +104,7 @@ describe('createSocket platform seam', () => {const urls: string[] = [];setPlatform({name: 'web',- createSocket: (o) => { urls.push(o.url); return marker; },+ createSocket: (o: { url: string }) => { urls.push(o.url); return marker; },} as unknown as PlatformAdapter);expect(createSocket({ url: 'wss://x' })).toBe(marker);expect(urls).toEqual(['wss://x']);diff --git a/sdk/tests/replication-interest.test.ts b/sdk/tests/replication-interest.test.tsindex 939886e09..9f39b2295 100644--- a/sdk/tests/replication-interest.test.ts+++ b/sdk/tests/replication-interest.test.ts@@ -84,13 +84,13 @@ describe('interest management (radius policy)', () => {expect(ghostNames(clientApp)).toEqual(['near', 'pawn']);// `near` wanders out of range → its ghost despawns.- serverApp.world.set(near, NetPos, { x: 400, y: 0 });+ serverApp.world.set(near, NetPos, { x: 400, y: 0, z: 0 });await step(serverApp, clientApp);expect(ghostNames(clientApp)).toEqual(['pawn']);// `far` wanders in — while out of interest it also changed y; the// respawn must carry CURRENT state, not the state at first spawn.- serverApp.world.set(far, NetPos, { x: 80, y: 33 });+ serverApp.world.set(far, NetPos, { x: 80, y: 33, z: 0 });await step(serverApp, clientApp);expect(ghostNames(clientApp)).toEqual(['far', 'pawn']);const farGhost = client.netIds.entityOf(@@ -111,7 +111,7 @@ describe('interest management (radius policy)', () => {// Move the far entity (still out of range): no ghost may appear and// the client's netId table must not learn it.- serverApp.world.set(far, NetPos, { x: 510, y: 5 });+ serverApp.world.set(far, NetPos, { x: 510, y: 5, z: 0 });await step(serverApp, clientApp, 2);expect(ghostNames(clientApp)).toEqual(['pawn']);const farNetId = (serverApp.world.tryGet(far, Replicated) as { netId: number }).netId;diff --git a/sdk/tsconfig.tests.json b/sdk/tsconfig.tests.jsonnew file mode 100644index 000000000..413a3dd4d--- /dev/null+++ b/sdk/tsconfig.tests.json@@ -0,0 +1,12 @@+{+ "//": "The test corpus, type-checked. The production config compiles src/ and emits dist/, so tests have never been inside any checker — vitest strips types and never looks. This one only checks: same strictness, plus the environment tests actually run in (node + vitest globals), so 'the suite has no test-environment types' is not counted as project debt. Read by tools/check-sdk-test-types.mjs, not by any build.",+ "extends": "./tsconfig.json",+ "compilerOptions": {+ "noEmit": true,+ "declaration": false,+ "rootDir": "..",+ "lib": ["ES2022", "DOM"],+ "types": ["node", "vitest/globals"]+ },+ "include": ["src/**/*", "tests/**/*"]+}diff --git a/tools/baselines/sdk-test-types.json b/tools/baselines/sdk-test-types.jsonnew file mode 100644index 000000000..bf63cb125--- /dev/null+++ b/tools/baselines/sdk-test-types.json@@ -0,0 +1,324 @@+{+ "tests/ai-enemy-integration.test.ts": {+ "TS2345|Argument of type '{ position: { x: number; y: number; z: number; }; }' is not assignable to parameter of type 'TransformData'.": 1+ },+ "tests/animator-graph.test.ts": {+ "TS2322|Type '\"int\"' is not assignable to type 'AnimatorParamType | undefined'.": 1,+ "TS2345|Argument of type '\"int\"' is not assignable to parameter of type 'AnimatorParamType'.": 1+ },+ "tests/animator.test.ts": {+ "TS2322|Type '{ clip: string; speed: number; playing: boolean; loop: boolean; enabled: boolean; currentFrame: number; frameTimer: number; finished?: boolean | undefined; }' is not assignable to type 'SpriteAnimatorData'.": 1+ },+ "tests/aot-app.test.ts": {+ "TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BufferSource'.": 12+ },+ "tests/aot-conformance.test.ts": {+ "TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BufferSource'.": 1,+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/aot-dispatch.test.ts": {+ "TS2739|Type '{ componentNamed: (name: string) => AnyComponentDef | undefined; resourceAt: () => undefined; }' is missing the following properties from type 'AotAddresses': resourceWriteBack, payloadRows, sendEvent, releasePayloads": 2+ },+ "tests/aot-dispatcher-seam.test.ts": {+ "TS2352|Conversion of type '{ componentNamed: () => ComponentDef<{ x: number; }>; resourceAt: () => undefined; }' to type 'AotAddresses' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1,+ "TS2459|Module '\"../src/ecs/aot/AotRuntime\"' declares 'AotContext' locally, but it is not exported.": 1+ },+ "tests/aot-install.test.ts": {+ "TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'string | BufferSource'.": 1,+ "TS2440|Import declaration conflicts with local declaration of 'FADE_FIELDS'.": 1+ },+ "tests/aot-perf.test.ts": {+ "TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BufferSource'.": 1+ },+ "tests/aot-row-cache.test.ts": {+ "TS2739|Type '{ componentNamed: () => AnyComponentDef; resourceAt: () => undefined; }' is missing the following properties from type 'AotAddresses': resourceWriteBack, payloadRows, sendEvent, releasePayloads": 1+ },+ "tests/api-baseline-rules.test.ts": {+ "TS7016|Could not find a declaration file for module '../../tools/lib/apiSnapshot.mjs'. 'D:/estella/tools/lib/apiSnapshot.mjs' implicitly has an 'any' type.": 1+ },+ "tests/asset-refcounter-integration.test.ts": {+ "TS2739|Type '{ textureHandles: Map<any, any>; materialHandles: Map<any, any>; fontHandles: Map<any, any>; releaseCallbacks: never[]; missing: never[]; }' is missing the following properties from type 'SceneAssetResult': meshHandles, environmentHandles, scope": 1+ },+ "tests/assets-invalidate-event.test.ts": {+ "TS2673|Constructor of class 'Assets' is private and only accessible within the class declaration.": 1+ },+ "tests/audio-api.test.ts": {+ "TS2739|Type '{ name: string; initialize: Mock<Procedure>; ensureResumed: Mock<Procedure>; loadBuffer: Mock<Procedure>; loadBufferFromData: Mock<...>; ... 4 more ...; dispose: Mock<...>; }' is missing the following properties from type 'PlatformAudioBackend': mixer, isReady": 1+ },+ "tests/audio-backend-factory.test.ts": {+ "TS18048|'platform.createAudioBackend' is possibly 'undefined'.": 3,+ "TS2722|Cannot invoke an object which is possibly 'undefined'.": 3,+ "TS2739|Type '{ name: \"web\" | \"wechat\"; fetch: () => Promise<any>; readFile: () => Promise<ArrayBuffer>; readTextFile: () => Promise<string>; fileExists: () => Promise<false>; ... 6 more ...; createAudioBackend: () => WebAudioBackend | MiniGameAudioBackend; }' is missing the following properties from type 'PlatformAdapter': devicePixelRatio, getStorageItem, setStorageItem, removeStorageItem, clearStorage": 1+ },+ "tests/binding-surface.test.ts": {+ "TS7016|Could not find a declaration file for module '../../build-tools/tasks/native.js'. 'D:/estella/build-tools/tasks/native.js' implicitly has an 'any' type.": 1+ },+ "tests/camera-bounds.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/camera-director.test.ts": {+ "TS2322|Type '{ entity: number; isActive: boolean; x: number; y: number; z: number; rotation: number; tilt?: { x: number; y: number; z: number; w: number; } | undefined; orbit?: { yaw: number; pitch: number; focusZ: number; } | undefined; ... 10 more ...; renderTarget?: number | undefined; }' is not assignable to type 'CameraPOV'.": 1+ },+ "tests/camera-pov.test.ts": {+ "TS2322|Type '{ entity: number; isActive: boolean; x: number; y: number; z: number; rotation: number; tilt?: { x: number; y: number; z: number; w: number; } | undefined; orbit?: { yaw: number; pitch: number; focusZ: number; } | undefined; ... 10 more ...; renderTarget?: number | undefined; }' is not assignable to type 'CameraPOV'.": 1+ },+ "tests/camera-render-order.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/colliderEnabled.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/collisionLayerMask.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/content-cache.test.ts": {+ "TS2322|Type 'Promise<{}>' is not assignable to type 'Promise<T>'.": 1+ },+ "tests/discoverAssets.test.ts": {+ "TS2741|Property 'runtime' is missing in type '{ skeletonField: string; atlasField: string; }' but required in type 'SkeletalFieldMeta'.": 1+ },+ "tests/editor-view-orbit.test.ts": {+ "TS2345|Argument of type '{ entity: number; isActive: boolean; x: number; y: number; z: number; rotation: number; tilt: { x: number; y: number; z: number; w: number; }; projection: number; orthoSize: number; fov: number; near: number; ... 5 more ...; cullingMask: number; }' is not assignable to parameter of type 'CameraPOV'.": 1+ },+ "tests/editor-view.test.ts": {+ "TS2345|Argument of type '{ active: true; x: number; y: number; orthoSize: number; }' is not assignable to parameter of type 'EditorViewData'.": 3+ },+ "tests/entity-box.test.ts": {+ "TS2698|Spread types may only be created from object types.": 5+ },+ "tests/entity-order.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/fsm-agent.test.ts": {+ "TS2345|Argument of type '(ctx: AiContext) => number' is not assignable to parameter of type 'AiAction<AiContext> | AiActionSpec<AiContext>'.": 1+ },+ "tests/fsm.test.ts": {+ "TS2345|Argument of type '() => number' is not assignable to parameter of type 'AiAction<unknown> | AiActionSpec<unknown>'.": 1+ },+ "tests/fx-despawn-cleanup.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/helpers/mockApp.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/hot-swap-systems.test.ts": {+ "TS2322|Type 'number' is not assignable to type 'void | Promise<void>'.": 13+ },+ "tests/input-vocabulary.test.ts": {+ "TS2741|Property 'mapping' is missing in type '{ index: number; connected: true; axes: number[]; buttons: number[]; }' but required in type 'GamepadSnapshot'.": 1+ },+ "tests/json-asset-loader.test.ts": {+ "TS2345|Argument of type '{ backend: Backend; }' is not assignable to parameter of type 'AssetsOptions'.": 1+ },+ "tests/marker-component.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/minigame-entry.test.ts": {+ "TS2722|Cannot invoke an object which is possibly 'undefined'.": 1+ },+ "tests/mocks/wasm.ts": {+ "TS2352|Conversion of type '{ getRegistry: () => CppRegistry; getResourceManager: () => CppResourceManager; getUINodeHiddenInTree: (_registry: unknown, entity: Entity) => boolean; setUINodeHiddenInTree: (entity: Entity, hidden: boolean) => void; GL: any; }' to type 'MockModule' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1,+ "TS2353|Object literal may only specify known properties, and 'loadTexture' does not exist in type 'CppResourceManager'.": 1+ },+ "tests/native-host-bridge.test.ts": {+ "TS2345|Argument of type '{ onTouchStart: Mock<Procedure>; onTouchMove: Mock<Procedure>; onTouchEnd: Mock<Procedure>; onTouchCancel: Mock<Procedure>; }' is not assignable to parameter of type 'NativeInputListener'.": 1+ },+ "tests/native-text.test.ts": {+ "TS2353|Object literal may only specify known properties, and 'len' does not exist in type '{ handle: number; x: number; y: number; w: number; h: number; bytes: number; }'.": 1+ },+ "tests/nav-debug-draw.test.ts": {+ "TS2345|Argument of type '{ verts: Float32Array<ArrayBuffer>; polys: Int32Array<ArrayBuffer>; neis: Int32Array<ArrayBuffer>; ... 4 more ...; verticalReach: number; }' is not assignable to parameter of type 'NavMeshData'.": 1,+ "TS2741|Property 'showLinks' is missing in type '{ enabled: true; showFaces: true; showBorders: true; }' but required in type 'NavDebugDrawConfig'.": 1+ },+ "tests/nav-geometry.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/physics-features.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/physics3d-ecs.test.ts": {+ "TS2339|Property 'publishContacts' does not exist on type 'Physics3DWasmModule & { calls: { name: string; args: number[]; }[]; publish(records: number[]): void; publishQuery(records: number[]): void; }'.": 1+ },+ "tests/physicsReconcile.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/physicsSyncTransforms.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/playableRuntime.test.ts": {+ "TS2554|Expected 1 arguments, but got 0.": 1+ },+ "tests/plugin-sets.test.ts": {+ "TS2345|Argument of type 'Plugin[]' is not assignable to parameter of type '{ name: string; }[]'.": 6+ },+ "tests/prefab-spawn-overrides.test.ts": {+ "TS2352|Conversion of type 'undefined' to type '{ overrides?: unknown[] | undefined; }' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1,+ "TS2493|Tuple type '[]' of length '0' has no element at index '2'.": 1+ },+ "tests/preload-ai-assets.test.ts": {+ "TS2741|Property 'version' is missing in type '{ name: string; entities: ({ id: number; name: string; parent: null; children: never[]; components: { type: string; data: { fsm: string; current: string; }; }[]; } | { id: number; name: string; parent: null; children: never[]; components: { ...; }[]; })[]; }' but required in type 'SceneData'.": 1+ },+ "tests/preload-concurrency.test.ts": {+ "TS2673|Constructor of class 'Assets' is private and only accessible within the class declaration.": 1+ },+ "tests/preload-texture-import.test.ts": {+ "TS2741|Property 'version' is missing in type '{ name: string; entities: { id: number; name: string; parent: null; children: never[]; components: { type: string; data: { texture: string; visualType: number; }; }[]; }[]; }' but required in type 'SceneData'.": 1+ },+ "tests/profile-recorder.test.ts": {+ "TS2322|Type 'number' is not assignable to type 'void | Promise<void>'.": 1+ },+ "tests/query-mixed-mut.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/query-mut-change-tracking.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/renderPipeline.test.ts": {+ "TS2339|Property '_applyScreenStack' does not exist on type 'ResourceDef<PostProcessAPI>'.": 1,+ "TS2339|Property '_beginScreenCapture' does not exist on type 'ResourceDef<PostProcessAPI>'.": 2,+ "TS2339|Property '_endScreenCapture' does not exist on type 'ResourceDef<PostProcessAPI>'.": 2,+ "TS2339|Property '_executeScreenPasses' does not exist on type 'ResourceDef<PostProcessAPI>'.": 2,+ "TS2339|Property 'getStack' does not exist on type 'ResourceDef<PostProcessAPI>'.": 1,+ "TS2339|Property 'init' does not exist on type 'ResourceDef<PostProcessAPI>'.": 1,+ "TS2339|Property 'isInitialized' does not exist on type 'ResourceDef<PostProcessAPI>'.": 1,+ "TS2339|Property 'resize' does not exist on type 'ResourceDef<PostProcessAPI>'.": 2+ },+ "tests/renderTexture.test.ts": {+ "TS2345|Argument of type '{ _handle: number; textureId: number; width: number; height: number; _depth: boolean; _filter: \"nearest\"; }' is not assignable to parameter of type 'RenderTextureHandle'.": 4+ },+ "tests/runtime-only-serialize.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/scene-asset-release.test.ts": {+ "TS2345|Argument of type '{ key: string; generation: number; value: null; release: () => number; }' is not assignable to parameter of type 'AssetLease<null>'.": 1+ },+ "tests/scene-loading-progress.test.ts": {+ "TS2353|Object literal may only specify known properties, and 'fetch' does not exist in type 'Backend'.": 1,+ "TS2673|Constructor of class 'Assets' is private and only accessible within the class declaration.": 3,+ "TS2673|Constructor of class 'Catalog' is private and only accessible within the class declaration.": 3,+ "TS2741|Property 'version' is missing in type '{ name: string; entities: never[]; }' but required in type 'SceneData'.": 1,+ "TS2741|Property 'version' is missing in type '{ name: string; entities: { id: number; name: string; parent: null; children: never[]; components: { type: string; data: { texture: string; }; }[]; }[]; }' but required in type 'SceneData'.": 1,+ "TS7006|Parameter 'loaded' implicitly has an 'any' type.": 2,+ "TS7006|Parameter 'total' implicitly has an 'any' type.": 2+ },+ "tests/scene-streaming.test.ts": {+ "TS2352|Conversion of type 'SystemDef' to type '{ _fn: (...a: unknown[]) => void; }' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1+ },+ "tests/scene.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/sceneManager.test.ts": {+ "TS2339|Property 'unbind' does not exist on type 'ResourceDef<PostProcessAPI>'.": 3,+ "TS2345|Argument of type 'BuiltinComponentDef<BitmapTextData>' is not assignable to parameter of type 'symbol'.": 2,+ "TS2345|Argument of type 'BuiltinComponentDef<SpineAnimationData>' is not assignable to parameter of type 'symbol'.": 2,+ "TS2345|Argument of type 'BuiltinComponentDef<SpriteData>' is not assignable to parameter of type 'symbol'.": 4,+ "TS2345|Argument of type 'ComponentDef<SceneOwnerData>' is not assignable to parameter of type 'symbol'.": 5,+ "TS2345|Argument of type 'Map<BuiltinComponentDef<TilemapLayerData>, { visible: boolean; opacity: number; }>' is not assignable to parameter of type 'Map<symbol, any>'.": 1+ },+ "tests/shader-twins.test.ts": {+ "TS7016|Could not find a declaration file for module '../../tools/gen-shader-twins.mjs'. 'D:/estella/tools/gen-shader-twins.mjs' implicitly has an 'any' type.": 1+ },+ "tests/sideModuleHost.test.ts": {+ "TS7053|Element implicitly has an 'any' type because expression of type 'SideModuleId' can't be used to index type 'Record<BuiltinSideModuleId, SideModuleDescriptor>'.": 1+ },+ "tests/soak/sabotage.test.ts": {+ "TS2345|Argument of type 'EventTarget' is not assignable to parameter of type 'Target'.": 1+ },+ "tests/spine-abi-cost.test.ts": {+ "TS2741|Property 'culling' is missing in type '{ id: string; pair: { skeleton: string; atlas: string; }; value: SpineAssetValue; retain: () => { release: () => void; }; }' but required in type 'SpineEraBinding'.": 1+ },+ "tests/spine-apply-routing.test.ts": {+ "TS2322|Type 'Map<string, { version: null; skelData: Uint8Array<ArrayBuffer>; atlasText: string; textures: Map<any, any>; }>' is not assignable to type 'Map<string, SpineAssetInfo>'.": 1,+ "TS2741|Property 'runtime' is missing in type '{ skeletonField: string; atlasField: string; }' but required in type 'SkeletalFieldMeta'.": 1+ },+ "tests/spine-clip-start.test.ts": {+ "TS2741|Property 'culling' is missing in type '{ id: string; value: { skelData: Uint8Array<ArrayBuffer>; atlasText: string; isBinary: true; textures: Map<any, any>; }; pair: { skeleton: string; atlas: string; }; retain: () => { ...; }; }' but required in type 'SpineEraBinding'.": 1+ },+ "tests/spine-contract-delivery.test.ts": {+ "TS2554|Expected 0 arguments, but got 1.": 1+ },+ "tests/spine-dedup.test.ts": {+ "TS2741|Property 'runtime' is missing in type '{ skeletonField: string; atlasField: string; }' but required in type 'SkeletalFieldMeta'.": 1+ },+ "tests/spine-demand-driven-pose.test.ts": {+ "TS2339|Property 'animation' does not exist on type 'RawSpineEvent'.": 1,+ "TS2339|Property 'name' does not exist on type 'RawSpineEvent'.": 1+ },+ "tests/spine-extract-stages.test.ts": {+ "TS2741|Property 'culling' is missing in type '{ id: string; value: { skelData: Uint8Array<ArrayBuffer>; atlasText: string; isBinary: true; textures: Map<any, any>; }; pair: { skeleton: string; atlas: string; }; retain: () => { ...; }; }' but required in type 'SpineEraBinding'.": 1+ },+ "tests/spine-multi-version-build.test.ts": {+ "TS7053|Element implicitly has an 'any' type because expression of type 'SideModuleId' can't be used to index type 'Record<BuiltinSideModuleId, SideModuleDescriptor>'.": 2+ },+ "tests/spine-observability.test.ts": {+ "TS2741|Property 'culling' is missing in type '{ id: string; value: { skelData: Uint8Array<ArrayBufferLike>; atlasText: string; isBinary: true; textures: Map<string, { glId: number; w: number; h: number; }>; }; pair: { ...; }; retain: () => { ...; }; }' but required in type 'SpineEraBinding'.": 1+ },+ "tests/spine-pose-demand.test.ts": {+ "TS2741|Property 'culling' is missing in type '{ id: string; value: { skelData: Uint8Array<ArrayBufferLike>; atlasText: string; isBinary: true; textures: Map<any, any>; }; pair: { skeleton: string; atlas: string; }; retain: () => { ...; }; }' but required in type 'SpineEraBinding'.": 1+ },+ "tests/spine-pose-materialization.test.ts": {+ "TS2741|Property 'culling' is missing in type '{ id: string; value: { skelData: Uint8Array<ArrayBufferLike>; atlasText: string; isBinary: true; textures: Map<any, any>; }; pair: { skeleton: string; atlas: string; }; retain: () => { ...; }; }' but required in type 'SpineEraBinding'.": 1+ },+ "tests/sprite-animator-goto.test.ts": {+ "TS2741|Property 'finished' is missing in type '{ clip: string; speed: number; playing: true; loop: true; enabled: true; currentFrame: number; frameTimer: number; }' but required in type 'SpriteAnimatorData'.": 1+ },+ "tests/storage.test.ts": {+ "TS2322|Type '{ store: Map<string, string>; name: \"web\"; getStorageItem: (key: string) => string | null; setStorageItem: (key: string, value: string) => void; removeStorageItem: (key: string) => void; ... 11 more ...; createAudioBackend: any; }' is not assignable to type 'PlatformAdapter & { store: Map<string, string>; }'.": 1+ },+ "tests/tiled-tile-collision.test.ts": {+ "TS18047|'map' is possibly 'null'.": 7+ },+ "tests/tilemap.test.ts": {+ "TS2739|Type '{ name: string; width: number; height: number; visible: true; tiles: Uint16Array<ArrayBuffer>; opacity: number; tintColor: { r: number; g: number; b: number; a: number; }; parallaxX: number; parallaxY: number; }' is missing the following properties from type 'TiledLayerData': chunks, infinite": 1,+ "TS2739|Type '{ opacity: number; tintColor: { r: number; g: number; b: number; a: number; }; parallaxX: number; parallaxY: number; name: string; width: number; height: number; visible: true; tiles: Uint16Array<ArrayBuffer>; }' is missing the following properties from type 'TiledLayerData': chunks, infinite": 5,+ "TS2739|Type '{ shape: \"rect\"; x: number; y: number; width: number; height: number; rotation: number; vertices: null; properties: Map<any, any>; }' is missing the following properties from type 'TiledObjectData': id, name, type, visible": 2,+ "TS2741|Property 'extrude' is missing in type '{ version: string; texture: string; tileWidth: number; tileHeight: number; columns: number; margin: number; spacing: number; tiles: {}; }' but required in type 'TilesetAsset'.": 1,+ "TS2741|Property 'firstGid' is missing in type '{ name: string; image: string; tileWidth: number; tileHeight: number; columns: number; tileCount: number; }' but required in type 'TiledTilesetData'.": 4,+ "TS2741|Property 'tileShapes' is missing in type '{ width: number; height: number; tileWidth: number; tileHeight: number; orientation: string; hexSideLength: number; staggerAxis: string; staggerIndex: string; layers: never[]; tilesets: never[]; collisionTileIds: never[]; tileAnimations: Map<...>; tileProperties: Map<...>; objectGroups: TiledObjectGroupData[]; }' but required in type 'TiledMapData'.": 1+ },+ "tests/timeline-drive.test.ts": {+ "TS2322|Type 'object' is not assignable to type 'AnyComponentDef | undefined'.": 1+ },+ "tests/timeline-evaluator.test.ts": {+ "TS2304|Cannot find name 'Entity'.": 5,+ "TS2322|Type 'object' is not assignable to type 'AnyComponentDef | undefined'.": 1+ },+ "tests/torture/assetHarness.ts": {+ "TS2339|Property 'registerTextureWithPath' does not exist on type 'never'.": 1,+ "TS2459|Module '\"../../src/asset/Assets\"' declares 'TextureResult' locally, but it is not exported.": 1+ },+ "tests/ui-anchor-preset.test.ts": {+ "TS2322|Type '{ position: number; display?: number | undefined; opacity?: number | undefined; pointerEvents?: number | undefined; width: Dimension; height: Dimension; ... 15 more ...; insetBottom: Dimension; }' is not assignable to type 'UINodeData'.": 1+ },+ "tests/ui-dimension-transient.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/ui-drag-plugin.test.ts": {+ "TS2322|Type 'null' is not assignable to type 'Vec2 | undefined'.": 2+ },+ "tests/ui-layout-incremental.test.ts": {+ "TS2322|Type '{ position: number; display?: number | undefined; opacity?: number | undefined; pointerEvents?: number | undefined; width: Dimension; height: Dimension; ... 15 more ...; insetBottom: Dimension; }' is not assignable to type 'UINodeData'.": 1,+ "TS2352|Conversion of type 'FlexContainerData' to type 'Record<string, unknown>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1+ },+ "tests/ui-plugin-cleanup.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/ui-slider-dropdown.test.ts": {+ "TS2724|'\"../src/ui\"' has no exported member named 'UIRect'. Did you mean 'Rect'?": 1+ },+ "tests/ui-text-submit.test.ts": {+ "TS2554|Expected 9-10 arguments, but got 8.": 1+ },+ "tests/utf8.test.ts": {+ "TS2307|Cannot find module '../src/util/utf8?fallback' or its corresponding type declarations.": 1+ },+ "tests/velocity.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1+ },+ "tests/wasm-video-backend.test.ts": {+ "TS2739|Type '{ name: \"wechat\"; fetch: () => Promise<any>; readFile: () => Promise<ArrayBuffer>; readTextFile: () => Promise<string>; fileExists: () => Promise<true>; ... 6 more ...; createAudioBackend: () => any; }' is missing the following properties from type 'PlatformAdapter': devicePixelRatio, getStorageItem, setStorageItem, removeStorageItem, clearStorage": 1+ },+ "tests/world.test.ts": {+ "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 2+ }+}diff --git a/tools/check-sdk-test-types.mjs b/tools/check-sdk-test-types.mjsnew file mode 100644index 000000000..64cb5fbb2--- /dev/null+++ b/tools/check-sdk-test-types.mjs@@ -0,0 +1,137 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file check-sdk-test-types.mjs — the test corpus is inside a type checker.+ *+ * `sdk/tsconfig.json` compiles `src/**` and emits `dist/`, so the 478 test files+ * beside it were never in any checker's scope; vitest strips types and never+ * looks. A fixture could go stale against the API it tests and stay green — one+ * did, three commits ago: literal schemas missing a field the handshake had+ * gained, running fine because both sides read `undefined`.+ *+ * This is not a demand for zero. There are 220 diagnostics of history here and+ * clearing them is not this gate's job. It is a RATCHET: no new debt, and debt+ * that gets paid is banked so it cannot come back.+ *+ * Identity is (file, error code, message) with a COUNT — never line and column,+ * or inserting two lines would churn the whole baseline.+ *+ * node tools/check-sdk-test-types.mjs # check+ * node tools/check-sdk-test-types.mjs --update # bank the current state+ */+import { spawnSync } from 'node:child_process';+import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');+const SDK = path.join(ROOT, 'sdk');+const TSC = path.join(SDK, 'node_modules', 'typescript', 'bin', 'tsc');+const CONFIG = path.join(SDK, 'tsconfig.tests.json');+const BASELINE = path.join(ROOT, 'tools', 'baselines', 'sdk-test-types.json');++/**+ * Areas held to zero. The networking suites are becoming certification-grade,+ * and a mechanism experiment run on fixtures that no longer type-check against+ * the API is worse than one that fails. (Flat file names rather than a `net/`+ * directory: sdk/tests has no subdirectories.)+ */+const ZERO_DEBT = {+ label: 'sdk/tests/{net-*,replication*,websocket}',+ match: (file) => /^tests\/(net-|replication|websocket)/.test(file),+};++const UPDATE = process.argv.includes('--update');++function fail(message, detail) {+ console.error(`check-sdk-test-types: ${message}`);+ if (detail) console.error(detail);+ process.exit(1);+}++// ---------------------------------------------------------------------------+// Collect+// ---------------------------------------------------------------------------++const run = spawnSync(process.execPath, [TSC, '-p', CONFIG], { encoding: 'utf8', cwd: SDK });+const output = `${run.stdout ?? ''}${run.stderr ?? ''}`;+if (run.status !== 0 && !/error TS\d+/.test(output)) {+ fail('tsc did not run.', output.slice(0, 2000));+}++/** file → "TSxxxx|message" → count. Continuation lines are indented; skip them. */+const current = {};+const LINE = /^(.+?)\((\d+),(\d+)\): error (TS\d+): (.*)$/;+for (const line of output.split(/\r?\n/)) {+ const m = LINE.exec(line);+ if (!m) continue;+ const file = m[1].split(path.sep).join('/');+ const key = `${m[4]}|${m[5]}`;+ (current[file] ??= {});+ current[file][key] = (current[file][key] ?? 0) + 1;+}++const total = (map) => Object.values(map).reduce((n, per) => n + Object.values(per).reduce((a, b) => a + b, 0), 0);++// ---------------------------------------------------------------------------+// Update+// ---------------------------------------------------------------------------++if (UPDATE) {+ const offenders = Object.keys(current).filter(ZERO_DEBT.match).sort();+ if (offenders.length > 0) {+ fail(`refusing to bank debt under ${ZERO_DEBT.label} — it is held to zero.`,+ offenders.map((f) => ` ${f}`).join('\n'));+ }+ mkdirSync(path.dirname(BASELINE), { recursive: true });+ const sorted = Object.fromEntries(Object.keys(current).sort().map((f) => [+ f, Object.fromEntries(Object.keys(current[f]).sort().map((k) => [k, current[f][k]])),+ ]));+ writeFileSync(BASELINE, `${JSON.stringify(sorted, null, 2)}\n`);+ console.log(`check-sdk-test-types: banked ${total(current)} diagnostic(s) in ${Object.keys(current).length} file(s).`);+ process.exit(0);+}++// ---------------------------------------------------------------------------+// Check+// ---------------------------------------------------------------------------++if (!existsSync(BASELINE)) fail(`no baseline at ${BASELINE} — run with --update once to create it.`);+const baseline = JSON.parse(readFileSync(BASELINE, 'utf8'));++const added = [];+const resolved = [];+for (const [file, per] of Object.entries(current)) {+ for (const [key, count] of Object.entries(per)) {+ const known = baseline[file]?.[key] ?? 0;+ if (count > known) added.push({ file, key, delta: count - known });+ }+}+for (const [file, per] of Object.entries(baseline)) {+ for (const [key, count] of Object.entries(per)) {+ const now = current[file]?.[key] ?? 0;+ if (now < count) resolved.push({ file, key, delta: count - now });+ }+}++// Held-to-zero areas answer for themselves, baseline or not.+const zeroBreaches = Object.keys(current).filter(ZERO_DEBT.match).sort();+if (zeroBreaches.length > 0) {+ fail(`${ZERO_DEBT.label} is held to zero type debt; ${zeroBreaches.length} file(s) have some.`,+ zeroBreaches.map((f) => ` ${f}: ${Object.keys(current[f]).join('; ')}`).join('\n'));+}++if (added.length > 0) {+ fail(`${added.reduce((n, a) => n + a.delta, 0)} new type diagnostic(s) in the SDK test corpus.`+ + ' vitest strips types, so nothing else would have told you.',+ added.map((a) => ` ${a.file} (+${a.delta}) ${a.key}`).join('\n'));+}++if (resolved.length > 0) {+ fail(`${resolved.reduce((n, r) => n + r.delta, 0)} diagnostic(s) were FIXED — good, but the baseline`+ + ' still allows them back. Bank it: node tools/check-sdk-test-types.mjs --update',+ resolved.map((r) => ` ${r.file} (-${r.delta}) ${r.key}`).join('\n'));+}++console.log(`check-sdk-test-types: known debt ${total(baseline)} in ${Object.keys(baseline).length} file(s),`+ + ` new 0, resolved 0 — and ${ZERO_DEBT.label} carries none.`);diff --git a/tools/gates.mjs b/tools/gates.mjsindex 1a8906ff2..8ae77ed10 100644--- a/tools/gates.mjs+++ b/tools/gates.mjs@@ -113,6 +113,10 @@ export const GATES = [// And the boundary holds in practice: a real project packages from the command// line with no editor built.{ id: 'headless-export', run: 'node tools/check-headless-export.mjs' },+ // The 478 SDK test files were in no checker's scope: the production config+ // compiles src/ and vitest strips types. A ratchet, not a demand for zero —+ // except in the net suites, which are held to none.+ { id: 'sdk-test-types', run: 'node tools/check-sdk-test-types.mjs' },// Replication applies its inbox in arrival order, so reliable+ordered is a// correctness condition. This compiles the claim: a transport that does not// make it cannot reach replication.