From 79c10f56049c6527b3f97f58b3d119e2ee6136e2 Mon Sep 17 00:00:00 2001 From: Quantum Explorer Date: Thu, 23 Apr 2026 14:53:05 +0800 Subject: [PATCH] test(wasm-sdk): remove invalid `position` from document-type root in fixtures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four test fixtures in the wasm-sdk functional test suite placed `position: N` at the document-type root (outside `properties`). This key is only valid inside property definitions — it's how DPP orders fields in the serialized document row, not a document-type-level config. The v0 document meta-schema silently accepted stray root-level keys because `additionalProperties` was unconstrained. PR #3475 (merged 2026-04-12, gated on protocol v12) added `additionalProperties: false` to the v1 meta-schema, which correctly rejects the stray `position`. Since protocol v12 went live this caused the `Run WASM SDK functional tests` step to fail with: state transition broadcast error: JsonSchemaError: Additional properties are not allowed ('position' was unexpected), path: on contract publish, with cascading `expected null to exist` failures on the 4 downstream tests that depend on the contract being published. Also replace the misleading comment `"Position property is required for document types and their properties"` with an accurate note about where `position` belongs. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../tests/functional/transitions/contracts.spec.ts | 9 +++++---- .../tests/functional/transitions/documents.spec.ts | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/wasm-sdk/tests/functional/transitions/contracts.spec.ts b/packages/wasm-sdk/tests/functional/transitions/contracts.spec.ts index ee7913fc5d2..c6005128016 100644 --- a/packages/wasm-sdk/tests/functional/transitions/contracts.spec.ts +++ b/packages/wasm-sdk/tests/functional/transitions/contracts.spec.ts @@ -39,12 +39,14 @@ describe('Contract State Transitions', function describeContractStateTransitions // Contract operations require at least HIGH security level (key index 2) const { signer, identityKey } = createTestSignerAndKey(sdk, 1, 2); - // Create a simple test schema with a "note" document type - // Position property is required for document types and their properties + // Create a simple test schema with a "note" document type. + // `position` is required on each *property* (to order fields in the + // document row) — it is NOT a valid key on the document-type root. + // Under protocol v12 the document meta-schema is strict + // (`additionalProperties: false`) and rejects stray root-level keys. const schema = { note: { type: 'object', - position: 0, properties: { message: { type: 'string', @@ -114,7 +116,6 @@ describe('Contract State Transitions', function describeContractStateTransitions ...existingSchemas, task: { type: 'object', - position: 1, properties: { title: { type: 'string', diff --git a/packages/wasm-sdk/tests/functional/transitions/documents.spec.ts b/packages/wasm-sdk/tests/functional/transitions/documents.spec.ts index 2b5d5457541..fc4ac99aa32 100644 --- a/packages/wasm-sdk/tests/functional/transitions/documents.spec.ts +++ b/packages/wasm-sdk/tests/functional/transitions/documents.spec.ts @@ -78,13 +78,15 @@ describe('Document State Transitions', function describeDocumentStateTransitions // Contract operations require at least HIGH security level (key index 2) const { signer, identityKey } = createTestSignerAndKey(sdk, 1, 2); - // Create a schema with mutable, deletable, and transferable document types - // Position property is required for document types and properties + // Create a schema with mutable, deletable, and transferable document types. + // `position` is required on each *property* (to order fields in the + // document row) — it is NOT a valid key on the document-type root. + // Under protocol v12 the document meta-schema is strict + // (`additionalProperties: false`) and rejects stray root-level keys. const schema = { // Mutable document type - can be updated mutableNote: { type: 'object', - position: 0, documentsMutable: true, canBeDeleted: true, properties: { @@ -101,7 +103,6 @@ describe('Document State Transitions', function describeDocumentStateTransitions // transferable: 1 = Always transferable (see Transferable enum in DPP) transferableItem: { type: 'object', - position: 1, transferable: 1, documentsMutable: false, canBeDeleted: false,