@fluidframework/container-runtime 2.4.0-299374 → 2.4.0-299707

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.
Files changed (48) hide show
  1. package/container-runtime.test-files.tar +0 -0
  2. package/dist/containerRuntime.d.ts.map +1 -1
  3. package/dist/containerRuntime.js +22 -59
  4. package/dist/containerRuntime.js.map +1 -1
  5. package/dist/gc/garbageCollection.d.ts +1 -1
  6. package/dist/gc/garbageCollection.d.ts.map +1 -1
  7. package/dist/gc/garbageCollection.js +2 -6
  8. package/dist/gc/garbageCollection.js.map +1 -1
  9. package/dist/opLifecycle/batchManager.d.ts +2 -0
  10. package/dist/opLifecycle/batchManager.d.ts.map +1 -1
  11. package/dist/opLifecycle/batchManager.js.map +1 -1
  12. package/dist/opLifecycle/outbox.d.ts.map +1 -1
  13. package/dist/opLifecycle/outbox.js +16 -10
  14. package/dist/opLifecycle/outbox.js.map +1 -1
  15. package/dist/packageVersion.d.ts +1 -1
  16. package/dist/packageVersion.js +1 -1
  17. package/dist/packageVersion.js.map +1 -1
  18. package/dist/pendingStateManager.d.ts +8 -2
  19. package/dist/pendingStateManager.d.ts.map +1 -1
  20. package/dist/pendingStateManager.js +14 -7
  21. package/dist/pendingStateManager.js.map +1 -1
  22. package/lib/containerRuntime.d.ts.map +1 -1
  23. package/lib/containerRuntime.js +22 -59
  24. package/lib/containerRuntime.js.map +1 -1
  25. package/lib/gc/garbageCollection.d.ts +1 -1
  26. package/lib/gc/garbageCollection.d.ts.map +1 -1
  27. package/lib/gc/garbageCollection.js +3 -7
  28. package/lib/gc/garbageCollection.js.map +1 -1
  29. package/lib/opLifecycle/batchManager.d.ts +2 -0
  30. package/lib/opLifecycle/batchManager.d.ts.map +1 -1
  31. package/lib/opLifecycle/batchManager.js.map +1 -1
  32. package/lib/opLifecycle/outbox.d.ts.map +1 -1
  33. package/lib/opLifecycle/outbox.js +16 -10
  34. package/lib/opLifecycle/outbox.js.map +1 -1
  35. package/lib/packageVersion.d.ts +1 -1
  36. package/lib/packageVersion.js +1 -1
  37. package/lib/packageVersion.js.map +1 -1
  38. package/lib/pendingStateManager.d.ts +8 -2
  39. package/lib/pendingStateManager.d.ts.map +1 -1
  40. package/lib/pendingStateManager.js +14 -7
  41. package/lib/pendingStateManager.js.map +1 -1
  42. package/package.json +20 -18
  43. package/src/containerRuntime.ts +43 -77
  44. package/src/gc/garbageCollection.ts +5 -12
  45. package/src/opLifecycle/batchManager.ts +3 -0
  46. package/src/opLifecycle/outbox.ts +21 -10
  47. package/src/packageVersion.ts +1 -1
  48. package/src/pendingStateManager.ts +26 -8
@@ -32,16 +32,23 @@ import { ScheduleManager } from "./scheduleManager.js";
32
32
  import { DocumentsSchemaController, OrderedClientCollection, OrderedClientElection, RetriableSummaryError, RunWhileConnectedCoordinator, Summarizer, SummarizerClientElection, SummaryCollection, SummaryManager, aliasBlobName, chunksBlobName, createRootSummarizerNodeWithGC, electedSummarizerBlobName, extractSummaryMetadataMessage, idCompressorBlobName, metadataBlobName, rootHasIsolatedChannels, summarizerClientType, wrapSummaryInChannelsTree, } from "./summary/index.js";
33
33
  import { Throttler, formExponentialFn } from "./throttler.js";
34
34
  /**
35
- * Utility to implement compat behaviors given an unknown message type
35
+ * Creates an error object to be thrown / passed to Container's close fn in case of an unknown message type.
36
36
  * The parameters are typed to support compile-time enforcement of handling all known types/behaviors
37
37
  *
38
- * @param _unknownContainerRuntimeMessageType - Typed as something unexpected, to ensure all known types have been
38
+ * @param unknownContainerRuntimeMessageType - Typed as something unexpected, to ensure all known types have been
39
39
  * handled before calling this function (e.g. in a switch statement).
40
- * @param compatBehavior - Typed redundantly with CompatModeBehavior to ensure handling is added when updating that type
40
+ *
41
+ * @param codePath - The code path where the unexpected message type was encountered.
42
+ *
43
+ * @param sequencedMessage - The sequenced message that contained the unexpected message type.
44
+ *
41
45
  */
42
- function compatBehaviorAllowsMessageType(_unknownContainerRuntimeMessageType, compatBehavior) {
43
- // undefined defaults to same behavior as "FailToProcess"
44
- return compatBehavior === "Ignore";
46
+ function getUnknownMessageTypeError(unknownContainerRuntimeMessageType, codePath, sequencedMessage) {
47
+ return DataProcessingError.create("Runtime message of unknown type", codePath, sequencedMessage, {
48
+ messageDetails: {
49
+ type: unknownContainerRuntimeMessageType,
50
+ },
51
+ });
45
52
  }
46
53
  /**
47
54
  * @legacy
@@ -1389,22 +1396,9 @@ export class ContainerRuntime extends TypedEventEmitter {
1389
1396
  // GC op is only sent in summarizer which should never have stashed ops.
1390
1397
  throw new LoggingError("GC op not expected to be stashed in summarizer");
1391
1398
  default: {
1392
- // This should be extremely rare for stashed ops.
1393
- // It would require a newer runtime stashing ops and then an older one applying them,
1394
- // e.g. if an app rolled back its container version
1395
- const compatBehavior = opContents.compatDetails?.behavior;
1396
- if (!compatBehaviorAllowsMessageType(opContents.type, compatBehavior)) {
1397
- const error = DataProcessingError.create("Stashed runtime message of unexpected type", "applyStashedOp", undefined /* sequencedMessage */, {
1398
- messageDetails: JSON.stringify({
1399
- type: opContents.type,
1400
- compatBehavior,
1401
- }),
1402
- });
1403
- this.closeFn(error);
1404
- throw error;
1405
- }
1406
- // Note: Even if its compat behavior allows it, we don't know how to apply this stashed op.
1407
- // All we can do is ignore it (similar to on process).
1399
+ const error = getUnknownMessageTypeError(opContents.type, "applyStashedOp" /* codePath */);
1400
+ this.closeFn(error);
1401
+ throw error;
1408
1402
  }
1409
1403
  }
1410
1404
  }
@@ -1724,23 +1718,9 @@ export class ContainerRuntime extends TypedEventEmitter {
1724
1718
  this.documentsSchemaController.processDocumentSchemaOp(message.contents, local, message.sequenceNumber);
1725
1719
  break;
1726
1720
  default: {
1727
- const compatBehavior = message.compatDetails?.behavior;
1728
- if (!compatBehaviorAllowsMessageType(message.type, compatBehavior)) {
1729
- const error = DataProcessingError.create(
1730
- // Former assert 0x3ce
1731
- "Runtime message of unknown type", "OpProcessing", message, {
1732
- local,
1733
- messageDetails: JSON.stringify({
1734
- type: message.type,
1735
- contentType: typeof message.contents,
1736
- compatBehavior,
1737
- batch: message.metadata?.batch,
1738
- compression: message.compression,
1739
- }),
1740
- });
1741
- this.closeFn(error);
1742
- throw error;
1743
- }
1721
+ const error = getUnknownMessageTypeError(message.type, "validateAndProcessRuntimeMessage" /* codePath */, message);
1722
+ this.closeFn(error);
1723
+ throw error;
1744
1724
  }
1745
1725
  }
1746
1726
  this.emit("op", message, true /* runtimeMessage */);
@@ -2848,26 +2828,9 @@ export class ContainerRuntime extends TypedEventEmitter {
2848
2828
  // send any ops, as some other client already changed schema.
2849
2829
  break;
2850
2830
  default: {
2851
- // This case should be very rare - it would imply an op was stashed from a
2852
- // future version of runtime code and now is being applied on an older version.
2853
- const compatBehavior = message.compatDetails?.behavior;
2854
- if (compatBehaviorAllowsMessageType(message.type, compatBehavior)) {
2855
- // We do not ultimately resubmit it, to be consistent with this version of the code.
2856
- this.logger.sendTelemetryEvent({
2857
- eventName: "resubmitUnrecognizedMessageTypeAllowed",
2858
- messageDetails: { type: message.type, compatBehavior },
2859
- });
2860
- }
2861
- else {
2862
- const error = DataProcessingError.create("Resubmitting runtime message of unexpected type", "reSubmitCore", undefined /* sequencedMessage */, {
2863
- messageDetails: JSON.stringify({
2864
- type: message.type,
2865
- compatBehavior,
2866
- }),
2867
- });
2868
- this.closeFn(error);
2869
- throw error;
2870
- }
2831
+ const error = getUnknownMessageTypeError(message.type, "reSubmitCore" /* codePath */);
2832
+ this.closeFn(error);
2833
+ throw error;
2871
2834
  }
2872
2835
  }
2873
2836
  }