From 0b4889bd1cbbf96538496ce7b350f67eef73465c Mon Sep 17 00:00:00 2001 From: Tony Murphy Date: Thu, 25 Mar 2021 11:03:18 -0700 Subject: [PATCH] Add Assert Shortcodes (#5619) Now that the automation is coming together this change will apply the first set of shortcodes related to #5409 #5529 #5552 --- common/lib/common-utils/src/bufferBrowser.ts | 4 +- .../lib/common-utils/src/hashFileBrowser.ts | 2 +- common/lib/common-utils/src/rangeTracker.ts | 17 +- common/lib/common-utils/src/timer.ts | 4 +- lerna-package-lock.json | 170 +++++++++- package-lock.json | 291 +++++++++++++++--- package.json | 2 +- packages/dds/cell/src/cell.ts | 2 +- packages/dds/map/src/directory.ts | 12 +- packages/dds/map/src/mapKernel.ts | 8 +- packages/dds/matrix/src/handlecache.ts | 4 +- packages/dds/matrix/src/matrix.ts | 24 +- packages/dds/matrix/src/permutationvector.ts | 12 +- packages/dds/matrix/src/undoprovider.ts | 6 +- packages/dds/merge-tree/src/client.ts | 40 +-- packages/dds/merge-tree/src/mergeTree.ts | 40 +-- packages/dds/merge-tree/src/partialLengths.ts | 17 +- .../src/segmentPropertiesManager.ts | 3 +- packages/dds/merge-tree/src/snapshotLoader.ts | 12 +- packages/dds/merge-tree/src/snapshotV1.ts | 4 +- packages/dds/merge-tree/src/snapshotlegacy.ts | 4 +- .../src/consensusOrderedCollection.ts | 8 +- .../src/snapshotableArray.ts | 2 +- .../src/consensusRegisterCollection.ts | 14 +- packages/dds/sequence/src/sequence.ts | 6 +- .../shared-object-base/src/sharedObject.ts | 13 +- packages/dds/task-manager/src/taskManager.ts | 14 +- .../debugger/src/fluidDebuggerController.ts | 16 +- .../drivers/debugger/src/fluidDebuggerUi.ts | 2 +- packages/drivers/debugger/src/sanitizer.ts | 10 +- .../src/documentDeltaConnection.ts | 6 +- .../src/fileDeltaStorageService.ts | 2 +- .../src/fileDocumentStorageService.ts | 11 +- .../src/urlResolver.ts | 2 +- .../src/innerDocumentServiceFactory.ts | 2 +- .../iframe-driver/src/innerUrlResolver.ts | 2 +- .../drivers/local-driver/src/localResolver.ts | 2 +- .../drivers/odsp-driver/src/epochTracker.ts | 10 +- .../src/odspDocumentDeltaConnection.ts | 8 +- .../odsp-driver/src/odspDocumentService.ts | 2 +- .../src/odspDocumentStorageManager.ts | 8 +- .../odsp-driver/src/odspDriverUrlResolver.ts | 2 +- .../src/odspSummaryUploadManager.ts | 10 +- .../drivers/odsp-driver/src/rateLimiter.ts | 2 +- .../src/replayDocumentDeltaConnection.ts | 2 +- .../src/storageImplementations.ts | 2 +- .../src/documentService.ts | 2 +- .../src/documentServiceFactory.ts | 2 +- .../src/documentStorageService.ts | 8 +- .../routerlicious-host/src/urlResolver.ts | 5 +- .../src/urlResolver.ts | 6 +- .../src/data-objects/pureDataObject.ts | 7 +- .../map/sharedDirectoryWithInterception.ts | 2 +- .../src/map/sharedMapWithInterception.ts | 2 +- .../sequence/sharedStringWithInterception.ts | 18 +- .../sharedDirectoryWithInterception.spec.ts | 2 +- .../test/sharedMapWithInterception.spec.ts | 2 +- .../test/sharedStringWithInterception.spec.ts | 2 +- .../request-handler/src/requestHandlers.ts | 2 +- packages/hosts/base-host/src/host.ts | 4 +- .../loader/container-loader/src/container.ts | 34 +- .../container-loader/src/containerContext.ts | 2 +- .../container-loader/src/deltaManager.ts | 42 +-- .../loader/container-loader/src/deltaQueue.ts | 2 +- packages/loader/container-utils/src/error.ts | 2 +- .../src/blobAggregationStorage.ts | 23 +- .../driver-utils/src/buildSnapshotTree.ts | 2 +- .../driver-utils/src/parallelRequests.ts | 41 +-- .../runtime/agent-scheduler/src/scheduler.ts | 19 +- .../container-runtime/src/blobManager.ts | 2 +- .../src/connectionTelemetry.ts | 3 +- .../container-runtime/src/containerRuntime.ts | 50 +-- .../container-runtime/src/dataStoreContext.ts | 65 ++-- .../src/dataStoreContexts.ts | 13 +- .../container-runtime/src/dataStores.ts | 26 +- .../src/pendingStateManager.ts | 25 +- .../src/summaryCollection.ts | 5 +- .../datastore/src/channelDeltaConnection.ts | 4 +- .../runtime/datastore/src/dataStoreRuntime.ts | 36 ++- .../datastore/src/localChannelContext.ts | 25 +- .../datastore/src/remoteChannelContext.ts | 8 +- .../runtime/garbage-collector/src/utils.ts | 4 +- .../runtime-utils/src/dataStoreHelpers.ts | 4 +- .../src/objectstoragepartition.ts | 2 +- .../runtime-utils/src/remoteObjectHandle.ts | 2 +- .../src/summarizerNode/summarizerNode.ts | 35 ++- .../src/summarizerNode/summarizerNodeUtils.ts | 4 +- .../summarizerNode/summarizerNodeWithGc.ts | 15 +- .../runtime/runtime-utils/src/summaryUtils.ts | 3 +- .../fetch-tool/src/fluidAnalyzeMessages.ts | 4 +- .../fetch-tool/src/fluidFetchMessages.ts | 10 +- .../fetch-tool/src/fluidFetchSnapshot.ts | 8 +- .../src/clientReplayTool.ts | 6 +- packages/tools/replay-tool/src/helpers.ts | 3 +- .../tools/replay-tool/src/replayMessages.ts | 17 +- .../packages/protocol-base/src/quorum.ts | 12 +- 96 files changed, 937 insertions(+), 521 deletions(-) diff --git a/common/lib/common-utils/src/bufferBrowser.ts b/common/lib/common-utils/src/bufferBrowser.ts index d4bc32e48b42..06d8f4769900 100644 --- a/common/lib/common-utils/src/bufferBrowser.ts +++ b/common/lib/common-utils/src/bufferBrowser.ts @@ -93,8 +93,8 @@ export class IsoBuffer extends Uint8Array { // Capture any typed arrays, including Uint8Array (and thus - IsoBuffer!) } else if (value !== null && typeof value === "object" && isArrayBuffer(value.buffer)) { // Support currently for full array, no view ports! (though it can be added in future) - assert(value.byteOffset === 0, "nonzero isobuffer byte offset"); - assert(value.byteLength === value.buffer.byteLength, "unexpected isobuffer byte length"); + assert(value.byteOffset === 0, 0x000 /* "nonzero isobuffer byte offset" */); + assert(value.byteLength === value.buffer.byteLength, 0x001 /* "unexpected isobuffer byte length" */); return IsoBuffer.fromArrayBuffer(value.buffer, encodingOrOffset as number | undefined, length); } else if (isArrayBuffer(value)) { return IsoBuffer.fromArrayBuffer(value, encodingOrOffset as number | undefined, length); diff --git a/common/lib/common-utils/src/hashFileBrowser.ts b/common/lib/common-utils/src/hashFileBrowser.ts index 8c71d94fd8e8..ce120d9ecc14 100644 --- a/common/lib/common-utils/src/hashFileBrowser.ts +++ b/common/lib/common-utils/src/hashFileBrowser.ts @@ -31,7 +31,7 @@ export function setInsecureContextHashFn(hashFn: (f: IsoBuffer) => Promise { // Use the function override if provided if (insecureContextHashFn !== undefined) { - assert(crypto.subtle === undefined, "Both crypto.subtle and insecureContextHashFn are defined!"); + assert(crypto.subtle === undefined, 0x002 /* "Both crypto.subtle and insecureContextHashFn are defined!" */); return insecureContextHashFn(file); } diff --git a/common/lib/common-utils/src/rangeTracker.ts b/common/lib/common-utils/src/rangeTracker.ts index 943941c4ebdc..ecefdc07c282 100644 --- a/common/lib/common-utils/src/rangeTracker.ts +++ b/common/lib/common-utils/src/rangeTracker.ts @@ -93,9 +93,9 @@ export class RangeTracker { public add(primary: number, secondary: number) { // Both values must continuously be increasing - we won't always track the last value we saw so we do so // below to check invariants - assert(primary >= this.lastPrimary, "Primary to add to range < last primary!"); + assert(primary >= this.lastPrimary, 0x003 /* "Primary to add to range < last primary!" */); if (this.lastSecondary !== undefined) { - assert(secondary >= this.lastSecondary, "Secondary to add to range < last secondary!"); + assert(secondary >= this.lastSecondary, 0x004 /* "Secondary to add to range < last secondary!" */); } this.lastPrimary = primary; this.lastSecondary = secondary; @@ -140,7 +140,7 @@ export class RangeTracker { * @returns the closest range to the primary */ public get(primary: number): number { - assert(primary >= this.ranges[0].primary, "Target primary to retrieve < first range's primary!"); + assert(primary >= this.ranges[0].primary, 0x005 /* "Target primary to retrieve < first range's primary!" */); // Find the first range where the starting position is greater than the primary. Our target range is // the one before it. @@ -150,7 +150,8 @@ export class RangeTracker { break; } } - assert(primary >= this.ranges[index - 1].primary, "Target primary to retrieve < last range's primary!"); + assert(primary >= this.ranges[index - 1].primary, + 0x006 /* "Target primary to retrieve < last range's primary!" */); // If the difference is within the stored range use it - otherwise add in the length - 1 as the highest // stored secondary value to use. @@ -164,7 +165,7 @@ export class RangeTracker { * @param primary - the primary value to update */ public updateBase(primary: number) { - assert(primary >= this.ranges[0].primary, "Target primary to update < first range's primary!"); + assert(primary >= this.ranges[0].primary, 0x007 /* "Target primary to update < first range's primary!" */); // Walk the ranges looking for the first one that is greater than the primary. Primary is then within the // previous index by definition (since it's less than the current index's primary but greather than the @@ -175,7 +176,8 @@ export class RangeTracker { break; } } - assert(primary >= this.ranges[index - 1].primary, "Target primary to update < last range's primary!"); + assert(primary >= this.ranges[index - 1].primary, + 0x008 /* "Target primary to update < last range's primary!" */); // Update the last range values const range = this.ranges[index - 1]; @@ -188,6 +190,7 @@ export class RangeTracker { this.ranges = index - 1 > 0 ? this.ranges.slice(index - 1) : this.ranges; // Assert that the lowest value is now the input to this method - assert(primary === this.ranges[0].primary, "After update, target primary is not first range's primary!"); + assert(primary === this.ranges[0].primary, + 0x009 /* "After update, target primary is not first range's primary!" */); } } diff --git a/common/lib/common-utils/src/timer.ts b/common/lib/common-utils/src/timer.ts index 6f24e2a1a7e7..e9466c2c3cac 100644 --- a/common/lib/common-utils/src/timer.ts +++ b/common/lib/common-utils/src/timer.ts @@ -148,7 +148,7 @@ export class Timer implements ITimer { } private handler() { - assert(!!this.runningState, "Running timer missing handler"); + assert(!!this.runningState, 0x00a /* "Running timer missing handler" */); const restart = this.runningState.restart; if (restart !== undefined) { // Restart with remaining time @@ -222,7 +222,7 @@ export class PromiseTimer implements IPromiseTimer { protected wrapHandler(handler: () => void) { handler(); - assert(!!this.deferred, "Handler executed without deferred"); + assert(!!this.deferred, 0x00b /* "Handler executed without deferred" */); this.deferred.resolve({ timerResult: "timeout" }); this.deferred = undefined; } diff --git a/lerna-package-lock.json b/lerna-package-lock.json index 48413afe52ef..f2142b0b69e2 100644 --- a/lerna-package-lock.json +++ b/lerna-package-lock.json @@ -3096,6 +3096,16 @@ "kuler": "^2.0.0" } }, + "@dsherret/to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-H2R13IvZdM6gei2vOGSzF7HdMyw=", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + } + }, "@endemolshinegroup/cosmiconfig-typescript-loader": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@endemolshinegroup/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-3.0.2.tgz", @@ -3372,9 +3382,9 @@ "integrity": "sha512-m6Jcq7Qzj/xV97o0kV7ctC462bgqhcU0D/vjJi4Ah2gXOJ5+poVDxpXexQCnFWYKJRG3YqhH9OFMcpAX96TbgA==" }, "@fluidframework/build-tools": { - "version": "0.2.19073", - "resolved": "https://registry.npmjs.org/@fluidframework/build-tools/-/build-tools-0.2.19073.tgz", - "integrity": "sha512-JCl/4/g4kdMWDIFLeiWmvmDyWSjh4OtxDCFo8VKWGoz/G6WH09p0K38zlK/H9LdP7SGGBcwKNZP+kBlKmClXrw==", + "version": "0.2.20474", + "resolved": "https://registry.npmjs.org/@fluidframework/build-tools/-/build-tools-0.2.20474.tgz", + "integrity": "sha512-uti0LeAV97Yf3/EDeDxJkuWb3F1jUaQTXWjN8xGjCh+u2le29Y+UgOU+27B9dLJPaOJDA8WFQ/y/wCWLgtXrBA==", "dev": true, "requires": { "@fluidframework/bundle-size-tools": "^0.0.8505", @@ -3393,7 +3403,8 @@ "rimraf": "^2.6.2", "semver": "^7.1.2", "shelljs": "^0.8.4", - "sort-package-json": "1.40.0" + "sort-package-json": "1.40.0", + "ts-morph": "^7.1.2" }, "dependencies": { "commander": { @@ -8233,9 +8244,9 @@ } }, "globby": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", - "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -9456,6 +9467,122 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==" }, + "@ts-morph/common": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.5.2.tgz", + "integrity": "sha512-eLmfYV6u6gUgHrB9QV9lpuWg3cD60mhXdv0jvM5exWR/Cor8HG+GziFIj2hPEWHJknqzuU4meZd8DTqIzZfDRQ==", + "dev": true, + "requires": { + "@dsherret/to-absolute-glob": "^2.0.2", + "fast-glob": "^3.2.2", + "fs-extra": "^9.0.0", + "is-negated-glob": "^1.0.0", + "multimatch": "^4.0.0", + "typescript": "~3.9.7" + }, + "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "typescript": { + "version": "3.9.9", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", + "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", + "dev": true + } + } + }, "@types/anymatch": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", @@ -13637,6 +13764,12 @@ "q": "^1.1.2" } }, + "code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "dev": true + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -15249,9 +15382,9 @@ "integrity": "sha512-JVrozIeElnj3QzfUIt8tB8YMluBJom4Vw9qTPpjGYQ9fYlB3D/rb6OordUxf3xeFB35LKWs0xqcO5U6ySvBtug==" }, "danger": { - "version": "10.6.3", - "resolved": "https://registry.npmjs.org/danger/-/danger-10.6.3.tgz", - "integrity": "sha512-9aLh21tdJGb1CNuuk0xostg2jix8jFQ+CZuC4h38832Wbcaznj+hA8i7E1VPM5d797SIGURdemLvYBlLcgZ4YQ==", + "version": "10.6.4", + "resolved": "https://registry.npmjs.org/danger/-/danger-10.6.4.tgz", + "integrity": "sha512-M8W1wP4SaFQHYwXTP8kgc6D0FPmxT9YJg8U19CjcDYmyAK+iU9R4GlX8lmNkJ+kX19yym5M5hzB0aIbWfVD/1g==", "dev": true, "requires": { "@babel/polyfill": "^7.2.5", @@ -21706,6 +21839,12 @@ "define-properties": "^1.1.3" } }, + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true + }, "is-negative-zero": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", @@ -38310,6 +38449,17 @@ "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.3.tgz", "integrity": "sha512-XvB+OdKSJ708Dmf9ore4Uf/q62AYDTzFcAdxc8KNML1mmAWywRFVt/dn1KYJH8Agt5UJNujfM3znU5PxgAzA2w==" }, + "ts-morph": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-7.3.0.tgz", + "integrity": "sha512-BUKSoz7AFSKPcYTZODbICW2mOthAN4vc5juD6FL1lD/dLwZ0WvrC3zqBM3/X6f5gHxq3yaz+HmanHGaWm0ddbQ==", + "dev": true, + "requires": { + "@dsherret/to-absolute-glob": "^2.0.2", + "@ts-morph/common": "~0.5.2", + "code-block-writer": "^10.1.0" + } + }, "ts-node": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", diff --git a/package-lock.json b/package-lock.json index 54bd5fb028b7..088a0f05e4f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -813,6 +813,16 @@ "kuler": "^2.0.0" } }, + "@dsherret/to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dsherret/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-H2R13IvZdM6gei2vOGSzF7HdMyw=", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + } + }, "@evocateur/libnpmaccess": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz", @@ -932,9 +942,9 @@ } }, "@fluidframework/build-tools": { - "version": "0.2.19073", - "resolved": "https://registry.npmjs.org/@fluidframework/build-tools/-/build-tools-0.2.19073.tgz", - "integrity": "sha512-JCl/4/g4kdMWDIFLeiWmvmDyWSjh4OtxDCFo8VKWGoz/G6WH09p0K38zlK/H9LdP7SGGBcwKNZP+kBlKmClXrw==", + "version": "0.2.20474", + "resolved": "https://registry.npmjs.org/@fluidframework/build-tools/-/build-tools-0.2.20474.tgz", + "integrity": "sha512-uti0LeAV97Yf3/EDeDxJkuWb3F1jUaQTXWjN8xGjCh+u2le29Y+UgOU+27B9dLJPaOJDA8WFQ/y/wCWLgtXrBA==", "dev": true, "requires": { "@fluidframework/bundle-size-tools": "^0.0.8505", @@ -953,15 +963,10 @@ "rimraf": "^2.6.2", "semver": "^7.1.2", "shelljs": "^0.8.4", - "sort-package-json": "1.40.0" + "sort-package-json": "1.40.0", + "ts-morph": "^7.1.2" }, "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "ignore": { "version": "5.1.8", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", @@ -3516,9 +3521,9 @@ } }, "globby": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", - "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz", + "integrity": "sha512-ffdmosjA807y7+lA1NM0jELARVmYul/715xiILEjo3hBLPTcirgQNnXECn5g3mtR8TOLCVbkfua1Hpen25/Xcg==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -4185,6 +4190,122 @@ "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", "dev": true }, + "@ts-morph/common": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.5.2.tgz", + "integrity": "sha512-eLmfYV6u6gUgHrB9QV9lpuWg3cD60mhXdv0jvM5exWR/Cor8HG+GziFIj2hPEWHJknqzuU4meZd8DTqIzZfDRQ==", + "dev": true, + "requires": { + "@dsherret/to-absolute-glob": "^2.0.2", + "fast-glob": "^3.2.2", + "fs-extra": "^9.0.0", + "is-negated-glob": "^1.0.0", + "multimatch": "^4.0.0", + "typescript": "~3.9.7" + }, + "dependencies": { + "@nodelib/fs.stat": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.4.tgz", + "integrity": "sha512-IYlHJA0clt2+Vg7bccq+TzRdJvv19c2INqBSsoOLp1je7xjtr7J26+WXR72MCdvU9q1qTzIWDfhMf+DRvQJK4Q==", + "dev": true + }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fast-glob": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "typescript": { + "version": "3.9.9", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.9.tgz", + "integrity": "sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==", + "dev": true + } + } + }, "@types/argparse": { "version": "1.0.38", "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", @@ -5230,6 +5351,16 @@ } } }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", @@ -5509,6 +5640,12 @@ "shallow-clone": "^3.0.0" } }, + "code-block-writer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", + "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "dev": true + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -5618,6 +5755,12 @@ "delayed-stream": "~1.0.0" } }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -6461,9 +6604,9 @@ "dev": true }, "danger": { - "version": "10.6.3", - "resolved": "https://registry.npmjs.org/danger/-/danger-10.6.3.tgz", - "integrity": "sha512-9aLh21tdJGb1CNuuk0xostg2jix8jFQ+CZuC4h38832Wbcaznj+hA8i7E1VPM5d797SIGURdemLvYBlLcgZ4YQ==", + "version": "10.6.4", + "resolved": "https://registry.npmjs.org/danger/-/danger-10.6.4.tgz", + "integrity": "sha512-M8W1wP4SaFQHYwXTP8kgc6D0FPmxT9YJg8U19CjcDYmyAK+iU9R4GlX8lmNkJ+kX19yym5M5hzB0aIbWfVD/1g==", "dev": true, "requires": { "@babel/polyfill": "^7.2.5", @@ -6504,12 +6647,6 @@ "supports-hyperlinks": "^1.0.1" }, "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "get-stdin": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", @@ -8486,6 +8623,17 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, "get-pkg-repo": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", @@ -9650,6 +9798,16 @@ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "dev": true }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, "is-accessor-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", @@ -9823,6 +9981,12 @@ "define-properties": "^1.1.3" } }, + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=", + "dev": true + }, "is-negative-zero": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", @@ -9879,6 +10043,15 @@ "has": "^1.0.3" } }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "requires": { + "is-unc-path": "^1.0.0" + } + }, "is-ssh": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/is-ssh/-/is-ssh-1.3.1.tgz", @@ -9930,6 +10103,15 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "requires": { + "unc-path-regex": "^0.1.2" + } + }, "is-utf8": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", @@ -13542,9 +13724,9 @@ } }, "queue-microtask": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.2.tgz", - "integrity": "sha512-dB15eXv3p2jDlbOiNLyMabYg1/sXvppd8DP2J3EOCQ0AkuSXCW2tP7mnVouVLJKgUMY6yP0kcQDVpLCN13h4Xg==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true }, "quick-lru": { @@ -14221,9 +14403,9 @@ "dev": true }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -14417,6 +14599,25 @@ } } }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "dependencies": { + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + } + } + }, "signal-exit": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", @@ -16154,6 +16355,17 @@ "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==", "dev": true }, + "ts-morph": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-7.3.0.tgz", + "integrity": "sha512-BUKSoz7AFSKPcYTZODbICW2mOthAN4vc5juD6FL1lD/dLwZ0WvrC3zqBM3/X6f5gHxq3yaz+HmanHGaWm0ddbQ==", + "dev": true, + "requires": { + "@dsherret/to-absolute-glob": "^2.0.2", + "@ts-morph/common": "~0.5.2", + "code-block-writer": "^10.1.0" + } + }, "tslib": { "version": "1.11.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.2.tgz", @@ -16198,9 +16410,9 @@ } }, "typed-rest-client": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.8.1.tgz", - "integrity": "sha512-7JbJFBZZuu3G64u6ksklN1xtVGfqBKiR5MQoTe5oLTi68OyB6pRuuIQCllfK/BdGjQtZYp62rgUOnEYDz4e9Xg==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.8.3.tgz", + "integrity": "sha512-gJoH7RE3trY77Bf5MNezVV+21O/WMmt9ps7w1bjFyLxrQqDymDWJSDacem1eM6R86zFM0FlE07F8dOupLmKLmQ==", "dev": true, "requires": { "qs": "^6.9.1", @@ -16209,10 +16421,13 @@ }, "dependencies": { "qs": { - "version": "6.9.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", - "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", - "dev": true + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "dev": true, + "requires": { + "side-channel": "^1.0.4" + } } } }, @@ -16283,6 +16498,12 @@ "integrity": "sha1-8pzr8B31F5ErtY/5xOUP3o4zMg0=", "dev": true }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true + }, "underscore": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", diff --git a/package.json b/package.json index 9ad9022ca12c..2fbe93b36555 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "temp-directory": "nyc/.nyc_output" }, "devDependencies": { - "@fluidframework/build-tools": "^0.2.19073", + "@fluidframework/build-tools": "^0.2.20474", "@fluidframework/test-tools": "^0.2.3074", "@microsoft/api-documenter": "^7.12.7", "@microsoft/api-extractor": "^7.13.1", diff --git a/packages/dds/cell/src/cell.ts b/packages/dds/cell/src/cell.ts index 3fd0166d54ce..46e4de17d1d4 100644 --- a/packages/dds/cell/src/cell.ts +++ b/packages/dds/cell/src/cell.ts @@ -283,7 +283,7 @@ export class SharedCell extends SharedObject implem protected reSubmitCore(content: any, localOpMetadata: unknown) { const message = content as IDirectoryOperation; const handler = this.messageHandlers.get(message.type); - assert(handler !== undefined, `Missing message handler for message type: ${message.type}`); + assert(handler !== undefined, 0x00d /* `Missing message handler for message type: ${message.type}` */); handler.submit(message, localOpMetadata); } @@ -744,7 +744,7 @@ export class SharedDirectory extends SharedObject implem if (message.type === MessageType.Operation) { const op: IDirectoryOperation = message.contents as IDirectoryOperation; const handler = this.messageHandlers.get(op.type); - assert(handler !== undefined, `Missing message handler for message type: ${message.type}`); + assert(handler !== undefined, 0x00e /* `Missing message handler for message type: ${message.type}` */); handler.process(op, local, message, localOpMetadata); } } @@ -1278,7 +1278,7 @@ class SubDirectory extends TypedEventEmitter implements IDirec ): void { if (local) { assert(localOpMetadata !== undefined, - `pendingMessageId is missing from the local client's ${op.type} operation`); + 0x00f /* `pendingMessageId is missing from the local client's ${op.type} operation` */); const pendingMessageId = localOpMetadata as number; if (this.pendingClearMessageId === pendingMessageId) { this.pendingClearMessageId = -1; @@ -1485,7 +1485,7 @@ class SubDirectory extends TypedEventEmitter implements IDirec if (this.pendingClearMessageId !== -1) { if (local) { assert(localOpMetadata !== undefined && localOpMetadata as number < this.pendingClearMessageId, - "Received out of order storage op when there is an unackd clear message"); + 0x010 /* "Received out of order storage op when there is an unackd clear message" */); } // If I have a NACK clear, we can ignore all ops. return false; @@ -1496,7 +1496,7 @@ class SubDirectory extends TypedEventEmitter implements IDirec // match the message's and don't process the op. if (local) { assert(localOpMetadata !== undefined, - `pendingMessageId is missing from the local client's ${op.type} operation`); + 0x011 /* `pendingMessageId is missing from the local client's ${op.type} operation` */); const pendingMessageId = localOpMetadata as number; const pendingKeyMessageId = this.pendingKeys.get(op.key); if (pendingKeyMessageId === pendingMessageId) { @@ -1529,7 +1529,7 @@ class SubDirectory extends TypedEventEmitter implements IDirec if (this.pendingSubDirectories.has(op.subdirName)) { if (local) { assert(localOpMetadata !== undefined, - `pendingMessageId is missing from the local client's ${op.type} operation`); + 0x012 /* `pendingMessageId is missing from the local client's ${op.type} operation` */); const pendingMessageId = localOpMetadata as number; const pendingSubDirectoryMessageId = this.pendingSubDirectories.get(op.subdirName); if (pendingSubDirectoryMessageId === pendingMessageId) { diff --git a/packages/dds/map/src/mapKernel.ts b/packages/dds/map/src/mapKernel.ts index 6cd119d84451..c7d593529941 100644 --- a/packages/dds/map/src/mapKernel.ts +++ b/packages/dds/map/src/mapKernel.ts @@ -636,7 +636,7 @@ export class MapKernel implements IValueTypeCreator { if (this.pendingClearMessageId !== -1) { if (local) { assert(localOpMetadata !== undefined && localOpMetadata as number < this.pendingClearMessageId, - "Received out of order op when there is an unackd clear message"); + 0x013 /* "Received out of order op when there is an unackd clear message" */); } // If we have an unack'd clear, we can ignore all ops. return false; @@ -647,7 +647,7 @@ export class MapKernel implements IValueTypeCreator { // and don't process the op. if (local) { assert(localOpMetadata !== undefined, - `pendingMessageId is missing from the local client's ${op.type} operation`); + 0x014 /* `pendingMessageId is missing from the local client's ${op.type} operation` */); const pendingMessageId = localOpMetadata as number; const pendingKeyMessageId = this.pendingKeys.get(op.key); if (pendingKeyMessageId === pendingMessageId) { @@ -673,7 +673,7 @@ export class MapKernel implements IValueTypeCreator { process: (op: IMapClearOperation, local, message, localOpMetadata) => { if (local) { assert(localOpMetadata !== undefined, - "pendingMessageId is missing from the local client's clear operation"); + 0x015 /* "pendingMessageId is missing from the local client's clear operation" */); const pendingMessageId = localOpMetadata as number; if (this.pendingClearMessageId === pendingMessageId) { this.pendingClearMessageId = -1; @@ -762,7 +762,7 @@ export class MapKernel implements IValueTypeCreator { this.submitMessage(op, localOpMetadata); }, getStashedOpLocalMetadata: (op: IMapValueTypeOperation) => { - assert(false, "apply stashed op not implemented for custom value type ops"); + assert(false, 0x016 /* "apply stashed op not implemented for custom value type ops" */); }, }); diff --git a/packages/dds/matrix/src/handlecache.ts b/packages/dds/matrix/src/handlecache.ts index 6183190403a3..b36be600fb6a 100644 --- a/packages/dds/matrix/src/handlecache.ts +++ b/packages/dds/matrix/src/handlecache.ts @@ -56,12 +56,12 @@ export class HandleCache implements IVectorConsumer { /** Update the cache when a handle has been allocated for a given position. */ public addHandle(position: number, handle: Handle) { - assert(isHandleValid(handle), "Trying to add invalid handle!"); + assert(isHandleValid(handle), 0x017 /* "Trying to add invalid handle!" */); const index = this.getIndex(position); if (index < this.handles.length) { assert(!isHandleValid(this.handles[index]), - "Trying to insert handle into position with already valid handle!"); + 0x018 /* "Trying to insert handle into position with already valid handle!" */); this.handles[index] = handle; } } diff --git a/packages/dds/matrix/src/matrix.ts b/packages/dds/matrix/src/matrix.ts index 84e444f14837..30f7c78be22b 100644 --- a/packages/dds/matrix/src/matrix.ts +++ b/packages/dds/matrix/src/matrix.ts @@ -114,7 +114,7 @@ export class SharedMatrix */ public openUndo(consumer: IUndoConsumer) { assert(this.undo === undefined, - "SharedMatrix.openUndo() supports at most a single IUndoConsumer."); + 0x019 /* "SharedMatrix.openUndo() supports at most a single IUndoConsumer." */); this.undo = new MatrixUndoProvider(consumer, this, this.rows, this.cols); } @@ -177,7 +177,7 @@ export class SharedMatrix public setCell(row: number, col: number, value: T) { assert(0 <= row && row < this.rowCount && 0 <= col && col < this.colCount, - "Trying to set out-of-bounds cell!"); + 0x01a /* "Trying to set out-of-bounds cell!" */); this.setCellCore(row, col, value); @@ -194,7 +194,7 @@ export class SharedMatrix && (0 <= colStart && colStart < this.colCount) && (1 <= colCount && colCount <= (this.colCount - colStart)) && (rowCount <= (this.rowCount - rowStart)), - "Trying to set multiple out-of-bounds cells!"); + 0x01b /* "Trying to set multiple out-of-bounds cells!" */); const endCol = colStart + colCount; let r = rowStart; @@ -275,7 +275,7 @@ export class SharedMatrix // Note that the comparison is '>=' because, in the case the MergeTree is regenerating ops for reconnection, // the MergeTree submits the op with the original 'localSeq'. assert(localSeq >= oppositeWindow.localSeq, - "The 'localSeq' of the vector submitting an op must >= the 'localSeq' of the other vector."); + 0x01c /* "The 'localSeq' of the vector submitting an op must >= the 'localSeq' of the other vector." */); oppositeWindow.localSeq = localSeq; @@ -452,14 +452,14 @@ export class SharedMatrix protected submitLocalMessage(message: any, localOpMetadata?: any) { // TODO: Recommend moving this assertion into SharedObject // (See https://github.com/microsoft/FluidFramework/issues/2559) - assert(this.isAttached() === true, "Trying to submit message to runtime while detached!"); + assert(this.isAttached() === true, 0x01d /* "Trying to submit message to runtime while detached!" */); super.submitLocalMessage(makeHandlesSerializable(message, this.serializer, this.handle), localOpMetadata); // Ensure that row/col 'localSeq' are synchronized (see 'nextLocalSeq()'). assert( this.rows.getCollabWindow().localSeq === this.cols.getCollabWindow().localSeq, - "Row and col collab window 'localSeq' desynchronized!", + 0x01e /* "Row and col collab window 'localSeq' desynchronized!" */, ); } @@ -474,7 +474,7 @@ export class SharedMatrix protected onConnect() { assert(this.rows.getCollabWindow().collaborating === this.cols.getCollabWindow().collaborating, - "Row and col collab window 'collaborating' status desynchronized!"); + 0x01f /* "Row and col collab window 'collaborating' status desynchronized!" */); // Update merge tree collaboration information with new client ID and then resend pending ops this.rows.startOrUpdateCollaboration(this.runtime.clientId as string); @@ -494,7 +494,7 @@ export class SharedMatrix localOpMetadata as SegmentGroup | SegmentGroup[])); break; default: { - assert(content.type === MatrixOp.set, "Unknown SharedMatrix 'op' type."); + assert(content.type === MatrixOp.set, 0x020 /* "Unknown SharedMatrix 'op' type." */); const setOp = content as ISetOp; const { rowHandle, colHandle, localSeq } = localOpMetadata as ISetOpMetadata; @@ -561,7 +561,8 @@ export class SharedMatrix this.rows.applyMsg(msg); break; default: { - assert(contents.type === MatrixOp.set, "SharedMatrix message contents have unexpected type!"); + assert(contents.type === MatrixOp.set, + 0x021 /* "SharedMatrix message contents have unexpected type!" */); const { referenceSequenceNumber: refSeq, clientId } = rawMessage; const { row, col } = contents; @@ -588,7 +589,7 @@ export class SharedMatrix const colHandle = this.cols.getAllocatedHandle(adjustedCol); assert(isHandleValid(rowHandle) && isHandleValid(colHandle), - "SharedMatrix row and/or col handles are invalid!"); + 0x022 /* "SharedMatrix row and/or col handles are invalid!" */); // If there is a pending (unACKed) local write to the same cell, skip the current op // since it "happened before" the pending write. @@ -659,7 +660,8 @@ export class SharedMatrix // locally removed and the row/col handles recycled. If this happens, the pendingLocalSeq will // be 'undefined' or > 'localSeq'. assert(!(pendingLocalSeq < localSeq), - "The 'localSeq' of pending write (if any) must be <= the localSeq of the currently processed op."); + // eslint-disable-next-line max-len + 0x023 /* "The 'localSeq' of pending write (if any) must be <= the localSeq of the currently processed op." */); // If this is the most recent write to the cell by the local client, the stored localSeq // will be an exact match for the given 'localSeq'. diff --git a/packages/dds/matrix/src/permutationvector.ts b/packages/dds/matrix/src/permutationvector.ts index ddb4b10ec8ea..ae92648acdcd 100644 --- a/packages/dds/matrix/src/permutationvector.ts +++ b/packages/dds/matrix/src/permutationvector.ts @@ -54,8 +54,8 @@ export class PermutationSegment extends BaseSegment { public get start() { return this._start; } public set start(value: Handle) { - assert(this._start === Handle.unallocated, "Start of PermutationSegment already allocated!"); - assert(isHandleValid(value), "Trying to set start of PermutationSegment to invalid handle!"); + assert(this._start === Handle.unallocated, 0x024 /* "Start of PermutationSegment already allocated!" */); + assert(isHandleValid(value), 0x025 /* "Trying to set start of PermutationSegment to invalid handle!" */); this._start = value; } @@ -103,7 +103,7 @@ export class PermutationSegment extends BaseSegment { } protected createSplitSegmentAt(pos: number) { - assert(0 < pos && pos < this.cachedLength, "Trying to split segment at out-of-bounds position!"); + assert(0 < pos && pos < this.cachedLength, 0x026 /* "Trying to split segment at out-of-bounds position!" */); const leafSegment = new PermutationSegment( /* length: */ this.cachedLength - pos, @@ -168,7 +168,7 @@ export class PermutationVector extends Client { } public getMaybeHandle(pos: number): Handle { - assert(0 <= pos && pos < this.getLength(), "Trying to get handle of out-of-bounds position!"); + assert(0 <= pos && pos < this.getLength(), 0x027 /* "Trying to get handle of out-of-bounds position!" */); return this.handleCache.getHandle(pos); } @@ -211,7 +211,7 @@ export class PermutationVector extends Client { public handleToPosition(handle: Handle, localSeq = this.mergeTree.collabWindow.localSeq) { assert(localSeq <= this.mergeTree.collabWindow.localSeq, - "'localSeq' for op being resubmitted must be <= the 'localSeq' of the last submitted op."); + 0x028 /* "'localSeq' for op being resubmitted must be <= the 'localSeq' of the last submitted op." */); // TODO: In theory, the MergeTree should be able to map the (position, refSeq, localSeq) from // the original operation to the current position for resubmitting. This is probably the @@ -256,7 +256,7 @@ export class PermutationVector extends Client { // ops that reference the stale handle, or the removal is unACKed, in which case the handle // has not yet been recycled. - assert(isHandleValid(containingSegment.start), "Invalid handle at start of containing segment!"); + assert(isHandleValid(containingSegment.start), 0x029 /* "Invalid handle at start of containing segment!" */); // Once we know the current position of the handle, we can use the MergeTree to get the segment // containing this position and use 'findReconnectionPosition' to adjust for the local ops that diff --git a/packages/dds/matrix/src/undoprovider.ts b/packages/dds/matrix/src/undoprovider.ts index a3bbc24efbdb..1d2c4aa04af8 100644 --- a/packages/dds/matrix/src/undoprovider.ts +++ b/packages/dds/matrix/src/undoprovider.ts @@ -47,7 +47,7 @@ export class VectorUndoProvider { // For SharedMatrix, each IRevertibles always holds a single row/col operation. // Therefore, 'currentOp' must either be undefined or equal to the current op. assert(this.currentOp === undefined || this.currentOp === operation, - "On vector undo, unexpected 'currentOp' type/state!"); + 0x02a /* "On vector undo, unexpected 'currentOp' type/state!" */); switch (operation) { case MergeTreeDeltaType.INSERT: @@ -80,7 +80,7 @@ export class VectorUndoProvider { const revertible = { revert: () => { assert(this.currentGroup === undefined && this.currentOp === undefined, - "Must not nest calls to IRevertible.revert()"); + 0x02b /* "Must not nest calls to IRevertible.revert()" */); this.currentGroup = new TrackingGroup(); @@ -139,7 +139,7 @@ export class MatrixUndoProvider { cellSet(rowHandle: Handle, colHandle: Handle, oldValue: T) { assert(isHandleValid(rowHandle) && isHandleValid(colHandle), - "On cellSet(), invalid row and/or column handles!"); + 0x02c /* "On cellSet(), invalid row and/or column handles!" */); if (this.consumer !== undefined) { this.consumer.pushToCurrentOperation({ diff --git a/packages/dds/merge-tree/src/client.ts b/packages/dds/merge-tree/src/client.ts index d2fab3f3c9ea..ecf92fa92a74 100644 --- a/packages/dds/merge-tree/src/client.ts +++ b/packages/dds/merge-tree/src/client.ts @@ -335,7 +335,7 @@ export class Client { * @returns True if the remove was applied. False if it could not be. */ private applyRemoveRangeOp(opArgs: IMergeTreeDeltaOpArgs): boolean { - assert(opArgs.op.type === ops.MergeTreeDeltaType.REMOVE, "Unexpected op type on range remove!"); + assert(opArgs.op.type === ops.MergeTreeDeltaType.REMOVE, 0x02d /* "Unexpected op type on range remove!" */); const op = opArgs.op; const clientArgs = this.getClientSequenceArgs(opArgs); const range = this.getValidOpRange(op, clientArgs); @@ -373,7 +373,7 @@ export class Client { * @returns True if the annotate was applied. False if it could not be. */ private applyAnnotateRangeOp(opArgs: IMergeTreeDeltaOpArgs): boolean { - assert(opArgs.op.type === ops.MergeTreeDeltaType.ANNOTATE, "Unexpected op type on range annotate!"); + assert(opArgs.op.type === ops.MergeTreeDeltaType.ANNOTATE, 0x02e /* "Unexpected op type on range annotate!" */); const op = opArgs.op; const clientArgs = this.getClientSequenceArgs(opArgs); const range = this.getValidOpRange(op, clientArgs); @@ -408,7 +408,7 @@ export class Client { * @returns True if the insert was applied. False if it could not be. */ private applyInsertOp(opArgs: IMergeTreeDeltaOpArgs): boolean { - assert(opArgs.op.type === ops.MergeTreeDeltaType.INSERT, "Unexpected op type on range insert!"); + assert(opArgs.op.type === ops.MergeTreeDeltaType.INSERT, 0x02f /* "Unexpected op type on range insert!" */); const op = opArgs.op; const clientArgs = this.getClientSequenceArgs(opArgs); const range = this.getValidOpRange(op, clientArgs); @@ -478,9 +478,9 @@ export class Client { } } else { assert(this.mergeTree.getCollabWindow().currentSeq < clientArgs.sequenceNumber, - "Incoming remote op sequence# <= local collabWindow's currentSequence#"); + 0x030 /* "Incoming remote op sequence# <= local collabWindow's currentSequence#" */); assert(this.mergeTree.getCollabWindow().minSeq <= opArgs.sequencedMessage.minimumSequenceNumber, - "Incoming remote op minSequence# < local collabWindow's minSequence#"); + 0x031 /* "Incoming remote op minSequence# < local collabWindow's minSequence#" */); if (traceStart) { this.accumTime += elapsedMicroseconds(traceStart); this.accumOps++; @@ -684,7 +684,7 @@ export class Client { * @param localSeq - The localSeq to find the position of the segment at */ public findReconnectionPostition(segment: ISegment, localSeq: number) { - assert(localSeq <= this.mergeTree.collabWindow.localSeq, "localSeq greater than collab window"); + assert(localSeq <= this.mergeTree.collabWindow.localSeq, 0x032 /* "localSeq greater than collab window" */); let segmentPosition = 0; /* Walk the segments up to the current segment, and calculate it's @@ -720,9 +720,10 @@ export class Client { private resetPendingDeltaToOps( resetOp: ops.IMergeTreeDeltaOp, segmentGroup: SegmentGroup): ops.IMergeTreeDeltaOp[] { - assert(!!segmentGroup, "Segment group undefined"); + assert(!!segmentGroup, 0x033 /* "Segment group undefined" */); const NACKedSegmentGroup = this.mergeTree.pendingSegments?.dequeue(); - assert(segmentGroup === NACKedSegmentGroup, "Segment group not at head of merge tree pending queue"); + assert(segmentGroup === NACKedSegmentGroup, + 0x034 /* "Segment group not at head of merge tree pending queue" */); const opList: ops.IMergeTreeDeltaOp[] = []; // We need to sort the segments by ordinal, as the segments are not sorted in the segment group. @@ -733,13 +734,13 @@ export class Client { for (const segment of segmentGroup.segments.sort((a, b) => a.ordinal < b.ordinal ? -1 : 1)) { const segmentSegGroup = segment.segmentGroups.dequeue(); assert(segmentGroup === segmentSegGroup, - "Segment group not at head of segment pending queue"); + 0x035 /* "Segment group not at head of segment pending queue" */); const segmentPosition = this.findReconnectionPostition(segment, segmentGroup.localSeq); let newOp: ops.IMergeTreeDeltaOp | undefined; switch (resetOp.type) { case ops.MergeTreeDeltaType.ANNOTATE: assert(segment.propertyManager?.hasPendingProperties() === true, - "Segment has no pending properties"); + 0x036 /* "Segment has no pending properties" */); newOp = OpBuilder.createAnnotateRangeOp( segmentPosition, segmentPosition + segment.cachedLength, @@ -749,7 +750,7 @@ export class Client { case ops.MergeTreeDeltaType.INSERT: assert(segment.seq === UnassignedSequenceNumber, - "Segment already has assigned sequence number"); + 0x037 /* "Segment already has assigned sequence number" */); newOp = OpBuilder.createInsertSegmentOp( segmentPosition, segment); @@ -830,9 +831,10 @@ export class Client { public updateSeqNumbers(min: number, seq: number) { const collabWindow = this.mergeTree.getCollabWindow(); // Equal is fine here due to SharedSegmentSequence<>.snapshotContent() potentially updating with same # - assert(collabWindow.currentSeq <= seq, "Incoming op sequence# < local collabWindow's currentSequence#"); + assert(collabWindow.currentSeq <= seq, + 0x038 /* "Incoming op sequence# < local collabWindow's currentSequence#" */); collabWindow.currentSeq = seq; - assert(min <= seq, "Incoming op sequence# < minSequence#"); + assert(min <= seq, 0x039 /* "Incoming op sequence# < minSequence#" */); this.updateMinSeq(min); } @@ -872,7 +874,7 @@ export class Client { if (resetOp.type === ops.MergeTreeDeltaType.GROUP) { if (Array.isArray(segmentGroup)) { assert(resetOp.ops.length === segmentGroup.length, - "Number of ops in 'resetOp' must match the number of segment groups provided."); + 0x03a /* "Number of ops in 'resetOp' must match the number of segment groups provided." */); for (let i = 0; i < resetOp.ops.length; i++) { opList.push( @@ -882,14 +884,14 @@ export class Client { // A group op containing a single op will pass a direct reference to 'segmentGroup' // rather than an array of segment groups. (See 'peekPendingSegmentGroups()') assert(resetOp.ops.length === 1, - "Number of ops in 'resetOp' must match the number of segment groups provided."); + 0x03b /* "Number of ops in 'resetOp' must match the number of segment groups provided." */); opList.push(...this.resetPendingDeltaToOps(resetOp.ops[0], segmentGroup)); } } else { assert((resetOp.type as any) !== ops.MergeTreeDeltaType.GROUP, - "Reset op has 'group' delta type!"); + 0x03c /* "Reset op has 'group' delta type!" */); assert(!Array.isArray(segmentGroup), - "segmentGroup is array rather than singleton!"); + 0x03d /* "segmentGroup is array rather than singleton!" */); opList.push( ...this.resetPendingDeltaToOps(resetOp, segmentGroup)); } @@ -927,14 +929,14 @@ export class Client { // One of the snapshots (from SPO) I observed to have chunk.chunkSequenceNumber > minSeq! // Not sure why - need to catch it sooner assert(this.getCollabWindow().minSeq === minSeq, - "minSeq mismatch between collab window and delta manager!"); + 0x03e /* "minSeq mismatch between collab window and delta manager!" */); // TODO: Remove options flag once new snapshot format is adopted as default. // (See https://github.com/microsoft/FluidFramework/issues/84) if (this.mergeTree.options?.newMergeTreeSnapshotFormat === true) { assert( catchUpMsgs === undefined || catchUpMsgs.length === 0, - "New format should not emit catchup ops"); + 0x03f /* "New format should not emit catchup ops" */); const snap = new SnapshotV1(this.mergeTree, this.logger); snap.extractSync(); return snap.emit(serializer, handle); diff --git a/packages/dds/merge-tree/src/mergeTree.ts b/packages/dds/merge-tree/src/mergeTree.ts index aa92cd366f6a..2a83a12648ac 100644 --- a/packages/dds/merge-tree/src/mergeTree.ts +++ b/packages/dds/merge-tree/src/mergeTree.ts @@ -365,7 +365,7 @@ export class MergeBlock extends MergeNode implements IMergeBlock { if (childCount === 8) { childCount = 7; } - assert((childCount >= 1) && (childCount <= 7), "Child count is not within [1,7] range!"); + assert((childCount >= 1) && (childCount <= 7), 0x040 /* "Child count is not within [1,7] range!" */); let localOrdinal: number; const ordinalWidth = 1 << (MaxNodesInBlock - (childCount + 1)); if (index === 0) { @@ -379,9 +379,9 @@ export class MergeBlock extends MergeNode implements IMergeBlock { if (MergeBlock.traceOrdinals) { console.log(`so: prnt chld prev ${ordinalToArray(this.ordinal)} ${ordinalToArray(child.ordinal)} ${(index > 0) ? ordinalToArray(this.children[index - 1].ordinal) : "NA"}`); } - assert(child.ordinal.length === (this.ordinal.length + 1), "Unexpected child ordinal length!"); + assert(child.ordinal.length === (this.ordinal.length + 1), 0x041 /* "Unexpected child ordinal length!" */); if (index > 0) { - assert(child.ordinal > this.children[index - 1].ordinal, "Child ordinal <= previous sibling ordinal!"); + assert(child.ordinal > this.children[index - 1].ordinal, 0x042 /* "Child ordinal <= previous sibling ordinal!" */); // console.log(`${ordinalToArray(this.ordinal)} ${ordinalToArray(child.ordinal)} ${ordinalToArray(this.children[index - 1].ordinal)}`); // console.log(`ord width ${ordinalWidth}`); } @@ -498,23 +498,23 @@ export abstract class BaseSegment extends MergeNode implements ISegment { public ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs, mergeTree: MergeTree): boolean { const currentSegmentGroup = this.segmentGroups.dequeue(); - assert(currentSegmentGroup === segmentGroup, "On ack, unexpected segmentGroup!"); + assert(currentSegmentGroup === segmentGroup, 0x043 /* "On ack, unexpected segmentGroup!" */); switch (opArgs.op.type) { case ops.MergeTreeDeltaType.ANNOTATE: - assert(!!this.propertyManager, "On annotate ack, missing segment property manager!"); + assert(!!this.propertyManager, 0x044 /* "On annotate ack, missing segment property manager!" */); this.propertyManager.ackPendingProperties(opArgs.op); return true; case ops.MergeTreeDeltaType.INSERT: - assert(this.seq === UnassignedSequenceNumber, "On insert, seq number already assigned!"); + assert(this.seq === UnassignedSequenceNumber, 0x045 /* "On insert, seq number already assigned!" */); this.seq = opArgs.sequencedMessage!.sequenceNumber; this.localSeq = undefined; return true; case ops.MergeTreeDeltaType.REMOVE: const removalInfo = mergeTree.getRemovalInfo(this); - assert(!!removalInfo, "On remove ack, missing removal info!"); - assert(!!removalInfo.removedSeq, "On remove ack, missing removed sequence number!"); + assert(!!removalInfo, 0x046 /* "On remove ack, missing removal info!" */); + assert(!!removalInfo.removedSeq, 0x047 /* "On remove ack, missing removed sequence number!" */); this.localRemovedSeq = undefined; if (removalInfo.removedSeq === UnassignedSequenceNumber) { removalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber; @@ -1015,7 +1015,7 @@ export interface MinListener { } const minListenerComparer: Collections.Comparer = { - min: { minRequired: Number.MIN_VALUE, onMinGE: () => { assert(false, "onMinGE()"); } }, + min: { minRequired: Number.MIN_VALUE, onMinGE: () => { assert(false, 0x048 /* "onMinGE()" */); } }, compare: (a, b) => a.minRequired - b.minRequired, }; @@ -1146,7 +1146,7 @@ export class MergeTree { reloadFromSegments(segments: ISegment[]) { // This code assumes that a later call to `startCollaboration()` will initialize partial lengths. - assert(!this.collabWindow.collaborating, "Trying to reload from segments while collaborating!"); + assert(!this.collabWindow.collaborating, 0x049 /* "Trying to reload from segments while collaborating!" */); const maxChildren = MaxNodesInBlock - 1; const measureReloadTime = false; @@ -1479,17 +1479,17 @@ export class MergeTree { } findHistorialPositionFromClient(pos: number, fromSeq: number, toSeq: number, clientId: number) { - assert(fromSeq < toSeq, "Invalid range for historical position search!"); + assert(fromSeq < toSeq, 0x04a /* "Invalid range for historical position search!" */); if (pos < this.getLength(fromSeq, clientId)) { assert(toSeq <= this.collabWindow.currentSeq, - "Out-of-bounds end sequence number for historical position search!"); + 0x04b /* "Out-of-bounds end sequence number for historical position search!" */); const segoff = this.getContainingSegment(pos, fromSeq, clientId); assert(segoff.segment !== undefined, - "Containing segment for historical position search is undefined!"); + 0x04c /* "Containing segment for historical position search is undefined!" */); const toPos = this.getPosition(segoff.segment, toSeq, clientId); const ret = toPos + segoff.offset!; assert(ret !== undefined, - "Return value for historical position search is undefined!"); + 0x04d /* "Return value for historical position search is undefined!" */); return ret; } else { return pos; @@ -1655,10 +1655,10 @@ export class MergeTree { } setMinSeq(minSeq: number) { - assert(minSeq <= this.collabWindow.currentSeq, "Trying to set minSeq above currentSeq of collab window!"); + assert(minSeq <= this.collabWindow.currentSeq, 0x04e /* "Trying to set minSeq above currentSeq of collab window!" */); // Only move forward - assert(this.collabWindow.minSeq <= minSeq, "minSeq of collab window > target minSeq!"); + assert(this.collabWindow.minSeq <= minSeq, 0x04f /* "minSeq of collab window > target minSeq!" */); if (minSeq > this.collabWindow.minSeq) { this.collabWindow.minSeq = minSeq; @@ -2004,7 +2004,7 @@ export class MergeTree { let startSeg = refSegment; if (refOffset !== 0 && refSegLen !== 0) { const splitSeg = this.splitLeafSegment(refSegment, refOffset); - assert(!!splitSeg.next, "Next segment changes are undefined!"); + assert(!!splitSeg.next, 0x050 /* "Next segment changes are undefined!" */); this.insertChildNode(refSegment.parent!, splitSeg.next, refSegment.index + 1); rebalanceTree(splitSeg.next); startSeg = splitSeg.next; @@ -2090,7 +2090,7 @@ export class MergeTree { } private insertChildNode(block: IMergeBlock, child: IMergeNode, childIndex: number) { - assert(block.childCount < MaxNodesInBlock, "Too many children on merge block!"); + assert(block.childCount < MaxNodesInBlock, 0x051 /* "Too many children on merge block!" */); for (let i = block.childCount; i > childIndex; i--) { block.children[i] = block.children[i - 1]; @@ -2633,7 +2633,7 @@ export class MergeTree { if (start < length) { const afterSegOff = this.getContainingSegment(start, refSeq, clientId); refSegment = afterSegOff.segment; - assert(!!refSegment, "Missing reference segment!"); + assert(!!refSegment, 0x052 /* "Missing reference segment!" */); if (!refSegment.localRefs) { refSegment.localRefs = new LocalReferenceCollection(refSegment); } @@ -2641,7 +2641,7 @@ export class MergeTree { } else if (length > 0) { const beforeSegOff = this.getContainingSegment(length - 1, refSeq, clientId); refSegment = beforeSegOff.segment; - assert(!!refSegment, "Missing reference segment!"); + assert(!!refSegment, 0x053 /* "Missing reference segment!" */); if (!refSegment.localRefs) { refSegment.localRefs = new LocalReferenceCollection(refSegment); } diff --git a/packages/dds/merge-tree/src/partialLengths.ts b/packages/dds/merge-tree/src/partialLengths.ts index bcfdc02913fe..caf9ccaca910 100644 --- a/packages/dds/merge-tree/src/partialLengths.ts +++ b/packages/dds/merge-tree/src/partialLengths.ts @@ -602,16 +602,16 @@ export class PartialSequenceLengths { count++; // Sequence number should be larger or equal to minseq - assert(this.minSeq <= partialLength.seq, "Sequence number less than minSeq!"); + assert(this.minSeq <= partialLength.seq, 0x054 /* "Sequence number less than minSeq!" */); // Sequence number should be sorted - assert(lastSeqNum < partialLength.seq, "Sequence number is not sorted!"); + assert(lastSeqNum < partialLength.seq, 0x055 /* "Sequence number is not sorted!" */); lastSeqNum = partialLength.seq; // Len is a accumulation of all the seglen adjustments accumSegLen += partialLength.seglen; if (accumSegLen !== partialLength.len) { - assert(false, "Unexpected total for accumulation of all seglen adjustments!"); + assert(false, 0x056 /* "Unexpected total for accumulation of all seglen adjustments!" */); } if (clientPartials) { @@ -628,13 +628,13 @@ export class PartialSequenceLengths { } else { // Len adjustment should not make length negative if (this.minLength + partialLength.len < 0) { - assert(false, "Negative length after length adjustment!"); + assert(false, 0x057 /* "Negative length after length adjustment!" */); } } if (partialLength.overlapRemoveClients) { // Only the flat partialLengths can have overlapRemoveClients, the per client view shouldn't - assert(!clientPartials, "Both overlapRemoveClients and clientPartials are set!"); + assert(!clientPartials, 0x058 /* "Both overlapRemoveClients and clientPartials are set!" */); // Each overlap client count as one count += partialLength.overlapRemoveClients.size(); @@ -653,14 +653,15 @@ export class PartialSequenceLengths { } // If we have client view, we should have the flat view - assert(!!this.partialLengths, "Client view exists but flat view does not!"); + assert(!!this.partialLengths, 0x059 /* "Client view exists but flat view does not!" */); const flatCount = this.verifyPartialLengths(this.partialLengths, false); // The number of partial lengths on the client view and flat view should be the same - assert(flatCount === cliCount, "Mismatch between number of partial lengths on client and flat views!"); + assert(flatCount === cliCount, + 0x05a /* "Mismatch between number of partial lengths on client and flat views!" */); } else { // If we don't have a client view, we shouldn't have the flat view either - assert(!this.partialLengths, "Flat view exists but client view does not!"); + assert(!this.partialLengths, 0x05b /* "Flat view exists but client view does not!" */); } } } diff --git a/packages/dds/merge-tree/src/segmentPropertiesManager.ts b/packages/dds/merge-tree/src/segmentPropertiesManager.ts index b53d368da33e..c428064935b8 100644 --- a/packages/dds/merge-tree/src/segmentPropertiesManager.ts +++ b/packages/dds/merge-tree/src/segmentPropertiesManager.ts @@ -25,7 +25,8 @@ export class SegmentPropertiesManager { } for (const key of Object.keys(annotateOp.props)) { if (this.pendingKeyUpdateCount?.[key] !== undefined) { - assert(this.pendingKeyUpdateCount[key] > 0, "Trying to update more annotate props than do exist!"); + assert(this.pendingKeyUpdateCount[key] > 0, + 0x05c /* "Trying to update more annotate props than do exist!" */); this.pendingKeyUpdateCount[key]--; if (this.pendingKeyUpdateCount?.[key] === 0) { // eslint-disable-next-line @typescript-eslint/no-dynamic-delete diff --git a/packages/dds/merge-tree/src/snapshotLoader.ts b/packages/dds/merge-tree/src/snapshotLoader.ts index 2794f45c100c..12ddea0ff0be 100644 --- a/packages/dds/merge-tree/src/snapshotLoader.ts +++ b/packages/dds/merge-tree/src/snapshotLoader.ts @@ -41,7 +41,7 @@ export class SnapshotLoader { ): Promise<{ catchupOpsP: Promise }> { const headerLoadedP = services.readBlob(SnapshotLegacy.header).then((header) => { - assert(!!header, "Missing blob header on legacy snapshot!"); + assert(!!header, 0x05f /* "Missing blob header on legacy snapshot!" */); return this.loadHeader(bufferToString(header,"utf8")); }); @@ -71,7 +71,7 @@ export class SnapshotLoader { if (blobs.length === headerChunk.headerMetadata!.orderedChunkMetadata.length + 1) { headerChunk.headerMetadata!.orderedChunkMetadata.forEach( (md) => blobs.splice(blobs.indexOf(md.id), 1)); - assert(blobs.length === 1, `There should be only one blob with catch up ops: ${blobs.length}`); + assert(blobs.length === 1, 0x060 /* `There should be only one blob with catch up ops: ${blobs.length}` */); // TODO: The 'Snapshot.catchupOps' tree entry is purely for backwards compatibility. // (See https://github.com/microsoft/FluidFramework/issues/84) @@ -156,11 +156,11 @@ export class SnapshotLoader { private async loadBody(chunk1: MergeTreeChunkV1, services: IChannelStorageService): Promise { assert( chunk1.length <= chunk1.headerMetadata!.totalLength, - "Mismatch in totalLength"); + 0x061 /* "Mismatch in totalLength" */); assert( chunk1.segmentCount <= chunk1.headerMetadata!.totalSegmentCount, - "Mismatch in totalSegmentCount"); + 0x062 /* "Mismatch in totalSegmentCount" */); if (chunk1.segmentCount === chunk1.headerMetadata!.totalSegmentCount) { return; @@ -180,11 +180,11 @@ export class SnapshotLoader { } assert( lengthSofar === chunk1.headerMetadata!.totalLength, - "Mismatch in totalLength"); + 0x063 /* "Mismatch in totalLength" */); assert( chunk1.segmentCount + segs.length === chunk1.headerMetadata!.totalSegmentCount, - "Mismatch in totalSegmentCount"); + 0x064 /* "Mismatch in totalSegmentCount" */); // Helper to insert segments at the end of the MergeTree. const mergeTree = this.mergeTree; diff --git a/packages/dds/merge-tree/src/snapshotV1.ts b/packages/dds/merge-tree/src/snapshotV1.ts index b12cecea27e5..25b507963159 100644 --- a/packages/dds/merge-tree/src/snapshotV1.ts +++ b/packages/dds/merge-tree/src/snapshotV1.ts @@ -232,7 +232,7 @@ export class SnapshotV1 { // sequence numbers. Any remaining removal info should be preserved. if (segment.removedSeq !== undefined) { assert(segment.removedSeq !== UnassignedSequenceNumber && segment.removedSeq > minSeq, - "On removal info preservation, segment has invalid removed sequence number!"); + 0x065 /* "On removal info preservation, segment has invalid removed sequence number!" */); raw.removedSeq = segment.removedSeq; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion raw.removedClient = mergeTree.getLongClientId!(segment.removedClientId!); @@ -241,7 +241,7 @@ export class SnapshotV1 { // Sanity check that we are preserving either the seq < minSeq or a removed segment's info. assert(raw.seq !== undefined && raw.client !== undefined || raw.removedSeq !== undefined && raw.removedClient !== undefined, - "Corrupted preservation of segment metadata!"); + 0x066 /* "Corrupted preservation of segment metadata!" */); // Record the segment with it's required metadata. pushSegRaw(raw, segment.cachedLength); diff --git a/packages/dds/merge-tree/src/snapshotlegacy.ts b/packages/dds/merge-tree/src/snapshotlegacy.ts index e32ac89ff668..02a5a9dcdbb0 100644 --- a/packages/dds/merge-tree/src/snapshotlegacy.ts +++ b/packages/dds/merge-tree/src/snapshotlegacy.ts @@ -153,11 +153,11 @@ export class SnapshotLegacy { assert( length === this.header!.segmentsTotalLength, - "emit: mismatch in segmentsTotalLength"); + 0x05d /* "emit: mismatch in segmentsTotalLength" */); assert( segments === chunk1.totalSegmentCount, - "emit: mismatch in totalSegmentCount"); + 0x05e /* "emit: mismatch in totalSegmentCount" */); if(catchUpMsgs !== undefined && catchUpMsgs.length > 0) { tree.entries.push({ diff --git a/packages/dds/ordered-collection/src/consensusOrderedCollection.ts b/packages/dds/ordered-collection/src/consensusOrderedCollection.ts index a820f519f319..8629d85244fc 100644 --- a/packages/dds/ordered-collection/src/consensusOrderedCollection.ts +++ b/packages/dds/ordered-collection/src/consensusOrderedCollection.ts @@ -119,7 +119,7 @@ export class ConsensusOrderedCollection // Disconnect order matters because it defines the order items go back to the queue. // So we put items back to queue only when we process our own removeMember event. runtime.getQuorum().on("removeMember", (clientId: string) => { - assert(!!clientId, "Missing clientId for removal!"); + assert(!!clientId, 0x067 /* "Missing clientId for removal!" */); this.removeClient(clientId); }); } @@ -275,13 +275,13 @@ export class ConsensusOrderedCollection * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore} */ protected async loadCore(storage: IChannelStorageService): Promise { - assert(this.jobTracking.size === 0, "On consensusOrderedCollection load, job tracking size > 0"); + assert(this.jobTracking.size === 0, 0x068 /* "On consensusOrderedCollection load, job tracking size > 0" */); const blob = await storage.readBlob(snapshotFileNameTracking); const rawContentTracking = bufferToString(blob, "utf8"); const content = this.deserializeValue(rawContentTracking, this.serializer); this.jobTracking = new Map(content) as JobTrackingInfo; - assert(this.data.size() === 0, "On consensusOrderedCollection load, data size > 0"); + assert(this.data.size() === 0, 0x069 /* "On consensusOrderedCollection load, data size > 0" */); const blob2 = await storage.readBlob(snapshotFileNameData); const rawContentData = bufferToString(blob2, "utf8"); const content2 = this.deserializeValue(rawContentData, this.serializer) as T[]; @@ -334,7 +334,7 @@ export class ConsensusOrderedCollection private async submit( message: TMessage, ): Promise | undefined> { - assert(this.isAttached(), "Trying to submit message while detached!"); + assert(this.isAttached(), 0x06a /* "Trying to submit message while detached!" */); return this.newAckBasedPromise | undefined>((resolve) => { // Send the resolve function as the localOpMetadata. This will be provided back to us when the diff --git a/packages/dds/ordered-collection/src/snapshotableArray.ts b/packages/dds/ordered-collection/src/snapshotableArray.ts index 0f1a7e921951..dec443d0a6bf 100644 --- a/packages/dds/ordered-collection/src/snapshotableArray.ts +++ b/packages/dds/ordered-collection/src/snapshotableArray.ts @@ -13,7 +13,7 @@ export class SnapshotableArray extends Array { } public async loadFrom(from: T[]): Promise { - assert(this.data.length === 0, "Loading snapshot into a non-empty collection"); + assert(this.data.length === 0, 0x06b /* "Loading snapshot into a non-empty collection" */); this.data = from; } diff --git a/packages/dds/register-collection/src/consensusRegisterCollection.ts b/packages/dds/register-collection/src/consensusRegisterCollection.ts index 515164dad84c..84a0f010ec07 100644 --- a/packages/dds/register-collection/src/consensusRegisterCollection.ts +++ b/packages/dds/register-collection/src/consensusRegisterCollection.ts @@ -172,7 +172,7 @@ export class ConsensusRegisterCollection if (versions !== undefined) { // We don't support deletion. So there should be at least one value. - assert(versions.length > 0, "Value should be undefined or non-empty"); + assert(versions.length > 0, 0x06c /* "Value should be undefined or non-empty" */); return versions[versions.length - 1]; } @@ -218,7 +218,8 @@ export class ConsensusRegisterCollection for (const key of Object.keys(dataObj)) { assert(dataObj[key].atomic?.value.type !== "Shared", - "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17"); + // eslint-disable-next-line max-len + 0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */); this.data.set(key, dataObj[key]); } @@ -244,7 +245,7 @@ export class ConsensusRegisterCollection // Use the refSeq from when the op was created, not when it was transmitted const refSeqWhenCreated = op.refSeq; assert(refSeqWhenCreated <= message.referenceSequenceNumber, - "Message's reference sequence number < op's reference sequence number!"); + 0x06e /* "Message's reference sequence number < op's reference sequence number!" */); const value = incomingOpMatchesCurrentFormat(op) ? this.parse(op.serializedValue, this.serializer) as T @@ -307,7 +308,7 @@ export class ConsensusRegisterCollection } } else { - assert(!!data, "data missing for non-atomic inbound update!"); + assert(!!data, 0x06f /* "data missing for non-atomic inbound update!" */); } // Remove versions that were known to the remote client at the time of write @@ -322,11 +323,12 @@ export class ConsensusRegisterCollection // Asserts for data integrity if (!this.isAttached()) { - assert(refSeq === 0 && sequenceNumber === 0, "sequence numbers are expected to be 0 when unattached"); + assert(refSeq === 0 && sequenceNumber === 0, + 0x070 /* "sequence numbers are expected to be 0 when unattached" */); } else if (data.versions.length > 0) { assert(sequenceNumber > data.versions[data.versions.length - 1].sequenceNumber, - "Versions should naturally be ordered by sequenceNumber"); + 0x071 /* "Versions should naturally be ordered by sequenceNumber" */); } // Push the new element. diff --git a/packages/dds/sequence/src/sequence.ts b/packages/dds/sequence/src/sequence.ts index 67337497760c..c041c75ae881 100644 --- a/packages/dds/sequence/src/sequence.ts +++ b/packages/dds/sequence/src/sequence.ts @@ -550,10 +550,10 @@ export abstract class SharedSegmentSequence // if loading isn't complete, we need to cache all // incoming ops to be applied after loading is complete if (this.deferIncomingOps) { - assert(!local, "Unexpected local op when loading not finished"); + assert(!local, 0x072 /* "Unexpected local op when loading not finished" */); this.loadedDeferredIncomingOps.push(message); } else { - assert(message.type === MessageType.Operation, "Sequence message not operation"); + assert(message.type === MessageType.Operation, 0x073 /* "Sequence message not operation" */); const handled = this.intervalMapKernel.tryProcessMessage(message.contents, local, message, localOpMetadata); @@ -588,7 +588,7 @@ export abstract class SharedSegmentSequence private snapshotMergeTree(serializer: IFluidSerializer): ITree { // Are we fully loaded? If not, things will go south - assert(this.loadedDeferred.isCompleted, "Snapshot called when not fully loaded"); + assert(this.loadedDeferred.isCompleted, 0x074 /* "Snapshot called when not fully loaded" */); const minSeq = this.runtime.deltaManager.minimumSequenceNumber; this.processMinSequenceNumberChanged(minSeq); diff --git a/packages/dds/shared-object-base/src/sharedObject.ts b/packages/dds/shared-object-base/src/sharedObject.ts index 6e1597f2806e..cf617b466588 100644 --- a/packages/dds/shared-object-base/src/sharedObject.ts +++ b/packages/dds/shared-object-base/src/sharedObject.ts @@ -89,7 +89,8 @@ export abstract class SharedObject implements ITa this.opWatcher.on("volunteer", (taskId: string, clientId: string, local: boolean, messageId: number) => { if (local) { const pendingOp = this.latestPendingOps.get(taskId); - assert(pendingOp !== undefined, "Unexpected op"); + assert(pendingOp !== undefined, 0x07b /* "Unexpected op" */); // Need to check the id, since it's possible to volunteer and abandon multiple times before the acks if (messageId === pendingOp.messageId) { - assert(pendingOp.type === "volunteer", "Unexpected op type"); + assert(pendingOp.type === "volunteer", 0x07c /* "Unexpected op type" */); // Delete the pending, because we no longer have an outstanding op this.latestPendingOps.delete(taskId); } @@ -180,10 +180,10 @@ export class TaskManager extends SharedObject implements ITa this.opWatcher.on("abandon", (taskId: string, clientId: string, local: boolean, messageId: number) => { if (local) { const pendingOp = this.latestPendingOps.get(taskId); - assert(pendingOp !== undefined, "Unexpected op"); + assert(pendingOp !== undefined, 0x07d /* "Unexpected op" */); // Need to check the id, since it's possible to abandon and volunteer multiple times before the acks if (messageId === pendingOp.messageId) { - assert(pendingOp.type === "abandon", "Unexpected op type"); + assert(pendingOp.type === "abandon", 0x07e /* "Unexpected op type" */); // Delete the pending, because we no longer have an outstanding op this.latestPendingOps.delete(taskId); } @@ -210,7 +210,7 @@ export class TaskManager extends SharedObject implements ITa }); this.disconnectWatcher.on("disconnect", () => { - assert(this.runtime.clientId !== undefined, "Missing client id on disconnect"); + assert(this.runtime.clientId !== undefined, 0x1d3 /* "Missing client id on disconnect" */); // We don't modify the taskQueues on disconnect (they still reflect the latest known consensus state). // After reconnect these will get cleaned up by observing the clientLeaves. @@ -350,7 +350,9 @@ export class TaskManager extends SharedObject implements ITa return false; } - assert(this.runtime.clientId !== undefined, "clientId undefined"); // TODO, handle disconnected/detached case + assert(this.runtime.clientId !== undefined, + 0x07f /* "clientId undefined" */); // TODO, handle disconnected/detached case + const clientQueue = this.taskQueues.get(taskId); // If we have no queue for the taskId, then no one has signed up for it. return ( diff --git a/packages/drivers/debugger/src/fluidDebuggerController.ts b/packages/drivers/debugger/src/fluidDebuggerController.ts index 95c0eaa3948a..94cbf6beac13 100644 --- a/packages/drivers/debugger/src/fluidDebuggerController.ts +++ b/packages/drivers/debugger/src/fluidDebuggerController.ts @@ -207,9 +207,9 @@ export class DebugReplayController extends ReplayController implements IDebugger return this.shouldUseController; } - assert(!!documentService, "Invalid document service!"); - assert(!this.documentService, "Document service already set!"); - assert(!this.documentStorageService, "Document storage service already set!"); + assert(!!documentService, 0x080 /* "Invalid document service!" */); + assert(!this.documentService, 0x081 /* "Document service already set!" */); + assert(!this.documentStorageService, 0x082 /* "Document storage service already set!" */); this.documentService = documentService; this.documentStorageService = await documentService.connectToStorage(); @@ -246,7 +246,7 @@ export class DebugReplayController extends ReplayController implements IDebugger this.shouldUseController = await this.startSeqDeferred.promise !== DebugReplayController.WindowClosedSeq; assert(this.isSelectionMade() === this.shouldUseController, - "User selection status does not match replay controller use status!"); + 0x083 /* "User selection status does not match replay controller use status!" */); return this.shouldUseController; } @@ -334,10 +334,10 @@ export class DebugReplayController extends ReplayController implements IDebugger seq: number, storage: ReadDocumentStorageServiceBase, version: IVersion | string) { - assert(!this.isSelectionMade(), "On storage resolve, user selection already made!"); - assert(!!storage, "On storage resolve, missing storage!"); + assert(!this.isSelectionMade(), 0x084 /* "On storage resolve, user selection already made!" */); + assert(!!storage, 0x085 /* "On storage resolve, missing storage!" */); this.storage = storage; - assert(this.isSelectionMade(), "After storage resolve, user selection status still false!"); + assert(this.isSelectionMade(), 0x086 /* "After storage resolve, user selection status still false!" */); this.ui.versionSelected(seq, version); this.startSeqDeferred.resolve(seq); @@ -351,7 +351,7 @@ async function* generateSequencedMessagesFromDeltaStorage(deltaStorage: IDocumen const { messages, partialResult } = await loadChunk(lastSeq, lastSeq + batch, deltaStorage); if (messages.length === 0) { assert(!partialResult, - "No messages loaded from chunk, but nonzero number of partial results loaded from chunk!"); + 0x087 /* "No messages loaded from chunk, but nonzero number of partial results loaded from chunk!" */); break; } yield messages; diff --git a/packages/drivers/debugger/src/fluidDebuggerUi.ts b/packages/drivers/debugger/src/fluidDebuggerUi.ts index 5dfb0edb8173..84c683976fef 100644 --- a/packages/drivers/debugger/src/fluidDebuggerUi.ts +++ b/packages/drivers/debugger/src/fluidDebuggerUi.ts @@ -287,7 +287,7 @@ export class DebuggerUI { } public disableNextOpButton(disable: boolean) { - assert(!!this.buttonOps, "Missing button ops button!"); + assert(!!this.buttonOps, 0x088 /* "Missing button ops button!" */); this.buttonOps.disabled = disable; } diff --git a/packages/drivers/debugger/src/sanitizer.ts b/packages/drivers/debugger/src/sanitizer.ts index 409ff4c61e02..1c633c67c237 100644 --- a/packages/drivers/debugger/src/sanitizer.ts +++ b/packages/drivers/debugger/src/sanitizer.ts @@ -145,7 +145,7 @@ class ChunkedOpProcessor { try { stringified = JSON.stringify(contents); assert(stringified.length <= this.concatenatedLength, - "Stringified length of chunk contents > total starting length"); + 0x089 /* "Stringified length of chunk contents > total starting length" */); } catch (e) { this.debugMsg(e); throw e; @@ -182,7 +182,7 @@ class ChunkedOpProcessor { } reset(): void { - assert(this.writtenBack, "resetting ChunkedOpProcessor that never wrote back its contents"); + assert(this.writtenBack, 0x08a /* "resetting ChunkedOpProcessor that never wrote back its contents" */); this.messages = new Array(); this.parsedMessageContents = new Array(); this.writtenBack = false; @@ -448,7 +448,7 @@ export class Sanitizer { * @param contents - contents object to fix */ fixAttachContents(contents: any): any { - assert(typeof contents === "object", "Unexpected type on contents for fix of an attach!"); + assert(typeof contents === "object", 0x08b /* "Unexpected type on contents for fix of an attach!" */); if (!this.objectMatchesSchema(contents, attachContentsSchema)) { this.replaceObject(contents); } else { @@ -512,7 +512,7 @@ export class Sanitizer { } const innerContent = contents.contents.content; - assert(innerContent !== undefined, "innerContent for fixing op contents is undefined!"); + assert(innerContent !== undefined, 0x08c /* "innerContent for fixing op contents is undefined!" */); if (contents.contents.type === "attach") { // attach op // handle case where inner content is stringified json @@ -675,7 +675,7 @@ export class Sanitizer { }); // make sure we don't miss an incomplete chunked op at the end - assert(!this.chunkProcessor.isPendingProcessing(), "After sanitize, pending incomplete ops!"); + assert(!this.chunkProcessor.isPendingProcessing(), 0x08d /* "After sanitize, pending incomplete ops!" */); } catch (error) { this.debugMsg(`Error while processing sequenceNumber ${seq}`); throw error; diff --git a/packages/drivers/driver-base/src/documentDeltaConnection.ts b/packages/drivers/driver-base/src/documentDeltaConnection.ts index b46555312f33..874274855899 100644 --- a/packages/drivers/driver-base/src/documentDeltaConnection.ts +++ b/packages/drivers/driver-base/src/documentDeltaConnection.ts @@ -187,9 +187,9 @@ export class DocumentDeltaConnection public get initialMessages(): ISequencedDocumentMessage[] { // If we call this when the earlyOpHandler is not attached, then the queuedMessages may not include the // latest ops. This could possibly indicate that initialMessages was called twice. - assert(this.earlyOpHandlerAttached, "Potentially missed initial messages"); + assert(this.earlyOpHandlerAttached, 0x08e /* "Potentially missed initial messages" */); // We will lose ops and perf will tank as we need to go to storage to become current! - assert(this.listeners("op").length !== 0, "No op handler is setup!"); + assert(this.listeners("op").length !== 0, 0x08f /* "No op handler is setup!" */); this.removeEarlyOpHandler(); @@ -209,7 +209,7 @@ export class DocumentDeltaConnection * @returns signals sent during the connection */ public get initialSignals(): ISignalMessage[] { - assert(this.listeners("signal").length !== 0, "No signal handler is setup!"); + assert(this.listeners("signal").length !== 0, 0x090 /* "No signal handler is setup!" */); this.removeEarlySignalHandler(); diff --git a/packages/drivers/file-driver/src/fileDeltaStorageService.ts b/packages/drivers/file-driver/src/fileDeltaStorageService.ts index 9e7e0a9e7562..af7648969da4 100644 --- a/packages/drivers/file-driver/src/fileDeltaStorageService.ts +++ b/packages/drivers/file-driver/src/fileDeltaStorageService.ts @@ -65,7 +65,7 @@ export class FileDeltaStorageService implements IDocumentDeltaStorageService { } this.lastOps = this.messages.slice(readFrom, readTo); assert(this.lastOps[0].sequenceNumber === readFrom + 1, - "Retrieved ops' first sequence number has unexpected value!"); + 0x091 /* "Retrieved ops' first sequence number has unexpected value!" */); return this.lastOps; } } diff --git a/packages/drivers/file-driver/src/fileDocumentStorageService.ts b/packages/drivers/file-driver/src/fileDocumentStorageService.ts index fa73490cf449..d4e7e376bf11 100644 --- a/packages/drivers/file-driver/src/fileDocumentStorageService.ts +++ b/packages/drivers/file-driver/src/fileDocumentStorageService.ts @@ -39,9 +39,9 @@ export class FluidFetchReader extends ReadDocumentStorageServiceBase implements * @param version - The version contains the path of the file which contains the snapshot tree. */ public async getSnapshotTree(version?: api.IVersion): Promise { - assert(version !== null, "version input for reading snapshot tree is null!"); + assert(version !== null, 0x092 /* "version input for reading snapshot tree is null!" */); assert(!version || version.treeId === FileStorageVersionTreeId, - "invalid version input for reading snapshot tree!"); + 0x093 /* "invalid version input for reading snapshot tree!" */); let filename: string; let rootTree = false; @@ -85,7 +85,7 @@ export class FluidFetchReader extends ReadDocumentStorageServiceBase implements return []; } else if (this.versionName !== undefined) { // We loaded from snapshot - search for commit there. - assert(!!this.docTree, "Missing snapshot tree!"); + assert(!!this.docTree, 0x094 /* "Missing snapshot tree!" */); return [{ id: versionId, treeId: FileStorageVersionTreeId, @@ -299,7 +299,8 @@ export const FileSnapshotWriterClassFactory = ( }); } - assert(Object.keys(snapshotTree.commits).length === 0, "Leftover distinct commits after building tree!"); + assert(Object.keys(snapshotTree.commits).length === 0, + 0x095 /* "Leftover distinct commits after building tree!" */); return tree; } }; @@ -311,7 +312,7 @@ function removeNullTreeIds(tree: api.ITree) { } } assert(tree.id === undefined || tree.id === null, - "Trying to remove valid tree IDs in removeNullTreeIds()!"); + 0x096 /* "Trying to remove valid tree IDs in removeNullTreeIds()!" */); delete tree.id; } diff --git a/packages/drivers/fluidapp-odsp-urlResolver/src/urlResolver.ts b/packages/drivers/fluidapp-odsp-urlResolver/src/urlResolver.ts index f64ed5f333d2..3c31252830ec 100644 --- a/packages/drivers/fluidapp-odsp-urlResolver/src/urlResolver.ts +++ b/packages/drivers/fluidapp-odsp-urlResolver/src/urlResolver.ts @@ -25,7 +25,7 @@ export class FluidAppOdspUrlResolver implements IUrlResolver { } else if (server === "www.office.com") { const getRequiredParam = (name: string): string => { const value = reqUrl.searchParams.get(name); - assert(!!value, `Missing ${name} from office.com URL parameter`); + assert(!!value, 0x097 /* `Missing ${name} from office.com URL parameter` */); return value; }; contents = { diff --git a/packages/drivers/iframe-driver/src/innerDocumentServiceFactory.ts b/packages/drivers/iframe-driver/src/innerDocumentServiceFactory.ts index 48b3dc4dd251..6050d9ec9b0e 100644 --- a/packages/drivers/iframe-driver/src/innerDocumentServiceFactory.ts +++ b/packages/drivers/iframe-driver/src/innerDocumentServiceFactory.ts @@ -26,7 +26,7 @@ export class InnerDocumentServiceFactory implements IDocumentServiceFactory { const combinedProxy = Comlink.wrap(outerPort); const outerProxy = combinedProxy[IDocumentServiceFactoryProxyKey] as Comlink.Remote; - assert(outerProxy !== undefined, "OuterDocumentServiceFactoryProxy unavailable"); + assert(outerProxy !== undefined, 0x098 /* "OuterDocumentServiceFactoryProxy unavailable" */); await outerProxy.connected(); return new InnerDocumentServiceFactory(outerProxy); } diff --git a/packages/drivers/iframe-driver/src/innerUrlResolver.ts b/packages/drivers/iframe-driver/src/innerUrlResolver.ts index 27b962a48b52..e002a2fa2e33 100644 --- a/packages/drivers/iframe-driver/src/innerUrlResolver.ts +++ b/packages/drivers/iframe-driver/src/innerUrlResolver.ts @@ -16,7 +16,7 @@ export class InnerUrlResolver implements IUrlResolver { // is expected to exist when running any inner iframe code. const combinedProxy = Comlink.wrap(outerPort); const outerProxy = combinedProxy[IUrlResolverProxyKey] as Comlink.Remote; - assert(outerProxy !== undefined, "OuterUrlResolverProxy unavailable"); + assert(outerProxy !== undefined, 0x099 /* "OuterUrlResolverProxy unavailable" */); await outerProxy.connected(); return new InnerUrlResolver(outerProxy); } diff --git a/packages/drivers/local-driver/src/localResolver.ts b/packages/drivers/local-driver/src/localResolver.ts index 01055fbd0d97..c1f9854c06a8 100644 --- a/packages/drivers/local-driver/src/localResolver.ts +++ b/packages/drivers/local-driver/src/localResolver.ts @@ -72,7 +72,7 @@ export class LocalResolver implements IUrlResolver { throw new Error("Url should contain tenant and docId!!"); } const [, , documentId] = parsedUrl.pathname.split("/"); - assert(!!documentId, "The resolvedUrl must have a documentId"); + assert(!!documentId, 0x09a /* "The resolvedUrl must have a documentId" */); return `http://localhost:3000/${documentId}/${url}`; } diff --git a/packages/drivers/odsp-driver/src/epochTracker.ts b/packages/drivers/odsp-driver/src/epochTracker.ts index 1092851ed70b..44c586efd729 100644 --- a/packages/drivers/odsp-driver/src/epochTracker.ts +++ b/packages/drivers/odsp-driver/src/epochTracker.ts @@ -36,8 +36,8 @@ export class EpochTracker { } public set fileEntry(fileEntry: IFileEntry | undefined) { - assert(this._fileEntry === undefined, "File Entry should be set only once"); - assert(fileEntry !== undefined, "Passed file entry should not be undefined"); + assert(this._fileEntry === undefined, 0x09b /* "File Entry should be set only once" */); + assert(fileEntry !== undefined, 0x09c /* "Passed file entry should not be undefined" */); this._fileEntry = fileEntry; } @@ -51,7 +51,7 @@ export class EpochTracker { public async validateEpochFromPush(details: IConnected) { const epoch = details.epoch; - assert(epoch !== undefined, "Connection details should contain epoch"); + assert(epoch !== undefined, 0x09d /* "Connection details should contain epoch" */); try { this.validateEpochFromResponse(epoch, "push"); } catch (error) { @@ -213,14 +213,14 @@ export class EpochTracker { // This will only throw if it is an epoch error. this.checkForEpochErrorCore(epochFromResponse, error.errorMessage); } catch (epochError) { - assert(epochError instanceof LoggingError, "type guard"); + assert(epochError instanceof LoggingError, 0x1d4 /* "type guard" */); epochError.addTelemetryProperties({ fromCache, clientEpoch: this.fluidEpoch, fetchType, }); this.logger.sendErrorEvent({ eventName: "EpochVersionMismatch" }, epochError); - assert(!!this.fileEntry, "File Entry should be set to clear the cached entries!!"); + assert(!!this.fileEntry, 0x09e /* "File Entry should be set to clear the cached entries!!" */); // If the epoch mismatches, then clear all entries for such file entry from cache. await this.persistedCache.removeEntries(this.fileEntry); throw epochError; diff --git a/packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts b/packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts index 04c7e65f94aa..a71234635ba3 100644 --- a/packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts +++ b/packages/drivers/odsp-driver/src/odspDocumentDeltaConnection.ts @@ -73,7 +73,7 @@ class SocketReference { * @param isFatalError - true if the socket reference should be removed immediately due to a fatal error */ public removeSocketIoReference(isFatalError: boolean) { - assert(this.references > 0, "No more socketIO refs to remove!"); + assert(this.references > 0, 0x09f /* "No more socketIO refs to remove!" */); this.references--; // see comment in disconnected() getter @@ -87,7 +87,7 @@ class SocketReference { if (this.references === 0 && this.delayDeleteTimeout === undefined) { this.delayDeleteTimeout = setTimeout(() => { // We should not get here with active users. - assert(this.references === 0, "Unexpected socketIO references on timeout"); + assert(this.references === 0, 0x0a0 /* "Unexpected socketIO references on timeout" */); this.closeSocket(); }, socketReferenceBufferTime); this.delayDeleteTimeoutSetTime = Date.now(); @@ -137,7 +137,7 @@ class SocketReference { this.clearTimer(); assert(SocketReference.socketIoSockets.get(this.key) === this, - "Socket reference set unexpectedly does not point to this socket!"); + 0x0a1 /* "Socket reference set unexpectedly does not point to this socket!" */); SocketReference.socketIoSockets.delete(this.key); const socket = this._socket; @@ -383,7 +383,7 @@ export class OdspDocumentDeltaConnection extends DocumentDeltaConnection impleme */ protected disconnect(socketProtocolError: boolean, reason: DriverError) { const socket = this.socketReference; - assert(socket !== undefined, "reentrancy not supported!"); + assert(socket !== undefined, 0x0a2 /* "reentrancy not supported!" */); this.socketReference = undefined; if (!socketProtocolError && this.hasDetails) { diff --git a/packages/drivers/odsp-driver/src/odspDocumentService.ts b/packages/drivers/odsp-driver/src/odspDocumentService.ts index 883cb1f4e063..54de764449a2 100644 --- a/packages/drivers/odsp-driver/src/odspDocumentService.ts +++ b/packages/drivers/odsp-driver/src/odspDocumentService.ts @@ -383,7 +383,7 @@ export class OdspDocumentService implements IDocumentService { }; const connectWithAfd = async () => { - assert(afdUrl !== undefined, "Tried to connect with AFD but no AFD url provided"); + assert(afdUrl !== undefined, 0x0a3 /* "Tried to connect with AFD but no AFD url provided" */); const startTime = performance.now(); try { diff --git a/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts b/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts index 9b05b853b620..fefbd260e78d 100644 --- a/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts +++ b/packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts @@ -131,7 +131,7 @@ class BlobCache { public addBlobs(blobs: IBlob[]) { blobs.forEach((blob) => { assert(blob.encoding === "base64" || blob.encoding === undefined, - `Unexpected blob encoding type: '${blob.encoding}'`); + 0x0a4 /* `Unexpected blob encoding type: '${blob.encoding}'` */); this._blobCache.set(blob.id, blob); }); // Reset the timer on cache set @@ -247,8 +247,8 @@ export class OdspDocumentStorageService implements IDocumentStorageService { private readonly blobCache = new BlobCache(); public set ops(ops: ISequencedDeltaOpMessage[] | undefined) { - assert(this._ops === undefined, "Trying to set ops when they are already set!"); - assert(ops !== undefined, "Input ops are undefined!"); + assert(this._ops === undefined, 0x0a5 /* "Trying to set ops when they are already set!" */); + assert(ops !== undefined, 0x0a6 /* "Input ops are undefined!" */); this._ops = ops; } @@ -752,7 +752,7 @@ export class OdspDocumentStorageService implements IDocumentStorageService { const { numTrees, numBlobs, encodedBlobsSize, decodedBlobsSize } = this.evalBlobsAndTrees(snapshot); const clientTime = networkTime ? overallTime - networkTime : undefined; - assert(this._snapshotCacheEntry === undefined, "snapshotCacheEntry already defined!"); + assert(this._snapshotCacheEntry === undefined, 0x0a7 /* "snapshotCacheEntry already defined!" */); this._snapshotCacheEntry = { file: this.fileEntry, type: "snapshot", diff --git a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts index 74d599e02da7..b5be6eb6130c 100644 --- a/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts +++ b/packages/drivers/odsp-driver/src/odspDriverUrlResolver.ts @@ -86,7 +86,7 @@ export class OdspDriverUrlResolver implements IUrlResolver { } const { siteUrl, driveId, itemId, path, containerPackageName, fileVersion } = decodeOdspUrl(request.url); const hashedDocumentId = getHashedDocumentId(driveId, itemId); - assert(!hashedDocumentId.includes("/"), "Docid should not contain slashes!!"); + assert(!hashedDocumentId.includes("/"), 0x0a8 /* "Docid should not contain slashes!!" */); let documentUrl = `fluid-odsp://placeholder/placeholder/${hashedDocumentId}/${removeBeginningSlash(path)}`; diff --git a/packages/drivers/odsp-driver/src/odspSummaryUploadManager.ts b/packages/drivers/odsp-driver/src/odspSummaryUploadManager.ts index c8a39909b695..d2143313bcc4 100644 --- a/packages/drivers/odsp-driver/src/odspSummaryUploadManager.ts +++ b/packages/drivers/odsp-driver/src/odspSummaryUploadManager.ts @@ -116,7 +116,7 @@ export class OdspSummaryUploadManager { blobCache: Map, path: string = ""): Promise { - assert(Object.keys(snapshotTree.commits).length === 0, "There should not be commit tree entries in snapshot"); + assert(Object.keys(snapshotTree.commits).length === 0, 0x0a9 /* "There should not be commit tree entries in snapshot" */); const summaryTree: api.ISummaryTree = { type: api.SummaryType.Tree, @@ -229,7 +229,7 @@ export class OdspSummaryUploadManager { false, ); if (!this.hostPolicy.blobDeduping) { - assert(reusedBlobs === 0, "No blobs should be deduped"); + assert(reusedBlobs === 0, 0x0aa /* "No blobs should be deduped" */); } const snapshot: IOdspSummaryPayload = { entries: snapshotTree.entries!, @@ -356,7 +356,7 @@ export class OdspSummaryUploadManager { hash = this.blobTreeDedupCaches.pathToBlobSha.get(currentPath); if (hash !== undefined) { cachedPath = this.blobTreeDedupCaches.blobShaToPath.get(hash); - assert(cachedPath !== undefined, "path should be defined as path->sha mapping exists"); + assert(cachedPath !== undefined, 0x0ab /* "path should be defined as path->sha mapping exists" */); } else { // We may not have the blob hash in case its contents were not returned during snapshot fetch. // In that case just put the current path as cached path as its contents should not have changed @@ -389,7 +389,7 @@ export class OdspSummaryUploadManager { blobs++; } else { if (!blobDedupingEnabled) { - assert(false, "Blob deduping is disabled"); + assert(false, 0x0ac /* "Blob deduping is disabled" */); } reusedBlobs++; id = `${parentHandle}/${cachedPath}`; @@ -455,7 +455,7 @@ export class OdspSummaryUploadManager { let entry: SnapshotTreeEntry; if (value) { - assert(id === undefined, "Snapshot entry has both a tree value and a referenced id!"); + assert(id === undefined, 0x0ad /* "Snapshot entry has both a tree value and a referenced id!" */); entry = { value, ...baseEntry, diff --git a/packages/drivers/odsp-driver/src/rateLimiter.ts b/packages/drivers/odsp-driver/src/rateLimiter.ts index 0e10fe152445..22c5848872c6 100644 --- a/packages/drivers/odsp-driver/src/rateLimiter.ts +++ b/packages/drivers/odsp-driver/src/rateLimiter.ts @@ -8,7 +8,7 @@ import { assert } from "@fluidframework/common-utils"; export class RateLimiter { private readonly tasks: (() => void)[] = []; constructor(private maxRequests: number) { - assert(maxRequests > 0, "Tried to create rate limiter with 0 max requests!"); + assert(maxRequests > 0, 0x0ae /* "Tried to create rate limiter with 0 max requests!" */); } public get waitQueueLength(): number { diff --git a/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts b/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts index 0aa92b868c26..6de5bf0d3bfd 100644 --- a/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts +++ b/packages/drivers/replay-driver/src/replayDocumentDeltaConnection.ts @@ -317,7 +317,7 @@ export class ReplayDocumentDeltaConnection if (messages.length === 0) { // No more ops. But, they can show up later, either because document was just created, // or because another client keeps submitting new ops. - assert(!partialResult, "No more ops, but nonzero partial results!"); + assert(!partialResult, 0x0af /* "No more ops, but nonzero partial results!" */); if (controller.isDoneFetch(currentOp, undefined)) { break; } diff --git a/packages/drivers/replay-driver/src/storageImplementations.ts b/packages/drivers/replay-driver/src/storageImplementations.ts index 8a47b1baed7b..974a3cd796ab 100644 --- a/packages/drivers/replay-driver/src/storageImplementations.ts +++ b/packages/drivers/replay-driver/src/storageImplementations.ts @@ -100,7 +100,7 @@ export class SnapshotStorage extends ReadDocumentStorageServiceBase { protected readonly storage: IDocumentStorageService, protected readonly docTree: ISnapshotTree | null) { super(); - assert(!!this.docTree, "Missing document snapshot tree!"); + assert(!!this.docTree, 0x0b0 /* "Missing document snapshot tree!" */); } public async getVersions(versionId: string, count: number): Promise { diff --git a/packages/drivers/routerlicious-driver/src/documentService.ts b/packages/drivers/routerlicious-driver/src/documentService.ts index 0b49d69f4e94..746c4fc10c07 100644 --- a/packages/drivers/routerlicious-driver/src/documentService.ts +++ b/packages/drivers/routerlicious-driver/src/documentService.ts @@ -94,7 +94,7 @@ export class DocumentService implements api.IDocumentService { * @returns returns the document delta storage service for routerlicious driver. */ public async connectToDeltaStorage(): Promise { - assert(!!this.documentStorageService, "Storage service not initialized"); + assert(!!this.documentStorageService, 0x0b1 /* "Storage service not initialized" */); const deltaStorage = new DeltaStorageService(this.deltaStorageUrl, this.tokenProvider, this.logger); return new DocumentDeltaStorageService(this.tenantId, this.documentId, diff --git a/packages/drivers/routerlicious-driver/src/documentServiceFactory.ts b/packages/drivers/routerlicious-driver/src/documentServiceFactory.ts index 9fbe05b7f97c..ba70ff3216ea 100644 --- a/packages/drivers/routerlicious-driver/src/documentServiceFactory.ts +++ b/packages/drivers/routerlicious-driver/src/documentServiceFactory.ts @@ -48,7 +48,7 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact logger?: ITelemetryBaseLogger, ): Promise { ensureFluidResolvedUrl(resolvedUrl); - assert(!!resolvedUrl.endpoints.ordererUrl, "Missing orderer URL!"); + assert(!!resolvedUrl.endpoints.ordererUrl, 0x0b2 /* "Missing orderer URL!" */); const parsedUrl = parse(resolvedUrl.url); if (!parsedUrl.pathname) { throw new Error("Parsed url should contain tenant and doc Id!!"); diff --git a/packages/drivers/routerlicious-driver/src/documentStorageService.ts b/packages/drivers/routerlicious-driver/src/documentStorageService.ts index 1ee8a2d60f60..52389825e1ec 100644 --- a/packages/drivers/routerlicious-driver/src/documentStorageService.ts +++ b/packages/drivers/routerlicious-driver/src/documentStorageService.ts @@ -261,18 +261,18 @@ export class DocumentStorageService implements IDocumentStorageService { /** Previous snapshot, subtree relative to this path part */ previousSnapshot: ISnapshotTreeEx, ): string { - assert(path.length > 0, "Expected at least 1 path part"); + assert(path.length > 0, 0x0b3 /* "Expected at least 1 path part" */); const key = path[0]; if (path.length === 1) { switch (handleType) { case SummaryType.Blob: { const tryId = previousSnapshot.blobs[key]; - assert(!!tryId, "Parent summary does not have blob handle for specified path."); + assert(!!tryId, 0x0b4 /* "Parent summary does not have blob handle for specified path." */); return tryId; } case SummaryType.Tree: { const tryId = previousSnapshot.trees[key]?.id; - assert(!!tryId, "Parent summary does not have tree handle for specified path."); + assert(!!tryId, 0x0b5 /* "Parent summary does not have tree handle for specified path." */); return tryId; } default: @@ -292,7 +292,7 @@ export class DocumentStorageService implements IDocumentStorageService { if (!this.blobsShaCache.has(hash)) { this.blobsShaCache.set(hash, ""); const blob = await this.manager.createBlob(parsedContent, encoding); - assert(hash === blob.sha, "Blob.sha and hash do not match!!"); + assert(hash === blob.sha, 0x0b6 /* "Blob.sha and hash do not match!!" */); } return hash; } diff --git a/packages/drivers/routerlicious-host/src/urlResolver.ts b/packages/drivers/routerlicious-host/src/urlResolver.ts index 07e500e0ea3d..fa357dd6f8f9 100644 --- a/packages/drivers/routerlicious-host/src/urlResolver.ts +++ b/packages/drivers/routerlicious-host/src/urlResolver.ts @@ -58,9 +58,10 @@ export class ContainerUrlResolver implements IUrlResolver { const fluidResolvedUrl = resolvedUrl as IFluidResolvedUrl; const parsedUrl = parse(fluidResolvedUrl.url); - assert(parsedUrl.pathname !== undefined, "Pathname should be defined"); + assert(parsedUrl.pathname !== undefined, 0x0b7 /* "Pathname should be defined" */); const [, tenantId, documentId] = parsedUrl.pathname.split("/"); - assert(documentId !== undefined && tenantId !== undefined, "Document and tenant IDs should both be defined"); + assert(documentId !== undefined && tenantId !== undefined, + 0x0b8 /* "Document and tenant IDs should both be defined" */); let url = relativeUrl; if (url.startsWith("/")) { diff --git a/packages/drivers/routerlicious-urlResolver/src/urlResolver.ts b/packages/drivers/routerlicious-urlResolver/src/urlResolver.ts index 6c9dc42a27ee..9c82f9cce67f 100644 --- a/packages/drivers/routerlicious-urlResolver/src/urlResolver.ts +++ b/packages/drivers/routerlicious-urlResolver/src/urlResolver.ts @@ -134,10 +134,10 @@ export class RouterliciousUrlResolver implements IUrlResolver { const fluidResolvedUrl = resolvedUrl as IFluidResolvedUrl; const parsedUrl = parse(fluidResolvedUrl.url); - assert(!!parsedUrl.pathname, "PathName should exist"); + assert(!!parsedUrl.pathname, 0x0b9 /* "PathName should exist" */); const [, tenantId, documentId] = parsedUrl.pathname.split("/"); - assert(!!tenantId, "Tenant id should exist"); - assert(!!documentId, "Document id should exist"); + assert(!!tenantId, 0x0ba /* "Tenant id should exist" */); + assert(!!documentId, 0x0bb /* "Document id should exist" */); let url = relativeUrl; if (url.startsWith("/")) { diff --git a/packages/framework/aqueduct/src/data-objects/pureDataObject.ts b/packages/framework/aqueduct/src/data-objects/pureDataObject.ts index ff09989769a4..0de401d93126 100644 --- a/packages/framework/aqueduct/src/data-objects/pureDataObject.ts +++ b/packages/framework/aqueduct/src/data-objects/pureDataObject.ts @@ -87,7 +87,7 @@ export abstract class PureDataObject { await this.preInitialize(); if (this.runtime.existing) { - assert(this.initProps === undefined, "Trying to initialize from existing while initProps is set!"); + assert(this.initProps === undefined, + 0x0be /* "Trying to initialize from existing while initProps is set!" */); await this.initializingFromExisting(); } else { await this.initializingFirstTime(this.context.createProps as S ?? this.initProps); diff --git a/packages/framework/dds-interceptions/src/map/sharedDirectoryWithInterception.ts b/packages/framework/dds-interceptions/src/map/sharedDirectoryWithInterception.ts index fdbd2a4b2b24..e23b38171f10 100644 --- a/packages/framework/dds-interceptions/src/map/sharedDirectoryWithInterception.ts +++ b/packages/framework/dds-interceptions/src/map/sharedDirectoryWithInterception.ts @@ -42,7 +42,7 @@ function createSubDirectoryWithInterception( let directory; // Set should not be called on the wrapped object from the interception callback as this will lead to // infinite recursion. - assert(executingCallback === false, "set called recursively from the interception callback"); + assert(executingCallback === false, 0x0bf /* "set called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { directory = subDirectory.set(key, value); diff --git a/packages/framework/dds-interceptions/src/map/sharedMapWithInterception.ts b/packages/framework/dds-interceptions/src/map/sharedMapWithInterception.ts index 727a861dd2c7..cfb9aea63725 100644 --- a/packages/framework/dds-interceptions/src/map/sharedMapWithInterception.ts +++ b/packages/framework/dds-interceptions/src/map/sharedMapWithInterception.ts @@ -32,7 +32,7 @@ export function createSharedMapWithInterception( let map; // Set should not be called on the wrapped object from the interception callback as this will lead to // infinite recursion. - assert(executingCallback === false, "set called recursively from the interception callback"); + assert(executingCallback === false, 0x0c0 /* "set called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { map = sharedMap.set(key, value); diff --git a/packages/framework/dds-interceptions/src/sequence/sharedStringWithInterception.ts b/packages/framework/dds-interceptions/src/sequence/sharedStringWithInterception.ts index ba5f58255194..5d9ec16b2c17 100644 --- a/packages/framework/dds-interceptions/src/sequence/sharedStringWithInterception.ts +++ b/packages/framework/dds-interceptions/src/sequence/sharedStringWithInterception.ts @@ -46,7 +46,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c1 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -73,7 +73,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c2 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -101,7 +101,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c3 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -124,7 +124,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c4 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -152,7 +152,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c5 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -178,7 +178,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c6 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -204,7 +204,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c7 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -233,7 +233,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c8 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; @@ -257,7 +257,7 @@ export function createSharedStringWithInterception( // Wrapper methods should not be called from the interception callback as this will lead to // infinite recursion. assert(executingCallback === false, - "Interception wrapper methods called recursively from the interception callback"); + 0x0c9 /* "Interception wrapper methods called recursively from the interception callback" */); context.containerRuntime.orderSequentially(() => { executingCallback = true; diff --git a/packages/framework/dds-interceptions/src/test/sharedDirectoryWithInterception.spec.ts b/packages/framework/dds-interceptions/src/test/sharedDirectoryWithInterception.spec.ts index aae866d4ddb3..8840fe57415a 100644 --- a/packages/framework/dds-interceptions/src/test/sharedDirectoryWithInterception.spec.ts +++ b/packages/framework/dds-interceptions/src/test/sharedDirectoryWithInterception.spec.ts @@ -333,7 +333,7 @@ describe("Shared Directory with Interception", () => { sharedDirectoryWithInterception.set("color", "green"); } catch (error) { assert.strictEqual(error.message, - "set called recursively from the interception callback", + "bf", "We should have caught an assert in replaceText because it detects an infinite recursion"); asserted = true; } diff --git a/packages/framework/dds-interceptions/src/test/sharedMapWithInterception.spec.ts b/packages/framework/dds-interceptions/src/test/sharedMapWithInterception.spec.ts index e0fd1b9bc070..11f452c1a520 100644 --- a/packages/framework/dds-interceptions/src/test/sharedMapWithInterception.spec.ts +++ b/packages/framework/dds-interceptions/src/test/sharedMapWithInterception.spec.ts @@ -110,7 +110,7 @@ describe("Shared Map with Interception", () => { sharedMapWithInterception.set("color", "green"); } catch (error) { assert.strictEqual(error.message, - "set called recursively from the interception callback", + "c0", "We should have caught an assert in replaceText because it detects an infinite recursion"); asserted = true; } diff --git a/packages/framework/dds-interceptions/src/test/sharedStringWithInterception.spec.ts b/packages/framework/dds-interceptions/src/test/sharedStringWithInterception.spec.ts index c1d062f64fdc..9c841005a4c3 100644 --- a/packages/framework/dds-interceptions/src/test/sharedStringWithInterception.spec.ts +++ b/packages/framework/dds-interceptions/src/test/sharedStringWithInterception.spec.ts @@ -160,7 +160,7 @@ describe("Shared String with Interception", () => { sharedStringWithInterception.replaceText(1, 2, text); } catch (error) { assert.strictEqual(error.message, - "Interception wrapper methods called recursively from the interception callback", + "c8", "We should have caught an assert in replaceText because it detects an infinite recursion"); asserted = true; } diff --git a/packages/framework/request-handler/src/requestHandlers.ts b/packages/framework/request-handler/src/requestHandlers.ts index 0054f2cc2be2..b6238f64d7e4 100644 --- a/packages/framework/request-handler/src/requestHandlers.ts +++ b/packages/framework/request-handler/src/requestHandlers.ts @@ -50,7 +50,7 @@ class LegacyUriHandle implements IFluidHandle } public attachGraph() { - assert(false, "Trying to use legacy graph attach!"); + assert(false, 0x0ca /* "Trying to use legacy graph attach!" */); } public async get(): Promise { diff --git a/packages/hosts/base-host/src/host.ts b/packages/hosts/base-host/src/host.ts index 628f14ddea5f..62c7d38aa6eb 100644 --- a/packages/hosts/base-host/src/host.ts +++ b/packages/hosts/base-host/src/host.ts @@ -81,7 +81,7 @@ export class BaseHost { const loader = await this.getLoader(); const container = await loader.createDetachedContainer(codeDetails); - assert(container.hasNullRuntime() === false, "Detached container should never have null runtime"); + assert(container.hasNullRuntime() === false, 0x0cb /* "Detached container should never have null runtime" */); return container; } @@ -93,7 +93,7 @@ export class BaseHost { const loader = await this.getLoader(); const container = await loader.rehydrateDetachedContainerFromSnapshot(snapshot); - assert(container.hasNullRuntime() === false, "Detached container should never have null runtime"); + assert(container.hasNullRuntime() === false, 0x0cc /* "Detached container should never have null runtime" */); return container; } diff --git a/packages/loader/container-loader/src/container.ts b/packages/loader/container-loader/src/container.ts index a8a008661ed7..e5b9f14f4a97 100644 --- a/packages/loader/container-loader/src/container.ts +++ b/packages/loader/container-loader/src/container.ts @@ -185,7 +185,7 @@ export async function waitContainerToCatchUp(container: Container) { const waitForOps = () => { assert(container.connectionState !== ConnectionState.Disconnected, - "Container disconnected while waiting for ops!"); + 0x0cd /* "Container disconnected while waiting for ops!" */); const hasCheckpointSequenceNumber = deltaManager.hasCheckpointSequenceNumber; const connectionOpSeqNumber = deltaManager.lastKnownSeqNumber; @@ -254,7 +254,7 @@ export class CollabWindowTracker { // We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN // update, which updates the MSN, then ack the update, etc...). Also, don't // count system messages in ops count. - assert(message.type !== MessageType.NoOp, "Don't acknowledge no-ops"); + assert(message.type !== MessageType.NoOp, 0x0ce /* "Don't acknowledge no-ops" */); if (this.lastNoopTime === undefined) { this.lastNoopTime = Date.now(); @@ -701,7 +701,7 @@ export class Container extends EventEmitterWithErrorHandling i this._context?.dispose(error !== undefined ? new Error(error.message) : undefined); - assert(this.connectionState === ConnectionState.Disconnected, "disconnect event was not raised!"); + assert(this.connectionState === ConnectionState.Disconnected, 0x0cf /* "disconnect event was not raised!" */); if (error !== undefined) { // Log current sequence number - useful if we have access to a file to understand better @@ -716,7 +716,7 @@ export class Container extends EventEmitterWithErrorHandling i error, ); } else { - assert(this.loaded, "Container in non-loaded state before close!"); + assert(this.loaded, 0x0d0 /* "Container in non-loaded state before close!" */); this.logger.sendTelemetryEvent({ eventName: "ContainerClose" }); } @@ -731,9 +731,9 @@ export class Container extends EventEmitterWithErrorHandling i // a new clientId and a future container using stale pending state without the new clientId would resubmit them this._deltaManager.close(); - assert(this.attachState === AttachState.Attached, "Container should be attached before close"); + assert(this.attachState === AttachState.Attached, 0x0d1 /* "Container should be attached before close" */); assert(this.resolvedUrl !== undefined && this.resolvedUrl.type === "fluid", - "resolved url should be valid Fluid url"); + 0x0d2 /* "resolved url should be valid Fluid url" */); const pendingState: IPendingLocalState = { pendingRuntimeState: this.context.getPendingLocalState(), url: this.resolvedUrl.url, @@ -749,7 +749,7 @@ export class Container extends EventEmitterWithErrorHandling i } public serialize(): string { - assert(this.attachState === AttachState.Detached, "Should only be called in detached container"); + assert(this.attachState === AttachState.Detached, 0x0d3 /* "Should only be called in detached container" */); const appSummary: ISummaryTree = this.context.createSummary(); const protocolSummary = this.captureProtocolSummary(); @@ -758,8 +758,8 @@ export class Container extends EventEmitterWithErrorHandling i } public async attach(request: IRequest): Promise { - assert(this.loaded, "not loaded"); - assert(!this.closed, "closed"); + assert(this.loaded, 0x0d4 /* "not loaded" */); + assert(!this.closed, 0x0d5 /* "closed" */); // If container is already attached or attach is in progress, return. if (this._attachState === AttachState.Attached || this.attachInProgress) { @@ -768,7 +768,7 @@ export class Container extends EventEmitterWithErrorHandling i this.attachInProgress = true; try { - assert(this.deltaManager.inbound.length === 0, "Inbound queue should be empty when attaching"); + assert(this.deltaManager.inbound.length === 0, 0x0d6 /* "Inbound queue should be empty when attaching" */); // Only take a summary if the container is in detached state, otherwise we could have local changes. // In failed attach call, we would already have a summary cached. if (this._attachState === AttachState.Detached) { @@ -786,7 +786,7 @@ export class Container extends EventEmitterWithErrorHandling i this.emit("attaching"); } assert(!!this.cachedAttachSummary, - "Summary should be there either by this attach call or previous attach call!!"); + 0x0d7 /* "Summary should be there either by this attach call or previous attach call!!" */); const createNewResolvedUrl = await this.urlResolver.resolve(request); ensureFluidResolvedUrl(createNewResolvedUrl); @@ -806,7 +806,7 @@ export class Container extends EventEmitterWithErrorHandling i "", this._context?.codeDetails, ); - assert(url !== undefined, "Container url undefined"); + assert(url !== undefined, 0x0d8 /* "Container url undefined" */); this.containerUrl = url; const parsedUrl = parseUrl(resolvedUrl.url); if (parsedUrl === undefined) { @@ -900,7 +900,7 @@ export class Container extends EventEmitterWithErrorHandling i } protected resumeInternal(args: IConnectionArgs) { - assert(!this.closed, "Attempting to setAutoReconnect() a closed DeltaManager"); + assert(!this.closed, 0x0d9 /* "Attempting to setAutoReconnect() a closed DeltaManager" */); // Resume processing ops if (!this.resumedOpProcessingAfterLoad) { @@ -1045,7 +1045,7 @@ export class Container extends EventEmitterWithErrorHandling i this._storageService = new BlobCacheStorageService(this.storageService, blobs); // ensure we did not lose that policy in the process of wrapping - assert(blobSize === this._storageService.policies?.minBlobSize, "blob size policy"); + assert(blobSize === this._storageService.policies?.minBlobSize, 0x0da /* "blob size policy" */); } const attributes: IDocumentAttributes = { branch: this.id, @@ -1304,7 +1304,7 @@ export class Container extends EventEmitterWithErrorHandling i private async rehydrateDetachedFromSnapshot(snapshotTree: ISnapshotTree) { const attributes = await this.getDocumentAttributes(undefined, snapshotTree); - assert(attributes.sequenceNumber === 0, "Seq number in detached container should be 0!!"); + assert(attributes.sequenceNumber === 0, 0x0db /* "Seq number in detached container should be 0!!" */); this.attachDeltaManagerOpHandler(attributes); // We know this is create detached flow with snapshot. @@ -1664,7 +1664,7 @@ export class Container extends EventEmitterWithErrorHandling i if (!this.context.disposed) { this.context.setConnectionState(state, this.clientId); } - assert(this.protocolHandler !== undefined, "Protocol handler should be set here"); + assert(this.protocolHandler !== undefined, 0x0dc /* "Protocol handler should be set here" */); this.protocolHandler.quorum.setConnectionState(state, this.clientId); raiseConnectedEvent(this.logger, this, state, this.clientId); @@ -1789,7 +1789,7 @@ export class Container extends EventEmitterWithErrorHandling i previousRuntimeState: IRuntimeState = {}, pendingLocalState?: unknown, ) { - assert(this._context?.disposed !== false, "Existing context not disposed"); + assert(this._context?.disposed !== false, 0x0dd /* "Existing context not disposed" */); // If this assert fires, our state tracking is likely not synchronized between COntainer & runtime. if (this._dirtyContainer) { this.logger.sendErrorEvent({ eventName: "DirtyContainerReloadContainer"}); diff --git a/packages/loader/container-loader/src/containerContext.ts b/packages/loader/container-loader/src/containerContext.ts index f1da0aed9903..6d6aaf0ff51d 100644 --- a/packages/loader/container-loader/src/containerContext.ts +++ b/packages/loader/container-loader/src/containerContext.ts @@ -246,7 +246,7 @@ export class ContainerContext implements IContainerContext { public setConnectionState(connected: boolean, clientId?: string) { const runtime = this.runtime; - assert(connected === this.connected, "Mismatch in connection state while setting"); + assert(connected === this.connected, 0x0de /* "Mismatch in connection state while setting" */); runtime.setConnectionState(connected, clientId); } diff --git a/packages/loader/container-loader/src/deltaManager.ts b/packages/loader/container-loader/src/deltaManager.ts index c5970d040919..cc8a4c6c3b03 100644 --- a/packages/loader/container-loader/src/deltaManager.ts +++ b/packages/loader/container-loader/src/deltaManager.ts @@ -230,7 +230,7 @@ export class DeltaManager */ public get hasCheckpointSequenceNumber() { // Valid to be called only if we have active connection. - assert(this.connection !== undefined, "Missing active connection"); + assert(this.connection !== undefined, 0x0df /* "Missing active connection" */); return this._hasCheckpointSequenceNumber; } @@ -373,7 +373,7 @@ export class DeltaManager // ensure we did not lose that policy in the process of wrapping assert(storageService.policies?.minBlobSize === this.storageService.policies?.minBlobSize, - "lost minBlobSize policy"); + 0x0e0 /* "lost minBlobSize policy" */); return this.storageService; } @@ -385,7 +385,7 @@ export class DeltaManager public setAutomaticReconnect(reconnect: boolean): void { assert( this._reconnectMode !== ReconnectMode.Never, - "Cannot toggle automatic reconnect if reconnect is set to Never."); + 0x0e1 /* "Cannot toggle automatic reconnect if reconnect is set to Never." */); this._reconnectMode = reconnect ? ReconnectMode.Enabled : ReconnectMode.Disabled; } @@ -516,10 +516,10 @@ export class DeltaManager this.lastObservedSeqNumber = sequenceNumber; // We will use same check in other places to make sure all the seq number above are set properly. - assert(this.handler === undefined, "DeltaManager already has attached op handler!"); + assert(this.handler === undefined, 0x0e2 /* "DeltaManager already has attached op handler!" */); this.handler = handler; // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions - assert(!!(this.handler as any), "Newly set op handler is null/undefined!"); + assert(!!(this.handler as any), 0x0e3 /* "Newly set op handler is null/undefined!" */); this._inbound.resume(); this._inboundSignal.resume(); @@ -738,7 +738,7 @@ export class DeltaManager // reset clientSequenceNumber if we are using new clientId. // we keep info about old connection as long as possible to be able to account for all non-acked ops // that we pick up on next connection. - assert(!!this.connection, "Lost old connection!"); + assert(!!this.connection, 0x0e4 /* "Lost old connection!" */); if (this.lastSubmittedClientId !== this.connection?.clientId) { this.lastSubmittedClientId = this.connection?.clientId; this.clientSequenceNumber = 0; @@ -886,7 +886,7 @@ export class DeltaManager // Issue async request for deltas - limit the number fetched to MaxBatchDeltas canRetry = true; - assert(deltaStorage !== undefined, "delta storage undefined while getting single batch!"); + assert(deltaStorage !== undefined, 0x0e5 /* "delta storage undefined while getting single batch!" */); // left is inclusive for ParallelRequests, but exclusive for IDocumentDeltaStorageService // right is exclusive for both const deltasP = deltaStorage.get(from - 1, to); @@ -1117,7 +1117,7 @@ export class DeltaManager */ private setupNewSuccessfulConnection(connection: IDocumentDeltaConnection, requestedMode: ConnectionMode) { // Old connection should have been cleaned up before establishing a new one - assert(this.connection === undefined, "old connection exists on new connection setup"); + assert(this.connection === undefined, 0x0e6 /* "old connection exists on new connection setup" */); this.connection = connection; // Does information in scopes & mode matches? @@ -1125,8 +1125,8 @@ export class DeltaManager // But if we ask read, server can still give us write. const readonly = !connection.claims.scopes.includes(ScopeType.DocWrite); assert(requestedMode === "read" || readonly === (this.connectionMode === "read"), - "claims/connectionMode mismatch"); - assert(!readonly || this.connectionMode === "read", "readonly perf with write connection"); + 0x0e7 /* "claims/connectionMode mismatch" */); + assert(!readonly || this.connectionMode === "read", 0x0e8 /* "readonly perf with write connection" */); this.set_readonlyPermissions(readonly); this.refreshDelayInfo(this.deltaStreamDelayId); @@ -1142,7 +1142,7 @@ export class DeltaManager // but it's safe to assume (until better design is put into place) that batches should not exist // across multiple connections. Right now we assume runtime will not submit any ops in disconnected // state. As requirements change, so should these checks. - assert(this.messageBuffer.length === 0, "messageBuffer is not empty on new connection"); + assert(this.messageBuffer.length === 0, 0x0e9 /* "messageBuffer is not empty on new connection" */); this._outbound.resume(); @@ -1230,7 +1230,7 @@ export class DeltaManager // but it's safe to assume (until better design is put into place) that batches should not exist // across multiple connections. Right now we assume runtime will not submit any ops in disconnected // state. As requirements change, so should these checks. - assert(this.messageBuffer.length === 0, "messageBuffer is not empty on disconnect"); + assert(this.messageBuffer.length === 0, 0x0ea /* "messageBuffer is not empty on disconnect" */); // eslint-disable-next-line @typescript-eslint/no-floating-promises this._outbound.pause(); @@ -1256,7 +1256,7 @@ export class DeltaManager // We quite often get protocol errors before / after observing nack/disconnect // we do not want to run through same sequence twice. // If we're already disconnected/disconnecting it's not appropriate to call this again. - assert(this.connection !== undefined, "Missing connection for reconnect"); + assert(this.connection !== undefined, 0x0eb /* "Missing connection for reconnect" */); this.disconnectFromDeltaStream(error.message); @@ -1333,7 +1333,7 @@ export class DeltaManager const n = this.previouslyProcessedMessage?.sequenceNumber; assert(n === undefined || n === this.lastQueuedSequenceNumber, - "Unexpected value for previously processed message's sequence number"); + 0x0ec /* "Unexpected value for previously processed message's sequence number" */); for (const message of messages) { // Check that the messages are arriving in the expected order @@ -1399,7 +1399,7 @@ export class DeltaManager assert( message.clientId !== undefined || isSystemMessage(message), - "non-system message have to have clientId", + 0x0ed /* "non-system message have to have clientId" */, ); // if we have connection, and message is local, then we better treat is as local! @@ -1407,15 +1407,15 @@ export class DeltaManager this.connection === undefined || this.connection.clientId !== message.clientId || this.lastSubmittedClientId === message.clientId, - "Not accounting local messages correctly", + 0x0ee /* "Not accounting local messages correctly" */, ); if (this.lastSubmittedClientId !== undefined && this.lastSubmittedClientId === message.clientId) { const clientSequenceNumber = message.clientSequenceNumber; - assert(this.clientSequenceNumberObserved < clientSequenceNumber, "client seq# not growing"); + assert(this.clientSequenceNumberObserved < clientSequenceNumber, 0x0ef /* "client seq# not growing" */); assert(clientSequenceNumber <= this.clientSequenceNumber, - "Incoming local client seq# > generated by this client"); + 0x0f0 /* "Incoming local client seq# > generated by this client" */); this.clientSequenceNumberObserved = clientSequenceNumber; } @@ -1487,7 +1487,7 @@ export class DeltaManager return; } - assert(fromArg === this.lastQueuedSequenceNumber, "from arg"); + assert(fromArg === this.lastQueuedSequenceNumber, 0x0f1 /* "from arg" */); let from = fromArg; const n = this.previouslyProcessedMessage?.sequenceNumber; @@ -1497,8 +1497,8 @@ export class DeltaManager // Knowing about this mechanism, we could ask for op we already observed to increase validation. // This is especially useful when coming out of offline mode or loading from // very old cached (by client / driver) snapshot. - assert(n === fromArg, "previouslyProcessedMessage"); - assert(from > 0, "not positive"); + assert(n === fromArg, 0x0f2 /* "previouslyProcessedMessage" */); + assert(from > 0, 0x0f3 /* "not positive" */); from--; } diff --git a/packages/loader/container-loader/src/deltaQueue.ts b/packages/loader/container-loader/src/deltaQueue.ts index 26cdadb8c743..5cffc3a6453b 100644 --- a/packages/loader/container-loader/src/deltaQueue.ts +++ b/packages/loader/container-loader/src/deltaQueue.ts @@ -87,7 +87,7 @@ export class DeltaQueue extends TypedEventEmitter> imple } public resume(): void { - assert(this.pauseCount > 0, "Nonzero pause-count on resume()"); + assert(this.pauseCount > 0, 0x0f4 /* "Nonzero pause-count on resume()" */); this.pauseCount--; if (!this.paused) { this.ensureProcessing(); diff --git a/packages/loader/container-utils/src/error.ts b/packages/loader/container-utils/src/error.ts index b409705e2955..38f1a4ebcfa0 100644 --- a/packages/loader/container-utils/src/error.ts +++ b/packages/loader/container-utils/src/error.ts @@ -133,7 +133,7 @@ export function CreateProcessingError( * @param error - Error to be converted. */ export function CreateContainerError(error: any): ICriticalContainerError { - assert(error !== undefined, "Missing error input"); + assert(error !== undefined, 0x0f5 /* "Missing error input" */); if (typeof error === "object" && error !== null) { const err = error; diff --git a/packages/loader/driver-utils/src/blobAggregationStorage.ts b/packages/loader/driver-utils/src/blobAggregationStorage.ts index bb3daee0f6ec..9d4c9064a4f9 100644 --- a/packages/loader/driver-utils/src/blobAggregationStorage.ts +++ b/packages/loader/driver-utils/src/blobAggregationStorage.ts @@ -130,7 +130,7 @@ export abstract class SnapshotExtractor { subTree = subTree.trees[subPath]; } const blobName = pathSplit[pathSplit.length - 1]; - assert(subTree.blobs[blobName] === undefined, "real blob ID exists"); + assert(subTree.blobs[blobName] === undefined, 0x0f6 /* "real blob ID exists" */); subTree.blobs[blobName] = id; } // eslint-disable-next-line @typescript-eslint/no-dynamic-delete @@ -156,12 +156,12 @@ export abstract class SnapshotExtractor { class SnapshotExtractorInPlace extends SnapshotExtractor { public async getBlob(id: string, tree: ISnapshotTree): Promise { const blob = tree.blobs[id]; - assert(blob !== undefined, "aggregate blob missing"); + assert(blob !== undefined, 0x0f7 /* "aggregate blob missing" */); return stringToBuffer(blob, "base64"); } public setBlob(id: string, tree: ISnapshotTree, content: string) { - assert(tree.blobs[id] === undefined, "blob from aggregate blob exists on its own"); + assert(tree.blobs[id] === undefined, 0x0f8 /* "blob from aggregate blob exists on its own" */); tree.blobs[id] = fromUtf8ToBase64(content); } } @@ -288,9 +288,9 @@ export class BlobAggregationStorage extends SnapshotExtractor implements IDocume // are there other ways we can get here? createFile is one flow, but we should not be reading blobs // in such flow - assert(this.loadedFromSummary, "never read summary"); + assert(this.loadedFromSummary, 0x0f9 /* "never read summary" */); const blob = this.virtualBlobs.get(id); - assert(blob !== undefined, "virtual blob not found"); + assert(blob !== undefined, 0x0fa /* "virtual blob not found" */); return blob; } @@ -325,7 +325,7 @@ export class BlobAggregationStorage extends SnapshotExtractor implements IDocume let aggregator = aggregatorArg; if (startingLevel) { - assert(aggregator === undefined, "logic err with aggregator"); + assert(aggregator === undefined, 0x0fb /* "logic err with aggregator" */); aggregator = new BlobAggregator(); } @@ -365,26 +365,27 @@ export class BlobAggregationStorage extends SnapshotExtractor implements IDocume handlePath = handlePath.substr(1); } // Ensure only whole data stores can be reused, no reusing at deeper level! - assert(level === 0, "tree reuse at lower level"); - assert(handlePath.indexOf("/") === -1, "data stores are writing incremental summaries!"); + assert(level === 0, 0x0fc /* "tree reuse at lower level" */); + assert(handlePath.indexOf("/") === -1, + 0x0fd /* "data stores are writing incremental summaries!" */); break; } case SummaryType.Attachment: - assert(this.isRealStorageId(obj.id), "attachment is aggregate blob"); + assert(this.isRealStorageId(obj.id), 0x0fe /* "attachment is aggregate blob" */); break; default: unreachableCase(obj, `Unknown type: ${(obj as any).type}`); } } - assert(newSummary.tree[this.aggregatedBlobName] === undefined, "duplicate aggregate blob"); + assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* "duplicate aggregate blob" */); if (startingLevel) { // Note: It would be great to add code here to unpack aggregate blob back to normal blobs // If only one blob made it into aggregate. Currently that does not happen as we always have // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue. // But it's possible that in future that would be great addition! // Good news - it's backward compatible change. - assert(aggregator !== undefined, "logic error"); + assert(aggregator !== undefined, 0x100 /* "logic error" */); const content = aggregator.getAggregatedBlobContent(); if (content !== undefined) { newSummary.tree[this.aggregatedBlobName] = { diff --git a/packages/loader/driver-utils/src/buildSnapshotTree.ts b/packages/loader/driver-utils/src/buildSnapshotTree.ts index 331bb643e1d6..57bf50050648 100644 --- a/packages/loader/driver-utils/src/buildSnapshotTree.ts +++ b/packages/loader/driver-utils/src/buildSnapshotTree.ts @@ -49,7 +49,7 @@ function flattenCore( }; entries.push(entry); } else { - assert(treeEntry.type === TreeEntry.Tree, "Unexpected tree entry type on flatten!"); + assert(treeEntry.type === TreeEntry.Tree, 0x101 /* "Unexpected tree entry type on flatten!" */); const t = treeEntry.value; const entry: git.ITreeEntry = { mode: FileMode[treeEntry.mode], diff --git a/packages/loader/driver-utils/src/parallelRequests.ts b/packages/loader/driver-utils/src/parallelRequests.ts index 369dc0ab2289..ca3c89764268 100644 --- a/packages/loader/driver-utils/src/parallelRequests.ts +++ b/packages/loader/driver-utils/src/parallelRequests.ts @@ -47,8 +47,8 @@ export class ParallelRequests { } public async run(concurrency: number) { - assert(concurrency > 0, "invalid level of concurrency"); - assert(this.working, "trying to parallel run while not working"); + assert(concurrency > 0, 0x102 /* "invalid level of concurrency" */); + assert(this.working, 0x103 /* "trying to parallel run while not working" */); let c = concurrency; while (c > 0) { @@ -61,8 +61,8 @@ export class ParallelRequests { private done() { // We should satisfy request fully. - assert(this.to !== undefined, "undefined end point for parallel fetch"); - assert(this.nextToDeliver === this.to, "unexpected end point for parallel fetch"); + assert(this.to !== undefined, 0x104 /* "undefined end point for parallel fetch" */); + assert(this.nextToDeliver === this.to, 0x105 /* "unexpected end point for parallel fetch" */); this.working = false; this.endEvent.resolve(); } @@ -86,18 +86,18 @@ export class ParallelRequests { // Account for cancellation - state might be not in consistent state on cancelling operation if (this.working) { assert(this.requestsInFlight !== 0 || this.results.size === 0, - "in unexpected state after dispatching results"); + 0x106 /* "in unexpected state after dispatching results" */); if (this.requestsInFlight === 0) { // we should have dispatched everything, no matter whether we knew about the end or not. // see comment in addRequestCore() around throwing away chunk if it's above this.to assert(this.results.size === 0, - "ending dispatch with remaining results to be sent"); + 0x107 /* "ending dispatch with remaining results to be sent" */); this.done(); } else if (this.to !== undefined && this.nextToDeliver >= this.to) { // Learned about the end and dispatched all the ops up to it. // Ignore all the in-flight requests above boundary - unblock caller sooner. - assert(!this.knewTo, "ending results dispatch but knew in advance about more requests"); + assert(!this.knewTo, 0x108 /* "ending results dispatch but knew in advance about more requests" */); this.done(); } } @@ -123,7 +123,7 @@ export class ParallelRequests { this.latestRequested = Math.min(this.to, this.latestRequested); } - assert(from < this.latestRequested, "unexpected next chunk position"); + assert(from < this.latestRequested, 0x109 /* "unexpected next chunk position" */); return { from, to: this.latestRequested}; } @@ -137,7 +137,7 @@ export class ParallelRequests { } private async addRequestCore(fromArg: number, toArg: number) { - assert(this.working, "cannot add parallel request while not working"); + assert(this.working, 0x10a /* "cannot add parallel request while not working" */); let from = fromArg; let to = toArg; @@ -146,12 +146,12 @@ export class ParallelRequests { this.requestsInFlight++; while (this.working) { const requestedLength = to - from; - assert(requestedLength > 0, "invalid parallel request range"); + assert(requestedLength > 0, 0x10b /* "invalid parallel request range" */); // We should not be wasting time asking for something useless. if (this.to !== undefined) { - assert(from < this.to, "invalid parallel request start point"); - assert(to <= this.to, "invalid parallel request end point"); + assert(from < this.to, 0x10c /* "invalid parallel request start point" */); + assert(to <= this.to, 0x10d /* "invalid parallel request end point" */); } this.requests++; @@ -174,7 +174,7 @@ export class ParallelRequests { // While it's useful not to throw this result, this is very corner cases and makes logic // (including consistency checks) much harder to write correctly. // So for now, we are throwing this result out the window. - assert(!this.knewTo, "should not throw result if we knew about boundary in advance"); + assert(!this.knewTo, 0x10e /* "should not throw result if we knew about boundary in advance" */); // Learn how often it happens and if it's too wasteful to throw these chunks. // If it pops into our view a lot, we would need to reconsider how we approach it. // Note that this is not visible to user other than potentially not hitting 100% of @@ -205,8 +205,9 @@ export class ParallelRequests { // This is very specific property of storage / ops, so this logic is not here, but given only // one user of this class, we assert that to catch issues earlier. // These invariant can be relaxed if needed. - assert(!partial, "empty/partial chunks should not be returned by caching"); - assert(!this.knewTo, "callback should retry until valid fetch before it learns new boundary"); + assert(!partial, 0x10f /* "empty/partial chunks should not be returned by caching" */); + assert(!this.knewTo, + 0x110 /* "callback should retry until valid fetch before it learns new boundary" */); } let fullChunk = (requestedLength <= payload.length); // we can possible get more than we asked. @@ -216,7 +217,7 @@ export class ParallelRequests { if (!this.knewTo) { if (this.to === undefined || this.to > from) { // The END - assert(!this.knewTo, "should not know futher boundary at end"); + assert(!this.knewTo, 0x111 /* "should not know futher boundary at end" */); this.to = from; } break; @@ -285,9 +286,9 @@ export class Queue implements IReadPipe { } protected pushCore(value: Promise) { - assert(!this.done, "cannot push onto queue if done"); + assert(!this.done, 0x112 /* "cannot push onto queue if done" */); if (this.deferred) { - assert(this.queue.length === 0, "deferred queue should be empty"); + assert(this.queue.length === 0, 0x113 /* "deferred queue should be empty" */); this.deferred.resolve(value); this.deferred = undefined; } else { @@ -296,12 +297,12 @@ export class Queue implements IReadPipe { } public async pop(): Promise { - assert(this.deferred === undefined, "cannot pop if deferred"); + assert(this.deferred === undefined, 0x114 /* "cannot pop if deferred" */); const el = this.queue.shift(); if (el !== undefined) { return el; } - assert(!this.done, "queue should not be done during pop"); + assert(!this.done, 0x115 /* "queue should not be done during pop" */); this.deferred = new Deferred(); return this.deferred.promise; } diff --git a/packages/runtime/agent-scheduler/src/scheduler.ts b/packages/runtime/agent-scheduler/src/scheduler.ts index a91e1497070d..9e7d9eeb2d73 100644 --- a/packages/runtime/agent-scheduler/src/scheduler.ts +++ b/packages/runtime/agent-scheduler/src/scheduler.ts @@ -39,7 +39,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { } else { root = await runtime.getChannel("root") as ISharedMap; const handle = await root.wait>>("scheduler"); - assert(handle !== undefined, "Missing handle on scheduler load"); + assert(handle !== undefined, 0x116 /* "Missing handle on scheduler load" */); scheduler = await handle.get(); } const agentScheduler = new AgentScheduler(runtime, context, scheduler); @@ -55,7 +55,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { return UnattachedClientId; } const clientId = this.runtime.clientId; - assert(!!clientId, "Trying to get missing clientId!"); + assert(!!clientId, 0x117 /* "Trying to get missing clientId!" */); return clientId; } @@ -110,7 +110,8 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { // TaskManager. In the future, as new usage shows up, we may need to reconsider that. // I'm adding assert here to catch that case and make decision on which way we go - push requirements // to consumers to make a choice, or centrally make this call here. - assert(this.context.deltaManager.clientDetails.capabilities.interactive, "Bad client interactive check"); + assert(this.context.deltaManager.clientDetails.capabilities.interactive, + 0x118 /* "Bad client interactive check" */); // Check the current status and express interest if it's a new one (undefined) or currently unpicked (null). if (this.isActive()) { @@ -130,7 +131,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { } // Note - the assumption is - we are connected. // If not - all tasks should have been dropped already on disconnect / attachment - assert(active, "This agent became inactive while releasing"); + assert(active, 0x119 /* "This agent became inactive while releasing" */); if (this.getTaskClientId(taskUrl) !== this.clientId) { return Promise.reject(new Error(`${taskUrl} was never picked`)); } @@ -156,7 +157,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { const taskStatus = this.getTaskClientId(taskUrl); // Task should be either registered (null) or picked up. - assert(taskStatus !== undefined, `Unsuccessful registration`); + assert(taskStatus !== undefined, 0x11a /* `Unsuccessful registration` */); if (taskStatus === null) { debug(`Registered ${taskUrl}`); @@ -181,7 +182,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { } private async clearTasks(taskUrls: string[]) { - assert(this.isActive(), "Trying to clear tasks on inactive agent"); + assert(this.isActive(), 0x11b /* "Trying to clear tasks on inactive agent" */); const clearP: Promise[] = []; for (const taskUrl of taskUrls) { debug(`Clearing ${taskUrl}`); @@ -205,7 +206,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { // Probably okay for now to have every client try to do this. // eslint-disable-next-line @typescript-eslint/no-misused-promises quorum.on("removeMember", async (clientId: string) => { - assert(this.runtime.objectsRoutingContext.isAttached, "Detached object routing context"); + assert(this.runtime.objectsRoutingContext.isAttached, 0x11c /* "Detached object routing context" */); // Cleanup only if connected. If not, cleanup will happen in initializeCore() that runs on connection. if (this.isActive()) { const leftTasks: string[] = []; @@ -256,7 +257,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { } private onNewTaskAssigned(key: string) { - assert(!this.runningTasks.has(key), "task is already running"); + assert(!this.runningTasks.has(key), 0x11d /* "task is already running" */); this.runningTasks.add(key); const worker = this.locallyRunnableTasks.get(key); if (worker === undefined) { @@ -275,7 +276,7 @@ class AgentScheduler extends EventEmitter implements IAgentScheduler { this.runningTasks.delete(key); this.emit("released", key); } - assert(currentClient !== undefined, "client is undefined"); + assert(currentClient !== undefined, 0x11e /* "client is undefined" */); if (this.isActive()) { // attempt to pick up task if we are connected. // If not, initializeCore() will do it when connected diff --git a/packages/runtime/container-runtime/src/blobManager.ts b/packages/runtime/container-runtime/src/blobManager.ts index 7394c54d98ab..7eee8e61d995 100644 --- a/packages/runtime/container-runtime/src/blobManager.ts +++ b/packages/runtime/container-runtime/src/blobManager.ts @@ -61,7 +61,7 @@ export class BlobManager { ) { } public async getBlob(blobId: string): Promise> { - assert(this.blobIds.has(blobId) || this.pendingBlobIds.has(blobId), "requesting unknown blobs"); + assert(this.blobIds.has(blobId) || this.pendingBlobIds.has(blobId), 0x11f /* "requesting unknown blobs" */); return new BlobHandle( `${BlobManager.basePath}/${blobId}`, this.routeContext, diff --git a/packages/runtime/container-runtime/src/connectionTelemetry.ts b/packages/runtime/container-runtime/src/connectionTelemetry.ts index 9fdf4ab5b810..b23b7b0cd9e6 100644 --- a/packages/runtime/container-runtime/src/connectionTelemetry.ts +++ b/packages/runtime/container-runtime/src/connectionTelemetry.ts @@ -133,7 +133,8 @@ class OpPerfTelemetry { if (this.clientId === message.clientId && this.clientSequenceNumberForLatencyStatistics === message.clientSequenceNumber) { - assert(this.opSendTimeForLatencyStatistics !== undefined, "Undefined latency statistics (op send time)"); + assert(this.opSendTimeForLatencyStatistics !== undefined, + 0x120 /* "Undefined latency statistics (op send time)" */); this.logger.sendPerformanceEvent({ eventName: "OpRoundtripTime", sequenceNumber, diff --git a/packages/runtime/container-runtime/src/containerRuntime.ts b/packages/runtime/container-runtime/src/containerRuntime.ts index d14fca33e0ed..3389adda48f7 100644 --- a/packages/runtime/container-runtime/src/containerRuntime.ts +++ b/packages/runtime/container-runtime/src/containerRuntime.ts @@ -262,11 +262,11 @@ export function unpackRuntimeMessage(message: ISequencedDocumentMessage) { } else { // new format const innerContents = message.contents as ContainerRuntimeMessage; - assert(innerContents.type !== undefined, "Undefined inner contents type!"); + assert(innerContents.type !== undefined, 0x121 /* "Undefined inner contents type!" */); message.type = innerContents.type; message.contents = innerContents.contents; } - assert(isRuntimeMessage(message), "Message to unpack is not proper runtime message"); + assert(isRuntimeMessage(message), 0x122 /* "Message to unpack is not proper runtime message" */); } else { // Legacy format, but it's already "unpacked", // i.e. message.type is actually ContainerMessageType. @@ -765,7 +765,7 @@ export class ContainerRuntime extends TypedEventEmitter this.blobManager = new BlobManager( this.IFluidHandleContext, () => { - assert(this.attachState !== AttachState.Detached, "Blobs NYI in detached container mode"); + assert(this.attachState !== AttachState.Detached, 0x123 /* "Blobs NYI in detached container mode" */); return this.storage; }, (blobId) => this.submit(ContainerMessageType.BlobAttach, undefined, undefined, { blobId }), @@ -832,7 +832,7 @@ export class ContainerRuntime extends TypedEventEmitter this.deltaManager.on("readonly", (readonly: boolean) => { // we accumulate ops while being in read-only state. // once user gets write permissions and we have active connection, flush all pending ops. - assert(readonly === this.deltaManager.readonly, "inconsistent readonly property/event state"); + assert(readonly === this.deltaManager.readonly, 0x124 /* "inconsistent readonly property/event state" */); // We need to be very careful with when we (re)send pending ops, to ensure that we only send ops // when we either never send an op, or attempted to send it but we know for sure it was not @@ -846,7 +846,7 @@ export class ContainerRuntime extends TypedEventEmitter // can rely on same safety mechanism and resend ops only when we establish new connection. // This is applicable for read-only permissions (event is raised before connection is properly registered), // but it's an extra requirement for Container.forceReadonly() API - assert(!readonly || !this.connected, "Unsafe to transition to read-only state!"); + assert(!readonly || !this.connected, 0x125 /* "Unsafe to transition to read-only state!" */); this.replayPendingStates(); }); @@ -961,7 +961,8 @@ export class ContainerRuntime extends TypedEventEmitter const subRequest = requestParser.createSubRequest(1); // We always expect createSubRequest to include a leading slash, but asserting here to protect against // unintentionally modifying the url if that changes. - assert(subRequest.url.startsWith("/"), "Expected createSubRequest url to include a leading slash"); + assert(subRequest.url.startsWith("/"), + 0x126 /* "Expected createSubRequest url to include a leading slash" */); return dataStore.IFluidRouter.request(subRequest); } @@ -1071,7 +1072,7 @@ export class ContainerRuntime extends TypedEventEmitter const oldState = this.dirtyContainer; this.dirtyContainer = false; - assert(this.emitDirtyDocumentEvent, "dirty document event not set on replay"); + assert(this.emitDirtyDocumentEvent, 0x127 /* "dirty document event not set on replay" */); this.emitDirtyDocumentEvent = false; let newState: boolean; @@ -1098,7 +1099,7 @@ export class ContainerRuntime extends TypedEventEmitter * so we listen directly from DeltaManager instead. */ private readonly onOp = (op: ISequencedDocumentMessage) => { - assert(!this.paused, "Container should not already be paused before applying stashed ops"); + assert(!this.paused, 0x128 /* "Container should not already be paused before applying stashed ops" */); this.paused = true; this.scheduleManager.setPaused(true); const stashP = this.pendingStateManager.applyStashedOpsAt(op.sequenceNumber); @@ -1143,7 +1144,7 @@ export class ContainerRuntime extends TypedEventEmitter raiseConnectedEvent(this._logger, this, connected, clientId); if (connected) { - assert(!!clientId, "Missing clientId"); + assert(!!clientId, 0x129 /* "Missing clientId" */); this.summaryManager.setConnected(clientId); } else { this.summaryManager.setDisconnected(); @@ -1196,7 +1197,7 @@ export class ContainerRuntime extends TypedEventEmitter this.dataStores.processFluidDataStoreOp(message, local || localAck, localOpMetadata); break; case ContainerMessageType.BlobAttach: - assert(message?.metadata?.blobId, "Missing blob id on metadata"); + assert(message?.metadata?.blobId, 0x12a /* "Missing blob id on metadata" */); this.blobManager.addBlobId(message.metadata.blobId); break; default: @@ -1230,7 +1231,7 @@ export class ContainerRuntime extends TypedEventEmitter public async getRootDataStore(id: string, wait = true): Promise { const context = await this.dataStores.getDataStore(id, wait); - assert(await context.isRoot(), "did not get root data store"); + assert(await context.isRoot(), 0x12b /* "did not get root data store" */); return context.realize(); } @@ -1390,7 +1391,7 @@ export class ContainerRuntime extends TypedEventEmitter public isMessageDirtyable(message: ISequencedDocumentMessage) { assert( isRuntimeMessage(message) === true, - "Message passed for dirtyable check should be a container runtime message", + 0x12c /* "Message passed for dirtyable check should be a container runtime message" */, ); return this.isContainerMessageDirtyable(message.type as ContainerMessageType, message.contents); } @@ -1429,9 +1430,10 @@ export class ContainerRuntime extends TypedEventEmitter public setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void { if (attachState === AttachState.Attaching) { assert(this.attachState === AttachState.Attaching, - "Container Context should already be in attaching state"); + 0x12d /* "Container Context should already be in attaching state" */); } else { - assert(this.attachState === AttachState.Attached, "Container Context should already be in attached state"); + assert(this.attachState === AttachState.Attached, + 0x12e /* "Container Context should already be in attached state" */); } this.dataStores.setAttachState(attachState); } @@ -1525,7 +1527,7 @@ export class ContainerRuntime extends TypedEventEmitter const summarizeResult = await this.summarizerNode.summarize(fullTree, trackState); assert(summarizeResult.summary.type === SummaryType.Tree, - "Container Runtime's summarize should always return a tree"); + 0x12f /* "Container Runtime's summarize should always return a tree" */); return summarizeResult as IChannelSummarizeResult; } @@ -1574,7 +1576,7 @@ export class ContainerRuntime extends TypedEventEmitter const lastSequenceNumber = this.deltaManager.lastSequenceNumber; assert( lastSequenceNumber === summaryRefSeqNum, - `lastSequenceNumber changed while paused. ${lastSequenceNumber} !== ${summaryRefSeqNum}`, + 0x130 /* `lastSequenceNumber changed while paused. ${lastSequenceNumber} !== ${summaryRefSeqNum}` */, ); const handle = await this.storage.uploadSummaryWithContext( @@ -1664,7 +1666,7 @@ export class ContainerRuntime extends TypedEventEmitter this.chunkMap.set(clientId, map); } assert(chunkedContent.chunkId === map.length + 1, - "Mismatch between new chunkId and expected chunkMap"); // 1-based indexing + 0x131 /* "Mismatch between new chunkId and expected chunkMap" */); // 1-based indexing map.push(chunkedContent.contents); } @@ -1719,7 +1721,7 @@ export class ContainerRuntime extends TypedEventEmitter this.closeFn(CreateContainerError("op submitted while processing pending initial state")); } // There should be no ops in detached container state! - assert(this.attachState !== AttachState.Detached, "sending ops in detached container"); + assert(this.attachState !== AttachState.Detached, 0x132 /* "sending ops in detached container" */); let clientSequenceNumber: number = -1; let opMetadataInternal = opMetadata; @@ -1799,7 +1801,7 @@ export class ContainerRuntime extends TypedEventEmitter type: MessageType, contents: any) { this.verifyNotClosed(); - assert(this.connected, "Container disconnected when trying to submit system message"); + assert(this.connected, 0x133 /* "Container disconnected when trying to submit system message" */); // System message should not be sent in the middle of the batch. // That said, we can preserve existing behavior by not flushing existing buffer. @@ -1877,13 +1879,13 @@ export class ContainerRuntime extends TypedEventEmitter // Each client expresses interest to be a leader. // eslint-disable-next-line @typescript-eslint/no-floating-promises scheduler.pick(LeaderTaskId, async () => { - assert(!this._leader, "Client is already leader"); + assert(!this._leader, 0x134 /* "Client is already leader" */); this.updateLeader(true); }); scheduler.on("lost", (key) => { if (key === LeaderTaskId) { - assert(this._leader, "Got leader key but client is not leader"); + assert(this._leader, 0x135 /* "Got leader key but client is not leader" */); this._leader = false; this.updateLeader(false); } @@ -1919,7 +1921,7 @@ export class ContainerRuntime extends TypedEventEmitter this._leader = leadership; if (this.leader) { assert(this.clientId === undefined || this.connected && this.deltaManager && this.deltaManager.active, - "Leader must either have undefined clientId or be connected with active delta manager!"); + 0x136 /* "Leader must either have undefined clientId or be connected with active delta manager!" */); this.emit("leader"); } else { this.emit("notleader"); @@ -1971,13 +1973,13 @@ export class ContainerRuntime extends TypedEventEmitter private async getVersionFromStorage(versionId: string): Promise { const versions = await this.storage.getVersions(versionId, 1); - assert(!!versions && !!versions[0], "Failed to get version from storage"); + assert(!!versions && !!versions[0], 0x137 /* "Failed to get version from storage" */); return versions[0]; } private async getSnapshotFromStorage(version: IVersion): Promise { const snapshot = await this.storage.getSnapshotTree(version); - assert(!!snapshot, "Failed to get snapshot from storage"); + assert(!!snapshot, 0x138 /* "Failed to get snapshot from storage" */); return snapshot; } diff --git a/packages/runtime/container-runtime/src/dataStoreContext.ts b/packages/runtime/container-runtime/src/dataStoreContext.ts index 26e1ee51cfbc..1658fdfe9f43 100644 --- a/packages/runtime/container-runtime/src/dataStoreContext.ts +++ b/packages/runtime/container-runtime/src/dataStoreContext.ts @@ -122,7 +122,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter { - assert(this.bindState === BindState.NotBound, "datastore context is already in bound state"); + assert(this.bindState === BindState.NotBound, 0x13b /* "datastore context is already in bound state" */); this.bindState = BindState.Binding; - assert(this.channel !== undefined, "undefined channel on datastore context"); + assert(this.channel !== undefined, 0x13c /* "undefined channel on datastore context" */); bindChannel(this.channel); this.bindState = BindState.Bound; }; @@ -255,7 +255,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter { - assert(!this.detachedRuntimeCreation, "Detached runtime creation on realize()"); + assert(!this.detachedRuntimeCreation, 0x13d /* "Detached runtime creation on realize()" */); if (!this.channelDeferred) { this.channelDeferred = new Deferred(); this.realizeCore().catch((error) => { @@ -266,7 +266,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter { await this.realize(); - assert(this.channel !== undefined, "Channel should not be undefined when running GC"); + assert(this.channel !== undefined, 0x143 /* "Channel should not be undefined when running GC" */); return this.channel.getGCData(fullGC); } @@ -470,8 +470,8 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter; public reSubmit(contents: any, localOpMetadata: unknown) { - assert(!!this.channel, "Channel must exist when resubmitting ops"); + assert(!!this.channel, 0x14b /* "Channel must exist when resubmitting ops" */); const innerContents = contents as FluidDataStoreMessage; this.channel.reSubmit(innerContents.type, innerContents.content, localOpMetadata); } @@ -624,7 +624,7 @@ export abstract class FluidDataStoreContext extends TypedEventEmitter { - assert(this.attachState === AttachState.Detached, "Should move from detached to attaching"); + assert(this.attachState === AttachState.Detached, 0x14d /* "Should move from detached to attaching" */); this._attachState = AttachState.Attaching; }); this.once("attached", () => { - assert(this.attachState === AttachState.Attaching, "Should move from attaching to attached"); + assert(this.attachState === AttachState.Attaching, 0x14e /* "Should move from attaching to attached" */); this._attachState = AttachState.Attached; }); } public generateAttachMessage(): IAttachMessage { - assert(this.channel !== undefined, "There should be a channel when generating attach message"); - assert(this.pkg !== undefined, "pkg should be available in local data store context"); - assert(this.isRootDataStore !== undefined, "isRootDataStore should be available in local data store context"); + assert(this.channel !== undefined, 0x14f /* "There should be a channel when generating attach message" */); + assert(this.pkg !== undefined, 0x150 /* "pkg should be available in local data store context" */); + assert(this.isRootDataStore !== undefined, + 0x151 /* "isRootDataStore should be available in local data store context" */); const summarizeResult = this.channel.getAttachSummary(); @@ -852,8 +853,10 @@ export class LocalFluidDataStoreContextBase extends FluidDataStoreContext { } protected async getInitialSnapshotDetails(): Promise { - assert(this.pkg !== undefined, "pkg should be available in local data store"); - assert(this.isRootDataStore !== undefined, "isRootDataStore should be available in local data store"); + assert(this.pkg !== undefined, 0x152 /* "pkg should be available in local data store" */); + assert(this.isRootDataStore !== undefined, + 0x153 /* "isRootDataStore should be available in local data store" */); + const snapshot = this.disableIsolatedChannels ? this.snapshotTree : this.snapshotTree?.trees[channelsTreeName]; @@ -945,15 +948,15 @@ export class LocalDetachedFluidDataStoreContext registry: IProvideFluidDataStoreFactory, dataStoreRuntime: IFluidDataStoreChannel) { - assert(this.detachedRuntimeCreation, "runtime creation is already attached"); - assert(this.channelDeferred === undefined, "channel deferral is already set"); + assert(this.detachedRuntimeCreation, 0x154 /* "runtime creation is already attached" */); + assert(this.channelDeferred === undefined, 0x155 /* "channel deferral is already set" */); const factory = registry.IFluidDataStoreFactory; const entry = await this.factoryFromPackagePath(this.pkg); - assert(entry.factory === factory, "Unexpected factory for package path"); + assert(entry.factory === factory, 0x156 /* "Unexpected factory for package path" */); - assert(this.registry === undefined, "datastore registry already attached"); + assert(this.registry === undefined, 0x157 /* "datastore registry already attached" */); this.registry = entry.registry; this.detachedRuntimeCreation = false; diff --git a/packages/runtime/container-runtime/src/dataStoreContexts.ts b/packages/runtime/container-runtime/src/dataStoreContexts.ts index 08fd690ffd8f..838d14b402e3 100644 --- a/packages/runtime/container-runtime/src/dataStoreContexts.ts +++ b/packages/runtime/container-runtime/src/dataStoreContexts.ts @@ -85,7 +85,7 @@ import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreCo */ public addUnbound(context: LocalFluidDataStoreContext) { const id = context.id; - assert(!this._contexts.has(id), "Creating store with existing ID"); + assert(!this._contexts.has(id), 0x158 /* "Creating store with existing ID" */); this._contexts.set(id, context); @@ -123,7 +123,7 @@ import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreCo */ public bind(id: string) { const removed: boolean = this.notBoundContexts.delete(id); - assert(removed, "The given id was not found in notBoundContexts to delete"); + assert(removed, 0x159 /* "The given id was not found in notBoundContexts to delete" */); this.resolveDeferred(id); } @@ -134,11 +134,12 @@ import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreCo */ private resolveDeferred(id: string) { const context = this._contexts.get(id); - assert(!!context, "Cannot find context to resolve to"); - assert(!this.notBoundContexts.has(id), "Expected this id to already be removed from notBoundContexts"); + assert(!!context, 0x15a /* "Cannot find context to resolve to" */); + assert(!this.notBoundContexts.has(id), + 0x15b /* "Expected this id to already be removed from notBoundContexts" */); const deferred = this.deferredContexts.get(id); - assert(!!deferred, "Cannot find deferred to resolve"); + assert(!!deferred, 0x15c /* "Cannot find deferred to resolve" */); deferred.resolve(context); } @@ -149,7 +150,7 @@ import { FluidDataStoreContext, LocalFluidDataStoreContext } from "./dataStoreCo */ public addBoundOrRemoted(context: FluidDataStoreContext) { const id = context.id; - assert(!this._contexts.has(id), "Creating store with existing ID"); + assert(!this._contexts.has(id), 0x15d /* "Creating store with existing ID" */); this._contexts.set(id, context); diff --git a/packages/runtime/container-runtime/src/dataStores.ts b/packages/runtime/container-runtime/src/dataStores.ts index 79590d0c5693..886d052a05b3 100644 --- a/packages/runtime/container-runtime/src/dataStores.ts +++ b/packages/runtime/container-runtime/src/dataStores.ts @@ -119,7 +119,8 @@ export class DataStores implements IDisposable { // However the feature of loading a detached container from snapshot, is added when the // snapshotFormatVersion is at least "0.1" (1), so we don't expect it to be anything else. const formatVersion = getAttributesFormatVersion(attributes); - assert(formatVersion > 0, `Invalid snapshot format version ${attributes.snapshotFormatVersion}`); + assert(formatVersion > 0, + 0x1d5 /* `Invalid snapshot format version ${attributes.snapshotFormatVersion}` */); const pkgFromSnapshot = JSON.parse(attributes.pkg) as string[]; dataStoreContext = new LocalFluidDataStoreContext( @@ -145,7 +146,8 @@ export class DataStores implements IDisposable { const attachMessage = message.contents as InboundAttachMessage; // The local object has already been attached if (local) { - assert(this.pendingAttach.has(attachMessage.id), "Local object does not have matching attach message id"); + assert(this.pendingAttach.has(attachMessage.id), + 0x15e /* "Local object does not have matching attach message id" */); this.contexts.get(attachMessage.id)?.emit("attached"); this.pendingAttach.delete(attachMessage.id); return; @@ -206,7 +208,7 @@ export class DataStores implements IDisposable { public bindFluidDataStore(fluidDataStoreRuntime: IFluidDataStoreChannel): void { const id = fluidDataStoreRuntime.id; const localContext = this.contexts.getUnbound(id); - assert(!!localContext, "Could not find unbound context to bind"); + assert(!!localContext, 0x15f /* "Could not find unbound context to bind" */); // If the container is detached, we don't need to send OP or add to pending attach because // we will summarize it while uploading the create new summary and make it known to other @@ -272,14 +274,14 @@ export class DataStores implements IDisposable { public resubmitDataStoreOp(content: any, localOpMetadata: unknown) { const envelope = content as IEnvelope; const context = this.contexts.get(envelope.address); - assert(!!context, "There should be a store context for the op"); + assert(!!context, 0x160 /* "There should be a store context for the op" */); context.reSubmit(envelope.contents, localOpMetadata); } public async applyStashedOp(content: any): Promise { const envelope = content as IEnvelope; const context = this.contexts.get(envelope.address); - assert(!!context, "There should be a store context for the op"); + assert(!!context, 0x161 /* "There should be a store context for the op" */); return context.applyStashedOp(envelope.contents); } @@ -293,7 +295,7 @@ export class DataStores implements IDisposable { const envelope = message.contents as IEnvelope; const transformed = { ...message, contents: envelope.contents }; const context = this.contexts.get(envelope.address); - assert(!!context, "There should be a store context for the op"); + assert(!!context, 0x162 /* "There should be a store context for the op" */); context.process(transformed, local, localMessageMetadata); } @@ -313,7 +315,7 @@ export class DataStores implements IDisposable { const context = this.contexts.get(address); if (!context) { // Attach message may not have been processed yet - assert(!local, "Missing datastore for local signal"); + assert(!local, 0x163 /* "Missing datastore for local signal" */); this.logger.sendTelemetryEvent({ eventName: "SignalFluidDataStoreNotFound", fluidDataStoreId: address, @@ -363,7 +365,7 @@ export class DataStores implements IDisposable { const summaryTree = await value.summarize(true /* fullTree */, false /* trackState */); assert( summaryTree.summary.type === SummaryType.Tree, - "summarize should always return a tree when fullTree is true"); + 0x164 /* "summarize should always return a tree when fullTree is true" */); // back-compat summary - Remove this once snapshot is removed. const snapshot = convertSummaryTreeToITree(summaryTree.summary); @@ -400,7 +402,7 @@ export class DataStores implements IDisposable { .filter(([_, context]) => { // Summarizer works only with clients with no local changes! assert(context.attachState !== AttachState.Attaching, - "Summarizer cannot work if client has local changes"); + 0x165 /* "Summarizer cannot work if client has local changes" */); return context.attachState === AttachState.Attached; }).map(async ([contextId, context]) => { const contextSummary = await context.summarize(fullTree, trackState); @@ -446,7 +448,7 @@ export class DataStores implements IDisposable { // If this data store is not yet loaded, then there should be no changes in the snapshot from // which it was created as it is detached container. So just use the previous snapshot. assert(!!this.baseSnapshot, - "BaseSnapshot should be there as detached container loaded from snapshot"); + 0x166 /* "BaseSnapshot should be there as detached container loaded from snapshot" */); dataStoreSummary = convertSnapshotTreeToSummaryTree(this.baseSnapshot.trees[key]); } builder.addWithStats(key, dataStoreSummary); @@ -495,7 +497,7 @@ export class DataStores implements IDisposable { // Verify that the used routes are correct. for (const [id] of usedDataStoreRoutes) { - assert(this.contexts.has(id), "Used route does not belong to any known data store"); + assert(this.contexts.has(id), 0x167 /* "Used route does not belong to any known data store" */); } // Update the used routes in each data store. Used routes is empty for unused data stores. @@ -530,7 +532,7 @@ export function getSummaryForDatastores( if (rootHasIsolatedChannels(metadata)) { const datastoresSnapshot = snapshot.trees[channelsTreeName]; - assert(!!datastoresSnapshot, `expected ${channelsTreeName} tree in snapshot`); + assert(!!datastoresSnapshot, 0x168 /* `expected ${channelsTreeName} tree in snapshot` */); return datastoresSnapshot; } else { // back-compat: strip out all non-datastore paths before giving to DataStores object. diff --git a/packages/runtime/container-runtime/src/pendingStateManager.ts b/packages/runtime/container-runtime/src/pendingStateManager.ts index cada5c56446a..f9e57aee4da2 100644 --- a/packages/runtime/container-runtime/src/pendingStateManager.ts +++ b/packages/runtime/container-runtime/src/pendingStateManager.ts @@ -288,7 +288,7 @@ export class PendingStateManager { // Get the next state from the pending queue and verify that it is of type "message". const pendingState = this.peekNextPendingState(); - assert(pendingState.type === "message", "No pending message found for this remote message"); + assert(pendingState.type === "message", 0x169 /* "No pending message found for this remote message" */); this.pendingStates.shift(); // Processing part - Verify that there has been no data corruption. @@ -333,12 +333,12 @@ export class PendingStateManager { // after a message is processed and not before. if (pendingState.type === "flushMode") { assert(pendingState.flushMode === FlushMode.Manual, - "Flush mode should be manual when processing batch begin"); + 0x16a /* "Flush mode should be manual when processing batch begin" */); } // We should not already be processing a batch and there should be no pending batch begin message. assert(!this.isProcessingBatch && this.pendingBatchBeginMessage === undefined, - "The pending batch state indicates we are already processing a batch"); + 0x16b /* "The pending batch state indicates we are already processing a batch" */); // Set the pending batch state indicating we have started processing a batch. this.pendingBatchBeginMessage = message; @@ -360,12 +360,12 @@ export class PendingStateManager { // beginning of a new one. So, it will removed when the next batch begin is processed. if (nextPendingState.type === "flushMode") { assert(nextPendingState.flushMode === FlushMode.Automatic, - "Flush mode is set to Manual in the middle of processing a batch"); + 0x16c /* "Flush mode is set to Manual in the middle of processing a batch" */); this.pendingStates.shift(); } // There should be a pending batch begin message. - assert(this.pendingBatchBeginMessage !== undefined, "There is no pending batch begin message"); + assert(this.pendingBatchBeginMessage !== undefined, 0x16d /* "There is no pending batch begin message" */); // Get the batch begin metadata from the first message in the batch. const batchBeginMetadata = this.pendingBatchBeginMessage.metadata?.batch; @@ -374,12 +374,12 @@ export class PendingStateManager { // are multiple messages in the batch, verify that we got the correct batch begin and end metadata. if (this.pendingBatchBeginMessage === message) { assert(batchBeginMetadata === undefined, - "Batch with single message should not have batch metadata"); + 0x16e /* "Batch with single message should not have batch metadata" */); } else { // Get the batch metadata from the last message in the batch. const batchEndMetadata = message.metadata?.batch; - assert(batchBeginMetadata === true, "Did not receive batch begin metadata"); - assert(batchEndMetadata === false, "Did not receive batch end metadata"); + assert(batchBeginMetadata === true, 0x16f /* "Did not receive batch begin metadata" */); + assert(batchEndMetadata === false, 0x170 /* "Did not receive batch end metadata" */); } // Clear the pending batch state now that we have processed the entire batch. @@ -392,7 +392,7 @@ export class PendingStateManager { */ private peekNextPendingState(): IPendingState { const nextPendingState = this.pendingStates.peekFront(); - assert(!!nextPendingState, "No pending state found for the remote message"); + assert(!!nextPendingState, 0x171 /* "No pending state found for the remote message" */); return nextPendingState; } @@ -401,13 +401,14 @@ export class PendingStateManager { * states in its queue. This includes setting the FlushMode and triggering resubmission of unacked ops. */ public replayPendingStates() { - assert(this.connected, "The connection state is not consistent with the runtime"); + assert(this.connected, 0x172 /* "The connection state is not consistent with the runtime" */); // This assert suggests we are about to send same ops twice, which will result in data loss. - assert(this.clientId !== this.containerRuntime.clientId, "replayPendingStates called twice for same clientId!"); + assert(this.clientId !== this.containerRuntime.clientId, + 0x173 /* "replayPendingStates called twice for same clientId!" */); this.clientId = this.containerRuntime.clientId; - assert(this.initialStates.isEmpty(), "initial states should be empty before replaying pending"); + assert(this.initialStates.isEmpty(), 0x174 /* "initial states should be empty before replaying pending" */); let pendingStatesCount = this.pendingStates.length; if (pendingStatesCount === 0) { diff --git a/packages/runtime/container-runtime/src/summaryCollection.ts b/packages/runtime/container-runtime/src/summaryCollection.ts index e8a5afbdb4b6..d113fc375836 100644 --- a/packages/runtime/container-runtime/src/summaryCollection.ts +++ b/packages/runtime/container-runtime/src/summaryCollection.ts @@ -93,7 +93,7 @@ class Summary implements ISummary { } public broadcast(op: ISummaryOpMessage) { - assert(this.state === SummaryState.Local, "Can only broadcast if summarizer starts in local state"); + assert(this.state === SummaryState.Local, 0x175 /* "Can only broadcast if summarizer starts in local state" */); this._summaryOp = op; this.defSummaryOp.resolve(); this.state = SummaryState.Broadcast; @@ -101,7 +101,8 @@ class Summary implements ISummary { } public ackNack(op: ISummaryAckMessage | ISummaryNackMessage) { - assert(this.state === SummaryState.Broadcast, "Can only ack/nack if summarizer is in broadcasting state"); + assert(this.state === SummaryState.Broadcast, + 0x176 /* "Can only ack/nack if summarizer is in broadcasting state" */); this._summaryAckNack = op; this.defSummaryAck.resolve(); this.state = op.type === MessageType.SummaryAck ? SummaryState.Acked : SummaryState.Nacked; diff --git a/packages/runtime/datastore/src/channelDeltaConnection.ts b/packages/runtime/datastore/src/channelDeltaConnection.ts index 09051e9dd30f..f772091be4f0 100644 --- a/packages/runtime/datastore/src/channelDeltaConnection.ts +++ b/packages/runtime/datastore/src/channelDeltaConnection.ts @@ -12,7 +12,7 @@ export class ChannelDeltaConnection implements IDeltaConnection { private _handler: IDeltaHandler | undefined; private get handler(): IDeltaHandler { - assert(!!this._handler, "Missing delta handler"); + assert(!!this._handler, 0x177 /* "Missing delta handler" */); return this._handler; } public get connected(): boolean { @@ -27,7 +27,7 @@ export class ChannelDeltaConnection implements IDeltaConnection { } public attach(handler: IDeltaHandler) { - assert(this._handler === undefined, "Missing delta handler on attach"); + assert(this._handler === undefined, 0x178 /* "Missing delta handler on attach" */); this._handler = handler; } diff --git a/packages/runtime/datastore/src/dataStoreRuntime.ts b/packages/runtime/datastore/src/dataStoreRuntime.ts index 42153c7c2a37..b88bd59e9b41 100644 --- a/packages/runtime/datastore/src/dataStoreRuntime.ts +++ b/packages/runtime/datastore/src/dataStoreRuntime.ts @@ -374,7 +374,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { public createChannel(id: string = uuid(), type: string): IChannel { this.verifyNotClosed(); - assert(!this.contexts.has(id), "createChannel() with existing ID"); + assert(!this.contexts.has(id), 0x179 /* "createChannel() with existing ID" */); this.notBoundedChannelContextSet.add(id); const context = new LocalChannelContext( id, @@ -397,7 +397,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { this.contextsDeferred.set(id, deferred); } - assert(!!context.channel, "Channel should be loaded when created!!"); + assert(!!context.channel, 0x17a /* "Channel should be loaded when created!!" */); return context.channel; } @@ -407,7 +407,8 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { * @param channel - channel to be registered. */ public bindChannel(channel: IChannel): void { - assert(this.notBoundedChannelContextSet.has(channel.id), "Channel to be binded should be in not bounded set"); + assert(this.notBoundedChannelContextSet.has(channel.id), + 0x17b /* "Channel to be binded should be in not bounded set" */); this.notBoundedChannelContextSet.delete(channel.id); // If our data store is attached, then attach the channel. if (this.isAttached) { @@ -513,12 +514,13 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { // If a non-local operation then go and create the object // Otherwise mark it as officially attached. if (local) { - assert(this.pendingAttach.has(id), "Unexpected attach (local) channel OP"); + assert(this.pendingAttach.has(id), 0x17c /* "Unexpected attach (local) channel OP" */); this.pendingAttach.delete(id); } else { - assert(!this.contexts.has(id), `Unexpected attach channel OP, + assert(!this.contexts.has(id), + 0x17d, /* `Unexpected attach channel OP, is in pendingAttach set: ${this.pendingAttach.has(id)}, - is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContext}`); + is local channel contexts: ${this.contexts.get(id) instanceof LocalChannelContext}` */); const flatBlobs = new Map(); const snapshotTree = buildSnapshotTree(attachMessage.snapshot.entries, flatBlobs); @@ -657,7 +659,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { // Verify that the used routes are correct. for (const [id] of usedContextRoutes) { - assert(this.contexts.has(id), "Used route does not belong to any known context"); + assert(this.contexts.has(id), 0x17e /* "Used route does not belong to any known context" */); } // Update the used routes in each context. Used routes is empty for unused context. @@ -704,7 +706,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { .filter(([contextId, _]) => { const isAttached = this.isChannelAttached(contextId); // We are not expecting local dds! Summary may not capture local state. - assert(isAttached, "Not expecting detached channels during summarize"); + assert(isAttached, 0x17f /* "Not expecting detached channels during summarize" */); // If the object is registered - and we have received the sequenced op creating the object // (i.e. it has a base mapping) - then we go ahead and summarize return isAttached; @@ -748,7 +750,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { const contextSummary = context.getAttachSummary(); assert( contextSummary.summary.type === SummaryType.Tree, - "getAttachSummary should always return a tree"); + 0x180 /* "getAttachSummary should always return a tree" */); summaryTree = { stats: contextSummary.stats, summary: contextSummary.summary }; // Prefix the child's id to the ids of its GC nodest. This gradually builds the id of each node @@ -758,7 +760,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { // If this channel is not yet loaded, then there should be no changes in the snapshot from which // it was created as it is detached container. So just use the previous snapshot. assert(!!this.dataStoreContext.baseSnapshot, - "BaseSnapshot should be there as detached container loaded from snapshot"); + 0x181 /* "BaseSnapshot should be there as detached container loaded from snapshot" */); summaryTree = convertSnapshotTreeToSummaryTree(this.dataStoreContext.baseSnapshot.trees[contextId]); } summaryBuilder.addWithStats(contextId, summaryTree); @@ -804,7 +806,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { channel.handle.attachGraph(); - assert(this.isAttached, "Data store should be attached to attach the channel."); + assert(this.isAttached, 0x182 /* "Data store should be attached to attach the channel." */); // Get the object snapshot only if the data store is Bound and its graph is attached too, // because if the graph is attaching, then it would get included in the data store snapshot. if (this.bindState === BindState.Bound && this.graphAttachState === AttachState.Attached) { @@ -854,7 +856,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { // For Operations, find the right channel and trigger resubmission on it. const envelope = content as IEnvelope; const channelContext = this.contexts.get(envelope.address); - assert(!!channelContext, "There should be a channel context for the op"); + assert(!!channelContext, 0x183 /* "There should be a channel context for the op" */); channelContext.reSubmit(envelope.contents, localOpMetadata); break; } @@ -870,7 +872,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { public async applyStashedOp(content: any): Promise { const envelope = content as IEnvelope; const channelContext = this.contexts.get(envelope.address); - assert(!!channelContext, "There should be a channel context for the op"); + assert(!!channelContext, 0x184 /* "There should be a channel context for the op" */); await channelContext.getChannel(); return channelContext.applyStashedOp(envelope.contents); } @@ -891,7 +893,7 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { }; const channelContext = this.contexts.get(envelope.address); - assert(!!channelContext, "Channel not found"); + assert(!!channelContext, 0x185 /* "Channel not found" */); channelContext.processOp(transformed, local, localOpMetadata); return channelContext; @@ -906,14 +908,16 @@ IFluidDataStoreChannel, IFluidDataStoreRuntime, IFluidHandleContext { this.emit("notleader"); }); this.dataStoreContext.once("attaching", () => { - assert(this.bindState !== BindState.NotBound, "Data store attaching should not occur if it is not bound"); + assert(this.bindState !== BindState.NotBound, + 0x186 /* "Data store attaching should not occur if it is not bound" */); this._attachState = AttachState.Attaching; // This promise resolution will be moved to attached event once we fix the scheduler. this.deferredAttached.resolve(); this.emit("attaching"); }); this.dataStoreContext.once("attached", () => { - assert(this.bindState === BindState.Bound, "Data store should only be attached after it is bound"); + assert(this.bindState === BindState.Bound, + 0x187 /* "Data store should only be attached after it is bound" */); this._attachState = AttachState.Attached; this.emit("attached"); }); diff --git a/packages/runtime/datastore/src/localChannelContext.ts b/packages/runtime/datastore/src/localChannelContext.ts index b5c08a750f2d..0b797bdab1f1 100644 --- a/packages/runtime/datastore/src/localChannelContext.ts +++ b/packages/runtime/datastore/src/localChannelContext.ts @@ -101,7 +101,7 @@ export class LocalChannelContext implements IChannelContext { } public processOp(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void { - assert(this.attached, "Local channel must be attached when processing op"); + assert(this.attached, 0x188 /* "Local channel must be attached when processing op" */); // A local channel may not be loaded in case where we rehydrate the container from a snapshot because of // delay loading. So after the container is attached and some other client joins which start generating @@ -110,14 +110,14 @@ export class LocalChannelContext implements IChannelContext { this.services.value.deltaConnection.process(message, local, localOpMetadata); } else { assert(local === false, - "Should always be remote because a local dds shouldn't generate ops before loading"); + 0x189 /* "Should always be remote because a local dds shouldn't generate ops before loading" */); this.pending.push(message); } } public reSubmit(content: any, localOpMetadata: unknown) { - assert(this.isLoaded, "Channel should be loaded to resubmit ops"); - assert(this.attached, "Local channel must be attached when resubmitting op"); + assert(this.isLoaded, 0x18a /* "Channel should be loaded to resubmit ops" */); + assert(this.attached, 0x18b /* "Local channel must be attached when resubmitting op" */); this.services.value.deltaConnection.reSubmit(content, localOpMetadata); } @@ -131,25 +131,26 @@ export class LocalChannelContext implements IChannelContext { * @param trackState - This tells whether we should track state from this summary. */ public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise { - assert(this.isLoaded && this.channel !== undefined, "Channel should be loaded to summarize"); + assert(this.isLoaded && this.channel !== undefined, 0x18c /* "Channel should be loaded to summarize" */); return summarizeChannel(this.channel, fullTree, trackState); } public getAttachSummary(): IContextSummarizeResult { - assert(this.isLoaded && this.channel !== undefined, "Channel should be loaded to take snapshot"); + assert(this.isLoaded && this.channel !== undefined, 0x18d /* "Channel should be loaded to take snapshot" */); return summarizeChannel(this.channel, true /* fullTree */, false /* trackState */); } private async loadChannel(): Promise { - assert(!this.isLoaded, "Channel must not already be loaded when loading"); - assert(!!this.snapshotTree, "Snapshot should be provided to load from!!"); + assert(!this.isLoaded, 0x18e /* "Channel must not already be loaded when loading" */); + assert(!!this.snapshotTree, 0x18f /* "Snapshot should be provided to load from!!" */); - assert(await this.services.value.objectStorage.contains(".attributes"), ".attributes blob should be present"); + assert(await this.services.value.objectStorage.contains(".attributes"), + 0x190 /* ".attributes blob should be present" */); const attributes = await readAndParse( this.services.value.objectStorage, ".attributes"); - assert(!!this.factory, "Factory should be there for local channel"); + assert(!!this.factory, 0x191 /* "Factory should be there for local channel" */); // Services will be assigned during this load. const channel = await this.factory.load( this.runtime, @@ -181,7 +182,7 @@ export class LocalChannelContext implements IChannelContext { } if (this.isLoaded) { - assert(!!this.channel, "Channel should be there if loaded!!"); + assert(!!this.channel, 0x192 /* "Channel should be there if loaded!!" */); this.channel.connect(this.services.value); } this.attached = true; @@ -210,7 +211,7 @@ export class LocalChannelContext implements IChannelContext { * @param fullGC - true to bypass optimizations and force full generation of GC data. */ public async getGCData(fullGC: boolean = false): Promise { - assert(this.isLoaded && this.channel !== undefined, "Channel should be loaded to run GC"); + assert(this.isLoaded && this.channel !== undefined, 0x193 /* "Channel should be loaded to run GC" */); return this.channel.getGCData(fullGC); } diff --git a/packages/runtime/datastore/src/remoteChannelContext.ts b/packages/runtime/datastore/src/remoteChannelContext.ts index ee1caa6fb1de..35019a18f642 100644 --- a/packages/runtime/datastore/src/remoteChannelContext.ts +++ b/packages/runtime/datastore/src/remoteChannelContext.ts @@ -100,7 +100,7 @@ export class RemoteChannelContext implements IChannelContext { } public applyStashedOp(message: ISequencedDocumentMessage): unknown { - assert(this.isLoaded, "Remote channel must be loaded when rebasing op"); + assert(this.isLoaded, 0x194 /* "Remote channel must be loaded when rebasing op" */); return this.services.deltaConnection.applyStashedOp(message); } @@ -110,14 +110,14 @@ export class RemoteChannelContext implements IChannelContext { if (this.isLoaded) { this.services.deltaConnection.process(message, local, localOpMetadata); } else { - assert(!local, "Remote channel must not be local when processing op"); + assert(!local, 0x195 /* "Remote channel must not be local when processing op" */); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion this.pending!.push(message); } } public reSubmit(content: any, localOpMetadata: unknown) { - assert(this.isLoaded, "Remote channel must be loaded when resubmitting op"); + assert(this.isLoaded, 0x196 /* "Remote channel must be loaded when resubmitting op" */); this.services.deltaConnection.reSubmit(content, localOpMetadata); } @@ -138,7 +138,7 @@ export class RemoteChannelContext implements IChannelContext { } private async loadChannel(): Promise { - assert(!this.isLoaded, "Remote channel must not already be loaded when loading"); + assert(!this.isLoaded, 0x197 /* "Remote channel must not already be loaded when loading" */); let attributes: IChannelAttributes | undefined; if (await this.services.objectStorage.contains(attributesBlobKey)) { diff --git a/packages/runtime/garbage-collector/src/utils.ts b/packages/runtime/garbage-collector/src/utils.ts index bd128e466637..3dfe10b50757 100644 --- a/packages/runtime/garbage-collector/src/utils.ts +++ b/packages/runtime/garbage-collector/src/utils.ts @@ -29,7 +29,7 @@ export function cloneGCData(gcData: IGarbageCollectionData): IGarbageCollectionD export function getChildNodesUsedRoutes(usedRoutes: string[]) { const childUsedRoutesMap: Map = new Map(); for (const route of usedRoutes) { - assert(route.startsWith("/"), "Used route should always be an absolute route"); + assert(route.startsWith("/"), 0x198 /* "Used route should always be an absolute route" */); const childId = route.split("/")[1]; const childUsedRoute = route.slice(childId.length + 1); @@ -51,7 +51,7 @@ export function getChildNodesUsedRoutes(usedRoutes: string[]) { export function getChildNodesGCData(gcData: IGarbageCollectionData) { const childGCDataMap: Map = new Map(); for (const [id, outboundRoutes] of Object.entries(gcData.gcNodes)) { - assert(id.startsWith("/"), "id should always be an absolute route"); + assert(id.startsWith("/"), 0x199 /* "id should always be an absolute route" */); const childId = id.split("/")[1]; let childGCNodeId = id.slice(childId.length + 1); // GC node id always begins with "/". Handle the special case where the id in parent's GC nodes is of the diff --git a/packages/runtime/runtime-utils/src/dataStoreHelpers.ts b/packages/runtime/runtime-utils/src/dataStoreHelpers.ts index ab5793e4b745..4cab87dbbc4a 100644 --- a/packages/runtime/runtime-utils/src/dataStoreHelpers.ts +++ b/packages/runtime/runtime-utils/src/dataStoreHelpers.ts @@ -80,14 +80,14 @@ export async function requestFluidObject( throw responseToException(response, request); } - assert(response.value, "Invalid response value for Fluid object request"); + assert(response.value, 0x19a /* "Invalid response value for Fluid object request" */); return response.value as T; } export const create404Response = (request: IRequest) => createResponseError(404, "not found", request); export function createResponseError(status: number, value: string, request: IRequest): IResponse { - assert(status !== 200, "Cannot not create response error on 200 status"); + assert(status !== 200, 0x19b /* "Cannot not create response error on 200 status" */); return { mimeType: "text/plain", status, diff --git a/packages/runtime/runtime-utils/src/objectstoragepartition.ts b/packages/runtime/runtime-utils/src/objectstoragepartition.ts index e031f817760c..1ba4f84d3102 100644 --- a/packages/runtime/runtime-utils/src/objectstoragepartition.ts +++ b/packages/runtime/runtime-utils/src/objectstoragepartition.ts @@ -12,7 +12,7 @@ import { IChannelStorageService } from "@fluidframework/datastore-definitions"; export class ObjectStoragePartition implements IChannelStorageService { constructor(private readonly storage: IChannelStorageService, private readonly path: string) { // `path` must not include the trailing separator. - assert(!path.endsWith("/"), "storage service path has trailing separator"); + assert(!path.endsWith("/"), 0x19c /* "storage service path has trailing separator" */); } public async readBlob(path: string): Promise { diff --git a/packages/runtime/runtime-utils/src/remoteObjectHandle.ts b/packages/runtime/runtime-utils/src/remoteObjectHandle.ts index 2972b7c4c2ed..dfe193e9e1f0 100644 --- a/packages/runtime/runtime-utils/src/remoteObjectHandle.ts +++ b/packages/runtime/runtime-utils/src/remoteObjectHandle.ts @@ -37,7 +37,7 @@ export class RemoteFluidObjectHandle implements IFluidHandle { public readonly absolutePath: string, public readonly routeContext: IFluidHandleContext, ) { - assert(absolutePath.startsWith("/"), "Handles should always have absolute paths"); + assert(absolutePath.startsWith("/"), 0x19d /* "Handles should always have absolute paths" */); } /** diff --git a/packages/runtime/runtime-utils/src/summarizerNode/summarizerNode.ts b/packages/runtime/runtime-utils/src/summarizerNode/summarizerNode.ts index c9d8cc185171..b09a409f3a87 100644 --- a/packages/runtime/runtime-utils/src/summarizerNode/summarizerNode.ts +++ b/packages/runtime/runtime-utils/src/summarizerNode/summarizerNode.ts @@ -68,8 +68,9 @@ export class SummarizerNode implements IRootSummarizerNode { private wipSkipRecursion = false; public startSummary(referenceSequenceNumber: number, summaryLogger: ITelemetryLogger) { - assert(this.wipSummaryLogger === undefined, "wipSummaryLogger should not be set yet in startSummary"); - assert(this.wipReferenceSequenceNumber === undefined, "Already tracking a summary"); + assert(this.wipSummaryLogger === undefined, + 0x19f /* "wipSummaryLogger should not be set yet in startSummary" */); + assert(this.wipReferenceSequenceNumber === undefined, 0x1a0 /* "Already tracking a summary" */); this.wipSummaryLogger = summaryLogger; @@ -80,8 +81,9 @@ export class SummarizerNode implements IRootSummarizerNode { } public async summarize(fullTree: boolean): Promise { - assert(this.isTrackingInProgress(), "summarize should not be called when not tracking the summary"); - assert(this.wipSummaryLogger !== undefined, "wipSummaryLogger should have been set in startSummary or ctor"); + assert(this.isTrackingInProgress(), 0x1a1 /* "summarize should not be called when not tracking the summary" */); + assert(this.wipSummaryLogger !== undefined, + 0x1a2 /* "wipSummaryLogger should have been set in startSummary or ctor" */); // Try to reuse the tree if unchanged if (this.canReuseHandle && !fullTree && !this.hasChanged()) { @@ -168,8 +170,9 @@ export class SummarizerNode implements IRootSummarizerNode { parentPath: EscapedPath | undefined, parentSkipRecursion: boolean, ) { - assert(this.wipSummaryLogger !== undefined, "wipSummaryLogger should have been set in startSummary or ctor"); - assert(this.wipReferenceSequenceNumber !== undefined, "Not tracking a summary"); + assert(this.wipSummaryLogger !== undefined, + 0x1a3 /* "wipSummaryLogger should have been set in startSummary or ctor" */); + assert(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* "Not tracking a summary" */); let localPathsToUse = this.wipLocalPaths; if (parentSkipRecursion) { @@ -200,7 +203,7 @@ export class SummarizerNode implements IRootSummarizerNode { // This should come from wipLocalPaths in normal cases, or from the latestSummary // if parentIsFailure or parentIsReused is true. // If there is no latestSummary, clearSummary and return before reaching this code. - assert(!!localPathsToUse, "Tracked summary local paths not set"); + assert(!!localPathsToUse, 0x1a5 /* "Tracked summary local paths not set" */); const summary = new SummaryNode({ ...localPathsToUse, @@ -271,14 +274,14 @@ export class SummarizerNode implements IRootSummarizerNode { // This should only happen if parent skipped recursion AND no prior summary existed. assert( this.latestSummary === undefined, - "Not found pending summary, but this node has previously completed a summary", + 0x1a6 /* "Not found pending summary, but this node has previously completed a summary" */, ); return; } else { assert( referenceSequenceNumber === summaryNode.referenceSequenceNumber, // eslint-disable-next-line max-len - `Pending summary reference sequence number should be consistent: ${summaryNode.referenceSequenceNumber} != ${referenceSequenceNumber}`, + 0x1a7 /* `Pending summary reference sequence number should be consistent: ${summaryNode.referenceSequenceNumber} != ${referenceSequenceNumber}` */, ); // Clear earlier pending summaries @@ -393,7 +396,7 @@ export class SummarizerNode implements IRootSummarizerNode { const newOpsLatestSeq = outstandingOps[outstandingOps.length - 1].sequenceNumber; assert( newOpsLatestSeq <= this.trackingSequenceNumber, - "When loading base summary, expected outstanding ops <= tracking sequence number", + 0x1a9 /* "When loading base summary, expected outstanding ops <= tracking sequence number" */, ); } @@ -408,7 +411,7 @@ export class SummarizerNode implements IRootSummarizerNode { if (lastOp !== undefined) { assert( lastOp.sequenceNumber < op.sequenceNumber, - `Out of order change recorded: ${lastOp.sequenceNumber} > ${op.sequenceNumber}`, + 0x1aa /* `Out of order change recorded: ${lastOp.sequenceNumber} > ${op.sequenceNumber}` */, ); } this.invalidate(op.sequenceNumber); @@ -470,7 +473,7 @@ export class SummarizerNode implements IRootSummarizerNode { createParam: CreateChildSummarizerNodeParam, config: ISummarizerNodeConfig = {}, ): ISummarizerNode { - assert(!this.children.has(id), "Create SummarizerNode child already exists"); + assert(!this.children.has(id), 0x1ab /* "Create SummarizerNode child already exists" */); const createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam); const child = new SummarizerNode( @@ -530,7 +533,7 @@ export class SummarizerNode implements IRootSummarizerNode { if (this.initialSummary === undefined) { assert( !!parentLatestSummary, - "Cannot create child from summary if parent does not have latest summary"); + 0x1ac /* "Cannot create child from summary if parent does not have latest summary" */); } // fallthrough to local } @@ -542,19 +545,19 @@ export class SummarizerNode implements IRootSummarizerNode { const { childrenTree } = parseSummaryTreeForSubtrees(parentInitialSummary.summary.summary); assert( childrenTree.type === SummaryType.Tree, - "Parent summary object is not a tree", + 0x1d6 /* "Parent summary object is not a tree" */, ); childSummary = childrenTree.tree[id]; } if (createParam.type === CreateSummarizerNodeSource.FromSummary) { // Locally created would not have differential subtree. - assert(!!childSummary, "Missing child summary tree"); + assert(!!childSummary, 0x1ad /* "Missing child summary tree" */); } let childSummaryWithStats: ISummaryTreeWithStats | undefined; if (childSummary !== undefined) { assert( childSummary.type === SummaryType.Tree, - "Child summary object is not a tree", + 0x1ae /* "Child summary object is not a tree" */, ); childSummaryWithStats = { summary: childSummary, diff --git a/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeUtils.ts b/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeUtils.ts index b88d289a16f5..9dc38fcd1283 100644 --- a/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeUtils.ts +++ b/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeUtils.ts @@ -203,8 +203,8 @@ export function decodeSummary( }; } - assert(!!outstandingOpsBlob, "Outstanding ops blob missing, but base summary tree exists"); - assert(newBaseSummary !== undefined, "Base summary tree missing, but outstanding ops blob exists"); + assert(!!outstandingOpsBlob, 0x1af /* "Outstanding ops blob missing, but base summary tree exists" */); + assert(newBaseSummary !== undefined, 0x1b0 /* "Base summary tree missing, but outstanding ops blob exists" */); baseSummary = newBaseSummary; pathParts.push(baseSummaryTreeKey); opsBlobs.unshift(outstandingOpsBlob); diff --git a/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeWithGc.ts b/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeWithGc.ts index 031ac3630983..4831588b4888 100644 --- a/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeWithGc.ts +++ b/packages/runtime/runtime-utils/src/summarizerNode/summarizerNodeWithGc.ts @@ -141,7 +141,8 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari // If GC is not disabled and we are tracking a summary, GC should have run and updated the used routes for this // summary by calling updateUsedRoutes which sets wipSerializedUsedRoutes. if (!this.gcDisabled && this.isTrackingInProgress()) { - assert(this.wipSerializedUsedRoutes !== undefined, "wip used routes should be set if tracking a summary"); + assert(this.wipSerializedUsedRoutes !== undefined, + 0x1b1 /* "wip used routes should be set if tracking a summary" */); } // If trackState is true, get summary from base summarizer node which tracks summary state. @@ -149,7 +150,7 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari if (trackState) { const summarizeResult = await super.summarize(fullTree); - // If there is no cached GC data, return empty data in summarize result. It is the caller's responsiblity + // If there is no cached GC data, return empty data in summarize result. It is the caller's responsibility // to ensure that GC data is available by calling getGCData before calling summarize. const gcData = this.gcData !== undefined ? cloneGCData(this.gcData) : { gcNodes: {} }; @@ -174,8 +175,8 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari * @param fullGC - true to bypass optimizations and force full generation of GC data. */ public async getGCData(fullGC: boolean = false): Promise { - assert(!this.gcDisabled, "Getting GC data should not be called when GC is disabled!"); - assert(this.getGCDataFn !== undefined, "GC data cannot be retrieved without getGCDataFn"); + assert(!this.gcDisabled, 0x1b2 /* "Getting GC data should not be called when GC is disabled!" */); + assert(this.getGCDataFn !== undefined, 0x1b3 /* "GC data cannot be retrieved without getGCDataFn" */); // Load GC details from the initial summary, if not already loaded. If this is the first time this function is // called and the node's data has not changed since last summary, the GC data in initial details is returned. @@ -201,7 +202,7 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari if (!this.gcDisabled) { assert( this.wipSerializedUsedRoutes === undefined, - "We should not already be tracking used routes when to track a new summary"); + 0x1b4 /* "We should not already be tracking used routes when to track a new summary" */); // back-compat: 0.33 - This will be done in `updateUsedRoutes`. Older clients do not have that method, so // keeping this one for now. @@ -223,7 +224,7 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari // If GC is disabled, don't set wip used routes. if (!this.gcDisabled) { wipSerializedUsedRoutes = this.wipSerializedUsedRoutes; - assert(wipSerializedUsedRoutes !== undefined, "We should have been tracking used routes"); + assert(wipSerializedUsedRoutes !== undefined, 0x1b5 /* "We should have been tracking used routes" */); } super.completeSummaryCore(proposalHandle, parentPath, parentSkipRecursion); @@ -321,7 +322,7 @@ export class SummarizerNodeWithGC extends SummarizerNode implements IRootSummari getGCDataFn?: (fullGC?: boolean) => Promise, getInitialGCSummaryDetailsFn?: () => Promise, ): ISummarizerNodeWithGC { - assert(!this.children.has(id), "Create SummarizerNode child already exists"); + assert(!this.children.has(id), 0x1b6 /* "Create SummarizerNode child already exists" */); const createDetails: ICreateChildDetails = this.getCreateDetailsForChild(id, createParam); const child = new SummarizerNodeWithGC( diff --git a/packages/runtime/runtime-utils/src/summaryUtils.ts b/packages/runtime/runtime-utils/src/summaryUtils.ts index 3cd52d69779e..2d7c7c99b850 100644 --- a/packages/runtime/runtime-utils/src/summaryUtils.ts +++ b/packages/runtime/runtime-utils/src/summaryUtils.ts @@ -241,7 +241,8 @@ export function convertToSummaryTree( export function convertSnapshotTreeToSummaryTree( snapshot: ISnapshotTree, ): ISummaryTreeWithStats { - assert(Object.keys(snapshot.commits).length === 0, "There should not be commit tree entries in snapshot"); + assert(Object.keys(snapshot.commits).length === 0, + 0x19e /* "There should not be commit tree entries in snapshot" */); const builder = new SummaryTreeBuilder(); for (const [key, value] of Object.entries(snapshot.blobs)) { diff --git a/packages/tools/fetch-tool/src/fluidAnalyzeMessages.ts b/packages/tools/fetch-tool/src/fluidAnalyzeMessages.ts index f20fd9fe2212..d1d3a547148d 100644 --- a/packages/tools/fetch-tool/src/fluidAnalyzeMessages.ts +++ b/packages/tools/fetch-tool/src/fluidAnalyzeMessages.ts @@ -648,7 +648,7 @@ function processQuorumMessages( const clientId = JSON.parse(dataString); session = sessionsInProgress.get(clientId); sessionsInProgress.delete(clientId); - assert(!!session, "Bad session state for processing quorum messages"); + assert(!!session, 0x1b7 /* "Bad session state for processing quorum messages" */); if (session) { if (!skipMessage) { session.reportOp(message.timestamp); @@ -665,7 +665,7 @@ function processQuorumMessages( session = sessionsInProgress.get(message.clientId); if (session === undefined) { session = sessionsInProgress.get(noClientName); - assert(!!session, "Bad session state for processing quorum messages"); + assert(!!session, 0x1b8 /* "Bad session state for processing quorum messages" */); } } return session; diff --git a/packages/tools/fetch-tool/src/fluidFetchMessages.ts b/packages/tools/fetch-tool/src/fluidFetchMessages.ts index 899508c2d1e2..b22022c50926 100644 --- a/packages/tools/fetch-tool/src/fluidFetchMessages.ts +++ b/packages/tools/fetch-tool/src/fluidFetchMessages.ts @@ -58,7 +58,7 @@ async function* loadAllSequencedMessages( const fileContent = fs.readFileSync(`${dir}/messages${file}.json`, { encoding: "utf-8" }); const messages: ISequencedDocumentMessage[] = JSON.parse(fileContent); assert(messages[0].sequenceNumber === lastSeq + 1, - "Unexpected value for sequence number of first message in file"); + 0x1b9 /* "Unexpected value for sequence number of first message in file" */); yield messages; lastSeq = messages[messages.length - 1].sequenceNumber; } catch (e) { @@ -105,7 +105,7 @@ async function* loadAllSequencedMessages( requests++; // Empty buckets should never be returned - assert(messages.length !== 0, "should not return empty buckets"); + assert(messages.length !== 0, 0x1ba /* "should not return empty buckets" */); // console.log(`Loaded ops at ${messages[0].sequenceNumber}`); // This parsing of message contents happens in delta manager. But when we analyze messages @@ -187,10 +187,10 @@ async function* saveOps( } sequencedMessages = sequencedMessages.concat(messages); assert(sequencedMessages[0].sequenceNumber === curr, - "Unexpected sequence number on first of messages to save"); + 0x1bb /* "Unexpected sequence number on first of messages to save" */); assert(sequencedMessages[sequencedMessages.length - 1].sequenceNumber === curr + sequencedMessages.length - 1, - "Unexpected sequence number on last of messages to save"); + 0x1bc /* "Unexpected sequence number on last of messages to save" */); } // Time to write it out? @@ -203,7 +203,7 @@ async function* saveOps( JSON.stringify(write, undefined, paramActualFormatting ? 0 : 2)); curr += chunk; assert(sequencedMessages.length === 0 || sequencedMessages[0].sequenceNumber === curr, - "Stopped writing at unexpected sequence number"); + 0x1bd /* "Stopped writing at unexpected sequence number" */); index++; } diff --git a/packages/tools/fetch-tool/src/fluidFetchSnapshot.ts b/packages/tools/fetch-tool/src/fluidFetchSnapshot.ts index 46e8e6d4cb61..fd78987a9539 100644 --- a/packages/tools/fetch-tool/src/fluidFetchSnapshot.ts +++ b/packages/tools/fetch-tool/src/fluidFetchSnapshot.ts @@ -116,7 +116,7 @@ async function fetchBlobsFromSnapshotTree( prefix: string = "/", perCommitBlobIdMap?: Map): Promise { assert(Object.keys(tree.commits).length === 0 || (prefix === "/"), - "Unexpected tree input to fetch"); + 0x1be /* "Unexpected tree input to fetch" */); const commit = !perCommitBlobIdMap; if (commit && dumpSnapshotTrees) { console.log(tree); @@ -151,9 +151,9 @@ async function fetchBlobsFromSnapshotTree( continue; } assert(dataStoreSnapShotTree.id === undefined || dataStoreSnapShotTree.id === tree.commits[dataStore], - `Unexpected id for tree: ${dataStoreSnapShotTree.id}`); + 0x1bf /* `Unexpected id for tree: ${dataStoreSnapShotTree.id}` */); assert(tree.commits[dataStore] === dataStoreVersions[0].id, - "Mismatch between commit id and fetched tree id"); + 0x1c0 /* "Mismatch between commit id and fetched tree id" */); const dataStoreBlobs = await fetchBlobsFromSnapshotTree( storage, dataStoreSnapShotTree, @@ -163,7 +163,7 @@ async function fetchBlobsFromSnapshotTree( for (const subtreeId of Object.keys(tree.trees)) { const subtree = tree.trees[subtreeId]; - assert(Object.keys(subtree.commits).length === 0, "Unexpected subtree properties"); + assert(Object.keys(subtree.commits).length === 0, 0x1c1 /* "Unexpected subtree properties" */); const dataStoreBlobs = await fetchBlobsFromSnapshotTree( storage, subtree, diff --git a/packages/tools/merge-tree-client-replay/src/clientReplayTool.ts b/packages/tools/merge-tree-client-replay/src/clientReplayTool.ts index 039c5acc7b62..e30f8ee7be68 100644 --- a/packages/tools/merge-tree-client-replay/src/clientReplayTool.ts +++ b/packages/tools/merge-tree-client-replay/src/clientReplayTool.ts @@ -249,10 +249,12 @@ export class ClientReplayTool { for (const mergeTree of client[1]) { assert( mergeTree[1].getLength() === readonlyClient.get(mergeTree[0]).getLength(), - "Mismatch between client mergeTree length and corresponding readonly mergeTree length"); + // eslint-disable-next-line max-len + 0x1c2 /* "Mismatch between client mergeTree length and corresponding readonly mergeTree length" */); assert( mergeTree[1].getText() === readonlyClient.get(mergeTree[0]).getText(), - "Mismatch between client mergeTree length and corresponding readonly mergeTree text"); + // eslint-disable-next-line max-len + 0x1c3 /* "Mismatch between client mergeTree length and corresponding readonly mergeTree text" */); } } } diff --git a/packages/tools/replay-tool/src/helpers.ts b/packages/tools/replay-tool/src/helpers.ts index 38ed74e6aae6..e10c67649446 100644 --- a/packages/tools/replay-tool/src/helpers.ts +++ b/packages/tools/replay-tool/src/helpers.ts @@ -264,7 +264,8 @@ export async function loadContainer( }); const container: Container = await loader.resolve({ url: resolved.url }); - assert(container.existing, "Container does not exist!"); // ReplayFileDeltaConnection.create() guarantees that + assert(container.existing, + 0x1c4 /* "Container does not exist!" */); // ReplayFileDeltaConnection.create() guarantees that return container; } diff --git a/packages/tools/replay-tool/src/replayMessages.ts b/packages/tools/replay-tool/src/replayMessages.ts index 01d88521b01f..7e4f7ac8d7d3 100644 --- a/packages/tools/replay-tool/src/replayMessages.ts +++ b/packages/tools/replay-tool/src/replayMessages.ts @@ -73,17 +73,18 @@ class ContainerContent { public constructor(public readonly op: number) { this._normalizedSnapshot = new Lazy(() => { - assert(this.snapshot !== undefined, "snapshot should be set before retreiving it"); + assert(this.snapshot !== undefined, 0x1c5 /* "snapshot should be set before retreiving it" */); return getNormalizedFileSnapshot(this.snapshot); }); this._snapshotAsString = new Lazy(() => { - assert(this.snapshot !== undefined, "snapshot should be set before retreiving it"); + assert(this.snapshot !== undefined, 0x1c6 /* "snapshot should be set before retreiving it" */); return JSON.stringify(this.snapshot, undefined, 2); }); this._snapshotExpanded = new Lazy(() => { - assert(this.snapshot !== undefined, "snapshot should be set before retreiving it as expanded string"); + assert(this.snapshot !== undefined, + 0x1c7 /* "snapshot should be set before retreiving it as expanded string" */); const snapshotExpanded: IFileSnapshot = { commits: {}, tree: expandTreeForReadability(this.snapshot.tree), @@ -224,7 +225,7 @@ class Document { this.resolveC = resolve; }); assert(this.documentSeqNumber === this.currentOp, - "Mismatch between document sequence number and current op number"); + 0x1c8 /* "Mismatch between document sequence number and current op number" */); } } @@ -295,7 +296,7 @@ export class ReplayTool { process.stdout.write("\n"); } assert(this.documentsFromStorageSnapshots.length === 0, - "Leftover documents after replay!"); + 0x1c9 /* "Leftover documents after replay!" */); process.removeListener("unhandledRejection", listener); @@ -522,7 +523,7 @@ export class ReplayTool { replayTo = Math.min(replayTo, op); } - assert(replayTo > currentOp, "replay-to target is <= current op in replay cycle"); + assert(replayTo > currentOp, 0x1ca /* "replay-to target is <= current op in replay cycle" */); for (const doc of this.documents) { await doc.replay(replayTo); } @@ -597,7 +598,7 @@ export class ReplayTool { && (final || this.documentsWindow[0].fromOp <= startOp)) { const doc = this.documentsWindow.shift(); assert(doc.fromOp === startOp || final, - "Bad window to verify snapshot"); + 0x1cb /* "Bad window to verify snapshot" */); await this.saveAndVerify(doc, dir, content, final); } } @@ -614,7 +615,7 @@ export class ReplayTool { } if (processVersionedSnapshot) { this.documentPriorSnapshot = this.documentsFromStorageSnapshots.shift(); - assert(this.documentPriorSnapshot.fromOp === op, "Unexpected previous snapshot op number"); + assert(this.documentPriorSnapshot.fromOp === op, 0x1cc /* "Unexpected previous snapshot op number" */); await this.saveAndVerify(this.documentPriorSnapshot, dir, content, final) .catch((e) => { const from = this.documentPriorSnapshot.containerDescription; diff --git a/server/routerlicious/packages/protocol-base/src/quorum.ts b/server/routerlicious/packages/protocol-base/src/quorum.ts index 4139e5409147..f82de3c79c94 100644 --- a/server/routerlicious/packages/protocol-base/src/quorum.ts +++ b/server/routerlicious/packages/protocol-base/src/quorum.ts @@ -52,7 +52,7 @@ class PendingProposal implements IPendingProposal, ISequencedProposal { } public addRejection(clientId: string) { - assert(!this.rejections.has(clientId), `!this.rejections.has(${clientId})`); + assert(!this.rejections.has(clientId), 0x1cd /* `!this.rejections.has(${clientId})` */); this.rejections.add(clientId); } } @@ -157,7 +157,7 @@ export class Quorum extends TypedEventEmitter implements IQuorum * Adds a new client to the quorum */ public addMember(clientId: string, details: ISequencedClient) { - assert(!this.members.has(clientId), `!this.members.has(${clientId})`); + assert(!this.members.has(clientId), 0x1ce /* `!this.members.has(${clientId})` */); this.members.set(clientId, details); this.emit("addMember", clientId, details); } @@ -166,7 +166,7 @@ export class Quorum extends TypedEventEmitter implements IQuorum * Removes a client from the quorum */ public removeMember(clientId: string) { - assert(this.members.has(clientId), `this.members.has(${clientId})`); + assert(this.members.has(clientId), 0x1cf /* `this.members.has(${clientId})` */); this.members.delete(clientId); this.emit("removeMember", clientId); } @@ -212,10 +212,10 @@ export class Quorum extends TypedEventEmitter implements IQuorum sequenceNumber: number, local: boolean, clientSequenceNumber: number) { - assert(!this.proposals.has(sequenceNumber), `!this.proposals.has(${sequenceNumber})`); + assert(!this.proposals.has(sequenceNumber), 0x1d0 /* `!this.proposals.has(${sequenceNumber})` */); assert( !local || this.localProposals.has(clientSequenceNumber), - `!${local} || this.localProposals.has(${clientSequenceNumber})`); + 0x1d1 /* `!${local} || this.localProposals.has(${clientSequenceNumber})` */); const proposal = new PendingProposal( this.sendReject, @@ -244,7 +244,7 @@ export class Quorum extends TypedEventEmitter implements IQuorum // Proposals require unanimous approval so any rejection results in a rejection of the proposal. For error // detection we will keep a rejected proposal in the pending list until the MSN advances so that we can // track the total number of rejections. - assert(this.proposals.has(sequenceNumber), `this.proposals.has(${sequenceNumber})`); + assert(this.proposals.has(sequenceNumber), 0x1d2 /* `this.proposals.has(${sequenceNumber})` */); const proposal = this.proposals.get(sequenceNumber); if (proposal !== undefined) {