@fluidframework/id-compressor 3.3.0 → 3.4.0
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/CHANGELOG.md +4 -0
- package/dist/idCompressor.d.ts +10 -17
- package/dist/idCompressor.d.ts.map +1 -1
- package/dist/idCompressor.js +68 -35
- package/dist/idCompressor.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/test/sharding.fuzz.spec.js.map +1 -1
- package/dist/test/sharding.spec.js.map +1 -1
- package/dist/test/types/validateIdCompressorPrevious.generated.js.map +1 -1
- package/dist/types/idCompressor.d.ts +110 -31
- package/dist/types/idCompressor.d.ts.map +1 -1
- package/dist/types/idCompressor.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/lib/idCompressor.d.ts +10 -17
- package/lib/idCompressor.d.ts.map +1 -1
- package/lib/idCompressor.js +69 -36
- package/lib/idCompressor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/test/sharding.fuzz.spec.js.map +1 -1
- package/lib/test/sharding.spec.js.map +1 -1
- package/lib/test/types/validateIdCompressorPrevious.generated.js.map +1 -1
- package/lib/types/idCompressor.d.ts +110 -31
- package/lib/types/idCompressor.d.ts.map +1 -1
- package/lib/types/idCompressor.js.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/package.json +9 -42
- package/src/idCompressor.ts +90 -42
- package/src/index.ts +10 -7
- package/src/packageVersion.ts +1 -1
- package/src/test/types/validateIdCompressorPrevious.generated.ts +1 -121
- package/src/types/idCompressor.ts +119 -31
- package/src/types/index.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/id-compressor\";\nexport const pkgVersion = \"3.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAC;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/id-compressor\";\nexport const pkgVersion = \"3.4.0\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharding.fuzz.spec.js","sourceRoot":"","sources":["../../src/test/sharding.fuzz.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,MAAM,EACN,IAAI,GACJ,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAm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AC;YACvB,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;YAChB,iBAAiB,EAAE,EAAE;YACrB,gBAAgB,EAAE,EAAE;YACpB,gBAAgB,EAAE,GAAG;SACrB,CAAC,CACF,CAAC;QACF,0BAA0B,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype BaseFuzzTestState,\n\ttype Generator,\n\tcreateWeightedGenerator,\n\tinterleave,\n\tmakeRandom,\n\tperformFuzzActions as performFuzzActionsBase,\n\trepeat,\n\ttake,\n} from \"@fluid-private/stochastic-test-utils\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport type { SessionSpaceCompressedId, StableId } from \"../index.js\";\nimport { SerializationVersion } from \"../types/index.js\";\nimport { createSessionId } from \"../utilities.js\";\n\n/**\n * State for sharding fuzz tests.\n * Tracks a tree of compressors and all generated IDs for collision detection and validation.\n */\ninterface ShardingFuzzTestState extends BaseFuzzTestState {\n\t/** The root compressor that started the tree */\n\trootCompressor: IdCompressor;\n\t/** Map from compressor to its parent (undefined for root) */\n\tparentMap: Map<IdCompressor, IdCompressor | undefined>;\n\t/** Map from compressor to its children */\n\tchildrenMap: Map<IdCompressor, Set<IdCompressor>>;\n\t/** All active compressors (not disposed) */\n\tactiveCompressors: Set<IdCompressor>;\n\t/** Leaf compressors that can be unsharded */\n\tleafCompressors: Set<IdCompressor>;\n\t/** Map from compressor to all local IDs it has generated */\n\tcompressorGeneratedIds: Map<IdCompressor, SessionSpaceCompressedId[]>;\n\t/**\n\t * Map from compressor to the set of local IDs it has been synchronized with (and so must be able\n\t * to decompress) but did not itself generate. Populated by synchronize operations.\n\t */\n\tsynchronizedIds: Map<IdCompressor, Set<SessionSpaceCompressedId>>;\n\t/** Global set of all generated local IDs for collision detection */\n\tglobalLocalIds: Set<SessionSpaceCompressedId>;\n\t/** Global set of all decompressed stable IDs for collision detection */\n\tglobalStableIds: Set<StableId>;\n}\n\n/**\n * Operation to shard a compressor into multiple child shards.\n */\ninterface ShardOperation {\n\ttype: \"shard\";\n\tcompressor: IdCompressor;\n\tnumShards: number;\n}\n\n/**\n * Operation to unshard a leaf compressor back into its parent.\n */\ninterface UnshardOperation {\n\ttype: \"unshard\";\n\tleaf: IdCompressor;\n}\n\n/**\n * Operation to synchronize a child shard's progress into its parent without disposing the child.\n */\ninterface SynchronizeOperation {\n\ttype: \"synchronize\";\n\tchild: IdCompressor;\n}\n\n/**\n * Operation to generate a new compressed ID.\n */\ninterface GenerateIdOperation {\n\ttype: \"generateId\";\n\tcompressor: IdCompressor;\n}\n\n/**\n * Operation to validate the current state of all compressors.\n */\ninterface ValidateShardingOperation {\n\ttype: \"validateSharding\";\n}\n\ntype ShardingOperation =\n\t| ShardOperation\n\t| UnshardOperation\n\t| SynchronizeOperation\n\t| GenerateIdOperation\n\t| ValidateShardingOperation;\n\n/**\n * Generates a shard operation targeting a random active compressor.\n */\nfunction shardGenerator(state: ShardingFuzzTestState): ShardOperation {\n\tconst compressor = state.random.pick([...state.activeCompressors]);\n\tconst numShards = state.random.integer(1, 3);\n\treturn {\n\t\ttype: \"shard\",\n\t\tcompressor,\n\t\tnumShards,\n\t};\n}\n\n/**\n * Generates an unshard operation targeting a random leaf compressor.\n * If there are no leaves (only root), returns a no-op operation.\n */\nfunction unshardGenerator(state: ShardingFuzzTestState): UnshardOperation {\n\tconst leaves = [...state.leafCompressors];\n\t// Filter out root - it can't be unsharded\n\tconst unshardableLeaves = leaves.filter((l) => l !== state.rootCompressor);\n\n\tif (unshardableLeaves.length === 0) {\n\t\t// No-op: target root which will be filtered out in handler\n\t\treturn {\n\t\t\ttype: \"unshard\",\n\t\t\tleaf: state.rootCompressor,\n\t\t};\n\t}\n\n\tconst leaf = state.random.pick(unshardableLeaves);\n\treturn {\n\t\ttype: \"unshard\",\n\t\tleaf,\n\t};\n}\n\n/**\n * Generates a synchronize operation targeting a random non-root active compressor.\n * The selected compressor's parent will be synchronized with it.\n * If there are no non-root compressors, returns a no-op targeting the root (filtered out in the handler).\n */\nfunction synchronizeGenerator(state: ShardingFuzzTestState): SynchronizeOperation {\n\tconst children = [...state.activeCompressors].filter((c) => c !== state.rootCompressor);\n\tif (children.length === 0) {\n\t\t// No-op: target root which will be filtered out in the handler.\n\t\treturn {\n\t\t\ttype: \"synchronize\",\n\t\t\tchild: state.rootCompressor,\n\t\t};\n\t}\n\treturn {\n\t\ttype: \"synchronize\",\n\t\tchild: state.random.pick(children),\n\t};\n}\n\n/**\n * Generates an operation to generate a new ID from a random compressor.\n */\nfunction generateIdGenerator(state: ShardingFuzzTestState): GenerateIdOperation {\n\tconst compressor = state.random.pick([...state.activeCompressors]);\n\treturn {\n\t\ttype: \"generateId\",\n\t\tcompressor,\n\t};\n}\n\n/**\n * Generates a validation operation.\n */\nfunction validateGenerator(): ValidateShardingOperation {\n\treturn { type: \"validateSharding\" };\n}\n\n/**\n * Configuration for the sharding operation generator.\n */\ninterface ShardingOpGeneratorConfig {\n\t/** Weight for shard operations (default: 3) */\n\tshardWeight?: number;\n\t/** Weight for unshard operations (default: 3) */\n\tunshardWeight?: number;\n\t/** Weight for synchronize operations (default: 5) */\n\tsynchronizeWeight?: number;\n\t/** Weight for ID generation operations (default: 20) */\n\tgenerateIdWeight?: number;\n\t/** How often to inject validation operations (default: every 100 ops) */\n\tvalidateInterval?: number;\n}\n\n/**\n * Creates a weighted generator for sharding fuzz test operations.\n */\nfunction makeShardingOpGenerator(\n\tconfig: ShardingOpGeneratorConfig,\n): Generator<ShardingOperation, ShardingFuzzTestState> {\n\tconst {\n\t\tshardWeight = 3,\n\t\tunshardWeight = 3,\n\t\tsynchronizeWeight = 5,\n\t\tgenerateIdWeight = 20,\n\t\tvalidateInterval = 100,\n\t} = config;\n\n\treturn interleave(\n\t\tcreateWeightedGenerator<ShardingOperation, ShardingFuzzTestState>([\n\t\t\t[shardGenerator, shardWeight],\n\t\t\t[unshardGenerator, unshardWeight],\n\t\t\t[synchronizeGenerator, synchronizeWeight],\n\t\t\t[generateIdGenerator, generateIdWeight],\n\t\t]),\n\t\ttake(1, repeat<ShardingOperation, ShardingFuzzTestState>(validateGenerator())),\n\t\tvalidateInterval,\n\t);\n}\n\n/**\n * Handles a shard operation by creating new child shards and updating the tree structure.\n */\nfunction handleShard(state: ShardingFuzzTestState, op: ShardOperation): ShardingFuzzTestState {\n\tconst { compressor, numShards } = op;\n\n\tlet serializedShards: ReturnType<IdCompressor[\"shard\"]>;\n\ttry {\n\t\tserializedShards = compressor.shard(numShards);\n\t} catch (error) {\n\t\t// Sharding multiplies the stride; once it would exceed the supported maximum, shard() throws\n\t\t// before mutating any state. This is expected for sufficiently deep trees, so treat it as a no-op.\n\t\tif (error instanceof Error && error.message === \"Sharding limit reached.\") {\n\t\t\treturn state;\n\t\t}\n\t\tthrow error;\n\t}\n\n\tfor (const serialized of serializedShards) {\n\t\tconst shard = IdCompressor.deserialize({\n\t\t\tserialized,\n\t\t\trequestedWriteVersion: SerializationVersion.V3,\n\t\t});\n\n\t\t// Update tree structure\n\t\tstate.parentMap.set(shard, compressor);\n\n\t\tlet children = state.childrenMap.get(compressor);\n\t\tif (children === undefined) {\n\t\t\tchildren = new Set();\n\t\t\tstate.childrenMap.set(compressor, children);\n\t\t}\n\t\tchildren.add(shard);\n\n\t\tstate.childrenMap.set(shard, new Set());\n\t\tstate.activeCompressors.add(shard);\n\t\tstate.leafCompressors.add(shard);\n\t\tstate.compressorGeneratedIds.set(shard, []);\n\t\tstate.synchronizedIds.set(shard, new Set());\n\t}\n\n\t// Parent is no longer a leaf after sharding\n\tstate.leafCompressors.delete(compressor);\n\n\treturn state;\n}\n\n/**\n * Handles an unshard operation by disposing a leaf and merging it back into its parent.\n * No-op if the target is the root or not a leaf.\n */\nfunction handleUnshard(\n\tstate: ShardingFuzzTestState,\n\top: UnshardOperation,\n): ShardingFuzzTestState {\n\tconst { leaf } = op;\n\n\t// Can't unshard root or non-leaves\n\tif (leaf === state.rootCompressor || !state.leafCompressors.has(leaf)) {\n\t\treturn state;\n\t}\n\n\tconst parent = state.parentMap.get(leaf);\n\tif (parent === undefined) {\n\t\treturn state;\n\t}\n\n\tconst disposalToken = leaf.disposeShard();\n\tif (disposalToken === undefined) {\n\t\treturn state;\n\t}\n\n\tparent.synchronizeWithShard(disposalToken);\n\n\t// Update tree structure\n\tconst siblings = state.childrenMap.get(parent);\n\tif (siblings !== undefined) {\n\t\tsiblings.delete(leaf);\n\n\t\t// If parent has no more children, it becomes a leaf\n\t\tif (siblings.size === 0) {\n\t\t\tstate.leafCompressors.add(parent);\n\t\t}\n\t}\n\n\t// The disposed leaf's IDs become the parent's responsibility to decompress.\n\tconst parentSynced = state.synchronizedIds.get(parent) ?? new Set();\n\tfor (const id of state.compressorGeneratedIds.get(leaf) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\tfor (const id of state.synchronizedIds.get(leaf) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\tstate.synchronizedIds.set(parent, parentSynced);\n\n\tstate.parentMap.delete(leaf);\n\tstate.childrenMap.delete(leaf);\n\tstate.activeCompressors.delete(leaf);\n\tstate.leafCompressors.delete(leaf);\n\tstate.compressorGeneratedIds.delete(leaf);\n\tstate.synchronizedIds.delete(leaf);\n\n\treturn state;\n}\n\n/**\n * Handles a synchronize operation by synchronizing a child's parent with the child's current progress,\n * without disposing the child. After this, the parent must be able to decompress every ID the child has\n * generated (and every ID the child had itself been synchronized with) up to this point.\n * No-op if the target is the root or is otherwise no longer eligible.\n */\nfunction handleSynchronize(\n\tstate: ShardingFuzzTestState,\n\top: SynchronizeOperation,\n): ShardingFuzzTestState {\n\tconst { child } = op;\n\n\tif (child === state.rootCompressor || !state.activeCompressors.has(child)) {\n\t\treturn state;\n\t}\n\n\tconst parent = state.parentMap.get(child);\n\tif (parent === undefined || !state.activeCompressors.has(parent)) {\n\t\treturn state;\n\t}\n\n\tconst token = child.getShardSyncToken();\n\tif (token === undefined) {\n\t\treturn state;\n\t}\n\n\tparent.synchronizeWithShard(token);\n\n\t// Record everything the parent must now be able to decompress: the child's own generated IDs plus\n\t// whatever the child had previously been synchronized with (this models upward propagation, since\n\t// the child's gen count was advanced past those IDs when it synchronized with its own children).\n\tlet parentSynced = state.synchronizedIds.get(parent);\n\tif (parentSynced === undefined) {\n\t\tparentSynced = new Set();\n\t\tstate.synchronizedIds.set(parent, parentSynced);\n\t}\n\tfor (const id of state.compressorGeneratedIds.get(child) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\tfor (const id of state.synchronizedIds.get(child) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\n\treturn state;\n}\n\n/**\n * Handles an ID generation operation.\n * Generates a new ID and checks for collisions in both local ID space and stable ID space.\n * Fails immediately if a collision is detected.\n */\nfunction handleGenerateId(\n\tstate: ShardingFuzzTestState,\n\top: GenerateIdOperation,\n): ShardingFuzzTestState {\n\tconst { compressor } = op;\n\n\tif (!state.activeCompressors.has(compressor)) {\n\t\tthrow new Error(\"Attempting to generate ID from disposed/inactive compressor\");\n\t}\n\n\tconst localId = compressor.generateCompressedId();\n\n\tif (state.globalLocalIds.has(localId)) {\n\t\tthrow new Error(\n\t\t\t`Local ID collision detected! ID ${localId} was already generated by another compressor.`,\n\t\t);\n\t}\n\tstate.globalLocalIds.add(localId);\n\n\tconst stableId = compressor.decompress(localId);\n\tif (state.globalStableIds.has(stableId)) {\n\t\tthrow new Error(\n\t\t\t`Stable ID collision detected! Stable ID ${stableId} (from local ID ${localId}) was already generated.`,\n\t\t);\n\t}\n\tstate.globalStableIds.add(stableId);\n\n\t// Track this ID for this compressor (compressor is always in the map when active)\n\tstate.compressorGeneratedIds.get(compressor)?.push(localId);\n\n\treturn state;\n}\n\n/**\n * Handles a validation operation.\n * For each compressor, verifies it can decompress all IDs in the range from -1 to its last generated ID.\n */\nfunction handleValidate(state: ShardingFuzzTestState): ShardingFuzzTestState {\n\tfor (const compressor of state.activeCompressors) {\n\t\tconst idsGenerated = state.compressorGeneratedIds.get(compressor);\n\t\tconst lastId = idsGenerated?.at(-1);\n\t\tif (lastId === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Local IDs are negative, so we iterate from -1 down to lastId (e.g., -20)\n\t\tfor (let id = -1; id >= lastId; id--) {\n\t\t\tconst localId = id as SessionSpaceCompressedId;\n\n\t\t\tif (!state.globalLocalIds.has(localId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst stableId = compressor.decompress(localId);\n\t\t\t\tif (!state.globalStableIds.has(stableId)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Validation failed: Compressor decompressed ID ${localId} to unknown stable ID ${stableId}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Validation failed: Compressor could not decompress ID ${localId} (last generated: ${lastId}): ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Every compressor must be able to decompress all IDs it has been synchronized with.\n\tfor (const compressor of state.activeCompressors) {\n\t\tconst syncedIds = state.synchronizedIds.get(compressor);\n\t\tif (syncedIds === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const localId of syncedIds) {\n\t\t\ttry {\n\t\t\t\tconst stableId = compressor.decompress(localId);\n\t\t\t\tif (!state.globalStableIds.has(stableId)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Validation failed: Compressor decompressed synchronized ID ${localId} to unknown stable ID ${stableId}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Validation failed: Compressor could not decompress synchronized ID ${localId}: ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Performs fuzz testing of sharding operations on an ID compressor.\n * @param generator - The operation generator\n * @param rootCompressor - The initial compressor to start the tree\n * @param seed - Random seed for reproducibility\n */\nfunction performShardingFuzzActions(\n\tgenerator: Generator<ShardingOperation, ShardingFuzzTestState>,\n\trootCompressor: IdCompressor,\n\tseed: number,\n): void {\n\tconst random = makeRandom(seed);\n\n\tconst initialState: ShardingFuzzTestState = {\n\t\trandom,\n\t\trootCompressor,\n\t\tparentMap: new Map([[rootCompressor, undefined]]),\n\t\tchildrenMap: new Map([[rootCompressor, new Set()]]),\n\t\tactiveCompressors: new Set([rootCompressor]),\n\t\tleafCompressors: new Set([rootCompressor]),\n\t\tcompressorGeneratedIds: new Map([[rootCompressor, []]]),\n\t\tsynchronizedIds: new Map([[rootCompressor, new Set()]]),\n\t\tglobalLocalIds: new Set(),\n\t\tglobalStableIds: new Set(),\n\t};\n\n\tconst handlers = {\n\t\tshard: handleShard,\n\t\tunshard: handleUnshard,\n\t\tsynchronize: handleSynchronize,\n\t\tgenerateId: handleGenerateId,\n\t\tvalidateSharding: handleValidate,\n\t};\n\n\tperformFuzzActionsBase(generator, handlers, initialState);\n}\n\ndescribe(\"IdCompressor Sharding Fuzz Tests\", () => {\n\tit(\"small fuzz test - basic correctness\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\tconst generator = take(\n\t\t\t200,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 2,\n\t\t\t\tunshardWeight: 2,\n\t\t\t\tgenerateIdWeight: 10,\n\t\t\t\tvalidateInterval: 50,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 42);\n\t});\n\n\tit(\"balanced fuzz test - equal sharding and unsharding\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\tconst generator = take(\n\t\t\t1000,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 3,\n\t\t\t\tunshardWeight: 3,\n\t\t\t\tgenerateIdWeight: 20,\n\t\t\t\tvalidateInterval: 100,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 123);\n\t});\n\n\tit(\"large and deep fuzz test - heavy ID generation with deep sharding\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\tconst generator = take(\n\t\t\t5000,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 2,\n\t\t\t\tunshardWeight: 10,\n\t\t\t\tgenerateIdWeight: 20,\n\t\t\t\tvalidateInterval: 200,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 456);\n\t});\n\n\tit(\"synchronization-heavy fuzz test - long-lived deep shards synchronized upward\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\t// High shard and low unshard weights keep trees deep and shards long-lived, while the high\n\t\t// synchronize weight drives many repeated, multi-ancestor synchronization steps.\n\t\tconst generator = take(\n\t\t\t3000,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 5,\n\t\t\t\tunshardWeight: 1,\n\t\t\t\tsynchronizeWeight: 15,\n\t\t\t\tgenerateIdWeight: 20,\n\t\t\t\tvalidateInterval: 100,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 789);\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"sharding.fuzz.spec.js","sourceRoot":"","sources":["../../src/test/sharding.fuzz.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,MAAM,EACN,IAAI,GACJ,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EA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ACrB,IAAI,EACJ,uBAAuB,CAAC;YACvB,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;YAChB,iBAAiB,EAAE,EAAE;YACrB,gBAAgB,EAAE,EAAE;YACpB,gBAAgB,EAAE,GAAG;SACrB,CAAC,CACF,CAAC;QACF,0BAA0B,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype BaseFuzzTestState,\n\ttype Generator,\n\tcreateWeightedGenerator,\n\tinterleave,\n\tmakeRandom,\n\tperformFuzzActions as performFuzzActionsBase,\n\trepeat,\n\ttake,\n} from \"@fluid-private/stochastic-test-utils\";\n\nimport { IdCompressor } from \"../idCompressor.js\";\nimport type { SessionSpaceCompressedId, StableId } from \"../index.js\";\nimport { SerializationVersion } from \"../types/index.js\";\nimport { createSessionId } from \"../utilities.js\";\n\n/**\n * State for sharding fuzz tests.\n * Tracks a tree of compressors and all generated IDs for collision detection and validation.\n */\ninterface ShardingFuzzTestState extends BaseFuzzTestState {\n\t/** The root compressor that started the tree */\n\trootCompressor: IdCompressor;\n\t/** Map from compressor to its parent (undefined for root) */\n\tparentMap: Map<IdCompressor, IdCompressor | undefined>;\n\t/** Map from compressor to its children */\n\tchildrenMap: Map<IdCompressor, Set<IdCompressor>>;\n\t/** All active compressors (not disposed) */\n\tactiveCompressors: Set<IdCompressor>;\n\t/** Leaf compressors that can be unsharded */\n\tleafCompressors: Set<IdCompressor>;\n\t/** Map from compressor to all local IDs it has generated */\n\tcompressorGeneratedIds: Map<IdCompressor, SessionSpaceCompressedId[]>;\n\t/**\n\t * Map from compressor to the set of local IDs it has been synchronized with (and so must be able\n\t * to decompress) but did not itself generate. Populated by synchronize operations.\n\t */\n\tsynchronizedIds: Map<IdCompressor, Set<SessionSpaceCompressedId>>;\n\t/** Global set of all generated local IDs for collision detection */\n\tglobalLocalIds: Set<SessionSpaceCompressedId>;\n\t/** Global set of all decompressed stable IDs for collision detection */\n\tglobalStableIds: Set<StableId>;\n}\n\n/**\n * Operation to shard a compressor into multiple child shards.\n */\ninterface ShardOperation {\n\ttype: \"shard\";\n\tcompressor: IdCompressor;\n\tnumShards: number;\n}\n\n/**\n * Operation to unshard a leaf compressor back into its parent.\n */\ninterface UnshardOperation {\n\ttype: \"unshard\";\n\tleaf: IdCompressor;\n}\n\n/**\n * Operation to synchronize a child shard's progress into its parent without disposing the child.\n */\ninterface SynchronizeOperation {\n\ttype: \"synchronize\";\n\tchild: IdCompressor;\n}\n\n/**\n * Operation to generate a new compressed ID.\n */\ninterface GenerateIdOperation {\n\ttype: \"generateId\";\n\tcompressor: IdCompressor;\n}\n\n/**\n * Operation to validate the current state of all compressors.\n */\ninterface ValidateShardingOperation {\n\ttype: \"validateSharding\";\n}\n\ntype ShardingOperation =\n\t| ShardOperation\n\t| UnshardOperation\n\t| SynchronizeOperation\n\t| GenerateIdOperation\n\t| ValidateShardingOperation;\n\n/**\n * Generates a shard operation targeting a random active compressor.\n */\nfunction shardGenerator(state: ShardingFuzzTestState): ShardOperation {\n\tconst compressor = state.random.pick([...state.activeCompressors]);\n\tconst numShards = state.random.integer(1, 3);\n\treturn {\n\t\ttype: \"shard\",\n\t\tcompressor,\n\t\tnumShards,\n\t};\n}\n\n/**\n * Generates an unshard operation targeting a random leaf compressor.\n * If there are no leaves (only root), returns a no-op operation.\n */\nfunction unshardGenerator(state: ShardingFuzzTestState): UnshardOperation {\n\tconst leaves = [...state.leafCompressors];\n\t// Filter out root - it can't be unsharded\n\tconst unshardableLeaves = leaves.filter((l) => l !== state.rootCompressor);\n\n\tif (unshardableLeaves.length === 0) {\n\t\t// No-op: target root which will be filtered out in handler\n\t\treturn {\n\t\t\ttype: \"unshard\",\n\t\t\tleaf: state.rootCompressor,\n\t\t};\n\t}\n\n\tconst leaf = state.random.pick(unshardableLeaves);\n\treturn {\n\t\ttype: \"unshard\",\n\t\tleaf,\n\t};\n}\n\n/**\n * Generates a synchronize operation targeting a random non-root active compressor.\n * The selected compressor's parent will be synchronized with it.\n * If there are no non-root compressors, returns a no-op targeting the root (filtered out in the handler).\n */\nfunction synchronizeGenerator(state: ShardingFuzzTestState): SynchronizeOperation {\n\tconst children = [...state.activeCompressors].filter((c) => c !== state.rootCompressor);\n\tif (children.length === 0) {\n\t\t// No-op: target root which will be filtered out in the handler.\n\t\treturn {\n\t\t\ttype: \"synchronize\",\n\t\t\tchild: state.rootCompressor,\n\t\t};\n\t}\n\treturn {\n\t\ttype: \"synchronize\",\n\t\tchild: state.random.pick(children),\n\t};\n}\n\n/**\n * Generates an operation to generate a new ID from a random compressor.\n */\nfunction generateIdGenerator(state: ShardingFuzzTestState): GenerateIdOperation {\n\tconst compressor = state.random.pick([...state.activeCompressors]);\n\treturn {\n\t\ttype: \"generateId\",\n\t\tcompressor,\n\t};\n}\n\n/**\n * Generates a validation operation.\n */\nfunction validateGenerator(): ValidateShardingOperation {\n\treturn { type: \"validateSharding\" };\n}\n\n/**\n * Configuration for the sharding operation generator.\n */\ninterface ShardingOpGeneratorConfig {\n\t/** Weight for shard operations (default: 3) */\n\tshardWeight?: number;\n\t/** Weight for unshard operations (default: 3) */\n\tunshardWeight?: number;\n\t/** Weight for synchronize operations (default: 5) */\n\tsynchronizeWeight?: number;\n\t/** Weight for ID generation operations (default: 20) */\n\tgenerateIdWeight?: number;\n\t/** How often to inject validation operations (default: every 100 ops) */\n\tvalidateInterval?: number;\n}\n\n/**\n * Creates a weighted generator for sharding fuzz test operations.\n */\nfunction makeShardingOpGenerator(\n\tconfig: ShardingOpGeneratorConfig,\n): Generator<ShardingOperation, ShardingFuzzTestState> {\n\tconst {\n\t\tshardWeight = 3,\n\t\tunshardWeight = 3,\n\t\tsynchronizeWeight = 5,\n\t\tgenerateIdWeight = 20,\n\t\tvalidateInterval = 100,\n\t} = config;\n\n\treturn interleave(\n\t\tcreateWeightedGenerator<ShardingOperation, ShardingFuzzTestState>([\n\t\t\t[shardGenerator, shardWeight],\n\t\t\t[unshardGenerator, unshardWeight],\n\t\t\t[synchronizeGenerator, synchronizeWeight],\n\t\t\t[generateIdGenerator, generateIdWeight],\n\t\t]),\n\t\ttake(1, repeat<ShardingOperation, ShardingFuzzTestState>(validateGenerator())),\n\t\tvalidateInterval,\n\t);\n}\n\n/**\n * Handles a shard operation by creating new child shards and updating the tree structure.\n */\nfunction handleShard(state: ShardingFuzzTestState, op: ShardOperation): ShardingFuzzTestState {\n\tconst { compressor, numShards } = op;\n\n\tlet serializedShards: ReturnType<IdCompressor[\"shard\"]>;\n\ttry {\n\t\tserializedShards = compressor.shard(numShards);\n\t} catch (error) {\n\t\t// Sharding multiplies the stride; once it would exceed the supported maximum, shard() throws\n\t\t// before mutating any state. This is expected for sufficiently deep trees, so treat it as a no-op.\n\t\tif (error instanceof Error && error.message === \"Sharding limit reached.\") {\n\t\t\treturn state;\n\t\t}\n\t\tthrow error;\n\t}\n\n\tfor (const { serialized } of serializedShards) {\n\t\tconst shard = IdCompressor.deserialize({\n\t\t\tserialized,\n\t\t\trequestedWriteVersion: SerializationVersion.V3,\n\t\t});\n\n\t\t// Update tree structure\n\t\tstate.parentMap.set(shard, compressor);\n\n\t\tlet children = state.childrenMap.get(compressor);\n\t\tif (children === undefined) {\n\t\t\tchildren = new Set();\n\t\t\tstate.childrenMap.set(compressor, children);\n\t\t}\n\t\tchildren.add(shard);\n\n\t\tstate.childrenMap.set(shard, new Set());\n\t\tstate.activeCompressors.add(shard);\n\t\tstate.leafCompressors.add(shard);\n\t\tstate.compressorGeneratedIds.set(shard, []);\n\t\tstate.synchronizedIds.set(shard, new Set());\n\t}\n\n\t// Parent is no longer a leaf after sharding\n\tstate.leafCompressors.delete(compressor);\n\n\treturn state;\n}\n\n/**\n * Handles an unshard operation by disposing a leaf and merging it back into its parent.\n * No-op if the target is the root or not a leaf.\n */\nfunction handleUnshard(\n\tstate: ShardingFuzzTestState,\n\top: UnshardOperation,\n): ShardingFuzzTestState {\n\tconst { leaf } = op;\n\n\t// Can't unshard root or non-leaves\n\tif (leaf === state.rootCompressor || !state.leafCompressors.has(leaf)) {\n\t\treturn state;\n\t}\n\n\tconst parent = state.parentMap.get(leaf);\n\tif (parent === undefined) {\n\t\treturn state;\n\t}\n\n\tconst disposalToken = leaf.disposeShard();\n\tif (disposalToken === undefined) {\n\t\treturn state;\n\t}\n\n\tparent.synchronizeWithShard(disposalToken);\n\n\t// Update tree structure\n\tconst siblings = state.childrenMap.get(parent);\n\tif (siblings !== undefined) {\n\t\tsiblings.delete(leaf);\n\n\t\t// If parent has no more children, it becomes a leaf\n\t\tif (siblings.size === 0) {\n\t\t\tstate.leafCompressors.add(parent);\n\t\t}\n\t}\n\n\t// The disposed leaf's IDs become the parent's responsibility to decompress.\n\tconst parentSynced = state.synchronizedIds.get(parent) ?? new Set();\n\tfor (const id of state.compressorGeneratedIds.get(leaf) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\tfor (const id of state.synchronizedIds.get(leaf) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\tstate.synchronizedIds.set(parent, parentSynced);\n\n\tstate.parentMap.delete(leaf);\n\tstate.childrenMap.delete(leaf);\n\tstate.activeCompressors.delete(leaf);\n\tstate.leafCompressors.delete(leaf);\n\tstate.compressorGeneratedIds.delete(leaf);\n\tstate.synchronizedIds.delete(leaf);\n\n\treturn state;\n}\n\n/**\n * Handles a synchronize operation by synchronizing a child's parent with the child's current progress,\n * without disposing the child. After this, the parent must be able to decompress every ID the child has\n * generated (and every ID the child had itself been synchronized with) up to this point.\n * No-op if the target is the root or is otherwise no longer eligible.\n */\nfunction handleSynchronize(\n\tstate: ShardingFuzzTestState,\n\top: SynchronizeOperation,\n): ShardingFuzzTestState {\n\tconst { child } = op;\n\n\tif (child === state.rootCompressor || !state.activeCompressors.has(child)) {\n\t\treturn state;\n\t}\n\n\tconst parent = state.parentMap.get(child);\n\tif (parent === undefined || !state.activeCompressors.has(parent)) {\n\t\treturn state;\n\t}\n\n\tconst token = child.getShardSyncToken();\n\tif (token === undefined) {\n\t\treturn state;\n\t}\n\n\tparent.synchronizeWithShard(token);\n\n\t// Record everything the parent must now be able to decompress: the child's own generated IDs plus\n\t// whatever the child had previously been synchronized with (this models upward propagation, since\n\t// the child's gen count was advanced past those IDs when it synchronized with its own children).\n\tlet parentSynced = state.synchronizedIds.get(parent);\n\tif (parentSynced === undefined) {\n\t\tparentSynced = new Set();\n\t\tstate.synchronizedIds.set(parent, parentSynced);\n\t}\n\tfor (const id of state.compressorGeneratedIds.get(child) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\tfor (const id of state.synchronizedIds.get(child) ?? []) {\n\t\tparentSynced.add(id);\n\t}\n\n\treturn state;\n}\n\n/**\n * Handles an ID generation operation.\n * Generates a new ID and checks for collisions in both local ID space and stable ID space.\n * Fails immediately if a collision is detected.\n */\nfunction handleGenerateId(\n\tstate: ShardingFuzzTestState,\n\top: GenerateIdOperation,\n): ShardingFuzzTestState {\n\tconst { compressor } = op;\n\n\tif (!state.activeCompressors.has(compressor)) {\n\t\tthrow new Error(\"Attempting to generate ID from disposed/inactive compressor\");\n\t}\n\n\tconst localId = compressor.generateCompressedId();\n\n\tif (state.globalLocalIds.has(localId)) {\n\t\tthrow new Error(\n\t\t\t`Local ID collision detected! ID ${localId} was already generated by another compressor.`,\n\t\t);\n\t}\n\tstate.globalLocalIds.add(localId);\n\n\tconst stableId = compressor.decompress(localId);\n\tif (state.globalStableIds.has(stableId)) {\n\t\tthrow new Error(\n\t\t\t`Stable ID collision detected! Stable ID ${stableId} (from local ID ${localId}) was already generated.`,\n\t\t);\n\t}\n\tstate.globalStableIds.add(stableId);\n\n\t// Track this ID for this compressor (compressor is always in the map when active)\n\tstate.compressorGeneratedIds.get(compressor)?.push(localId);\n\n\treturn state;\n}\n\n/**\n * Handles a validation operation.\n * For each compressor, verifies it can decompress all IDs in the range from -1 to its last generated ID.\n */\nfunction handleValidate(state: ShardingFuzzTestState): ShardingFuzzTestState {\n\tfor (const compressor of state.activeCompressors) {\n\t\tconst idsGenerated = state.compressorGeneratedIds.get(compressor);\n\t\tconst lastId = idsGenerated?.at(-1);\n\t\tif (lastId === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Local IDs are negative, so we iterate from -1 down to lastId (e.g., -20)\n\t\tfor (let id = -1; id >= lastId; id--) {\n\t\t\tconst localId = id as SessionSpaceCompressedId;\n\n\t\t\tif (!state.globalLocalIds.has(localId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst stableId = compressor.decompress(localId);\n\t\t\t\tif (!state.globalStableIds.has(stableId)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Validation failed: Compressor decompressed ID ${localId} to unknown stable ID ${stableId}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Validation failed: Compressor could not decompress ID ${localId} (last generated: ${lastId}): ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Every compressor must be able to decompress all IDs it has been synchronized with.\n\tfor (const compressor of state.activeCompressors) {\n\t\tconst syncedIds = state.synchronizedIds.get(compressor);\n\t\tif (syncedIds === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\tfor (const localId of syncedIds) {\n\t\t\ttry {\n\t\t\t\tconst stableId = compressor.decompress(localId);\n\t\t\t\tif (!state.globalStableIds.has(stableId)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Validation failed: Compressor decompressed synchronized ID ${localId} to unknown stable ID ${stableId}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Validation failed: Compressor could not decompress synchronized ID ${localId}: ${error}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Performs fuzz testing of sharding operations on an ID compressor.\n * @param generator - The operation generator\n * @param rootCompressor - The initial compressor to start the tree\n * @param seed - Random seed for reproducibility\n */\nfunction performShardingFuzzActions(\n\tgenerator: Generator<ShardingOperation, ShardingFuzzTestState>,\n\trootCompressor: IdCompressor,\n\tseed: number,\n): void {\n\tconst random = makeRandom(seed);\n\n\tconst initialState: ShardingFuzzTestState = {\n\t\trandom,\n\t\trootCompressor,\n\t\tparentMap: new Map([[rootCompressor, undefined]]),\n\t\tchildrenMap: new Map([[rootCompressor, new Set()]]),\n\t\tactiveCompressors: new Set([rootCompressor]),\n\t\tleafCompressors: new Set([rootCompressor]),\n\t\tcompressorGeneratedIds: new Map([[rootCompressor, []]]),\n\t\tsynchronizedIds: new Map([[rootCompressor, new Set()]]),\n\t\tglobalLocalIds: new Set(),\n\t\tglobalStableIds: new Set(),\n\t};\n\n\tconst handlers = {\n\t\tshard: handleShard,\n\t\tunshard: handleUnshard,\n\t\tsynchronize: handleSynchronize,\n\t\tgenerateId: handleGenerateId,\n\t\tvalidateSharding: handleValidate,\n\t};\n\n\tperformFuzzActionsBase(generator, handlers, initialState);\n}\n\ndescribe(\"IdCompressor Sharding Fuzz Tests\", () => {\n\tit(\"small fuzz test - basic correctness\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\tconst generator = take(\n\t\t\t200,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 2,\n\t\t\t\tunshardWeight: 2,\n\t\t\t\tgenerateIdWeight: 10,\n\t\t\t\tvalidateInterval: 50,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 42);\n\t});\n\n\tit(\"balanced fuzz test - equal sharding and unsharding\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\tconst generator = take(\n\t\t\t1000,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 3,\n\t\t\t\tunshardWeight: 3,\n\t\t\t\tgenerateIdWeight: 20,\n\t\t\t\tvalidateInterval: 100,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 123);\n\t});\n\n\tit(\"large and deep fuzz test - heavy ID generation with deep sharding\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\tconst generator = take(\n\t\t\t5000,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 2,\n\t\t\t\tunshardWeight: 10,\n\t\t\t\tgenerateIdWeight: 20,\n\t\t\t\tvalidateInterval: 200,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 456);\n\t});\n\n\tit(\"synchronization-heavy fuzz test - long-lived deep shards synchronized upward\", () => {\n\t\tconst sessionId = createSessionId();\n\t\tconst root = new IdCompressor(sessionId, undefined, SerializationVersion.V3);\n\t\t// High shard and low unshard weights keep trees deep and shards long-lived, while the high\n\t\t// synchronize weight drives many repeated, multi-ancestor synchronization steps.\n\t\tconst generator = take(\n\t\t\t3000,\n\t\t\tmakeShardingOpGenerator({\n\t\t\t\tshardWeight: 5,\n\t\t\t\tunshardWeight: 1,\n\t\t\t\tsynchronizeWeight: 15,\n\t\t\t\tgenerateIdWeight: 20,\n\t\t\t\tvalidateInterval: 100,\n\t\t\t}),\n\t\t);\n\t\tperformShardingFuzzActions(generator, root, 789);\n\t});\n});\n"]}
|