@fluidframework/merge-tree 2.52.0 → 2.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/merge-tree
2
2
 
3
+ ## 2.53.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.52.0
4
8
 
5
9
  Dependency updates only.
@@ -26,12 +26,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  __setModuleDefault(result, mod);
27
27
  return result;
28
28
  };
29
- var __importDefault = (this && this.__importDefault) || function (mod) {
30
- return (mod && mod.__esModule) ? mod : { "default": mod };
31
- };
32
29
  Object.defineProperty(exports, "__esModule", { value: true });
33
30
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
34
- const node_assert_1 = __importDefault(require("node:assert"));
31
+ const node_assert_1 = require("node:assert");
35
32
  const fs = __importStar(require("node:fs"));
36
33
  const opBuilder_js_1 = require("../opBuilder.js");
37
34
  const ops_js_1 = require("../ops.js");
@@ -49,7 +46,7 @@ describe("MergeTree.Client", () => {
49
46
  originalClient.startOrUpdateCollaboration("A");
50
47
  for (const group of file) {
51
48
  for (const msg of group.msgs) {
52
- (0, node_assert_1.default)(msg.clientId, "expected clientId to be defined");
49
+ (0, node_assert_1.strict)(msg.clientId, "expected clientId to be defined");
53
50
  if (!msgClients.has(msg.clientId)) {
54
51
  const client = await testClient_js_1.TestClient.createFromClientSnapshot(originalClient, msg.clientId);
55
52
  msgClients.set(msg.clientId, { client, msgs: [] });
@@ -59,7 +56,7 @@ describe("MergeTree.Client", () => {
59
56
  for (const group of file) {
60
57
  const logger = new testClientLogger_js_1.TestClientLogger([...msgClients.values()].map((mc) => mc.client));
61
58
  const initialText = logger.validate();
62
- node_assert_1.default.strictEqual(initialText, group.initialText, "Initial text not as expected");
59
+ node_assert_1.strict.strictEqual(initialText, group.initialText, "Initial text not as expected");
63
60
  for (const msg of group.msgs) {
64
61
  const msgClient = msgClients.get(msg.clientId);
65
62
  while (msgClient.msgs.length > 0 &&
@@ -77,7 +74,7 @@ describe("MergeTree.Client", () => {
77
74
  }
78
75
  }
79
76
  const result = logger.validate();
80
- node_assert_1.default.strictEqual(result, group.resultText, "Result text not as expected");
77
+ node_assert_1.strict.strictEqual(result, group.resultText, "Result text not as expected");
81
78
  logger.dispose();
82
79
  }
83
80
  }).timeout(30 * 10000);
@@ -1 +1 @@
1
- {"version":3,"file":"client.replay.spec.js","sourceRoot":"","sources":["../../src/test/client.replay.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6DAA6D;AAE7D,8DAAiC;AACjC,4CAA8B;AAI9B,kDAAgD;AAChD,sCAA6D;AAE7D,+EAA+E;AAC/E,mDAA6C;AAC7C,+DAAyD;AAEzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,KAAK,MAAM,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,+CAAiB,CAAC,EAAE,CAAC;QAC1D,EAAE,CAAC,UAAU,QAAQ,EAAE,EAAE,KAAK,IAAI,EAAE;YACnC,MAAM,IAAI,GAAkB,IAAI,CAAC,KAAK,CACrC,EAAE,CAAC,YAAY,CAAC,GAAG,+CAAiB,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACnB,MAAM,UAAU,GAAG,IAAI,GAAG,EAGvB,CAAC;YACJ,MAAM,cAAc,GAAG,IAAI,0BAAU,CAAC,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YAC1D,cAAc,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;YACvD,cAAc,CAAC,0BAA0B,CA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C,IAAI,CAAC,KAAK,EAAG,CAAC,CAAC;oBACpD,CAAC;oBACD,MAAM,EAAE,GAAG,GAAG,CAAC,QAAwB,CAAC;oBACxC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAChC,EAAE,CAAC,IAAI,KAAK,2BAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,4BAAa,EAAC,EAAE,CAAC,CAC7D,CAAC;oBACF,KAAK,MAAM,EAAE,IAAI,UAAU;wBAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnD,CAAC;gBAED,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;oBAC7B,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC9B,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAG,CAAC,CAAC;oBAC5C,CAAC;gBACF,CAAC;gBACD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACjC,qBAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;gBAC5E,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;QACF,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;IACxB,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport assert from \"node:assert\";\nimport * as fs from \"node:fs\";\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport { createGroupOp } from \"../opBuilder.js\";\nimport { IMergeTreeOp, MergeTreeDeltaType } from \"../ops.js\";\n\nimport { ReplayGroup, replayResultsPath } from \"./mergeTreeOperationRunner.js\";\nimport { TestClient } from \"./testClient.js\";\nimport { TestClientLogger } from \"./testClientLogger.js\";\n\ndescribe(\"MergeTree.Client\", () => {\n\tfor (const filePath of fs.readdirSync(replayResultsPath)) {\n\t\tit(`Replay ${filePath}`, async () => {\n\t\t\tconst file: ReplayGroup[] = JSON.parse(\n\t\t\t\tfs.readFileSync(`${replayResultsPath}/${filePath}`).toString(),\n\t\t\t) as ReplayGroup[];\n\t\t\tconst msgClients = new Map<\n\t\t\t\tstring,\n\t\t\t\t{ client: TestClient; msgs: ISequencedDocumentMessage[] }\n\t\t\t>();\n\t\t\tconst originalClient = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tmsgClients.set(\"A\", { client: originalClient, msgs: [] });\n\t\t\toriginalClient.insertTextLocal(0, file[0].initialText);\n\t\t\toriginalClient.startOrUpdateCollaboration(\"A\");\n\t\t\tfor (const group of file) {\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tassert(msg.clientId, \"expected clientId to be defined\");\n\t\t\t\t\tif (!msgClients.has(msg.clientId)) {\n\t\t\t\t\t\tconst client = await TestClient.createFromClientSnapshot(\n\t\t\t\t\t\t\toriginalClient,\n\t\t\t\t\t\t\tmsg.clientId,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmsgClients.set(msg.clientId, { client, msgs: [] });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const group of file) {\n\t\t\t\tconst logger = new TestClientLogger([...msgClients.values()].map((mc) => mc.client));\n\t\t\t\tconst initialText = logger.validate();\n\t\t\t\tassert.strictEqual(initialText, group.initialText, \"Initial text not as expected\");\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tconst msgClient = msgClients.get(msg.clientId!)!;\n\t\t\t\t\twhile (\n\t\t\t\t\t\tmsgClient.msgs.length > 0 &&\n\t\t\t\t\t\tmsg.referenceSequenceNumber > msgClient.client.getCurrentSeq()\n\t\t\t\t\t) {\n\t\t\t\t\t\tmsgClient.client.applyMsg(msgClient.msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t\tconst op = msg.contents as IMergeTreeOp;\n\t\t\t\t\tmsgClient.client.localTransaction(\n\t\t\t\t\t\top.type === MergeTreeDeltaType.GROUP ? op : createGroupOp(op),\n\t\t\t\t\t);\n\t\t\t\t\tfor (const mc of msgClients) mc[1].msgs.push(msg);\n\t\t\t\t}\n\n\t\t\t\tfor (const mc of msgClients) {\n\t\t\t\t\twhile (mc[1].msgs.length > 0) {\n\t\t\t\t\t\tmc[1].client.applyMsg(mc[1].msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst result = logger.validate();\n\t\t\t\tassert.strictEqual(result, group.resultText, \"Result text not as expected\");\n\t\t\t\tlogger.dispose();\n\t\t\t}\n\t\t}).timeout(30 * 10000);\n\t}\n});\n"]}
1
+ {"version":3,"file":"client.replay.spec.js","sourceRoot":"","sources":["../../src/test/client.replay.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6DAA6D;AAE7D,6CAA+C;AAC/C,4CAA8B;AAI9B,kDAAgD;AAChD,sCAA6D;AAE7D,+EAA+E;AAC/E,mDAA6C;AAC7C,+DAAyD;AAEzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,KAAK,MAAM,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,+CAAiB,CAAC,EAAE,CAAC;QAC1D,EAAE,CAAC,UAAU,QAAQ,EAAE,EAAE,KAAK,IAAI,EAAE;YACnC,MAAM,IAAI,GAAkB,IAAI,CAAC,KAAK,CACrC,EAAE,CAAC,YAAY,CAAC,GAAG,+CAAiB,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACnB,MAAM,UAAU,GAAG,IAAI,GAAG,EAGv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AC,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;IACxB,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { strict as assert } from \"node:assert\";\nimport * as fs from \"node:fs\";\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport { createGroupOp } from \"../opBuilder.js\";\nimport { IMergeTreeOp, MergeTreeDeltaType } from \"../ops.js\";\n\nimport { ReplayGroup, replayResultsPath } from \"./mergeTreeOperationRunner.js\";\nimport { TestClient } from \"./testClient.js\";\nimport { TestClientLogger } from \"./testClientLogger.js\";\n\ndescribe(\"MergeTree.Client\", () => {\n\tfor (const filePath of fs.readdirSync(replayResultsPath)) {\n\t\tit(`Replay ${filePath}`, async () => {\n\t\t\tconst file: ReplayGroup[] = JSON.parse(\n\t\t\t\tfs.readFileSync(`${replayResultsPath}/${filePath}`).toString(),\n\t\t\t) as ReplayGroup[];\n\t\t\tconst msgClients = new Map<\n\t\t\t\tstring,\n\t\t\t\t{ client: TestClient; msgs: ISequencedDocumentMessage[] }\n\t\t\t>();\n\t\t\tconst originalClient = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tmsgClients.set(\"A\", { client: originalClient, msgs: [] });\n\t\t\toriginalClient.insertTextLocal(0, file[0].initialText);\n\t\t\toriginalClient.startOrUpdateCollaboration(\"A\");\n\t\t\tfor (const group of file) {\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tassert(msg.clientId, \"expected clientId to be defined\");\n\t\t\t\t\tif (!msgClients.has(msg.clientId)) {\n\t\t\t\t\t\tconst client = await TestClient.createFromClientSnapshot(\n\t\t\t\t\t\t\toriginalClient,\n\t\t\t\t\t\t\tmsg.clientId,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmsgClients.set(msg.clientId, { client, msgs: [] });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const group of file) {\n\t\t\t\tconst logger = new TestClientLogger([...msgClients.values()].map((mc) => mc.client));\n\t\t\t\tconst initialText = logger.validate();\n\t\t\t\tassert.strictEqual(initialText, group.initialText, \"Initial text not as expected\");\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tconst msgClient = msgClients.get(msg.clientId!)!;\n\t\t\t\t\twhile (\n\t\t\t\t\t\tmsgClient.msgs.length > 0 &&\n\t\t\t\t\t\tmsg.referenceSequenceNumber > msgClient.client.getCurrentSeq()\n\t\t\t\t\t) {\n\t\t\t\t\t\tmsgClient.client.applyMsg(msgClient.msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t\tconst op = msg.contents as IMergeTreeOp;\n\t\t\t\t\tmsgClient.client.localTransaction(\n\t\t\t\t\t\top.type === MergeTreeDeltaType.GROUP ? op : createGroupOp(op),\n\t\t\t\t\t);\n\t\t\t\t\tfor (const mc of msgClients) mc[1].msgs.push(msg);\n\t\t\t\t}\n\n\t\t\t\tfor (const mc of msgClients) {\n\t\t\t\t\twhile (mc[1].msgs.length > 0) {\n\t\t\t\t\t\tmc[1].client.applyMsg(mc[1].msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst result = logger.validate();\n\t\t\t\tassert.strictEqual(result, group.resultText, \"Result text not as expected\");\n\t\t\t\tlogger.dispose();\n\t\t\t}\n\t\t}).timeout(30 * 10000);\n\t}\n});\n"]}
@@ -3,11 +3,8 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
10
- const node_assert_1 = __importDefault(require("node:assert"));
7
+ const node_assert_1 = require("node:assert");
11
8
  const ordinal_js_1 = require("../ordinal.js");
12
9
  const mergeTreeOperationRunner_js_1 = require("./mergeTreeOperationRunner.js");
13
10
  function computeNumericOrdinal(index) {
@@ -28,8 +25,8 @@ describe("MergeTree.ordinals", () => {
28
25
  let previous = "";
29
26
  for (let i = 0; i < count; i++) {
30
27
  const current = (0, ordinal_js_1.computeHierarchicalOrdinal)(max, count, parentOrdinal, previous);
31
- (0, node_assert_1.default)(current > previous, "subsequent ordinal should be greater than previous");
32
- (0, node_assert_1.default)(current.length > parentOrdinal.length, "child ordinals should be more than parent");
28
+ (0, node_assert_1.strict)(current > previous, "subsequent ordinal should be greater than previous");
29
+ (0, node_assert_1.strict)(current.length > parentOrdinal.length, "child ordinals should be more than parent");
33
30
  previous = current;
34
31
  }
35
32
  parentOrdinal = previous ?? parentOrdinal;
@@ -41,7 +38,7 @@ describe("MergeTree.ordinals", () => {
41
38
  let previous = String.fromCharCode(0);
42
39
  for (let i = 2; i < Number.MAX_SAFE_INTEGER; i = Math.pow(i, 2)) {
43
40
  const current = computeNumericOrdinal(i);
44
- (0, node_assert_1.default)(current > previous, `subsequent ordinal should be greater than previous ${i.toString(16)}`);
41
+ (0, node_assert_1.strict)(current > previous, `subsequent ordinal should be greater than previous ${i.toString(16)}`);
45
42
  previous = current;
46
43
  }
47
44
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ordinal.spec.js","sourceRoot":"","sources":["../../src/test/ordinal.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,8DAAiC;AAEjC,8CAA2D;AAE3D,+EAA4D;AAE5D,SAAS,qBAAqB,CAAC,KAAa;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAC7C,qHAAqH;IACrH,iGAAiG;IACjG,qDAAqD;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,qDAAqD;IACrD,OAAO,GAAG,MA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AAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACzC,IAAA,qBAAM,EACL,OAAO,GAAG,QAAQ,EAClB,sDAAsD,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CACtE,CAAC;YACF,QAAQ,GAAG,OAAO,CAAC;QACpB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"node:assert\";\n\nimport { computeHierarchicalOrdinal } from \"../ordinal.js\";\n\nimport { doOverRange } from \"./mergeTreeOperationRunner.js\";\n\nfunction computeNumericOrdinal(index: number): string {\n\tconst prefixLen = Math.floor(index / 0xffff);\n\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tconst prefix = String.fromCharCode(0xffff).repeat(prefixLen);\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\treturn `${prefix}${String.fromCharCode(index - prefixLen * 0xffff)}`;\n}\n\ndescribe(\"MergeTree.ordinals\", () => {\n\tdoOverRange(\n\t\t{ min: 1, max: 16 },\n\t\t(i) => i + 1,\n\t\t(max) => {\n\t\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\t\tlet parentOrdinal = String.fromCharCode(0);\n\t\t\tit(`Max ${max}`, () => {\n\t\t\t\tdoOverRange(\n\t\t\t\t\t{ min: 1, max },\n\t\t\t\t\t(i) => i + 1,\n\t\t\t\t\t(count) => {\n\t\t\t\t\t\tlet previous: string = \"\";\n\t\t\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\t\t\tconst current = computeHierarchicalOrdinal(max, count, parentOrdinal, previous);\n\t\t\t\t\t\t\tassert(current > previous, \"subsequent ordinal should be greater than previous\");\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tcurrent.length > parentOrdinal.length,\n\t\t\t\t\t\t\t\t\"child ordinals should be more than parent\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprevious = current;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparentOrdinal = previous ?? parentOrdinal;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t},\n\t);\n\n\tit(\"numericOrdinal\", () => {\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tlet previous = String.fromCharCode(0);\n\t\tfor (let i = 2; i < Number.MAX_SAFE_INTEGER; i = Math.pow(i, 2)) {\n\t\t\tconst current = computeNumericOrdinal(i);\n\t\t\tassert(\n\t\t\t\tcurrent > previous,\n\t\t\t\t`subsequent ordinal should be greater than previous ${i.toString(16)}`,\n\t\t\t);\n\t\t\tprevious = current;\n\t\t}\n\t});\n});\n"]}
1
+ {"version":3,"file":"ordinal.spec.js","sourceRoot":"","sources":["../../src/test/ordinal.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAE/C,8CAA2D;AAE3D,+EAA4D;AAE5D,SAAS,qBAAqB,CAAC,KAAa;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAC7C,qHAAqH;IACrH,iGAAiG;IACjG,qDAAqD;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,qDAAqD;IACrD,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM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G,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACzC,IAAA,oBAAM,EACL,OAAO,GAAG,QAAQ,EAClB,sDAAsD,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CACtE,CAAC;YACF,QAAQ,GAAG,OAAO,CAAC;QACpB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { computeHierarchicalOrdinal } from \"../ordinal.js\";\n\nimport { doOverRange } from \"./mergeTreeOperationRunner.js\";\n\nfunction computeNumericOrdinal(index: number): string {\n\tconst prefixLen = Math.floor(index / 0xffff);\n\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tconst prefix = String.fromCharCode(0xffff).repeat(prefixLen);\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\treturn `${prefix}${String.fromCharCode(index - prefixLen * 0xffff)}`;\n}\n\ndescribe(\"MergeTree.ordinals\", () => {\n\tdoOverRange(\n\t\t{ min: 1, max: 16 },\n\t\t(i) => i + 1,\n\t\t(max) => {\n\t\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\t\tlet parentOrdinal = String.fromCharCode(0);\n\t\t\tit(`Max ${max}`, () => {\n\t\t\t\tdoOverRange(\n\t\t\t\t\t{ min: 1, max },\n\t\t\t\t\t(i) => i + 1,\n\t\t\t\t\t(count) => {\n\t\t\t\t\t\tlet previous: string = \"\";\n\t\t\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\t\t\tconst current = computeHierarchicalOrdinal(max, count, parentOrdinal, previous);\n\t\t\t\t\t\t\tassert(current > previous, \"subsequent ordinal should be greater than previous\");\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tcurrent.length > parentOrdinal.length,\n\t\t\t\t\t\t\t\t\"child ordinals should be more than parent\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprevious = current;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparentOrdinal = previous ?? parentOrdinal;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t},\n\t);\n\n\tit(\"numericOrdinal\", () => {\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tlet previous = String.fromCharCode(0);\n\t\tfor (let i = 2; i < Number.MAX_SAFE_INTEGER; i = Math.pow(i, 2)) {\n\t\t\tconst current = computeNumericOrdinal(i);\n\t\t\tassert(\n\t\t\t\tcurrent > previous,\n\t\t\t\t`subsequent ordinal should be greater than previous ${i.toString(16)}`,\n\t\t\t);\n\t\t\tprevious = current;\n\t\t}\n\t});\n});\n"]}
@@ -3,11 +3,8 @@
3
3
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
4
  * Licensed under the MIT License.
5
5
  */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
6
  Object.defineProperty(exports, "__esModule", { value: true });
10
- const node_assert_1 = __importDefault(require("node:assert"));
7
+ const node_assert_1 = require("node:assert");
11
8
  const stochastic_test_utils_1 = require("@fluid-private/stochastic-test-utils");
12
9
  const mergeTreeNodeWalk_js_1 = require("../mergeTreeNodeWalk.js");
13
10
  const revertibles_js_1 = require("../revertibles.js");
@@ -97,14 +94,14 @@ describe("MergeTree.Client", () => {
97
94
  seq = (0, mergeTreeOperationRunner_js_1.applyMessages)(seq, msgs.splice(0), clients.all, logger);
98
95
  (0, mergeTreeNodeWalk_js_1.walkAllChildSegments)(clients.B.mergeTree.root, (seg) => {
99
96
  if (seg?.trackingCollection.empty === false) {
100
- node_assert_1.default.notDeepStrictEqual(seg?.trackingCollection.empty, false, "there should be no left over tracking group");
97
+ node_assert_1.strict.notDeepStrictEqual(seg?.trackingCollection.empty, false, "there should be no left over tracking group");
101
98
  }
102
99
  if (seg?.localRefs?.empty === false) {
103
- node_assert_1.default.notDeepStrictEqual(seg?.localRefs?.empty, false, "there should be no left over local references");
100
+ node_assert_1.strict.notDeepStrictEqual(seg?.localRefs?.empty, false, "there should be no left over local references");
104
101
  }
105
102
  });
106
103
  const mergeTreeWithRevert = clients.B.mergeTree;
107
- node_assert_1.default.notDeepStrictEqual(mergeTreeWithRevert.__mergeTreeRevertible?.detachedReferences?.localRefs?.empty, false, "there should be no left over local references in detached references");
104
+ node_assert_1.strict.notDeepStrictEqual(mergeTreeWithRevert.__mergeTreeRevertible?.detachedReferences?.localRefs?.empty, false, "there should be no left over local references in detached references");
108
105
  }
109
106
  catch (error) {
110
107
  throw logger.addLogsToError(error);
@@ -1 +1 @@
1
- {"version":3,"file":"revertibleFarm.spec.js","sourceRoot":"","sources":["../../src/test/revertibleFarm.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,8DAAiC;AAEjC,gFAAkE;AAOlE,kEAA+D;AAE/D,sDAK2B;AAE3B,+EAMuC;AACvC,mDAAqD;AACrD,+DAAsF;AAEtF,MAAM,cAAc,GAAG;IACtB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE;IACjE,uBAAuB,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAC3C,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,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,CAAC;wBACH,MAAM,mBAAmB,GAAiC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;wBAC9E,qBAAM,CAAC,kBAAkB,CACxB,mBAAmB,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,EAC/E,KAAK,EACL,sEAAsE,CACtE,CAAC;oBACH,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBAChB,MAAM,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;oBACD,MAAM,CAAC,QAAQ,CAAC;wBACf,WAAW,EAAE,wBAAwB;wBACrC,QAAQ,EAAE,YAAY;qBACtB,CAAC,CAAC;oBACH,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"node:assert\";\n\nimport { makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport type {\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n} from \"../mergeTreeDeltaCallback.js\";\nimport { walkAllChildSegments } from \"../mergeTreeNodeWalk.js\";\nimport { SegmentGroup, type ISegmentPrivate } from \"../mergeTreeNodes.js\";\nimport {\n\tMergeTreeDeltaRevertible,\n\tMergeTreeWithRevert,\n\tappendToMergeTreeDeltaRevertibles,\n\trevertMergeTreeDeltaRevertibles,\n} from \"../revertibles.js\";\n\nimport {\n\tannotateRange,\n\tapplyMessages,\n\tdoOverRanges,\n\tgenerateOperationMessagesForClients,\n\tremoveRange,\n} from \"./mergeTreeOperationRunner.js\";\nimport { createRevertDriver } from \"./testClient.js\";\nimport { TestClientLogger, createClientsAtInitialState } from \"./testClientLogger.js\";\n\nconst defaultOptions = {\n\tinitialOps: 5,\n\tminLength: { min: 1, max: 256, growthFunc: (i): number => i * i },\n\tconcurrentOpsWithRevert: { min: 0, max: 8 },\n\trevertOps: { min: 1, max: 16 },\n\tackBeforeRevert: [\"None\", \"Some\", \"All\"] as (\"None\" | \"Some\" | \"All\")[],\n\trounds: 10,\n\toperations: [removeRange, annotateRange],\n\tgrowthFunc: (i): number => i * 2,\n};\n\ndescribe(\"MergeTree.Client\", () => {\n\tdoOverRanges(defaultOptions, ({ minLength: minLen, concurrentOpsWithRevert, revertOps }) => {\n\t\tfor (const ackBeforeRevert of defaultOptions.ackBeforeRevert) {\n\t\t\tit(`InitialOps: ${defaultOptions.initialOps} MinLen: ${minLen} ConcurrentOpsWithRevert: ${concurrentOpsWithRevert} RevertOps: ${revertOps} AckBeforeRevert: ${ackBeforeRevert}`, async () => {\n\t\t\t\tconst random = makeRandom(\n\t\t\t\t\tminLen,\n\t\t\t\t\trevertOps,\n\t\t\t\t\t[...ackBeforeRevert].reduce<number>((pv, cv) => pv + (cv.codePointAt(0) ?? 0), 0),\n\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t);\n\n\t\t\t\tconst clients = createClientsAtInitialState(\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialState: \"\",\n\t\t\t\t\t\toptions: { mergeTreeEnableAnnotateAdjust: true },\n\t\t\t\t\t},\n\t\t\t\t\t\"A\",\n\t\t\t\t\t\"B\",\n\t\t\t\t\t\"C\",\n\t\t\t\t);\n\t\t\t\tlet seq = 0;\n\t\t\t\tfor (let rnd = 0; rnd < defaultOptions.rounds; rnd++) {\n\t\t\t\t\tfor (const c of clients.all) c.updateMinSeq(seq);\n\n\t\t\t\t\tconst logger = new TestClientLogger(clients.all, `Round ${rnd}`);\n\t\t\t\t\t{\n\t\t\t\t\t\t// init with random values\n\t\t\t\t\t\tconst initialMsgs = generateOperationMessagesForClients(\n\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tdefaultOptions.initialOps,\n\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tseq = applyMessages(seq, initialMsgs, clients.all, logger);\n\t\t\t\t\t}\n\n\t\t\t\t\t// cache the base text to ensure we get back to it after revert\n\t\t\t\t\tconst undoBaseText = logger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\terrorPrefix: \"After Initial Ops\",\n\t\t\t\t\t});\n\n\t\t\t\t\tconst clientB_Revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\t\tconst clientBDriver = createRevertDriver(clients.B);\n\t\t\t\t\tconst deltaCallback = (\n\t\t\t\t\t\top: IMergeTreeDeltaOpArgs,\n\t\t\t\t\t\tdelta: IMergeTreeDeltaCallbackArgs,\n\t\t\t\t\t): void => {\n\t\t\t\t\t\tif (op.sequencedMessage === undefined) {\n\t\t\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, clientB_Revertibles);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst msgs: [ISequencedDocumentMessage, SegmentGroup | SegmentGroup[]][] = [];\n\t\t\t\t\t{\n\t\t\t\t\t\tclientBDriver.submitOpCallback = (op): number =>\n\t\t\t\t\t\t\tmsgs.push([\n\t\t\t\t\t\t\t\tclients.B.makeOpMessage(op, undefined, undefined, undefined, seq),\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\t\tclients.B.peekPendingSegmentGroups()!,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\tclients.B.on(\"delta\", deltaCallback);\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.B],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\trevertOps,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (concurrentOpsWithRevert > 0) {\n\t\t\t\t\t\t// add modifications from another client\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.C],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet redoBaseText: string | undefined;\n\t\t\t\t\tif (ackBeforeRevert !== \"None\") {\n\t\t\t\t\t\tconst ackAll = ackBeforeRevert === \"All\";\n\t\t\t\t\t\tseq = applyMessages(\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tmsgs.splice(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tackAll ? msgs.length : random.integer(0, Math.floor(msgs.length / 2)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (ackAll) {\n\t\t\t\t\t\t\tredoBaseText = logger.validate({ errorPrefix: \"Before Revert Ack\" });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\tbaseText: concurrentOpsWithRevert === 0 ? undoBaseText : undefined,\n\t\t\t\t\t\terrorPrefix: \"After Revert (undo)\",\n\t\t\t\t\t});\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// reset the callback before the final revert\n\t\t\t\t\t\t// to avoid accruing any new detached references\n\t\t\t\t\t\tclients.B.off(\"delta\", deltaCallback);\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\n\t\t\t\t\t\twalkAllChildSegments(clients.B.mergeTree.root, (seg: ISegmentPrivate) => {\n\t\t\t\t\t\t\tif (seg?.trackingCollection.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.trackingCollection.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over tracking group\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (seg?.localRefs?.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.localRefs?.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over local references\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst mergeTreeWithRevert: Partial<MergeTreeWithRevert> = clients.B.mergeTree;\n\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\tmergeTreeWithRevert.__mergeTreeRevertible?.detachedReferences?.localRefs?.empty,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\"there should be no left over local references in detached references\",\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\terrorPrefix: \"After Re-Revert (redo)\",\n\t\t\t\t\t\tbaseText: redoBaseText,\n\t\t\t\t\t});\n\t\t\t\t\tlogger.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n});\n"]}
1
+ {"version":3,"file":"revertibleFarm.spec.js","sourceRoot":"","sources":["../../src/test/revertibleFarm.spec.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,6CAA+C;AAE/C,gFAAkE;AAOlE,kEAA+D;AAE/D,sDAK2B;AAE3B,+EAMuC;AACvC,mDAAqD;AACrD,+DAAsF;AAEtF,MAAM,cAAc,GAAG;IACtB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE;IACjE,uBAAuB,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAC3C,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAgC;IACvE,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,CAAC,yCAAW,EAAE,2CAAa,CAAC;IACxC,UAAU,EAAE,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC;CAChC,CAAC;AAEF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,IAAA,0CAAY,EAAC,cAAc,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,uBAAuB,EAAE,SAAS,EAAE,EAAE,EAAE;QAC1F,KAAK,MAAM,eAAe,IAAI,cAAc,CAAC,eAAe,EAAE,C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AAQ,EAAE,YAAY;qBACtB,CAAC,CAAC;oBACH,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport type {\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n} from \"../mergeTreeDeltaCallback.js\";\nimport { walkAllChildSegments } from \"../mergeTreeNodeWalk.js\";\nimport { SegmentGroup, type ISegmentPrivate } from \"../mergeTreeNodes.js\";\nimport {\n\tMergeTreeDeltaRevertible,\n\tMergeTreeWithRevert,\n\tappendToMergeTreeDeltaRevertibles,\n\trevertMergeTreeDeltaRevertibles,\n} from \"../revertibles.js\";\n\nimport {\n\tannotateRange,\n\tapplyMessages,\n\tdoOverRanges,\n\tgenerateOperationMessagesForClients,\n\tremoveRange,\n} from \"./mergeTreeOperationRunner.js\";\nimport { createRevertDriver } from \"./testClient.js\";\nimport { TestClientLogger, createClientsAtInitialState } from \"./testClientLogger.js\";\n\nconst defaultOptions = {\n\tinitialOps: 5,\n\tminLength: { min: 1, max: 256, growthFunc: (i): number => i * i },\n\tconcurrentOpsWithRevert: { min: 0, max: 8 },\n\trevertOps: { min: 1, max: 16 },\n\tackBeforeRevert: [\"None\", \"Some\", \"All\"] as (\"None\" | \"Some\" | \"All\")[],\n\trounds: 10,\n\toperations: [removeRange, annotateRange],\n\tgrowthFunc: (i): number => i * 2,\n};\n\ndescribe(\"MergeTree.Client\", () => {\n\tdoOverRanges(defaultOptions, ({ minLength: minLen, concurrentOpsWithRevert, revertOps }) => {\n\t\tfor (const ackBeforeRevert of defaultOptions.ackBeforeRevert) {\n\t\t\tit(`InitialOps: ${defaultOptions.initialOps} MinLen: ${minLen} ConcurrentOpsWithRevert: ${concurrentOpsWithRevert} RevertOps: ${revertOps} AckBeforeRevert: ${ackBeforeRevert}`, async () => {\n\t\t\t\tconst random = makeRandom(\n\t\t\t\t\tminLen,\n\t\t\t\t\trevertOps,\n\t\t\t\t\t[...ackBeforeRevert].reduce<number>((pv, cv) => pv + (cv.codePointAt(0) ?? 0), 0),\n\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t);\n\n\t\t\t\tconst clients = createClientsAtInitialState(\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialState: \"\",\n\t\t\t\t\t\toptions: { mergeTreeEnableAnnotateAdjust: true },\n\t\t\t\t\t},\n\t\t\t\t\t\"A\",\n\t\t\t\t\t\"B\",\n\t\t\t\t\t\"C\",\n\t\t\t\t);\n\t\t\t\tlet seq = 0;\n\t\t\t\tfor (let rnd = 0; rnd < defaultOptions.rounds; rnd++) {\n\t\t\t\t\tfor (const c of clients.all) c.updateMinSeq(seq);\n\n\t\t\t\t\tconst logger = new TestClientLogger(clients.all, `Round ${rnd}`);\n\t\t\t\t\t{\n\t\t\t\t\t\t// init with random values\n\t\t\t\t\t\tconst initialMsgs = generateOperationMessagesForClients(\n\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tdefaultOptions.initialOps,\n\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tseq = applyMessages(seq, initialMsgs, clients.all, logger);\n\t\t\t\t\t}\n\n\t\t\t\t\t// cache the base text to ensure we get back to it after revert\n\t\t\t\t\tconst undoBaseText = logger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\terrorPrefix: \"After Initial Ops\",\n\t\t\t\t\t});\n\n\t\t\t\t\tconst clientB_Revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\t\tconst clientBDriver = createRevertDriver(clients.B);\n\t\t\t\t\tconst deltaCallback = (\n\t\t\t\t\t\top: IMergeTreeDeltaOpArgs,\n\t\t\t\t\t\tdelta: IMergeTreeDeltaCallbackArgs,\n\t\t\t\t\t): void => {\n\t\t\t\t\t\tif (op.sequencedMessage === undefined) {\n\t\t\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, clientB_Revertibles);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst msgs: [ISequencedDocumentMessage, SegmentGroup | SegmentGroup[]][] = [];\n\t\t\t\t\t{\n\t\t\t\t\t\tclientBDriver.submitOpCallback = (op): number =>\n\t\t\t\t\t\t\tmsgs.push([\n\t\t\t\t\t\t\t\tclients.B.makeOpMessage(op, undefined, undefined, undefined, seq),\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\t\tclients.B.peekPendingSegmentGroups()!,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\tclients.B.on(\"delta\", deltaCallback);\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.B],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\trevertOps,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (concurrentOpsWithRevert > 0) {\n\t\t\t\t\t\t// add modifications from another client\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.C],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet redoBaseText: string | undefined;\n\t\t\t\t\tif (ackBeforeRevert !== \"None\") {\n\t\t\t\t\t\tconst ackAll = ackBeforeRevert === \"All\";\n\t\t\t\t\t\tseq = applyMessages(\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tmsgs.splice(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tackAll ? msgs.length : random.integer(0, Math.floor(msgs.length / 2)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (ackAll) {\n\t\t\t\t\t\t\tredoBaseText = logger.validate({ errorPrefix: \"Before Revert Ack\" });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\tbaseText: concurrentOpsWithRevert === 0 ? undoBaseText : undefined,\n\t\t\t\t\t\terrorPrefix: \"After Revert (undo)\",\n\t\t\t\t\t});\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// reset the callback before the final revert\n\t\t\t\t\t\t// to avoid accruing any new detached references\n\t\t\t\t\t\tclients.B.off(\"delta\", deltaCallback);\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\n\t\t\t\t\t\twalkAllChildSegments(clients.B.mergeTree.root, (seg: ISegmentPrivate) => {\n\t\t\t\t\t\t\tif (seg?.trackingCollection.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.trackingCollection.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over tracking group\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (seg?.localRefs?.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.localRefs?.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over local references\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst mergeTreeWithRevert: Partial<MergeTreeWithRevert> = clients.B.mergeTree;\n\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\tmergeTreeWithRevert.__mergeTreeRevertible?.detachedReferences?.localRefs?.empty,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\"there should be no left over local references in detached references\",\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\terrorPrefix: \"After Re-Revert (redo)\",\n\t\t\t\t\t\tbaseText: redoBaseText,\n\t\t\t\t\t});\n\t\t\t\t\tlogger.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n});\n"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
6
- import assert from "node:assert";
6
+ import { strict as assert } from "node:assert";
7
7
  import * as fs from "node:fs";
8
8
  import { createGroupOp } from "../opBuilder.js";
9
9
  import { MergeTreeDeltaType } from "../ops.js";
@@ -1 +1 @@
1
- {"version":3,"file":"client.replay.spec.js","sourceRoot":"","sources":["../../src/test/client.replay.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAgB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAe,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,KAAK,MAAM,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC1D,EAAE,CAAC,UAAU,QAAQ,EAAE,EAAE,KAAK,IAAI,EAAE;YACnC,MAAM,IAAI,GAAkB,IAAI,CAAC,KAAK,CACrC,EAAE,CAAC,YAAY,CAAC,GAAG,iBAAiB,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACnB,MAAM,UAAU,GAAG,IAAI,GAAG,EAGvB,CAAC;YACJ,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YAC1D,cAAc,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,C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,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAG,CAAC,CAAC;oBACpD,CAAC;oBACD,MAAM,EAAE,GAAG,GAAG,CAAC,QAAwB,CAAC;oBACxC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAChC,EAAE,CAAC,IAAI,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAC7D,CAAC;oBACF,KAAK,MAAM,EAAE,IAAI,UAAU;wBAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnD,CAAC;gBAED,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;oBAC7B,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC9B,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAG,CAAC,CAAC;oBAC5C,CAAC;gBACF,CAAC;gBACD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACjC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;gBAC5E,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;QACF,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;IACxB,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport assert from \"node:assert\";\nimport * as fs from \"node:fs\";\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport { createGroupOp } from \"../opBuilder.js\";\nimport { IMergeTreeOp, MergeTreeDeltaType } from \"../ops.js\";\n\nimport { ReplayGroup, replayResultsPath } from \"./mergeTreeOperationRunner.js\";\nimport { TestClient } from \"./testClient.js\";\nimport { TestClientLogger } from \"./testClientLogger.js\";\n\ndescribe(\"MergeTree.Client\", () => {\n\tfor (const filePath of fs.readdirSync(replayResultsPath)) {\n\t\tit(`Replay ${filePath}`, async () => {\n\t\t\tconst file: ReplayGroup[] = JSON.parse(\n\t\t\t\tfs.readFileSync(`${replayResultsPath}/${filePath}`).toString(),\n\t\t\t) as ReplayGroup[];\n\t\t\tconst msgClients = new Map<\n\t\t\t\tstring,\n\t\t\t\t{ client: TestClient; msgs: ISequencedDocumentMessage[] }\n\t\t\t>();\n\t\t\tconst originalClient = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tmsgClients.set(\"A\", { client: originalClient, msgs: [] });\n\t\t\toriginalClient.insertTextLocal(0, file[0].initialText);\n\t\t\toriginalClient.startOrUpdateCollaboration(\"A\");\n\t\t\tfor (const group of file) {\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tassert(msg.clientId, \"expected clientId to be defined\");\n\t\t\t\t\tif (!msgClients.has(msg.clientId)) {\n\t\t\t\t\t\tconst client = await TestClient.createFromClientSnapshot(\n\t\t\t\t\t\t\toriginalClient,\n\t\t\t\t\t\t\tmsg.clientId,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmsgClients.set(msg.clientId, { client, msgs: [] });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const group of file) {\n\t\t\t\tconst logger = new TestClientLogger([...msgClients.values()].map((mc) => mc.client));\n\t\t\t\tconst initialText = logger.validate();\n\t\t\t\tassert.strictEqual(initialText, group.initialText, \"Initial text not as expected\");\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tconst msgClient = msgClients.get(msg.clientId!)!;\n\t\t\t\t\twhile (\n\t\t\t\t\t\tmsgClient.msgs.length > 0 &&\n\t\t\t\t\t\tmsg.referenceSequenceNumber > msgClient.client.getCurrentSeq()\n\t\t\t\t\t) {\n\t\t\t\t\t\tmsgClient.client.applyMsg(msgClient.msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t\tconst op = msg.contents as IMergeTreeOp;\n\t\t\t\t\tmsgClient.client.localTransaction(\n\t\t\t\t\t\top.type === MergeTreeDeltaType.GROUP ? op : createGroupOp(op),\n\t\t\t\t\t);\n\t\t\t\t\tfor (const mc of msgClients) mc[1].msgs.push(msg);\n\t\t\t\t}\n\n\t\t\t\tfor (const mc of msgClients) {\n\t\t\t\t\twhile (mc[1].msgs.length > 0) {\n\t\t\t\t\t\tmc[1].client.applyMsg(mc[1].msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst result = logger.validate();\n\t\t\t\tassert.strictEqual(result, group.resultText, \"Result text not as expected\");\n\t\t\t\tlogger.dispose();\n\t\t\t}\n\t\t}).timeout(30 * 10000);\n\t}\n});\n"]}
1
+ {"version":3,"file":"client.replay.spec.js","sourceRoot":"","sources":["../../src/test/client.replay.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAE7D,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAgB,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EAAe,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,KAAK,MAAM,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,CAAC;QA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C,CAAC;gBACF,CAAC;gBACD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACjC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,6BAA6B,CAAC,CAAC;gBAC5E,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC;QACF,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;IACxB,CAAC;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { strict as assert } from \"node:assert\";\nimport * as fs from \"node:fs\";\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport { createGroupOp } from \"../opBuilder.js\";\nimport { IMergeTreeOp, MergeTreeDeltaType } from \"../ops.js\";\n\nimport { ReplayGroup, replayResultsPath } from \"./mergeTreeOperationRunner.js\";\nimport { TestClient } from \"./testClient.js\";\nimport { TestClientLogger } from \"./testClientLogger.js\";\n\ndescribe(\"MergeTree.Client\", () => {\n\tfor (const filePath of fs.readdirSync(replayResultsPath)) {\n\t\tit(`Replay ${filePath}`, async () => {\n\t\t\tconst file: ReplayGroup[] = JSON.parse(\n\t\t\t\tfs.readFileSync(`${replayResultsPath}/${filePath}`).toString(),\n\t\t\t) as ReplayGroup[];\n\t\t\tconst msgClients = new Map<\n\t\t\t\tstring,\n\t\t\t\t{ client: TestClient; msgs: ISequencedDocumentMessage[] }\n\t\t\t>();\n\t\t\tconst originalClient = new TestClient({ mergeTreeEnableObliterate: true });\n\t\t\tmsgClients.set(\"A\", { client: originalClient, msgs: [] });\n\t\t\toriginalClient.insertTextLocal(0, file[0].initialText);\n\t\t\toriginalClient.startOrUpdateCollaboration(\"A\");\n\t\t\tfor (const group of file) {\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tassert(msg.clientId, \"expected clientId to be defined\");\n\t\t\t\t\tif (!msgClients.has(msg.clientId)) {\n\t\t\t\t\t\tconst client = await TestClient.createFromClientSnapshot(\n\t\t\t\t\t\t\toriginalClient,\n\t\t\t\t\t\t\tmsg.clientId,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmsgClients.set(msg.clientId, { client, msgs: [] });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const group of file) {\n\t\t\t\tconst logger = new TestClientLogger([...msgClients.values()].map((mc) => mc.client));\n\t\t\t\tconst initialText = logger.validate();\n\t\t\t\tassert.strictEqual(initialText, group.initialText, \"Initial text not as expected\");\n\t\t\t\tfor (const msg of group.msgs) {\n\t\t\t\t\tconst msgClient = msgClients.get(msg.clientId!)!;\n\t\t\t\t\twhile (\n\t\t\t\t\t\tmsgClient.msgs.length > 0 &&\n\t\t\t\t\t\tmsg.referenceSequenceNumber > msgClient.client.getCurrentSeq()\n\t\t\t\t\t) {\n\t\t\t\t\t\tmsgClient.client.applyMsg(msgClient.msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t\tconst op = msg.contents as IMergeTreeOp;\n\t\t\t\t\tmsgClient.client.localTransaction(\n\t\t\t\t\t\top.type === MergeTreeDeltaType.GROUP ? op : createGroupOp(op),\n\t\t\t\t\t);\n\t\t\t\t\tfor (const mc of msgClients) mc[1].msgs.push(msg);\n\t\t\t\t}\n\n\t\t\t\tfor (const mc of msgClients) {\n\t\t\t\t\twhile (mc[1].msgs.length > 0) {\n\t\t\t\t\t\tmc[1].client.applyMsg(mc[1].msgs.shift()!);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst result = logger.validate();\n\t\t\t\tassert.strictEqual(result, group.resultText, \"Result text not as expected\");\n\t\t\t\tlogger.dispose();\n\t\t\t}\n\t\t}).timeout(30 * 10000);\n\t}\n});\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import assert from "node:assert";
5
+ import { strict as assert } from "node:assert";
6
6
  import { computeHierarchicalOrdinal } from "../ordinal.js";
7
7
  import { doOverRange } from "./mergeTreeOperationRunner.js";
8
8
  function computeNumericOrdinal(index) {
@@ -1 +1 @@
1
- {"version":3,"file":"ordinal.spec.js","sourceRoot":"","sources":["../../src/test/ordinal.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,SAAS,qBAAqB,CAAC,KAAa;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAC7C,qHAAqH;IACrH,iGAAiG;IACjG,qDAAqD;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,qDAAqD;IACrD,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACnC,WAAW,CACV,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EACnB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACZ,CAAC,GAAG,EAAE,EAAE;QACP,qDAAqD;QACrD,IAAI,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC3C,EAAE,CAAC,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE;YACrB,WAAW,CACV,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EACf,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACZ,CAAC,KAAK,EAAE,EAAE;gBACT,IAAI,QAAQ,GAAW,EAAE,CAAC;gBAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;oBAChC,MAAM,OAAO,GAAG,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;oBAChF,MAAM,CAAC,OAAO,GAAG,QAAQ,EAAE,oDAAoD,CAAC,CAAC;oBACjF,MAAM,CACL,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,EACrC,4CAA4C,CAC5C,CAAC;oBACF,QAAQ,GAAG,OAAO,CAAC;gBACpB,CAAC;gBACD,aAAa,GAAG,QAAQ,IAAI,aAAa,CAAC;YAC3C,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CACD,CAAC;IAEF,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACzB,qDAAqD;QACrD,IAAI,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACzC,MAAM,CACL,OAAO,GAAG,QAAQ,EAClB,sDAAsD,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CACtE,CAAC;YACF,QAAQ,GAAG,OAAO,CAAC;QACpB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"node:assert\";\n\nimport { computeHierarchicalOrdinal } from \"../ordinal.js\";\n\nimport { doOverRange } from \"./mergeTreeOperationRunner.js\";\n\nfunction computeNumericOrdinal(index: number): string {\n\tconst prefixLen = Math.floor(index / 0xffff);\n\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tconst prefix = String.fromCharCode(0xffff).repeat(prefixLen);\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\treturn `${prefix}${String.fromCharCode(index - prefixLen * 0xffff)}`;\n}\n\ndescribe(\"MergeTree.ordinals\", () => {\n\tdoOverRange(\n\t\t{ min: 1, max: 16 },\n\t\t(i) => i + 1,\n\t\t(max) => {\n\t\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\t\tlet parentOrdinal = String.fromCharCode(0);\n\t\t\tit(`Max ${max}`, () => {\n\t\t\t\tdoOverRange(\n\t\t\t\t\t{ min: 1, max },\n\t\t\t\t\t(i) => i + 1,\n\t\t\t\t\t(count) => {\n\t\t\t\t\t\tlet previous: string = \"\";\n\t\t\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\t\t\tconst current = computeHierarchicalOrdinal(max, count, parentOrdinal, previous);\n\t\t\t\t\t\t\tassert(current > previous, \"subsequent ordinal should be greater than previous\");\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tcurrent.length > parentOrdinal.length,\n\t\t\t\t\t\t\t\t\"child ordinals should be more than parent\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprevious = current;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparentOrdinal = previous ?? parentOrdinal;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t},\n\t);\n\n\tit(\"numericOrdinal\", () => {\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tlet previous = String.fromCharCode(0);\n\t\tfor (let i = 2; i < Number.MAX_SAFE_INTEGER; i = Math.pow(i, 2)) {\n\t\t\tconst current = computeNumericOrdinal(i);\n\t\t\tassert(\n\t\t\t\tcurrent > previous,\n\t\t\t\t`subsequent ordinal should be greater than previous ${i.toString(16)}`,\n\t\t\t);\n\t\t\tprevious = current;\n\t\t}\n\t});\n});\n"]}
1
+ {"version":3,"file":"ordinal.spec.js","sourceRoot":"","sources":["../../src/test/ordinal.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAE5D,SAAS,qBAAqB,CAAC,KAAa;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;IAC7C,qHAAqH;IACrH,iGAAiG;IACjG,qDAAqD;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7D,qDAAqD;IACrD,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACnC,WAAW,CACV,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EACnB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACZ,CAAC,GAAG,EAAE,EAAE;QACP,qDAAqD;QACrD,IAAI,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC3C,EAAE,CAAC,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE;YACrB,WAAW,CACV,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EACf,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EACZ,CAAC,KAAK,EAAE,EAAE;gBACT,IAAI,QAAQ,GAAW,EAAE,CAAC;gBAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;oBAChC,MAAM,OAAO,GAAG,0BAA0B,CAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;oBAChF,MAAM,CAAC,OAAO,GAAG,QAAQ,EAAE,oDAAoD,CAAC,CAAC;oBACjF,MAAM,CACL,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,EACrC,4CAA4C,CAC5C,CAAC;oBACF,QAAQ,GAAG,OAAO,CAAC;gBACpB,CAAC;gBACD,aAAa,GAAG,QAAQ,IAAI,aAAa,CAAC;YAC3C,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CACD,CAAC;IAEF,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;QACzB,qDAAqD;QACrD,IAAI,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACjE,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;YACzC,MAAM,CACL,OAAO,GAAG,QAAQ,EAClB,sDAAsD,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CACtE,CAAC;YACF,QAAQ,GAAG,OAAO,CAAC;QACpB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { computeHierarchicalOrdinal } from \"../ordinal.js\";\n\nimport { doOverRange } from \"./mergeTreeOperationRunner.js\";\n\nfunction computeNumericOrdinal(index: number): string {\n\tconst prefixLen = Math.floor(index / 0xffff);\n\t// Ordinals exist purely for lexicographical sort order and use a small set of valid bytes for each string character.\n\t// The extra handling fromCodePoint has for things like surrogate pairs is therefore unnecessary.\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\tconst prefix = String.fromCharCode(0xffff).repeat(prefixLen);\n\t// eslint-disable-next-line unicorn/prefer-code-point\n\treturn `${prefix}${String.fromCharCode(index - prefixLen * 0xffff)}`;\n}\n\ndescribe(\"MergeTree.ordinals\", () => {\n\tdoOverRange(\n\t\t{ min: 1, max: 16 },\n\t\t(i) => i + 1,\n\t\t(max) => {\n\t\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\t\tlet parentOrdinal = String.fromCharCode(0);\n\t\t\tit(`Max ${max}`, () => {\n\t\t\t\tdoOverRange(\n\t\t\t\t\t{ min: 1, max },\n\t\t\t\t\t(i) => i + 1,\n\t\t\t\t\t(count) => {\n\t\t\t\t\t\tlet previous: string = \"\";\n\t\t\t\t\t\tfor (let i = 0; i < count; i++) {\n\t\t\t\t\t\t\tconst current = computeHierarchicalOrdinal(max, count, parentOrdinal, previous);\n\t\t\t\t\t\t\tassert(current > previous, \"subsequent ordinal should be greater than previous\");\n\t\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\t\tcurrent.length > parentOrdinal.length,\n\t\t\t\t\t\t\t\t\"child ordinals should be more than parent\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprevious = current;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparentOrdinal = previous ?? parentOrdinal;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t},\n\t);\n\n\tit(\"numericOrdinal\", () => {\n\t\t// eslint-disable-next-line unicorn/prefer-code-point\n\t\tlet previous = String.fromCharCode(0);\n\t\tfor (let i = 2; i < Number.MAX_SAFE_INTEGER; i = Math.pow(i, 2)) {\n\t\t\tconst current = computeNumericOrdinal(i);\n\t\t\tassert(\n\t\t\t\tcurrent > previous,\n\t\t\t\t`subsequent ordinal should be greater than previous ${i.toString(16)}`,\n\t\t\t);\n\t\t\tprevious = current;\n\t\t}\n\t});\n});\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import assert from "node:assert";
5
+ import { strict as assert } from "node:assert";
6
6
  import { makeRandom } from "@fluid-private/stochastic-test-utils";
7
7
  import { walkAllChildSegments } from "../mergeTreeNodeWalk.js";
8
8
  import { appendToMergeTreeDeltaRevertibles, revertMergeTreeDeltaRevertibles, } from "../revertibles.js";
@@ -1 +1 @@
1
- {"version":3,"file":"revertibleFarm.spec.js","sourceRoot":"","sources":["../../src/test/revertibleFarm.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAOlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAGN,iCAAiC,EACjC,+BAA+B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mCAAmC,EACnC,WAAW,GACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEtF,MAAM,cAAc,GAAG;IACtB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE;IACjE,uBAAuB,EAAE,EAAE,GA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AAK,EACL,+CAA+C,CAC/C,CAAC;4BACH,CAAC;wBACF,CAAC,CAAC,CAAC;wBACH,MAAM,mBAAmB,GAAiC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;wBAC9E,MAAM,CAAC,kBAAkB,CACxB,mBAAmB,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,EAC/E,KAAK,EACL,sEAAsE,CACtE,CAAC;oBACH,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBAChB,MAAM,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;oBACD,MAAM,CAAC,QAAQ,CAAC;wBACf,WAAW,EAAE,wBAAwB;wBACrC,QAAQ,EAAE,YAAY;qBACtB,CAAC,CAAC;oBACH,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport assert from \"node:assert\";\n\nimport { makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport type {\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n} from \"../mergeTreeDeltaCallback.js\";\nimport { walkAllChildSegments } from \"../mergeTreeNodeWalk.js\";\nimport { SegmentGroup, type ISegmentPrivate } from \"../mergeTreeNodes.js\";\nimport {\n\tMergeTreeDeltaRevertible,\n\tMergeTreeWithRevert,\n\tappendToMergeTreeDeltaRevertibles,\n\trevertMergeTreeDeltaRevertibles,\n} from \"../revertibles.js\";\n\nimport {\n\tannotateRange,\n\tapplyMessages,\n\tdoOverRanges,\n\tgenerateOperationMessagesForClients,\n\tremoveRange,\n} from \"./mergeTreeOperationRunner.js\";\nimport { createRevertDriver } from \"./testClient.js\";\nimport { TestClientLogger, createClientsAtInitialState } from \"./testClientLogger.js\";\n\nconst defaultOptions = {\n\tinitialOps: 5,\n\tminLength: { min: 1, max: 256, growthFunc: (i): number => i * i },\n\tconcurrentOpsWithRevert: { min: 0, max: 8 },\n\trevertOps: { min: 1, max: 16 },\n\tackBeforeRevert: [\"None\", \"Some\", \"All\"] as (\"None\" | \"Some\" | \"All\")[],\n\trounds: 10,\n\toperations: [removeRange, annotateRange],\n\tgrowthFunc: (i): number => i * 2,\n};\n\ndescribe(\"MergeTree.Client\", () => {\n\tdoOverRanges(defaultOptions, ({ minLength: minLen, concurrentOpsWithRevert, revertOps }) => {\n\t\tfor (const ackBeforeRevert of defaultOptions.ackBeforeRevert) {\n\t\t\tit(`InitialOps: ${defaultOptions.initialOps} MinLen: ${minLen} ConcurrentOpsWithRevert: ${concurrentOpsWithRevert} RevertOps: ${revertOps} AckBeforeRevert: ${ackBeforeRevert}`, async () => {\n\t\t\t\tconst random = makeRandom(\n\t\t\t\t\tminLen,\n\t\t\t\t\trevertOps,\n\t\t\t\t\t[...ackBeforeRevert].reduce<number>((pv, cv) => pv + (cv.codePointAt(0) ?? 0), 0),\n\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t);\n\n\t\t\t\tconst clients = createClientsAtInitialState(\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialState: \"\",\n\t\t\t\t\t\toptions: { mergeTreeEnableAnnotateAdjust: true },\n\t\t\t\t\t},\n\t\t\t\t\t\"A\",\n\t\t\t\t\t\"B\",\n\t\t\t\t\t\"C\",\n\t\t\t\t);\n\t\t\t\tlet seq = 0;\n\t\t\t\tfor (let rnd = 0; rnd < defaultOptions.rounds; rnd++) {\n\t\t\t\t\tfor (const c of clients.all) c.updateMinSeq(seq);\n\n\t\t\t\t\tconst logger = new TestClientLogger(clients.all, `Round ${rnd}`);\n\t\t\t\t\t{\n\t\t\t\t\t\t// init with random values\n\t\t\t\t\t\tconst initialMsgs = generateOperationMessagesForClients(\n\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tdefaultOptions.initialOps,\n\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tseq = applyMessages(seq, initialMsgs, clients.all, logger);\n\t\t\t\t\t}\n\n\t\t\t\t\t// cache the base text to ensure we get back to it after revert\n\t\t\t\t\tconst undoBaseText = logger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\terrorPrefix: \"After Initial Ops\",\n\t\t\t\t\t});\n\n\t\t\t\t\tconst clientB_Revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\t\tconst clientBDriver = createRevertDriver(clients.B);\n\t\t\t\t\tconst deltaCallback = (\n\t\t\t\t\t\top: IMergeTreeDeltaOpArgs,\n\t\t\t\t\t\tdelta: IMergeTreeDeltaCallbackArgs,\n\t\t\t\t\t): void => {\n\t\t\t\t\t\tif (op.sequencedMessage === undefined) {\n\t\t\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, clientB_Revertibles);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst msgs: [ISequencedDocumentMessage, SegmentGroup | SegmentGroup[]][] = [];\n\t\t\t\t\t{\n\t\t\t\t\t\tclientBDriver.submitOpCallback = (op): number =>\n\t\t\t\t\t\t\tmsgs.push([\n\t\t\t\t\t\t\t\tclients.B.makeOpMessage(op, undefined, undefined, undefined, seq),\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\t\tclients.B.peekPendingSegmentGroups()!,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\tclients.B.on(\"delta\", deltaCallback);\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.B],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\trevertOps,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (concurrentOpsWithRevert > 0) {\n\t\t\t\t\t\t// add modifications from another client\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.C],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet redoBaseText: string | undefined;\n\t\t\t\t\tif (ackBeforeRevert !== \"None\") {\n\t\t\t\t\t\tconst ackAll = ackBeforeRevert === \"All\";\n\t\t\t\t\t\tseq = applyMessages(\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tmsgs.splice(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tackAll ? msgs.length : random.integer(0, Math.floor(msgs.length / 2)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (ackAll) {\n\t\t\t\t\t\t\tredoBaseText = logger.validate({ errorPrefix: \"Before Revert Ack\" });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\tbaseText: concurrentOpsWithRevert === 0 ? undoBaseText : undefined,\n\t\t\t\t\t\terrorPrefix: \"After Revert (undo)\",\n\t\t\t\t\t});\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// reset the callback before the final revert\n\t\t\t\t\t\t// to avoid accruing any new detached references\n\t\t\t\t\t\tclients.B.off(\"delta\", deltaCallback);\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\n\t\t\t\t\t\twalkAllChildSegments(clients.B.mergeTree.root, (seg: ISegmentPrivate) => {\n\t\t\t\t\t\t\tif (seg?.trackingCollection.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.trackingCollection.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over tracking group\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (seg?.localRefs?.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.localRefs?.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over local references\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst mergeTreeWithRevert: Partial<MergeTreeWithRevert> = clients.B.mergeTree;\n\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\tmergeTreeWithRevert.__mergeTreeRevertible?.detachedReferences?.localRefs?.empty,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\"there should be no left over local references in detached references\",\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\terrorPrefix: \"After Re-Revert (redo)\",\n\t\t\t\t\t\tbaseText: redoBaseText,\n\t\t\t\t\t});\n\t\t\t\t\tlogger.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n});\n"]}
1
+ {"version":3,"file":"revertibleFarm.spec.js","sourceRoot":"","sources":["../../src/test/revertibleFarm.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAOlE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAGN,iCAAiC,EACjC,+BAA+B,GAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,aAAa,EACb,aAAa,EACb,YAAY,EACZ,mCAAmC,EACnC,WAAW,GACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEtF,MAAM,cAAc,GAAG;IACtB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE;IACjE,uBAAuB,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;IAC3C,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IAC9B,eAAe,EAAE,CAA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AM,CAAC,kBAAkB,CACxB,mBAAmB,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,SAAS,EAAE,KAAK,EAC/E,KAAK,EACL,sEAAsE,CACtE,CAAC;oBACH,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBAChB,MAAM,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;oBACpC,CAAC;oBACD,MAAM,CAAC,QAAQ,CAAC;wBACf,WAAW,EAAE,wBAAwB;wBACrC,QAAQ,EAAE,YAAY;qBACtB,CAAC,CAAC;oBACH,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,CAAC;YACF,CAAC,CAAC,CAAC;QACJ,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\n\nimport { makeRandom } from \"@fluid-private/stochastic-test-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\n\nimport type {\n\tIMergeTreeDeltaCallbackArgs,\n\tIMergeTreeDeltaOpArgs,\n} from \"../mergeTreeDeltaCallback.js\";\nimport { walkAllChildSegments } from \"../mergeTreeNodeWalk.js\";\nimport { SegmentGroup, type ISegmentPrivate } from \"../mergeTreeNodes.js\";\nimport {\n\tMergeTreeDeltaRevertible,\n\tMergeTreeWithRevert,\n\tappendToMergeTreeDeltaRevertibles,\n\trevertMergeTreeDeltaRevertibles,\n} from \"../revertibles.js\";\n\nimport {\n\tannotateRange,\n\tapplyMessages,\n\tdoOverRanges,\n\tgenerateOperationMessagesForClients,\n\tremoveRange,\n} from \"./mergeTreeOperationRunner.js\";\nimport { createRevertDriver } from \"./testClient.js\";\nimport { TestClientLogger, createClientsAtInitialState } from \"./testClientLogger.js\";\n\nconst defaultOptions = {\n\tinitialOps: 5,\n\tminLength: { min: 1, max: 256, growthFunc: (i): number => i * i },\n\tconcurrentOpsWithRevert: { min: 0, max: 8 },\n\trevertOps: { min: 1, max: 16 },\n\tackBeforeRevert: [\"None\", \"Some\", \"All\"] as (\"None\" | \"Some\" | \"All\")[],\n\trounds: 10,\n\toperations: [removeRange, annotateRange],\n\tgrowthFunc: (i): number => i * 2,\n};\n\ndescribe(\"MergeTree.Client\", () => {\n\tdoOverRanges(defaultOptions, ({ minLength: minLen, concurrentOpsWithRevert, revertOps }) => {\n\t\tfor (const ackBeforeRevert of defaultOptions.ackBeforeRevert) {\n\t\t\tit(`InitialOps: ${defaultOptions.initialOps} MinLen: ${minLen} ConcurrentOpsWithRevert: ${concurrentOpsWithRevert} RevertOps: ${revertOps} AckBeforeRevert: ${ackBeforeRevert}`, async () => {\n\t\t\t\tconst random = makeRandom(\n\t\t\t\t\tminLen,\n\t\t\t\t\trevertOps,\n\t\t\t\t\t[...ackBeforeRevert].reduce<number>((pv, cv) => pv + (cv.codePointAt(0) ?? 0), 0),\n\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t);\n\n\t\t\t\tconst clients = createClientsAtInitialState(\n\t\t\t\t\t{\n\t\t\t\t\t\tinitialState: \"\",\n\t\t\t\t\t\toptions: { mergeTreeEnableAnnotateAdjust: true },\n\t\t\t\t\t},\n\t\t\t\t\t\"A\",\n\t\t\t\t\t\"B\",\n\t\t\t\t\t\"C\",\n\t\t\t\t);\n\t\t\t\tlet seq = 0;\n\t\t\t\tfor (let rnd = 0; rnd < defaultOptions.rounds; rnd++) {\n\t\t\t\t\tfor (const c of clients.all) c.updateMinSeq(seq);\n\n\t\t\t\t\tconst logger = new TestClientLogger(clients.all, `Round ${rnd}`);\n\t\t\t\t\t{\n\t\t\t\t\t\t// init with random values\n\t\t\t\t\t\tconst initialMsgs = generateOperationMessagesForClients(\n\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\tdefaultOptions.initialOps,\n\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tseq = applyMessages(seq, initialMsgs, clients.all, logger);\n\t\t\t\t\t}\n\n\t\t\t\t\t// cache the base text to ensure we get back to it after revert\n\t\t\t\t\tconst undoBaseText = logger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\terrorPrefix: \"After Initial Ops\",\n\t\t\t\t\t});\n\n\t\t\t\t\tconst clientB_Revertibles: MergeTreeDeltaRevertible[] = [];\n\t\t\t\t\tconst clientBDriver = createRevertDriver(clients.B);\n\t\t\t\t\tconst deltaCallback = (\n\t\t\t\t\t\top: IMergeTreeDeltaOpArgs,\n\t\t\t\t\t\tdelta: IMergeTreeDeltaCallbackArgs,\n\t\t\t\t\t): void => {\n\t\t\t\t\t\tif (op.sequencedMessage === undefined) {\n\t\t\t\t\t\t\tappendToMergeTreeDeltaRevertibles(delta, clientB_Revertibles);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tconst msgs: [ISequencedDocumentMessage, SegmentGroup | SegmentGroup[]][] = [];\n\t\t\t\t\t{\n\t\t\t\t\t\tclientBDriver.submitOpCallback = (op): number =>\n\t\t\t\t\t\t\tmsgs.push([\n\t\t\t\t\t\t\t\tclients.B.makeOpMessage(op, undefined, undefined, undefined, seq),\n\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\t\tclients.B.peekPendingSegmentGroups()!,\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\tclients.B.on(\"delta\", deltaCallback);\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.B],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\trevertOps,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (concurrentOpsWithRevert > 0) {\n\t\t\t\t\t\t// add modifications from another client\n\t\t\t\t\t\tmsgs.push(\n\t\t\t\t\t\t\t...generateOperationMessagesForClients(\n\t\t\t\t\t\t\t\trandom,\n\t\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\t\t[clients.A, clients.C],\n\t\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t\t\tconcurrentOpsWithRevert,\n\t\t\t\t\t\t\t\tminLen,\n\t\t\t\t\t\t\t\tdefaultOptions.operations,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tlet redoBaseText: string | undefined;\n\t\t\t\t\tif (ackBeforeRevert !== \"None\") {\n\t\t\t\t\t\tconst ackAll = ackBeforeRevert === \"All\";\n\t\t\t\t\t\tseq = applyMessages(\n\t\t\t\t\t\t\tseq,\n\t\t\t\t\t\t\tmsgs.splice(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tackAll ? msgs.length : random.integer(0, Math.floor(msgs.length / 2)),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tclients.all,\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (ackAll) {\n\t\t\t\t\t\t\tredoBaseText = logger.validate({ errorPrefix: \"Before Revert Ack\" });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\tclear: true,\n\t\t\t\t\t\tbaseText: concurrentOpsWithRevert === 0 ? undoBaseText : undefined,\n\t\t\t\t\t\terrorPrefix: \"After Revert (undo)\",\n\t\t\t\t\t});\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// reset the callback before the final revert\n\t\t\t\t\t\t// to avoid accruing any new detached references\n\t\t\t\t\t\tclients.B.off(\"delta\", deltaCallback);\n\t\t\t\t\t\trevertMergeTreeDeltaRevertibles(clientBDriver, clientB_Revertibles.splice(0));\n\t\t\t\t\t\tseq = applyMessages(seq, msgs.splice(0), clients.all, logger);\n\n\t\t\t\t\t\twalkAllChildSegments(clients.B.mergeTree.root, (seg: ISegmentPrivate) => {\n\t\t\t\t\t\t\tif (seg?.trackingCollection.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.trackingCollection.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over tracking group\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (seg?.localRefs?.empty === false) {\n\t\t\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\t\t\tseg?.localRefs?.empty,\n\t\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\t\t\"there should be no left over local references\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst mergeTreeWithRevert: Partial<MergeTreeWithRevert> = clients.B.mergeTree;\n\t\t\t\t\t\tassert.notDeepStrictEqual(\n\t\t\t\t\t\t\tmergeTreeWithRevert.__mergeTreeRevertible?.detachedReferences?.localRefs?.empty,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t\"there should be no left over local references in detached references\",\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow logger.addLogsToError(error);\n\t\t\t\t\t}\n\t\t\t\t\tlogger.validate({\n\t\t\t\t\t\terrorPrefix: \"After Re-Revert (redo)\",\n\t\t\t\t\t\tbaseText: redoBaseText,\n\t\t\t\t\t});\n\t\t\t\t\tlogger.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/merge-tree",
3
- "version": "2.52.0",
3
+ "version": "2.53.0",
4
4
  "description": "Merge tree",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -81,30 +81,30 @@
81
81
  "temp-directory": "nyc/.nyc_output"
82
82
  },
83
83
  "dependencies": {
84
- "@fluid-internal/client-utils": "~2.52.0",
85
- "@fluidframework/container-definitions": "~2.52.0",
86
- "@fluidframework/core-interfaces": "~2.52.0",
87
- "@fluidframework/core-utils": "~2.52.0",
88
- "@fluidframework/datastore-definitions": "~2.52.0",
89
- "@fluidframework/driver-definitions": "~2.52.0",
90
- "@fluidframework/runtime-definitions": "~2.52.0",
91
- "@fluidframework/runtime-utils": "~2.52.0",
92
- "@fluidframework/shared-object-base": "~2.52.0",
93
- "@fluidframework/telemetry-utils": "~2.52.0"
84
+ "@fluid-internal/client-utils": "~2.53.0",
85
+ "@fluidframework/container-definitions": "~2.53.0",
86
+ "@fluidframework/core-interfaces": "~2.53.0",
87
+ "@fluidframework/core-utils": "~2.53.0",
88
+ "@fluidframework/datastore-definitions": "~2.53.0",
89
+ "@fluidframework/driver-definitions": "~2.53.0",
90
+ "@fluidframework/runtime-definitions": "~2.53.0",
91
+ "@fluidframework/runtime-utils": "~2.53.0",
92
+ "@fluidframework/shared-object-base": "~2.53.0",
93
+ "@fluidframework/telemetry-utils": "~2.53.0"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@arethetypeswrong/cli": "^0.17.1",
97
97
  "@biomejs/biome": "~1.9.3",
98
- "@fluid-internal/mocha-test-setup": "~2.52.0",
99
- "@fluid-private/stochastic-test-utils": "~2.52.0",
100
- "@fluid-private/test-pairwise-generator": "~2.52.0",
98
+ "@fluid-internal/mocha-test-setup": "~2.53.0",
99
+ "@fluid-private/stochastic-test-utils": "~2.53.0",
100
+ "@fluid-private/test-pairwise-generator": "~2.53.0",
101
101
  "@fluid-tools/benchmark": "^0.51.0",
102
102
  "@fluid-tools/build-cli": "^0.57.0",
103
103
  "@fluidframework/build-common": "^2.0.3",
104
104
  "@fluidframework/build-tools": "^0.57.0",
105
105
  "@fluidframework/eslint-config-fluid": "^5.7.4",
106
- "@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@2.51.0",
107
- "@fluidframework/test-runtime-utils": "~2.52.0",
106
+ "@fluidframework/merge-tree-previous": "npm:@fluidframework/merge-tree@2.52.0",
107
+ "@fluidframework/test-runtime-utils": "~2.53.0",
108
108
  "@microsoft/api-extractor": "7.52.8",
109
109
  "@types/diff": "^3.5.1",
110
110
  "@types/mocha": "^10.0.10",