@fluidframework/container-runtime 2.74.0-365691 → 2.74.0-370705

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.
@@ -1 +1 @@
1
- {"version":3,"file":"containerRuntime.js","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,uBAAuB,EACvB,aAAa,EACb,KAAK,EACL,iBAAiB,GACjB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAWpE,OAAO,EACN,eAAe,EACf,mBAAmB,GACnB,MAAM,gDAAgD,CAAC;AAgCxD,OAAO,EACN,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,eAAe,GACf,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAWjE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAQrE,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,uBAAuB,GACvB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,GACT,MAAM,8CAA8C,CAAC;AAsBtD,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,+BAA+B,EAC/B,WAAW,EACX,gBAAgB,GAChB,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,YAAY,EACZ,YAAY,EACZ,gBAAgB;AAChB,kDAAkD;AAClD,mBAAmB,EACnB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,MAAM,QAAQ,GAAG,QAAQ,CAAC;YAC1B,IAAI,QAAQ,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC;YACd,CAAC;YACD,MAAM;QACP,CAAC;QACD,KAAK,oBAAoB,CAAC,YAAY,CAAC;QACvC,KAAK,oBAAoB,CAAC,oBAAoB,CAAC;QAC/C,KAAK,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,MAAM;QACP,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tILayerCompatDetails,\n\tIProvideLayerCompatDetails,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tcheckLayerCompatibility,\n\tcreateEmitter,\n\tTrace,\n\tTypedEventEmitter,\n} from \"@fluid-internal/client-utils\";\nimport type {\n\tIAudience,\n\tISelf,\n\tICriticalContainerError,\n\tIAudienceEvents,\n} from \"@fluidframework/container-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type {\n\tIContainerContext,\n\tIGetPendingLocalStateProps,\n\tIRuntime,\n\tIDeltaManager,\n\tIDeltaManagerFull,\n\tILoader,\n\tIContainerStorageService,\n\tConnectionStatus,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tConnectionState,\n\tisIDeltaManagerFull,\n} from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tContainerExtensionFactory,\n\tContainerExtensionId,\n\tExtensionHost,\n\tExtensionHostEvents,\n\tExtensionInstantiationResult,\n\tExtensionRuntimeProperties,\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n\tIContainerRuntimeInternal,\n\t// eslint-disable-next-line import-x/no-deprecated\n\tIContainerRuntimeWithResolveHandle_Deprecated,\n\tJoinedStatus,\n\tOutboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tFluidObject,\n\tIFluidHandle,\n\tIRequest,\n\tIResponse,\n\tITelemetryBaseLogger,\n\tListenable,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleContext,\n\tIFluidHandleInternal,\n\tIProvideFluidHandleContext,\n\tISignalEnvelope,\n\tOpaqueJsonDeserialized,\n\tTypedMessage,\n} from \"@fluidframework/core-interfaces/internal\";\nimport {\n\tassert,\n\tDeferred,\n\tLazy,\n\tLazyPromise,\n\tPromiseCache,\n\tdelay,\n\tfail,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIClientDetails,\n\tIQuorumClients,\n\tISummaryTree,\n} from \"@fluidframework/driver-definitions\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\tISnapshot,\n\tISnapshotTree,\n\tISummaryContent,\n\tISummaryContext,\n\tSummaryObject,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { FetchSource, MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIIdCompressorCore,\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"@fluidframework/id-compressor/internal\";\nimport {\n\tcreateIdCompressor,\n\tcreateSessionId,\n\tdeserializeIdCompressor,\n} from \"@fluidframework/id-compressor/internal\";\nimport {\n\tFlushMode,\n\tFlushModeExperimental,\n\tchannelsTreeName,\n\tgcTreeKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeParam,\n\tIDataStore,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreRegistry,\n\tIFluidParentContext,\n\tISummarizeInternalResult,\n\tInboundAttachMessage,\n\tNamedFluidDataStoreRegistryEntries,\n\tSummarizeInternalFn,\n\tIInboundSignalMessage,\n\tIRuntimeMessagesContent,\n\tISummarizerNodeWithGC,\n\tStageControlsInternal,\n\tIContainerRuntimeBaseInternal,\n\tMinimumVersionForCollab,\n\tContainerExtensionExpectations,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tcreate404Response,\n\tdefaultMinVersionForCollab,\n\texceptionToResponse,\n\tGCDataBuilder,\n\tisValidMinVersionForCollab,\n\tRequestParser,\n\tRuntimeHeaders,\n\tvalidateMinimumVersionForCollab,\n\tseqFromTree,\n\tTelemetryContext,\n} from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIEventSampler,\n\tIFluidErrorBase,\n\tITelemetryGenericEventExt,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tGenericError,\n\tLoggingError,\n\tPerformanceEvent,\n\t// eslint-disable-next-line import-x/no-deprecated\n\tTaggedLoggerAdapter,\n\tUsageError,\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tcreateSampledLogger,\n\tloggerToMonitoringContext,\n\traiseConnectedEvent,\n\twrapError,\n\ttagCodeArtifacts,\n\tnormalizeError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { gt } from \"semver-ts\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { BindBatchTracker } from \"./batchTracker.js\";\nimport {\n\tBlobManager,\n\ttype IPendingBlobs,\n\tblobManagerBasePath,\n\tblobsTreeName,\n\tisBlobPath,\n\tloadBlobManagerLoadInfo,\n\ttype IBlobManagerLoadInfo,\n} from \"./blobManager/index.js\";\nimport type {\n\tAddressedUnsequencedSignalEnvelope,\n\tIFluidRootParentContextPrivate,\n} from \"./channelCollection.js\";\nimport {\n\tChannelCollection,\n\tformParentContext,\n\tgetSummaryForDatastores,\n} from \"./channelCollection.js\";\nimport type { ICompressionRuntimeOptions } from \"./compressionDefinitions.js\";\nimport { CompressionAlgorithms, disabledCompressionConfig } from \"./compressionDefinitions.js\";\nimport { ReportOpPerfTelemetry } from \"./connectionTelemetry.js\";\nimport {\n\tgetMinVersionForCollabDefaults,\n\ttype RuntimeOptionsAffectingDocSchema,\n\tvalidateRuntimeOptions,\n\truntimeOptionKeysThatRequireExplicitSchemaControl,\n\ttype RuntimeOptionKeysThatRequireExplicitSchemaControl,\n} from \"./containerCompatibility.js\";\nimport { ContainerFluidHandleContext } from \"./containerHandleContext.js\";\nimport { channelToDataStore } from \"./dataStore.js\";\nimport { FluidDataStoreRegistry } from \"./dataStoreRegistry.js\";\nimport {\n\tBaseDeltaManagerProxy,\n\tDeltaManagerPendingOpsProxy,\n\tDeltaManagerSummarizerProxy,\n} from \"./deltaManagerProxies.js\";\nimport { DeltaScheduler } from \"./deltaScheduler.js\";\nimport {\n\tGCNodeType,\n\tGarbageCollector,\n\ttype IGCRuntimeOptions,\n\ttype IGCStats,\n\ttype IGarbageCollector,\n\tgcGenerationOptionName,\n\ttype GarbageCollectionMessage,\n\ttype IGarbageCollectionRuntime,\n} from \"./gc/index.js\";\nimport { InboundBatchAggregator } from \"./inboundBatchAggregator.js\";\nimport {\n\tContainerMessageType,\n\ttype ContainerRuntimeAliasMessage,\n\ttype ContainerRuntimeDataStoreOpMessage,\n\ttype OutboundContainerRuntimeDocumentSchemaMessage,\n\ttype ContainerRuntimeGCMessage,\n\ttype ContainerRuntimeIdAllocationMessage,\n\ttype InboundSequencedContainerRuntimeMessage,\n\ttype LocalContainerRuntimeMessage,\n\ttype OutboundContainerRuntimeAttachMessage,\n\ttype UnknownContainerRuntimeMessage,\n} from \"./messageTypes.js\";\nimport type { ISavedOpMetadata } from \"./metadata.js\";\nimport {\n\ttype LocalBatchMessage,\n\ttype BatchStartInfo,\n\tDuplicateBatchDetector,\n\tensureContentsDeserialized,\n\ttype IBatchCheckpoint,\n\tOpCompressor,\n\tOpDecompressor,\n\tOpGroupingManager,\n\tOpSplitter,\n\tOutbox,\n\tRemoteMessageProcessor,\n\ttype OutboundBatch,\n\ttype BatchResubmitInfo,\n} from \"./opLifecycle/index.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport {\n\ttype PendingMessageResubmitData,\n\ttype IPendingLocalState,\n\tPendingStateManager,\n\ttype PendingBatchResubmitMetadata,\n} from \"./pendingStateManager.js\";\nimport { BatchRunCounter, RunCounter } from \"./runCounter.js\";\nimport {\n\truntimeCompatDetailsForLoader,\n\truntimeCoreCompatDetails,\n\tvalidateLoaderCompatibility,\n} from \"./runtimeLayerCompatState.js\";\nimport { SignalTelemetryManager } from \"./signalTelemetryProcessing.js\";\n// These types are imported as types here because they are present in summaryDelayLoadedModule, which is loaded dynamically when required.\nimport {\n\taliasBlobName,\n\tchunksBlobName,\n\tcreateRootSummarizerNodeWithGC,\n\tDefaultSummaryConfiguration,\n\tDocumentsSchemaController,\n\telectedSummarizerBlobName,\n\ttype EnqueueSummarizeResult,\n\textractSummaryMetadataMessage,\n\tformCreateSummarizerFn,\n\ttype IBaseSummarizeResult,\n\ttype IConnectableRuntime,\n\ttype IContainerRuntimeMetadata,\n\ttype ICreateContainerMetadata,\n\tidCompressorBlobName,\n\ttype IdCompressorMode,\n\ttype IDocumentSchemaChangeMessageIncoming,\n\ttype IDocumentSchemaCurrent,\n\ttype IDocumentSchemaFeatures,\n\ttype IEnqueueSummarizeOptions,\n\ttype IGeneratedSummaryStats,\n\ttype IGenerateSummaryTreeResult,\n\ttype IOnDemandSummarizeOptions,\n\ttype IRefreshSummaryAckOptions,\n\ttype IRootSummarizerNodeWithGC,\n\ttype ISerializedElection,\n\tisSummariesDisabled,\n\tisSummaryOnRequest,\n\ttype ISubmitSummaryOptions,\n\ttype ISummarizeResults,\n\ttype ISummarizerInternalsProvider,\n\ttype ISummarizerRuntime,\n\ttype ISummaryConfiguration,\n\ttype ISummaryMetadataMessage,\n\tmetadataBlobName,\n\tOrderedClientCollection,\n\tOrderedClientElection,\n\trecentBatchInfoBlobName,\n\tRetriableSummaryError,\n\trootHasIsolatedChannels,\n\ttype SubmitSummaryResult,\n\ttype Summarizer,\n\tSummarizerClientElection,\n\tsummarizerClientType,\n\tsummarizerRequestUrl,\n\tSummaryCollection,\n\tSummaryManager,\n\tvalidateSummaryHeuristicConfiguration,\n\twrapSummaryInChannelsTree,\n} from \"./summary/index.js\";\nimport { Throttler, formExponentialFn } from \"./throttler.js\";\n\n/**\n * A {@link ContainerExtension}'s factory function as stored in extension map.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `any` required to allow typed factory to be assignable per ContainerExtension.processSignal\ntype ExtensionEntry = ExtensionInstantiationResult<unknown, any, unknown[]>;\n\n/**\n * ContainerRuntime's compatibility details that is exposed to Container Extensions.\n */\nconst containerRuntimeCompatDetailsForContainerExtensions = {\n\t...runtimeCoreCompatDetails,\n\t/**\n\t * The features supported by the ContainerRuntime's ContainerExtensionStore\n\t * implementation.\n\t */\n\tsupportedFeatures: new Set<string>(),\n} as const satisfies ILayerCompatDetails;\n\n/**\n * Creates an error object to be thrown / passed to Container's close fn in case of an unknown message type.\n * The parameters are typed to support compile-time enforcement of handling all known types/behaviors\n *\n * @param unknownContainerRuntimeMessageType - Typed as something unexpected, to ensure all known types have been\n * handled before calling this function (e.g. in a switch statement).\n *\n * @param codePath - The code path where the unexpected message type was encountered.\n *\n * @param sequencedMessage - The sequenced message that contained the unexpected message type.\n *\n */\nfunction getUnknownMessageTypeError(\n\tunknownContainerRuntimeMessageType: UnknownContainerRuntimeMessage[\"type\"],\n\tcodePath: string,\n\tsequencedMessage?: ISequencedDocumentMessage,\n): IFluidErrorBase {\n\treturn DataProcessingError.create(\n\t\t\"Runtime message of unknown type\",\n\t\tcodePath,\n\t\tsequencedMessage,\n\t\t{\n\t\t\tmessageDetails: {\n\t\t\t\ttype: unknownContainerRuntimeMessageType,\n\t\t\t},\n\t\t},\n\t);\n}\n\n/**\n * @legacy @beta\n */\nexport interface ISummaryRuntimeOptions {\n\t/**\n\t * Override summary configurations set by the server.\n\t */\n\tsummaryConfigOverrides?: ISummaryConfiguration;\n\n\t/**\n\t * Delay before first attempt to spawn summarizing container.\n\t *\n\t * @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s\n\t * {@link ISummaryBaseConfiguration.initialSummarizerDelayMs} instead.\n\t */\n\tinitialSummarizerDelayMs?: number;\n}\n\n/**\n * Full set of options for container runtime as \"required\".\n *\n * @remarks\n * {@link IContainerRuntimeOptions} is expected to be used by consumers.\n *\n * @privateRemarks If any new properties are added to this interface (or\n * {@link IContainerRuntimeOptionsInternal}), then we will also need to make\n * changes in {@link file://./containerCompatibility.ts}.\n * If the new property does not change the DocumentSchema, then it must be\n * explicity omitted from {@link RuntimeOptionsAffectingDocSchema}.\n * If it does change the DocumentSchema, then a corresponding entry must be\n * added to `runtimeOptionsAffectingDocSchemaConfigMap` with the appropriate\n * compat configuration info.\n * If neither of the above is done, then the build will fail to compile.\n *\n * @legacy @beta\n */\nexport interface ContainerRuntimeOptions {\n\treadonly summaryOptions: ISummaryRuntimeOptions;\n\treadonly gcOptions: IGCRuntimeOptions;\n\t/**\n\t * Affects the behavior while loading the runtime when the data verification check which\n\t * compares the DeltaManager sequence number (obtained from protocol in summary) to the\n\t * runtime sequence number (obtained from runtime metadata in summary) finds a mismatch.\n\t * 1. \"close\" (default) will close the container with an assertion.\n\t * 2. \"log\" will log an error event to telemetry, but still continue to load.\n\t * 3. \"bypass\" will skip the check entirely. This is not recommended.\n\t */\n\treadonly loadSequenceNumberVerification: \"close\" | \"log\" | \"bypass\";\n\n\t/**\n\t * Enables the runtime to compress ops. See {@link ICompressionRuntimeOptions}.\n\t */\n\treadonly compressionOptions: ICompressionRuntimeOptions;\n\t/**\n\t * If specified, when in FlushMode.TurnBased, if the size of the ops between JS turns exceeds this value,\n\t * an error will be thrown and the container will close.\n\t *\n\t * If unspecified, the limit is 700Kb.\n\t *\n\t * 'Infinity' will disable any limit.\n\t *\n\t * @experimental This config should be driven by the connection with the service and will be moved in the future.\n\t */\n\treadonly maxBatchSizeInBytes: number;\n\t/**\n\t * If the op payload needs to be chunked in order to work around the maximum size of the batch, this value represents\n\t * how large the individual chunks will be. This is only supported when compression is enabled. If after compression, the\n\t * batch content size exceeds this value, it will be chunked into smaller ops of this exact size.\n\t *\n\t * This value is a trade-off between having many small chunks vs fewer larger chunks and by default, the runtime is configured to use\n\t * 200 * 1024 = 204800 bytes. This default value ensures that no compressed payload's content is able to exceed {@link ContainerRuntimeOptions.maxBatchSizeInBytes}\n\t * regardless of the overhead of an individual op.\n\t *\n\t * Any value of `chunkSizeInBytes` exceeding {@link ContainerRuntimeOptions.maxBatchSizeInBytes} will disable this feature, therefore if a compressed batch's content\n\t * size exceeds {@link ContainerRuntimeOptions.maxBatchSizeInBytes} after compression, the container will close with an instance of `DataProcessingError` with\n\t * the `BatchTooLarge` message.\n\t */\n\treadonly chunkSizeInBytes: number;\n\n\t/**\n\t * Enable the IdCompressor in the runtime.\n\t * @experimental Not ready for use.\n\t */\n\treadonly enableRuntimeIdCompressor: IdCompressorMode;\n\n\t/**\n\t * If enabled, the runtime will group messages within a batch into a single\n\t * message to be sent to the service.\n\t * The grouping and ungrouping of such messages is handled by the \"OpGroupingManager\".\n\t *\n\t * By default, the feature is enabled. This feature can only be disabled when compression is also disabled.\n\t * @deprecated The ability to disable Grouped Batching is deprecated and will be removed in a future release. This feature is required for the proper functioning of the Fluid Framework.\n\t */\n\treadonly enableGroupedBatching: boolean;\n\n\t/**\n\t * When this property is set to true, it requires runtime to control is document schema properly through ops\n\t * The benefit of this mode is that clients who do not understand schema will fail in predictable way, with predictable message,\n\t * and will not attempt to limp along, which could cause data corruptions and crashes in random places.\n\t * When this property is not set (or set to false), runtime operates in legacy mode, where new features (modifying document schema)\n\t * are engaged as they become available, without giving legacy clients any chance to fail predictably.\n\t */\n\treadonly explicitSchemaControl: boolean;\n\n\t/**\n\t * Create blob handles with pending payloads when calling createBlob (default is `undefined` (disabled)).\n\t * When enabled (`true`), createBlob will return a handle before the blob upload completes.\n\t */\n\treadonly createBlobPayloadPending: true | undefined;\n}\n\n/**\n * Options for container runtime.\n *\n * @legacy @beta\n */\nexport type IContainerRuntimeOptions = Partial<ContainerRuntimeOptions>;\n\n/**\n * Internal extension of {@link ContainerRuntimeOptions}\n *\n * @privateRemarks\n * These options are not available to consumers when creating a new container runtime,\n * but we do need to expose them for internal use, e.g. when configuring the container runtime\n * to ensure compatibility with older versions.\n *\n * This is defined as a fully required set of options as this package does not yet\n * use `exactOptionalPropertyTypes` and `Required<>` applied to optional type allowing\n * `undefined` like {@link IdCompressorMode} will exclude `undefined`.\n *\n * @internal\n */\nexport interface ContainerRuntimeOptionsInternal extends ContainerRuntimeOptions {\n\t/**\n\t * Sets the flush mode for the runtime. In Immediate flush mode the runtime will immediately\n\t * send all operations to the driver layer, while in TurnBased the operations will be buffered\n\t * and then sent them as a single batch at the end of the turn.\n\t * By default, flush mode is TurnBased.\n\t */\n\treadonly flushMode: FlushMode;\n\n\t/**\n\t * Allows Grouped Batching to be disabled by setting to false (default is true).\n\t * In that case, batched messages will be sent individually (but still all at the same time).\n\t */\n\treadonly enableGroupedBatching: boolean;\n}\n\n/**\n * Internal extension of {@link IContainerRuntimeOptions}\n *\n * @internal\n */\nexport type IContainerRuntimeOptionsInternal = Partial<ContainerRuntimeOptionsInternal>;\n\n/**\n * Error responses when requesting a deleted object will have this header set to true\n * @internal\n */\nexport const DeletedResponseHeaderKey = \"wasDeleted\";\n/**\n * Tombstone error responses will have this header set to true\n * @legacy @beta\n */\nexport const TombstoneResponseHeaderKey = \"isTombstoned\";\n/**\n * Inactive error responses will have this header set to true\n * @legacy @beta\n *\n * @deprecated this header is deprecated and will be removed in the future. The functionality corresponding\n * to this was experimental and is no longer supported.\n */\nexport const InactiveResponseHeaderKey = \"isInactive\";\n\n/**\n * The full set of parsed header data that may be found on Runtime requests\n * @internal\n */\nexport interface RuntimeHeaderData {\n\twait?: boolean;\n\tviaHandle?: boolean;\n\tallowTombstone?: boolean;\n}\n\n/**\n * Default values for Runtime Headers\n */\nexport const defaultRuntimeHeaderData: Required<RuntimeHeaderData> = {\n\twait: true,\n\tviaHandle: false,\n\tallowTombstone: false,\n};\n\nconst defaultStagingCommitOptions = { squash: false };\n\n/**\n * @deprecated\n * Untagged logger is unsupported going forward. There are old loaders with old ContainerContexts that only\n * have the untagged logger, so to accommodate that scenario the below interface is used. It can be removed once\n * its usage is removed from TaggedLoggerAdapter fallback.\n */\ninterface OldContainerContextWithLogger extends Omit<IContainerContext, \"taggedLogger\"> {\n\tlogger: ITelemetryBaseLogger;\n\ttaggedLogger: undefined;\n}\n\n/**\n * State saved when the container closes, to be given back to a newly\n * instantiated runtime in a new instance of the container, so it can load to the\n * same state\n */\nexport interface IPendingRuntimeState {\n\t/**\n\t * Pending ops from PendingStateManager\n\t */\n\tpending?: IPendingLocalState;\n\t/**\n\t * Pending blobs from BlobManager\n\t */\n\tpendingAttachmentBlobs?: IPendingBlobs;\n\t/**\n\t * Pending idCompressor state\n\t */\n\tpendingIdCompressorState?: SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Time at which session expiry timer started.\n\t */\n\tsessionExpiryTimerStarted?: number | undefined;\n}\n\nconst maxConsecutiveReconnectsKey = \"Fluid.ContainerRuntime.MaxConsecutiveReconnects\";\n\n// The actual limit is 1Mb (socket.io and Kafka limits)\n// We can't estimate it fully, as we\n// - do not know what properties relay service will add\n// - we do not stringify final op, thus we do not know how much escaping will be added.\nconst defaultMaxBatchSizeInBytes = 700 * 1024;\n\nconst defaultChunkSizeInBytes = 204800;\n\n/**\n * The default time to wait for pending ops to be processed during summarization\n */\nexport const defaultPendingOpsWaitTimeoutMs = 1000;\n/**\n * The default time to delay a summarization retry attempt when there are pending ops\n */\nexport const defaultPendingOpsRetryDelayMs = 1000;\n\n/**\n * Instead of refreshing from latest because we do not have 100% confidence in the state\n * of the current system, we should close the summarizer and let it recover.\n * This delay's goal is to prevent tight restart loops\n */\nconst defaultCloseSummarizerDelayMs = 5000; // 5 seconds\n\n/**\n * Checks whether a message.type is one of the values in ContainerMessageType\n */\nexport function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {\n\treturn (Object.values(ContainerMessageType) as string[]).includes(message.type);\n}\n\n/**\n * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a\n * special-case for document dirty state. Ultimately we should have no special-cases from the\n * ContainerRuntime's perspective.\n * @internal\n */\nexport const agentSchedulerId = \"_scheduler\";\n\n// safely check navigator and get the hardware spec value\nexport function getDeviceSpec(): {\n\tdeviceMemory?: number | undefined;\n\thardwareConcurrency?: number | undefined;\n} {\n\ttry {\n\t\tif (typeof navigator === \"object\" && navigator !== null) {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n\t\t\t\tdeviceMemory: (navigator as any).deviceMemory,\n\t\t\t\thardwareConcurrency: navigator.hardwareConcurrency,\n\t\t\t};\n\t\t}\n\t} catch {\n\t\t// Eat the error\n\t}\n\treturn {};\n}\n\n/**\n * Older loader doesn't have a submitBatchFn member, this is the older way of submitting a batch.\n * Rather than exposing the submitFn (now deprecated) and IDeltaManager (dangerous to hand out) to the Outbox,\n * we can provide a partially-applied function to keep those items private to the ContainerRuntime.\n */\nexport const makeLegacySendBatchFn =\n\t(\n\t\tsubmitFn: (\n\t\t\ttype: MessageType,\n\t\t\tcontents: unknown,\n\t\t\tbatch: boolean,\n\t\t\tappData?: unknown,\n\t\t) => number,\n\t\tdeltaManager: Pick<IDeltaManager<unknown, unknown>, \"flush\">,\n\t) =>\n\t(batch: OutboundBatch): number => {\n\t\t// Default to negative one to match Container.submitBatch behavior\n\t\tlet clientSequenceNumber: number = -1;\n\t\tfor (const message of batch.messages) {\n\t\t\tclientSequenceNumber = submitFn(\n\t\t\t\tMessageType.Operation,\n\t\t\t\t// For back-compat (submitFn only works on deserialized content)\n\t\t\t\tmessage.contents === undefined ? undefined : JSON.parse(message.contents),\n\t\t\t\ttrue, // batch\n\t\t\t\tmessage.metadata,\n\t\t\t);\n\t\t}\n\n\t\tdeltaManager.flush();\n\n\t\treturn clientSequenceNumber;\n\t};\n\n/**\n * Extract last message from the snapshot metadata.\n * Uses legacy property if not using explicit schema control, otherwise uses the new property.\n * This allows new runtime to make documents not openable for old runtimes, one explicit document schema control is enabled.\n * Please see addMetadataToSummary() as well\n */\nfunction lastMessageFromMetadata(\n\tmetadata: IContainerRuntimeMetadata | undefined,\n): ISummaryMetadataMessage | undefined {\n\treturn metadata?.documentSchema?.runtime?.explicitSchemaControl === true\n\t\t? metadata?.lastMessage\n\t\t: metadata?.message;\n}\n\n/**\n * There is some ancient back-compat code that we'd like to instrument\n * to understand if/when it is hit.\n * We only want to log this once, to avoid spamming telemetry if we are wrong and these cases are hit commonly.\n */\nexport let getSingleUseLegacyLogCallback = (logger: ITelemetryLoggerExt, type: string) => {\n\treturn (codePath: string): void => {\n\t\tlogger.sendTelemetryEvent({\n\t\t\teventName: \"LegacyMessageFormat\",\n\t\t\tdetails: { codePath, type },\n\t\t});\n\n\t\t// Now that we've logged, prevent future logging (globally).\n\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\tgetSingleUseLegacyLogCallback = () => () => {};\n\t};\n};\n\n/**\n * A {@link TypedMessage} that has unknown content explicitly\n * noted as deserialized JSON.\n */\nexport interface UnknownIncomingTypedMessage extends TypedMessage {\n\tcontent: OpaqueJsonDeserialized<unknown>;\n}\n\ntype UnsequencedSignalEnvelope = Omit<ISignalEnvelope, \"clientBroadcastSignalSequenceNumber\">;\n\n/**\n * This object holds the parameters necessary for the {@link loadContainerRuntime} function.\n * @legacy @beta\n */\nexport interface LoadContainerRuntimeParams {\n\t/**\n\t * Context of the container.\n\t */\n\tcontext: IContainerContext;\n\t/**\n\t * Mapping from data store types to their corresponding factories\n\t */\n\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t/**\n\t * Pass 'true' if loading from an existing snapshot.\n\t */\n\texisting: boolean;\n\t/**\n\t * Additional options to be passed to the runtime.\n\t * @remarks\n\t * Defaults to `{}`.\n\t */\n\truntimeOptions?: IContainerRuntimeOptions;\n\t/**\n\t * runtime services provided with context\n\t */\n\tcontainerScope?: FluidObject;\n\t/**\n\t * Promise that resolves to an object which will act as entryPoint for the Container.\n\t */\n\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;\n\n\t/**\n\t * Request handler for the request() method of the container runtime.\n\t * Only relevant for back-compat while we remove the request() method and move fully to entryPoint as the main pattern.\n\t * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t * */\n\trequestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;\n\n\t/**\n\t * Minimum version of the FF runtime that is required to collaborate on new documents.\n\t * The input should be a string that represents the minimum version of the FF runtime that should be\n\t * supported for collaboration. The format of the string must be in valid semver format.\n\t *\n\t * The inputted version will be used to determine the default configuration for\n\t * {@link IContainerRuntimeOptionsInternal} to ensure compatibility with the specified version.\n\t *\n\t * @example\n\t * minVersionForCollab: \"2.0.0\"\n\t *\n\t * @privateRemarks\n\t * Used to determine the default configuration for {@link IContainerRuntimeOptionsInternal} that affect the document schema.\n\t * For example, let's say that feature `foo` was added in 2.0 which introduces a new op type. Additionally, option `bar`\n\t * was added to `IContainerRuntimeOptionsInternal` in 2.0 to enable/disable `foo` since clients prior to 2.0 would not\n\t * understand the new op type. If a customer were to set minVersionForCollab to 2.0.0, then `bar` would be set to\n\t * enable `foo` by default. If a customer were to set minVersionForCollab to 1.0.0, then `bar` would be set to\n\t * disable `foo` by default.\n\t */\n\tminVersionForCollab?: MinimumVersionForCollab;\n}\n/**\n * This is meant to be used by a {@link @fluidframework/container-definitions#IRuntimeFactory} to instantiate a container runtime.\n * @param params - An object which specifies all required and optional params necessary to instantiate a runtime.\n * @returns A runtime which provides all the functionality necessary to bind with the loader layer via the {@link @fluidframework/container-definitions#IRuntime} interface and provide a runtime environment via the {@link @fluidframework/container-runtime-definitions#IContainerRuntime} interface.\n * @legacy @beta\n */\nexport async function loadContainerRuntime(\n\tparams: LoadContainerRuntimeParams,\n): Promise<IContainerRuntime & IRuntime> {\n\treturn ContainerRuntime.loadRuntime(params);\n}\n\nconst defaultMaxConsecutiveReconnects = 7;\n\n/**\n * These are the ONLY message types that are allowed to be submitted while in staging mode\n * (Does not apply to pre-StagingMode batches that are resubmitted, those are not considered to be staged)\n */\nfunction canStageMessageOfType(\n\ttype: LocalContainerRuntimeMessage[\"type\"],\n): type is\n\t| ContainerMessageType.FluidDataStoreOp\n\t| ContainerMessageType.GC\n\t| ContainerMessageType.DocumentSchemaChange {\n\treturn (\n\t\t// These are user changes coming up from the runtime's DataStores\n\t\ttype === ContainerMessageType.FluidDataStoreOp ||\n\t\t// GC ops are used to detect issues in the reference graph so all clients can repair their GC state.\n\t\t// These can be submitted at any time, including while in Staging Mode.\n\t\ttype === ContainerMessageType.GC ||\n\t\t// These are typically sent shortly after boot and will not be common in Staging Mode, but it's possible.\n\t\ttype === ContainerMessageType.DocumentSchemaChange\n\t);\n}\n\n/**\n * Represents the runtime of the container. Contains helper functions/state of the container.\n * It will define the store level mappings.\n *\n * @internal\n */\nexport class ContainerRuntime\n\textends TypedEventEmitter<IContainerRuntimeEvents>\n\timplements\n\t\tIContainerRuntimeInternal,\n\t\tIContainerRuntimeBaseInternal,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tIContainerRuntimeWithResolveHandle_Deprecated,\n\t\tIRuntime,\n\t\tIGarbageCollectionRuntime,\n\t\tISummarizerRuntime,\n\t\tISummarizerInternalsProvider,\n\t\t// If ContainerRuntime stops being exported from this package, this can\n\t\t// be updated to implement IFluidRootParentContextPrivate and leave\n\t\t// submitMessage included.\n\t\t// IFluidParentContextPrivate is also better than IFluidParentContext\n\t\t// and is also internal only; so, not usable here.\n\t\tOmit<IFluidParentContext, \"submitMessage\" | \"submitSignal\">,\n\t\tIProvideFluidHandleContext,\n\t\tIProvideLayerCompatDetails\n{\n\t/* eslint-disable @fluid-internal/fluid/no-hyphen-after-jsdoc-tag -- false positive AB#50920 */\n\t/**\n\t * Load the stores from a snapshot and returns the runtime.\n\t * @param params - An object housing the runtime properties.\n\t * {@link LoadContainerRuntimeParams} except internal, while still having layer compat obligations.\n\t * @privateRemarks\n\t * Despite this being `@internal`, `@fluidframework/test-utils` uses it in `createTestContainerRuntimeFactory` and assumes multiple versions of the package expose the same API.\n\t *\n\t * Also note that `mixinAttributor` from `@fluid-experimental/attributor` overrides this function:\n\t * that will have to be updated if changing the signature of this function as well.\n\t *\n\t * Assuming these usages are updated appropriately,\n\t * `loadRuntime` could be removed (replaced by `loadRuntime2` which could be renamed back to `loadRuntime`).\n\t */\n\tpublic static async loadRuntime(\n\t\tparams: LoadContainerRuntimeParams & {\n\t\t\t/**\n\t\t\t * Constructor to use to create the ContainerRuntime instance.\n\t\t\t * @remarks\n\t\t\t * Defaults to {@link ContainerRuntime}.\n\t\t\t */\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t},\n\t): Promise<ContainerRuntime> {\n\t\treturn ContainerRuntime.loadRuntime2({\n\t\t\t...params,\n\t\t\tregistry: new FluidDataStoreRegistry(params.registryEntries),\n\t\t});\n\t}\n\t/* eslint-enable @fluid-internal/fluid/no-hyphen-after-jsdoc-tag */\n\n\t/**\n\t * Load the stores from a snapshot and returns the runtime.\n\t * @remarks\n\t * Same as {@link ContainerRuntime.loadRuntime},\n\t * but with `registry` instead of `registryEntries` and more `runtimeOptions`.\n\t */\n\tpublic static async loadRuntime2(\n\t\tparams: Omit<LoadContainerRuntimeParams, \"registryEntries\" | \"runtimeOptions\"> & {\n\t\t\t/**\n\t\t\t * Mapping from data store types to their corresponding factories.\n\t\t\t */\n\t\t\tregistry: IFluidDataStoreRegistry;\n\t\t\t/**\n\t\t\t * Constructor to use to create the ContainerRuntime instance.\n\t\t\t * @remarks\n\t\t\t * Defaults to {@link ContainerRuntime}.\n\t\t\t */\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t\t/**\n\t\t\t * {@link LoadContainerRuntimeParams.runtimeOptions}, except with additional internal only options.\n\t\t\t */\n\t\t\truntimeOptions?: IContainerRuntimeOptionsInternal;\n\t\t},\n\t): Promise<ContainerRuntime> {\n\t\tconst {\n\t\t\tcontext,\n\t\t\tregistry,\n\t\t\texisting,\n\t\t\trequestHandler,\n\t\t\tprovideEntryPoint,\n\t\t\truntimeOptions = {} satisfies IContainerRuntimeOptionsInternal,\n\t\t\tcontainerScope = {},\n\t\t\tcontainerRuntimeCtor = ContainerRuntime,\n\t\t\tminVersionForCollab = defaultMinVersionForCollab,\n\t\t} = params;\n\n\t\t// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:\n\t\t// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45\n\t\tconst backCompatContext: IContainerContext | OldContainerContextWithLogger = context;\n\t\tconst passLogger =\n\t\t\tbackCompatContext.taggedLogger ??\n\t\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\t\tnew TaggedLoggerAdapter((backCompatContext as OldContainerContextWithLogger).logger);\n\t\tconst logger = createChildLogger({\n\t\t\tlogger: passLogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tconst mc = loggerToMonitoringContext(logger);\n\n\t\t// Some options require a minimum version of the FF runtime to operate, so the default configs will be generated\n\t\t// based on the minVersionForCollab.\n\t\t// For example, if minVersionForCollab is set to \"1.0.0\", the default configs will ensure compatibility with FF runtime\n\t\t// 1.0.0 or later. If the minVersionForCollab is set to \"2.10.0\", the default values will be generated to ensure compatibility\n\t\t// with FF runtime 2.10.0 or later.\n\t\tif (!isValidMinVersionForCollab(minVersionForCollab)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Invalid minVersionForCollab: ${minVersionForCollab}. It must be an existing FF version (i.e. 2.22.1).`,\n\t\t\t);\n\t\t}\n\t\t// We also validate that there is not a mismatch between `minVersionForCollab` and runtime options that\n\t\t// were manually set.\n\t\tvalidateRuntimeOptions(minVersionForCollab, runtimeOptions);\n\n\t\tconst defaultsAffectingDocSchema = getMinVersionForCollabDefaults(minVersionForCollab);\n\n\t\t// The following are the default values for the options that do not affect the DocumentSchema.\n\t\tconst defaultsNotAffectingDocSchema: Omit<\n\t\t\tContainerRuntimeOptionsInternal,\n\t\t\tkeyof RuntimeOptionsAffectingDocSchema\n\t\t> = {\n\t\t\tsummaryOptions: {},\n\t\t\tloadSequenceNumberVerification: \"close\",\n\t\t\tmaxBatchSizeInBytes: defaultMaxBatchSizeInBytes,\n\t\t\tchunkSizeInBytes: defaultChunkSizeInBytes,\n\t\t};\n\n\t\tconst defaultConfigs = {\n\t\t\t...defaultsAffectingDocSchema,\n\t\t\t...defaultsNotAffectingDocSchema,\n\t\t};\n\n\t\t// Here we set each option to its corresponding default config value if it's not provided in runtimeOptions.\n\t\t// Note: We cannot do a simple object merge of defaultConfigs/runtimeOptions because in most cases we don't want\n\t\t// a option that is undefined in runtimeOptions to override the default value (except for idCompressor, see below).\n\t\tconst {\n\t\t\tsummaryOptions = defaultConfigs.summaryOptions,\n\t\t\tgcOptions = defaultConfigs.gcOptions,\n\t\t\tloadSequenceNumberVerification = defaultConfigs.loadSequenceNumberVerification,\n\t\t\tmaxBatchSizeInBytes = defaultConfigs.maxBatchSizeInBytes,\n\t\t\tchunkSizeInBytes = defaultConfigs.chunkSizeInBytes,\n\t\t\texplicitSchemaControl = defaultConfigs.explicitSchemaControl,\n\t\t\tenableGroupedBatching = defaultConfigs.enableGroupedBatching,\n\t\t\tflushMode = defaultConfigs.flushMode,\n\t\t\t// If batching is disabled then we should disable compression as well. If batching is disabled and compression\n\t\t\t// is enabled via runtimeOptions, we will throw an error later.\n\t\t\tcompressionOptions = enableGroupedBatching === false\n\t\t\t\t? disabledCompressionConfig\n\t\t\t\t: defaultConfigs.compressionOptions,\n\t\t\tcreateBlobPayloadPending = defaultConfigs.createBlobPayloadPending,\n\t\t}: IContainerRuntimeOptionsInternal = runtimeOptions;\n\n\t\t// If explicitSchemaControl is off, ensure that options which require explicitSchemaControl are not enabled.\n\t\tif (!explicitSchemaControl) {\n\t\t\tconst disallowedKeys = Object.keys(runtimeOptions).filter(\n\t\t\t\t(key) =>\n\t\t\t\t\truntimeOptionKeysThatRequireExplicitSchemaControl.includes(\n\t\t\t\t\t\tkey as RuntimeOptionKeysThatRequireExplicitSchemaControl,\n\t\t\t\t\t) && runtimeOptions[key] !== undefined,\n\t\t\t);\n\t\t\tif (disallowedKeys.length > 0) {\n\t\t\t\tthrow new UsageError(`explicitSchemaControl must be enabled to use ${disallowedKeys}`);\n\t\t\t}\n\t\t}\n\n\t\t// The logic for enableRuntimeIdCompressor is a bit different. Since `undefined` represents a logical state (off)\n\t\t// we need to check it's explicitly set in runtimeOptions. If so, we should use that value even if it's undefined.\n\t\tconst enableRuntimeIdCompressor =\n\t\t\t\"enableRuntimeIdCompressor\" in runtimeOptions\n\t\t\t\t? runtimeOptions.enableRuntimeIdCompressor\n\t\t\t\t: defaultConfigs.enableRuntimeIdCompressor;\n\n\t\tconst tryFetchBlob = async <T>(blobName: string): Promise<T | undefined> => {\n\t\t\tconst blobId = context.baseSnapshot?.blobs[blobName];\n\t\t\tif (context.baseSnapshot !== undefined && blobId !== undefined) {\n\t\t\t\t// IContainerContext storage api return type still has undefined in 0.39 package version.\n\t\t\t\t// So once we release 0.40 container-defn package we can remove this check.\n\t\t\t\tassert(\n\t\t\t\t\tcontext.storage !== undefined,\n\t\t\t\t\t0x1f5 /* \"Attached state should have storage\" */,\n\t\t\t\t);\n\t\t\t\treturn readAndParse<T>(context.storage, blobId);\n\t\t\t}\n\t\t};\n\n\t\tconst [\n\t\t\tchunks,\n\t\t\trecentBatchInfo,\n\t\t\tmetadata,\n\t\t\telectedSummarizerData,\n\t\t\taliases,\n\t\t\tserializedIdCompressor,\n\t\t] = await Promise.all([\n\t\t\ttryFetchBlob<[string, string[]][]>(chunksBlobName),\n\t\t\ttryFetchBlob<ReturnType<DuplicateBatchDetector[\"getRecentBatchInfoForSummary\"]>>(\n\t\t\t\trecentBatchInfoBlobName,\n\t\t\t),\n\n\t\t\ttryFetchBlob<IContainerRuntimeMetadata>(metadataBlobName),\n\n\t\t\ttryFetchBlob<ISerializedElection>(electedSummarizerBlobName),\n\t\t\ttryFetchBlob<[string, string][]>(aliasBlobName),\n\t\t\ttryFetchBlob<SerializedIdCompressorWithNoSession>(idCompressorBlobName),\n\t\t]);\n\n\t\t// read snapshot blobs needed for BlobManager to load\n\t\tconst blobManagerLoadInfo = await loadBlobManagerLoadInfo(context);\n\n\t\tconst messageAtLastSummary = lastMessageFromMetadata(metadata);\n\n\t\t// Verify summary runtime sequence number matches protocol sequence number.\n\t\tconst runtimeSequenceNumber = messageAtLastSummary?.sequenceNumber;\n\t\tconst protocolSequenceNumber = context.deltaManager.initialSequenceNumber;\n\t\t// When we load with pending state, we reuse an old snapshot so we don't expect these numbers to match\n\t\tif (context.pendingLocalState === undefined && runtimeSequenceNumber !== undefined) {\n\t\t\t// Unless bypass is explicitly set, then take action when sequence numbers mismatch.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if -- Separate if statements make flow easier to parse\n\t\t\tif (\n\t\t\t\tloadSequenceNumberVerification !== \"bypass\" &&\n\t\t\t\truntimeSequenceNumber !== protocolSequenceNumber\n\t\t\t) {\n\t\t\t\t// Message to OCEs:\n\t\t\t\t// You can hit this error with runtimeSequenceNumber === -1 in < 2.0 RC3 builds.\n\t\t\t\t// This would indicate that explicit schema control is enabled in current (2.0 RC3+) builds and it\n\t\t\t\t// results in addMetadataToSummary() creating a poison pill for older runtimes in the form of a -1 sequence number.\n\t\t\t\t// Older runtimes do not understand new schema, and thus could corrupt document if they proceed, thus we are using\n\t\t\t\t// this poison pill to prevent them from proceeding.\n\n\t\t\t\t// \"Load from summary, runtime metadata sequenceNumber !== initialSequenceNumber\"\n\t\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t\t// pre-0.58 error message: SummaryMetadataMismatch\n\t\t\t\t\t\"Summary metadata mismatch\",\n\t\t\t\t\t{ runtimeVersion: pkgVersion, runtimeSequenceNumber, protocolSequenceNumber },\n\t\t\t\t);\n\n\t\t\t\tif (loadSequenceNumberVerification === \"log\") {\n\t\t\t\t\tlogger.sendErrorEvent({ eventName: \"SequenceNumberMismatch\" }, error);\n\t\t\t\t} else {\n\t\t\t\t\tcontext.closeFn(error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet desiredIdCompressorMode: IdCompressorMode;\n\t\tswitch (mc.config.getBoolean(\"Fluid.ContainerRuntime.IdCompressorEnabled\")) {\n\t\t\tcase true: {\n\t\t\t\tdesiredIdCompressorMode = \"on\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase false: {\n\t\t\t\tdesiredIdCompressorMode = undefined;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tdesiredIdCompressorMode = enableRuntimeIdCompressor;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Enabling the IdCompressor is a one-way operation and we only want to\n\t\t// allow new containers to turn it on.\n\t\tlet idCompressorMode: IdCompressorMode;\n\t\tif (existing) {\n\t\t\t// This setting has to be sticky for correctness:\n\t\t\t// 1) if compressior is OFF, it can't be enabled, as already running clients (in given document session) do not know\n\t\t\t// how to process compressor ops\n\t\t\t// 2) if it's ON, then all sessions should load compressor right away\n\t\t\t// 3) Same logic applies for \"delayed\" mode\n\t\t\t// Maybe in the future we will need to enabled (and figure how to do it safely) \"delayed\" -> \"on\" change.\n\t\t\t// We could do \"off\" -> \"on\" transition too, if all clients start loading compressor (but not using it initially) and\n\t\t\t// do so for a while - this will allow clients to eventually disregard \"off\" setting (when it's safe so) and start\n\t\t\t// using compressor in future sessions.\n\t\t\t// Everyting is possible, but it needs to be designed and executed carefully, when such need arises.\n\t\t\tidCompressorMode = metadata?.documentSchema?.runtime\n\t\t\t\t?.idCompressorMode as IdCompressorMode;\n\n\t\t\t// This is the only exception to the rule above - we have proper plumbing to load ID compressor on schema change\n\t\t\t// event. It is loaded async (relative to op processing), so this conversion is only safe for off -> delayed conversion!\n\t\t\t// Clients do not expect ID compressor ops unless ID compressor is On for them, and that could be achieved only through\n\t\t\t// explicit schema change, i.e. only if explicitSchemaControl is on.\n\t\t\t// Note: it would be better if we throw on combination of options (explicitSchemaControl = off, desiredIdCompressorMode === \"delayed\")\n\t\t\t// that is not supported. But our service tests are oblivious to these problems and throwing here will cause a ton of failures\n\t\t\t// We ignored incompatible ID compressor changes from the start (they were sticky), so that's not a new problem being introduced...\n\t\t\tif (\n\t\t\t\tidCompressorMode === undefined &&\n\t\t\t\tdesiredIdCompressorMode === \"delayed\" &&\n\t\t\t\texplicitSchemaControl\n\t\t\t) {\n\t\t\t\tidCompressorMode = desiredIdCompressorMode;\n\t\t\t}\n\t\t} else {\n\t\t\tidCompressorMode = desiredIdCompressorMode;\n\t\t}\n\n\t\tconst createIdCompressorFn = (): IIdCompressor & IIdCompressorCore => {\n\t\t\t/**\n\t\t\t * Because the IdCompressor emits so much telemetry, this function is used to sample\n\t\t\t * approximately 5% of all clients. Only the given percentage of sessions will emit telemetry.\n\t\t\t */\n\t\t\tconst idCompressorEventSampler: IEventSampler = (() => {\n\t\t\t\tconst isIdCompressorTelemetryEnabled = Math.random() < 0.05;\n\t\t\t\treturn {\n\t\t\t\t\tsample: () => {\n\t\t\t\t\t\treturn isIdCompressorTelemetryEnabled;\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t})();\n\n\t\t\tconst compressorLogger = createSampledLogger(logger, idCompressorEventSampler);\n\t\t\tconst pendingLocalState = context.pendingLocalState as IPendingRuntimeState;\n\n\t\t\tif (pendingLocalState?.pendingIdCompressorState !== undefined) {\n\t\t\t\treturn deserializeIdCompressor(\n\t\t\t\t\tpendingLocalState.pendingIdCompressorState,\n\t\t\t\t\tcompressorLogger,\n\t\t\t\t);\n\t\t\t} else if (serializedIdCompressor === undefined) {\n\t\t\t\treturn createIdCompressor(compressorLogger);\n\t\t\t} else {\n\t\t\t\treturn deserializeIdCompressor(\n\t\t\t\t\tserializedIdCompressor,\n\t\t\t\t\tcreateSessionId(),\n\t\t\t\t\tcompressorLogger,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst compressionLz4 =\n\t\t\tcompressionOptions.minimumBatchSizeInBytes !== Number.POSITIVE_INFINITY &&\n\t\t\tcompressionOptions.compressionAlgorithm === \"lz4\";\n\n\t\tconst documentSchemaController = new DocumentsSchemaController(\n\t\t\texisting,\n\t\t\tprotocolSequenceNumber,\n\t\t\tmetadata?.documentSchema,\n\t\t\t{\n\t\t\t\texplicitSchemaControl,\n\t\t\t\tcompressionLz4,\n\t\t\t\tidCompressorMode,\n\t\t\t\topGroupingEnabled: enableGroupedBatching,\n\t\t\t\tcreateBlobPayloadPending,\n\t\t\t\tdisallowedVersions: [],\n\t\t\t},\n\t\t\t(schema) => {\n\t\t\t\truntime.onSchemaChange(schema);\n\t\t\t},\n\t\t\t{ minVersionForCollab },\n\t\t\tlogger,\n\t\t);\n\n\t\t// If the minVersionForCollab for this client is greater than the existing one, we should use that one going forward.\n\t\tconst existingMinVersionForCollab =\n\t\t\tdocumentSchemaController.sessionSchema.info.minVersionForCollab;\n\t\tconst updatedMinVersionForCollab =\n\t\t\texistingMinVersionForCollab === undefined ||\n\t\t\tgt(minVersionForCollab, existingMinVersionForCollab)\n\t\t\t\t? minVersionForCollab\n\t\t\t\t: existingMinVersionForCollab;\n\n\t\tif (compressionLz4 && !enableGroupedBatching) {\n\t\t\tthrow new UsageError(\"If compression is enabled, op grouping must be enabled too\");\n\t\t}\n\n\t\tconst featureGatesForTelemetry: Record<string, boolean | number | undefined> = {};\n\n\t\t// Make sure we've got all the options including internal ones\n\t\tconst internalRuntimeOptions: Readonly<ContainerRuntimeOptionsInternal> = {\n\t\t\tsummaryOptions,\n\t\t\tgcOptions,\n\t\t\tloadSequenceNumberVerification,\n\t\t\tflushMode,\n\t\t\tcompressionOptions,\n\t\t\tmaxBatchSizeInBytes,\n\t\t\tchunkSizeInBytes,\n\t\t\tenableRuntimeIdCompressor,\n\t\t\tenableGroupedBatching,\n\t\t\texplicitSchemaControl,\n\t\t\tcreateBlobPayloadPending,\n\t\t};\n\n\t\tvalidateMinimumVersionForCollab(updatedMinVersionForCollab);\n\t\tconst runtime = new containerRuntimeCtor(\n\t\t\tcontext,\n\t\t\tregistry,\n\t\t\tmetadata,\n\t\t\telectedSummarizerData,\n\t\t\tchunks ?? [],\n\t\t\taliases ?? [],\n\t\t\tinternalRuntimeOptions,\n\t\t\tcontainerScope,\n\t\t\tlogger,\n\t\t\texisting,\n\t\t\tblobManagerLoadInfo,\n\t\t\tcontext.storage,\n\t\t\tcreateIdCompressorFn,\n\t\t\tdocumentSchemaController,\n\t\t\tfeatureGatesForTelemetry,\n\t\t\tprovideEntryPoint,\n\t\t\tupdatedMinVersionForCollab,\n\t\t\trequestHandler,\n\t\t\tundefined, // summaryConfiguration\n\t\t\trecentBatchInfo,\n\t\t);\n\n\t\truntime.sharePendingBlobs();\n\n\t\t// Initialize the base state of the runtime before it's returned.\n\t\tawait runtime.initializeBaseState(context.loader);\n\n\t\t// Apply stashed ops with a reference sequence number equal to the sequence number of the snapshot,\n\t\t// or zero. This must be done before Container replays saved ops.\n\t\tawait runtime.pendingStateManager.applyStashedOpsAt(runtimeSequenceNumber ?? 0);\n\n\t\treturn runtime;\n\t}\n\n\tpublic readonly options: Record<string | number, unknown>;\n\n\tprivate readonly _getClientId: () => string | undefined;\n\tpublic get clientId(): string | undefined {\n\t\treturn this._getClientId();\n\t}\n\n\tpublic readonly clientDetails: IClientDetails;\n\n\tprivate readonly isSummarizerClient: boolean;\n\n\tpublic get storage(): IContainerStorageService {\n\t\treturn this._storage;\n\t}\n\n\tpublic get containerRuntime(): ContainerRuntime {\n\t\treturn this;\n\t}\n\n\tprivate readonly submitSummaryFn: (\n\t\tsummaryOp: ISummaryContent,\n\t\treferenceSequenceNumber?: number,\n\t) => number;\n\tprivate readonly submitSignalFn: (\n\t\tcontent: UnsequencedSignalEnvelope,\n\t\ttargetClientId?: string,\n\t) => void;\n\tpublic readonly disposeFn: (error?: ICriticalContainerError) => void;\n\tpublic readonly closeFn: (error?: ICriticalContainerError) => void;\n\n\tpublic get flushMode(): FlushMode {\n\t\treturn this._flushMode;\n\t}\n\n\tpublic get scope(): FluidObject {\n\t\treturn this.containerScope;\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.registry;\n\t}\n\n\tprivate readonly _getAttachState: () => AttachState;\n\tpublic get attachState(): AttachState {\n\t\treturn this._getAttachState();\n\t}\n\n\tpublic readonly isReadOnly = (): boolean => this.deltaManager.readOnlyInfo.readonly === true;\n\n\t/**\n\t * Current session schema - defines what options are on & off.\n\t * It's overlap of document schema (controlled by summary & ops) and options controlling this session.\n\t * For example, document schema might have compression ON, but feature gates / runtime options turn it Off.\n\t * In such case it will be off in session schema (i.e. this session should not use compression), but this client\n\t * has to deal with compressed ops as other clients might send them.\n\t * And in reverse, session schema can have compression Off, but feature gates / runtime options want it On.\n\t * In such case it will be off in session schema, however this client will propose change to schema, and once / if\n\t * this op roundtrips, compression will be On. Client can't send compressed ops until it's change in schema.\n\t */\n\tpublic get sessionSchema(): {\n\t\t[P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean\n\t\t\t? true\n\t\t\t: IDocumentSchemaFeatures[P];\n\t} {\n\t\treturn this.documentsSchemaController.sessionSchema.runtime;\n\t}\n\n\tprivate _idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;\n\n\t// We accumulate Id compressor Ops while Id compressor is not loaded yet (only for \"delayed\" mode)\n\t// Once it loads, it will process all such ops and we will stop accumulating further ops - ops will be processes as they come in.\n\tprivate pendingIdCompressorOps: IdCreationRange[] = [];\n\n\t// Id Compressor serializes final state (see getPendingLocalState()). As result, it needs to skip all ops that preceeded that state\n\t// (such ops will be marked by Loader layer as savedOp === true)\n\t// That said, in \"delayed\" mode it's possible that Id Compressor was never initialized before getPendingLocalState() is called.\n\t// In such case we have to process all ops, including those marked with savedOp === true.\n\tprivate readonly skipSavedCompressorOps: boolean;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.idCompressor}\n\t */\n\tpublic get idCompressor(): (IIdCompressor & IIdCompressorCore) | undefined {\n\t\t// Expose ID Compressor only if it's On from the start.\n\t\t// If container uses delayed mode, then we can only expose generateDocumentUniqueId() and nothing else.\n\t\t// That's because any other usage will require immidiate loading of ID Compressor in next sessions in order\n\t\t// to reason over such things as session ID space.\n\t\tif (this.sessionSchema.idCompressorMode === \"on\") {\n\t\t\tassert(this._idCompressor !== undefined, 0x8ea /* compressor should have been loaded */);\n\t\t\treturn this._idCompressor;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.generateDocumentUniqueId}\n\t */\n\tpublic generateDocumentUniqueId(): string | number {\n\t\treturn this._idCompressor?.generateDocumentUniqueId() ?? uuid();\n\t}\n\n\tpublic get IFluidHandleContext(): IFluidHandleContext {\n\t\treturn this.handleContext;\n\t}\n\tprivate readonly handleContext: ContainerFluidHandleContext;\n\n\t/**\n\t * This is a proxy to the delta manager provided by the container context (innerDeltaManager). It restricts certain\n\t * accesses such as sets \"read-only\" mode for the summarizer client. This is the default delta manager that should\n\t * be used unless the innerDeltaManager is required.\n\t */\n\tpublic get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t\treturn this._deltaManager;\n\t}\n\n\tprivate readonly _deltaManager: BaseDeltaManagerProxy;\n\n\t/**\n\t * The delta manager provided by the container context. By default, using the default delta manager (proxy)\n\t * should be sufficient. This should be used only if necessary. For example, for validating and propagating connected\n\t * events which requires access to the actual real only info, this is needed.\n\t */\n\tprivate readonly innerDeltaManager: IDeltaManagerFull;\n\n\t// internal logger for ContainerRuntime. Use this.logger for stores, summaries, etc.\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate summarizerClientElection?: SummarizerClientElection;\n\t/**\n\t * summaryManager will only be created if this client is permitted to spawn a summarizing client\n\t * It is created only by interactive client, i.e. summarizer client, as well as non-interactive bots\n\t * do not create it (see SummarizerClientElection.clientDetailsPermitElection() for details)\n\t */\n\tprivate summaryManager?: SummaryManager;\n\n\tprivate readonly summarizerNode: IRootSummarizerNodeWithGC;\n\n\tprivate readonly maxConsecutiveReconnects: number;\n\n\tprivate readonly batchRunner = new BatchRunCounter();\n\tprivate readonly _flushMode: FlushMode;\n\t/**\n\t * BatchId tracking is needed whenever there's a possibility of a \"forked Container\",\n\t * where the same local state is pending in two different running Containers, each of\n\t * which is trying to ensure it's persisted.\n\t * \"Offline Load\" from serialized pending state is one such scenario since two Containers\n\t * could load from the same serialized pending state.\n\t */\n\tprivate readonly batchIdTrackingEnabled: boolean;\n\tprivate flushScheduled = false;\n\n\tprivate canSendOps: boolean;\n\tprivate canSendSignals: boolean | undefined;\n\n\tprivate readonly getConnectionState?: () => ConnectionState;\n\n\tprivate consecutiveReconnects = 0;\n\n\tprivate readonly dataModelChangeRunner = new RunCounter();\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, it will be marked as reentrant.\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\treturn this.dataModelChangeRunner.run(callback);\n\t}\n\n\t/**\n\t * Indicates whether the container is in a state where it is able to send\n\t * ops (connected to op stream and not in readonly mode).\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this.canSendOps;\n\t}\n\n\t/**\n\t * clientId of parent (non-summarizing) container that owns summarizer container\n\t */\n\tpublic get summarizerClientId(): string | undefined {\n\t\treturn this.summarizerClientElection?.electedClientId;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\n\tprivate lastEmittedDirty: boolean;\n\tprivate emitDirtyDocumentEvent = true;\n\tprivate readonly useDeltaManagerOpsProxy: boolean;\n\tprivate readonly closeSummarizerDelayMs: number;\n\n\tprivate readonly signalTelemetryManager = new SignalTelemetryManager();\n\n\t/**\n\t * Summarizer is responsible for coordinating when to send generate and send summaries.\n\t * It is the main entry point for summary work.\n\t * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n\t */\n\n\tprivate _summarizer?: Summarizer;\n\tprivate readonly deltaScheduler: DeltaScheduler;\n\tprivate readonly inboundBatchAggregator: InboundBatchAggregator;\n\tprivate readonly blobManager: BlobManager;\n\tprivate readonly pendingStateManager: PendingStateManager;\n\tprivate readonly duplicateBatchDetector: DuplicateBatchDetector | undefined;\n\tprivate readonly outbox: Outbox;\n\tprivate readonly garbageCollector: IGarbageCollector;\n\n\tprivate readonly channelCollection: ChannelCollection;\n\tprivate readonly remoteMessageProcessor: RemoteMessageProcessor;\n\n\t/**\n\t * The last message processed at the time of the last summary.\n\t */\n\n\tprivate messageAtLastSummary: ISummaryMetadataMessage | undefined;\n\n\tprivate readonly summariesDisabled: boolean;\n\n\tprivate readonly createContainerMetadata: ICreateContainerMetadata;\n\t/**\n\t * The summary number of the next summary that will be generated for this container. This is incremented every time\n\t * a summary is generated.\n\t */\n\tprivate nextSummaryNumber: number;\n\n\t/**\n\t * If false, loading or using a Tombstoned object should merely log, not fail.\n\t * @deprecated NOT SUPPORTED - hardcoded to return false since it's deprecated.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic get gcTombstoneEnforcementAllowed(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * If true, throw an error when a tombstone data store is used.\n\t * @deprecated NOT SUPPORTED - hardcoded to return false since it's deprecated.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic get gcThrowOnTombstoneUsage(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * GUID to identify a document in telemetry\n\t * ! Note: should not be used for anything other than telemetry and is not considered a stable GUID\n\t */\n\tprivate readonly telemetryDocumentId: string;\n\n\t/**\n\t * The id of the version used to initially load this runtime, or undefined if it's newly created.\n\t */\n\tprivate readonly loadedFromVersionId: string | undefined;\n\n\tprivate readonly isSnapshotInstanceOfISnapshot: boolean;\n\n\t/**\n\t * The summary context of the last acked summary. The properties from this as used when uploading a summary.\n\t */\n\tprivate lastAckedSummaryContext: ISummaryContext | undefined;\n\n\t/**\n\t * It a cache for holding mapping for loading groupIds with its snapshot from the service. Add expiry policy of 1 minute.\n\t * Starting with 1 min and based on recorded usage we can tweak it later on.\n\t */\n\tprivate readonly snapshotCacheForLoadingGroupIds = new PromiseCache<string, ISnapshot>({\n\t\texpiry: { policy: \"absolute\", durationMs: 60000 },\n\t});\n\n\t/**\n\t * The compatibility details of the Runtime layer that is exposed to the Loader layer\n\t * for validating Loader-Runtime compatibility.\n\t */\n\tpublic get ILayerCompatDetails(): ILayerCompatDetails {\n\t\treturn runtimeCompatDetailsForLoader;\n\t}\n\n\t/**\n\t * If true, will skip Outbox flushing before processing an incoming message (and on DeltaManager \"op\" event for loader back-compat),\n\t * and instead the Outbox will check for a split batch on every submit.\n\t * This is a kill-bit switch for this simplification of logic, in case it causes unexpected issues.\n\t */\n\tprivate readonly skipSafetyFlushDuringProcessStack: boolean;\n\n\tprivate readonly extensions = new Map<ContainerExtensionId, ExtensionEntry>();\n\n\t/***/\n\tprotected constructor(\n\t\tcontext: IContainerContext,\n\t\tprivate readonly registry: IFluidDataStoreRegistry,\n\n\t\tprivate readonly metadata: IContainerRuntimeMetadata | undefined,\n\n\t\tprivate readonly electedSummarizerData: ISerializedElection | undefined,\n\t\tchunks: [string, string[]][],\n\t\tdataStoreAliasMap: [string, string][],\n\t\tprivate readonly runtimeOptions: Readonly<ContainerRuntimeOptionsInternal>,\n\t\tprivate readonly containerScope: FluidObject,\n\t\t// Create a custom ITelemetryBaseLogger to output telemetry events.\n\t\tpublic readonly baseLogger: ITelemetryBaseLogger,\n\t\texisting: boolean,\n\n\t\tblobManagerLoadInfo: IBlobManagerLoadInfo,\n\t\tprivate readonly _storage: IContainerStorageService,\n\t\tprivate readonly createIdCompressorFn: () => IIdCompressor & IIdCompressorCore,\n\n\t\tprivate readonly documentsSchemaController: DocumentsSchemaController,\n\t\tfeatureGatesForTelemetry: Record<string, boolean | number | undefined>,\n\t\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>,\n\t\tpublic readonly minVersionForCollab: MinimumVersionForCollab,\n\t\tprivate readonly requestHandler?: (\n\t\t\trequest: IRequest,\n\t\t\truntime: IContainerRuntime,\n\t\t) => Promise<IResponse>,\n\t\t// // eslint-disable-next-line unicorn/no-object-as-default-parameter\n\t\tprivate readonly summaryConfiguration: ISummaryConfiguration = {\n\t\t\t// the defaults\n\t\t\t...DefaultSummaryConfiguration,\n\t\t\t// the runtime configuration overrides\n\t\t\t...runtimeOptions.summaryOptions?.summaryConfigOverrides,\n\t\t},\n\t\trecentBatchInfo?: [number, string][],\n\t) {\n\t\tsuper();\n\n\t\tconst {\n\t\t\toptions,\n\t\t\tclientDetails,\n\t\t\tconnected,\n\t\t\tbaseSnapshot,\n\t\t\tsubmitFn,\n\t\t\tsubmitBatchFn,\n\t\t\tsubmitSummaryFn,\n\t\t\tsubmitSignalFn,\n\t\t\tdisposeFn,\n\t\t\tcloseFn,\n\t\t\tdeltaManager,\n\t\t\tquorum,\n\t\t\taudience,\n\t\t\tsignalAudience,\n\t\t\tpendingLocalState,\n\t\t\tsupportedFeatures,\n\t\t\tsnapshotWithContents,\n\t\t\tgetConnectionState,\n\t\t} = context;\n\n\t\tthis.getConnectionState = getConnectionState;\n\n\t\t// In old loaders without dispose functionality, closeFn is equivalent but will also switch container to readonly mode\n\t\tthis.disposeFn = disposeFn ?? closeFn;\n\n\t\tthis.isSnapshotInstanceOfISnapshot = snapshotWithContents !== undefined;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.baseLogger,\n\t\t\tnamespace: \"ContainerRuntime\",\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tinStagingMode: this.inStagingMode,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\t// Validate that the Loader is compatible with this Runtime.\n\t\tconst maybeLoaderCompatDetailsForRuntime = context as FluidObject<ILayerCompatDetails>;\n\t\tvalidateLoaderCompatibility(\n\t\t\tmaybeLoaderCompatDetailsForRuntime.ILayerCompatDetails,\n\t\t\tthis.disposeFn,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// If we support multiple algorithms in the future, then we would need to manage it here carefully.\n\t\t// We can use runtimeOptions.compressionOptions.compressionAlgorithm, but only if it's in the schema list!\n\t\t// If it's not in the list, then we will need to either use no compression, or fallback to some other (supported by format)\n\t\t// compression.\n\t\tconst compressionOptions: ICompressionRuntimeOptions = {\n\t\t\tminimumBatchSizeInBytes: this.sessionSchema.compressionLz4\n\t\t\t\t? runtimeOptions.compressionOptions.minimumBatchSizeInBytes\n\t\t\t\t: Number.POSITIVE_INFINITY,\n\t\t\tcompressionAlgorithm: CompressionAlgorithms.lz4,\n\t\t};\n\n\t\tassert(isIDeltaManagerFull(deltaManager), 0xa80 /* Invalid delta manager */);\n\t\tthis.innerDeltaManager = deltaManager;\n\n\t\t// Here we could wrap/intercept on these functions to block/modify outgoing messages if needed.\n\t\t// This makes ContainerRuntime the final gatekeeper for outgoing messages.\n\t\t// back-compat: ADO #1385: Make this call unconditional in the future\n\t\tthis.submitSummaryFn =\n\t\t\tsubmitSummaryFn ??\n\t\t\t((summaryOp, refseq) => submitFn(MessageType.Summarize, summaryOp, false));\n\n\t\tconst sequenceAndSubmitSignal = (\n\t\t\tenvelope: UnsequencedSignalEnvelope,\n\t\t\ttargetClientId?: string,\n\t\t): void => {\n\t\t\tif (targetClientId === undefined) {\n\t\t\t\tthis.signalTelemetryManager.applyTrackingToBroadcastSignalEnvelope(envelope);\n\t\t\t}\n\t\t\tsubmitSignalFn(envelope, targetClientId);\n\t\t};\n\t\tthis.submitSignalFn = (envelope: UnsequencedSignalEnvelope, targetClientId?: string) => {\n\t\t\tif (envelope.address?.startsWith(\"/\") === true) {\n\t\t\t\tthrow new Error(\"General path based addressing is not implemented\");\n\t\t\t}\n\t\t\tsequenceAndSubmitSignal(envelope, targetClientId);\n\t\t};\n\t\tthis.submitExtensionSignal = <TMessage extends TypedMessage>(\n\t\t\tid: string,\n\t\t\taddressChain: string[],\n\t\t\tmessage: OutboundExtensionMessage<TMessage>,\n\t\t): void => {\n\t\t\tthis.verifyNotClosed();\n\t\t\tconst envelope = {\n\t\t\t\taddress: `/ext/${id}/${addressChain.join(\"/\")}`,\n\t\t\t\tcontents: message,\n\t\t\t} satisfies UnsequencedSignalEnvelope;\n\t\t\tsequenceAndSubmitSignal(envelope, message.targetClientId);\n\t\t};\n\n\t\t// TODO: After IContainerContext.options is removed, we'll just create a new blank object {} here.\n\t\t// Values are generally expected to be set from the runtime side.\n\t\tthis.options = options ?? {};\n\t\tthis.clientDetails = clientDetails;\n\t\tthis.isSummarizerClient = this.clientDetails.type === summarizerClientType;\n\t\tthis.loadedFromVersionId = context.getLoadedFromVersion()?.id;\n\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\tthis._getClientId = () => context.clientId;\n\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\tthis._getAttachState = () => context.attachState;\n\t\tthis.getAbsoluteUrl = async (relativeUrl: string) => {\n\t\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\t\tif (context.getAbsoluteUrl === undefined) {\n\t\t\t\tthrow new Error(\"Driver does not implement getAbsoluteUrl\");\n\t\t\t}\n\t\t\tif (this.attachState !== AttachState.Attached) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn context.getAbsoluteUrl(relativeUrl);\n\t\t};\n\t\t// TODO: Consider that the Container could just listen to these events itself, or even more appropriately maybe the\n\t\t// customer should observe dirty state on the runtime (the owner of dirty state) directly, rather than on the IContainer.\n\t\tthis.on(\"dirty\", () => context.updateDirtyContainerState(true));\n\t\tthis.on(\"saved\", () => context.updateDirtyContainerState(false));\n\n\t\t// Telemetry for when the container is attached and subsequently saved for the first time.\n\t\t// These events are useful for investigating the validity of container \"saved\" eventing upon attach.\n\t\t// See this.setAttachState() and this.updateDocumentDirtyState() for more details on \"attached\" and \"saved\" events.\n\t\tthis.once(\"attached\", () => {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"Attached\",\n\t\t\t\tdetails: {\n\t\t\t\t\tlastEmittedDirty: this.lastEmittedDirty,\n\t\t\t\t\tcurrentDirtyState: this.computeCurrentDirtyState(),\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t\tthis.once(\"saved\", () =>\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"Saved\",\n\t\t\t\tdetails: { attachState: this.attachState },\n\t\t\t}),\n\t\t);\n\n\t\t// In cases of summarizer, we want to dispose instead since consumer doesn't interact with this container\n\t\tthis.closeFn = this.isSummarizerClient ? this.disposeFn : closeFn;\n\n\t\tlet loadSummaryNumber: number;\n\t\t// Get the container creation metadata. For new container, we initialize these. For existing containers,\n\t\t// get the values from the metadata blob.\n\t\tif (existing) {\n\t\t\tthis.createContainerMetadata = {\n\t\t\t\tcreateContainerRuntimeVersion: metadata?.createContainerRuntimeVersion,\n\t\t\t\tcreateContainerTimestamp: metadata?.createContainerTimestamp,\n\t\t\t};\n\t\t\t// summaryNumber was renamed from summaryCount. For older docs that haven't been opened for a long time,\n\t\t\t// the count is reset to 0.\n\t\t\tloadSummaryNumber = metadata?.summaryNumber ?? 0;\n\t\t} else {\n\t\t\tthis.createContainerMetadata = {\n\t\t\t\tcreateContainerRuntimeVersion: pkgVersion,\n\t\t\t\tcreateContainerTimestamp: Date.now(),\n\t\t\t};\n\t\t\tloadSummaryNumber = 0;\n\t\t}\n\t\tthis.nextSummaryNumber = loadSummaryNumber + 1;\n\n\t\tthis.messageAtLastSummary = lastMessageFromMetadata(metadata);\n\n\t\t// Note that we only need to pull the *initial* connected state from the context.\n\t\t// Later updates come through calls to setConnectionState/Status.\n\t\tthis.canSendOps = connected;\n\t\tthis.canSendSignals = this.getConnectionState\n\t\t\t? this.getConnectionState() === ConnectionState.Connected ||\n\t\t\t\tthis.getConnectionState() === ConnectionState.CatchingUp\n\t\t\t: undefined;\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GCFeatureMatrix\",\n\t\t\tmetadataValue: JSON.stringify(metadata?.gcFeatureMatrix),\n\t\t\tinputs: JSON.stringify({\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tgcOptions_gcGeneration: runtimeOptions.gcOptions[gcGenerationOptionName],\n\t\t\t}),\n\t\t});\n\n\t\tthis.telemetryDocumentId = metadata?.telemetryDocumentId ?? uuid();\n\n\t\tconst opGroupingManager = new OpGroupingManager(\n\t\t\t{\n\t\t\t\tgroupedBatchingEnabled: this.groupedBatchingEnabled,\n\t\t\t},\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\tconst opSplitter = new OpSplitter(\n\t\t\tchunks,\n\t\t\tsubmitBatchFn,\n\t\t\truntimeOptions.chunkSizeInBytes,\n\t\t\truntimeOptions.maxBatchSizeInBytes,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\tthis.remoteMessageProcessor = new RemoteMessageProcessor(\n\t\t\topSplitter,\n\t\t\tnew OpDecompressor(this.mc.logger),\n\t\t\topGroupingManager,\n\t\t);\n\n\t\tconst pendingRuntimeState = pendingLocalState as IPendingRuntimeState | undefined;\n\t\tthis.pendingStateManager = new PendingStateManager(\n\t\t\t{\n\t\t\t\tapplyStashedOp: this.applyStashedOp.bind(this),\n\t\t\t\tclientId: () => this.clientId,\n\t\t\t\tconnected: () => this.connected,\n\t\t\t\treSubmitBatch: this.reSubmitBatch.bind(this),\n\t\t\t\tisActiveConnection: () => this.innerDeltaManager.active,\n\t\t\t\tisAttached: () => this.attachState !== AttachState.Detached,\n\t\t\t},\n\t\t\tpendingRuntimeState?.pending,\n\t\t\tthis.baseLogger,\n\t\t);\n\n\t\tlet outerDeltaManager: IDeltaManagerFull = this.innerDeltaManager;\n\t\tthis.useDeltaManagerOpsProxy =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.ContainerRuntime.DeltaManagerOpsProxy\") === true;\n\t\t// The summarizerDeltaManager Proxy is used to lie to the summarizer to convince it is in the right state as a summarizer client.\n\t\touterDeltaManager = DeltaManagerSummarizerProxy.wrapIfSummarizer(outerDeltaManager);\n\n\t\t// The DeltaManagerPendingOpsProxy is used to control the minimum sequence number\n\t\t// It allows us to lie to the layers below so that they can maintain enough local state for rebasing ops.\n\t\tif (this.useDeltaManagerOpsProxy) {\n\t\t\tconst pendingOpsDeltaManagerProxy = new DeltaManagerPendingOpsProxy(\n\t\t\t\touterDeltaManager,\n\t\t\t\tthis.pendingStateManager,\n\t\t\t);\n\t\t\touterDeltaManager = pendingOpsDeltaManagerProxy;\n\t\t}\n\n\t\t// always wrap the exposed delta manager in at least on layer of proxying\n\t\tthis._deltaManager =\n\t\t\touterDeltaManager instanceof BaseDeltaManagerProxy\n\t\t\t\t? outerDeltaManager\n\t\t\t\t: new BaseDeltaManagerProxy(outerDeltaManager);\n\n\t\tthis.handleContext = new ContainerFluidHandleContext(\"\", this);\n\n\t\tif (this.summaryConfiguration.state === \"enabled\") {\n\t\t\tvalidateSummaryHeuristicConfiguration(this.summaryConfiguration);\n\t\t}\n\n\t\tthis.summariesDisabled = isSummariesDisabled(this.summaryConfiguration);\n\n\t\tthis.maxConsecutiveReconnects =\n\t\t\tthis.mc.config.getNumber(maxConsecutiveReconnectsKey) ?? defaultMaxConsecutiveReconnects;\n\n\t\t// If the context has ILayerCompatDetails, it supports referenceSequenceNumbers since that features\n\t\t// predates ILayerCompatDetails.\n\t\tconst referenceSequenceNumbersSupported =\n\t\t\tmaybeLoaderCompatDetailsForRuntime.ILayerCompatDetails === undefined\n\t\t\t\t? supportedFeatures?.get(\"referenceSequenceNumbers\") === true\n\t\t\t\t: true;\n\t\tif (\n\t\t\truntimeOptions.flushMode === (FlushModeExperimental.Async as unknown as FlushMode) &&\n\t\t\t!referenceSequenceNumbersSupported\n\t\t) {\n\t\t\t// The loader does not support reference sequence numbers, falling back on FlushMode.TurnBased\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"FlushModeFallback\" });\n\t\t\tthis._flushMode = FlushMode.TurnBased;\n\t\t} else {\n\t\t\tthis._flushMode = runtimeOptions.flushMode;\n\t\t}\n\t\tthis.batchIdTrackingEnabled =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.enableOfflineFull\") ??\n\t\t\tthis.mc.config.getBoolean(\"Fluid.ContainerRuntime.enableBatchIdTracking\") ??\n\t\t\tfalse;\n\n\t\tif (this.batchIdTrackingEnabled && this._flushMode !== FlushMode.TurnBased) {\n\t\t\tconst error = new UsageError(\"Offline mode is only supported in turn-based mode\");\n\t\t\tthis.closeFn(error);\n\t\t\tthrow error;\n\t\t}\n\n\t\t// DuplicateBatchDetection is only enabled if Offline Load is enabled\n\t\t// It maintains a cache of all batchIds/sequenceNumbers within the collab window.\n\t\t// Don't waste resources doing so if not needed.\n\t\tif (this.batchIdTrackingEnabled) {\n\t\t\tthis.duplicateBatchDetector = new DuplicateBatchDetector(recentBatchInfo);\n\t\t}\n\n\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\tif (context.attachState === AttachState.Attached) {\n\t\t\tconst maxSnapshotCacheDurationMs = this._storage?.policies?.maximumCacheDurationMs;\n\t\t\tif (\n\t\t\t\tmaxSnapshotCacheDurationMs !== undefined &&\n\t\t\t\tmaxSnapshotCacheDurationMs > 5 * 24 * 60 * 60 * 1000\n\t\t\t) {\n\t\t\t\t// This is a runtime enforcement of what's already explicit in the policy's type itself,\n\t\t\t\t// which dictates the value is either undefined or exactly 5 days in ms.\n\t\t\t\t// As long as the actual value is less than 5 days, the assumptions GC makes here are valid.\n\t\t\t\tthrow new UsageError(\"Driver's maximumCacheDurationMs policy cannot exceed 5 days\");\n\t\t\t}\n\t\t}\n\n\t\tthis.garbageCollector = GarbageCollector.create({\n\t\t\truntime: this,\n\t\t\tgcOptions: runtimeOptions.gcOptions,\n\t\t\tbaseSnapshot,\n\t\t\tbaseLogger: this.mc.logger,\n\t\t\texisting,\n\t\t\tmetadata,\n\t\t\tcreateContainerMetadata: this.createContainerMetadata,\n\t\t\tisSummarizerClient: this.isSummarizerClient,\n\t\t\tgetNodePackagePath: async (nodePath: string) => this.getGCNodePackagePath(nodePath),\n\t\t\tgetLastSummaryTimestampMs: () => this.messageAtLastSummary?.timestamp,\n\t\t\treadAndParseBlob: async <T>(id: string) => readAndParse<T>(this.storage, id),\n\t\t\tsubmitMessage: (message: ContainerRuntimeGCMessage) => this.submit(message),\n\t\t\tsessionExpiryTimerStarted: pendingRuntimeState?.sessionExpiryTimerStarted,\n\t\t});\n\n\t\tconst loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;\n\t\t// If the base snapshot was generated when isolated channels were disabled, set the summary reference\n\t\t// sequence to undefined so that this snapshot will not be used for incremental summaries. This is for\n\t\t// back-compat and will rarely happen so its okay to re-summarize everything in the first summary.\n\t\tconst summaryReferenceSequenceNumber =\n\t\t\tbaseSnapshot === undefined || metadata?.disableIsolatedChannels === true\n\t\t\t\t? undefined\n\t\t\t\t: loadedFromSequenceNumber;\n\t\tthis.summarizerNode = createRootSummarizerNodeWithGC(\n\t\t\tcreateChildLogger({ logger: this.baseLogger, namespace: \"SummarizerNode\" }),\n\t\t\t// Summarize function to call when summarize is called. Summarizer node always tracks summary state.\n\t\t\tasync (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext) =>\n\t\t\t\tthis.summarizeInternal(fullTree, trackState, telemetryContext),\n\t\t\t// Latest change sequence number, no changes since summary applied yet\n\t\t\tloadedFromSequenceNumber,\n\t\t\tsummaryReferenceSequenceNumber,\n\t\t\t{\n\t\t\t\t// Must set to false to prevent sending summary handle which would be pointing to\n\t\t\t\t// a summary with an older protocol state.\n\t\t\t\tcanReuseHandle: false,\n\t\t\t\t// If GC should not run, let the summarizer node know so that it does not track GC state.\n\t\t\t\tgcDisabled: !this.garbageCollector.shouldRunGC,\n\t\t\t},\n\t\t\t// Function to get GC data if needed. This will always be called by the root summarizer node to get GC data.\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t\t// Function to get the GC details from the base snapshot we loaded from.\n\t\t\tasync () => this.garbageCollector.getBaseGCDetails(),\n\t\t);\n\n\t\tconst parentContext = formParentContext<IFluidRootParentContextPrivate>(this, {\n\t\t\tsubmitMessage: this.submitMessage.bind(this),\n\n\t\t\t// Due to a mismatch between different layers in terms of\n\t\t\t// what is the interface of passing signals, we need the\n\t\t\t// downstream stores to wrap the signal.\n\t\t\tsubmitSignal: (\n\t\t\t\tenvelope: AddressedUnsequencedSignalEnvelope,\n\t\t\t\ttargetClientId?: string,\n\t\t\t): void => {\n\t\t\t\t// verifyNotClosed is called in FluidDataStoreContext, which is *the* expected caller.\n\t\t\t\tthis.submitSignalFn(envelope, targetClientId);\n\t\t\t},\n\t\t});\n\n\t\tlet snapshot: ISnapshot | ISnapshotTree | undefined = getSummaryForDatastores(\n\t\t\tbaseSnapshot,\n\t\t\tmetadata,\n\t\t);\n\t\tif (snapshot !== undefined && snapshotWithContents !== undefined) {\n\t\t\tsnapshot = {\n\t\t\t\t...snapshotWithContents,\n\t\t\t\tsnapshotTree: snapshot,\n\t\t\t};\n\t\t}\n\n\t\tthis.channelCollection = new ChannelCollection(\n\t\t\tsnapshot,\n\t\t\tparentContext,\n\t\t\tthis.mc.logger,\n\t\t\t(props) =>\n\t\t\t\tthis.garbageCollector.nodeUpdated({\n\t\t\t\t\t...props,\n\t\t\t\t\ttimestampMs: props.timestampMs ?? this.getCurrentReferenceTimestampMs(),\n\t\t\t\t}),\n\t\t\t(path: string) => this.garbageCollector.isNodeDeleted(path),\n\t\t\tnew Map<string, string>(dataStoreAliasMap),\n\t\t);\n\t\tthis._deltaManager.on(\"readonly\", this.notifyReadOnlyState);\n\n\t\tthis.blobManager = new BlobManager({\n\t\t\trouteContext: this.handleContext,\n\t\t\tblobManagerLoadInfo,\n\t\t\tstorage: this.storage,\n\t\t\tsendBlobAttachMessage: (localId: string, blobId: string) => {\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.submit(\n\t\t\t\t\t\t{ type: ContainerMessageType.BlobAttach, contents: undefined },\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlocalId,\n\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tblobRequested: (blobPath: string) =>\n\t\t\t\tthis.garbageCollector.nodeUpdated({\n\t\t\t\t\tnode: { type: \"Blob\", path: blobPath },\n\t\t\t\t\treason: \"Loaded\",\n\t\t\t\t\ttimestampMs: this.getCurrentReferenceTimestampMs(),\n\t\t\t\t}),\n\t\t\tisBlobDeleted: (blobPath: string) => this.garbageCollector.isNodeDeleted(blobPath),\n\t\t\truntime: this,\n\t\t\tpendingBlobs: pendingRuntimeState?.pendingAttachmentBlobs,\n\t\t\tcreateBlobPayloadPending: this.sessionSchema.createBlobPayloadPending === true,\n\t\t});\n\n\t\tthis.deltaScheduler = new DeltaScheduler(\n\t\t\tthis.innerDeltaManager,\n\t\t\tthis,\n\t\t\tcreateChildLogger({ logger: this.baseLogger, namespace: \"DeltaScheduler\" }),\n\t\t);\n\n\t\tthis.inboundBatchAggregator = new InboundBatchAggregator(\n\t\t\tthis.innerDeltaManager,\n\t\t\t() => this.clientId,\n\t\t\tcreateChildLogger({ logger: this.baseLogger, namespace: \"InboundBatchAggregator\" }),\n\t\t);\n\n\t\tconst legacySendBatchFn = makeLegacySendBatchFn(submitFn, this.innerDeltaManager);\n\n\t\tthis.skipSafetyFlushDuringProcessStack =\n\t\t\t// Keep the old flag name even though we renamed the class member (it shipped in 2.31.0)\n\t\t\tthis.mc.config.getBoolean(\"Fluid.ContainerRuntime.DisableFlushBeforeProcess\") === true;\n\n\t\tthis.outbox = new Outbox({\n\t\t\tshouldSend: () => this.shouldSendOps(),\n\t\t\tpendingStateManager: this.pendingStateManager,\n\t\t\tsubmitBatchFn,\n\t\t\tlegacySendBatchFn,\n\t\t\tcompressor: new OpCompressor(this.mc.logger),\n\t\t\tsplitter: opSplitter,\n\t\t\tconfig: {\n\t\t\t\tcompressionOptions,\n\t\t\t\tmaxBatchSizeInBytes: runtimeOptions.maxBatchSizeInBytes,\n\t\t\t\t// If we disable flush before process, we must be ready to flush partial batches\n\t\t\t\tflushPartialBatches: this.skipSafetyFlushDuringProcessStack,\n\t\t\t},\n\t\t\tlogger: this.mc.logger,\n\t\t\tgroupingManager: opGroupingManager,\n\t\t\tgetCurrentSequenceNumbers: () => ({\n\t\t\t\t// Note: These sequence numbers only change when DeltaManager processes an incoming op\n\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\tclientSequenceNumber: this._processedClientSequenceNumber,\n\t\t\t}),\n\t\t\treSubmit: this.reSubmit.bind(this),\n\t\t\topReentrancy: () => this.dataModelChangeRunner.running,\n\t\t});\n\n\t\tthis._quorum = quorum;\n\t\tthis._quorum.on(\"removeMember\", (clientId: string) => {\n\t\t\tthis.remoteMessageProcessor.clearPartialMessagesFor(clientId);\n\t\t});\n\n\t\tthis._audience = audience;\n\t\tif (audience.getSelf === undefined) {\n\t\t\t// back-compat, added in 2.0 RC3.\n\t\t\t// Purpose: deal with cases when we run against old loader that does not have newly added capabilities\n\t\t\taudience.getSelf = () => {\n\t\t\t\tconst clientId = this._getClientId();\n\t\t\t\treturn clientId === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: ({\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tclient: audience.getMember(clientId),\n\t\t\t\t\t\t} satisfies ISelf);\n\t\t\t};\n\n\t\t\tlet oldClientId = this.clientId;\n\t\t\tthis.on(\"connected\", () => {\n\t\t\t\tconst clientId = this.clientId;\n\t\t\t\tassert(clientId !== undefined, 0x975 /* can't be undefined */);\n\t\t\t\t(audience as unknown as TypedEventEmitter<IAudienceEvents>).emit(\n\t\t\t\t\t\"selfChanged\",\n\t\t\t\t\t{ clientId: oldClientId },\n\t\t\t\t\t{ clientId, client: audience.getMember(clientId) },\n\t\t\t\t);\n\t\t\t\toldClientId = clientId;\n\t\t\t});\n\t\t}\n\n\t\tthis.signalAudience = signalAudience;\n\n\t\tconst closeSummarizerDelayOverride = this.mc.config.getNumber(\n\t\t\t\"Fluid.ContainerRuntime.Test.CloseSummarizerDelayOverrideMs\",\n\t\t);\n\t\tthis.closeSummarizerDelayMs =\n\t\t\tcloseSummarizerDelayOverride ?? defaultCloseSummarizerDelayMs;\n\n\t\t// We haven't emitted dirty/saved yet, but this is the baseline so we know to emit when it changes\n\t\tthis.lastEmittedDirty = this.computeCurrentDirtyState();\n\t\tcontext.updateDirtyContainerState(this.lastEmittedDirty);\n\n\t\tif (!this.skipSafetyFlushDuringProcessStack) {\n\t\t\t// Reference Sequence Number may have just changed, and it must be consistent across a batch,\n\t\t\t// so we should flush now to clear the way for the next ops.\n\t\t\t// NOTE: This will be redundant whenever CR.process was called for the op (since we flush there too) -\n\t\t\t// But we need this coverage for old loaders that don't call ContainerRuntime.process for non-runtime messages.\n\t\t\t// (We have to call flush _before_ processing a runtime op, but after is ok for non-runtime op)\n\t\t\tthis.deltaManager.on(\"op\", () => this.flush());\n\t\t}\n\n\t\t// logging hardware telemetry\n\t\tthis.baseLogger.send({\n\t\t\tcategory: \"generic\",\n\t\t\teventName: \"DeviceSpec\",\n\t\t\t...getDeviceSpec(),\n\t\t});\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"ContainerLoadStats\",\n\t\t\t...this.createContainerMetadata,\n\t\t\t...this.channelCollection.containerLoadStats,\n\t\t\tsummaryNumber: loadSummaryNumber,\n\t\t\tsummaryFormatVersion: metadata?.summaryFormatVersion,\n\t\t\tdisableIsolatedChannels: metadata?.disableIsolatedChannels,\n\t\t\tgcVersion: metadata?.gcFeature,\n\t\t\toptions: JSON.stringify(runtimeOptions),\n\t\t\tidCompressorModeMetadata: metadata?.documentSchema?.runtime?.idCompressorMode,\n\t\t\tidCompressorMode: this.sessionSchema.idCompressorMode,\n\t\t\tsessionRuntimeSchema: JSON.stringify(this.sessionSchema),\n\t\t\tfeatureGates: JSON.stringify({\n\t\t\t\t...featureGatesForTelemetry,\n\t\t\t\tcloseSummarizerDelayOverride,\n\t\t\t\tdisableFlushBeforeProcess: this.skipSafetyFlushDuringProcessStack,\n\t\t\t}),\n\t\t\ttelemetryDocumentId: this.telemetryDocumentId,\n\t\t\tgroupedBatchingEnabled: this.groupedBatchingEnabled,\n\t\t\tinitialSequenceNumber: this.deltaManager.initialSequenceNumber,\n\t\t\tminVersionForCollab: this.minVersionForCollab,\n\t\t});\n\n\t\tReportOpPerfTelemetry(this.clientId, this._deltaManager, this, this.baseLogger);\n\t\tBindBatchTracker(this, this.baseLogger);\n\n\t\tthis.entryPoint = new LazyPromise(async () => {\n\t\t\tif (this._summarizer !== undefined) {\n\t\t\t\treturn this._summarizer;\n\t\t\t}\n\t\t\treturn provideEntryPoint(this);\n\t\t});\n\n\t\t// If we loaded from pending state, then we need to skip any ops that are already accounted in such\n\t\t// saved state, i.e. all the ops marked by Loader layer sa savedOp === true.\n\t\tthis.skipSavedCompressorOps = pendingRuntimeState?.pendingIdCompressorState !== undefined;\n\t}\n\n\tpublic onSchemaChange(schema: IDocumentSchemaCurrent): void {\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"SchemaChangeAccept\",\n\t\t\tsessionRuntimeSchema: JSON.stringify(schema),\n\t\t});\n\n\t\t// Most of the settings will be picked up only by new sessions (i.e. after reload).\n\t\t// We can make it better in the future (i.e. start to use op compression right away), but for simplicity\n\t\t// this is not done.\n\t\t// But ID compressor is special. It's possible, that in future, we will remove \"stickiness\" of ID compressor setting\n\t\t// and will allow to start using it. If that were to happen, we want to ensure that we do not break eventual consistency\n\t\t// promises. To do so, we need to initialize id compressor right away.\n\t\t// As it's implemented right now (with async initialization), this will only work for \"off\" -> \"delayed\" transitions.\n\t\t// Anything else is too risky, and requires ability to initialize ID compressor synchronously!\n\t\tif (schema.runtime.idCompressorMode !== undefined) {\n\t\t\tthis.loadIdCompressor();\n\t\t}\n\t}\n\n\tpublic getCreateChildSummarizerNodeFn(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t) {\n\t\treturn (\n\t\t\tsummarizeInternal: SummarizeInternalFn,\n\t\t\tgetGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\t): ISummarizerNodeWithGC =>\n\t\t\tthis.summarizerNode.createChild(\n\t\t\t\tsummarizeInternal,\n\t\t\t\tid,\n\t\t\t\tcreateParam,\n\t\t\t\tundefined,\n\t\t\t\tgetGCDataFn,\n\t\t\t);\n\t}\n\n\tpublic deleteChildSummarizerNode(id: string): void {\n\t\treturn this.summarizerNode.deleteChild(id);\n\t}\n\n\t// #region `IFluidParentContext` APIs that should not be called on Root\n\n\tpublic makeLocallyVisible(): void {\n\t\tassert(false, 0x8eb /* should not be called */);\n\t}\n\n\tpublic setChannelDirty(address: string): void {\n\t\tassert(false, 0x909 /* should not be called */);\n\t}\n\n\t// #endregion\n\n\t/**\n\t * Initializes the state from the base snapshot this container runtime loaded from.\n\t */\n\tprivate async initializeBaseState(loader: ILoader): Promise<void> {\n\t\tif (\n\t\t\tthis.sessionSchema.idCompressorMode === \"on\" ||\n\t\t\t(this.sessionSchema.idCompressorMode === \"delayed\" && this.connected)\n\t\t) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"CreateIdCompressorOnBoot\" },\n\t\t\t\t(event) => {\n\t\t\t\t\tthis._idCompressor = this.createIdCompressorFn();\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tidCompressorMode: this.sessionSchema.idCompressorMode,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\t// This is called from loadRuntime(), long before we process any ops, so there should be no ops accumulated yet.\n\t\t\tassert(this.pendingIdCompressorOps.length === 0, 0x8ec /* no pending ops */);\n\t\t}\n\n\t\tawait this.initializeSummarizer(loader);\n\t\tawait this.garbageCollector.initializeBaseState();\n\t}\n\n\tprivate async initializeSummarizer(loader: ILoader): Promise<void> {\n\t\tif (this.summariesDisabled) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"SummariesDisabled\" });\n\t\t\treturn;\n\t\t}\n\n\t\tconst { maxOpsSinceLastSummary = 0, initialSummarizerDelayMs = 0 } = isSummariesDisabled(\n\t\t\tthis.summaryConfiguration,\n\t\t)\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\t...this.summaryConfiguration,\n\t\t\t\t\tinitialSummarizerDelayMs:\n\t\t\t\t\t\t// back-compat: initialSummarizerDelayMs was moved from ISummaryRuntimeOptions\n\t\t\t\t\t\t// to ISummaryConfiguration in 0.60.\n\t\t\t\t\t\tthis.runtimeOptions.summaryOptions.initialSummarizerDelayMs ??\n\t\t\t\t\t\tthis.summaryConfiguration.initialSummarizerDelayMs,\n\t\t\t\t};\n\n\t\tconst summaryCollection: SummaryCollection = new SummaryCollection(\n\t\t\tthis.deltaManager,\n\t\t\tthis.baseLogger,\n\t\t);\n\t\tconst onRequestMode = isSummaryOnRequest(this.summaryConfiguration);\n\n\t\tif (this.isSummarizerClient) {\n\t\t\t// We want to dynamically import any thing inside summaryDelayLoadedModule module only when we are the summarizer client,\n\t\t\t// so that all non summarizer clients don't have to load the code inside this module.\n\t\t\tconst module = await import(\n\t\t\t\t/* webpackChunkName: \"summarizerDelayLoadedModule\" */ \"./summary/index.js\"\n\t\t\t);\n\t\t\tthis._summarizer = new module.Summarizer(\n\t\t\t\tthis /* ISummarizerRuntime */,\n\t\t\t\t() => this.summaryConfiguration,\n\t\t\t\tthis /* ISummarizerInternalsProvider */,\n\t\t\t\tthis.handleContext,\n\t\t\t\tsummaryCollection,\n\n\t\t\t\tasync (runtime: IConnectableRuntime) =>\n\t\t\t\t\tmodule.RunWhileConnectedCoordinator.create(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\t// Summarization runs in summarizer client and needs access to the real (non-proxy) active\n\t\t\t\t\t\t// information. The proxy delta manager would always return false for summarizer client.\n\t\t\t\t\t\t() => this.innerDeltaManager.active,\n\t\t\t\t\t),\n\t\t\t);\n\t\t} else if (\n\t\t\t!onRequestMode &&\n\t\t\tSummarizerClientElection.clientDetailsPermitElection(this.clientDetails)\n\t\t) {\n\t\t\t// Only create a SummaryManager and SummarizerClientElection\n\t\t\t// if summaries are enabled and we are not the summarizer client.\n\t\t\tconst orderedClientLogger = createChildLogger({\n\t\t\t\tlogger: this.baseLogger,\n\t\t\t\tnamespace: \"OrderedClientElection\",\n\t\t\t});\n\t\t\tconst orderedClientCollection = new OrderedClientCollection(\n\t\t\t\torderedClientLogger,\n\t\t\t\tthis.innerDeltaManager,\n\t\t\t\tthis._quorum,\n\t\t\t);\n\t\t\tconst orderedClientElectionForSummarizer = new OrderedClientElection(\n\t\t\t\torderedClientLogger,\n\t\t\t\torderedClientCollection,\n\t\t\t\tthis.electedSummarizerData ?? this.innerDeltaManager.lastSequenceNumber,\n\t\t\t\tSummarizerClientElection.isClientEligible,\n\t\t\t\tthis.mc.config.getBoolean(\n\t\t\t\t\t\"Fluid.ContainerRuntime.OrderedClientElection.EnablePerformanceEvents\",\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tthis.summarizerClientElection = new SummarizerClientElection(\n\t\t\t\torderedClientLogger,\n\t\t\t\tsummaryCollection,\n\t\t\t\torderedClientElectionForSummarizer,\n\t\t\t\tmaxOpsSinceLastSummary,\n\t\t\t);\n\n\t\t\tconst defaultAction = (): void => {\n\t\t\t\tif (summaryCollection.opsSinceLastAck > maxOpsSinceLastSummary) {\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"SummaryStatus:Behind\" });\n\t\t\t\t\t// unregister default to no log on every op after falling behind\n\t\t\t\t\t// and register summary ack handler to re-register this handler\n\t\t\t\t\t// after successful summary\n\t\t\t\t\tsummaryCollection.once(MessageType.SummaryAck, () => {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"SummaryStatus:CaughtUp\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// we've caught up, so re-register the default action to monitor for\n\t\t\t\t\t\t// falling behind, and unregister ourself\n\t\t\t\t\t\tsummaryCollection.on(\"default\", defaultAction);\n\t\t\t\t\t});\n\t\t\t\t\tsummaryCollection.off(\"default\", defaultAction);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tsummaryCollection.on(\"default\", defaultAction);\n\n\t\t\t// Create the SummaryManager and mark the initial state\n\t\t\tthis.summaryManager = new SummaryManager(\n\t\t\t\tthis.summarizerClientElection,\n\t\t\t\tthis, // IConnectedState\n\t\t\t\tsummaryCollection,\n\t\t\t\tthis.baseLogger,\n\t\t\t\tformCreateSummarizerFn(loader),\n\t\t\t\tnew Throttler(\n\t\t\t\t\t60 * 1000, // 60 sec delay window\n\t\t\t\t\t30 * 1000, // 30 sec max delay\n\t\t\t\t\t// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)\n\t\t\t\t\tformExponentialFn({ coefficient: 20, initialDelay: 0 }),\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tinitialDelayMs: initialSummarizerDelayMs,\n\t\t\t\t},\n\t\t\t);\n\t\t\t// Forward events from SummaryManager\n\t\t\tfor (const eventName of [\n\t\t\t\t\"summarize\",\n\t\t\t\t\"summarizeAllAttemptsFailed\",\n\t\t\t\t\"summarizerStop\",\n\t\t\t\t\"summarizerStart\",\n\t\t\t\t\"summarizerStartupFailed\",\n\t\t\t]) {\n\t\t\t\tthis.summaryManager?.on(eventName, (...args: unknown[]) => {\n\t\t\t\t\tthis.emit(eventName, ...args);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.summaryManager.start();\n\t\t}\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t{\n\t\t\t\teventName: \"ContainerRuntimeDisposed\",\n\t\t\t\tisDirty: this.isDirty,\n\t\t\t\tlastSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\tattachState: this.attachState,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\n\t\tif (this.summaryManager !== undefined) {\n\t\t\tthis.summaryManager.dispose();\n\t\t}\n\t\tthis.garbageCollector.dispose();\n\t\tthis._summarizer?.dispose();\n\t\tthis.channelCollection.dispose();\n\t\tthis.pendingStateManager.dispose();\n\t\tthis.inboundBatchAggregator.dispose();\n\t\tthis.deltaScheduler.dispose();\n\t\tthis._deltaManager.dispose();\n\t\tthis.emit(\"dispose\");\n\t\tthis.removeAllListeners();\n\t}\n\n\t/**\n\t * Api to fetch the snapshot from the service for a loadingGroupIds.\n\t * @param loadingGroupIds - LoadingGroupId for which the snapshot is asked for.\n\t * @param pathParts - Parts of the path, which we want to extract from the snapshot tree.\n\t * @returns snapshotTree and the sequence number of the snapshot.\n\t */\n\tpublic async getSnapshotForLoadingGroupId(\n\t\tloadingGroupIds: string[],\n\t\tpathParts: string[],\n\t): Promise<{ snapshotTree: ISnapshotTree; sequenceNumber: number }> {\n\t\tconst sortedLoadingGroupIds = loadingGroupIds.sort();\n\t\tassert(\n\t\t\tthis.storage.getSnapshot !== undefined,\n\t\t\t0x8ed /* getSnapshot api should be defined if used */,\n\t\t);\n\t\tlet loadedFromCache = true;\n\t\t// Lookup up in the cache, if not present then make the network call as multiple datastores could\n\t\t// be in same loading group. So, once we have fetched the snapshot for that loading group on\n\t\t// any request, then cache that as same group could be requested in future too.\n\t\tconst snapshot = await this.snapshotCacheForLoadingGroupIds.addOrGet(\n\t\t\tsortedLoadingGroupIds.join(\",\"),\n\t\t\tasync () => {\n\t\t\t\tassert(\n\t\t\t\t\tthis.storage.getSnapshot !== undefined,\n\t\t\t\t\t0x8ee /* getSnapshot api should be defined if used */,\n\t\t\t\t);\n\t\t\t\tloadedFromCache = false;\n\t\t\t\treturn this.storage.getSnapshot({\n\t\t\t\t\tcacheSnapshot: false,\n\t\t\t\t\tscenarioName: \"snapshotForLoadingGroupId\",\n\t\t\t\t\tloadingGroupIds: sortedLoadingGroupIds,\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GroupIdSnapshotFetched\",\n\t\t\tdetails: JSON.stringify({\n\t\t\t\tfromCache: loadedFromCache,\n\t\t\t\tloadingGroupIds: loadingGroupIds.join(\",\"),\n\t\t\t}),\n\t\t});\n\t\t// Find the snapshotTree inside the returned snapshot based on the path as given in the request.\n\t\tconst hasIsolatedChannels = rootHasIsolatedChannels(this.metadata);\n\t\tconst snapshotTreeForPath = this.getSnapshotTreeForPath(\n\t\t\tsnapshot.snapshotTree,\n\t\t\tpathParts,\n\t\t\thasIsolatedChannels,\n\t\t);\n\t\tassert(snapshotTreeForPath !== undefined, 0x8ef /* no snapshotTree for the path */);\n\t\tconst snapshotSeqNumber = snapshot.sequenceNumber;\n\t\tassert(snapshotSeqNumber !== undefined, 0x8f0 /* snapshotSeqNumber should be present */);\n\n\t\t// This assert fires if we get a snapshot older than the snapshot we loaded from. This is a service issue.\n\t\t// Snapshots should only move forward. If we observe an older snapshot than the one we loaded from, then likely\n\t\t// the file has been overwritten or service lost data.\n\t\tif (snapshotSeqNumber < this.deltaManager.initialSequenceNumber) {\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\"Downloaded snapshot older than snapshot we loaded from\",\n\t\t\t\t\"getSnapshotForLoadingGroupId\",\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tloadingGroupIds: sortedLoadingGroupIds.join(\",\"),\n\t\t\t\t\tsnapshotSeqNumber,\n\t\t\t\t\tinitialSequenceNumber: this.deltaManager.initialSequenceNumber,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// If the snapshot is ahead of the last seq number of the delta manager, then catch up before\n\t\t// returning the snapshot.\n\t\tif (snapshotSeqNumber > this.deltaManager.lastSequenceNumber) {\n\t\t\t// If this is a summarizer client, which is trying to load a group and it finds that there is\n\t\t\t// another snapshot from which the summarizer loaded and it is behind, then just give up as\n\t\t\t// the summarizer state is not up to date.\n\t\t\t// This should be a recoverable scenario and shouldn't happen as we should process the ack first.\n\t\t\tif (this._summarizer !== undefined) {\n\t\t\t\tthrow new Error(\"Summarizer client behind, loaded newer snapshot with loadingGroupId\");\n\t\t\t}\n\n\t\t\t// We want to catchup from sequenceNumber to targetSequenceNumber\n\t\t\tconst props: ITelemetryGenericEventExt = {\n\t\t\t\teventName: \"GroupIdSnapshotCatchup\",\n\t\t\t\tloadingGroupIds: sortedLoadingGroupIds.join(\",\"),\n\t\t\t\ttargetSequenceNumber: snapshotSeqNumber, // This is so we reuse some columns in telemetry\n\t\t\t\tsequenceNumber: this.deltaManager.lastSequenceNumber, // This is so we reuse some columns in telemetry\n\t\t\t};\n\n\t\t\tconst event = PerformanceEvent.start(this.mc.logger, {\n\t\t\t\t...props,\n\t\t\t});\n\t\t\t// If the inbound deltas queue is paused or disconnected, we expect a reconnect and unpause\n\t\t\t// as long as it's not a summarizer client.\n\t\t\tif (this._deltaManager.inbound.paused) {\n\t\t\t\tprops.inboundPaused = this._deltaManager.inbound.paused; // reusing telemetry\n\t\t\t}\n\t\t\tconst defP = new Deferred<boolean>();\n\t\t\tthis.deltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\t\tif (message.sequenceNumber >= snapshotSeqNumber) {\n\t\t\t\t\tdefP.resolve(true);\n\t\t\t\t}\n\t\t\t});\n\t\t\tawait defP.promise;\n\t\t\tevent.end(props);\n\t\t}\n\t\treturn { snapshotTree: snapshotTreeForPath, sequenceNumber: snapshotSeqNumber };\n\t}\n\n\t/**\n\t * Api to find a snapshot tree inside a bigger snapshot tree based on the path in the pathParts array.\n\t * @param snapshotTree - snapshot tree to look into.\n\t * @param pathParts - Part of the path, which we want to extract from the snapshot tree.\n\t * @param hasIsolatedChannels - whether the channels are present inside \".channels\" subtree. Older\n\t * snapshots will not have trees inside \".channels\", so check that.\n\t * @returns requested snapshot tree based on the path parts.\n\t */\n\tprivate getSnapshotTreeForPath(\n\t\tsnapshotTree: ISnapshotTree,\n\t\tpathParts: string[],\n\t\thasIsolatedChannels: boolean,\n\t): ISnapshotTree | undefined {\n\t\tlet childTree = snapshotTree;\n\t\tfor (const part of pathParts) {\n\t\t\tif (hasIsolatedChannels) {\n\t\t\t\tchildTree = childTree?.trees[channelsTreeName];\n\t\t\t}\n\t\t\tchildTree = childTree?.trees[part];\n\t\t}\n\t\treturn childTree;\n\t}\n\n\t/**\n\t * Notifies this object about the request made to the container.\n\t * @param request - Request made to the handler.\n\t * @deprecated Will be removed in future major release. This method needs to stay private until LTS version of Loader moves to \"2.0.0-internal.7.0.0\".\n\t */\n\t// @ts-expect-error expected to be used by LTS Loaders and Containers\n\tprivate async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tconst id = parser.pathParts[0];\n\n\t\t\tif (id === summarizerRequestUrl && parser.pathParts.length === 1) {\n\t\t\t\tif (this._summarizer !== undefined) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 200,\n\t\t\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\t\t\tvalue: this._summarizer,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn create404Response(request);\n\t\t\t}\n\t\t\tif (this.requestHandler !== undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures\n\t\t\t\treturn this.requestHandler(parser, this);\n\t\t\t}\n\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\t/**\n\t * Resolves URI representing handle\n\t * @param request - Request made to the handler.\n\t */\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst requestParser = RequestParser.create(request);\n\t\t\tconst id = requestParser.pathParts[0];\n\n\t\t\tif (id === \"_channels\") {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures\n\t\t\t\treturn this.resolveHandle(requestParser.createSubRequest(1));\n\t\t\t}\n\n\t\t\tif (id === blobManagerBasePath && requestParser.isLeaf(2)) {\n\t\t\t\tconst localId = requestParser.pathParts[1];\n\t\t\t\tconst payloadPending = requestParser.headers?.[RuntimeHeaders.payloadPending] === true;\n\t\t\t\tif (\n\t\t\t\t\t!this.blobManager.hasBlob(localId) &&\n\t\t\t\t\trequestParser.headers?.[RuntimeHeaders.wait] === false\n\t\t\t\t) {\n\t\t\t\t\treturn create404Response(request);\n\t\t\t\t}\n\n\t\t\t\tconst blob = await this.blobManager.getBlob(localId, payloadPending);\n\t\t\t\treturn {\n\t\t\t\t\tstatus: 200,\n\t\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\t\tvalue: blob,\n\t\t\t\t};\n\t\t\t} else if (requestParser.pathParts.length > 0) {\n\t\t\t\treturn await this.channelCollection.request(request);\n\t\t\t}\n\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/container-definitions#IRuntime.getEntryPoint}\n\t */\n\tpublic async getEntryPoint(): Promise<FluidObject> {\n\t\treturn this.entryPoint;\n\t}\n\tprivate readonly entryPoint: LazyPromise<FluidObject>;\n\n\tprivate internalId(maybeAlias: string): string {\n\t\treturn this.channelCollection.internalId(maybeAlias);\n\t}\n\n\t/**\n\t * Adds the container's metadata to the given summary tree.\n\t */\n\tprivate addMetadataToSummary(summaryTree: ISummaryTreeWithStats): void {\n\t\t// The last message processed at the time of summary. If there are no new messages, use the message from the\n\t\t// last summary.\n\t\tconst message =\n\t\t\textractSummaryMetadataMessage(this.deltaManager.lastMessage) ??\n\t\t\tthis.messageAtLastSummary;\n\n\t\tconst documentSchema = this.documentsSchemaController.summarizeDocumentSchema(\n\t\t\tthis.deltaManager.lastSequenceNumber,\n\t\t);\n\n\t\t// Is document schema explicit control on?\n\t\tconst explicitSchemaControl = documentSchema?.runtime.explicitSchemaControl === true;\n\n\t\tconst metadata: IContainerRuntimeMetadata = {\n\t\t\t...this.createContainerMetadata,\n\t\t\t// Increment the summary number for the next summary that will be generated.\n\t\t\tsummaryNumber: this.nextSummaryNumber++,\n\t\t\tsummaryFormatVersion: 1,\n\t\t\t...this.garbageCollector.getMetadata(),\n\t\t\ttelemetryDocumentId: this.telemetryDocumentId,\n\t\t\t// If explicit document schema control is not on, use legacy way to supply last message (using 'message' property).\n\t\t\t// Otherwise use new 'lastMessage' property, but also put content into the 'message' property that cases old\n\t\t\t// runtimes (that preceded document schema control capabilities) to close container on load due to mismatch in\n\t\t\t// last message's sequence number.\n\t\t\t// See also lastMessageFromMetadata()\n\t\t\tmessage: explicitSchemaControl\n\t\t\t\t? ({ sequenceNumber: -1 } as unknown as ISummaryMetadataMessage)\n\t\t\t\t: message,\n\t\t\tlastMessage: explicitSchemaControl ? message : undefined,\n\t\t\tdocumentSchema,\n\t\t};\n\n\t\taddBlobToSummary(summaryTree, metadataBlobName, JSON.stringify(metadata));\n\t}\n\n\tprotected addContainerStateToSummary(\n\t\tsummaryTree: ISummaryTreeWithStats,\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): void {\n\t\tthis.addMetadataToSummary(summaryTree);\n\n\t\tif (this._idCompressor) {\n\t\t\tconst idCompressorState = JSON.stringify(this._idCompressor.serialize(false));\n\t\t\taddBlobToSummary(summaryTree, idCompressorBlobName, idCompressorState);\n\t\t}\n\n\t\tif (this.remoteMessageProcessor.partialMessages.size > 0) {\n\t\t\tconst content = JSON.stringify([...this.remoteMessageProcessor.partialMessages]);\n\t\t\taddBlobToSummary(summaryTree, chunksBlobName, content);\n\t\t}\n\n\t\tconst recentBatchInfo =\n\t\t\tthis.duplicateBatchDetector?.getRecentBatchInfoForSummary(telemetryContext);\n\t\tif (recentBatchInfo !== undefined) {\n\t\t\taddBlobToSummary(summaryTree, recentBatchInfoBlobName, JSON.stringify(recentBatchInfo));\n\t\t}\n\n\t\tconst dataStoreAliases = this.channelCollection.aliases;\n\t\tif (dataStoreAliases.size > 0) {\n\t\t\taddBlobToSummary(summaryTree, aliasBlobName, JSON.stringify([...dataStoreAliases]));\n\t\t}\n\n\t\tif (this.summarizerClientElection) {\n\t\t\tconst electedSummarizerContent = JSON.stringify(\n\t\t\t\tthis.summarizerClientElection?.serialize(),\n\t\t\t);\n\t\t\taddBlobToSummary(summaryTree, electedSummarizerBlobName, electedSummarizerContent);\n\t\t}\n\n\t\tconst blobManagerSummary = this.blobManager.summarize();\n\t\t// Some storage (like git) doesn't allow empty tree, so we can omit it.\n\t\t// and the blob manager can handle the tree not existing when loading\n\t\tif (Object.keys(blobManagerSummary.summary.tree).length > 0) {\n\t\t\taddSummarizeResultToSummary(summaryTree, blobsTreeName, blobManagerSummary);\n\t\t}\n\n\t\tconst gcSummary = this.garbageCollector.summarize(fullTree, trackState, telemetryContext);\n\t\tif (gcSummary !== undefined) {\n\t\t\taddSummarizeResultToSummary(summaryTree, gcTreeKey, gcSummary);\n\t\t}\n\t}\n\n\t// Track how many times the container tries to reconnect with pending messages.\n\t// This happens when the connection state is changed and we reset the counter\n\t// when we are able to process a local op or when there are no pending messages.\n\t// If this counter reaches a max, it's a good indicator that the container\n\t// is not making progress and it is stuck in a retry loop.\n\tprivate shouldContinueReconnecting(): boolean {\n\t\tif (this.maxConsecutiveReconnects <= 0) {\n\t\t\t// Feature disabled, we never stop reconnecting\n\t\t\treturn true;\n\t\t}\n\n\t\tif (!this.hasPendingMessages()) {\n\t\t\t// If there are no pending messages, we can always reconnect\n\t\t\tthis.resetReconnectCount();\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.consecutiveReconnects === Math.floor(this.maxConsecutiveReconnects / 2)) {\n\t\t\t// If we're halfway through the max reconnects, send an event in order\n\t\t\t// to better identify false positives, if any. If the rate of this event\n\t\t\t// matches Container Close count below, we can safely cut down\n\t\t\t// maxConsecutiveReconnects to half.\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"ReconnectsWithNoProgress\",\n\t\t\t\tattempts: this.consecutiveReconnects,\n\t\t\t\tpendingMessages: this.pendingMessagesCount,\n\t\t\t});\n\t\t}\n\n\t\treturn this.consecutiveReconnects < this.maxConsecutiveReconnects;\n\t}\n\n\tprivate resetReconnectCount(): void {\n\t\tthis.consecutiveReconnects = 0;\n\t}\n\n\tprivate replayPendingStates(): void {\n\t\t// We need to be able to send ops to replay states\n\t\tif (!this.shouldSendOps()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Replaying is an internal operation and we don't want to generate noise while doing it.\n\t\t// So temporarily disable dirty state change events, and save the old state.\n\t\t// When we're done, we'll emit the event if the state changed.\n\t\tconst oldState = this.lastEmittedDirty;\n\t\tassert(this.emitDirtyDocumentEvent, 0x127 /* \"dirty document event not set on replay\" */);\n\t\tthis.emitDirtyDocumentEvent = false;\n\n\t\ttry {\n\t\t\t// Any ID Allocation ops that failed to submit after the pending state was queued need to have\n\t\t\t// the corresponding ranges resubmitted (note this call replaces the typical resubmit flow).\n\t\t\t// Since we don't submit ID Allocation ops when staged, any outstanding ranges would be from\n\t\t\t// before staging mode so we can simply say staged: false.\n\t\t\tthis.submitIdAllocationOpIfNeeded({ resubmitOutstandingRanges: true, staged: false });\n\t\t\tthis.scheduleFlush();\n\n\t\t\t// replay the ops\n\t\t\tthis.pendingStateManager.replayPendingStates();\n\t\t} finally {\n\t\t\t// Restore the old state, re-enable event emit\n\t\t\tthis.lastEmittedDirty = oldState;\n\t\t\tthis.emitDirtyDocumentEvent = true;\n\t\t}\n\n\t\t// This will emit an event if the state changed relative to before replay\n\t\tthis.updateDocumentDirtyState();\n\t}\n\n\t/**\n\t * Parse an op's type and actual content from given serialized content\n\t * ! Note: this format needs to be in-line with what is set in the \"ContainerRuntime.submit(...)\" method\n\t */\n\tprivate parseLocalOpContent(serializedContents?: string): LocalContainerRuntimeMessage {\n\t\tassert(serializedContents !== undefined, 0x6d5 /* content must be defined */);\n\t\tconst message = JSON.parse(serializedContents) as LocalContainerRuntimeMessage;\n\t\tassert(message.type !== undefined, 0x6d6 /* incorrect op content format */);\n\t\treturn message;\n\t}\n\n\tprivate async applyStashedOp(serializedOpContent: string): Promise<unknown> {\n\t\t// Pending State contains serialized contents, so parse it here.\n\t\tconst opContents = this.parseLocalOpContent(serializedOpContent);\n\t\tswitch (opContents.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Attach:\n\t\t\tcase ContainerMessageType.Alias: {\n\t\t\t\treturn this.channelCollection.applyStashedOp(opContents);\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation: {\n\t\t\t\t// IDs allocation ops in stashed state are ignored because the tip state of the compressor\n\t\t\t\t// is serialized into the pending state. This is done because generation of new IDs during\n\t\t\t\t// stashed op application (or, later, resubmit) must generate new IDs and if the compressor\n\t\t\t\t// was loaded from a state serialized at the same time as the summary tree in the stashed state\n\t\t\t\t// then it would generate IDs that collide with any in later stashed ops.\n\t\t\t\t// In the future, IdCompressor could be extended to have an \"applyStashedOp\" or similar method\n\t\t\t\t// and the runtime could filter out all ID allocation ops from the stashed state and apply them\n\t\t\t\t// before applying the rest of the stashed ops. This would accomplish the same thing but with\n\t\t\t\t// better performance in future incremental stashed state creation.\n\t\t\t\tassert(\n\t\t\t\t\tthis.sessionSchema.idCompressorMode !== undefined,\n\t\t\t\t\t0x8f1 /* ID compressor should be in use */,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tthrow new Error(\"rejoin not expected here\");\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\t// GC op is only sent in summarizer which should never have stashed ops.\n\t\t\t\tthrow new LoggingError(\"GC op not expected to be stashed in summarizer\");\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst error = getUnknownMessageTypeError(\n\t\t\t\t\topContents.type,\n\t\t\t\t\t\"applyStashedOp\" /* codePath */,\n\t\t\t\t);\n\t\t\t\tthis.closeFn(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate loadIdCompressor(): void {\n\t\tif (\n\t\t\tthis._idCompressor === undefined &&\n\t\t\tthis.sessionSchema.idCompressorMode !== undefined\n\t\t) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"CreateIdCompressorOnDelayedLoad\" },\n\t\t\t\t(event) => {\n\t\t\t\t\tthis._idCompressor = this.createIdCompressorFn();\n\t\t\t\t\t// Finalize any ranges we received while the compressor was turned off.\n\t\t\t\t\tconst ops = this.pendingIdCompressorOps;\n\t\t\t\t\tthis.pendingIdCompressorOps = [];\n\t\t\t\t\tconst trace = Trace.start();\n\t\t\t\t\tfor (const range of ops) {\n\t\t\t\t\t\tthis._idCompressor.finalizeCreationRange(range);\n\t\t\t\t\t}\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tfinalizeCreationRangeDuration: trace.trace().duration,\n\t\t\t\t\t\t\tidCompressorMode: this.sessionSchema.idCompressorMode,\n\t\t\t\t\t\t\tpendingIdCompressorOps: ops.length,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(this.pendingIdCompressorOps.length === 0, 0x976 /* No new ops added */);\n\t\t}\n\t}\n\n\tprivate readonly notifyReadOnlyState = (readonly: boolean): void =>\n\t\tthis.channelCollection.notifyReadOnlyState(readonly);\n\n\tpublic setConnectionState(canSendOps: boolean, clientId?: string): void {\n\t\tthis.setConnectionStateToConnectedOrDisconnected(canSendOps, clientId);\n\t}\n\n\tpublic setConnectionStatus(status: ConnectionStatus): void {\n\t\tswitch (status.connectionState) {\n\t\t\tcase ConnectionState.Connected: {\n\t\t\t\tthis.setConnectionStateToConnectedOrDisconnected(\n\t\t\t\t\tstatus.canSendOps,\n\t\t\t\t\tstatus.clientConnectionId,\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ConnectionState.Disconnected: {\n\t\t\t\tthis.setConnectionStateToConnectedOrDisconnected(\n\t\t\t\t\tstatus.canSendOps,\n\t\t\t\t\tstatus.priorConnectedClientConnectionId,\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ConnectionState.CatchingUp: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.getConnectionState !== undefined &&\n\t\t\t\t\t\tthis.getConnectionState() === ConnectionState.CatchingUp,\n\t\t\t\t\t0xc8d /* connection state mismatch between getConnectionState and setConnectionStatus notification */,\n\t\t\t\t);\n\n\t\t\t\t// Note: Historically when only `setConnectionState` of `IRuntime`\n\t\t\t\t// was supported, it was possible to be in `CatchingUp` state and\n\t\t\t\t// call through to `setConnectionStateCore` when there is a readonly\n\t\t\t\t// change - see `Container`'s `\"deltaManager.on(\"readonly\"`. There\n\t\t\t\t// would not be a transition of `canSendOps` in that case, but\n\t\t\t\t// `channelCollection` and `garbageCollector` would receive early\n\t\t\t\t// `setConnectionState` call AND `this` would `emit` \"disconnected\"\n\t\t\t\t// event.\n\n\t\t\t\tthis.emitServiceConnectionEvents(\n\t\t\t\t\t/* canSendOpsChanged */ this.canSendOps,\n\t\t\t\t\t/* canSendOps */ false,\n\t\t\t\t\tstatus.pendingClientConnectionId,\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tprivate setConnectionStateToConnectedOrDisconnected(\n\t\tcanSendOps: boolean,\n\t\tclientId: string | undefined,\n\t): void {\n\t\t// Validate we have consistent state\n\t\tconst currentClientId = this._audience.getSelf()?.clientId;\n\t\tassert(clientId === currentClientId, 0x977 /* input clientId does not match Audience */);\n\t\tassert(\n\t\t\tthis.clientId === currentClientId,\n\t\t\t0x978 /* this.clientId does not match Audience */,\n\t\t);\n\n\t\tif (canSendOps && this.sessionSchema.idCompressorMode === \"delayed\") {\n\t\t\tthis.loadIdCompressor();\n\t\t}\n\n\t\tthis.setConnectionStateCore(canSendOps, clientId);\n\t}\n\n\t/**\n\t * Raises and propagates connected events.\n\t * @param canSendOps - Indicates whether the container can send ops or not (connected and not readonly).\n\t * @remarks The connection state from container context used here when raising connected events.\n\t */\n\tprivate setConnectionStateCore(canSendOps: boolean, clientId?: string): void {\n\t\tthis.verifyNotClosed();\n\n\t\t// There might be no change of state due to Container calling this API after loading runtime.\n\t\tconst canSendOpsChanged = this.canSendOps !== canSendOps;\n\t\tconst reconnection = canSendOpsChanged && !canSendOps;\n\n\t\t// We need to flush the ops currently collected by Outbox to preserve original order.\n\t\t// This flush NEEDS to happen before we set the ContainerRuntime to \"connected\".\n\t\t// We want these ops to get to the PendingStateManager without sending to service and have them return to the Outbox upon calling \"replayPendingStates\".\n\t\tif (canSendOpsChanged && canSendOps) {\n\t\t\tthis.flush();\n\t\t}\n\n\t\tthis.canSendOps = canSendOps;\n\n\t\tif (canSendOps) {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attached,\n\t\t\t\t0x3cd /* Connection is possible only if container exists in storage */,\n\t\t\t);\n\t\t\tif (canSendOpsChanged) {\n\t\t\t\tthis.signalTelemetryManager.resetTracking();\n\t\t\t}\n\t\t}\n\n\t\t// Fail while disconnected\n\t\tif (reconnection) {\n\t\t\tthis.consecutiveReconnects++;\n\n\t\t\tif (!this.shouldContinueReconnecting()) {\n\t\t\t\tthis.closeFn(\n\t\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\t\"Runtime detected too many reconnects with no progress syncing local ops.\",\n\t\t\t\t\t\t\"setConnectionState\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdataLoss: 1,\n\t\t\t\t\t\t\tattempts: this.consecutiveReconnects,\n\t\t\t\t\t\t\tpendingMessages: this.pendingMessagesCount,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (canSendOpsChanged) {\n\t\t\tthis.replayPendingStates();\n\t\t}\n\n\t\tthis.channelCollection.setConnectionState(canSendOps, clientId);\n\t\tthis.garbageCollector.setConnectionState(canSendOps, clientId);\n\n\t\t// Emit \"connected\" and \"disconnected\" events based on ability to send ops\n\t\traiseConnectedEvent(this.mc.logger, this, this.connected /* canSendOps */, clientId);\n\t\t// Emit \"connectedToService\" and \"disconnectedFromService\" events based on service connection status\n\t\tthis.emitServiceConnectionEvents(canSendOpsChanged, canSendOps, clientId);\n\t}\n\n\t/**\n\t * Emits service connection events based on connection state changes.\n\t *\n\t * @remarks\n\t * \"connectedToService\" is emitted when container connection state transitions to 'CatchingUp' or 'Connected' regardless of connection mode.\n\t * \"disconnectedFromService\" excludes false \"disconnected\" events that happen when readonly client transitions to 'Connected'.\n\t */\n\tprivate emitServiceConnectionEvents(\n\t\tcanSendOpsChanged: boolean,\n\t\tcanSendOps: boolean,\n\t\tclientId?: string,\n\t): void {\n\t\tif (!this.getConnectionState) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst connectionState = this.getConnectionState();\n\t\tconst canSendSignals =\n\t\t\tconnectionState === ConnectionState.Connected ||\n\t\t\tconnectionState === ConnectionState.CatchingUp;\n\t\tconst canSendSignalsChanged = this.canSendSignals !== canSendSignals;\n\t\tthis.canSendSignals = canSendSignals;\n\t\tif (canSendSignalsChanged) {\n\t\t\t// If canSendSignals changed, we either transitioned from CatchingUp or\n\t\t\t// Connected to Disconnected or EstablishingConnection to CatchingUp.\n\t\t\tif (canSendSignals) {\n\t\t\t\t// Emit for EstablishingConnection to CatchingUp or Connected transition\n\t\t\t\tthis.emit(\"connectedToService\", clientId, canSendOps);\n\t\t\t} else {\n\t\t\t\t// Emit for CatchingUp or Connected to Disconnected transition\n\t\t\t\tthis.emit(\"disconnectedFromService\");\n\t\t\t}\n\t\t} else if (canSendOpsChanged) {\n\t\t\t// If canSendSignals did not change but canSendOps did, then operations possible has changed.\n\t\t\tthis.emit(\"operabilityChanged\", canSendOps);\n\t\t}\n\t}\n\n\tpublic async notifyOpReplay(message: ISequencedDocumentMessage): Promise<void> {\n\t\tawait this.pendingStateManager.applyStashedOpsAt(message.sequenceNumber);\n\t}\n\n\t/**\n\t * Processes the op.\n\t * @param messageCopy - Sequenced message for a distributed document.\n\t * @param local - true if the message was originally generated by the client receiving it.\n\t */\n\tpublic process({ ...messageCopy }: ISequencedDocumentMessage, local: boolean): void {\n\t\t// spread operator above ensure we make a shallow copy of message, as the processing flow will modify it.\n\t\t// There might be multiple container instances receiving the same message.\n\n\t\tthis.verifyNotClosed();\n\n\t\tif (!this.skipSafetyFlushDuringProcessStack) {\n\t\t\t// Reference Sequence Number may be about to change, and it must be consistent across a batch, so flush now\n\t\t\tthis.flush();\n\t\t}\n\n\t\tthis.ensureNoDataModelChanges(() => {\n\t\t\tthis.processInboundMessageOrBatch(messageCopy, local);\n\t\t});\n\t}\n\n\t/**\n\t * Implementation of core logic for {@link ContainerRuntime.process}, once preconditions are established\n\t *\n\t * @param messageCopy - Shallow copy of the sequenced message. If it's a virtualized batch, we'll process\n\t * all messages in the batch here.\n\t */\n\tprivate processInboundMessageOrBatch(\n\t\tmessageCopy: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): void {\n\t\t// Whether or not the message appears to be a runtime message from an up-to-date client.\n\t\t// It may be a legacy runtime message (ie already unpacked and ContainerMessageType)\n\t\t// or something different, like a system message.\n\t\tconst hasModernRuntimeMessageEnvelope = messageCopy.type === MessageType.Operation;\n\t\tconst savedOp = (messageCopy.metadata as ISavedOpMetadata)?.savedOp;\n\t\tconst logLegacyCase = getSingleUseLegacyLogCallback(this.mc.logger, messageCopy.type);\n\n\t\tlet runtimeBatch: boolean =\n\t\t\thasModernRuntimeMessageEnvelope || isUnpackedRuntimeMessage(messageCopy);\n\t\tif (runtimeBatch) {\n\t\t\t// We expect runtime messages to have JSON contents - deserialize it in place.\n\t\t\tensureContentsDeserialized(messageCopy);\n\t\t}\n\n\t\tif (hasModernRuntimeMessageEnvelope) {\n\t\t\t// If the message has the modern message envelope, then process it here.\n\t\t\t// Here we unpack the message (decompress, unchunk, and/or ungroup) into a batch of messages with ContainerMessageType\n\t\t\tconst inboundResult = this.remoteMessageProcessor.process(messageCopy, logLegacyCase);\n\t\t\tif (inboundResult === undefined) {\n\t\t\t\t// This means the incoming message is an incomplete part of a message or batch\n\t\t\t\t// and we need to process more messages before the rest of the system can understand it.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\"batchStart\" in inboundResult) {\n\t\t\t\tconst batchStart: BatchStartInfo = inboundResult.batchStart;\n\t\t\t\tconst result = this.duplicateBatchDetector?.processInboundBatch(batchStart);\n\t\t\t\tif (result?.duplicate === true) {\n\t\t\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t\t\t\"Duplicate batch - The same batch was sequenced twice\",\n\t\t\t\t\t\t{ batchId: batchStart.batchId },\n\t\t\t\t\t);\n\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"DuplicateBatch\",\n\t\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\t\tbatchId: batchStart.batchId,\n\t\t\t\t\t\t\t\tclientId: batchStart.clientId,\n\t\t\t\t\t\t\t\tbatchStartCsn: batchStart.batchStartCsn,\n\t\t\t\t\t\t\t\tsize: inboundResult.length,\n\t\t\t\t\t\t\t\tduplicateBatchSequenceNumber: result.otherSequenceNumber,\n\t\t\t\t\t\t\t\t...extractSafePropertiesFromMessage(batchStart.keyMessage),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reach out to PendingStateManager, either to zip localOpMetadata into the *local* message list,\n\t\t\t// or to check to ensure the *remote* messages don't match the batchId of a pending local batch.\n\t\t\t// This latter case would indicate that the container has forked - two copies are trying to persist the same local changes.\n\t\t\tlet messagesWithPendingState: {\n\t\t\t\tmessage: ISequencedDocumentMessage;\n\t\t\t\tlocalOpMetadata?: unknown;\n\t\t\t}[] = this.pendingStateManager.processInboundMessages(inboundResult, local);\n\n\t\t\tif (inboundResult.type !== \"fullBatch\") {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesWithPendingState.length === 1,\n\t\t\t\t\t0xa3d /* Partial batch should have exactly one message */,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (messagesWithPendingState.length === 0) {\n\t\t\t\tassert(\n\t\t\t\t\tinboundResult.type === \"fullBatch\",\n\t\t\t\t\t0xa3e /* Empty batch is always considered a full batch */,\n\t\t\t\t);\n\t\t\t\t/**\n\t\t\t\t * We need to process an empty batch, which will execute expected actions while processing even if there\n\t\t\t\t * are no inner runtime messages.\n\t\t\t\t *\n\t\t\t\t * Empty batches are produced by the outbox on resubmit when the resubmit flow resulted in no runtime\n\t\t\t\t * messages.\n\t\t\t\t * This can happen if changes from a remote client \"cancel out\" the pending changes being resubmitted by\n\t\t\t\t * this client. We submit an empty batch if \"offline load\" (aka rehydrating from stashed state) is\n\t\t\t\t * enabled, to ensure we account for this batch when comparing batchIds, checking for a forked container.\n\t\t\t\t * Otherwise, we would not realize this container has forked in the case where it did fork, and a batch\n\t\t\t\t * became empty but wasn't submitted as such.\n\t\t\t\t */\n\t\t\t\tmessagesWithPendingState = [\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: inboundResult.batchStart.keyMessage,\n\t\t\t\t\t\tlocalOpMetadata: undefined,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\t// Empty batch message is a non-runtime message as it was generated by the op grouping manager.\n\t\t\t\truntimeBatch = false;\n\t\t\t}\n\n\t\t\tconst locationInBatch: { batchStart: boolean; batchEnd: boolean } =\n\t\t\t\tinboundResult.type === \"fullBatch\"\n\t\t\t\t\t? { batchStart: true, batchEnd: true }\n\t\t\t\t\t: inboundResult.type === \"batchStartingMessage\"\n\t\t\t\t\t\t? { batchStart: true, batchEnd: false }\n\t\t\t\t\t\t: { batchStart: false, batchEnd: inboundResult.batchEnd === true };\n\n\t\t\tthis.processInboundMessages(\n\t\t\t\tmessagesWithPendingState,\n\t\t\t\tlocationInBatch,\n\t\t\t\tlocal,\n\t\t\t\tsavedOp,\n\t\t\t\truntimeBatch,\n\t\t\t\tinboundResult.type === \"fullBatch\"\n\t\t\t\t\t? inboundResult.groupedBatch\n\t\t\t\t\t: false /* groupedBatch */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.processInboundMessages(\n\t\t\t\t[{ message: messageCopy, localOpMetadata: undefined }],\n\t\t\t\t{ batchStart: true, batchEnd: true }, // Single message\n\t\t\t\tlocal,\n\t\t\t\tsavedOp,\n\t\t\t\truntimeBatch,\n\t\t\t\tfalse /* groupedBatch */,\n\t\t\t);\n\t\t}\n\n\t\tif (local) {\n\t\t\t// If we have processed a local op, this means that the container is\n\t\t\t// making progress and we can reset the counter for how many times\n\t\t\t// we have consecutively replayed the pending states\n\t\t\tthis.resetReconnectCount();\n\t\t}\n\t}\n\n\tprivate _processedClientSequenceNumber: number | undefined;\n\n\t/**\n\t * Processes inbound message(s). It calls delta scheduler according to the messages' location in the batch.\n\t * @param messagesWithMetadata - messages to process along with their metadata.\n\t * @param locationInBatch - Are we processing the start and/or end of a batch?\n\t * @param local - true if the messages were originally generated by the client receiving it.\n\t * @param savedOp - true if the message is a replayed saved op.\n\t * @param runtimeBatch - true if these are runtime messages.\n\t * @param groupedBatch - true if these messages are part of a grouped op batch.\n\t */\n\tprivate processInboundMessages(\n\t\tmessagesWithMetadata: {\n\t\t\tmessage: ISequencedDocumentMessage;\n\t\t\tlocalOpMetadata?: unknown;\n\t\t}[],\n\t\tlocationInBatch: { batchStart: boolean; batchEnd: boolean },\n\t\tlocal: boolean,\n\t\tsavedOp: boolean | undefined,\n\t\truntimeBatch: boolean,\n\t\tgroupedBatch: boolean,\n\t): void {\n\t\t// This message could have been the last pending local (dirtyable) message, in which case we need to update dirty state to \"saved\"\n\t\tthis.updateDocumentDirtyState();\n\n\t\tif (locationInBatch.batchStart) {\n\t\t\tconst firstMessage = messagesWithMetadata[0]?.message;\n\t\t\tassert(firstMessage !== undefined, 0xa31 /* Batch must have at least one message */);\n\t\t\tthis.emit(\"batchBegin\", firstMessage);\n\t\t}\n\n\t\tlet error: unknown;\n\t\ttry {\n\t\t\tif (!runtimeBatch) {\n\t\t\t\tfor (const { message } of messagesWithMetadata) {\n\t\t\t\t\tthis.observeNonRuntimeMessage(message);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Updates a message's minimum sequence number to the minimum sequence number that container\n\t\t\t// runtime is tracking and sets _processedClientSequenceNumber. It returns the updated message.\n\t\t\tconst updateSequenceNumbers = (\n\t\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\t): InboundSequencedContainerRuntimeMessage => {\n\t\t\t\t// Set the minimum sequence number to the containerRuntime's understanding of minimum sequence number.\n\t\t\t\tmessage.minimumSequenceNumber =\n\t\t\t\t\tthis.useDeltaManagerOpsProxy &&\n\t\t\t\t\tthis.deltaManager.minimumSequenceNumber < message.minimumSequenceNumber\n\t\t\t\t\t\t? this.deltaManager.minimumSequenceNumber\n\t\t\t\t\t\t: message.minimumSequenceNumber;\n\t\t\t\tthis._processedClientSequenceNumber = message.clientSequenceNumber;\n\t\t\t\treturn message as InboundSequencedContainerRuntimeMessage;\n\t\t\t};\n\n\t\t\t// Non-grouped batch messages are processed one at a time.\n\t\t\tif (!groupedBatch) {\n\t\t\t\tfor (const { message, localOpMetadata } of messagesWithMetadata) {\n\t\t\t\t\tupdateSequenceNumbers(message);\n\t\t\t\t\tthis.validateAndProcessRuntimeMessages(\n\t\t\t\t\t\tmessage as InboundSequencedContainerRuntimeMessage,\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontents: message.contents,\n\t\t\t\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t\tsavedOp,\n\t\t\t\t\t);\n\t\t\t\t\tthis.emit(\"op\", message, true /* runtimeMessage */);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet bunchedMessagesContent: IRuntimeMessagesContent[] = [];\n\t\t\tlet previousMessage: InboundSequencedContainerRuntimeMessage | undefined;\n\n\t\t\t// Process the previous bunch of messages.\n\t\t\tconst processBunchedMessages = (): void => {\n\t\t\t\tassert(previousMessage !== undefined, 0xa67 /* previous message must exist */);\n\t\t\t\tthis.validateAndProcessRuntimeMessages(\n\t\t\t\t\tpreviousMessage,\n\t\t\t\t\tbunchedMessagesContent,\n\t\t\t\t\tlocal,\n\t\t\t\t\tsavedOp,\n\t\t\t\t);\n\t\t\t\tbunchedMessagesContent = [];\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * For grouped batch messages, bunch contiguous messages of the same type and process them together.\n\t\t\t * This is an optimization mainly for DDSes, where it can process a bunch of ops together. DDSes\n\t\t\t * like merge tree or shared tree can process ops more efficiently when they are bunched together.\n\t\t\t */\n\t\t\tfor (const { message, localOpMetadata } of messagesWithMetadata) {\n\t\t\t\tconst currentMessage = updateSequenceNumbers(message);\n\t\t\t\tif (previousMessage && previousMessage.type !== currentMessage.type) {\n\t\t\t\t\tprocessBunchedMessages();\n\t\t\t\t}\n\t\t\t\tpreviousMessage = currentMessage;\n\t\t\t\tbunchedMessagesContent.push({\n\t\t\t\t\tcontents: message.contents,\n\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Process the last bunch of messages.\n\t\t\tprocessBunchedMessages();\n\n\t\t\t// Send the \"op\" events for the messages now that the ops have been processed.\n\t\t\tfor (const { message } of messagesWithMetadata) {\n\t\t\t\tthis.emit(\"op\", message, true /* runtimeMessage */);\n\t\t\t}\n\t\t} catch (error_) {\n\t\t\terror = error_;\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (locationInBatch.batchEnd) {\n\t\t\t\tconst lastMessage = messagesWithMetadata[messagesWithMetadata.length - 1]?.message;\n\t\t\t\tassert(lastMessage !== undefined, 0xa32 /* Batch must have at least one message */);\n\t\t\t\tthis.emit(\"batchEnd\", error, lastMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Observes messages that are not intended for the runtime layer, updating/notifying Runtime systems as needed.\n\t * @param message - non-runtime message to process.\n\t */\n\tprivate observeNonRuntimeMessage(message: ISequencedDocumentMessage): void {\n\t\t// Set the minimum sequence number to the containerRuntime's understanding of minimum sequence number.\n\t\tif (this.deltaManager.minimumSequenceNumber < message.minimumSequenceNumber) {\n\t\t\tmessage.minimumSequenceNumber = this.deltaManager.minimumSequenceNumber;\n\t\t}\n\n\t\tthis._processedClientSequenceNumber = message.clientSequenceNumber;\n\n\t\t// The DeltaManager used to do this, but doesn't anymore as of Loader v2.4\n\t\t// Anyone listening to our \"op\" event would expect the contents to be parsed per this same logic\n\t\tif (\n\t\t\ttypeof message.contents === \"string\" &&\n\t\t\tmessage.contents !== \"\" &&\n\t\t\tmessage.type !== MessageType.ClientLeave\n\t\t) {\n\t\t\tmessage.contents = JSON.parse(message.contents);\n\t\t}\n\n\t\tthis.emit(\"op\", message, false /* runtimeMessage */);\n\t}\n\n\t/**\n\t * Process runtime messages. The messages here are contiguous messages in a batch.\n\t * Assuming the messages in the given bunch are also a TypedContainerRuntimeMessage, checks its type and dispatch\n\t * the messages to the appropriate handler in the runtime.\n\t * Throws a DataProcessingError if the message looks like but doesn't conform to a known TypedContainerRuntimeMessage type.\n\t * @param message - The core message with common properties for all the messages.\n\t * @param messageContents - The contents, local metadata and clientSequenceNumbers of the messages.\n\t * @param local - true if the messages were originally generated by the client receiving it.\n\t * @param savedOp - true if the message is a replayed saved op.\n\t *\n\t */\n\tprivate validateAndProcessRuntimeMessages(\n\t\tmessage: Omit<InboundSequencedContainerRuntimeMessage, \"contents\">,\n\t\tmessagesContent: IRuntimeMessagesContent[],\n\t\tlocal: boolean,\n\t\tsavedOp?: boolean,\n\t): void {\n\t\t// Get the contents without the localOpMetadata because not all message types know about localOpMetadata.\n\t\tconst contents = messagesContent.map((c) => c.contents);\n\n\t\tswitch (message.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Attach:\n\t\t\tcase ContainerMessageType.Alias: {\n\t\t\t\t// Remove the metadata from the message before sending it to the channel collection. The metadata\n\t\t\t\t// is added by the container runtime and is not part of the message that the channel collection and\n\t\t\t\t// layers below it expect.\n\t\t\t\tthis.channelCollection.processMessages({ envelope: message, messagesContent, local });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\tthis.blobManager.processBlobAttachMessage(message, local);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation: {\n\t\t\t\tthis.processIdCompressorMessages(contents as IdCreationRange[], savedOp);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\tthis.garbageCollector.processMessages(\n\t\t\t\t\tcontents as GarbageCollectionMessage[],\n\t\t\t\t\tmessage.timestamp,\n\t\t\t\t\tlocal,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.ChunkedOp: {\n\t\t\t\t// From observability POV, we should not expose the rest of the system (including \"op\" events on object) to these messages.\n\t\t\t\t// Also resetReconnectCount() would be wrong - see comment that was there before this change was made.\n\t\t\t\tassert(false, 0x93d /* should not even get here */);\n\t\t\t}\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\tthis.documentsSchemaController.processDocumentSchemaMessages(\n\t\t\t\t\tcontents as IDocumentSchemaChangeMessageIncoming[],\n\t\t\t\t\tlocal,\n\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst error = getUnknownMessageTypeError(\n\t\t\t\t\tmessage.type,\n\t\t\t\t\t\"validateAndProcessRuntimeMessage\" /* codePath */,\n\t\t\t\t\tmessage as ISequencedDocumentMessage,\n\t\t\t\t);\n\t\t\t\tthis.closeFn(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processIdCompressorMessages(\n\t\tmessageContents: IdCreationRange[],\n\t\tsavedOp?: boolean,\n\t): void {\n\t\tfor (const range of messageContents) {\n\t\t\t// Don't re-finalize the range if we're processing a \"savedOp\" in\n\t\t\t// stashed ops flow. The compressor is stashed with these ops already processed.\n\t\t\t// That said, in idCompressorMode === \"delayed\", we might not serialize ID compressor, and\n\t\t\t// thus we need to process all the ops.\n\t\t\tif (!(this.skipSavedCompressorOps && savedOp === true)) {\n\t\t\t\t// Some other client turned on the id compressor. If we have not turned it on,\n\t\t\t\t// put it in a pending queue and delay finalization.\n\t\t\t\tif (this._idCompressor === undefined) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.sessionSchema.idCompressorMode !== undefined,\n\t\t\t\t\t\t0x93c /* id compressor should be enabled */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.pendingIdCompressorOps.push(range);\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.pendingIdCompressorOps.length === 0,\n\t\t\t\t\t\t0x979 /* there should be no pending ops! */,\n\t\t\t\t\t);\n\t\t\t\t\tthis._idCompressor.finalizeCreationRange(range);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic processSignal(\n\t\tmessage: ISignalMessage<{\n\t\t\ttype: string;\n\t\t\tcontent: ISignalEnvelope<{ type: string; content: OpaqueJsonDeserialized<unknown> }>;\n\t\t}>,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst envelope = message.content;\n\t\tconst transformed = {\n\t\t\tclientId: message.clientId,\n\t\t\tcontent: envelope.contents.content,\n\t\t\ttype: envelope.contents.type,\n\t\t\ttargetClientId: message.targetClientId,\n\t\t};\n\n\t\t// Only collect signal telemetry for broadcast messages sent by the current client.\n\t\tif (message.clientId === this.clientId) {\n\t\t\tthis.signalTelemetryManager.trackReceivedSignal(\n\t\t\t\tenvelope,\n\t\t\t\tthis.mc.logger,\n\t\t\t\tthis.consecutiveReconnects,\n\t\t\t);\n\t\t}\n\n\t\tconst fullAddress = envelope.address;\n\t\tif (fullAddress === undefined) {\n\t\t\t// No address indicates a container signal message.\n\t\t\tthis.emit(\"signal\", transformed, local);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.routeNonContainerSignal(fullAddress, transformed, local);\n\t}\n\n\tprivate routeNonContainerSignal(\n\t\taddress: string,\n\t\tsignalMessage: IInboundSignalMessage<UnknownIncomingTypedMessage>,\n\t\tlocal: boolean,\n\t): void {\n\t\t// channelCollection signals are identified by no starting `/` in address.\n\t\tif (!address.startsWith(\"/\")) {\n\t\t\t// Due to a mismatch between different layers in terms of\n\t\t\t// what is the interface of passing signals, we need to adjust\n\t\t\t// the signal envelope before sending it to the datastores to be processed\n\t\t\tconst channelSignalMessage = {\n\t\t\t\t...signalMessage,\n\t\t\t\tcontent: {\n\t\t\t\t\taddress,\n\t\t\t\t\tcontents: signalMessage.content,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tthis.channelCollection.processSignal(channelSignalMessage, local);\n\t\t\treturn;\n\t\t}\n\n\t\tconst addresses = address.split(\"/\");\n\t\tif (addresses.length > 2 && addresses[1] === \"ext\") {\n\t\t\tconst id = addresses[2] as ContainerExtensionId;\n\t\t\tconst entry = this.extensions.get(id);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tentry.extension.processSignal?.(addresses.slice(3), signalMessage, local);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tassert(!local, 0xba0 /* No recipient found for local signal */);\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"SignalAddressNotFound\",\n\t\t\t...tagCodeArtifacts({\n\t\t\t\taddress,\n\t\t\t}),\n\t\t});\n\t}\n\n\t/**\n\t * Flush the current batch of ops to the ordering service for sequencing\n\t * This method is not expected to be called in the middle of a batch.\n\t * @remarks If it throws (e.g. if the batch is too large to send), the container will be closed.\n\t *\n\t * @param resubmitInfo - If defined, indicates this is a resubmission of a batch with the given Batch info needed for resubmit.\n\t */\n\tprivate flush(resubmitInfo?: BatchResubmitInfo): void {\n\t\tthis.flushScheduled = false;\n\n\t\ttry {\n\t\t\tassert(\n\t\t\t\t!this.batchRunner.running,\n\t\t\t\t0x24c /* \"Cannot call `flush()` while manually accumulating a batch (e.g. under orderSequentially) */,\n\t\t\t);\n\n\t\t\tthis.outbox.flush(resubmitInfo);\n\t\t\tassert(this.outbox.isEmpty, 0x3cf /* reentrancy */);\n\t\t} catch (error) {\n\t\t\tconst error2 = normalizeError(error, {\n\t\t\t\tprops: {\n\t\t\t\t\torderSequentiallyCalls: this.batchRunner.runs,\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.closeFn(error2);\n\t\t\tthrow error2;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.orderSequentially}\n\t */\n\tpublic orderSequentially<T>(callback: () => T): T {\n\t\tlet checkpoint: IBatchCheckpoint | undefined;\n\t\tlet stageControls: StageControlsInternal | undefined;\n\t\tif (this.mc.config.getBoolean(\"Fluid.ContainerRuntime.EnableRollback\") === true) {\n\t\t\tif (!this.batchRunner.running && !this.inStagingMode) {\n\t\t\t\tstageControls = this.enterStagingMode();\n\t\t\t}\n\t\t\t// Note: we are not touching any batches other than mainBatch here, for two reasons:\n\t\t\t// 1. It would not help, as other batches are flushed independently from main batch.\n\t\t\t// 2. There is no way to undo process of data store creation, blob creation, ID compressor ops, or other things tracked by other batches.\n\t\t\tcheckpoint = this.outbox.getBatchCheckpoints().mainBatch;\n\t\t}\n\t\tconst result = this.batchRunner.run(() => {\n\t\t\ttry {\n\t\t\t\treturn callback();\n\t\t\t} catch (error) {\n\t\t\t\tif (checkpoint) {\n\t\t\t\t\t// This will throw and close the container if rollback fails\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcheckpoint.rollback((message: LocalBatchMessage) =>\n\t\t\t\t\t\t\t// These changes are staged since we entered staging mode above\n\t\t\t\t\t\t\tthis.rollbackStagedChange(message.runtimeOp, message.localOpMetadata),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.updateDocumentDirtyState();\n\t\t\t\t\t\tstageControls?.discardChanges();\n\t\t\t\t\t\tstageControls = undefined;\n\t\t\t\t\t} catch (error_) {\n\t\t\t\t\t\tconst error2 = wrapError(error_, (message) => {\n\t\t\t\t\t\t\treturn DataProcessingError.create(\n\t\t\t\t\t\t\t\t`RollbackError: ${message}`,\n\t\t\t\t\t\t\t\t\"checkpointRollback\",\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t) as DataProcessingError;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.closeFn(error2);\n\t\t\t\t\t\tthrow error2;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.closeFn(\n\t\t\t\t\t\twrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\t\t\tnew GenericError(\n\t\t\t\t\t\t\t\t\t`orderSequentially callback exception: ${errorMessage}`,\n\t\t\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\torderSequentiallyCalls: this.batchRunner.runs,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow error; // throw the original error for the consumer of the runtime\n\t\t\t}\n\t\t});\n\n\t\tstageControls?.commitChanges({ squash: false });\n\n\t\t// We don't flush on TurnBased since we expect all messages in the same JS turn to be part of the same batch\n\t\tif (this.flushMode !== FlushMode.TurnBased && !this.batchRunner.running) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate stageControls: StageControlsInternal | undefined;\n\n\t/**\n\t * If true, the ContainerRuntime is not submitting any new ops to the ordering service.\n\t * Ops submitted to the ContainerRuntime while in Staging Mode will be queued in the PendingStateManager,\n\t * either to be discarded or committed later (via the Stage Controls returned from enterStagingMode).\n\t */\n\tpublic get inStagingMode(): boolean {\n\t\treturn this.stageControls !== undefined;\n\t}\n\n\t/**\n\t * Enter Staging Mode, such that ops submitted to the ContainerRuntime will not be sent to the ordering service.\n\t * To exit Staging Mode, call either discardChanges or commitChanges on the Stage Controls returned from this method.\n\t *\n\t * @returns Controls for exiting Staging Mode.\n\t */\n\tpublic enterStagingMode = (): StageControlsInternal => {\n\t\tif (this.stageControls !== undefined) {\n\t\t\tthrow new UsageError(\"Already in staging mode\");\n\t\t}\n\t\tif (this.attachState === AttachState.Detached) {\n\t\t\tthrow new UsageError(\"Cannot enter staging mode while Detached\");\n\t\t}\n\n\t\t// Make sure Outbox is empty before entering staging mode,\n\t\t// since we mark whole batches as \"staged\" or not to indicate whether to submit them.\n\t\tthis.flush();\n\n\t\tconst exitStagingMode = (discardOrCommit: () => void): void => {\n\t\t\ttry {\n\t\t\t\t// Final flush of any last staged changes\n\t\t\t\t// NOTE: We can't use this.flush() here, because orderSequentially uses StagingMode and in the rollback case we'll hit assert 0x24c\n\t\t\t\tthis.outbox.flush();\n\n\t\t\t\tthis.stageControls = undefined;\n\n\t\t\t\t// During Staging Mode, we avoid submitting any ID Allocation ops (apart from resubmitting pre-staging ops).\n\t\t\t\t// Now that we've exited, we need to submit an ID Allocation op for any IDs that were generated while in Staging Mode.\n\t\t\t\tthis.submitIdAllocationOpIfNeeded({ staged: false });\n\t\t\t\tdiscardOrCommit();\n\n\t\t\t\tthis.channelCollection.notifyStagingMode(false);\n\t\t\t} catch (error) {\n\t\t\t\tconst normalizedError = normalizeError(error);\n\t\t\t\tthis.closeFn(normalizedError);\n\t\t\t\tthrow normalizedError;\n\t\t\t}\n\t\t};\n\n\t\tconst stageControls: StageControlsInternal = {\n\t\t\tdiscardChanges: () =>\n\t\t\t\texitStagingMode(() => {\n\t\t\t\t\t// Pop all staged batches from the PSM and roll them back in LIFO order\n\t\t\t\t\tthis.pendingStateManager.popStagedBatches(({ runtimeOp, localOpMetadata }) => {\n\t\t\t\t\t\tthis.rollbackStagedChange(runtimeOp, localOpMetadata);\n\t\t\t\t\t});\n\t\t\t\t\tthis.updateDocumentDirtyState();\n\t\t\t\t}),\n\t\t\tcommitChanges: (options) => {\n\t\t\t\tconst { squash } = { ...defaultStagingCommitOptions, ...options };\n\t\t\t\texitStagingMode(() => {\n\t\t\t\t\t// Replay all staged batches in typical FIFO order.\n\t\t\t\t\t// We'll be out of staging mode so they'll be sent to the service finally.\n\t\t\t\t\tthis.pendingStateManager.replayPendingStates({\n\t\t\t\t\t\tcommittingStagedBatches: true,\n\t\t\t\t\t\tsquash,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\n\t\tthis.stageControls = stageControls;\n\t\tthis.channelCollection.notifyStagingMode(true);\n\n\t\treturn this.stageControls;\n\t};\n\n\t/**\n\t * Returns the aliased data store's entryPoint, given the alias.\n\t * @param alias - The alias for the data store.\n\t * @returns The data store's entry point ({@link @fluidframework/core-interfaces#IFluidHandle}) if it exists and is aliased.\n\t * Returns undefined if no data store has been assigned the given alias.\n\t */\n\tpublic async getAliasedDataStoreEntryPoint(\n\t\talias: string,\n\t): Promise<IFluidHandle<FluidObject> | undefined> {\n\t\t// Back-comapatibility:\n\t\t// There are old files that were created without using data store aliasing feature, but\n\t\t// used createRoot*DataStore*() (already removed) API. Such data stores will have isRoot = true,\n\t\t// and internalID provided by user. The expectation is that such files behave as new files, where\n\t\t// same data store instances created using aliasing feature.\n\t\t// Please also see note on name collisions in DataStores.createDataStoreId()\n\t\tawait this.channelCollection.waitIfPendingAlias(alias);\n\t\tconst internalId = this.internalId(alias);\n\t\tconst context = await this.channelCollection.getDataStoreIfAvailable(internalId, {\n\t\t\twait: false,\n\t\t});\n\t\t// If the data store is not available or not an alias, return undefined.\n\t\tif (context === undefined || !(await context.isRoot())) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst channel = await context.realize();\n\t\tif (channel.entryPoint === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"entryPoint must be defined on data store runtime for using getAliasedDataStoreEntryPoint\",\n\t\t\t);\n\t\t}\n\t\tthis.garbageCollector.nodeUpdated({\n\t\t\tnode: { type: \"DataStore\", path: `/${internalId}` },\n\t\t\treason: \"Loaded\",\n\t\t\tpackagePath: context.packagePath,\n\t\t\ttimestampMs: this.getCurrentReferenceTimestampMs(),\n\t\t});\n\t\treturn channel.entryPoint;\n\t}\n\n\tpublic createDetachedDataStore(\n\t\tpkg: readonly string[],\n\t\tloadingGroupId?: string,\n\t): IFluidDataStoreContextDetached {\n\t\treturn this.channelCollection.createDetachedDataStore(pkg, loadingGroupId);\n\t}\n\n\tpublic async createDataStore(\n\t\tpkg: Readonly<string | string[]>,\n\t\tloadingGroupId?: string,\n\t): Promise<IDataStore> {\n\t\tconst context = this.channelCollection.createDataStoreContext(\n\t\t\tArray.isArray(pkg) ? pkg : [pkg],\n\t\t\tloadingGroupId,\n\t\t);\n\t\treturn channelToDataStore(\n\t\t\tawait context.realize(),\n\t\t\tcontext.id,\n\t\t\tthis.channelCollection,\n\t\t\tthis.mc.logger,\n\t\t);\n\t}\n\n\tprivate shouldSendOps(): boolean {\n\t\t// Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because\n\t\t// container runtime's ability to send ops depend on the actual readonly state of the delta manager.\n\t\treturn this.connected && this.innerDeltaManager.readOnlyInfo.readonly !== true;\n\t}\n\n\tprivate readonly _quorum: IQuorumClients;\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this._quorum;\n\t}\n\n\tprivate readonly _audience: IAudience;\n\tpublic getAudience(): IAudience {\n\t\treturn this._audience;\n\t}\n\n\t/**\n\t * When defined, this {@link @fluidframework/container-definitions#IAudience}\n\t * maintains member list using signals only.\n\t * Thus \"write\" members may be known earlier than quorum and avoid noise from\n\t * un-summarized quorum history.\n\t */\n\tprivate readonly signalAudience?: IAudience;\n\n\t/**\n\t * Returns true of container is dirty, i.e. there are some pending local changes that\n\t * either were not sent out to delta stream or were not yet acknowledged.\n\t */\n\tpublic get isDirty(): boolean {\n\t\t// Rather than recomputing the dirty state in this moment,\n\t\t// just regurgitate the last emitted dirty state.\n\t\treturn this.lastEmittedDirty;\n\t}\n\n\t/**\n\t * Returns true if the container is dirty: not attached, or no pending user messages (could be some \"non-dirtyable\" ones though)\n\t */\n\tprivate computeCurrentDirtyState(): boolean {\n\t\treturn (\n\t\t\tthis.attachState !== AttachState.Attached ||\n\t\t\tthis.pendingStateManager.hasPendingUserChanges() ||\n\t\t\tthis.outbox.containsUserChanges()\n\t\t);\n\t}\n\n\t/**\n\t * Submits the signal to be sent to other clients.\n\t * @param type - Type of the signal.\n\t * @param content - Content of the signal. Should be a JSON serializable object or primitive.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t *\n\t * @remarks\n\t *\n\t * The `targetClientId` parameter here is currently intended for internal testing purposes only.\n\t * Support for this option at container runtime is planned to be deprecated in the future.\n\t *\n\t */\n\tpublic submitSignal(type: string, content: unknown, targetClientId?: string): void {\n\t\tthis.verifyNotClosed();\n\t\tconst envelope = {\n\t\t\tcontents: { type, content },\n\t\t} satisfies UnsequencedSignalEnvelope;\n\t\tthis.submitSignalFn(envelope, targetClientId);\n\t}\n\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tif (attachState === AttachState.Attaching) {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attaching,\n\t\t\t\t0x12d /* \"Container Context should already be in attaching state\" */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attached,\n\t\t\t\t0x12e /* \"Container Context should already be in attached state\" */,\n\t\t\t);\n\t\t\tthis.emit(\"attached\");\n\t\t}\n\n\t\tthis.updateDocumentDirtyState();\n\t\tthis.channelCollection.setAttachState(attachState);\n\t}\n\n\t/**\n\t * Create a summary. Used when attaching or serializing a detached container.\n\t *\n\t * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n\t * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n\t * new storage IDs so requests can be redirected.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic createSummary(\n\t\tblobRedirectTable?: Map<string, string>,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTree {\n\t\tif (blobRedirectTable) {\n\t\t\tthis.blobManager.patchRedirectTable(blobRedirectTable);\n\t\t}\n\n\t\t// We can finalize any allocated IDs since we're the only client\n\t\tconst idRange = this._idCompressor?.takeNextCreationRange();\n\t\tif (idRange !== undefined) {\n\t\t\tassert(\n\t\t\t\tidRange.ids === undefined || idRange.ids.firstGenCount === 1,\n\t\t\t\t0x93e /* No other ranges should be taken while container is detached. */,\n\t\t\t);\n\t\t\tthis._idCompressor?.finalizeCreationRange(idRange);\n\t\t}\n\n\t\tconst summarizeResult = this.channelCollection.getAttachSummary(telemetryContext);\n\t\t// Wrap data store summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\n\t\tthis.addContainerStateToSummary(\n\t\t\tsummarizeResult,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn summarizeResult.summary;\n\t}\n\n\tpublic readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;\n\n\t/**\n\t * Builds the Summary tree including all the channels and the container state.\n\t *\n\t * @remarks Unfortunately, this function is accessed in a non-typesafe way by a legacy first-party partner,\n\t * so until we can provide a proper API for their scenario, we need to ensure this function doesn't change.\n\t */\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst summarizeResult = await this.channelCollection.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t);\n\n\t\t// Wrap data store summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\t\tconst pathPartsForChildren = [channelsTreeName];\n\n\t\tthis.loadIdCompressor();\n\n\t\tthis.addContainerStateToSummary(summarizeResult, fullTree, trackState, telemetryContext);\n\t\treturn {\n\t\t\t...summarizeResult,\n\t\t\tid: \"\",\n\t\t\tpathPartsForChildren,\n\t\t};\n\t}\n\n\t/**\n\t * Returns a summary of the runtime at the current sequence number.\n\t */\n\tpublic async summarize(options: {\n\t\t/**\n\t\t * True to generate the full tree with no handle reuse optimizations; defaults to false\n\t\t */\n\t\tfullTree?: boolean;\n\t\t/**\n\t\t * True to track the state for this summary in the SummarizerNodes; defaults to true\n\t\t */\n\t\ttrackState?: boolean;\n\t\t/**\n\t\t * Logger to use for correlated summary events\n\t\t */\n\t\tsummaryLogger?: ITelemetryLoggerExt;\n\t\t/**\n\t\t * True to run garbage collection before summarizing; defaults to true\n\t\t */\n\t\trunGC?: boolean;\n\t\t/**\n\t\t * True to generate full GC data\n\t\t */\n\t\tfullGC?: boolean;\n\t\t/**\n\t\t * True to run GC sweep phase after the mark phase\n\t\t */\n\t\trunSweep?: boolean;\n\t}): Promise<ISummaryTreeWithStats> {\n\t\tthis.verifyNotClosed();\n\n\t\tconst {\n\t\t\tfullTree = false,\n\t\t\ttrackState = true,\n\t\t\tsummaryLogger = this.mc.logger,\n\t\t\trunGC = this.garbageCollector.shouldRunGC,\n\t\t\trunSweep,\n\t\t\tfullGC,\n\t\t} = options;\n\n\t\tconst telemetryContext = new TelemetryContext();\n\t\t// Add the options that are used to generate this summary to the telemetry context.\n\t\ttelemetryContext.setMultiple(\"fluid_Summarize\", \"Options\", {\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\trunGC,\n\t\t\tfullGC,\n\t\t\trunSweep,\n\t\t});\n\n\t\ttry {\n\t\t\tif (runGC) {\n\t\t\t\tawait this.collectGarbage(\n\t\t\t\t\t{ logger: summaryLogger, runSweep, fullGC },\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst { stats, summary } = await this.summarizerNode.summarize(\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tsummary.type === SummaryType.Tree,\n\t\t\t\t0x12f /* \"Container Runtime's summarize should always return a tree\" */,\n\t\t\t);\n\n\t\t\treturn { stats, summary };\n\t\t} finally {\n\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"SummarizeTelemetry\",\n\t\t\t\tdetails: telemetryContext.serialize(),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async getGCDataInternal(fullGC?: boolean): Promise<IGarbageCollectionData> {\n\t\treturn this.channelCollection.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates and returns the GC data for this container.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t * @see IGarbageCollectionRuntime.getGCData\n\t */\n\tpublic async getGCData(fullGC?: boolean): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\tconst dsGCData = await this.summarizerNode.getGCData(fullGC);\n\t\tbuilder.addNodes(dsGCData.gcNodes);\n\n\t\tconst blobsGCData = this.blobManager.getGCData(fullGC);\n\t\tbuilder.addNodes(blobsGCData.gcNodes);\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this container's nodes of routes that are used in it.\n\t * @param usedRoutes - The routes that are used in all nodes in this Container.\n\t * @see IGarbageCollectionRuntime.updateUsedRoutes\n\t */\n\tpublic updateUsedRoutes(usedRoutes: readonly string[]): void {\n\t\t// Update our summarizer node's used routes. Updating used routes in summarizer node before\n\t\t// summarizing is required and asserted by the the summarizer node. We are the root and are\n\t\t// always referenced, so the used routes is only self-route (empty string).\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\n\t\tconst { dataStoreRoutes } = this.getDataStoreAndBlobManagerRoutes(usedRoutes);\n\t\tthis.channelCollection.updateUsedRoutes(dataStoreRoutes);\n\t}\n\n\t/**\n\t * After GC has run and identified nodes that are sweep ready, this is called to delete the sweep ready nodes.\n\t * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.\n\t * @returns The routes of nodes that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[] {\n\t\tconst { dataStoreRoutes, blobManagerRoutes } =\n\t\t\tthis.getDataStoreAndBlobManagerRoutes(sweepReadyRoutes);\n\n\t\treturn [\n\t\t\t...this.channelCollection.deleteSweepReadyNodes(dataStoreRoutes),\n\t\t\t...this.blobManager.deleteSweepReadyNodes(blobManagerRoutes),\n\t\t];\n\t}\n\n\t/**\n\t * This is called to update objects that are tombstones.\n\t *\n\t * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.\n\t * Tombstoned objects are eventually deleted by GC.\n\t *\n\t * @param tombstonedRoutes - Data store and attachment blob routes that are tombstones in this Container.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void {\n\t\tconst { dataStoreRoutes } = this.getDataStoreAndBlobManagerRoutes(tombstonedRoutes);\n\t\tthis.channelCollection.updateTombstonedRoutes(dataStoreRoutes);\n\t}\n\n\t/**\n\t * Returns a server generated referenced timestamp to be used to track unreferenced nodes by GC.\n\t */\n\tpublic getCurrentReferenceTimestampMs(): number | undefined {\n\t\t// Use the timestamp of the last message seen by this client as that is server generated. If no messages have\n\t\t// been processed, use the timestamp of the message from the last summary.\n\t\treturn this.deltaManager.lastMessage?.timestamp ?? this.messageAtLastSummary?.timestamp;\n\t}\n\n\t/**\n\t * Returns the type of the GC node. Currently, there are nodes that belong to the root (\"/\"), data stores or\n\t * blob manager.\n\t */\n\n\tpublic getNodeType(nodePath: string): GCNodeType {\n\t\tif (isBlobPath(nodePath)) {\n\t\t\treturn GCNodeType.Blob;\n\t\t}\n\n\t\treturn this.channelCollection.getGCNodeType(nodePath) ?? GCNodeType.Other;\n\t}\n\n\t/**\n\t * Called by GC to retrieve the package path of the node with the given path. The node should belong to a\n\t * data store or an attachment blob.\n\t */\n\tpublic async getGCNodePackagePath(nodePath: string): Promise<readonly string[] | undefined> {\n\t\t// GC uses \"/\" when adding \"root\" references, e.g. for Aliasing or as part of Tombstone Auto-Recovery.\n\t\t// These have no package path so return a special value.\n\t\tif (nodePath === \"/\") {\n\t\t\treturn [\"_gcRoot\"];\n\t\t}\n\n\t\tswitch (this.getNodeType(nodePath)) {\n\t\t\tcase GCNodeType.Blob: {\n\t\t\t\treturn [blobManagerBasePath];\n\t\t\t}\n\n\t\t\tcase GCNodeType.DataStore:\n\n\t\t\tcase GCNodeType.SubDataStore: {\n\t\t\t\treturn this.channelCollection.getDataStorePackagePath(nodePath);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tassert(false, 0x2de /* \"Package path requested for unsupported node type.\" */);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * From a given list of routes, separate and return routes that belong to blob manager and data stores.\n\t * @param routes - A list of routes that can belong to data stores or blob manager.\n\t * @returns Two route lists - One that contains routes for blob manager and another one that contains routes\n\t * for data stores.\n\t */\n\tprivate getDataStoreAndBlobManagerRoutes(routes: readonly string[]): {\n\t\tblobManagerRoutes: string[];\n\t\tdataStoreRoutes: string[];\n\t} {\n\t\tconst blobManagerRoutes: string[] = [];\n\t\tconst dataStoreRoutes: string[] = [];\n\t\tfor (const route of routes) {\n\t\t\tif (isBlobPath(route)) {\n\t\t\t\tblobManagerRoutes.push(route);\n\t\t\t} else {\n\t\t\t\tdataStoreRoutes.push(route);\n\t\t\t}\n\t\t}\n\t\treturn { blobManagerRoutes, dataStoreRoutes };\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns the statistics of the garbage collection run; undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/**\n\t\t\t * Logger to use for logging GC events\n\t\t\t */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/**\n\t\t\t * True to run GC sweep phase after the mark phase\n\t\t\t */\n\t\t\trunSweep?: boolean;\n\t\t\t/**\n\t\t\t * True to generate full GC data\n\t\t\t */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\treturn this.garbageCollector.collectGarbage(options, telemetryContext);\n\t}\n\n\t/**\n\t * Called when a new outbound route is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param fromPath - The absolute path of the node that added the reference.\n\t * @param toPath - The absolute path of the outbound node that is referenced.\n\t * @param messageTimestampMs - The timestamp of the message that added the reference.\n\t */\n\tpublic addedGCOutboundRoute(\n\t\tfromPath: string,\n\t\ttoPath: string,\n\t\tmessageTimestampMs?: number,\n\t): void {\n\t\t// This is always called when processing an op so messageTimestampMs should exist. Due to back-compat\n\t\t// across the data store runtime / container runtime boundary, this may be undefined and if so, get\n\t\t// the timestamp from the last processed message which should exist.\n\t\t// If a timestamp doesn't exist, log so we can learn about these cases and return.\n\t\tconst timestampMs = messageTimestampMs ?? this.getCurrentReferenceTimestampMs();\n\t\tif (timestampMs === undefined) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"NoTimestampInGCOutboundRoute\",\n\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\tid: toPath,\n\t\t\t\t\tfromId: fromPath,\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.garbageCollector.addedOutboundReference(fromPath, toPath, timestampMs);\n\t}\n\n\t/**\n\t * Generates the summary tree, uploads it to storage, and then submits the summarize op.\n\t * This is intended to be called by the summarizer, since it is the implementation of\n\t * ISummarizerInternalsProvider.submitSummary.\n\t * It takes care of state management at the container level, including pausing inbound\n\t * op processing, updating SummarizerNode state tracking, and garbage collection.\n\t * @param options - options controlling how the summary is generated or submitted\n\t */\n\n\tpublic async submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult> {\n\t\tconst {\n\t\t\tcancellationToken,\n\t\t\tfullTree = false,\n\t\t\tfinalAttempt = false,\n\t\t\tsummaryLogger,\n\t\t\tlatestSummaryRefSeqNum,\n\t\t} = options;\n\t\t// The summary number for this summary. This will be updated during the summary process, so get it now and\n\t\t// use it for all events logged during this summary.\n\t\tconst summaryNumber = this.nextSummaryNumber;\n\t\tlet summaryRefSeqNum: number | undefined;\n\t\tconst summaryNumberLogger = createChildLogger({\n\t\t\tlogger: summaryLogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tsummaryNumber,\n\t\t\t\t\treferenceSequenceNumber: () => summaryRefSeqNum,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\t// legacy: assert 0x3d1\n\t\tif (!this.outbox.isEmpty) {\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\"Can't trigger summary in the middle of a batch\",\n\t\t\t\t\"submitSummary\",\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tsummaryNumber,\n\t\t\t\t\tpendingMessages: this.pendingMessagesCount,\n\t\t\t\t\toutboxLength: this.outbox.messageCount,\n\t\t\t\t\tmainBatchLength: this.outbox.mainBatchMessageCount,\n\t\t\t\t\tblobAttachBatchLength: this.outbox.blobAttachBatchMessageCount,\n\t\t\t\t\tidAllocationBatchLength: this.outbox.idAllocationBatchMessageCount,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// If the container is dirty, i.e., there are pending unacked ops, the summary will not be eventual consistent\n\t\t// and it may even be incorrect. So, wait for the container to be saved with a timeout. If the container is not\n\t\t// saved within the timeout, check if it should be failed or can continue.\n\t\tif (this.isDirty) {\n\t\t\tconst countBefore = this.pendingMessagesCount;\n\t\t\t// The timeout for waiting for pending ops can be overridden via configurations.\n\t\t\tconst pendingOpsTimeout =\n\t\t\t\tthis.mc.config.getNumber(\"Fluid.Summarizer.waitForPendingOpsTimeoutMs\") ??\n\t\t\t\tdefaultPendingOpsWaitTimeoutMs;\n\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\tconst timeoutId = setTimeout(() => resolve(), pendingOpsTimeout);\n\t\t\t\tthis.once(\"saved\", () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t\tthis.once(\"dispose\", () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t\treject(new Error(\"Runtime is disposed while summarizing\"));\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// Log that there are pending ops while summarizing. This will help us gather data on how often this\n\t\t\t// happens, whether we attempted to wait for these ops to be acked and what was the result.\n\t\t\tsummaryNumberLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"PendingOpsWhileSummarizing\",\n\t\t\t\tsaved: !this.isDirty,\n\t\t\t\ttimeout: pendingOpsTimeout,\n\t\t\t\tcountBefore,\n\t\t\t\tcountAfter: this.pendingMessagesCount,\n\t\t\t});\n\n\t\t\t// There could still be pending ops. Check if summary should fail or continue.\n\t\t\tconst pendingMessagesFailResult = await this.shouldFailSummaryOnPendingOps(\n\t\t\t\tsummaryNumberLogger,\n\t\t\t\tthis.deltaManager.lastSequenceNumber,\n\t\t\t\tthis.deltaManager.minimumSequenceNumber,\n\t\t\t\tfinalAttempt,\n\t\t\t\ttrue /* beforeSummaryGeneration */,\n\t\t\t);\n\t\t\tif (pendingMessagesFailResult !== undefined) {\n\t\t\t\treturn pendingMessagesFailResult;\n\t\t\t}\n\t\t}\n\n\t\tconst shouldPauseInboundSignal =\n\t\t\tthis.mc.config.getBoolean(\n\t\t\t\t\"Fluid.ContainerRuntime.SubmitSummary.disableInboundSignalPause\",\n\t\t\t) !== true;\n\t\tconst shouldValidatePreSummaryState =\n\t\t\tthis.mc.config.getBoolean(\n\t\t\t\t\"Fluid.ContainerRuntime.SubmitSummary.shouldValidatePreSummaryState\",\n\t\t\t) === true;\n\n\t\ttry {\n\t\t\tawait this._deltaManager.inbound.pause();\n\t\t\tif (shouldPauseInboundSignal) {\n\t\t\t\tawait this.deltaManager.inboundSignal.pause();\n\t\t\t}\n\n\t\t\tsummaryRefSeqNum = this.deltaManager.lastSequenceNumber;\n\t\t\tconst minimumSequenceNumber = this.deltaManager.minimumSequenceNumber;\n\t\t\tconst message = `Summary @${summaryRefSeqNum}:${this.deltaManager.minimumSequenceNumber}`;\n\t\t\tconst lastAckedContext = this.lastAckedSummaryContext;\n\n\t\t\tconst startSummaryResult = this.summarizerNode.startSummary(\n\t\t\t\tsummaryRefSeqNum,\n\t\t\t\tsummaryNumberLogger,\n\t\t\t\tlatestSummaryRefSeqNum,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * This was added to validate that the summarizer node tree has the same reference sequence number from the\n\t\t\t * top running summarizer down to the lowest summarizer node.\n\t\t\t *\n\t\t\t * The order of mismatch numbers goes (validate sequence number)-(node sequence number).\n\t\t\t * Generally the validate sequence number comes from the running summarizer and the node sequence number comes from the\n\t\t\t * summarizer nodes.\n\t\t\t */\n\t\t\tif (startSummaryResult.invalidNodes > 0 || startSummaryResult.mismatchNumbers.size > 0) {\n\t\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"LatestSummaryRefSeqNumMismatch\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\t...startSummaryResult,\n\t\t\t\t\t\tmismatchNumbers: [...startSummaryResult.mismatchNumbers],\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tif (shouldValidatePreSummaryState && !finalAttempt) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstage: \"base\",\n\t\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\t\terror: new RetriableSummaryError(\n\t\t\t\t\t\t\t`Summarizer node state inconsistent with summarizer state.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Helper function to check whether we should still continue between each async step.\n\t\t\tconst checkContinue = (): { continue: true } | { continue: false; error: string } => {\n\t\t\t\t// Do not check for loss of connectivity directly! Instead leave it up to\n\t\t\t\t// RunWhileConnectedCoordinator to control policy in a single place.\n\t\t\t\t// This will allow easier change of design if we chose to. For example, we may chose to allow\n\t\t\t\t// summarizer to reconnect in the future.\n\t\t\t\t// Also checking for cancellation is a must as summary process may be abandoned for other reasons,\n\t\t\t\t// like loss of connectivity for main (interactive) client.\n\t\t\t\tif (cancellationToken.cancelled) {\n\t\t\t\t\treturn { continue: false, error: \"disconnected\" };\n\t\t\t\t}\n\t\t\t\t// That said, we rely on submitSystemMessage() that today only works in connected state.\n\t\t\t\t// So if we fail here, it either means that RunWhileConnectedCoordinator does not work correctly,\n\t\t\t\t// OR that design changed and we need to remove this check and fix submitSystemMessage.\n\t\t\t\tassert(this.connected, 0x258 /* \"connected\" */);\n\n\t\t\t\t// Ensure that lastSequenceNumber has not changed after pausing.\n\t\t\t\t// We need the summary op's reference sequence number to match our summary sequence number,\n\t\t\t\t// otherwise we'll get the wrong sequence number stamped on the summary's .protocol attributes.\n\t\t\t\tif (this.deltaManager.lastSequenceNumber !== summaryRefSeqNum) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontinue: false,\n\t\t\t\t\t\terror: `lastSequenceNumber changed before uploading to storage. ${this.deltaManager.lastSequenceNumber} !== ${summaryRefSeqNum}`,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tassert(\n\t\t\t\t\tsummaryRefSeqNum === this.deltaManager.lastMessage?.sequenceNumber,\n\t\t\t\t\t0x395 /* it's one and the same thing */,\n\t\t\t\t);\n\n\t\t\t\tif (lastAckedContext !== this.lastAckedSummaryContext) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontinue: false,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\t\t\terror: `Last summary changed while summarizing. ${this.lastAckedSummaryContext} !== ${lastAckedContext}`,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn { continue: true };\n\t\t\t};\n\n\t\t\tlet continueResult = checkContinue();\n\t\t\tif (!continueResult.continue) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"base\",\n\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\terror: new RetriableSummaryError(continueResult.error),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst trace = Trace.start();\n\t\t\tlet summarizeResult: ISummaryTreeWithStats;\n\t\t\ttry {\n\t\t\t\tsummarizeResult = await this.summarize({\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrackState: true,\n\t\t\t\t\tsummaryLogger: summaryNumberLogger,\n\t\t\t\t\trunGC: this.garbageCollector.shouldRunGC,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"base\",\n\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Validate that the summary generated by summarizer nodes is correct before uploading.\n\t\t\tconst validateResult = this.summarizerNode.validateSummary();\n\t\t\tif (!validateResult.success) {\n\t\t\t\tconst { success, ...loggingProps } = validateResult;\n\t\t\t\tconst error = new RetriableSummaryError(\n\t\t\t\t\tvalidateResult.reason,\n\t\t\t\t\tvalidateResult.retryAfterSeconds,\n\t\t\t\t\t{ ...loggingProps },\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"base\",\n\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\terror,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// If there are pending unacked ops, this summary attempt may fail as the uploaded\n\t\t\t// summary would be eventually inconsistent.\n\t\t\tconst pendingMessagesFailResult = await this.shouldFailSummaryOnPendingOps(\n\t\t\t\tsummaryNumberLogger,\n\t\t\t\tsummaryRefSeqNum,\n\t\t\t\tminimumSequenceNumber,\n\t\t\t\tfinalAttempt,\n\t\t\t\tfalse /* beforeSummaryGeneration */,\n\t\t\t);\n\t\t\tif (pendingMessagesFailResult !== undefined) {\n\t\t\t\treturn pendingMessagesFailResult;\n\t\t\t}\n\n\t\t\tconst { summary: summaryTree, stats: partialStats } = summarizeResult;\n\n\t\t\t// Now that we have generated the summary, update the message at last summary to the last message processed.\n\t\t\tthis.messageAtLastSummary = this.deltaManager.lastMessage;\n\n\t\t\t// Counting dataStores and handles\n\t\t\t// Because handles are unchanged dataStores in the current logic,\n\t\t\t// summarized dataStore count is total dataStore count minus handle count\n\t\t\tconst dataStoreTree: SummaryObject | undefined = summaryTree.tree[channelsTreeName];\n\n\t\t\tassert(dataStoreTree?.type === SummaryType.Tree, 0x1fc /* \"summary is not a tree\" */);\n\t\t\tconst handleCount = Object.values(dataStoreTree.tree).filter(\n\t\t\t\t(value) => value.type === SummaryType.Handle,\n\t\t\t).length;\n\t\t\tconst gcSummaryTreeStats =\n\t\t\t\tsummaryTree.tree[gcTreeKey] === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: calculateStats(summaryTree.tree[gcTreeKey]);\n\n\t\t\tconst summaryStats: IGeneratedSummaryStats = {\n\t\t\t\tdataStoreCount: this.channelCollection.size,\n\t\t\t\tsummarizedDataStoreCount: this.channelCollection.size - handleCount,\n\t\t\t\tgcStateUpdatedDataStoreCount: this.garbageCollector.updatedDSCountSinceLastSummary,\n\t\t\t\tgcBlobNodeCount: gcSummaryTreeStats?.blobNodeCount,\n\t\t\t\tgcTotalBlobsSize: gcSummaryTreeStats?.totalBlobSize,\n\t\t\t\tsummaryNumber,\n\t\t\t\t...partialStats,\n\t\t\t};\n\t\t\tconst generateSummaryData: Omit<IGenerateSummaryTreeResult, \"stage\" | \"error\"> = {\n\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\tminimumSequenceNumber,\n\t\t\t\tsummaryTree,\n\t\t\t\tsummaryStats,\n\t\t\t\tgenerateDuration: trace.trace().duration,\n\t\t\t} as const;\n\n\t\t\tcontinueResult = checkContinue();\n\t\t\tif (!continueResult.continue) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"generate\",\n\t\t\t\t\t...generateSummaryData,\n\t\t\t\t\terror: new RetriableSummaryError(continueResult.error),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst summaryContext: ISummaryContext = {\n\t\t\t\tproposalHandle: this.lastAckedSummaryContext?.proposalHandle ?? undefined,\n\t\t\t\tackHandle: this.lastAckedSummaryContext?.ackHandle ?? this.loadedFromVersionId,\n\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t};\n\n\t\t\tlet handle: string;\n\t\t\ttry {\n\t\t\t\thandle = await this.storage.uploadSummaryWithContext(summaryTree, summaryContext);\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"generate\",\n\t\t\t\t\t...generateSummaryData,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parent = summaryContext.ackHandle;\n\t\t\tconst summaryMessage: ISummaryContent = {\n\t\t\t\thandle,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\thead: parent!,\n\t\t\t\tmessage,\n\t\t\t\tparents: parent === undefined ? [] : [parent],\n\t\t\t};\n\t\t\tconst uploadData = {\n\t\t\t\t...generateSummaryData,\n\t\t\t\thandle,\n\t\t\t\tuploadDuration: trace.trace().duration,\n\t\t\t} as const;\n\n\t\t\tcontinueResult = checkContinue();\n\t\t\tif (!continueResult.continue) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"upload\",\n\t\t\t\t\t...uploadData,\n\t\t\t\t\terror: new RetriableSummaryError(continueResult.error),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet clientSequenceNumber: number;\n\t\t\ttry {\n\t\t\t\tclientSequenceNumber = this.submitSummaryMessage(summaryMessage, summaryRefSeqNum);\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"upload\",\n\t\t\t\t\t...uploadData,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst submitData = {\n\t\t\t\tstage: \"submit\",\n\t\t\t\t...uploadData,\n\t\t\t\tclientSequenceNumber,\n\t\t\t\tsubmitOpDuration: trace.trace().duration,\n\t\t\t} as const;\n\n\t\t\ttry {\n\t\t\t\tthis.summarizerNode.completeSummary(handle);\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"upload\",\n\t\t\t\t\t...uploadData,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn submitData;\n\t\t} finally {\n\t\t\t// Cleanup wip summary in case of failure\n\t\t\tthis.summarizerNode.clearSummary();\n\n\t\t\t// ! This needs to happen before we resume inbound queues to ensure heuristics are tracked correctly\n\t\t\tthis._summarizer?.recordSummaryAttempt?.(summaryRefSeqNum);\n\n\t\t\t// Restart the delta manager\n\t\t\tthis._deltaManager.inbound.resume();\n\t\t\tif (shouldPauseInboundSignal) {\n\t\t\t\tthis.deltaManager.inboundSignal.resume();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * This helper is called during summarization. If the container is dirty, it will return a failed summarize result\n\t * (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.\n\t * @param logger - The logger to be used for sending telemetry.\n\t * @param referenceSequenceNumber - The reference sequence number of the summary attempt.\n\t * @param minimumSequenceNumber - The minimum sequence number of the summary attempt.\n\t * @param finalAttempt - Whether this is the final summary attempt.\n\t * @param beforeSummaryGeneration - Whether this is called before summary generation or after.\n\t * @returns failed summarize result (IBaseSummarizeResult) if summary should be failed, undefined otherwise.\n\t */\n\tprivate async shouldFailSummaryOnPendingOps(\n\t\tlogger: ITelemetryLoggerExt,\n\t\treferenceSequenceNumber: number,\n\t\tminimumSequenceNumber: number,\n\t\tfinalAttempt: boolean,\n\t\tbeforeSummaryGeneration: boolean,\n\t): Promise<IBaseSummarizeResult | undefined> {\n\t\tif (!this.isDirty) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If \"SkipFailingIncorrectSummary\" option is true, don't fail the summary in the last attempt.\n\t\t// This is a fallback to make progress in documents where there are consistently pending ops in\n\t\t// the summarizer.\n\t\tif (\n\t\t\tfinalAttempt &&\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Summarizer.SkipFailingIncorrectSummary\") === true\n\t\t) {\n\t\t\tconst error = DataProcessingError.create(\n\t\t\t\t\"Pending ops during summarization\",\n\t\t\t\t\"submitSummary\",\n\t\t\t\tundefined,\n\t\t\t\t{ pendingMessages: this.pendingMessagesCount },\n\t\t\t);\n\t\t\tlogger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"SkipFailingIncorrectSummary\",\n\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\tbeforeGenerate: beforeSummaryGeneration,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t} else {\n\t\t\t// The retry delay when there are pending ops can be overridden via config so that we can adjust it\n\t\t\t// based on telemetry while we decide on a stable number.\n\t\t\tconst retryDelayMs =\n\t\t\t\tthis.mc.config.getNumber(\"Fluid.Summarizer.PendingOpsRetryDelayMs\") ??\n\t\t\t\tdefaultPendingOpsRetryDelayMs;\n\t\t\tconst error = new RetriableSummaryError(\n\t\t\t\t\"PendingOpsWhileSummarizing\",\n\t\t\t\tretryDelayMs / 1000,\n\t\t\t\t{\n\t\t\t\t\tcount: this.pendingMessagesCount,\n\t\t\t\t\tbeforeGenerate: beforeSummaryGeneration,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tstage: \"base\",\n\t\t\t\treferenceSequenceNumber,\n\t\t\t\tminimumSequenceNumber,\n\t\t\t\terror,\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate get pendingMessagesCount(): number {\n\t\treturn this.pendingStateManager.pendingMessagesCount + this.outbox.messageCount;\n\t}\n\n\tprivate hasPendingMessages(): boolean {\n\t\treturn this.pendingMessagesCount !== 0;\n\t}\n\n\t/**\n\t * Emit \"dirty\" or \"saved\" event based on the current dirty state of the document.\n\t * This must be called every time the states underlying the dirty state change.\n\t *\n\t * @privateRemarks It's helpful to think of this as an event handler registered\n\t * for hypothetical \"changed\" events for PendingStateManager, Outbox, and Container Attach machinery.\n\t * But those events don't exist so we manually call this wherever we know those changes happen.\n\t */\n\tprivate updateDocumentDirtyState(): void {\n\t\tconst dirty: boolean = this.computeCurrentDirtyState();\n\n\t\tif (this.lastEmittedDirty === dirty) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastEmittedDirty = dirty;\n\t\tif (this.emitDirtyDocumentEvent) {\n\t\t\tthis.emit(dirty ? \"dirty\" : \"saved\");\n\t\t}\n\t}\n\n\t// Keep in sync with IFluidRootParentContextPrivate.submitMessage.\n\tpublic submitMessage(\n\t\tcontainerRuntimeMessage:\n\t\t\t| ContainerRuntimeDataStoreOpMessage\n\t\t\t| OutboundContainerRuntimeAttachMessage\n\t\t\t| ContainerRuntimeAliasMessage,\n\t\tlocalOpMetadata: unknown = undefined,\n\t): void {\n\t\tthis.submit(containerRuntimeMessage, localOpMetadata);\n\t}\n\n\tpublic async uploadBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\tthis.verifyNotClosed();\n\t\treturn this.blobManager.createBlob(blob, signal);\n\t}\n\n\t/**\n\t * Lookup the blob storage ID for a given local blob id.\n\t * @param localId - The local blob id. Likely coming from a handle.\n\t * @returns The storage ID if found and the blob is not pending, undefined otherwise.\n\t * @remarks\n\t * This method provides access to the BlobManager's storage ID lookup functionality.\n\t * For blobs with pending payloads (localId exists but upload hasn't finished), this returns undefined.\n\t * Consumers should use the observability APIs on the handle to understand/wait for storage ID availability.\n\t *\n\t * Warning: the returned blob URL may expire and does not support permalinks.\n\t * This API is intended for temporary integration scenarios only.\n\t */\n\tpublic lookupTemporaryBlobStorageId(localId: string): string | undefined {\n\t\treturn this.blobManager.lookupTemporaryBlobStorageId(localId);\n\t}\n\n\tprivate submitIdAllocationOpIfNeeded({\n\t\tresubmitOutstandingRanges = false,\n\t\tstaged,\n\t}: {\n\t\tresubmitOutstandingRanges?: boolean;\n\t\tstaged: boolean;\n\t}): void {\n\t\tif (this._idCompressor) {\n\t\t\tconst idRange = resubmitOutstandingRanges\n\t\t\t\t? this._idCompressor.takeUnfinalizedCreationRange()\n\t\t\t\t: this._idCompressor.takeNextCreationRange();\n\t\t\t// Don't include the idRange if there weren't any Ids allocated\n\t\t\tif (idRange.ids !== undefined) {\n\t\t\t\tconst idAllocationMessage: ContainerRuntimeIdAllocationMessage = {\n\t\t\t\t\ttype: ContainerMessageType.IdAllocation,\n\t\t\t\t\tcontents: idRange,\n\t\t\t\t};\n\t\t\t\tconst idAllocationBatchMessage: LocalBatchMessage = {\n\t\t\t\t\truntimeOp: idAllocationMessage,\n\t\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\t\tstaged,\n\t\t\t\t};\n\t\t\t\tthis.outbox.submitIdAllocation(idAllocationBatchMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate submit(\n\t\tcontainerRuntimeMessage: LocalContainerRuntimeMessage,\n\t\tlocalOpMetadata: unknown = undefined,\n\t\tmetadata?: { localId: string; blobId?: string },\n\t): void {\n\t\tthis.verifyNotClosed();\n\n\t\t// There should be no ops in detached container state!\n\t\tassert(\n\t\t\tthis.attachState !== AttachState.Detached,\n\t\t\t0x132 /* \"sending ops in detached container\" */,\n\t\t);\n\n\t\tassert(\n\t\t\tmetadata === undefined ||\n\t\t\t\tcontainerRuntimeMessage.type === ContainerMessageType.BlobAttach,\n\t\t\t0x93f /* metadata */,\n\t\t);\n\n\t\t// Note that the real (non-proxy) delta manager is used here to get the readonly info. This is because\n\t\t// container runtime's ability to submit ops depend on the actual readonly state of the delta manager.\n\t\tif (this.innerDeltaManager.readOnlyInfo.readonly === true) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"SubmitOpInReadonly\",\n\t\t\t\tconnected: this.connected,\n\t\t\t});\n\t\t}\n\n\t\tconst type = containerRuntimeMessage.type;\n\t\tassert(\n\t\t\ttype !== ContainerMessageType.IdAllocation,\n\t\t\t0x9a5 /* IdAllocation should be submitted directly to outbox. */,\n\t\t);\n\n\t\ttry {\n\t\t\t// If we're resubmitting a batch, keep the same \"staged\" value as before. Otherwise, use the current \"global\" state.\n\t\t\tconst staged = this.batchRunner.resubmitInfo?.staged ?? this.inStagingMode;\n\n\t\t\tassert(\n\t\t\t\t!staged || canStageMessageOfType(type),\n\t\t\t\t0xbba /* Unexpected message type submitted in Staging Mode */,\n\t\t\t);\n\n\t\t\t// Before submitting any non-staged change, submit the ID Allocation op to cover any compressed IDs included in the op.\n\t\t\tif (!staged) {\n\t\t\t\tthis.submitIdAllocationOpIfNeeded({ staged: false });\n\t\t\t}\n\n\t\t\t// Allow document schema controller to send a message if it needs to propose change in document schema.\n\t\t\t// If it needs to send a message, it will call provided callback with payload of such message and rely\n\t\t\t// on this callback to do actual sending.\n\t\t\tconst schemaChangeMessage = this.documentsSchemaController.maybeGenerateSchemaMessage();\n\t\t\tif (schemaChangeMessage) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"SchemaChangeProposal\",\n\t\t\t\t\trefSeq: schemaChangeMessage.refSeq,\n\t\t\t\t\tversion: schemaChangeMessage.version,\n\t\t\t\t\tnewRuntimeSchema: JSON.stringify(schemaChangeMessage.runtime),\n\t\t\t\t\tsessionRuntimeSchema: JSON.stringify(this.sessionSchema),\n\t\t\t\t\toldRuntimeSchema: JSON.stringify(this.metadata?.documentSchema?.runtime),\n\t\t\t\t\tminVersionForCollab: schemaChangeMessage.info?.minVersionForCollab,\n\t\t\t\t});\n\t\t\t\tconst msg: OutboundContainerRuntimeDocumentSchemaMessage = {\n\t\t\t\t\ttype: ContainerMessageType.DocumentSchemaChange,\n\t\t\t\t\tcontents: schemaChangeMessage,\n\t\t\t\t};\n\t\t\t\tthis.outbox.submit({\n\t\t\t\t\truntimeOp: msg,\n\t\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\t\tstaged,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst message: LocalBatchMessage = {\n\t\t\t\t// This will encode any handles present in this op before serializing to string\n\t\t\t\t// Note: handles may already have been encoded by the DDS layer, but encoding handles is idempotent so there's no problem.\n\t\t\t\truntimeOp: containerRuntimeMessage,\n\t\t\t\tmetadata,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\tstaged,\n\t\t\t};\n\t\t\tif (type === ContainerMessageType.BlobAttach) {\n\t\t\t\t// BlobAttach ops must have their metadata visible and cannot be grouped (see opGroupingManager.ts)\n\t\t\t\tthis.outbox.submitBlobAttach(message);\n\t\t\t} else {\n\t\t\t\tthis.outbox.submit(message);\n\t\t\t}\n\n\t\t\tthis.scheduleFlush();\n\t\t} catch (error) {\n\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(error, \"ContainerRuntime.submit\", {\n\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t});\n\t\t\tthis.closeFn(dpe);\n\t\t\tthrow dpe;\n\t\t}\n\n\t\tthis.updateDocumentDirtyState();\n\t}\n\n\tprivate scheduleFlush(): void {\n\t\tif (this.flushScheduled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.flushScheduled = true;\n\n\t\tswitch (this.flushMode) {\n\t\t\tcase FlushMode.Immediate: {\n\t\t\t\t// When in Immediate flush mode, flush immediately unless we are intentionally batching multiple ops (e.g. via orderSequentially)\n\t\t\t\tif (!this.batchRunner.running) {\n\t\t\t\t\tthis.flush();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase FlushMode.TurnBased: {\n\t\t\t\t// When in TurnBased flush mode the runtime will buffer operations in the current turn and send them as a single\n\t\t\t\t// batch at the end of the turn\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises -- Container will close if flush throws\n\t\t\t\tPromise.resolve().then(() => this.flush());\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// FlushModeExperimental is experimental and not exposed directly in the runtime APIs\n\t\t\tcase FlushModeExperimental.Async as unknown as FlushMode: {\n\t\t\t\t// When in Async flush mode, the runtime will accumulate all operations across JS turns and send them as a single\n\t\t\t\t// batch when all micro-tasks are complete.\n\t\t\t\t// Compared to TurnBased, this flush mode will capture more ops into the same batch.\n\t\t\t\tsetTimeout(() => this.flush(), 0);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tfail(0x587 /* Unreachable unless manually accumulating a batch */);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate submitSummaryMessage(\n\t\tcontents: ISummaryContent,\n\t\treferenceSequenceNumber: number,\n\t): number {\n\t\tthis.verifyNotClosed();\n\t\tassert(\n\t\t\tthis.connected,\n\t\t\t0x133 /* \"Container disconnected when trying to submit system message\" */,\n\t\t);\n\n\t\t// System message should not be sent in the middle of the batch.\n\t\tassert(this.outbox.isEmpty, 0x3d4 /* System op in the middle of a batch */);\n\n\t\treturn this.submitSummaryFn(contents, referenceSequenceNumber);\n\t}\n\n\t/**\n\t * Throw an error if the runtime is closed. Methods that are expected to potentially\n\t * be called after dispose due to asynchrony should not call this.\n\t */\n\tprivate verifyNotClosed(): void {\n\t\tif (this._disposed) {\n\t\t\tthrow new Error(\"Runtime is closed\");\n\t\t}\n\t}\n\n\t/**\n\t * Resubmits each message in the batch, and then flushes the outbox.\n\t * This typically happens when we reconnect and there are pending messages.\n\t *\n\t * @remarks\n\t * Attempting to resubmit a batch that has been successfully sequenced will not happen due to\n\t * checks in the ConnectionStateHandler (Loader layer)\n\t *\n\t * The only exception to this would be if the Container \"forks\" due to misuse of the \"Offline Load\" feature.\n\t * If the \"Offline Load\" feature is enabled, the batchId is included in the resubmitted messages,\n\t * for correlation to detect container forking.\n\t */\n\tprivate reSubmitBatch(\n\t\tbatch: PendingMessageResubmitData[],\n\t\t{ batchId, staged, squash }: PendingBatchResubmitMetadata,\n\t): void {\n\t\tassert(\n\t\t\tthis._summarizer === undefined,\n\t\t\t0x8f2 /* Summarizer never reconnects so should never resubmit */,\n\t\t);\n\n\t\tconst resubmitInfo = {\n\t\t\t// Only include Batch ID if \"Offline Load\" feature is enabled\n\t\t\t// It's only needed to identify batches across container forks arising from misuse of offline load.\n\t\t\tbatchId: this.batchIdTrackingEnabled ? batchId : undefined,\n\t\t\tstaged,\n\t\t};\n\n\t\tconst resubmitFn = squash\n\t\t\t? this.reSubmitWithSquashing.bind(this)\n\t\t\t: this.reSubmit.bind(this);\n\n\t\tthis.batchRunner.run(() => {\n\t\t\tfor (const message of batch) {\n\t\t\t\tresubmitFn(message);\n\t\t\t}\n\t\t}, resubmitInfo);\n\n\t\tthis.flush(resubmitInfo);\n\t}\n\n\t/**\n\t * Resubmit the given message as part of a squash rebase upon exiting Staging Mode.\n\t * How exactly to resubmit the message is up to the subsystem that submitted the op to begin with.\n\t */\n\tprivate reSubmitWithSquashing(resubmitData: PendingMessageResubmitData): void {\n\t\tconst message = resubmitData.runtimeOp;\n\t\tassert(\n\t\t\tcanStageMessageOfType(message.type),\n\t\t\t0xbbb /* Expected message type to be compatible with staging */,\n\t\t);\n\t\tswitch (message.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp: {\n\t\t\t\tthis.channelCollection.reSubmitContainerMessage(\n\t\t\t\t\tmessage,\n\t\t\t\t\tresubmitData.localOpMetadata,\n\t\t\t\t\t/* squash: */ true,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// NOTE: Squash doesn't apply to GC or DocumentSchemaChange ops, fallback to typical resubmit logic.\n\t\t\tcase ContainerMessageType.GC:\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\tthis.reSubmit(resubmitData);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(message.type);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Resubmit the given message which was previously submitted to the ContainerRuntime but not successfully\n\t * transmitted to the ordering service (e.g. due to a disconnect, or being in Staging Mode)\n\t * How to resubmit is up to the subsystem that submitted the op to begin with\n\t */\n\tprivate reSubmit({\n\t\truntimeOp: message,\n\t\tlocalOpMetadata,\n\t\topMetadata,\n\t}: PendingMessageResubmitData): void {\n\t\tswitch (message.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Attach:\n\t\t\tcase ContainerMessageType.Alias: {\n\t\t\t\t// Call reSubmitContainerMessage which will find the right store\n\t\t\t\t// and trigger resubmission on it.\n\t\t\t\tthis.channelCollection.reSubmitContainerMessage(\n\t\t\t\t\tmessage,\n\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t\t/* squash: */ false,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation: {\n\t\t\t\t// Allocation ops are never resubmitted/rebased. This is because they require special handling to\n\t\t\t\t// avoid being submitted out of order. For example, if the pending state manager contained\n\t\t\t\t// [idOp1, dataOp1, idOp2, dataOp2] and the resubmission of dataOp1 generated idOp3, that would be\n\t\t\t\t// placed into the outbox in the same batch as idOp1, but before idOp2 is resubmitted.\n\t\t\t\t// To avoid this, allocation ops are simply never resubmitted. Prior to invoking the pending state\n\t\t\t\t// manager to replay pending ops, the runtime will always submit a new allocation range that includes\n\t\t\t\t// all pending IDs. The resubmitted allocation ops are then ignored here.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\tthis.blobManager.reSubmit(opMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tthis.submit(message);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\tthis.submit(message);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\t// We shouldn't directly resubmit due to Compare-And-Swap semantics.\n\t\t\t\t// If needed it will be generated from scratch before other ops are submitted.\n\t\t\t\tthis.documentsSchemaController.pendingOpNotAcked();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst error = getUnknownMessageTypeError(message.type, \"reSubmitCore\" /* codePath */);\n\t\t\t\tthis.closeFn(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rollback the given op which was only staged but not yet submitted.\n\t */\n\tprivate rollbackStagedChange(\n\t\t{ type, contents }: LocalContainerRuntimeMessage,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tassert(canStageMessageOfType(type), 0xbbc /* Unexpected message type to be rolled back */);\n\n\t\tswitch (type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp: {\n\t\t\t\t// For operations, call rollbackDataStoreOp which will find the right store\n\t\t\t\t// and trigger rollback on it.\n\t\t\t\tthis.channelCollection.rollbackDataStoreOp(contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\t// Just drop it, but log an error, this is not expected and not ideal, but not critical failure either.\n\t\t\t\t// Currently the only expected type here is TombstoneLoaded, which will have been preceded by one of these events as well:\n\t\t\t\t// GC_Tombstone_DataStore_Requested, GC_Tombstone_SubDataStore_Requested, GC_Tombstone_Blob_Requested\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"GC_OpDiscarded\",\n\t\t\t\t\tdetails: { subType: contents.type },\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\t// Notify the document schema controller that the pending op was not acked.\n\t\t\t\t// This will allow it to propose the schema change again if needed.\n\t\t\t\tthis.documentsSchemaController.pendingOpNotAcked();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck\n\t */\n\tpublic async refreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void> {\n\t\tconst { proposalHandle, ackHandle, summaryRefSeq, summaryLogger } = options;\n\t\t// proposalHandle is always passed from RunningSummarizer.\n\t\tassert(proposalHandle !== undefined, 0x766 /* proposalHandle should be available */);\n\t\tconst result = await this.summarizerNode.refreshLatestSummary(\n\t\t\tproposalHandle,\n\t\t\tsummaryRefSeq,\n\t\t);\n\n\t\t/* eslint-disable jsdoc/check-indentation */\n\t\t/**\n\t\t * If the snapshot corresponding to the ack is not tracked by this client, it was submitted by another client.\n\t\t * Take action as per the following scenarios:\n\t\t * 1. If that snapshot is older than the one tracked by this client, ignore the ack because only the latest\n\t\t * snapshot is tracked.\n\t\t * 2. If that snapshot is newer, attempt to fetch the latest snapshot and do one of the following:\n\t\t * 2.1. If the fetched snapshot is same or newer than the one for which ack was received, close this client.\n\t\t * The next summarizer client will likely start from this snapshot and get out of this state. Fetching\n\t\t * the snapshot updates the cache for this client so if it's re-elected as summarizer, this will prevent\n\t\t * any thrashing.\n\t\t * 2.2. If the fetched snapshot is older than the one for which ack was received, ignore the ack. This can\n\t\t * happen in scenarios where the snapshot for the ack was lost in storage (in scenarios like DB rollback,\n\t\t * etc.) but the summary ack is still there because it's tracked a different service. In such cases,\n\t\t * ignoring the ack is the correct thing to do because the latest snapshot in storage is not the one for\n\t\t * the ack but is still the one tracked by this client. If we were to close the summarizer like in the\n\t\t * previous scenario, it will result in this document stuck in this state in a loop.\n\t\t */\n\t\t/* eslint-enable jsdoc/check-indentation */\n\t\tif (!result.isSummaryTracked) {\n\t\t\tif (result.isSummaryNewer) {\n\t\t\t\tawait this.fetchLatestSnapshotAndMaybeClose(summaryRefSeq, ackHandle, summaryLogger);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Notify the garbage collector so it can update its latest summary state.\n\t\tawait this.garbageCollector.refreshLatestSummary(result);\n\n\t\t// If we here, the ack was tracked by this client. Update the summary context of the last ack.\n\t\tthis.lastAckedSummaryContext = {\n\t\t\tproposalHandle,\n\t\t\tackHandle,\n\t\t\treferenceSequenceNumber: summaryRefSeq,\n\t\t};\n\t}\n\n\tprivate readonly readAndParseBlob = async <T>(id: string): Promise<T> =>\n\t\treadAndParse<T>(this.storage, id);\n\n\t/**\n\t * Fetches the latest snapshot from storage. If the fetched snapshot is same or newer than the one for which ack\n\t * was received, close this client. Fetching the snapshot will update the cache for this client so if it's\n\t * re-elected as summarizer, this will prevent any thrashing.\n\t * If the fetched snapshot is older than the one for which ack was received, ignore the ack and return. This can\n\t * happen in scenarios where the snapshot for the ack was lost in storage in scenarios like DB rollback, etc.\n\t */\n\tprivate async fetchLatestSnapshotAndMaybeClose(\n\t\ttargetRefSeq: number,\n\t\ttargetAckHandle: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<void> {\n\t\tconst fetchedSnapshotRefSeq = await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"RefreshLatestSummaryAckFetch\" },\n\t\t\tasync (perfEvent: {\n\t\t\t\tend: (arg0: {\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tgetVersionDuration?: number | undefined;\n\t\t\t\t\t\tgetSnapshotDuration?: number | undefined;\n\t\t\t\t\t\tsnapshotRefSeq?: number | undefined;\n\t\t\t\t\t\tsnapshotVersion?: string | undefined;\n\t\t\t\t\t\tnewerSnapshotPresent?: boolean | undefined;\n\t\t\t\t\t\ttargetRefSeq?: number | undefined;\n\t\t\t\t\t\ttargetAckHandle?: string | undefined;\n\t\t\t\t\t};\n\t\t\t\t}) => void;\n\t\t\t}) => {\n\t\t\t\tconst props: {\n\t\t\t\t\tgetVersionDuration?: number;\n\t\t\t\t\tgetSnapshotDuration?: number;\n\t\t\t\t\tsnapshotRefSeq?: number;\n\t\t\t\t\tsnapshotVersion?: string;\n\t\t\t\t\tnewerSnapshotPresent?: boolean | undefined;\n\t\t\t\t\ttargetRefSeq?: number | undefined;\n\t\t\t\t\ttargetAckHandle?: string | undefined;\n\t\t\t\t} = { targetRefSeq, targetAckHandle };\n\t\t\t\tconst trace = Trace.start();\n\n\t\t\t\tlet snapshotTree: ISnapshotTree | null;\n\t\t\t\tconst scenarioName = \"RefreshLatestSummaryAckFetch\";\n\t\t\t\t// If loader supplied us the ISnapshot when loading, the new getSnapshotApi is supported and feature gate is ON, then use the\n\t\t\t\t// new API, otherwise it will reduce the service performance because the service will need to recalculate the full snapshot\n\t\t\t\t// in case previously getSnapshotApi was used and now we use the getVersions API.\n\t\t\t\tif (\n\t\t\t\t\tthis.isSnapshotInstanceOfISnapshot &&\n\t\t\t\t\tthis.storage.getSnapshot !== undefined &&\n\t\t\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2\") ===\n\t\t\t\t\t\ttrue\n\t\t\t\t) {\n\t\t\t\t\tconst snapshot = await this.storage.getSnapshot({\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\tfetchSource: FetchSource.noCache,\n\t\t\t\t\t});\n\t\t\t\t\tconst id = snapshot.snapshotTree.id;\n\t\t\t\t\tassert(id !== undefined, 0x9d0 /* id of the fetched snapshot should be defined */);\n\t\t\t\t\tprops.snapshotVersion = id;\n\t\t\t\t\tsnapshotTree = snapshot.snapshotTree;\n\t\t\t\t} else {\n\t\t\t\t\tconst versions = await this.storage.getVersions(\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t1,\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\tFetchSource.noCache,\n\t\t\t\t\t);\n\t\t\t\t\tassert(versions[0] !== undefined, 0x137 /* \"Failed to get version from storage\" */);\n\t\t\t\t\tsnapshotTree = await this.storage.getSnapshotTree(versions[0]);\n\t\t\t\t\tassert(!!snapshotTree, 0x138 /* \"Failed to get snapshot from storage\" */);\n\t\t\t\t\tprops.snapshotVersion = versions[0].id;\n\t\t\t\t}\n\n\t\t\t\tprops.getSnapshotDuration = trace.trace().duration;\n\n\t\t\t\tconst snapshotRefSeq = await seqFromTree(snapshotTree, this.readAndParseBlob);\n\t\t\t\tprops.snapshotRefSeq = snapshotRefSeq;\n\t\t\t\tprops.newerSnapshotPresent = snapshotRefSeq >= targetRefSeq;\n\n\t\t\t\tperfEvent.end({ details: props });\n\t\t\t\treturn snapshotRefSeq;\n\t\t\t},\n\t\t);\n\n\t\t// If the snapshot that was fetched is older than the target snapshot, return. The summarizer will not be closed\n\t\t// because the snapshot is likely deleted from storage and it so, closing the summarizer will result in the\n\t\t// document being stuck in this state.\n\t\tif (fetchedSnapshotRefSeq < targetRefSeq) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait delay(this.closeSummarizerDelayMs);\n\t\tthis._summarizer?.stop(\"latestSummaryStateStale\");\n\t\tthis.disposeFn();\n\t}\n\n\tpublic getPendingLocalState(props?: IGetPendingLocalStateProps): unknown {\n\t\t// AB#46464 - Add support for serializing pending state while in staging mode\n\t\tif (this.inStagingMode) {\n\t\t\tthrow new UsageError(\"getPendingLocalState is not yet supported in staging mode\");\n\t\t}\n\n\t\tthis.verifyNotClosed();\n\t\tif (props?.notifyImminentClosure === true) {\n\t\t\tthrow new UsageError(\"notifyImminentClosure is no longer supported in ContainerRuntime\");\n\t\t}\n\n\t\tif (this.batchRunner.running) {\n\t\t\tthrow new UsageError(\"can't get state while manually accumulating a batch\");\n\t\t}\n\n\t\t// Flush pending batch.\n\t\t// getPendingLocalState() is only exposed through Container.getPendingLocalState(), so it's safe\n\t\t// to close current batch.\n\t\tthis.flush();\n\n\t\treturn PerformanceEvent.timedExec<IPendingRuntimeState | undefined>(\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\teventName: \"getPendingLocalState\",\n\t\t\t},\n\t\t\t(event) => {\n\t\t\t\tconst pending = this.pendingStateManager.getLocalState(props?.snapshotSequenceNumber);\n\t\t\t\tconst sessionExpiryTimerStarted =\n\t\t\t\t\tprops?.sessionExpiryTimerStarted ?? this.garbageCollector.sessionExpiryTimerStarted;\n\n\t\t\t\tconst pendingIdCompressorState = this._idCompressor?.serialize(true);\n\t\t\t\tconst pendingAttachmentBlobs = this.blobManager.getPendingBlobs();\n\n\t\t\t\tconst pendingRuntimeState: IPendingRuntimeState = {\n\t\t\t\t\tpending,\n\t\t\t\t\tpendingIdCompressorState,\n\t\t\t\t\tpendingAttachmentBlobs,\n\t\t\t\t\tsessionExpiryTimerStarted,\n\t\t\t\t};\n\t\t\t\tevent.end({\n\t\t\t\t\tattachmentBlobsSize: Object.keys(pendingAttachmentBlobs ?? {}).length,\n\t\t\t\t\tpendingOpsSize: pendingRuntimeState?.pending?.pendingStates.length,\n\t\t\t\t});\n\t\t\t\treturn pendingRuntimeState;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * ContainerRuntime knows about additional restrictions on when blob sharing can be resumed as compared\n\t * to BlobManager. In particular, it wants to avoid sharing blobs while in readonly state, and it also\n\t * wants to avoid sharing blobs before connection completes (otherwise it may cause the sharing to happen\n\t * before processing shared ops).\n\t *\n\t * This method can be called safely before those conditions are met. In the background, it will wait until\n\t * it is safe before initiating sharing. It will close the container on any error.\n\t */\n\tpublic sharePendingBlobs = (): void => {\n\t\tnew Promise<void>((resolve) => {\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t\tconst canStartSharing = (): boolean =>\n\t\t\t\tthis.connected && this.deltaManager.readOnlyInfo.readonly !== true;\n\n\t\t\tif (canStartSharing()) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst checkCanShare = (readonly: boolean): void => {\n\t\t\t\tif (canStartSharing()) {\n\t\t\t\t\tthis.deltaManager.off(\"readonly\", checkCanShare);\n\t\t\t\t\tthis.off(\"connected\", checkCanShare);\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis.deltaManager.on(\"readonly\", checkCanShare);\n\t\t\tthis.on(\"connected\", checkCanShare);\n\t\t})\n\t\t\t.then(this.blobManager.sharePendingBlobs)\n\t\t\t// It may not be necessary to close the container on failures - this should just mean there's\n\t\t\t// a handle in the container that is stuck pending, which is a scenario that customers need to\n\t\t\t// handle anyway. Starting with this more aggressive/restrictive behavior to be cautious.\n\t\t\t.catch(this.closeFn);\n\t};\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\tif (this._summarizer !== undefined) {\n\t\t\treturn this._summarizer.summarizeOnDemand(options);\n\t\t} else if (this.summaryManager === undefined) {\n\t\t\t// If we're not the summarizer, and we don't have a summaryManager, we expect that\n\t\t\t// disableSummaries is turned on. We are throwing instead of returning a failure here,\n\t\t\t// because it is a misuse of the API rather than an expected failure.\n\t\t\tthrow new UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);\n\t\t} else {\n\t\t\treturn this.summaryManager.summarizeOnDemand(options);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (this._summarizer !== undefined) {\n\t\t\treturn this._summarizer.enqueueSummarize(options);\n\t\t} else if (this.summaryManager === undefined) {\n\t\t\t// If we're not the summarizer, and we don't have a summaryManager, we expect that\n\t\t\t// generateSummaries is turned off. We are throwing instead of returning a failure here,\n\t\t\t// because it is a misuse of the API rather than an expected failure.\n\t\t\tthrow new UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);\n\t\t} else {\n\t\t\treturn this.summaryManager.enqueueSummarize(options);\n\t\t}\n\t}\n\n\t// While internal, ContainerRuntime has not been converted to use the new events support.\n\t// Recreate the required events (new pattern) with injected, wrapper new emitter.\n\t// It is lazily create to avoid listeners (old events) that ultimately go nowhere.\n\tprivate readonly lazyEventsForExtensions = new Lazy<Listenable<ExtensionHostEvents>>(() => {\n\t\tconst eventEmitter = createEmitter<ExtensionHostEvents>();\n\t\tif (this.getConnectionState) {\n\t\t\tthis.on(\"connectedToService\", (clientId: string, canWrite: boolean) => {\n\t\t\t\teventEmitter.emit(\"joined\", { clientId, canWrite });\n\t\t\t});\n\t\t\tthis.on(\"disconnectedFromService\", () => eventEmitter.emit(\"disconnected\"));\n\t\t\tthis.on(\"operabilityChanged\", (canWrite: boolean) =>\n\t\t\t\teventEmitter.emit(\"operabilityChanged\", canWrite),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.on(\"connected\", (clientId: string) => {\n\t\t\t\teventEmitter.emit(\"joined\", { clientId, canWrite: true });\n\t\t\t});\n\t\t\tthis.on(\"disconnected\", () => eventEmitter.emit(\"disconnected\"));\n\t\t}\n\t\treturn eventEmitter;\n\t});\n\n\tprivate getJoinedStatus(): JoinedStatus {\n\t\tconst getConnectionState = this.getConnectionState;\n\t\tif (getConnectionState) {\n\t\t\tconst connectionState = getConnectionState();\n\t\t\tif (\n\t\t\t\tconnectionState === ConnectionState.Connected ||\n\t\t\t\tconnectionState === ConnectionState.CatchingUp\n\t\t\t) {\n\t\t\t\t// Note: when CatchingUp, canSendOps will always be false.\n\t\t\t\treturn this.canSendOps ? \"joinedForWriting\" : \"joinedForReading\";\n\t\t\t}\n\t\t} else if (this.canSendOps) {\n\t\t\treturn \"joinedForWriting\";\n\t\t}\n\t\treturn \"disconnected\";\n\t}\n\n\tprivate readonly submitExtensionSignal: <TMessage extends TypedMessage>(\n\t\tid: string,\n\t\taddressChain: string[],\n\t\tmessage: OutboundExtensionMessage<TMessage>,\n\t) => void;\n\n\tpublic acquireExtension<\n\t\tT,\n\t\tTRuntimeProperties extends ExtensionRuntimeProperties,\n\t\tTUseContext extends unknown[],\n\t>(\n\t\tid: ContainerExtensionId,\n\t\tfactory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,\n\t\t...useContext: TUseContext\n\t): T {\n\t\treturn this.acquireExtensionInternal(\n\t\t\t/* injectionPermitted */ true,\n\t\t\tid,\n\t\t\tfactory,\n\t\t\t...useContext,\n\t\t);\n\t}\n\n\tpublic getExtension<\n\t\tT,\n\t\tTRuntimeProperties extends ExtensionRuntimeProperties,\n\t\tTUseContext extends unknown[],\n\t>(\n\t\tid: ContainerExtensionId,\n\t\trequirements: ContainerExtensionExpectations,\n\t\t...useContext: TUseContext\n\t): T {\n\t\t// Temporarily allow injection for extensions.\n\t\t// `requirements` are expected to be a factory as well.\n\t\treturn this.acquireExtensionInternal(\n\t\t\t/* injectionPermitted */ true,\n\t\t\tid,\n\t\t\trequirements as ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,\n\t\t\t...useContext,\n\t\t);\n\t}\n\n\tprivate acquireExtensionInternal<\n\t\tT,\n\t\tTRuntimeProperties extends ExtensionRuntimeProperties,\n\t\tTUseContext extends unknown[],\n\t>(\n\t\tinjectionPermitted: boolean,\n\t\tid: ContainerExtensionId,\n\t\tfactory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,\n\t\t...useContext: TUseContext\n\t): T {\n\t\tconst compatCheckResult = checkLayerCompatibility(\n\t\t\tfactory.hostRequirements,\n\t\t\tcontainerRuntimeCompatDetailsForContainerExtensions,\n\t\t);\n\t\tif (!compatCheckResult.isCompatible) {\n\t\t\tthrow new UsageError(\"Extension is not compatible with ContainerRuntime\", {\n\t\t\t\terrorDetails: JSON.stringify({\n\t\t\t\t\tcontainerRuntimeVersion:\n\t\t\t\t\t\tcontainerRuntimeCompatDetailsForContainerExtensions.pkgVersion,\n\t\t\t\t\tcontainerRuntimeGeneration:\n\t\t\t\t\t\tcontainerRuntimeCompatDetailsForContainerExtensions.generation,\n\t\t\t\t\tminSupportedGeneration: factory.hostRequirements.minSupportedGeneration,\n\t\t\t\t\tisGenerationCompatible: compatCheckResult.isGenerationCompatible,\n\t\t\t\t\tunsupportedFeatures: compatCheckResult.unsupportedFeatures,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\n\t\tlet entry = this.extensions.get(id);\n\t\tif (entry === undefined) {\n\t\t\tif (!injectionPermitted) {\n\t\t\t\tthrow new Error(`Extension ${id} not found`);\n\t\t\t}\n\n\t\t\tconst audience = this.signalAudience;\n\t\t\tconst runtime = {\n\t\t\t\tgetJoinedStatus: this.getJoinedStatus.bind(this),\n\t\t\t\tgetClientId: audience ? () => audience.getSelf()?.clientId : () => this.clientId,\n\t\t\t\tevents: this.lazyEventsForExtensions.value,\n\t\t\t\tlogger: this.baseLogger,\n\t\t\t\tsubmitAddressedSignal: (\n\t\t\t\t\taddressChain: string[],\n\t\t\t\t\tmessage: OutboundExtensionMessage<TRuntimeProperties[\"SignalMessages\"]>,\n\t\t\t\t) => {\n\t\t\t\t\tthis.submitExtensionSignal(id, addressChain, message);\n\t\t\t\t},\n\t\t\t\tgetQuorum: this.getQuorum.bind(this),\n\t\t\t\tgetAudience: audience ? () => audience : this.getAudience.bind(this),\n\t\t\t\tsupportedFeatures: this.ILayerCompatDetails.supportedFeatures,\n\t\t\t} satisfies ExtensionHost<TRuntimeProperties>;\n\t\t\tentry = factory.instantiateExtension(runtime, ...useContext);\n\t\t\tthis.extensions.set(id, entry);\n\t\t} else {\n\t\t\tconst { extension, compatibility } = entry;\n\t\t\tif (\n\t\t\t\t// Check short-circuit (re-use) for same instance which must be\n\t\t\t\t// same version and capabilities.\n\t\t\t\t!(entry instanceof factory) &&\n\t\t\t\t// Check version and capabilities if different instance. If\n\t\t\t\t// version matches and existing has all capabilities of\n\t\t\t\t// requested, then allow direct reuse.\n\t\t\t\t(compatibility.version !== factory.instanceExpectations.version ||\n\t\t\t\t\t[...factory.instanceExpectations.capabilities].some(\n\t\t\t\t\t\t(cap) => !compatibility.capabilities.has(cap),\n\t\t\t\t\t))\n\t\t\t) {\n\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary -- operations are significant and deserve own blocks\n\t\t\t\tif (\n\t\t\t\t\t!injectionPermitted ||\n\t\t\t\t\tgt(compatibility.version, factory.instanceExpectations.version)\n\t\t\t\t) {\n\t\t\t\t\t// This is an attempt to acquire an older version of an\n\t\t\t\t\t// extension that is already acquired OR updating (form of\n\t\t\t\t\t// injection) is not permitted.\n\t\t\t\t\tentry = extension.handleVersionOrCapabilitiesMismatch(\n\t\t\t\t\t\tentry,\n\t\t\t\t\t\tfactory.instanceExpectations,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// This is an attempt to acquire a newer or more capable\n\t\t\t\t\t// version of an extension that is already acquired. Replace\n\t\t\t\t\t// existing with new.\n\t\t\t\t\tentry = factory.resolvePriorInstantiation(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/consistent-destructuring -- 'entry' may have been update and thus use of 'extension' would be incorrect\n\t\t\tentry.extension.onNewUse(...useContext);\n\t\t}\n\t\treturn entry.interface as T;\n\t}\n\n\tprivate get groupedBatchingEnabled(): boolean {\n\t\treturn this.sessionSchema.opGroupingEnabled === true;\n\t}\n}\n\nexport function isContainerMessageDirtyable({\n\ttype,\n\tcontents,\n}: LocalContainerRuntimeMessage): boolean {\n\t// Certain container runtime messages should not mark the container dirty such as the old built-in\n\t// AgentScheduler and Garbage collector messages.\n\tswitch (type) {\n\t\tcase ContainerMessageType.Attach: {\n\t\t\tconst attachMessage = contents as InboundAttachMessage;\n\t\t\tif (attachMessage.id === agentSchedulerId) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase ContainerMessageType.FluidDataStoreOp: {\n\t\t\tconst envelope = contents;\n\t\t\tif (envelope.address === agentSchedulerId) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase ContainerMessageType.IdAllocation:\n\t\tcase ContainerMessageType.DocumentSchemaChange:\n\t\tcase ContainerMessageType.GC: {\n\t\t\treturn false;\n\t\t}\n\t\tdefault: {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn true;\n}\n"]}
1
+ {"version":3,"file":"containerRuntime.js","sourceRoot":"","sources":["../src/containerRuntime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,uBAAuB,EACvB,aAAa,EACb,KAAK,EACL,iBAAiB,GACjB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAWpE,OAAO,EACN,eAAe,EACf,mBAAmB,GACnB,MAAM,gDAAgD,CAAC;AAgCxD,OAAO,EACN,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,eAAe,GACf,MAAM,qCAAqC,CAAC;AAM7C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAWjE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAQrE,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,uBAAuB,GACvB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACN,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,GACT,MAAM,8CAA8C,CAAC;AAsBtD,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,+BAA+B,EAC/B,WAAW,EACX,gBAAgB,GAChB,MAAM,wCAAwC,CAAC;AAQhD,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,YAAY,EACZ,YAAY,EACZ,gBAAgB;AAChB,kDAAkD;AAClD,mBAAmB,EACnB,U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YAC1B,IAAI,QAAQ,CAAC,OAAO,KAAK,gBAAgB,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC;YACd,CAAC;YACD,MAAM;QACP,CAAC;QACD,KAAK,oBAAoB,CAAC,YAAY,CAAC;QACvC,KAAK,oBAAoB,CAAC,oBAAoB,CAAC;QAC/C,KAAK,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9B,OAAO,KAAK,CAAC;QACd,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,MAAM;QACP,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tILayerCompatDetails,\n\tIProvideLayerCompatDetails,\n} from \"@fluid-internal/client-utils\";\nimport {\n\tcheckLayerCompatibility,\n\tcreateEmitter,\n\tTrace,\n\tTypedEventEmitter,\n} from \"@fluid-internal/client-utils\";\nimport type {\n\tIAudience,\n\tISelf,\n\tICriticalContainerError,\n\tIAudienceEvents,\n} from \"@fluidframework/container-definitions\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport type {\n\tIContainerContext,\n\tIGetPendingLocalStateProps,\n\tIRuntime,\n\tIDeltaManager,\n\tIDeltaManagerFull,\n\tILoader,\n\tIContainerStorageService,\n\tConnectionStatus,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tConnectionState,\n\tisIDeltaManagerFull,\n} from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tContainerExtensionFactory,\n\tContainerExtensionId,\n\tExtensionHost,\n\tExtensionHostEvents,\n\tExtensionInstantiationResult,\n\tExtensionRuntimeProperties,\n\tIContainerRuntime,\n\tIContainerRuntimeEvents,\n\tIContainerRuntimeInternal,\n\t// eslint-disable-next-line import-x/no-deprecated\n\tIContainerRuntimeWithResolveHandle_Deprecated,\n\tJoinedStatus,\n\tOutboundExtensionMessage,\n} from \"@fluidframework/container-runtime-definitions/internal\";\nimport type {\n\tFluidObject,\n\tIFluidHandle,\n\tIRequest,\n\tIResponse,\n\tITelemetryBaseLogger,\n\tListenable,\n} from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleContext,\n\tIFluidHandleInternal,\n\tIProvideFluidHandleContext,\n\tISignalEnvelope,\n\tOpaqueJsonDeserialized,\n\tTypedMessage,\n} from \"@fluidframework/core-interfaces/internal\";\nimport {\n\tassert,\n\tDeferred,\n\tLazy,\n\tLazyPromise,\n\tPromiseCache,\n\tdelay,\n\tfail,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIClientDetails,\n\tIQuorumClients,\n\tISummaryTree,\n} from \"@fluidframework/driver-definitions\";\nimport { SummaryType } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\tISnapshot,\n\tISnapshotTree,\n\tISummaryContent,\n\tISummaryContext,\n\tSummaryObject,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { FetchSource, MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type { IIdCompressor } from \"@fluidframework/id-compressor\";\nimport type {\n\tIIdCompressorCore,\n\tIdCreationRange,\n\tSerializedIdCompressorWithNoSession,\n\tSerializedIdCompressorWithOngoingSession,\n} from \"@fluidframework/id-compressor/internal\";\nimport {\n\tcreateIdCompressor,\n\tcreateSessionId,\n\tdeserializeIdCompressor,\n} from \"@fluidframework/id-compressor/internal\";\nimport {\n\tFlushMode,\n\tFlushModeExperimental,\n\tchannelsTreeName,\n\tgcTreeKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeParam,\n\tIDataStore,\n\tIFluidDataStoreContextDetached,\n\tIFluidDataStoreRegistry,\n\tIFluidParentContext,\n\tISummarizeInternalResult,\n\tInboundAttachMessage,\n\tNamedFluidDataStoreRegistryEntries,\n\tSummarizeInternalFn,\n\tIInboundSignalMessage,\n\tIRuntimeMessagesContent,\n\tISummarizerNodeWithGC,\n\tStageControlsInternal,\n\tIContainerRuntimeBaseInternal,\n\tMinimumVersionForCollab,\n\tContainerExtensionExpectations,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tcreate404Response,\n\tdefaultMinVersionForCollab,\n\texceptionToResponse,\n\tGCDataBuilder,\n\tisValidMinVersionForCollab,\n\tRequestParser,\n\tRuntimeHeaders,\n\tvalidateMinimumVersionForCollab,\n\tseqFromTree,\n\tTelemetryContext,\n} from \"@fluidframework/runtime-utils/internal\";\nimport type {\n\tIEventSampler,\n\tIFluidErrorBase,\n\tITelemetryGenericEventExt,\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport {\n\tDataCorruptionError,\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tGenericError,\n\tLoggingError,\n\tPerformanceEvent,\n\t// eslint-disable-next-line import-x/no-deprecated\n\tTaggedLoggerAdapter,\n\tUsageError,\n\tcreateChildLogger,\n\tcreateChildMonitoringContext,\n\tcreateSampledLogger,\n\tloggerToMonitoringContext,\n\traiseConnectedEvent,\n\twrapError,\n\ttagCodeArtifacts,\n\tnormalizeError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { gt } from \"semver-ts\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { BindBatchTracker } from \"./batchTracker.js\";\nimport {\n\tBlobManager,\n\ttype IPendingBlobs,\n\tblobManagerBasePath,\n\tblobsTreeName,\n\tisBlobPath,\n\tloadBlobManagerLoadInfo,\n\ttype IBlobManagerLoadInfo,\n} from \"./blobManager/index.js\";\nimport type {\n\tAddressedUnsequencedSignalEnvelope,\n\tIFluidRootParentContextPrivate,\n} from \"./channelCollection.js\";\nimport {\n\tChannelCollection,\n\tformParentContext,\n\tgetSummaryForDatastores,\n} from \"./channelCollection.js\";\nimport type { ICompressionRuntimeOptions } from \"./compressionDefinitions.js\";\nimport { CompressionAlgorithms, disabledCompressionConfig } from \"./compressionDefinitions.js\";\nimport { ReportOpPerfTelemetry } from \"./connectionTelemetry.js\";\nimport {\n\tgetMinVersionForCollabDefaults,\n\ttype RuntimeOptionsAffectingDocSchema,\n\tvalidateRuntimeOptions,\n\truntimeOptionKeysThatRequireExplicitSchemaControl,\n\ttype RuntimeOptionKeysThatRequireExplicitSchemaControl,\n} from \"./containerCompatibility.js\";\nimport { ContainerFluidHandleContext } from \"./containerHandleContext.js\";\nimport { channelToDataStore } from \"./dataStore.js\";\nimport { FluidDataStoreRegistry } from \"./dataStoreRegistry.js\";\nimport {\n\tBaseDeltaManagerProxy,\n\tDeltaManagerPendingOpsProxy,\n\tDeltaManagerSummarizerProxy,\n} from \"./deltaManagerProxies.js\";\nimport { DeltaScheduler } from \"./deltaScheduler.js\";\nimport {\n\tGCNodeType,\n\tGarbageCollector,\n\ttype IGCRuntimeOptions,\n\ttype IGCStats,\n\ttype IGarbageCollector,\n\tgcGenerationOptionName,\n\ttype GarbageCollectionMessage,\n\ttype IGarbageCollectionRuntime,\n} from \"./gc/index.js\";\nimport { InboundBatchAggregator } from \"./inboundBatchAggregator.js\";\nimport {\n\tContainerMessageType,\n\ttype ContainerRuntimeAliasMessage,\n\ttype ContainerRuntimeDataStoreOpMessage,\n\ttype OutboundContainerRuntimeDocumentSchemaMessage,\n\ttype ContainerRuntimeGCMessage,\n\ttype ContainerRuntimeIdAllocationMessage,\n\ttype InboundSequencedContainerRuntimeMessage,\n\ttype LocalContainerRuntimeMessage,\n\ttype OutboundContainerRuntimeAttachMessage,\n\ttype UnknownContainerRuntimeMessage,\n} from \"./messageTypes.js\";\nimport type { ISavedOpMetadata } from \"./metadata.js\";\nimport {\n\ttype LocalBatchMessage,\n\ttype BatchStartInfo,\n\tDuplicateBatchDetector,\n\tensureContentsDeserialized,\n\ttype IBatchCheckpoint,\n\tOpCompressor,\n\tOpDecompressor,\n\tOpGroupingManager,\n\tOpSplitter,\n\tOutbox,\n\tRemoteMessageProcessor,\n\ttype OutboundBatch,\n\ttype BatchResubmitInfo,\n} from \"./opLifecycle/index.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport {\n\ttype PendingMessageResubmitData,\n\ttype IPendingLocalState,\n\tPendingStateManager,\n\ttype PendingBatchResubmitMetadata,\n} from \"./pendingStateManager.js\";\nimport { BatchRunCounter, RunCounter } from \"./runCounter.js\";\nimport {\n\truntimeCompatDetailsForLoader,\n\truntimeCoreCompatDetails,\n\tvalidateLoaderCompatibility,\n} from \"./runtimeLayerCompatState.js\";\nimport { SignalTelemetryManager } from \"./signalTelemetryProcessing.js\";\n// These types are imported as types here because they are present in summaryDelayLoadedModule, which is loaded dynamically when required.\nimport {\n\taliasBlobName,\n\tchunksBlobName,\n\tcreateRootSummarizerNodeWithGC,\n\tDefaultSummaryConfiguration,\n\tDocumentsSchemaController,\n\telectedSummarizerBlobName,\n\ttype EnqueueSummarizeResult,\n\textractSummaryMetadataMessage,\n\tformCreateSummarizerFn,\n\ttype IBaseSummarizeResult,\n\ttype IConnectableRuntime,\n\ttype IContainerRuntimeMetadata,\n\ttype ICreateContainerMetadata,\n\tidCompressorBlobName,\n\ttype IdCompressorMode,\n\ttype IDocumentSchemaChangeMessageIncoming,\n\ttype IDocumentSchemaCurrent,\n\ttype IDocumentSchemaFeatures,\n\ttype IEnqueueSummarizeOptions,\n\ttype IGeneratedSummaryStats,\n\ttype IGenerateSummaryTreeResult,\n\ttype IOnDemandSummarizeOptions,\n\ttype IRefreshSummaryAckOptions,\n\ttype IRootSummarizerNodeWithGC,\n\ttype ISerializedElection,\n\tisSummariesDisabled,\n\tisSummaryOnRequest,\n\ttype ISubmitSummaryOptions,\n\ttype ISummarizeResults,\n\ttype ISummarizerInternalsProvider,\n\ttype ISummarizerRuntime,\n\ttype ISummaryConfiguration,\n\ttype ISummaryMetadataMessage,\n\tmetadataBlobName,\n\tOrderedClientCollection,\n\tOrderedClientElection,\n\trecentBatchInfoBlobName,\n\tRetriableSummaryError,\n\trootHasIsolatedChannels,\n\ttype SubmitSummaryResult,\n\ttype Summarizer,\n\tSummarizerClientElection,\n\tsummarizerClientType,\n\tsummarizerRequestUrl,\n\tSummaryCollection,\n\tSummaryManager,\n\tvalidateSummaryHeuristicConfiguration,\n\twrapSummaryInChannelsTree,\n} from \"./summary/index.js\";\nimport { Throttler, formExponentialFn } from \"./throttler.js\";\n\n/**\n * A {@link ContainerExtension}'s factory function as stored in extension map.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- `any` required to allow typed factory to be assignable per ContainerExtension.processSignal\ntype ExtensionEntry = ExtensionInstantiationResult<unknown, any, unknown[]>;\n\n/**\n * ContainerRuntime's compatibility details that is exposed to Container Extensions.\n */\nconst containerRuntimeCompatDetailsForContainerExtensions = {\n\t...runtimeCoreCompatDetails,\n\t/**\n\t * The features supported by the ContainerRuntime's ContainerExtensionStore\n\t * implementation.\n\t */\n\tsupportedFeatures: new Set<string>(),\n} as const satisfies ILayerCompatDetails;\n\n/**\n * Creates an error object to be thrown / passed to Container's close fn in case of an unknown message type.\n * The parameters are typed to support compile-time enforcement of handling all known types/behaviors\n *\n * @param unknownContainerRuntimeMessageType - Typed as something unexpected, to ensure all known types have been\n * handled before calling this function (e.g. in a switch statement).\n *\n * @param codePath - The code path where the unexpected message type was encountered.\n *\n * @param sequencedMessage - The sequenced message that contained the unexpected message type.\n *\n */\nfunction getUnknownMessageTypeError(\n\tunknownContainerRuntimeMessageType: UnknownContainerRuntimeMessage[\"type\"],\n\tcodePath: string,\n\tsequencedMessage?: ISequencedDocumentMessage,\n): IFluidErrorBase {\n\treturn DataProcessingError.create(\n\t\t\"Runtime message of unknown type\",\n\t\tcodePath,\n\t\tsequencedMessage,\n\t\t{\n\t\t\tmessageDetails: {\n\t\t\t\ttype: unknownContainerRuntimeMessageType,\n\t\t\t},\n\t\t},\n\t);\n}\n\n/**\n * @legacy @beta\n */\nexport interface ISummaryRuntimeOptions {\n\t/**\n\t * Override summary configurations set by the server.\n\t */\n\tsummaryConfigOverrides?: ISummaryConfiguration;\n\n\t/**\n\t * Delay before first attempt to spawn summarizing container.\n\t *\n\t * @deprecated Use {@link ISummaryRuntimeOptions.summaryConfigOverrides}'s\n\t * {@link ISummaryBaseConfiguration.initialSummarizerDelayMs} instead.\n\t */\n\tinitialSummarizerDelayMs?: number;\n}\n\n/**\n * Full set of options for container runtime as \"required\".\n *\n * @remarks\n * {@link IContainerRuntimeOptions} is expected to be used by consumers.\n *\n * @privateRemarks If any new properties are added to this interface (or\n * {@link IContainerRuntimeOptionsInternal}), then we will also need to make\n * changes in {@link file://./containerCompatibility.ts}.\n * If the new property does not change the DocumentSchema, then it must be\n * explicity omitted from {@link RuntimeOptionsAffectingDocSchema}.\n * If it does change the DocumentSchema, then a corresponding entry must be\n * added to `runtimeOptionsAffectingDocSchemaConfigMap` with the appropriate\n * compat configuration info.\n * If neither of the above is done, then the build will fail to compile.\n *\n * @legacy @beta\n */\nexport interface ContainerRuntimeOptions {\n\treadonly summaryOptions: ISummaryRuntimeOptions;\n\treadonly gcOptions: IGCRuntimeOptions;\n\t/**\n\t * Affects the behavior while loading the runtime when the data verification check which\n\t * compares the DeltaManager sequence number (obtained from protocol in summary) to the\n\t * runtime sequence number (obtained from runtime metadata in summary) finds a mismatch.\n\t * 1. \"close\" (default) will close the container with an assertion.\n\t * 2. \"log\" will log an error event to telemetry, but still continue to load.\n\t * 3. \"bypass\" will skip the check entirely. This is not recommended.\n\t */\n\treadonly loadSequenceNumberVerification: \"close\" | \"log\" | \"bypass\";\n\n\t/**\n\t * Enables the runtime to compress ops. See {@link ICompressionRuntimeOptions}.\n\t */\n\treadonly compressionOptions: ICompressionRuntimeOptions;\n\t/**\n\t * If specified, when in FlushMode.TurnBased, if the size of the ops between JS turns exceeds this value,\n\t * an error will be thrown and the container will close.\n\t *\n\t * If unspecified, the limit is 700Kb.\n\t *\n\t * 'Infinity' will disable any limit.\n\t *\n\t * @experimental This config should be driven by the connection with the service and will be moved in the future.\n\t */\n\treadonly maxBatchSizeInBytes: number;\n\t/**\n\t * If the op payload needs to be chunked in order to work around the maximum size of the batch, this value represents\n\t * how large the individual chunks will be. This is only supported when compression is enabled. If after compression, the\n\t * batch content size exceeds this value, it will be chunked into smaller ops of this exact size.\n\t *\n\t * This value is a trade-off between having many small chunks vs fewer larger chunks and by default, the runtime is configured to use\n\t * 200 * 1024 = 204800 bytes. This default value ensures that no compressed payload's content is able to exceed {@link ContainerRuntimeOptions.maxBatchSizeInBytes}\n\t * regardless of the overhead of an individual op.\n\t *\n\t * Any value of `chunkSizeInBytes` exceeding {@link ContainerRuntimeOptions.maxBatchSizeInBytes} will disable this feature, therefore if a compressed batch's content\n\t * size exceeds {@link ContainerRuntimeOptions.maxBatchSizeInBytes} after compression, the container will close with an instance of `DataProcessingError` with\n\t * the `BatchTooLarge` message.\n\t */\n\treadonly chunkSizeInBytes: number;\n\n\t/**\n\t * Enable the IdCompressor in the runtime.\n\t * @experimental Not ready for use.\n\t */\n\treadonly enableRuntimeIdCompressor: IdCompressorMode;\n\n\t/**\n\t * If enabled, the runtime will group messages within a batch into a single\n\t * message to be sent to the service.\n\t * The grouping and ungrouping of such messages is handled by the \"OpGroupingManager\".\n\t *\n\t * By default, the feature is enabled. This feature can only be disabled when compression is also disabled.\n\t * @deprecated The ability to disable Grouped Batching is deprecated and will be removed in a future release. This feature is required for the proper functioning of the Fluid Framework.\n\t */\n\treadonly enableGroupedBatching: boolean;\n\n\t/**\n\t * When this property is set to true, it requires runtime to control is document schema properly through ops\n\t * The benefit of this mode is that clients who do not understand schema will fail in predictable way, with predictable message,\n\t * and will not attempt to limp along, which could cause data corruptions and crashes in random places.\n\t * When this property is not set (or set to false), runtime operates in legacy mode, where new features (modifying document schema)\n\t * are engaged as they become available, without giving legacy clients any chance to fail predictably.\n\t */\n\treadonly explicitSchemaControl: boolean;\n\n\t/**\n\t * Create blob handles with pending payloads when calling createBlob (default is `undefined` (disabled)).\n\t * When enabled (`true`), createBlob will return a handle before the blob upload completes.\n\t */\n\treadonly createBlobPayloadPending: true | undefined;\n}\n\n/**\n * Options for container runtime.\n *\n * @legacy @beta\n */\nexport type IContainerRuntimeOptions = Partial<ContainerRuntimeOptions>;\n\n/**\n * Internal extension of {@link ContainerRuntimeOptions}\n *\n * @privateRemarks\n * These options are not available to consumers when creating a new container runtime,\n * but we do need to expose them for internal use, e.g. when configuring the container runtime\n * to ensure compatibility with older versions.\n *\n * This is defined as a fully required set of options as this package does not yet\n * use `exactOptionalPropertyTypes` and `Required<>` applied to optional type allowing\n * `undefined` like {@link IdCompressorMode} will exclude `undefined`.\n *\n * @internal\n */\nexport interface ContainerRuntimeOptionsInternal extends ContainerRuntimeOptions {\n\t/**\n\t * Sets the flush mode for the runtime. In Immediate flush mode the runtime will immediately\n\t * send all operations to the driver layer, while in TurnBased the operations will be buffered\n\t * and then sent them as a single batch at the end of the turn.\n\t * By default, flush mode is TurnBased.\n\t */\n\treadonly flushMode: FlushMode;\n\n\t/**\n\t * Allows Grouped Batching to be disabled by setting to false (default is true).\n\t * In that case, batched messages will be sent individually (but still all at the same time).\n\t */\n\treadonly enableGroupedBatching: boolean;\n}\n\n/**\n * Internal extension of {@link IContainerRuntimeOptions}\n *\n * @internal\n */\nexport type IContainerRuntimeOptionsInternal = Partial<ContainerRuntimeOptionsInternal>;\n\n/**\n * Error responses when requesting a deleted object will have this header set to true\n * @internal\n */\nexport const DeletedResponseHeaderKey = \"wasDeleted\";\n/**\n * Tombstone error responses will have this header set to true\n * @legacy @beta\n */\nexport const TombstoneResponseHeaderKey = \"isTombstoned\";\n/**\n * Inactive error responses will have this header set to true\n * @legacy @beta\n *\n * @deprecated this header is deprecated and will be removed in the future. The functionality corresponding\n * to this was experimental and is no longer supported.\n */\nexport const InactiveResponseHeaderKey = \"isInactive\";\n\n/**\n * The full set of parsed header data that may be found on Runtime requests\n * @internal\n */\nexport interface RuntimeHeaderData {\n\twait?: boolean;\n\tviaHandle?: boolean;\n\tallowTombstone?: boolean;\n}\n\n/**\n * Default values for Runtime Headers\n */\nexport const defaultRuntimeHeaderData: Required<RuntimeHeaderData> = {\n\twait: true,\n\tviaHandle: false,\n\tallowTombstone: false,\n};\n\nconst defaultStagingCommitOptions = { squash: false };\n\n/**\n * @deprecated\n * Untagged logger is unsupported going forward. There are old loaders with old ContainerContexts that only\n * have the untagged logger, so to accommodate that scenario the below interface is used. It can be removed once\n * its usage is removed from TaggedLoggerAdapter fallback.\n */\ninterface OldContainerContextWithLogger extends Omit<IContainerContext, \"taggedLogger\"> {\n\tlogger: ITelemetryBaseLogger;\n\ttaggedLogger: undefined;\n}\n\n/**\n * State saved when the container closes, to be given back to a newly\n * instantiated runtime in a new instance of the container, so it can load to the\n * same state\n */\nexport interface IPendingRuntimeState {\n\t/**\n\t * Pending ops from PendingStateManager\n\t */\n\tpending?: IPendingLocalState;\n\t/**\n\t * Pending blobs from BlobManager\n\t */\n\tpendingAttachmentBlobs?: IPendingBlobs;\n\t/**\n\t * Pending idCompressor state\n\t */\n\tpendingIdCompressorState?: SerializedIdCompressorWithOngoingSession;\n\n\t/**\n\t * Time at which session expiry timer started.\n\t */\n\tsessionExpiryTimerStarted?: number | undefined;\n}\n\nconst maxConsecutiveReconnectsKey = \"Fluid.ContainerRuntime.MaxConsecutiveReconnects\";\n\n// The actual limit is 1Mb (socket.io and Kafka limits)\n// We can't estimate it fully, as we\n// - do not know what properties relay service will add\n// - we do not stringify final op, thus we do not know how much escaping will be added.\nconst defaultMaxBatchSizeInBytes = 700 * 1024;\n\nconst defaultChunkSizeInBytes = 204800;\n\n/**\n * The default time to wait for pending ops to be processed during summarization\n */\nexport const defaultPendingOpsWaitTimeoutMs = 1000;\n/**\n * The default time to delay a summarization retry attempt when there are pending ops\n */\nexport const defaultPendingOpsRetryDelayMs = 1000;\n\n/**\n * Instead of refreshing from latest because we do not have 100% confidence in the state\n * of the current system, we should close the summarizer and let it recover.\n * This delay's goal is to prevent tight restart loops\n */\nconst defaultCloseSummarizerDelayMs = 5000; // 5 seconds\n\n/**\n * Checks whether a message.type is one of the values in ContainerMessageType\n */\nexport function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {\n\treturn (Object.values(ContainerMessageType) as string[]).includes(message.type);\n}\n\n/**\n * Legacy ID for the built-in AgentScheduler. To minimize disruption while removing it, retaining this as a\n * special-case for document dirty state. Ultimately we should have no special-cases from the\n * ContainerRuntime's perspective.\n * @internal\n */\nexport const agentSchedulerId = \"_scheduler\";\n\n// safely check navigator and get the hardware spec value\nexport function getDeviceSpec(): {\n\tdeviceMemory?: number | undefined;\n\thardwareConcurrency?: number | undefined;\n} {\n\ttry {\n\t\tif (typeof navigator === \"object\" && navigator !== null) {\n\t\t\treturn {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment\n\t\t\t\tdeviceMemory: (navigator as any).deviceMemory,\n\t\t\t\thardwareConcurrency: navigator.hardwareConcurrency,\n\t\t\t};\n\t\t}\n\t} catch {\n\t\t// Eat the error\n\t}\n\treturn {};\n}\n\n/**\n * Older loader doesn't have a submitBatchFn member, this is the older way of submitting a batch.\n * Rather than exposing the submitFn (now deprecated) and IDeltaManager (dangerous to hand out) to the Outbox,\n * we can provide a partially-applied function to keep those items private to the ContainerRuntime.\n */\nexport const makeLegacySendBatchFn =\n\t(\n\t\tsubmitFn: (\n\t\t\ttype: MessageType,\n\t\t\tcontents: unknown,\n\t\t\tbatch: boolean,\n\t\t\tappData?: unknown,\n\t\t) => number,\n\t\tdeltaManager: Pick<IDeltaManager<unknown, unknown>, \"flush\">,\n\t) =>\n\t(batch: OutboundBatch): number => {\n\t\t// Default to negative one to match Container.submitBatch behavior\n\t\tlet clientSequenceNumber: number = -1;\n\t\tfor (const message of batch.messages) {\n\t\t\tclientSequenceNumber = submitFn(\n\t\t\t\tMessageType.Operation,\n\t\t\t\t// For back-compat (submitFn only works on deserialized content)\n\t\t\t\tmessage.contents === undefined ? undefined : JSON.parse(message.contents),\n\t\t\t\ttrue, // batch\n\t\t\t\tmessage.metadata,\n\t\t\t);\n\t\t}\n\n\t\tdeltaManager.flush();\n\n\t\treturn clientSequenceNumber;\n\t};\n\n/**\n * Extract last message from the snapshot metadata.\n * Uses legacy property if not using explicit schema control, otherwise uses the new property.\n * This allows new runtime to make documents not openable for old runtimes, one explicit document schema control is enabled.\n * Please see addMetadataToSummary() as well\n */\nfunction lastMessageFromMetadata(\n\tmetadata: IContainerRuntimeMetadata | undefined,\n): ISummaryMetadataMessage | undefined {\n\treturn metadata?.documentSchema?.runtime?.explicitSchemaControl === true\n\t\t? metadata?.lastMessage\n\t\t: metadata?.message;\n}\n\n/**\n * There is some ancient back-compat code that we'd like to instrument\n * to understand if/when it is hit.\n * We only want to log this once, to avoid spamming telemetry if we are wrong and these cases are hit commonly.\n */\nexport let getSingleUseLegacyLogCallback = (logger: ITelemetryLoggerExt, type: string) => {\n\treturn (codePath: string): void => {\n\t\tlogger.sendTelemetryEvent({\n\t\t\teventName: \"LegacyMessageFormat\",\n\t\t\tdetails: { codePath, type },\n\t\t});\n\n\t\t// Now that we've logged, prevent future logging (globally).\n\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\tgetSingleUseLegacyLogCallback = () => () => {};\n\t};\n};\n\n/**\n * A {@link TypedMessage} that has unknown content explicitly\n * noted as deserialized JSON.\n */\nexport interface UnknownIncomingTypedMessage extends TypedMessage {\n\tcontent: OpaqueJsonDeserialized<unknown>;\n}\n\ntype UnsequencedSignalEnvelope = Omit<ISignalEnvelope, \"clientBroadcastSignalSequenceNumber\">;\n\n/**\n * This object holds the parameters necessary for the {@link loadContainerRuntime} function.\n * @legacy @beta\n */\nexport interface LoadContainerRuntimeParams {\n\t/**\n\t * Context of the container.\n\t */\n\tcontext: IContainerContext;\n\t/**\n\t * Mapping from data store types to their corresponding factories\n\t */\n\tregistryEntries: NamedFluidDataStoreRegistryEntries;\n\t/**\n\t * Pass 'true' if loading from an existing snapshot.\n\t */\n\texisting: boolean;\n\t/**\n\t * Additional options to be passed to the runtime.\n\t * @remarks\n\t * Defaults to `{}`.\n\t */\n\truntimeOptions?: IContainerRuntimeOptions;\n\t/**\n\t * runtime services provided with context\n\t */\n\tcontainerScope?: FluidObject;\n\t/**\n\t * Promise that resolves to an object which will act as entryPoint for the Container.\n\t */\n\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>;\n\n\t/**\n\t * Request handler for the request() method of the container runtime.\n\t * Only relevant for back-compat while we remove the request() method and move fully to entryPoint as the main pattern.\n\t * @deprecated Will be removed once Loader LTS version is \"2.0.0-internal.7.0.0\". Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t * */\n\trequestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;\n\n\t/**\n\t * Minimum version of the FF runtime that is required to collaborate on new documents.\n\t * The input should be a string that represents the minimum version of the FF runtime that should be\n\t * supported for collaboration. The format of the string must be in valid semver format.\n\t *\n\t * The inputted version will be used to determine the default configuration for\n\t * {@link IContainerRuntimeOptionsInternal} to ensure compatibility with the specified version.\n\t *\n\t * @example\n\t * minVersionForCollab: \"2.0.0\"\n\t *\n\t * @privateRemarks\n\t * Used to determine the default configuration for {@link IContainerRuntimeOptionsInternal} that affect the document schema.\n\t * For example, let's say that feature `foo` was added in 2.0 which introduces a new op type. Additionally, option `bar`\n\t * was added to `IContainerRuntimeOptionsInternal` in 2.0 to enable/disable `foo` since clients prior to 2.0 would not\n\t * understand the new op type. If a customer were to set minVersionForCollab to 2.0.0, then `bar` would be set to\n\t * enable `foo` by default. If a customer were to set minVersionForCollab to 1.0.0, then `bar` would be set to\n\t * disable `foo` by default.\n\t */\n\tminVersionForCollab?: MinimumVersionForCollab;\n}\n/**\n * This is meant to be used by a {@link @fluidframework/container-definitions#IRuntimeFactory} to instantiate a container runtime.\n * @param params - An object which specifies all required and optional params necessary to instantiate a runtime.\n * @returns A runtime which provides all the functionality necessary to bind with the loader layer via the {@link @fluidframework/container-definitions#IRuntime} interface and provide a runtime environment via the {@link @fluidframework/container-runtime-definitions#IContainerRuntime} interface.\n * @legacy @beta\n */\nexport async function loadContainerRuntime(\n\tparams: LoadContainerRuntimeParams,\n): Promise<IContainerRuntime & IRuntime> {\n\treturn ContainerRuntime.loadRuntime(params);\n}\n\nconst defaultMaxConsecutiveReconnects = 7;\n\n/**\n * These are the ONLY message types that are allowed to be submitted while in staging mode\n * (Does not apply to pre-StagingMode batches that are resubmitted, those are not considered to be staged)\n */\nfunction canStageMessageOfType(\n\ttype: LocalContainerRuntimeMessage[\"type\"],\n): type is\n\t| ContainerMessageType.FluidDataStoreOp\n\t| ContainerMessageType.GC\n\t| ContainerMessageType.DocumentSchemaChange {\n\treturn (\n\t\t// These are user changes coming up from the runtime's DataStores\n\t\ttype === ContainerMessageType.FluidDataStoreOp ||\n\t\t// GC ops are used to detect issues in the reference graph so all clients can repair their GC state.\n\t\t// These can be submitted at any time, including while in Staging Mode.\n\t\ttype === ContainerMessageType.GC ||\n\t\t// These are typically sent shortly after boot and will not be common in Staging Mode, but it's possible.\n\t\ttype === ContainerMessageType.DocumentSchemaChange\n\t);\n}\n\n/**\n * Represents the runtime of the container. Contains helper functions/state of the container.\n * It will define the store level mappings.\n *\n * @internal\n */\nexport class ContainerRuntime\n\textends TypedEventEmitter<IContainerRuntimeEvents>\n\timplements\n\t\tIContainerRuntimeInternal,\n\t\tIContainerRuntimeBaseInternal,\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tIContainerRuntimeWithResolveHandle_Deprecated,\n\t\tIRuntime,\n\t\tIGarbageCollectionRuntime,\n\t\tISummarizerRuntime,\n\t\tISummarizerInternalsProvider,\n\t\t// If ContainerRuntime stops being exported from this package, this can\n\t\t// be updated to implement IFluidRootParentContextPrivate and leave\n\t\t// submitMessage included.\n\t\t// IFluidParentContextPrivate is also better than IFluidParentContext\n\t\t// and is also internal only; so, not usable here.\n\t\tOmit<IFluidParentContext, \"submitMessage\" | \"submitSignal\">,\n\t\tIProvideFluidHandleContext,\n\t\tIProvideLayerCompatDetails\n{\n\t/**\n\t * Load the stores from a snapshot and returns the runtime.\n\t * @param params - An object housing the runtime properties.\n\t * {@link LoadContainerRuntimeParams} except internal, while still having layer compat obligations.\n\t * @privateRemarks\n\t * Despite this being `@internal`, `@fluidframework/test-utils` uses it in `createTestContainerRuntimeFactory` and assumes multiple versions of the package expose the same API.\n\t *\n\t * Also note that `mixinAttributor` from `@fluid-experimental/attributor` overrides this function:\n\t * that will have to be updated if changing the signature of this function as well.\n\t *\n\t * Assuming these usages are updated appropriately,\n\t * `loadRuntime` could be removed (replaced by `loadRuntime2` which could be renamed back to `loadRuntime`).\n\t */\n\tpublic static async loadRuntime(\n\t\tparams: LoadContainerRuntimeParams & {\n\t\t\t/**\n\t\t\t * Constructor to use to create the ContainerRuntime instance.\n\t\t\t * @remarks\n\t\t\t * Defaults to {@link ContainerRuntime}.\n\t\t\t */\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t},\n\t): Promise<ContainerRuntime> {\n\t\treturn ContainerRuntime.loadRuntime2({\n\t\t\t...params,\n\t\t\tregistry: new FluidDataStoreRegistry(params.registryEntries),\n\t\t});\n\t}\n\n\t/**\n\t * Load the stores from a snapshot and returns the runtime.\n\t * @remarks\n\t * Same as {@link ContainerRuntime.loadRuntime},\n\t * but with `registry` instead of `registryEntries` and more `runtimeOptions`.\n\t */\n\tpublic static async loadRuntime2(\n\t\tparams: Omit<LoadContainerRuntimeParams, \"registryEntries\" | \"runtimeOptions\"> & {\n\t\t\t/**\n\t\t\t * Mapping from data store types to their corresponding factories.\n\t\t\t */\n\t\t\tregistry: IFluidDataStoreRegistry;\n\t\t\t/**\n\t\t\t * Constructor to use to create the ContainerRuntime instance.\n\t\t\t * @remarks\n\t\t\t * Defaults to {@link ContainerRuntime}.\n\t\t\t */\n\t\t\tcontainerRuntimeCtor?: typeof ContainerRuntime;\n\t\t\t/**\n\t\t\t * {@link LoadContainerRuntimeParams.runtimeOptions}, except with additional internal only options.\n\t\t\t */\n\t\t\truntimeOptions?: IContainerRuntimeOptionsInternal;\n\t\t},\n\t): Promise<ContainerRuntime> {\n\t\tconst {\n\t\t\tcontext,\n\t\t\tregistry,\n\t\t\texisting,\n\t\t\trequestHandler,\n\t\t\tprovideEntryPoint,\n\t\t\truntimeOptions = {} satisfies IContainerRuntimeOptionsInternal,\n\t\t\tcontainerScope = {},\n\t\t\tcontainerRuntimeCtor = ContainerRuntime,\n\t\t\tminVersionForCollab = defaultMinVersionForCollab,\n\t\t} = params;\n\n\t\t// If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:\n\t\t// back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45\n\t\tconst backCompatContext: IContainerContext | OldContainerContextWithLogger = context;\n\t\tconst passLogger =\n\t\t\tbackCompatContext.taggedLogger ??\n\t\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\t\tnew TaggedLoggerAdapter((backCompatContext as OldContainerContextWithLogger).logger);\n\t\tconst logger = createChildLogger({\n\t\t\tlogger: passLogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\truntimeVersion: pkgVersion,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tconst mc = loggerToMonitoringContext(logger);\n\n\t\t// Some options require a minimum version of the FF runtime to operate, so the default configs will be generated\n\t\t// based on the minVersionForCollab.\n\t\t// For example, if minVersionForCollab is set to \"1.0.0\", the default configs will ensure compatibility with FF runtime\n\t\t// 1.0.0 or later. If the minVersionForCollab is set to \"2.10.0\", the default values will be generated to ensure compatibility\n\t\t// with FF runtime 2.10.0 or later.\n\t\tif (!isValidMinVersionForCollab(minVersionForCollab)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t`Invalid minVersionForCollab: ${minVersionForCollab}. It must be an existing FF version (i.e. 2.22.1).`,\n\t\t\t);\n\t\t}\n\t\t// We also validate that there is not a mismatch between `minVersionForCollab` and runtime options that\n\t\t// were manually set.\n\t\tvalidateRuntimeOptions(minVersionForCollab, runtimeOptions);\n\n\t\tconst defaultsAffectingDocSchema = getMinVersionForCollabDefaults(minVersionForCollab);\n\n\t\t// The following are the default values for the options that do not affect the DocumentSchema.\n\t\tconst defaultsNotAffectingDocSchema: Omit<\n\t\t\tContainerRuntimeOptionsInternal,\n\t\t\tkeyof RuntimeOptionsAffectingDocSchema\n\t\t> = {\n\t\t\tsummaryOptions: {},\n\t\t\tloadSequenceNumberVerification: \"close\",\n\t\t\tmaxBatchSizeInBytes: defaultMaxBatchSizeInBytes,\n\t\t\tchunkSizeInBytes: defaultChunkSizeInBytes,\n\t\t};\n\n\t\tconst defaultConfigs = {\n\t\t\t...defaultsAffectingDocSchema,\n\t\t\t...defaultsNotAffectingDocSchema,\n\t\t};\n\n\t\t// Here we set each option to its corresponding default config value if it's not provided in runtimeOptions.\n\t\t// Note: We cannot do a simple object merge of defaultConfigs/runtimeOptions because in most cases we don't want\n\t\t// a option that is undefined in runtimeOptions to override the default value (except for idCompressor, see below).\n\t\tconst {\n\t\t\tsummaryOptions = defaultConfigs.summaryOptions,\n\t\t\tgcOptions = defaultConfigs.gcOptions,\n\t\t\tloadSequenceNumberVerification = defaultConfigs.loadSequenceNumberVerification,\n\t\t\tmaxBatchSizeInBytes = defaultConfigs.maxBatchSizeInBytes,\n\t\t\tchunkSizeInBytes = defaultConfigs.chunkSizeInBytes,\n\t\t\texplicitSchemaControl = defaultConfigs.explicitSchemaControl,\n\t\t\tenableGroupedBatching = defaultConfigs.enableGroupedBatching,\n\t\t\tflushMode = defaultConfigs.flushMode,\n\t\t\t// If batching is disabled then we should disable compression as well. If batching is disabled and compression\n\t\t\t// is enabled via runtimeOptions, we will throw an error later.\n\t\t\tcompressionOptions = enableGroupedBatching === false\n\t\t\t\t? disabledCompressionConfig\n\t\t\t\t: defaultConfigs.compressionOptions,\n\t\t\tcreateBlobPayloadPending = defaultConfigs.createBlobPayloadPending,\n\t\t}: IContainerRuntimeOptionsInternal = runtimeOptions;\n\n\t\t// If explicitSchemaControl is off, ensure that options which require explicitSchemaControl are not enabled.\n\t\tif (!explicitSchemaControl) {\n\t\t\tconst disallowedKeys = Object.keys(runtimeOptions).filter(\n\t\t\t\t(key) =>\n\t\t\t\t\truntimeOptionKeysThatRequireExplicitSchemaControl.includes(\n\t\t\t\t\t\tkey as RuntimeOptionKeysThatRequireExplicitSchemaControl,\n\t\t\t\t\t) && runtimeOptions[key] !== undefined,\n\t\t\t);\n\t\t\tif (disallowedKeys.length > 0) {\n\t\t\t\tthrow new UsageError(`explicitSchemaControl must be enabled to use ${disallowedKeys}`);\n\t\t\t}\n\t\t}\n\n\t\t// The logic for enableRuntimeIdCompressor is a bit different. Since `undefined` represents a logical state (off)\n\t\t// we need to check it's explicitly set in runtimeOptions. If so, we should use that value even if it's undefined.\n\t\tconst enableRuntimeIdCompressor =\n\t\t\t\"enableRuntimeIdCompressor\" in runtimeOptions\n\t\t\t\t? runtimeOptions.enableRuntimeIdCompressor\n\t\t\t\t: defaultConfigs.enableRuntimeIdCompressor;\n\n\t\tconst tryFetchBlob = async <T>(blobName: string): Promise<T | undefined> => {\n\t\t\tconst blobId = context.baseSnapshot?.blobs[blobName];\n\t\t\tif (context.baseSnapshot !== undefined && blobId !== undefined) {\n\t\t\t\t// IContainerContext storage api return type still has undefined in 0.39 package version.\n\t\t\t\t// So once we release 0.40 container-defn package we can remove this check.\n\t\t\t\tassert(\n\t\t\t\t\tcontext.storage !== undefined,\n\t\t\t\t\t0x1f5 /* \"Attached state should have storage\" */,\n\t\t\t\t);\n\t\t\t\treturn readAndParse<T>(context.storage, blobId);\n\t\t\t}\n\t\t};\n\n\t\tconst [\n\t\t\tchunks,\n\t\t\trecentBatchInfo,\n\t\t\tmetadata,\n\t\t\telectedSummarizerData,\n\t\t\taliases,\n\t\t\tserializedIdCompressor,\n\t\t] = await Promise.all([\n\t\t\ttryFetchBlob<[string, string[]][]>(chunksBlobName),\n\t\t\ttryFetchBlob<ReturnType<DuplicateBatchDetector[\"getRecentBatchInfoForSummary\"]>>(\n\t\t\t\trecentBatchInfoBlobName,\n\t\t\t),\n\n\t\t\ttryFetchBlob<IContainerRuntimeMetadata>(metadataBlobName),\n\n\t\t\ttryFetchBlob<ISerializedElection>(electedSummarizerBlobName),\n\t\t\ttryFetchBlob<[string, string][]>(aliasBlobName),\n\t\t\ttryFetchBlob<SerializedIdCompressorWithNoSession>(idCompressorBlobName),\n\t\t]);\n\n\t\t// read snapshot blobs needed for BlobManager to load\n\t\tconst blobManagerLoadInfo = await loadBlobManagerLoadInfo(context);\n\n\t\tconst messageAtLastSummary = lastMessageFromMetadata(metadata);\n\n\t\t// Verify summary runtime sequence number matches protocol sequence number.\n\t\tconst runtimeSequenceNumber = messageAtLastSummary?.sequenceNumber;\n\t\tconst protocolSequenceNumber = context.deltaManager.initialSequenceNumber;\n\t\t// When we load with pending state, we reuse an old snapshot so we don't expect these numbers to match\n\t\tif (context.pendingLocalState === undefined && runtimeSequenceNumber !== undefined) {\n\t\t\t// Unless bypass is explicitly set, then take action when sequence numbers mismatch.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if -- Separate if statements make flow easier to parse\n\t\t\tif (\n\t\t\t\tloadSequenceNumberVerification !== \"bypass\" &&\n\t\t\t\truntimeSequenceNumber !== protocolSequenceNumber\n\t\t\t) {\n\t\t\t\t// Message to OCEs:\n\t\t\t\t// You can hit this error with runtimeSequenceNumber === -1 in < 2.0 RC3 builds.\n\t\t\t\t// This would indicate that explicit schema control is enabled in current (2.0 RC3+) builds and it\n\t\t\t\t// results in addMetadataToSummary() creating a poison pill for older runtimes in the form of a -1 sequence number.\n\t\t\t\t// Older runtimes do not understand new schema, and thus could corrupt document if they proceed, thus we are using\n\t\t\t\t// this poison pill to prevent them from proceeding.\n\n\t\t\t\t// \"Load from summary, runtime metadata sequenceNumber !== initialSequenceNumber\"\n\t\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t\t// pre-0.58 error message: SummaryMetadataMismatch\n\t\t\t\t\t\"Summary metadata mismatch\",\n\t\t\t\t\t{ runtimeVersion: pkgVersion, runtimeSequenceNumber, protocolSequenceNumber },\n\t\t\t\t);\n\n\t\t\t\tif (loadSequenceNumberVerification === \"log\") {\n\t\t\t\t\tlogger.sendErrorEvent({ eventName: \"SequenceNumberMismatch\" }, error);\n\t\t\t\t} else {\n\t\t\t\t\tcontext.closeFn(error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tlet desiredIdCompressorMode: IdCompressorMode;\n\t\tswitch (mc.config.getBoolean(\"Fluid.ContainerRuntime.IdCompressorEnabled\")) {\n\t\t\tcase true: {\n\t\t\t\tdesiredIdCompressorMode = \"on\";\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase false: {\n\t\t\t\tdesiredIdCompressorMode = undefined;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tdesiredIdCompressorMode = enableRuntimeIdCompressor;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// Enabling the IdCompressor is a one-way operation and we only want to\n\t\t// allow new containers to turn it on.\n\t\tlet idCompressorMode: IdCompressorMode;\n\t\tif (existing) {\n\t\t\t// This setting has to be sticky for correctness:\n\t\t\t// 1) if compressior is OFF, it can't be enabled, as already running clients (in given document session) do not know\n\t\t\t// how to process compressor ops\n\t\t\t// 2) if it's ON, then all sessions should load compressor right away\n\t\t\t// 3) Same logic applies for \"delayed\" mode\n\t\t\t// Maybe in the future we will need to enabled (and figure how to do it safely) \"delayed\" -> \"on\" change.\n\t\t\t// We could do \"off\" -> \"on\" transition too, if all clients start loading compressor (but not using it initially) and\n\t\t\t// do so for a while - this will allow clients to eventually disregard \"off\" setting (when it's safe so) and start\n\t\t\t// using compressor in future sessions.\n\t\t\t// Everyting is possible, but it needs to be designed and executed carefully, when such need arises.\n\t\t\tidCompressorMode = metadata?.documentSchema?.runtime\n\t\t\t\t?.idCompressorMode as IdCompressorMode;\n\n\t\t\t// This is the only exception to the rule above - we have proper plumbing to load ID compressor on schema change\n\t\t\t// event. It is loaded async (relative to op processing), so this conversion is only safe for off -> delayed conversion!\n\t\t\t// Clients do not expect ID compressor ops unless ID compressor is On for them, and that could be achieved only through\n\t\t\t// explicit schema change, i.e. only if explicitSchemaControl is on.\n\t\t\t// Note: it would be better if we throw on combination of options (explicitSchemaControl = off, desiredIdCompressorMode === \"delayed\")\n\t\t\t// that is not supported. But our service tests are oblivious to these problems and throwing here will cause a ton of failures\n\t\t\t// We ignored incompatible ID compressor changes from the start (they were sticky), so that's not a new problem being introduced...\n\t\t\tif (\n\t\t\t\tidCompressorMode === undefined &&\n\t\t\t\tdesiredIdCompressorMode === \"delayed\" &&\n\t\t\t\texplicitSchemaControl\n\t\t\t) {\n\t\t\t\tidCompressorMode = desiredIdCompressorMode;\n\t\t\t}\n\t\t} else {\n\t\t\tidCompressorMode = desiredIdCompressorMode;\n\t\t}\n\n\t\tconst createIdCompressorFn = (): IIdCompressor & IIdCompressorCore => {\n\t\t\t/**\n\t\t\t * Because the IdCompressor emits so much telemetry, this function is used to sample\n\t\t\t * approximately 5% of all clients. Only the given percentage of sessions will emit telemetry.\n\t\t\t */\n\t\t\tconst idCompressorEventSampler: IEventSampler = (() => {\n\t\t\t\tconst isIdCompressorTelemetryEnabled = Math.random() < 0.05;\n\t\t\t\treturn {\n\t\t\t\t\tsample: () => {\n\t\t\t\t\t\treturn isIdCompressorTelemetryEnabled;\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t})();\n\n\t\t\tconst compressorLogger = createSampledLogger(logger, idCompressorEventSampler);\n\t\t\tconst pendingLocalState = context.pendingLocalState as IPendingRuntimeState;\n\n\t\t\tif (pendingLocalState?.pendingIdCompressorState !== undefined) {\n\t\t\t\treturn deserializeIdCompressor(\n\t\t\t\t\tpendingLocalState.pendingIdCompressorState,\n\t\t\t\t\tcompressorLogger,\n\t\t\t\t);\n\t\t\t} else if (serializedIdCompressor === undefined) {\n\t\t\t\treturn createIdCompressor(compressorLogger);\n\t\t\t} else {\n\t\t\t\treturn deserializeIdCompressor(\n\t\t\t\t\tserializedIdCompressor,\n\t\t\t\t\tcreateSessionId(),\n\t\t\t\t\tcompressorLogger,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst compressionLz4 =\n\t\t\tcompressionOptions.minimumBatchSizeInBytes !== Number.POSITIVE_INFINITY &&\n\t\t\tcompressionOptions.compressionAlgorithm === \"lz4\";\n\n\t\tconst documentSchemaController = new DocumentsSchemaController(\n\t\t\texisting,\n\t\t\tprotocolSequenceNumber,\n\t\t\tmetadata?.documentSchema,\n\t\t\t{\n\t\t\t\texplicitSchemaControl,\n\t\t\t\tcompressionLz4,\n\t\t\t\tidCompressorMode,\n\t\t\t\topGroupingEnabled: enableGroupedBatching,\n\t\t\t\tcreateBlobPayloadPending,\n\t\t\t\tdisallowedVersions: [],\n\t\t\t},\n\t\t\t(schema) => {\n\t\t\t\truntime.onSchemaChange(schema);\n\t\t\t},\n\t\t\t{ minVersionForCollab },\n\t\t\tlogger,\n\t\t);\n\n\t\t// If the minVersionForCollab for this client is greater than the existing one, we should use that one going forward.\n\t\tconst existingMinVersionForCollab =\n\t\t\tdocumentSchemaController.sessionSchema.info.minVersionForCollab;\n\t\tconst updatedMinVersionForCollab =\n\t\t\texistingMinVersionForCollab === undefined ||\n\t\t\tgt(minVersionForCollab, existingMinVersionForCollab)\n\t\t\t\t? minVersionForCollab\n\t\t\t\t: existingMinVersionForCollab;\n\n\t\tif (compressionLz4 && !enableGroupedBatching) {\n\t\t\tthrow new UsageError(\"If compression is enabled, op grouping must be enabled too\");\n\t\t}\n\n\t\tconst featureGatesForTelemetry: Record<string, boolean | number | undefined> = {};\n\n\t\t// Make sure we've got all the options including internal ones\n\t\tconst internalRuntimeOptions: Readonly<ContainerRuntimeOptionsInternal> = {\n\t\t\tsummaryOptions,\n\t\t\tgcOptions,\n\t\t\tloadSequenceNumberVerification,\n\t\t\tflushMode,\n\t\t\tcompressionOptions,\n\t\t\tmaxBatchSizeInBytes,\n\t\t\tchunkSizeInBytes,\n\t\t\tenableRuntimeIdCompressor,\n\t\t\tenableGroupedBatching,\n\t\t\texplicitSchemaControl,\n\t\t\tcreateBlobPayloadPending,\n\t\t};\n\n\t\tvalidateMinimumVersionForCollab(updatedMinVersionForCollab);\n\t\tconst runtime = new containerRuntimeCtor(\n\t\t\tcontext,\n\t\t\tregistry,\n\t\t\tmetadata,\n\t\t\telectedSummarizerData,\n\t\t\tchunks ?? [],\n\t\t\taliases ?? [],\n\t\t\tinternalRuntimeOptions,\n\t\t\tcontainerScope,\n\t\t\tlogger,\n\t\t\texisting,\n\t\t\tblobManagerLoadInfo,\n\t\t\tcontext.storage,\n\t\t\tcreateIdCompressorFn,\n\t\t\tdocumentSchemaController,\n\t\t\tfeatureGatesForTelemetry,\n\t\t\tprovideEntryPoint,\n\t\t\tupdatedMinVersionForCollab,\n\t\t\trequestHandler,\n\t\t\tundefined, // summaryConfiguration\n\t\t\trecentBatchInfo,\n\t\t);\n\n\t\truntime.sharePendingBlobs();\n\n\t\t// Initialize the base state of the runtime before it's returned.\n\t\tawait runtime.initializeBaseState(context.loader);\n\n\t\t// Apply stashed ops with a reference sequence number equal to the sequence number of the snapshot,\n\t\t// or zero. This must be done before Container replays saved ops.\n\t\tawait runtime.pendingStateManager.applyStashedOpsAt(runtimeSequenceNumber ?? 0);\n\n\t\treturn runtime;\n\t}\n\n\tpublic readonly options: Record<string | number, unknown>;\n\n\tprivate readonly _getClientId: () => string | undefined;\n\tpublic get clientId(): string | undefined {\n\t\treturn this._getClientId();\n\t}\n\n\tpublic readonly clientDetails: IClientDetails;\n\n\tprivate readonly isSummarizerClient: boolean;\n\n\tpublic get storage(): IContainerStorageService {\n\t\treturn this._storage;\n\t}\n\n\tpublic get containerRuntime(): ContainerRuntime {\n\t\treturn this;\n\t}\n\n\tprivate readonly submitSummaryFn: (\n\t\tsummaryOp: ISummaryContent,\n\t\treferenceSequenceNumber?: number,\n\t) => number;\n\tprivate readonly submitSignalFn: (\n\t\tcontent: UnsequencedSignalEnvelope,\n\t\ttargetClientId?: string,\n\t) => void;\n\tpublic readonly disposeFn: (error?: ICriticalContainerError) => void;\n\tpublic readonly closeFn: (error?: ICriticalContainerError) => void;\n\n\tpublic get flushMode(): FlushMode {\n\t\treturn this._flushMode;\n\t}\n\n\tpublic get scope(): FluidObject {\n\t\treturn this.containerScope;\n\t}\n\n\tpublic get IFluidDataStoreRegistry(): IFluidDataStoreRegistry {\n\t\treturn this.registry;\n\t}\n\n\tprivate readonly _getAttachState: () => AttachState;\n\tpublic get attachState(): AttachState {\n\t\treturn this._getAttachState();\n\t}\n\n\tpublic readonly isReadOnly = (): boolean => this.deltaManager.readOnlyInfo.readonly === true;\n\n\t/**\n\t * Current session schema - defines what options are on & off.\n\t * It's overlap of document schema (controlled by summary & ops) and options controlling this session.\n\t * For example, document schema might have compression ON, but feature gates / runtime options turn it Off.\n\t * In such case it will be off in session schema (i.e. this session should not use compression), but this client\n\t * has to deal with compressed ops as other clients might send them.\n\t * And in reverse, session schema can have compression Off, but feature gates / runtime options want it On.\n\t * In such case it will be off in session schema, however this client will propose change to schema, and once / if\n\t * this op roundtrips, compression will be On. Client can't send compressed ops until it's change in schema.\n\t */\n\tpublic get sessionSchema(): {\n\t\t[P in keyof IDocumentSchemaFeatures]?: IDocumentSchemaFeatures[P] extends boolean\n\t\t\t? true\n\t\t\t: IDocumentSchemaFeatures[P];\n\t} {\n\t\treturn this.documentsSchemaController.sessionSchema.runtime;\n\t}\n\n\tprivate _idCompressor: (IIdCompressor & IIdCompressorCore) | undefined;\n\n\t// We accumulate Id compressor Ops while Id compressor is not loaded yet (only for \"delayed\" mode)\n\t// Once it loads, it will process all such ops and we will stop accumulating further ops - ops will be processes as they come in.\n\tprivate pendingIdCompressorOps: IdCreationRange[] = [];\n\n\t// Id Compressor serializes final state (see getPendingLocalState()). As result, it needs to skip all ops that preceeded that state\n\t// (such ops will be marked by Loader layer as savedOp === true)\n\t// That said, in \"delayed\" mode it's possible that Id Compressor was never initialized before getPendingLocalState() is called.\n\t// In such case we have to process all ops, including those marked with savedOp === true.\n\tprivate readonly skipSavedCompressorOps: boolean;\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.idCompressor}\n\t */\n\tpublic get idCompressor(): (IIdCompressor & IIdCompressorCore) | undefined {\n\t\t// Expose ID Compressor only if it's On from the start.\n\t\t// If container uses delayed mode, then we can only expose generateDocumentUniqueId() and nothing else.\n\t\t// That's because any other usage will require immidiate loading of ID Compressor in next sessions in order\n\t\t// to reason over such things as session ID space.\n\t\tif (this.sessionSchema.idCompressorMode === \"on\") {\n\t\t\tassert(this._idCompressor !== undefined, 0x8ea /* compressor should have been loaded */);\n\t\t\treturn this._idCompressor;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.generateDocumentUniqueId}\n\t */\n\tpublic generateDocumentUniqueId(): string | number {\n\t\treturn this._idCompressor?.generateDocumentUniqueId() ?? uuid();\n\t}\n\n\tpublic get IFluidHandleContext(): IFluidHandleContext {\n\t\treturn this.handleContext;\n\t}\n\tprivate readonly handleContext: ContainerFluidHandleContext;\n\n\t/**\n\t * This is a proxy to the delta manager provided by the container context (innerDeltaManager). It restricts certain\n\t * accesses such as sets \"read-only\" mode for the summarizer client. This is the default delta manager that should\n\t * be used unless the innerDeltaManager is required.\n\t */\n\tpublic get deltaManager(): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t\treturn this._deltaManager;\n\t}\n\n\tprivate readonly _deltaManager: BaseDeltaManagerProxy;\n\n\t/**\n\t * The delta manager provided by the container context. By default, using the default delta manager (proxy)\n\t * should be sufficient. This should be used only if necessary. For example, for validating and propagating connected\n\t * events which requires access to the actual real only info, this is needed.\n\t */\n\tprivate readonly innerDeltaManager: IDeltaManagerFull;\n\n\t// internal logger for ContainerRuntime. Use this.logger for stores, summaries, etc.\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate summarizerClientElection?: SummarizerClientElection;\n\t/**\n\t * summaryManager will only be created if this client is permitted to spawn a summarizing client\n\t * It is created only by interactive client, i.e. summarizer client, as well as non-interactive bots\n\t * do not create it (see SummarizerClientElection.clientDetailsPermitElection() for details)\n\t */\n\tprivate summaryManager?: SummaryManager;\n\n\tprivate readonly summarizerNode: IRootSummarizerNodeWithGC;\n\n\tprivate readonly maxConsecutiveReconnects: number;\n\n\tprivate readonly batchRunner = new BatchRunCounter();\n\tprivate readonly _flushMode: FlushMode;\n\t/**\n\t * BatchId tracking is needed whenever there's a possibility of a \"forked Container\",\n\t * where the same local state is pending in two different running Containers, each of\n\t * which is trying to ensure it's persisted.\n\t * \"Offline Load\" from serialized pending state is one such scenario since two Containers\n\t * could load from the same serialized pending state.\n\t */\n\tprivate readonly batchIdTrackingEnabled: boolean;\n\tprivate flushScheduled = false;\n\n\tprivate canSendOps: boolean;\n\tprivate canSendSignals: boolean | undefined;\n\n\tprivate readonly getConnectionState?: () => ConnectionState;\n\n\tprivate consecutiveReconnects = 0;\n\n\tprivate readonly dataModelChangeRunner = new RunCounter();\n\n\t/**\n\t * Invokes the given callback and expects that no ops are submitted\n\t * until execution finishes. If an op is submitted, it will be marked as reentrant.\n\t *\n\t * @param callback - the callback to be invoked\n\t */\n\tpublic ensureNoDataModelChanges<T>(callback: () => T): T {\n\t\treturn this.dataModelChangeRunner.run(callback);\n\t}\n\n\t/**\n\t * Indicates whether the container is in a state where it is able to send\n\t * ops (connected to op stream and not in readonly mode).\n\t */\n\tpublic get connected(): boolean {\n\t\treturn this.canSendOps;\n\t}\n\n\t/**\n\t * clientId of parent (non-summarizing) container that owns summarizer container\n\t */\n\tpublic get summarizerClientId(): string | undefined {\n\t\treturn this.summarizerClientElection?.electedClientId;\n\t}\n\n\tprivate _disposed = false;\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\n\tprivate lastEmittedDirty: boolean;\n\tprivate emitDirtyDocumentEvent = true;\n\tprivate readonly useDeltaManagerOpsProxy: boolean;\n\tprivate readonly closeSummarizerDelayMs: number;\n\n\tprivate readonly signalTelemetryManager = new SignalTelemetryManager();\n\n\t/**\n\t * Summarizer is responsible for coordinating when to send generate and send summaries.\n\t * It is the main entry point for summary work.\n\t * It is created only by summarizing container (i.e. one with clientType === \"summarizer\")\n\t */\n\n\tprivate _summarizer?: Summarizer;\n\tprivate readonly deltaScheduler: DeltaScheduler;\n\tprivate readonly inboundBatchAggregator: InboundBatchAggregator;\n\tprivate readonly blobManager: BlobManager;\n\tprivate readonly pendingStateManager: PendingStateManager;\n\tprivate readonly duplicateBatchDetector: DuplicateBatchDetector | undefined;\n\tprivate readonly outbox: Outbox;\n\tprivate readonly garbageCollector: IGarbageCollector;\n\n\tprivate readonly channelCollection: ChannelCollection;\n\tprivate readonly remoteMessageProcessor: RemoteMessageProcessor;\n\n\t/**\n\t * The last message processed at the time of the last summary.\n\t */\n\n\tprivate messageAtLastSummary: ISummaryMetadataMessage | undefined;\n\n\tprivate readonly summariesDisabled: boolean;\n\n\tprivate readonly createContainerMetadata: ICreateContainerMetadata;\n\t/**\n\t * The summary number of the next summary that will be generated for this container. This is incremented every time\n\t * a summary is generated.\n\t */\n\tprivate nextSummaryNumber: number;\n\n\t/**\n\t * If false, loading or using a Tombstoned object should merely log, not fail.\n\t * @deprecated NOT SUPPORTED - hardcoded to return false since it's deprecated.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic get gcTombstoneEnforcementAllowed(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * If true, throw an error when a tombstone data store is used.\n\t * @deprecated NOT SUPPORTED - hardcoded to return false since it's deprecated.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic get gcThrowOnTombstoneUsage(): boolean {\n\t\treturn false;\n\t}\n\n\t/**\n\t * GUID to identify a document in telemetry\n\t * ! Note: should not be used for anything other than telemetry and is not considered a stable GUID\n\t */\n\tprivate readonly telemetryDocumentId: string;\n\n\t/**\n\t * The id of the version used to initially load this runtime, or undefined if it's newly created.\n\t */\n\tprivate readonly loadedFromVersionId: string | undefined;\n\n\tprivate readonly isSnapshotInstanceOfISnapshot: boolean;\n\n\t/**\n\t * The summary context of the last acked summary. The properties from this as used when uploading a summary.\n\t */\n\tprivate lastAckedSummaryContext: ISummaryContext | undefined;\n\n\t/**\n\t * It a cache for holding mapping for loading groupIds with its snapshot from the service. Add expiry policy of 1 minute.\n\t * Starting with 1 min and based on recorded usage we can tweak it later on.\n\t */\n\tprivate readonly snapshotCacheForLoadingGroupIds = new PromiseCache<string, ISnapshot>({\n\t\texpiry: { policy: \"absolute\", durationMs: 60000 },\n\t});\n\n\t/**\n\t * The compatibility details of the Runtime layer that is exposed to the Loader layer\n\t * for validating Loader-Runtime compatibility.\n\t */\n\tpublic get ILayerCompatDetails(): ILayerCompatDetails {\n\t\treturn runtimeCompatDetailsForLoader;\n\t}\n\n\t/**\n\t * If true, will skip Outbox flushing before processing an incoming message (and on DeltaManager \"op\" event for loader back-compat),\n\t * and instead the Outbox will check for a split batch on every submit.\n\t * This is a kill-bit switch for this simplification of logic, in case it causes unexpected issues.\n\t */\n\tprivate readonly skipSafetyFlushDuringProcessStack: boolean;\n\n\tprivate readonly extensions = new Map<ContainerExtensionId, ExtensionEntry>();\n\n\t/***/\n\tprotected constructor(\n\t\tcontext: IContainerContext,\n\t\tprivate readonly registry: IFluidDataStoreRegistry,\n\n\t\tprivate readonly metadata: IContainerRuntimeMetadata | undefined,\n\n\t\tprivate readonly electedSummarizerData: ISerializedElection | undefined,\n\t\tchunks: [string, string[]][],\n\t\tdataStoreAliasMap: [string, string][],\n\t\tprivate readonly runtimeOptions: Readonly<ContainerRuntimeOptionsInternal>,\n\t\tprivate readonly containerScope: FluidObject,\n\t\t// Create a custom ITelemetryBaseLogger to output telemetry events.\n\t\tpublic readonly baseLogger: ITelemetryBaseLogger,\n\t\texisting: boolean,\n\n\t\tblobManagerLoadInfo: IBlobManagerLoadInfo,\n\t\tprivate readonly _storage: IContainerStorageService,\n\t\tprivate readonly createIdCompressorFn: () => IIdCompressor & IIdCompressorCore,\n\n\t\tprivate readonly documentsSchemaController: DocumentsSchemaController,\n\t\tfeatureGatesForTelemetry: Record<string, boolean | number | undefined>,\n\t\tprovideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>,\n\t\tpublic readonly minVersionForCollab: MinimumVersionForCollab,\n\t\tprivate readonly requestHandler?: (\n\t\t\trequest: IRequest,\n\t\t\truntime: IContainerRuntime,\n\t\t) => Promise<IResponse>,\n\t\t// // eslint-disable-next-line unicorn/no-object-as-default-parameter\n\t\tprivate readonly summaryConfiguration: ISummaryConfiguration = {\n\t\t\t// the defaults\n\t\t\t...DefaultSummaryConfiguration,\n\t\t\t// the runtime configuration overrides\n\t\t\t...runtimeOptions.summaryOptions?.summaryConfigOverrides,\n\t\t},\n\t\trecentBatchInfo?: [number, string][],\n\t) {\n\t\tsuper();\n\n\t\tconst {\n\t\t\toptions,\n\t\t\tclientDetails,\n\t\t\tconnected,\n\t\t\tbaseSnapshot,\n\t\t\tsubmitFn,\n\t\t\tsubmitBatchFn,\n\t\t\tsubmitSummaryFn,\n\t\t\tsubmitSignalFn,\n\t\t\tdisposeFn,\n\t\t\tcloseFn,\n\t\t\tdeltaManager,\n\t\t\tquorum,\n\t\t\taudience,\n\t\t\tsignalAudience,\n\t\t\tpendingLocalState,\n\t\t\tsupportedFeatures,\n\t\t\tsnapshotWithContents,\n\t\t\tgetConnectionState,\n\t\t} = context;\n\n\t\tthis.getConnectionState = getConnectionState;\n\n\t\t// In old loaders without dispose functionality, closeFn is equivalent but will also switch container to readonly mode\n\t\tthis.disposeFn = disposeFn ?? closeFn;\n\n\t\tthis.isSnapshotInstanceOfISnapshot = snapshotWithContents !== undefined;\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.baseLogger,\n\t\t\tnamespace: \"ContainerRuntime\",\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tinStagingMode: this.inStagingMode,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\t// Validate that the Loader is compatible with this Runtime.\n\t\tconst maybeLoaderCompatDetailsForRuntime = context as FluidObject<ILayerCompatDetails>;\n\t\tvalidateLoaderCompatibility(\n\t\t\tmaybeLoaderCompatDetailsForRuntime.ILayerCompatDetails,\n\t\t\tthis.disposeFn,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// If we support multiple algorithms in the future, then we would need to manage it here carefully.\n\t\t// We can use runtimeOptions.compressionOptions.compressionAlgorithm, but only if it's in the schema list!\n\t\t// If it's not in the list, then we will need to either use no compression, or fallback to some other (supported by format)\n\t\t// compression.\n\t\tconst compressionOptions: ICompressionRuntimeOptions = {\n\t\t\tminimumBatchSizeInBytes: this.sessionSchema.compressionLz4\n\t\t\t\t? runtimeOptions.compressionOptions.minimumBatchSizeInBytes\n\t\t\t\t: Number.POSITIVE_INFINITY,\n\t\t\tcompressionAlgorithm: CompressionAlgorithms.lz4,\n\t\t};\n\n\t\tassert(isIDeltaManagerFull(deltaManager), 0xa80 /* Invalid delta manager */);\n\t\tthis.innerDeltaManager = deltaManager;\n\n\t\t// Here we could wrap/intercept on these functions to block/modify outgoing messages if needed.\n\t\t// This makes ContainerRuntime the final gatekeeper for outgoing messages.\n\t\t// back-compat: ADO #1385: Make this call unconditional in the future\n\t\tthis.submitSummaryFn =\n\t\t\tsubmitSummaryFn ??\n\t\t\t((summaryOp, refseq) => submitFn(MessageType.Summarize, summaryOp, false));\n\n\t\tconst sequenceAndSubmitSignal = (\n\t\t\tenvelope: UnsequencedSignalEnvelope,\n\t\t\ttargetClientId?: string,\n\t\t): void => {\n\t\t\tif (targetClientId === undefined) {\n\t\t\t\tthis.signalTelemetryManager.applyTrackingToBroadcastSignalEnvelope(envelope);\n\t\t\t}\n\t\t\tsubmitSignalFn(envelope, targetClientId);\n\t\t};\n\t\tthis.submitSignalFn = (envelope: UnsequencedSignalEnvelope, targetClientId?: string) => {\n\t\t\tif (envelope.address?.startsWith(\"/\") === true) {\n\t\t\t\tthrow new Error(\"General path based addressing is not implemented\");\n\t\t\t}\n\t\t\tsequenceAndSubmitSignal(envelope, targetClientId);\n\t\t};\n\t\tthis.submitExtensionSignal = <TMessage extends TypedMessage>(\n\t\t\tid: string,\n\t\t\taddressChain: string[],\n\t\t\tmessage: OutboundExtensionMessage<TMessage>,\n\t\t): void => {\n\t\t\tthis.verifyNotClosed();\n\t\t\tconst envelope = {\n\t\t\t\taddress: `/ext/${id}/${addressChain.join(\"/\")}`,\n\t\t\t\tcontents: message,\n\t\t\t} satisfies UnsequencedSignalEnvelope;\n\t\t\tsequenceAndSubmitSignal(envelope, message.targetClientId);\n\t\t};\n\n\t\t// TODO: After IContainerContext.options is removed, we'll just create a new blank object {} here.\n\t\t// Values are generally expected to be set from the runtime side.\n\t\tthis.options = options ?? {};\n\t\tthis.clientDetails = clientDetails;\n\t\tthis.isSummarizerClient = this.clientDetails.type === summarizerClientType;\n\t\tthis.loadedFromVersionId = context.getLoadedFromVersion()?.id;\n\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\tthis._getClientId = () => context.clientId;\n\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\tthis._getAttachState = () => context.attachState;\n\t\tthis.getAbsoluteUrl = async (relativeUrl: string) => {\n\t\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\t\tif (context.getAbsoluteUrl === undefined) {\n\t\t\t\tthrow new Error(\"Driver does not implement getAbsoluteUrl\");\n\t\t\t}\n\t\t\tif (this.attachState !== AttachState.Attached) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn context.getAbsoluteUrl(relativeUrl);\n\t\t};\n\t\t// TODO: Consider that the Container could just listen to these events itself, or even more appropriately maybe the\n\t\t// customer should observe dirty state on the runtime (the owner of dirty state) directly, rather than on the IContainer.\n\t\tthis.on(\"dirty\", () => context.updateDirtyContainerState(true));\n\t\tthis.on(\"saved\", () => context.updateDirtyContainerState(false));\n\n\t\t// Telemetry for when the container is attached and subsequently saved for the first time.\n\t\t// These events are useful for investigating the validity of container \"saved\" eventing upon attach.\n\t\t// See this.setAttachState() and this.updateDocumentDirtyState() for more details on \"attached\" and \"saved\" events.\n\t\tthis.once(\"attached\", () => {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"Attached\",\n\t\t\t\tdetails: {\n\t\t\t\t\tlastEmittedDirty: this.lastEmittedDirty,\n\t\t\t\t\tcurrentDirtyState: this.computeCurrentDirtyState(),\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t\tthis.once(\"saved\", () =>\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"Saved\",\n\t\t\t\tdetails: { attachState: this.attachState },\n\t\t\t}),\n\t\t);\n\n\t\t// In cases of summarizer, we want to dispose instead since consumer doesn't interact with this container\n\t\tthis.closeFn = this.isSummarizerClient ? this.disposeFn : closeFn;\n\n\t\tlet loadSummaryNumber: number;\n\t\t// Get the container creation metadata. For new container, we initialize these. For existing containers,\n\t\t// get the values from the metadata blob.\n\t\tif (existing) {\n\t\t\tthis.createContainerMetadata = {\n\t\t\t\tcreateContainerRuntimeVersion: metadata?.createContainerRuntimeVersion,\n\t\t\t\tcreateContainerTimestamp: metadata?.createContainerTimestamp,\n\t\t\t};\n\t\t\t// summaryNumber was renamed from summaryCount. For older docs that haven't been opened for a long time,\n\t\t\t// the count is reset to 0.\n\t\t\tloadSummaryNumber = metadata?.summaryNumber ?? 0;\n\t\t} else {\n\t\t\tthis.createContainerMetadata = {\n\t\t\t\tcreateContainerRuntimeVersion: pkgVersion,\n\t\t\t\tcreateContainerTimestamp: Date.now(),\n\t\t\t};\n\t\t\tloadSummaryNumber = 0;\n\t\t}\n\t\tthis.nextSummaryNumber = loadSummaryNumber + 1;\n\n\t\tthis.messageAtLastSummary = lastMessageFromMetadata(metadata);\n\n\t\t// Note that we only need to pull the *initial* connected state from the context.\n\t\t// Later updates come through calls to setConnectionState/Status.\n\t\tthis.canSendOps = connected;\n\t\tthis.canSendSignals = this.getConnectionState\n\t\t\t? this.getConnectionState() === ConnectionState.Connected ||\n\t\t\t\tthis.getConnectionState() === ConnectionState.CatchingUp\n\t\t\t: undefined;\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GCFeatureMatrix\",\n\t\t\tmetadataValue: JSON.stringify(metadata?.gcFeatureMatrix),\n\t\t\tinputs: JSON.stringify({\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tgcOptions_gcGeneration: runtimeOptions.gcOptions[gcGenerationOptionName],\n\t\t\t}),\n\t\t});\n\n\t\tthis.telemetryDocumentId = metadata?.telemetryDocumentId ?? uuid();\n\n\t\tconst opGroupingManager = new OpGroupingManager(\n\t\t\t{\n\t\t\t\tgroupedBatchingEnabled: this.groupedBatchingEnabled,\n\t\t\t},\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\tconst opSplitter = new OpSplitter(\n\t\t\tchunks,\n\t\t\tsubmitBatchFn,\n\t\t\truntimeOptions.chunkSizeInBytes,\n\t\t\truntimeOptions.maxBatchSizeInBytes,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\tthis.remoteMessageProcessor = new RemoteMessageProcessor(\n\t\t\topSplitter,\n\t\t\tnew OpDecompressor(this.mc.logger),\n\t\t\topGroupingManager,\n\t\t);\n\n\t\tconst pendingRuntimeState = pendingLocalState as IPendingRuntimeState | undefined;\n\t\tthis.pendingStateManager = new PendingStateManager(\n\t\t\t{\n\t\t\t\tapplyStashedOp: this.applyStashedOp.bind(this),\n\t\t\t\tclientId: () => this.clientId,\n\t\t\t\tconnected: () => this.connected,\n\t\t\t\treSubmitBatch: this.reSubmitBatch.bind(this),\n\t\t\t\tisActiveConnection: () => this.innerDeltaManager.active,\n\t\t\t\tisAttached: () => this.attachState !== AttachState.Detached,\n\t\t\t},\n\t\t\tpendingRuntimeState?.pending,\n\t\t\tthis.baseLogger,\n\t\t);\n\n\t\tlet outerDeltaManager: IDeltaManagerFull = this.innerDeltaManager;\n\t\tthis.useDeltaManagerOpsProxy =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.ContainerRuntime.DeltaManagerOpsProxy\") === true;\n\t\t// The summarizerDeltaManager Proxy is used to lie to the summarizer to convince it is in the right state as a summarizer client.\n\t\touterDeltaManager = DeltaManagerSummarizerProxy.wrapIfSummarizer(outerDeltaManager);\n\n\t\t// The DeltaManagerPendingOpsProxy is used to control the minimum sequence number\n\t\t// It allows us to lie to the layers below so that they can maintain enough local state for rebasing ops.\n\t\tif (this.useDeltaManagerOpsProxy) {\n\t\t\tconst pendingOpsDeltaManagerProxy = new DeltaManagerPendingOpsProxy(\n\t\t\t\touterDeltaManager,\n\t\t\t\tthis.pendingStateManager,\n\t\t\t);\n\t\t\touterDeltaManager = pendingOpsDeltaManagerProxy;\n\t\t}\n\n\t\t// always wrap the exposed delta manager in at least on layer of proxying\n\t\tthis._deltaManager =\n\t\t\touterDeltaManager instanceof BaseDeltaManagerProxy\n\t\t\t\t? outerDeltaManager\n\t\t\t\t: new BaseDeltaManagerProxy(outerDeltaManager);\n\n\t\tthis.handleContext = new ContainerFluidHandleContext(\"\", this);\n\n\t\tif (this.summaryConfiguration.state === \"enabled\") {\n\t\t\tvalidateSummaryHeuristicConfiguration(this.summaryConfiguration);\n\t\t}\n\n\t\tthis.summariesDisabled = isSummariesDisabled(this.summaryConfiguration);\n\n\t\tthis.maxConsecutiveReconnects =\n\t\t\tthis.mc.config.getNumber(maxConsecutiveReconnectsKey) ?? defaultMaxConsecutiveReconnects;\n\n\t\t// If the context has ILayerCompatDetails, it supports referenceSequenceNumbers since that features\n\t\t// predates ILayerCompatDetails.\n\t\tconst referenceSequenceNumbersSupported =\n\t\t\tmaybeLoaderCompatDetailsForRuntime.ILayerCompatDetails === undefined\n\t\t\t\t? supportedFeatures?.get(\"referenceSequenceNumbers\") === true\n\t\t\t\t: true;\n\t\tif (\n\t\t\truntimeOptions.flushMode === (FlushModeExperimental.Async as unknown as FlushMode) &&\n\t\t\t!referenceSequenceNumbersSupported\n\t\t) {\n\t\t\t// The loader does not support reference sequence numbers, falling back on FlushMode.TurnBased\n\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"FlushModeFallback\" });\n\t\t\tthis._flushMode = FlushMode.TurnBased;\n\t\t} else {\n\t\t\tthis._flushMode = runtimeOptions.flushMode;\n\t\t}\n\t\tthis.batchIdTrackingEnabled =\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.enableOfflineFull\") ??\n\t\t\tthis.mc.config.getBoolean(\"Fluid.ContainerRuntime.enableBatchIdTracking\") ??\n\t\t\tfalse;\n\n\t\tif (this.batchIdTrackingEnabled && this._flushMode !== FlushMode.TurnBased) {\n\t\t\tconst error = new UsageError(\"Offline mode is only supported in turn-based mode\");\n\t\t\tthis.closeFn(error);\n\t\t\tthrow error;\n\t\t}\n\n\t\t// DuplicateBatchDetection is only enabled if Offline Load is enabled\n\t\t// It maintains a cache of all batchIds/sequenceNumbers within the collab window.\n\t\t// Don't waste resources doing so if not needed.\n\t\tif (this.batchIdTrackingEnabled) {\n\t\t\tthis.duplicateBatchDetector = new DuplicateBatchDetector(recentBatchInfo);\n\t\t}\n\n\t\t// eslint-disable-next-line unicorn/consistent-destructuring\n\t\tif (context.attachState === AttachState.Attached) {\n\t\t\tconst maxSnapshotCacheDurationMs = this._storage?.policies?.maximumCacheDurationMs;\n\t\t\tif (\n\t\t\t\tmaxSnapshotCacheDurationMs !== undefined &&\n\t\t\t\tmaxSnapshotCacheDurationMs > 5 * 24 * 60 * 60 * 1000\n\t\t\t) {\n\t\t\t\t// This is a runtime enforcement of what's already explicit in the policy's type itself,\n\t\t\t\t// which dictates the value is either undefined or exactly 5 days in ms.\n\t\t\t\t// As long as the actual value is less than 5 days, the assumptions GC makes here are valid.\n\t\t\t\tthrow new UsageError(\"Driver's maximumCacheDurationMs policy cannot exceed 5 days\");\n\t\t\t}\n\t\t}\n\n\t\tthis.garbageCollector = GarbageCollector.create({\n\t\t\truntime: this,\n\t\t\tgcOptions: runtimeOptions.gcOptions,\n\t\t\tbaseSnapshot,\n\t\t\tbaseLogger: this.mc.logger,\n\t\t\texisting,\n\t\t\tmetadata,\n\t\t\tcreateContainerMetadata: this.createContainerMetadata,\n\t\t\tisSummarizerClient: this.isSummarizerClient,\n\t\t\tgetNodePackagePath: async (nodePath: string) => this.getGCNodePackagePath(nodePath),\n\t\t\tgetLastSummaryTimestampMs: () => this.messageAtLastSummary?.timestamp,\n\t\t\treadAndParseBlob: async <T>(id: string) => readAndParse<T>(this.storage, id),\n\t\t\tsubmitMessage: (message: ContainerRuntimeGCMessage) => this.submit(message),\n\t\t\tsessionExpiryTimerStarted: pendingRuntimeState?.sessionExpiryTimerStarted,\n\t\t});\n\n\t\tconst loadedFromSequenceNumber = this.deltaManager.initialSequenceNumber;\n\t\t// If the base snapshot was generated when isolated channels were disabled, set the summary reference\n\t\t// sequence to undefined so that this snapshot will not be used for incremental summaries. This is for\n\t\t// back-compat and will rarely happen so its okay to re-summarize everything in the first summary.\n\t\tconst summaryReferenceSequenceNumber =\n\t\t\tbaseSnapshot === undefined || metadata?.disableIsolatedChannels === true\n\t\t\t\t? undefined\n\t\t\t\t: loadedFromSequenceNumber;\n\t\tthis.summarizerNode = createRootSummarizerNodeWithGC(\n\t\t\tcreateChildLogger({ logger: this.baseLogger, namespace: \"SummarizerNode\" }),\n\t\t\t// Summarize function to call when summarize is called. Summarizer node always tracks summary state.\n\t\t\tasync (fullTree: boolean, trackState: boolean, telemetryContext?: ITelemetryContext) =>\n\t\t\t\tthis.summarizeInternal(fullTree, trackState, telemetryContext),\n\t\t\t// Latest change sequence number, no changes since summary applied yet\n\t\t\tloadedFromSequenceNumber,\n\t\t\tsummaryReferenceSequenceNumber,\n\t\t\t{\n\t\t\t\t// Must set to false to prevent sending summary handle which would be pointing to\n\t\t\t\t// a summary with an older protocol state.\n\t\t\t\tcanReuseHandle: false,\n\t\t\t\t// If GC should not run, let the summarizer node know so that it does not track GC state.\n\t\t\t\tgcDisabled: !this.garbageCollector.shouldRunGC,\n\t\t\t},\n\t\t\t// Function to get GC data if needed. This will always be called by the root summarizer node to get GC data.\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t\t// Function to get the GC details from the base snapshot we loaded from.\n\t\t\tasync () => this.garbageCollector.getBaseGCDetails(),\n\t\t);\n\n\t\tconst parentContext = formParentContext<IFluidRootParentContextPrivate>(this, {\n\t\t\tsubmitMessage: this.submitMessage.bind(this),\n\n\t\t\t// Due to a mismatch between different layers in terms of\n\t\t\t// what is the interface of passing signals, we need the\n\t\t\t// downstream stores to wrap the signal.\n\t\t\tsubmitSignal: (\n\t\t\t\tenvelope: AddressedUnsequencedSignalEnvelope,\n\t\t\t\ttargetClientId?: string,\n\t\t\t): void => {\n\t\t\t\t// verifyNotClosed is called in FluidDataStoreContext, which is *the* expected caller.\n\t\t\t\tthis.submitSignalFn(envelope, targetClientId);\n\t\t\t},\n\t\t});\n\n\t\tlet snapshot: ISnapshot | ISnapshotTree | undefined = getSummaryForDatastores(\n\t\t\tbaseSnapshot,\n\t\t\tmetadata,\n\t\t);\n\t\tif (snapshot !== undefined && snapshotWithContents !== undefined) {\n\t\t\tsnapshot = {\n\t\t\t\t...snapshotWithContents,\n\t\t\t\tsnapshotTree: snapshot,\n\t\t\t};\n\t\t}\n\n\t\tthis.channelCollection = new ChannelCollection(\n\t\t\tsnapshot,\n\t\t\tparentContext,\n\t\t\tthis.mc.logger,\n\t\t\t(props) =>\n\t\t\t\tthis.garbageCollector.nodeUpdated({\n\t\t\t\t\t...props,\n\t\t\t\t\ttimestampMs: props.timestampMs ?? this.getCurrentReferenceTimestampMs(),\n\t\t\t\t}),\n\t\t\t(path: string) => this.garbageCollector.isNodeDeleted(path),\n\t\t\tnew Map<string, string>(dataStoreAliasMap),\n\t\t);\n\t\tthis._deltaManager.on(\"readonly\", this.notifyReadOnlyState);\n\n\t\tthis.blobManager = new BlobManager({\n\t\t\trouteContext: this.handleContext,\n\t\t\tblobManagerLoadInfo,\n\t\t\tstorage: this.storage,\n\t\t\tsendBlobAttachMessage: (localId: string, blobId: string) => {\n\t\t\t\tif (!this.disposed) {\n\t\t\t\t\tthis.submit(\n\t\t\t\t\t\t{ type: ContainerMessageType.BlobAttach, contents: undefined },\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlocalId,\n\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tblobRequested: (blobPath: string) =>\n\t\t\t\tthis.garbageCollector.nodeUpdated({\n\t\t\t\t\tnode: { type: \"Blob\", path: blobPath },\n\t\t\t\t\treason: \"Loaded\",\n\t\t\t\t\ttimestampMs: this.getCurrentReferenceTimestampMs(),\n\t\t\t\t}),\n\t\t\tisBlobDeleted: (blobPath: string) => this.garbageCollector.isNodeDeleted(blobPath),\n\t\t\truntime: this,\n\t\t\tpendingBlobs: pendingRuntimeState?.pendingAttachmentBlobs,\n\t\t\tcreateBlobPayloadPending: this.sessionSchema.createBlobPayloadPending === true,\n\t\t});\n\n\t\tthis.deltaScheduler = new DeltaScheduler(\n\t\t\tthis.innerDeltaManager,\n\t\t\tthis,\n\t\t\tcreateChildLogger({ logger: this.baseLogger, namespace: \"DeltaScheduler\" }),\n\t\t);\n\n\t\tthis.inboundBatchAggregator = new InboundBatchAggregator(\n\t\t\tthis.innerDeltaManager,\n\t\t\t() => this.clientId,\n\t\t\tcreateChildLogger({ logger: this.baseLogger, namespace: \"InboundBatchAggregator\" }),\n\t\t);\n\n\t\tconst legacySendBatchFn = makeLegacySendBatchFn(submitFn, this.innerDeltaManager);\n\n\t\tthis.skipSafetyFlushDuringProcessStack =\n\t\t\t// Keep the old flag name even though we renamed the class member (it shipped in 2.31.0)\n\t\t\tthis.mc.config.getBoolean(\"Fluid.ContainerRuntime.DisableFlushBeforeProcess\") === true;\n\n\t\tthis.outbox = new Outbox({\n\t\t\tshouldSend: () => this.shouldSendOps(),\n\t\t\tpendingStateManager: this.pendingStateManager,\n\t\t\tsubmitBatchFn,\n\t\t\tlegacySendBatchFn,\n\t\t\tcompressor: new OpCompressor(this.mc.logger),\n\t\t\tsplitter: opSplitter,\n\t\t\tconfig: {\n\t\t\t\tcompressionOptions,\n\t\t\t\tmaxBatchSizeInBytes: runtimeOptions.maxBatchSizeInBytes,\n\t\t\t\t// If we disable flush before process, we must be ready to flush partial batches\n\t\t\t\tflushPartialBatches: this.skipSafetyFlushDuringProcessStack,\n\t\t\t},\n\t\t\tlogger: this.mc.logger,\n\t\t\tgroupingManager: opGroupingManager,\n\t\t\tgetCurrentSequenceNumbers: () => ({\n\t\t\t\t// Note: These sequence numbers only change when DeltaManager processes an incoming op\n\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\tclientSequenceNumber: this._processedClientSequenceNumber,\n\t\t\t}),\n\t\t\treSubmit: this.reSubmit.bind(this),\n\t\t\topReentrancy: () => this.dataModelChangeRunner.running,\n\t\t});\n\n\t\tthis._quorum = quorum;\n\t\tthis._quorum.on(\"removeMember\", (clientId: string) => {\n\t\t\tthis.remoteMessageProcessor.clearPartialMessagesFor(clientId);\n\t\t});\n\n\t\tthis._audience = audience;\n\t\tif (audience.getSelf === undefined) {\n\t\t\t// back-compat, added in 2.0 RC3.\n\t\t\t// Purpose: deal with cases when we run against old loader that does not have newly added capabilities\n\t\t\taudience.getSelf = () => {\n\t\t\t\tconst clientId = this._getClientId();\n\t\t\t\treturn clientId === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: ({\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tclient: audience.getMember(clientId),\n\t\t\t\t\t\t} satisfies ISelf);\n\t\t\t};\n\n\t\t\tlet oldClientId = this.clientId;\n\t\t\tthis.on(\"connected\", () => {\n\t\t\t\tconst clientId = this.clientId;\n\t\t\t\tassert(clientId !== undefined, 0x975 /* can't be undefined */);\n\t\t\t\t(audience as unknown as TypedEventEmitter<IAudienceEvents>).emit(\n\t\t\t\t\t\"selfChanged\",\n\t\t\t\t\t{ clientId: oldClientId },\n\t\t\t\t\t{ clientId, client: audience.getMember(clientId) },\n\t\t\t\t);\n\t\t\t\toldClientId = clientId;\n\t\t\t});\n\t\t}\n\n\t\tthis.signalAudience = signalAudience;\n\n\t\tconst closeSummarizerDelayOverride = this.mc.config.getNumber(\n\t\t\t\"Fluid.ContainerRuntime.Test.CloseSummarizerDelayOverrideMs\",\n\t\t);\n\t\tthis.closeSummarizerDelayMs =\n\t\t\tcloseSummarizerDelayOverride ?? defaultCloseSummarizerDelayMs;\n\n\t\t// We haven't emitted dirty/saved yet, but this is the baseline so we know to emit when it changes\n\t\tthis.lastEmittedDirty = this.computeCurrentDirtyState();\n\t\tcontext.updateDirtyContainerState(this.lastEmittedDirty);\n\n\t\tif (!this.skipSafetyFlushDuringProcessStack) {\n\t\t\t// Reference Sequence Number may have just changed, and it must be consistent across a batch,\n\t\t\t// so we should flush now to clear the way for the next ops.\n\t\t\t// NOTE: This will be redundant whenever CR.process was called for the op (since we flush there too) -\n\t\t\t// But we need this coverage for old loaders that don't call ContainerRuntime.process for non-runtime messages.\n\t\t\t// (We have to call flush _before_ processing a runtime op, but after is ok for non-runtime op)\n\t\t\tthis.deltaManager.on(\"op\", () => this.flush());\n\t\t}\n\n\t\t// logging hardware telemetry\n\t\tthis.baseLogger.send({\n\t\t\tcategory: \"generic\",\n\t\t\teventName: \"DeviceSpec\",\n\t\t\t...getDeviceSpec(),\n\t\t});\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"ContainerLoadStats\",\n\t\t\t...this.createContainerMetadata,\n\t\t\t...this.channelCollection.containerLoadStats,\n\t\t\tsummaryNumber: loadSummaryNumber,\n\t\t\tsummaryFormatVersion: metadata?.summaryFormatVersion,\n\t\t\tdisableIsolatedChannels: metadata?.disableIsolatedChannels,\n\t\t\tgcVersion: metadata?.gcFeature,\n\t\t\toptions: JSON.stringify(runtimeOptions),\n\t\t\tidCompressorModeMetadata: metadata?.documentSchema?.runtime?.idCompressorMode,\n\t\t\tidCompressorMode: this.sessionSchema.idCompressorMode,\n\t\t\tsessionRuntimeSchema: JSON.stringify(this.sessionSchema),\n\t\t\tfeatureGates: JSON.stringify({\n\t\t\t\t...featureGatesForTelemetry,\n\t\t\t\tcloseSummarizerDelayOverride,\n\t\t\t\tdisableFlushBeforeProcess: this.skipSafetyFlushDuringProcessStack,\n\t\t\t}),\n\t\t\ttelemetryDocumentId: this.telemetryDocumentId,\n\t\t\tgroupedBatchingEnabled: this.groupedBatchingEnabled,\n\t\t\tinitialSequenceNumber: this.deltaManager.initialSequenceNumber,\n\t\t\tminVersionForCollab: this.minVersionForCollab,\n\t\t});\n\n\t\tReportOpPerfTelemetry(this.clientId, this._deltaManager, this, this.baseLogger);\n\t\tBindBatchTracker(this, this.baseLogger);\n\n\t\tthis.entryPoint = new LazyPromise(async () => {\n\t\t\tif (this._summarizer !== undefined) {\n\t\t\t\treturn this._summarizer;\n\t\t\t}\n\t\t\treturn provideEntryPoint(this);\n\t\t});\n\n\t\t// If we loaded from pending state, then we need to skip any ops that are already accounted in such\n\t\t// saved state, i.e. all the ops marked by Loader layer sa savedOp === true.\n\t\tthis.skipSavedCompressorOps = pendingRuntimeState?.pendingIdCompressorState !== undefined;\n\t}\n\n\tpublic onSchemaChange(schema: IDocumentSchemaCurrent): void {\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"SchemaChangeAccept\",\n\t\t\tsessionRuntimeSchema: JSON.stringify(schema),\n\t\t});\n\n\t\t// Most of the settings will be picked up only by new sessions (i.e. after reload).\n\t\t// We can make it better in the future (i.e. start to use op compression right away), but for simplicity\n\t\t// this is not done.\n\t\t// But ID compressor is special. It's possible, that in future, we will remove \"stickiness\" of ID compressor setting\n\t\t// and will allow to start using it. If that were to happen, we want to ensure that we do not break eventual consistency\n\t\t// promises. To do so, we need to initialize id compressor right away.\n\t\t// As it's implemented right now (with async initialization), this will only work for \"off\" -> \"delayed\" transitions.\n\t\t// Anything else is too risky, and requires ability to initialize ID compressor synchronously!\n\t\tif (schema.runtime.idCompressorMode !== undefined) {\n\t\t\tthis.loadIdCompressor();\n\t\t}\n\t}\n\n\tpublic getCreateChildSummarizerNodeFn(\n\t\tid: string,\n\t\tcreateParam: CreateChildSummarizerNodeParam,\n\t) {\n\t\treturn (\n\t\t\tsummarizeInternal: SummarizeInternalFn,\n\t\t\tgetGCDataFn: (fullGC?: boolean) => Promise<IGarbageCollectionData>,\n\t\t): ISummarizerNodeWithGC =>\n\t\t\tthis.summarizerNode.createChild(\n\t\t\t\tsummarizeInternal,\n\t\t\t\tid,\n\t\t\t\tcreateParam,\n\t\t\t\tundefined,\n\t\t\t\tgetGCDataFn,\n\t\t\t);\n\t}\n\n\tpublic deleteChildSummarizerNode(id: string): void {\n\t\treturn this.summarizerNode.deleteChild(id);\n\t}\n\n\t// #region `IFluidParentContext` APIs that should not be called on Root\n\n\tpublic makeLocallyVisible(): void {\n\t\tassert(false, 0x8eb /* should not be called */);\n\t}\n\n\tpublic setChannelDirty(address: string): void {\n\t\tassert(false, 0x909 /* should not be called */);\n\t}\n\n\t// #endregion\n\n\t/**\n\t * Initializes the state from the base snapshot this container runtime loaded from.\n\t */\n\tprivate async initializeBaseState(loader: ILoader): Promise<void> {\n\t\tif (\n\t\t\tthis.sessionSchema.idCompressorMode === \"on\" ||\n\t\t\t(this.sessionSchema.idCompressorMode === \"delayed\" && this.connected)\n\t\t) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"CreateIdCompressorOnBoot\" },\n\t\t\t\t(event) => {\n\t\t\t\t\tthis._idCompressor = this.createIdCompressorFn();\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tidCompressorMode: this.sessionSchema.idCompressorMode,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\t// This is called from loadRuntime(), long before we process any ops, so there should be no ops accumulated yet.\n\t\t\tassert(this.pendingIdCompressorOps.length === 0, 0x8ec /* no pending ops */);\n\t\t}\n\n\t\tawait this.initializeSummarizer(loader);\n\t\tawait this.garbageCollector.initializeBaseState();\n\t}\n\n\tprivate async initializeSummarizer(loader: ILoader): Promise<void> {\n\t\tif (this.summariesDisabled) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"SummariesDisabled\" });\n\t\t\treturn;\n\t\t}\n\n\t\tconst { maxOpsSinceLastSummary = 0, initialSummarizerDelayMs = 0 } = isSummariesDisabled(\n\t\t\tthis.summaryConfiguration,\n\t\t)\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\t...this.summaryConfiguration,\n\t\t\t\t\tinitialSummarizerDelayMs:\n\t\t\t\t\t\t// back-compat: initialSummarizerDelayMs was moved from ISummaryRuntimeOptions\n\t\t\t\t\t\t// to ISummaryConfiguration in 0.60.\n\t\t\t\t\t\tthis.runtimeOptions.summaryOptions.initialSummarizerDelayMs ??\n\t\t\t\t\t\tthis.summaryConfiguration.initialSummarizerDelayMs,\n\t\t\t\t};\n\n\t\tconst summaryCollection: SummaryCollection = new SummaryCollection(\n\t\t\tthis.deltaManager,\n\t\t\tthis.baseLogger,\n\t\t);\n\t\tconst onRequestMode = isSummaryOnRequest(this.summaryConfiguration);\n\n\t\tif (this.isSummarizerClient) {\n\t\t\t// We want to dynamically import any thing inside summaryDelayLoadedModule module only when we are the summarizer client,\n\t\t\t// so that all non summarizer clients don't have to load the code inside this module.\n\t\t\tconst module = await import(\n\t\t\t\t/* webpackChunkName: \"summarizerDelayLoadedModule\" */ \"./summary/index.js\"\n\t\t\t);\n\t\t\tthis._summarizer = new module.Summarizer(\n\t\t\t\tthis /* ISummarizerRuntime */,\n\t\t\t\t() => this.summaryConfiguration,\n\t\t\t\tthis /* ISummarizerInternalsProvider */,\n\t\t\t\tthis.handleContext,\n\t\t\t\tsummaryCollection,\n\n\t\t\t\tasync (runtime: IConnectableRuntime) =>\n\t\t\t\t\tmodule.RunWhileConnectedCoordinator.create(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\t// Summarization runs in summarizer client and needs access to the real (non-proxy) active\n\t\t\t\t\t\t// information. The proxy delta manager would always return false for summarizer client.\n\t\t\t\t\t\t() => this.innerDeltaManager.active,\n\t\t\t\t\t),\n\t\t\t);\n\t\t} else if (\n\t\t\t!onRequestMode &&\n\t\t\tSummarizerClientElection.clientDetailsPermitElection(this.clientDetails)\n\t\t) {\n\t\t\t// Only create a SummaryManager and SummarizerClientElection\n\t\t\t// if summaries are enabled and we are not the summarizer client.\n\t\t\tconst orderedClientLogger = createChildLogger({\n\t\t\t\tlogger: this.baseLogger,\n\t\t\t\tnamespace: \"OrderedClientElection\",\n\t\t\t});\n\t\t\tconst orderedClientCollection = new OrderedClientCollection(\n\t\t\t\torderedClientLogger,\n\t\t\t\tthis.innerDeltaManager,\n\t\t\t\tthis._quorum,\n\t\t\t);\n\t\t\tconst orderedClientElectionForSummarizer = new OrderedClientElection(\n\t\t\t\torderedClientLogger,\n\t\t\t\torderedClientCollection,\n\t\t\t\tthis.electedSummarizerData ?? this.innerDeltaManager.lastSequenceNumber,\n\t\t\t\tSummarizerClientElection.isClientEligible,\n\t\t\t\tthis.mc.config.getBoolean(\n\t\t\t\t\t\"Fluid.ContainerRuntime.OrderedClientElection.EnablePerformanceEvents\",\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tthis.summarizerClientElection = new SummarizerClientElection(\n\t\t\t\torderedClientLogger,\n\t\t\t\tsummaryCollection,\n\t\t\t\torderedClientElectionForSummarizer,\n\t\t\t\tmaxOpsSinceLastSummary,\n\t\t\t);\n\n\t\t\tconst defaultAction = (): void => {\n\t\t\t\tif (summaryCollection.opsSinceLastAck > maxOpsSinceLastSummary) {\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"SummaryStatus:Behind\" });\n\t\t\t\t\t// unregister default to no log on every op after falling behind\n\t\t\t\t\t// and register summary ack handler to re-register this handler\n\t\t\t\t\t// after successful summary\n\t\t\t\t\tsummaryCollection.once(MessageType.SummaryAck, () => {\n\t\t\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\t\t\teventName: \"SummaryStatus:CaughtUp\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// we've caught up, so re-register the default action to monitor for\n\t\t\t\t\t\t// falling behind, and unregister ourself\n\t\t\t\t\t\tsummaryCollection.on(\"default\", defaultAction);\n\t\t\t\t\t});\n\t\t\t\t\tsummaryCollection.off(\"default\", defaultAction);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tsummaryCollection.on(\"default\", defaultAction);\n\n\t\t\t// Create the SummaryManager and mark the initial state\n\t\t\tthis.summaryManager = new SummaryManager(\n\t\t\t\tthis.summarizerClientElection,\n\t\t\t\tthis, // IConnectedState\n\t\t\t\tsummaryCollection,\n\t\t\t\tthis.baseLogger,\n\t\t\t\tformCreateSummarizerFn(loader),\n\t\t\t\tnew Throttler(\n\t\t\t\t\t60 * 1000, // 60 sec delay window\n\t\t\t\t\t30 * 1000, // 30 sec max delay\n\t\t\t\t\t// throttling function increases exponentially (0ms, 40ms, 80ms, 160ms, etc)\n\t\t\t\t\tformExponentialFn({ coefficient: 20, initialDelay: 0 }),\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tinitialDelayMs: initialSummarizerDelayMs,\n\t\t\t\t},\n\t\t\t);\n\t\t\t// Forward events from SummaryManager\n\t\t\tfor (const eventName of [\n\t\t\t\t\"summarize\",\n\t\t\t\t\"summarizeAllAttemptsFailed\",\n\t\t\t\t\"summarizerStop\",\n\t\t\t\t\"summarizerStart\",\n\t\t\t\t\"summarizerStartupFailed\",\n\t\t\t]) {\n\t\t\t\tthis.summaryManager?.on(eventName, (...args: unknown[]) => {\n\t\t\t\t\tthis.emit(eventName, ...args);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.summaryManager.start();\n\t\t}\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._disposed = true;\n\n\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t{\n\t\t\t\teventName: \"ContainerRuntimeDisposed\",\n\t\t\t\tisDirty: this.isDirty,\n\t\t\t\tlastSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\tattachState: this.attachState,\n\t\t\t},\n\t\t\terror,\n\t\t);\n\n\t\tif (this.summaryManager !== undefined) {\n\t\t\tthis.summaryManager.dispose();\n\t\t}\n\t\tthis.garbageCollector.dispose();\n\t\tthis._summarizer?.dispose();\n\t\tthis.channelCollection.dispose();\n\t\tthis.pendingStateManager.dispose();\n\t\tthis.inboundBatchAggregator.dispose();\n\t\tthis.deltaScheduler.dispose();\n\t\tthis._deltaManager.dispose();\n\t\tthis.emit(\"dispose\");\n\t\tthis.removeAllListeners();\n\t}\n\n\t/**\n\t * Api to fetch the snapshot from the service for a loadingGroupIds.\n\t * @param loadingGroupIds - LoadingGroupId for which the snapshot is asked for.\n\t * @param pathParts - Parts of the path, which we want to extract from the snapshot tree.\n\t * @returns snapshotTree and the sequence number of the snapshot.\n\t */\n\tpublic async getSnapshotForLoadingGroupId(\n\t\tloadingGroupIds: string[],\n\t\tpathParts: string[],\n\t): Promise<{ snapshotTree: ISnapshotTree; sequenceNumber: number }> {\n\t\tconst sortedLoadingGroupIds = loadingGroupIds.sort();\n\t\tassert(\n\t\t\tthis.storage.getSnapshot !== undefined,\n\t\t\t0x8ed /* getSnapshot api should be defined if used */,\n\t\t);\n\t\tlet loadedFromCache = true;\n\t\t// Lookup up in the cache, if not present then make the network call as multiple datastores could\n\t\t// be in same loading group. So, once we have fetched the snapshot for that loading group on\n\t\t// any request, then cache that as same group could be requested in future too.\n\t\tconst snapshot = await this.snapshotCacheForLoadingGroupIds.addOrGet(\n\t\t\tsortedLoadingGroupIds.join(\",\"),\n\t\t\tasync () => {\n\t\t\t\tassert(\n\t\t\t\t\tthis.storage.getSnapshot !== undefined,\n\t\t\t\t\t0x8ee /* getSnapshot api should be defined if used */,\n\t\t\t\t);\n\t\t\t\tloadedFromCache = false;\n\t\t\t\treturn this.storage.getSnapshot({\n\t\t\t\t\tcacheSnapshot: false,\n\t\t\t\t\tscenarioName: \"snapshotForLoadingGroupId\",\n\t\t\t\t\tloadingGroupIds: sortedLoadingGroupIds,\n\t\t\t\t});\n\t\t\t},\n\t\t);\n\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"GroupIdSnapshotFetched\",\n\t\t\tdetails: JSON.stringify({\n\t\t\t\tfromCache: loadedFromCache,\n\t\t\t\tloadingGroupIds: loadingGroupIds.join(\",\"),\n\t\t\t}),\n\t\t});\n\t\t// Find the snapshotTree inside the returned snapshot based on the path as given in the request.\n\t\tconst hasIsolatedChannels = rootHasIsolatedChannels(this.metadata);\n\t\tconst snapshotTreeForPath = this.getSnapshotTreeForPath(\n\t\t\tsnapshot.snapshotTree,\n\t\t\tpathParts,\n\t\t\thasIsolatedChannels,\n\t\t);\n\t\tassert(snapshotTreeForPath !== undefined, 0x8ef /* no snapshotTree for the path */);\n\t\tconst snapshotSeqNumber = snapshot.sequenceNumber;\n\t\tassert(snapshotSeqNumber !== undefined, 0x8f0 /* snapshotSeqNumber should be present */);\n\n\t\t// This assert fires if we get a snapshot older than the snapshot we loaded from. This is a service issue.\n\t\t// Snapshots should only move forward. If we observe an older snapshot than the one we loaded from, then likely\n\t\t// the file has been overwritten or service lost data.\n\t\tif (snapshotSeqNumber < this.deltaManager.initialSequenceNumber) {\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\"Downloaded snapshot older than snapshot we loaded from\",\n\t\t\t\t\"getSnapshotForLoadingGroupId\",\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tloadingGroupIds: sortedLoadingGroupIds.join(\",\"),\n\t\t\t\t\tsnapshotSeqNumber,\n\t\t\t\t\tinitialSequenceNumber: this.deltaManager.initialSequenceNumber,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// If the snapshot is ahead of the last seq number of the delta manager, then catch up before\n\t\t// returning the snapshot.\n\t\tif (snapshotSeqNumber > this.deltaManager.lastSequenceNumber) {\n\t\t\t// If this is a summarizer client, which is trying to load a group and it finds that there is\n\t\t\t// another snapshot from which the summarizer loaded and it is behind, then just give up as\n\t\t\t// the summarizer state is not up to date.\n\t\t\t// This should be a recoverable scenario and shouldn't happen as we should process the ack first.\n\t\t\tif (this._summarizer !== undefined) {\n\t\t\t\tthrow new Error(\"Summarizer client behind, loaded newer snapshot with loadingGroupId\");\n\t\t\t}\n\n\t\t\t// We want to catchup from sequenceNumber to targetSequenceNumber\n\t\t\tconst props: ITelemetryGenericEventExt = {\n\t\t\t\teventName: \"GroupIdSnapshotCatchup\",\n\t\t\t\tloadingGroupIds: sortedLoadingGroupIds.join(\",\"),\n\t\t\t\ttargetSequenceNumber: snapshotSeqNumber, // This is so we reuse some columns in telemetry\n\t\t\t\tsequenceNumber: this.deltaManager.lastSequenceNumber, // This is so we reuse some columns in telemetry\n\t\t\t};\n\n\t\t\tconst event = PerformanceEvent.start(this.mc.logger, {\n\t\t\t\t...props,\n\t\t\t});\n\t\t\t// If the inbound deltas queue is paused or disconnected, we expect a reconnect and unpause\n\t\t\t// as long as it's not a summarizer client.\n\t\t\tif (this._deltaManager.inbound.paused) {\n\t\t\t\tprops.inboundPaused = this._deltaManager.inbound.paused; // reusing telemetry\n\t\t\t}\n\t\t\tconst defP = new Deferred<boolean>();\n\t\t\tthis.deltaManager.on(\"op\", (message: ISequencedDocumentMessage) => {\n\t\t\t\tif (message.sequenceNumber >= snapshotSeqNumber) {\n\t\t\t\t\tdefP.resolve(true);\n\t\t\t\t}\n\t\t\t});\n\t\t\tawait defP.promise;\n\t\t\tevent.end(props);\n\t\t}\n\t\treturn { snapshotTree: snapshotTreeForPath, sequenceNumber: snapshotSeqNumber };\n\t}\n\n\t/**\n\t * Api to find a snapshot tree inside a bigger snapshot tree based on the path in the pathParts array.\n\t * @param snapshotTree - snapshot tree to look into.\n\t * @param pathParts - Part of the path, which we want to extract from the snapshot tree.\n\t * @param hasIsolatedChannels - whether the channels are present inside \".channels\" subtree. Older\n\t * snapshots will not have trees inside \".channels\", so check that.\n\t * @returns requested snapshot tree based on the path parts.\n\t */\n\tprivate getSnapshotTreeForPath(\n\t\tsnapshotTree: ISnapshotTree,\n\t\tpathParts: string[],\n\t\thasIsolatedChannels: boolean,\n\t): ISnapshotTree | undefined {\n\t\tlet childTree = snapshotTree;\n\t\tfor (const part of pathParts) {\n\t\t\tif (hasIsolatedChannels) {\n\t\t\t\tchildTree = childTree?.trees[channelsTreeName];\n\t\t\t}\n\t\t\tchildTree = childTree?.trees[part];\n\t\t}\n\t\treturn childTree;\n\t}\n\n\t/**\n\t * Notifies this object about the request made to the container.\n\t * @param request - Request made to the handler.\n\t * @deprecated Will be removed in future major release. This method needs to stay private until LTS version of Loader moves to \"2.0.0-internal.7.0.0\".\n\t */\n\t// @ts-expect-error expected to be used by LTS Loaders and Containers\n\tprivate async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst parser = RequestParser.create(request);\n\t\t\tconst id = parser.pathParts[0];\n\n\t\t\tif (id === summarizerRequestUrl && parser.pathParts.length === 1) {\n\t\t\t\tif (this._summarizer !== undefined) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 200,\n\t\t\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\t\t\tvalue: this._summarizer,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn create404Response(request);\n\t\t\t}\n\t\t\tif (this.requestHandler !== undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures\n\t\t\t\treturn this.requestHandler(parser, this);\n\t\t\t}\n\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\t/**\n\t * Resolves URI representing handle\n\t * @param request - Request made to the handler.\n\t */\n\tpublic async resolveHandle(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\tconst requestParser = RequestParser.create(request);\n\t\t\tconst id = requestParser.pathParts[0];\n\n\t\t\tif (id === \"_channels\") {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/return-await -- Adding an await here causes test failures\n\t\t\t\treturn this.resolveHandle(requestParser.createSubRequest(1));\n\t\t\t}\n\n\t\t\tif (id === blobManagerBasePath && requestParser.isLeaf(2)) {\n\t\t\t\tconst localId = requestParser.pathParts[1];\n\t\t\t\tconst payloadPending = requestParser.headers?.[RuntimeHeaders.payloadPending] === true;\n\t\t\t\tif (\n\t\t\t\t\t!this.blobManager.hasBlob(localId) &&\n\t\t\t\t\trequestParser.headers?.[RuntimeHeaders.wait] === false\n\t\t\t\t) {\n\t\t\t\t\treturn create404Response(request);\n\t\t\t\t}\n\n\t\t\t\tconst blob = await this.blobManager.getBlob(localId, payloadPending);\n\t\t\t\treturn {\n\t\t\t\t\tstatus: 200,\n\t\t\t\t\tmimeType: \"fluid/object\",\n\t\t\t\t\tvalue: blob,\n\t\t\t\t};\n\t\t\t} else if (requestParser.pathParts.length > 0) {\n\t\t\t\treturn await this.channelCollection.request(request);\n\t\t\t}\n\n\t\t\treturn create404Response(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/container-definitions#IRuntime.getEntryPoint}\n\t */\n\tpublic async getEntryPoint(): Promise<FluidObject> {\n\t\treturn this.entryPoint;\n\t}\n\tprivate readonly entryPoint: LazyPromise<FluidObject>;\n\n\tprivate internalId(maybeAlias: string): string {\n\t\treturn this.channelCollection.internalId(maybeAlias);\n\t}\n\n\t/**\n\t * Adds the container's metadata to the given summary tree.\n\t */\n\tprivate addMetadataToSummary(summaryTree: ISummaryTreeWithStats): void {\n\t\t// The last message processed at the time of summary. If there are no new messages, use the message from the\n\t\t// last summary.\n\t\tconst message =\n\t\t\textractSummaryMetadataMessage(this.deltaManager.lastMessage) ??\n\t\t\tthis.messageAtLastSummary;\n\n\t\tconst documentSchema = this.documentsSchemaController.summarizeDocumentSchema(\n\t\t\tthis.deltaManager.lastSequenceNumber,\n\t\t);\n\n\t\t// Is document schema explicit control on?\n\t\tconst explicitSchemaControl = documentSchema?.runtime.explicitSchemaControl === true;\n\n\t\tconst metadata: IContainerRuntimeMetadata = {\n\t\t\t...this.createContainerMetadata,\n\t\t\t// Increment the summary number for the next summary that will be generated.\n\t\t\tsummaryNumber: this.nextSummaryNumber++,\n\t\t\tsummaryFormatVersion: 1,\n\t\t\t...this.garbageCollector.getMetadata(),\n\t\t\ttelemetryDocumentId: this.telemetryDocumentId,\n\t\t\t// If explicit document schema control is not on, use legacy way to supply last message (using 'message' property).\n\t\t\t// Otherwise use new 'lastMessage' property, but also put content into the 'message' property that cases old\n\t\t\t// runtimes (that preceded document schema control capabilities) to close container on load due to mismatch in\n\t\t\t// last message's sequence number.\n\t\t\t// See also lastMessageFromMetadata()\n\t\t\tmessage: explicitSchemaControl\n\t\t\t\t? ({ sequenceNumber: -1 } as unknown as ISummaryMetadataMessage)\n\t\t\t\t: message,\n\t\t\tlastMessage: explicitSchemaControl ? message : undefined,\n\t\t\tdocumentSchema,\n\t\t};\n\n\t\taddBlobToSummary(summaryTree, metadataBlobName, JSON.stringify(metadata));\n\t}\n\n\tprotected addContainerStateToSummary(\n\t\tsummaryTree: ISummaryTreeWithStats,\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): void {\n\t\tthis.addMetadataToSummary(summaryTree);\n\n\t\tif (this._idCompressor) {\n\t\t\tconst idCompressorState = JSON.stringify(this._idCompressor.serialize(false));\n\t\t\taddBlobToSummary(summaryTree, idCompressorBlobName, idCompressorState);\n\t\t}\n\n\t\tif (this.remoteMessageProcessor.partialMessages.size > 0) {\n\t\t\tconst content = JSON.stringify([...this.remoteMessageProcessor.partialMessages]);\n\t\t\taddBlobToSummary(summaryTree, chunksBlobName, content);\n\t\t}\n\n\t\tconst recentBatchInfo =\n\t\t\tthis.duplicateBatchDetector?.getRecentBatchInfoForSummary(telemetryContext);\n\t\tif (recentBatchInfo !== undefined) {\n\t\t\taddBlobToSummary(summaryTree, recentBatchInfoBlobName, JSON.stringify(recentBatchInfo));\n\t\t}\n\n\t\tconst dataStoreAliases = this.channelCollection.aliases;\n\t\tif (dataStoreAliases.size > 0) {\n\t\t\taddBlobToSummary(summaryTree, aliasBlobName, JSON.stringify([...dataStoreAliases]));\n\t\t}\n\n\t\tif (this.summarizerClientElection) {\n\t\t\tconst electedSummarizerContent = JSON.stringify(\n\t\t\t\tthis.summarizerClientElection?.serialize(),\n\t\t\t);\n\t\t\taddBlobToSummary(summaryTree, electedSummarizerBlobName, electedSummarizerContent);\n\t\t}\n\n\t\tconst blobManagerSummary = this.blobManager.summarize();\n\t\t// Some storage (like git) doesn't allow empty tree, so we can omit it.\n\t\t// and the blob manager can handle the tree not existing when loading\n\t\tif (Object.keys(blobManagerSummary.summary.tree).length > 0) {\n\t\t\taddSummarizeResultToSummary(summaryTree, blobsTreeName, blobManagerSummary);\n\t\t}\n\n\t\tconst gcSummary = this.garbageCollector.summarize(fullTree, trackState, telemetryContext);\n\t\tif (gcSummary !== undefined) {\n\t\t\taddSummarizeResultToSummary(summaryTree, gcTreeKey, gcSummary);\n\t\t}\n\t}\n\n\t// Track how many times the container tries to reconnect with pending messages.\n\t// This happens when the connection state is changed and we reset the counter\n\t// when we are able to process a local op or when there are no pending messages.\n\t// If this counter reaches a max, it's a good indicator that the container\n\t// is not making progress and it is stuck in a retry loop.\n\tprivate shouldContinueReconnecting(): boolean {\n\t\tif (this.maxConsecutiveReconnects <= 0) {\n\t\t\t// Feature disabled, we never stop reconnecting\n\t\t\treturn true;\n\t\t}\n\n\t\tif (!this.hasPendingMessages()) {\n\t\t\t// If there are no pending messages, we can always reconnect\n\t\t\tthis.resetReconnectCount();\n\t\t\treturn true;\n\t\t}\n\n\t\tif (this.consecutiveReconnects === Math.floor(this.maxConsecutiveReconnects / 2)) {\n\t\t\t// If we're halfway through the max reconnects, send an event in order\n\t\t\t// to better identify false positives, if any. If the rate of this event\n\t\t\t// matches Container Close count below, we can safely cut down\n\t\t\t// maxConsecutiveReconnects to half.\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"ReconnectsWithNoProgress\",\n\t\t\t\tattempts: this.consecutiveReconnects,\n\t\t\t\tpendingMessages: this.pendingMessagesCount,\n\t\t\t});\n\t\t}\n\n\t\treturn this.consecutiveReconnects < this.maxConsecutiveReconnects;\n\t}\n\n\tprivate resetReconnectCount(): void {\n\t\tthis.consecutiveReconnects = 0;\n\t}\n\n\tprivate replayPendingStates(): void {\n\t\t// We need to be able to send ops to replay states\n\t\tif (!this.shouldSendOps()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Replaying is an internal operation and we don't want to generate noise while doing it.\n\t\t// So temporarily disable dirty state change events, and save the old state.\n\t\t// When we're done, we'll emit the event if the state changed.\n\t\tconst oldState = this.lastEmittedDirty;\n\t\tassert(this.emitDirtyDocumentEvent, 0x127 /* \"dirty document event not set on replay\" */);\n\t\tthis.emitDirtyDocumentEvent = false;\n\n\t\ttry {\n\t\t\t// Any ID Allocation ops that failed to submit after the pending state was queued need to have\n\t\t\t// the corresponding ranges resubmitted (note this call replaces the typical resubmit flow).\n\t\t\t// Since we don't submit ID Allocation ops when staged, any outstanding ranges would be from\n\t\t\t// before staging mode so we can simply say staged: false.\n\t\t\tthis.submitIdAllocationOpIfNeeded({ resubmitOutstandingRanges: true, staged: false });\n\t\t\tthis.scheduleFlush();\n\n\t\t\t// replay the ops\n\t\t\tthis.pendingStateManager.replayPendingStates();\n\t\t} finally {\n\t\t\t// Restore the old state, re-enable event emit\n\t\t\tthis.lastEmittedDirty = oldState;\n\t\t\tthis.emitDirtyDocumentEvent = true;\n\t\t}\n\n\t\t// This will emit an event if the state changed relative to before replay\n\t\tthis.updateDocumentDirtyState();\n\t}\n\n\t/**\n\t * Parse an op's type and actual content from given serialized content\n\t * ! Note: this format needs to be in-line with what is set in the \"ContainerRuntime.submit(...)\" method\n\t */\n\tprivate parseLocalOpContent(serializedContents?: string): LocalContainerRuntimeMessage {\n\t\tassert(serializedContents !== undefined, 0x6d5 /* content must be defined */);\n\t\tconst message = JSON.parse(serializedContents) as LocalContainerRuntimeMessage;\n\t\tassert(message.type !== undefined, 0x6d6 /* incorrect op content format */);\n\t\treturn message;\n\t}\n\n\tprivate async applyStashedOp(serializedOpContent: string): Promise<unknown> {\n\t\t// Pending State contains serialized contents, so parse it here.\n\t\tconst opContents = this.parseLocalOpContent(serializedOpContent);\n\t\tswitch (opContents.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Attach:\n\t\t\tcase ContainerMessageType.Alias: {\n\t\t\t\treturn this.channelCollection.applyStashedOp(opContents);\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation: {\n\t\t\t\t// IDs allocation ops in stashed state are ignored because the tip state of the compressor\n\t\t\t\t// is serialized into the pending state. This is done because generation of new IDs during\n\t\t\t\t// stashed op application (or, later, resubmit) must generate new IDs and if the compressor\n\t\t\t\t// was loaded from a state serialized at the same time as the summary tree in the stashed state\n\t\t\t\t// then it would generate IDs that collide with any in later stashed ops.\n\t\t\t\t// In the future, IdCompressor could be extended to have an \"applyStashedOp\" or similar method\n\t\t\t\t// and the runtime could filter out all ID allocation ops from the stashed state and apply them\n\t\t\t\t// before applying the rest of the stashed ops. This would accomplish the same thing but with\n\t\t\t\t// better performance in future incremental stashed state creation.\n\t\t\t\tassert(\n\t\t\t\t\tthis.sessionSchema.idCompressorMode !== undefined,\n\t\t\t\t\t0x8f1 /* ID compressor should be in use */,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tthrow new Error(\"rejoin not expected here\");\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\t// GC op is only sent in summarizer which should never have stashed ops.\n\t\t\t\tthrow new LoggingError(\"GC op not expected to be stashed in summarizer\");\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst error = getUnknownMessageTypeError(\n\t\t\t\t\topContents.type,\n\t\t\t\t\t\"applyStashedOp\" /* codePath */,\n\t\t\t\t);\n\t\t\t\tthis.closeFn(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate loadIdCompressor(): void {\n\t\tif (\n\t\t\tthis._idCompressor === undefined &&\n\t\t\tthis.sessionSchema.idCompressorMode !== undefined\n\t\t) {\n\t\t\tPerformanceEvent.timedExec(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{ eventName: \"CreateIdCompressorOnDelayedLoad\" },\n\t\t\t\t(event) => {\n\t\t\t\t\tthis._idCompressor = this.createIdCompressorFn();\n\t\t\t\t\t// Finalize any ranges we received while the compressor was turned off.\n\t\t\t\t\tconst ops = this.pendingIdCompressorOps;\n\t\t\t\t\tthis.pendingIdCompressorOps = [];\n\t\t\t\t\tconst trace = Trace.start();\n\t\t\t\t\tfor (const range of ops) {\n\t\t\t\t\t\tthis._idCompressor.finalizeCreationRange(range);\n\t\t\t\t\t}\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\tfinalizeCreationRangeDuration: trace.trace().duration,\n\t\t\t\t\t\t\tidCompressorMode: this.sessionSchema.idCompressorMode,\n\t\t\t\t\t\t\tpendingIdCompressorOps: ops.length,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t);\n\t\t\tassert(this.pendingIdCompressorOps.length === 0, 0x976 /* No new ops added */);\n\t\t}\n\t}\n\n\tprivate readonly notifyReadOnlyState = (readonly: boolean): void =>\n\t\tthis.channelCollection.notifyReadOnlyState(readonly);\n\n\tpublic setConnectionState(canSendOps: boolean, clientId?: string): void {\n\t\tthis.setConnectionStateToConnectedOrDisconnected(canSendOps, clientId);\n\t}\n\n\tpublic setConnectionStatus(status: ConnectionStatus): void {\n\t\tswitch (status.connectionState) {\n\t\t\tcase ConnectionState.Connected: {\n\t\t\t\tthis.setConnectionStateToConnectedOrDisconnected(\n\t\t\t\t\tstatus.canSendOps,\n\t\t\t\t\tstatus.clientConnectionId,\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ConnectionState.Disconnected: {\n\t\t\t\tthis.setConnectionStateToConnectedOrDisconnected(\n\t\t\t\t\tstatus.canSendOps,\n\t\t\t\t\tstatus.priorConnectedClientConnectionId,\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ConnectionState.CatchingUp: {\n\t\t\t\tassert(\n\t\t\t\t\tthis.getConnectionState !== undefined &&\n\t\t\t\t\t\tthis.getConnectionState() === ConnectionState.CatchingUp,\n\t\t\t\t\t0xc8d /* connection state mismatch between getConnectionState and setConnectionStatus notification */,\n\t\t\t\t);\n\n\t\t\t\t// Note: Historically when only `setConnectionState` of `IRuntime`\n\t\t\t\t// was supported, it was possible to be in `CatchingUp` state and\n\t\t\t\t// call through to `setConnectionStateCore` when there is a readonly\n\t\t\t\t// change - see `Container`'s `\"deltaManager.on(\"readonly\"`. There\n\t\t\t\t// would not be a transition of `canSendOps` in that case, but\n\t\t\t\t// `channelCollection` and `garbageCollector` would receive early\n\t\t\t\t// `setConnectionState` call AND `this` would `emit` \"disconnected\"\n\t\t\t\t// event.\n\n\t\t\t\tthis.emitServiceConnectionEvents(\n\t\t\t\t\t/* canSendOpsChanged */ this.canSendOps,\n\t\t\t\t\t/* canSendOps */ false,\n\t\t\t\t\tstatus.pendingClientConnectionId,\n\t\t\t\t);\n\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// No default\n\t\t}\n\t}\n\n\tprivate setConnectionStateToConnectedOrDisconnected(\n\t\tcanSendOps: boolean,\n\t\tclientId: string | undefined,\n\t): void {\n\t\t// Validate we have consistent state\n\t\tconst currentClientId = this._audience.getSelf()?.clientId;\n\t\tassert(clientId === currentClientId, 0x977 /* input clientId does not match Audience */);\n\t\tassert(\n\t\t\tthis.clientId === currentClientId,\n\t\t\t0x978 /* this.clientId does not match Audience */,\n\t\t);\n\n\t\tif (canSendOps && this.sessionSchema.idCompressorMode === \"delayed\") {\n\t\t\tthis.loadIdCompressor();\n\t\t}\n\n\t\tthis.setConnectionStateCore(canSendOps, clientId);\n\t}\n\n\t/**\n\t * Raises and propagates connected events.\n\t * @param canSendOps - Indicates whether the container can send ops or not (connected and not readonly).\n\t * @remarks The connection state from container context used here when raising connected events.\n\t */\n\tprivate setConnectionStateCore(canSendOps: boolean, clientId?: string): void {\n\t\tthis.verifyNotClosed();\n\n\t\t// There might be no change of state due to Container calling this API after loading runtime.\n\t\tconst canSendOpsChanged = this.canSendOps !== canSendOps;\n\t\tconst reconnection = canSendOpsChanged && !canSendOps;\n\n\t\t// We need to flush the ops currently collected by Outbox to preserve original order.\n\t\t// This flush NEEDS to happen before we set the ContainerRuntime to \"connected\".\n\t\t// We want these ops to get to the PendingStateManager without sending to service and have them return to the Outbox upon calling \"replayPendingStates\".\n\t\tif (canSendOpsChanged && canSendOps) {\n\t\t\tthis.flush();\n\t\t}\n\n\t\tthis.canSendOps = canSendOps;\n\n\t\tif (canSendOps) {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attached,\n\t\t\t\t0x3cd /* Connection is possible only if container exists in storage */,\n\t\t\t);\n\t\t\tif (canSendOpsChanged) {\n\t\t\t\tthis.signalTelemetryManager.resetTracking();\n\t\t\t}\n\t\t}\n\n\t\t// Fail while disconnected\n\t\tif (reconnection) {\n\t\t\tthis.consecutiveReconnects++;\n\n\t\t\tif (!this.shouldContinueReconnecting()) {\n\t\t\t\tthis.closeFn(\n\t\t\t\t\tDataProcessingError.create(\n\t\t\t\t\t\t\"Runtime detected too many reconnects with no progress syncing local ops.\",\n\t\t\t\t\t\t\"setConnectionState\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdataLoss: 1,\n\t\t\t\t\t\t\tattempts: this.consecutiveReconnects,\n\t\t\t\t\t\t\tpendingMessages: this.pendingMessagesCount,\n\t\t\t\t\t\t},\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (canSendOpsChanged) {\n\t\t\tthis.replayPendingStates();\n\t\t}\n\n\t\tthis.channelCollection.setConnectionState(canSendOps, clientId);\n\t\tthis.garbageCollector.setConnectionState(canSendOps, clientId);\n\n\t\t// Emit \"connected\" and \"disconnected\" events based on ability to send ops\n\t\traiseConnectedEvent(this.mc.logger, this, this.connected /* canSendOps */, clientId);\n\t\t// Emit \"connectedToService\" and \"disconnectedFromService\" events based on service connection status\n\t\tthis.emitServiceConnectionEvents(canSendOpsChanged, canSendOps, clientId);\n\t}\n\n\t/**\n\t * Emits service connection events based on connection state changes.\n\t *\n\t * @remarks\n\t * \"connectedToService\" is emitted when container connection state transitions to 'CatchingUp' or 'Connected' regardless of connection mode.\n\t * \"disconnectedFromService\" excludes false \"disconnected\" events that happen when readonly client transitions to 'Connected'.\n\t */\n\tprivate emitServiceConnectionEvents(\n\t\tcanSendOpsChanged: boolean,\n\t\tcanSendOps: boolean,\n\t\tclientId?: string,\n\t): void {\n\t\tif (!this.getConnectionState) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst connectionState = this.getConnectionState();\n\t\tconst canSendSignals =\n\t\t\tconnectionState === ConnectionState.Connected ||\n\t\t\tconnectionState === ConnectionState.CatchingUp;\n\t\tconst canSendSignalsChanged = this.canSendSignals !== canSendSignals;\n\t\tthis.canSendSignals = canSendSignals;\n\t\tif (canSendSignalsChanged) {\n\t\t\t// If canSendSignals changed, we either transitioned from CatchingUp or\n\t\t\t// Connected to Disconnected or EstablishingConnection to CatchingUp.\n\t\t\tif (canSendSignals) {\n\t\t\t\t// Emit for EstablishingConnection to CatchingUp or Connected transition\n\t\t\t\tthis.emit(\"connectedToService\", clientId, canSendOps);\n\t\t\t} else {\n\t\t\t\t// Emit for CatchingUp or Connected to Disconnected transition\n\t\t\t\tthis.emit(\"disconnectedFromService\");\n\t\t\t}\n\t\t} else if (canSendOpsChanged) {\n\t\t\t// If canSendSignals did not change but canSendOps did, then operations possible has changed.\n\t\t\tthis.emit(\"operabilityChanged\", canSendOps);\n\t\t}\n\t}\n\n\tpublic async notifyOpReplay(message: ISequencedDocumentMessage): Promise<void> {\n\t\tawait this.pendingStateManager.applyStashedOpsAt(message.sequenceNumber);\n\t}\n\n\t/**\n\t * Processes the op.\n\t * @param messageCopy - Sequenced message for a distributed document.\n\t * @param local - true if the message was originally generated by the client receiving it.\n\t */\n\tpublic process({ ...messageCopy }: ISequencedDocumentMessage, local: boolean): void {\n\t\t// spread operator above ensure we make a shallow copy of message, as the processing flow will modify it.\n\t\t// There might be multiple container instances receiving the same message.\n\n\t\tthis.verifyNotClosed();\n\n\t\tif (!this.skipSafetyFlushDuringProcessStack) {\n\t\t\t// Reference Sequence Number may be about to change, and it must be consistent across a batch, so flush now\n\t\t\tthis.flush();\n\t\t}\n\n\t\tthis.ensureNoDataModelChanges(() => {\n\t\t\tthis.processInboundMessageOrBatch(messageCopy, local);\n\t\t});\n\t}\n\n\t/**\n\t * Implementation of core logic for {@link ContainerRuntime.process}, once preconditions are established\n\t *\n\t * @param messageCopy - Shallow copy of the sequenced message. If it's a virtualized batch, we'll process\n\t * all messages in the batch here.\n\t */\n\tprivate processInboundMessageOrBatch(\n\t\tmessageCopy: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): void {\n\t\t// Whether or not the message appears to be a runtime message from an up-to-date client.\n\t\t// It may be a legacy runtime message (ie already unpacked and ContainerMessageType)\n\t\t// or something different, like a system message.\n\t\tconst hasModernRuntimeMessageEnvelope = messageCopy.type === MessageType.Operation;\n\t\tconst savedOp = (messageCopy.metadata as ISavedOpMetadata)?.savedOp;\n\t\tconst logLegacyCase = getSingleUseLegacyLogCallback(this.mc.logger, messageCopy.type);\n\n\t\tlet runtimeBatch: boolean =\n\t\t\thasModernRuntimeMessageEnvelope || isUnpackedRuntimeMessage(messageCopy);\n\t\tif (runtimeBatch) {\n\t\t\t// We expect runtime messages to have JSON contents - deserialize it in place.\n\t\t\tensureContentsDeserialized(messageCopy);\n\t\t}\n\n\t\tif (hasModernRuntimeMessageEnvelope) {\n\t\t\t// If the message has the modern message envelope, then process it here.\n\t\t\t// Here we unpack the message (decompress, unchunk, and/or ungroup) into a batch of messages with ContainerMessageType\n\t\t\tconst inboundResult = this.remoteMessageProcessor.process(messageCopy, logLegacyCase);\n\t\t\tif (inboundResult === undefined) {\n\t\t\t\t// This means the incoming message is an incomplete part of a message or batch\n\t\t\t\t// and we need to process more messages before the rest of the system can understand it.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\"batchStart\" in inboundResult) {\n\t\t\t\tconst batchStart: BatchStartInfo = inboundResult.batchStart;\n\t\t\t\tconst result = this.duplicateBatchDetector?.processInboundBatch(batchStart);\n\t\t\t\tif (result?.duplicate === true) {\n\t\t\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t\t\t\"Duplicate batch - The same batch was sequenced twice\",\n\t\t\t\t\t\t{ batchId: batchStart.batchId },\n\t\t\t\t\t);\n\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"DuplicateBatch\",\n\t\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\t\tbatchId: batchStart.batchId,\n\t\t\t\t\t\t\t\tclientId: batchStart.clientId,\n\t\t\t\t\t\t\t\tbatchStartCsn: batchStart.batchStartCsn,\n\t\t\t\t\t\t\t\tsize: inboundResult.length,\n\t\t\t\t\t\t\t\tduplicateBatchSequenceNumber: result.otherSequenceNumber,\n\t\t\t\t\t\t\t\t...extractSafePropertiesFromMessage(batchStart.keyMessage),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Reach out to PendingStateManager, either to zip localOpMetadata into the *local* message list,\n\t\t\t// or to check to ensure the *remote* messages don't match the batchId of a pending local batch.\n\t\t\t// This latter case would indicate that the container has forked - two copies are trying to persist the same local changes.\n\t\t\tlet messagesWithPendingState: {\n\t\t\t\tmessage: ISequencedDocumentMessage;\n\t\t\t\tlocalOpMetadata?: unknown;\n\t\t\t}[] = this.pendingStateManager.processInboundMessages(inboundResult, local);\n\n\t\t\tif (inboundResult.type !== \"fullBatch\") {\n\t\t\t\tassert(\n\t\t\t\t\tmessagesWithPendingState.length === 1,\n\t\t\t\t\t0xa3d /* Partial batch should have exactly one message */,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (messagesWithPendingState.length === 0) {\n\t\t\t\tassert(\n\t\t\t\t\tinboundResult.type === \"fullBatch\",\n\t\t\t\t\t0xa3e /* Empty batch is always considered a full batch */,\n\t\t\t\t);\n\t\t\t\t/**\n\t\t\t\t * We need to process an empty batch, which will execute expected actions while processing even if there\n\t\t\t\t * are no inner runtime messages.\n\t\t\t\t *\n\t\t\t\t * Empty batches are produced by the outbox on resubmit when the resubmit flow resulted in no runtime\n\t\t\t\t * messages.\n\t\t\t\t * This can happen if changes from a remote client \"cancel out\" the pending changes being resubmitted by\n\t\t\t\t * this client. We submit an empty batch if \"offline load\" (aka rehydrating from stashed state) is\n\t\t\t\t * enabled, to ensure we account for this batch when comparing batchIds, checking for a forked container.\n\t\t\t\t * Otherwise, we would not realize this container has forked in the case where it did fork, and a batch\n\t\t\t\t * became empty but wasn't submitted as such.\n\t\t\t\t */\n\t\t\t\tmessagesWithPendingState = [\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage: inboundResult.batchStart.keyMessage,\n\t\t\t\t\t\tlocalOpMetadata: undefined,\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\t// Empty batch message is a non-runtime message as it was generated by the op grouping manager.\n\t\t\t\truntimeBatch = false;\n\t\t\t}\n\n\t\t\tconst locationInBatch: { batchStart: boolean; batchEnd: boolean } =\n\t\t\t\tinboundResult.type === \"fullBatch\"\n\t\t\t\t\t? { batchStart: true, batchEnd: true }\n\t\t\t\t\t: inboundResult.type === \"batchStartingMessage\"\n\t\t\t\t\t\t? { batchStart: true, batchEnd: false }\n\t\t\t\t\t\t: { batchStart: false, batchEnd: inboundResult.batchEnd === true };\n\n\t\t\tthis.processInboundMessages(\n\t\t\t\tmessagesWithPendingState,\n\t\t\t\tlocationInBatch,\n\t\t\t\tlocal,\n\t\t\t\tsavedOp,\n\t\t\t\truntimeBatch,\n\t\t\t\tinboundResult.type === \"fullBatch\"\n\t\t\t\t\t? inboundResult.groupedBatch\n\t\t\t\t\t: false /* groupedBatch */,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.processInboundMessages(\n\t\t\t\t[{ message: messageCopy, localOpMetadata: undefined }],\n\t\t\t\t{ batchStart: true, batchEnd: true }, // Single message\n\t\t\t\tlocal,\n\t\t\t\tsavedOp,\n\t\t\t\truntimeBatch,\n\t\t\t\tfalse /* groupedBatch */,\n\t\t\t);\n\t\t}\n\n\t\tif (local) {\n\t\t\t// If we have processed a local op, this means that the container is\n\t\t\t// making progress and we can reset the counter for how many times\n\t\t\t// we have consecutively replayed the pending states\n\t\t\tthis.resetReconnectCount();\n\t\t}\n\t}\n\n\tprivate _processedClientSequenceNumber: number | undefined;\n\n\t/**\n\t * Processes inbound message(s). It calls delta scheduler according to the messages' location in the batch.\n\t * @param messagesWithMetadata - messages to process along with their metadata.\n\t * @param locationInBatch - Are we processing the start and/or end of a batch?\n\t * @param local - true if the messages were originally generated by the client receiving it.\n\t * @param savedOp - true if the message is a replayed saved op.\n\t * @param runtimeBatch - true if these are runtime messages.\n\t * @param groupedBatch - true if these messages are part of a grouped op batch.\n\t */\n\tprivate processInboundMessages(\n\t\tmessagesWithMetadata: {\n\t\t\tmessage: ISequencedDocumentMessage;\n\t\t\tlocalOpMetadata?: unknown;\n\t\t}[],\n\t\tlocationInBatch: { batchStart: boolean; batchEnd: boolean },\n\t\tlocal: boolean,\n\t\tsavedOp: boolean | undefined,\n\t\truntimeBatch: boolean,\n\t\tgroupedBatch: boolean,\n\t): void {\n\t\t// This message could have been the last pending local (dirtyable) message, in which case we need to update dirty state to \"saved\"\n\t\tthis.updateDocumentDirtyState();\n\n\t\tif (locationInBatch.batchStart) {\n\t\t\tconst firstMessage = messagesWithMetadata[0]?.message;\n\t\t\tassert(firstMessage !== undefined, 0xa31 /* Batch must have at least one message */);\n\t\t\tthis.emit(\"batchBegin\", firstMessage);\n\t\t}\n\n\t\tlet error: unknown;\n\t\ttry {\n\t\t\tif (!runtimeBatch) {\n\t\t\t\tfor (const { message } of messagesWithMetadata) {\n\t\t\t\t\tthis.observeNonRuntimeMessage(message);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Updates a message's minimum sequence number to the minimum sequence number that container\n\t\t\t// runtime is tracking and sets _processedClientSequenceNumber. It returns the updated message.\n\t\t\tconst updateSequenceNumbers = (\n\t\t\t\tmessage: ISequencedDocumentMessage,\n\t\t\t): InboundSequencedContainerRuntimeMessage => {\n\t\t\t\t// Set the minimum sequence number to the containerRuntime's understanding of minimum sequence number.\n\t\t\t\tmessage.minimumSequenceNumber =\n\t\t\t\t\tthis.useDeltaManagerOpsProxy &&\n\t\t\t\t\tthis.deltaManager.minimumSequenceNumber < message.minimumSequenceNumber\n\t\t\t\t\t\t? this.deltaManager.minimumSequenceNumber\n\t\t\t\t\t\t: message.minimumSequenceNumber;\n\t\t\t\tthis._processedClientSequenceNumber = message.clientSequenceNumber;\n\t\t\t\treturn message as InboundSequencedContainerRuntimeMessage;\n\t\t\t};\n\n\t\t\t// Non-grouped batch messages are processed one at a time.\n\t\t\tif (!groupedBatch) {\n\t\t\t\tfor (const { message, localOpMetadata } of messagesWithMetadata) {\n\t\t\t\t\tupdateSequenceNumbers(message);\n\t\t\t\t\tthis.validateAndProcessRuntimeMessages(\n\t\t\t\t\t\tmessage as InboundSequencedContainerRuntimeMessage,\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontents: message.contents,\n\t\t\t\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t\tsavedOp,\n\t\t\t\t\t);\n\t\t\t\t\tthis.emit(\"op\", message, true /* runtimeMessage */);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet bunchedMessagesContent: IRuntimeMessagesContent[] = [];\n\t\t\tlet previousMessage: InboundSequencedContainerRuntimeMessage | undefined;\n\n\t\t\t// Process the previous bunch of messages.\n\t\t\tconst processBunchedMessages = (): void => {\n\t\t\t\tassert(previousMessage !== undefined, 0xa67 /* previous message must exist */);\n\t\t\t\tthis.validateAndProcessRuntimeMessages(\n\t\t\t\t\tpreviousMessage,\n\t\t\t\t\tbunchedMessagesContent,\n\t\t\t\t\tlocal,\n\t\t\t\t\tsavedOp,\n\t\t\t\t);\n\t\t\t\tbunchedMessagesContent = [];\n\t\t\t};\n\n\t\t\t/**\n\t\t\t * For grouped batch messages, bunch contiguous messages of the same type and process them together.\n\t\t\t * This is an optimization mainly for DDSes, where it can process a bunch of ops together. DDSes\n\t\t\t * like merge tree or shared tree can process ops more efficiently when they are bunched together.\n\t\t\t */\n\t\t\tfor (const { message, localOpMetadata } of messagesWithMetadata) {\n\t\t\t\tconst currentMessage = updateSequenceNumbers(message);\n\t\t\t\tif (previousMessage && previousMessage.type !== currentMessage.type) {\n\t\t\t\t\tprocessBunchedMessages();\n\t\t\t\t}\n\t\t\t\tpreviousMessage = currentMessage;\n\t\t\t\tbunchedMessagesContent.push({\n\t\t\t\t\tcontents: message.contents,\n\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t\tclientSequenceNumber: message.clientSequenceNumber,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Process the last bunch of messages.\n\t\t\tprocessBunchedMessages();\n\n\t\t\t// Send the \"op\" events for the messages now that the ops have been processed.\n\t\t\tfor (const { message } of messagesWithMetadata) {\n\t\t\t\tthis.emit(\"op\", message, true /* runtimeMessage */);\n\t\t\t}\n\t\t} catch (error_) {\n\t\t\terror = error_;\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (locationInBatch.batchEnd) {\n\t\t\t\tconst lastMessage = messagesWithMetadata[messagesWithMetadata.length - 1]?.message;\n\t\t\t\tassert(lastMessage !== undefined, 0xa32 /* Batch must have at least one message */);\n\t\t\t\tthis.emit(\"batchEnd\", error, lastMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Observes messages that are not intended for the runtime layer, updating/notifying Runtime systems as needed.\n\t * @param message - non-runtime message to process.\n\t */\n\tprivate observeNonRuntimeMessage(message: ISequencedDocumentMessage): void {\n\t\t// Set the minimum sequence number to the containerRuntime's understanding of minimum sequence number.\n\t\tif (this.deltaManager.minimumSequenceNumber < message.minimumSequenceNumber) {\n\t\t\tmessage.minimumSequenceNumber = this.deltaManager.minimumSequenceNumber;\n\t\t}\n\n\t\tthis._processedClientSequenceNumber = message.clientSequenceNumber;\n\n\t\t// The DeltaManager used to do this, but doesn't anymore as of Loader v2.4\n\t\t// Anyone listening to our \"op\" event would expect the contents to be parsed per this same logic\n\t\tif (\n\t\t\ttypeof message.contents === \"string\" &&\n\t\t\tmessage.contents !== \"\" &&\n\t\t\tmessage.type !== MessageType.ClientLeave\n\t\t) {\n\t\t\tmessage.contents = JSON.parse(message.contents);\n\t\t}\n\n\t\tthis.emit(\"op\", message, false /* runtimeMessage */);\n\t}\n\n\t/**\n\t * Process runtime messages. The messages here are contiguous messages in a batch.\n\t * Assuming the messages in the given bunch are also a TypedContainerRuntimeMessage, checks its type and dispatch\n\t * the messages to the appropriate handler in the runtime.\n\t * Throws a DataProcessingError if the message looks like but doesn't conform to a known TypedContainerRuntimeMessage type.\n\t * @param message - The core message with common properties for all the messages.\n\t * @param messageContents - The contents, local metadata and clientSequenceNumbers of the messages.\n\t * @param local - true if the messages were originally generated by the client receiving it.\n\t * @param savedOp - true if the message is a replayed saved op.\n\t *\n\t */\n\tprivate validateAndProcessRuntimeMessages(\n\t\tmessage: Omit<InboundSequencedContainerRuntimeMessage, \"contents\">,\n\t\tmessagesContent: IRuntimeMessagesContent[],\n\t\tlocal: boolean,\n\t\tsavedOp?: boolean,\n\t): void {\n\t\t// Get the contents without the localOpMetadata because not all message types know about localOpMetadata.\n\t\tconst contents = messagesContent.map((c) => c.contents);\n\n\t\tswitch (message.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Attach:\n\t\t\tcase ContainerMessageType.Alias: {\n\t\t\t\t// Remove the metadata from the message before sending it to the channel collection. The metadata\n\t\t\t\t// is added by the container runtime and is not part of the message that the channel collection and\n\t\t\t\t// layers below it expect.\n\t\t\t\tthis.channelCollection.processMessages({ envelope: message, messagesContent, local });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\tthis.blobManager.processBlobAttachMessage(message, local);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation: {\n\t\t\t\tthis.processIdCompressorMessages(contents as IdCreationRange[], savedOp);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\tthis.garbageCollector.processMessages(\n\t\t\t\t\tcontents as GarbageCollectionMessage[],\n\t\t\t\t\tmessage.timestamp,\n\t\t\t\t\tlocal,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.ChunkedOp: {\n\t\t\t\t// From observability POV, we should not expose the rest of the system (including \"op\" events on object) to these messages.\n\t\t\t\t// Also resetReconnectCount() would be wrong - see comment that was there before this change was made.\n\t\t\t\tassert(false, 0x93d /* should not even get here */);\n\t\t\t}\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\tthis.documentsSchemaController.processDocumentSchemaMessages(\n\t\t\t\t\tcontents as IDocumentSchemaChangeMessageIncoming[],\n\t\t\t\t\tlocal,\n\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst error = getUnknownMessageTypeError(\n\t\t\t\t\tmessage.type,\n\t\t\t\t\t\"validateAndProcessRuntimeMessage\" /* codePath */,\n\t\t\t\t\tmessage as ISequencedDocumentMessage,\n\t\t\t\t);\n\t\t\t\tthis.closeFn(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate processIdCompressorMessages(\n\t\tmessageContents: IdCreationRange[],\n\t\tsavedOp?: boolean,\n\t): void {\n\t\tfor (const range of messageContents) {\n\t\t\t// Don't re-finalize the range if we're processing a \"savedOp\" in\n\t\t\t// stashed ops flow. The compressor is stashed with these ops already processed.\n\t\t\t// That said, in idCompressorMode === \"delayed\", we might not serialize ID compressor, and\n\t\t\t// thus we need to process all the ops.\n\t\t\tif (!(this.skipSavedCompressorOps && savedOp === true)) {\n\t\t\t\t// Some other client turned on the id compressor. If we have not turned it on,\n\t\t\t\t// put it in a pending queue and delay finalization.\n\t\t\t\tif (this._idCompressor === undefined) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.sessionSchema.idCompressorMode !== undefined,\n\t\t\t\t\t\t0x93c /* id compressor should be enabled */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.pendingIdCompressorOps.push(range);\n\t\t\t\t} else {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.pendingIdCompressorOps.length === 0,\n\t\t\t\t\t\t0x979 /* there should be no pending ops! */,\n\t\t\t\t\t);\n\t\t\t\t\tthis._idCompressor.finalizeCreationRange(range);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic processSignal(\n\t\tmessage: ISignalMessage<{\n\t\t\ttype: string;\n\t\t\tcontent: ISignalEnvelope<{ type: string; content: OpaqueJsonDeserialized<unknown> }>;\n\t\t}>,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst envelope = message.content;\n\t\tconst transformed = {\n\t\t\tclientId: message.clientId,\n\t\t\tcontent: envelope.contents.content,\n\t\t\ttype: envelope.contents.type,\n\t\t\ttargetClientId: message.targetClientId,\n\t\t};\n\n\t\t// Only collect signal telemetry for broadcast messages sent by the current client.\n\t\tif (message.clientId === this.clientId) {\n\t\t\tthis.signalTelemetryManager.trackReceivedSignal(\n\t\t\t\tenvelope,\n\t\t\t\tthis.mc.logger,\n\t\t\t\tthis.consecutiveReconnects,\n\t\t\t);\n\t\t}\n\n\t\tconst fullAddress = envelope.address;\n\t\tif (fullAddress === undefined) {\n\t\t\t// No address indicates a container signal message.\n\t\t\tthis.emit(\"signal\", transformed, local);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.routeNonContainerSignal(fullAddress, transformed, local);\n\t}\n\n\tprivate routeNonContainerSignal(\n\t\taddress: string,\n\t\tsignalMessage: IInboundSignalMessage<UnknownIncomingTypedMessage>,\n\t\tlocal: boolean,\n\t): void {\n\t\t// channelCollection signals are identified by no starting `/` in address.\n\t\tif (!address.startsWith(\"/\")) {\n\t\t\t// Due to a mismatch between different layers in terms of\n\t\t\t// what is the interface of passing signals, we need to adjust\n\t\t\t// the signal envelope before sending it to the datastores to be processed\n\t\t\tconst channelSignalMessage = {\n\t\t\t\t...signalMessage,\n\t\t\t\tcontent: {\n\t\t\t\t\taddress,\n\t\t\t\t\tcontents: signalMessage.content,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tthis.channelCollection.processSignal(channelSignalMessage, local);\n\t\t\treturn;\n\t\t}\n\n\t\tconst addresses = address.split(\"/\");\n\t\tif (addresses.length > 2 && addresses[1] === \"ext\") {\n\t\t\tconst id = addresses[2] as ContainerExtensionId;\n\t\t\tconst entry = this.extensions.get(id);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tentry.extension.processSignal?.(addresses.slice(3), signalMessage, local);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tassert(!local, 0xba0 /* No recipient found for local signal */);\n\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\teventName: \"SignalAddressNotFound\",\n\t\t\t...tagCodeArtifacts({\n\t\t\t\taddress,\n\t\t\t}),\n\t\t});\n\t}\n\n\t/**\n\t * Flush the current batch of ops to the ordering service for sequencing\n\t * This method is not expected to be called in the middle of a batch.\n\t * @remarks If it throws (e.g. if the batch is too large to send), the container will be closed.\n\t *\n\t * @param resubmitInfo - If defined, indicates this is a resubmission of a batch with the given Batch info needed for resubmit.\n\t */\n\tprivate flush(resubmitInfo?: BatchResubmitInfo): void {\n\t\tthis.flushScheduled = false;\n\n\t\ttry {\n\t\t\tassert(\n\t\t\t\t!this.batchRunner.running,\n\t\t\t\t0x24c /* \"Cannot call `flush()` while manually accumulating a batch (e.g. under orderSequentially) */,\n\t\t\t);\n\n\t\t\tthis.outbox.flush(resubmitInfo);\n\t\t\tassert(this.outbox.isEmpty, 0x3cf /* reentrancy */);\n\t\t} catch (error) {\n\t\t\tconst error2 = normalizeError(error, {\n\t\t\t\tprops: {\n\t\t\t\t\torderSequentiallyCalls: this.batchRunner.runs,\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.closeFn(error2);\n\t\t\tthrow error2;\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/runtime-definitions#IContainerRuntimeBase.orderSequentially}\n\t */\n\tpublic orderSequentially<T>(callback: () => T): T {\n\t\tlet checkpoint: IBatchCheckpoint | undefined;\n\t\tlet stageControls: StageControlsInternal | undefined;\n\t\tif (this.mc.config.getBoolean(\"Fluid.ContainerRuntime.EnableRollback\") === true) {\n\t\t\tif (!this.batchRunner.running && !this.inStagingMode) {\n\t\t\t\tstageControls = this.enterStagingMode();\n\t\t\t}\n\t\t\t// Note: we are not touching any batches other than mainBatch here, for two reasons:\n\t\t\t// 1. It would not help, as other batches are flushed independently from main batch.\n\t\t\t// 2. There is no way to undo process of data store creation, blob creation, ID compressor ops, or other things tracked by other batches.\n\t\t\tcheckpoint = this.outbox.getBatchCheckpoints().mainBatch;\n\t\t}\n\t\tconst result = this.batchRunner.run(() => {\n\t\t\ttry {\n\t\t\t\treturn callback();\n\t\t\t} catch (error) {\n\t\t\t\tif (checkpoint) {\n\t\t\t\t\t// This will throw and close the container if rollback fails\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcheckpoint.rollback((message: LocalBatchMessage) =>\n\t\t\t\t\t\t\t// These changes are staged since we entered staging mode above\n\t\t\t\t\t\t\tthis.rollbackStagedChange(message.runtimeOp, message.localOpMetadata),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.updateDocumentDirtyState();\n\t\t\t\t\t\tstageControls?.discardChanges();\n\t\t\t\t\t\tstageControls = undefined;\n\t\t\t\t\t} catch (error_) {\n\t\t\t\t\t\tconst error2 = wrapError(error_, (message) => {\n\t\t\t\t\t\t\treturn DataProcessingError.create(\n\t\t\t\t\t\t\t\t`RollbackError: ${message}`,\n\t\t\t\t\t\t\t\t\"checkpointRollback\",\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t) as DataProcessingError;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tthis.closeFn(error2);\n\t\t\t\t\t\tthrow error2;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.closeFn(\n\t\t\t\t\t\twrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\t\t\tnew GenericError(\n\t\t\t\t\t\t\t\t\t`orderSequentially callback exception: ${errorMessage}`,\n\t\t\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\torderSequentiallyCalls: this.batchRunner.runs,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow error; // throw the original error for the consumer of the runtime\n\t\t\t}\n\t\t});\n\n\t\tstageControls?.commitChanges({ squash: false });\n\n\t\t// We don't flush on TurnBased since we expect all messages in the same JS turn to be part of the same batch\n\t\tif (this.flushMode !== FlushMode.TurnBased && !this.batchRunner.running) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate stageControls: StageControlsInternal | undefined;\n\n\t/**\n\t * If true, the ContainerRuntime is not submitting any new ops to the ordering service.\n\t * Ops submitted to the ContainerRuntime while in Staging Mode will be queued in the PendingStateManager,\n\t * either to be discarded or committed later (via the Stage Controls returned from enterStagingMode).\n\t */\n\tpublic get inStagingMode(): boolean {\n\t\treturn this.stageControls !== undefined;\n\t}\n\n\t/**\n\t * Enter Staging Mode, such that ops submitted to the ContainerRuntime will not be sent to the ordering service.\n\t * To exit Staging Mode, call either discardChanges or commitChanges on the Stage Controls returned from this method.\n\t *\n\t * @returns Controls for exiting Staging Mode.\n\t */\n\tpublic enterStagingMode = (): StageControlsInternal => {\n\t\tif (this.stageControls !== undefined) {\n\t\t\tthrow new UsageError(\"Already in staging mode\");\n\t\t}\n\t\tif (this.attachState === AttachState.Detached) {\n\t\t\tthrow new UsageError(\"Cannot enter staging mode while Detached\");\n\t\t}\n\n\t\t// Make sure Outbox is empty before entering staging mode,\n\t\t// since we mark whole batches as \"staged\" or not to indicate whether to submit them.\n\t\tthis.flush();\n\n\t\tconst exitStagingMode = (discardOrCommit: () => void): void => {\n\t\t\ttry {\n\t\t\t\t// Final flush of any last staged changes\n\t\t\t\t// NOTE: We can't use this.flush() here, because orderSequentially uses StagingMode and in the rollback case we'll hit assert 0x24c\n\t\t\t\tthis.outbox.flush();\n\n\t\t\t\tthis.stageControls = undefined;\n\n\t\t\t\t// During Staging Mode, we avoid submitting any ID Allocation ops (apart from resubmitting pre-staging ops).\n\t\t\t\t// Now that we've exited, we need to submit an ID Allocation op for any IDs that were generated while in Staging Mode.\n\t\t\t\tthis.submitIdAllocationOpIfNeeded({ staged: false });\n\t\t\t\tdiscardOrCommit();\n\n\t\t\t\tthis.channelCollection.notifyStagingMode(false);\n\t\t\t} catch (error) {\n\t\t\t\tconst normalizedError = normalizeError(error);\n\t\t\t\tthis.closeFn(normalizedError);\n\t\t\t\tthrow normalizedError;\n\t\t\t}\n\t\t};\n\n\t\tconst stageControls: StageControlsInternal = {\n\t\t\tdiscardChanges: () =>\n\t\t\t\texitStagingMode(() => {\n\t\t\t\t\t// Pop all staged batches from the PSM and roll them back in LIFO order\n\t\t\t\t\tthis.pendingStateManager.popStagedBatches(({ runtimeOp, localOpMetadata }) => {\n\t\t\t\t\t\tthis.rollbackStagedChange(runtimeOp, localOpMetadata);\n\t\t\t\t\t});\n\t\t\t\t\tthis.updateDocumentDirtyState();\n\t\t\t\t}),\n\t\t\tcommitChanges: (options) => {\n\t\t\t\tconst { squash } = { ...defaultStagingCommitOptions, ...options };\n\t\t\t\texitStagingMode(() => {\n\t\t\t\t\t// Replay all staged batches in typical FIFO order.\n\t\t\t\t\t// We'll be out of staging mode so they'll be sent to the service finally.\n\t\t\t\t\tthis.pendingStateManager.replayPendingStates({\n\t\t\t\t\t\tcommittingStagedBatches: true,\n\t\t\t\t\t\tsquash,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\n\t\tthis.stageControls = stageControls;\n\t\tthis.channelCollection.notifyStagingMode(true);\n\n\t\treturn this.stageControls;\n\t};\n\n\t/**\n\t * Returns the aliased data store's entryPoint, given the alias.\n\t * @param alias - The alias for the data store.\n\t * @returns The data store's entry point ({@link @fluidframework/core-interfaces#IFluidHandle}) if it exists and is aliased.\n\t * Returns undefined if no data store has been assigned the given alias.\n\t */\n\tpublic async getAliasedDataStoreEntryPoint(\n\t\talias: string,\n\t): Promise<IFluidHandle<FluidObject> | undefined> {\n\t\t// Back-comapatibility:\n\t\t// There are old files that were created without using data store aliasing feature, but\n\t\t// used createRoot*DataStore*() (already removed) API. Such data stores will have isRoot = true,\n\t\t// and internalID provided by user. The expectation is that such files behave as new files, where\n\t\t// same data store instances created using aliasing feature.\n\t\t// Please also see note on name collisions in DataStores.createDataStoreId()\n\t\tawait this.channelCollection.waitIfPendingAlias(alias);\n\t\tconst internalId = this.internalId(alias);\n\t\tconst context = await this.channelCollection.getDataStoreIfAvailable(internalId, {\n\t\t\twait: false,\n\t\t});\n\t\t// If the data store is not available or not an alias, return undefined.\n\t\tif (context === undefined || !(await context.isRoot())) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst channel = await context.realize();\n\t\tif (channel.entryPoint === undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"entryPoint must be defined on data store runtime for using getAliasedDataStoreEntryPoint\",\n\t\t\t);\n\t\t}\n\t\tthis.garbageCollector.nodeUpdated({\n\t\t\tnode: { type: \"DataStore\", path: `/${internalId}` },\n\t\t\treason: \"Loaded\",\n\t\t\tpackagePath: context.packagePath,\n\t\t\ttimestampMs: this.getCurrentReferenceTimestampMs(),\n\t\t});\n\t\treturn channel.entryPoint;\n\t}\n\n\tpublic createDetachedDataStore(\n\t\tpkg: readonly string[],\n\t\tloadingGroupId?: string,\n\t): IFluidDataStoreContextDetached {\n\t\treturn this.channelCollection.createDetachedDataStore(pkg, loadingGroupId);\n\t}\n\n\tpublic async createDataStore(\n\t\tpkg: Readonly<string | string[]>,\n\t\tloadingGroupId?: string,\n\t): Promise<IDataStore> {\n\t\tconst context = this.channelCollection.createDataStoreContext(\n\t\t\tArray.isArray(pkg) ? pkg : [pkg],\n\t\t\tloadingGroupId,\n\t\t);\n\t\treturn channelToDataStore(\n\t\t\tawait context.realize(),\n\t\t\tcontext.id,\n\t\t\tthis.channelCollection,\n\t\t\tthis.mc.logger,\n\t\t);\n\t}\n\n\tprivate shouldSendOps(): boolean {\n\t\t// Note that the real (non-proxy) delta manager is needed here to get the readonly info. This is because\n\t\t// container runtime's ability to send ops depend on the actual readonly state of the delta manager.\n\t\treturn this.connected && this.innerDeltaManager.readOnlyInfo.readonly !== true;\n\t}\n\n\tprivate readonly _quorum: IQuorumClients;\n\tpublic getQuorum(): IQuorumClients {\n\t\treturn this._quorum;\n\t}\n\n\tprivate readonly _audience: IAudience;\n\tpublic getAudience(): IAudience {\n\t\treturn this._audience;\n\t}\n\n\t/**\n\t * When defined, this {@link @fluidframework/container-definitions#IAudience}\n\t * maintains member list using signals only.\n\t * Thus \"write\" members may be known earlier than quorum and avoid noise from\n\t * un-summarized quorum history.\n\t */\n\tprivate readonly signalAudience?: IAudience;\n\n\t/**\n\t * Returns true of container is dirty, i.e. there are some pending local changes that\n\t * either were not sent out to delta stream or were not yet acknowledged.\n\t */\n\tpublic get isDirty(): boolean {\n\t\t// Rather than recomputing the dirty state in this moment,\n\t\t// just regurgitate the last emitted dirty state.\n\t\treturn this.lastEmittedDirty;\n\t}\n\n\t/**\n\t * Returns true if the container is dirty: not attached, or no pending user messages (could be some \"non-dirtyable\" ones though)\n\t */\n\tprivate computeCurrentDirtyState(): boolean {\n\t\treturn (\n\t\t\tthis.attachState !== AttachState.Attached ||\n\t\t\tthis.pendingStateManager.hasPendingUserChanges() ||\n\t\t\tthis.outbox.containsUserChanges()\n\t\t);\n\t}\n\n\t/**\n\t * Submits the signal to be sent to other clients.\n\t * @param type - Type of the signal.\n\t * @param content - Content of the signal. Should be a JSON serializable object or primitive.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t *\n\t * @remarks\n\t *\n\t * The `targetClientId` parameter here is currently intended for internal testing purposes only.\n\t * Support for this option at container runtime is planned to be deprecated in the future.\n\t *\n\t */\n\tpublic submitSignal(type: string, content: unknown, targetClientId?: string): void {\n\t\tthis.verifyNotClosed();\n\t\tconst envelope = {\n\t\t\tcontents: { type, content },\n\t\t} satisfies UnsequencedSignalEnvelope;\n\t\tthis.submitSignalFn(envelope, targetClientId);\n\t}\n\n\tpublic setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void {\n\t\tif (attachState === AttachState.Attaching) {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attaching,\n\t\t\t\t0x12d /* \"Container Context should already be in attaching state\" */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.attachState === AttachState.Attached,\n\t\t\t\t0x12e /* \"Container Context should already be in attached state\" */,\n\t\t\t);\n\t\t\tthis.emit(\"attached\");\n\t\t}\n\n\t\tthis.updateDocumentDirtyState();\n\t\tthis.channelCollection.setAttachState(attachState);\n\t}\n\n\t/**\n\t * Create a summary. Used when attaching or serializing a detached container.\n\t *\n\t * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n\t * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n\t * new storage IDs so requests can be redirected.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic createSummary(\n\t\tblobRedirectTable?: Map<string, string>,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTree {\n\t\tif (blobRedirectTable) {\n\t\t\tthis.blobManager.patchRedirectTable(blobRedirectTable);\n\t\t}\n\n\t\t// We can finalize any allocated IDs since we're the only client\n\t\tconst idRange = this._idCompressor?.takeNextCreationRange();\n\t\tif (idRange !== undefined) {\n\t\t\tassert(\n\t\t\t\tidRange.ids === undefined || idRange.ids.firstGenCount === 1,\n\t\t\t\t0x93e /* No other ranges should be taken while container is detached. */,\n\t\t\t);\n\t\t\tthis._idCompressor?.finalizeCreationRange(idRange);\n\t\t}\n\n\t\tconst summarizeResult = this.channelCollection.getAttachSummary(telemetryContext);\n\t\t// Wrap data store summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\n\t\tthis.addContainerStateToSummary(\n\t\t\tsummarizeResult,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t\treturn summarizeResult.summary;\n\t}\n\n\tpublic readonly getAbsoluteUrl: (relativeUrl: string) => Promise<string | undefined>;\n\n\t/**\n\t * Builds the Summary tree including all the channels and the container state.\n\t *\n\t * @remarks Unfortunately, this function is accessed in a non-typesafe way by a legacy first-party partner,\n\t * so until we can provide a proper API for their scenario, we need to ensure this function doesn't change.\n\t */\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst summarizeResult = await this.channelCollection.summarize(\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t);\n\n\t\t// Wrap data store summaries in .channels subtree.\n\t\twrapSummaryInChannelsTree(summarizeResult);\n\t\tconst pathPartsForChildren = [channelsTreeName];\n\n\t\tthis.loadIdCompressor();\n\n\t\tthis.addContainerStateToSummary(summarizeResult, fullTree, trackState, telemetryContext);\n\t\treturn {\n\t\t\t...summarizeResult,\n\t\t\tid: \"\",\n\t\t\tpathPartsForChildren,\n\t\t};\n\t}\n\n\t/**\n\t * Returns a summary of the runtime at the current sequence number.\n\t */\n\tpublic async summarize(options: {\n\t\t/**\n\t\t * True to generate the full tree with no handle reuse optimizations; defaults to false\n\t\t */\n\t\tfullTree?: boolean;\n\t\t/**\n\t\t * True to track the state for this summary in the SummarizerNodes; defaults to true\n\t\t */\n\t\ttrackState?: boolean;\n\t\t/**\n\t\t * Logger to use for correlated summary events\n\t\t */\n\t\tsummaryLogger?: ITelemetryLoggerExt;\n\t\t/**\n\t\t * True to run garbage collection before summarizing; defaults to true\n\t\t */\n\t\trunGC?: boolean;\n\t\t/**\n\t\t * True to generate full GC data\n\t\t */\n\t\tfullGC?: boolean;\n\t\t/**\n\t\t * True to run GC sweep phase after the mark phase\n\t\t */\n\t\trunSweep?: boolean;\n\t}): Promise<ISummaryTreeWithStats> {\n\t\tthis.verifyNotClosed();\n\n\t\tconst {\n\t\t\tfullTree = false,\n\t\t\ttrackState = true,\n\t\t\tsummaryLogger = this.mc.logger,\n\t\t\trunGC = this.garbageCollector.shouldRunGC,\n\t\t\trunSweep,\n\t\t\tfullGC,\n\t\t} = options;\n\n\t\tconst telemetryContext = new TelemetryContext();\n\t\t// Add the options that are used to generate this summary to the telemetry context.\n\t\ttelemetryContext.setMultiple(\"fluid_Summarize\", \"Options\", {\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\trunGC,\n\t\t\tfullGC,\n\t\t\trunSweep,\n\t\t});\n\n\t\ttry {\n\t\t\tif (runGC) {\n\t\t\t\tawait this.collectGarbage(\n\t\t\t\t\t{ logger: summaryLogger, runSweep, fullGC },\n\t\t\t\t\ttelemetryContext,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst { stats, summary } = await this.summarizerNode.summarize(\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tsummary.type === SummaryType.Tree,\n\t\t\t\t0x12f /* \"Container Runtime's summarize should always return a tree\" */,\n\t\t\t);\n\n\t\t\treturn { stats, summary };\n\t\t} finally {\n\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"SummarizeTelemetry\",\n\t\t\t\tdetails: telemetryContext.serialize(),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async getGCDataInternal(fullGC?: boolean): Promise<IGarbageCollectionData> {\n\t\treturn this.channelCollection.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates and returns the GC data for this container.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t * @see IGarbageCollectionRuntime.getGCData\n\t */\n\tpublic async getGCData(fullGC?: boolean): Promise<IGarbageCollectionData> {\n\t\tconst builder = new GCDataBuilder();\n\t\tconst dsGCData = await this.summarizerNode.getGCData(fullGC);\n\t\tbuilder.addNodes(dsGCData.gcNodes);\n\n\t\tconst blobsGCData = this.blobManager.getGCData(fullGC);\n\t\tbuilder.addNodes(blobsGCData.gcNodes);\n\t\treturn builder.getGCData();\n\t}\n\n\t/**\n\t * After GC has run, called to notify this container's nodes of routes that are used in it.\n\t * @param usedRoutes - The routes that are used in all nodes in this Container.\n\t * @see IGarbageCollectionRuntime.updateUsedRoutes\n\t */\n\tpublic updateUsedRoutes(usedRoutes: readonly string[]): void {\n\t\t// Update our summarizer node's used routes. Updating used routes in summarizer node before\n\t\t// summarizing is required and asserted by the the summarizer node. We are the root and are\n\t\t// always referenced, so the used routes is only self-route (empty string).\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\n\t\tconst { dataStoreRoutes } = this.getDataStoreAndBlobManagerRoutes(usedRoutes);\n\t\tthis.channelCollection.updateUsedRoutes(dataStoreRoutes);\n\t}\n\n\t/**\n\t * After GC has run and identified nodes that are sweep ready, this is called to delete the sweep ready nodes.\n\t * @param sweepReadyRoutes - The routes of nodes that are sweep ready and should be deleted.\n\t * @returns The routes of nodes that were deleted.\n\t */\n\tpublic deleteSweepReadyNodes(sweepReadyRoutes: readonly string[]): readonly string[] {\n\t\tconst { dataStoreRoutes, blobManagerRoutes } =\n\t\t\tthis.getDataStoreAndBlobManagerRoutes(sweepReadyRoutes);\n\n\t\treturn [\n\t\t\t...this.channelCollection.deleteSweepReadyNodes(dataStoreRoutes),\n\t\t\t...this.blobManager.deleteSweepReadyNodes(blobManagerRoutes),\n\t\t];\n\t}\n\n\t/**\n\t * This is called to update objects that are tombstones.\n\t *\n\t * A Tombstoned object has been unreferenced long enough that GC knows it won't be referenced again.\n\t * Tombstoned objects are eventually deleted by GC.\n\t *\n\t * @param tombstonedRoutes - Data store and attachment blob routes that are tombstones in this Container.\n\t */\n\tpublic updateTombstonedRoutes(tombstonedRoutes: readonly string[]): void {\n\t\tconst { dataStoreRoutes } = this.getDataStoreAndBlobManagerRoutes(tombstonedRoutes);\n\t\tthis.channelCollection.updateTombstonedRoutes(dataStoreRoutes);\n\t}\n\n\t/**\n\t * Returns a server generated referenced timestamp to be used to track unreferenced nodes by GC.\n\t */\n\tpublic getCurrentReferenceTimestampMs(): number | undefined {\n\t\t// Use the timestamp of the last message seen by this client as that is server generated. If no messages have\n\t\t// been processed, use the timestamp of the message from the last summary.\n\t\treturn this.deltaManager.lastMessage?.timestamp ?? this.messageAtLastSummary?.timestamp;\n\t}\n\n\t/**\n\t * Returns the type of the GC node. Currently, there are nodes that belong to the root (\"/\"), data stores or\n\t * blob manager.\n\t */\n\n\tpublic getNodeType(nodePath: string): GCNodeType {\n\t\tif (isBlobPath(nodePath)) {\n\t\t\treturn GCNodeType.Blob;\n\t\t}\n\n\t\treturn this.channelCollection.getGCNodeType(nodePath) ?? GCNodeType.Other;\n\t}\n\n\t/**\n\t * Called by GC to retrieve the package path of the node with the given path. The node should belong to a\n\t * data store or an attachment blob.\n\t */\n\tpublic async getGCNodePackagePath(nodePath: string): Promise<readonly string[] | undefined> {\n\t\t// GC uses \"/\" when adding \"root\" references, e.g. for Aliasing or as part of Tombstone Auto-Recovery.\n\t\t// These have no package path so return a special value.\n\t\tif (nodePath === \"/\") {\n\t\t\treturn [\"_gcRoot\"];\n\t\t}\n\n\t\tswitch (this.getNodeType(nodePath)) {\n\t\t\tcase GCNodeType.Blob: {\n\t\t\t\treturn [blobManagerBasePath];\n\t\t\t}\n\n\t\t\tcase GCNodeType.DataStore:\n\n\t\t\tcase GCNodeType.SubDataStore: {\n\t\t\t\treturn this.channelCollection.getDataStorePackagePath(nodePath);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tassert(false, 0x2de /* \"Package path requested for unsupported node type.\" */);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * From a given list of routes, separate and return routes that belong to blob manager and data stores.\n\t * @param routes - A list of routes that can belong to data stores or blob manager.\n\t * @returns Two route lists - One that contains routes for blob manager and another one that contains routes\n\t * for data stores.\n\t */\n\tprivate getDataStoreAndBlobManagerRoutes(routes: readonly string[]): {\n\t\tblobManagerRoutes: string[];\n\t\tdataStoreRoutes: string[];\n\t} {\n\t\tconst blobManagerRoutes: string[] = [];\n\t\tconst dataStoreRoutes: string[] = [];\n\t\tfor (const route of routes) {\n\t\t\tif (isBlobPath(route)) {\n\t\t\t\tblobManagerRoutes.push(route);\n\t\t\t} else {\n\t\t\t\tdataStoreRoutes.push(route);\n\t\t\t}\n\t\t}\n\t\treturn { blobManagerRoutes, dataStoreRoutes };\n\t}\n\n\t/**\n\t * Runs garbage collection and updates the reference / used state of the nodes in the container.\n\t * @returns the statistics of the garbage collection run; undefined if GC did not run.\n\t */\n\tpublic async collectGarbage(\n\t\toptions: {\n\t\t\t/**\n\t\t\t * Logger to use for logging GC events\n\t\t\t */\n\t\t\tlogger?: ITelemetryLoggerExt;\n\t\t\t/**\n\t\t\t * True to run GC sweep phase after the mark phase\n\t\t\t */\n\t\t\trunSweep?: boolean;\n\t\t\t/**\n\t\t\t * True to generate full GC data\n\t\t\t */\n\t\t\tfullGC?: boolean;\n\t\t},\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<IGCStats | undefined> {\n\t\treturn this.garbageCollector.collectGarbage(options, telemetryContext);\n\t}\n\n\t/**\n\t * Called when a new outbound route is added to another node. This is used by garbage collection to identify\n\t * all references added in the system.\n\t * @param fromPath - The absolute path of the node that added the reference.\n\t * @param toPath - The absolute path of the outbound node that is referenced.\n\t * @param messageTimestampMs - The timestamp of the message that added the reference.\n\t */\n\tpublic addedGCOutboundRoute(\n\t\tfromPath: string,\n\t\ttoPath: string,\n\t\tmessageTimestampMs?: number,\n\t): void {\n\t\t// This is always called when processing an op so messageTimestampMs should exist. Due to back-compat\n\t\t// across the data store runtime / container runtime boundary, this may be undefined and if so, get\n\t\t// the timestamp from the last processed message which should exist.\n\t\t// If a timestamp doesn't exist, log so we can learn about these cases and return.\n\t\tconst timestampMs = messageTimestampMs ?? this.getCurrentReferenceTimestampMs();\n\t\tif (timestampMs === undefined) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"NoTimestampInGCOutboundRoute\",\n\t\t\t\t...tagCodeArtifacts({\n\t\t\t\t\tid: toPath,\n\t\t\t\t\tfromId: fromPath,\n\t\t\t\t}),\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.garbageCollector.addedOutboundReference(fromPath, toPath, timestampMs);\n\t}\n\n\t/**\n\t * Generates the summary tree, uploads it to storage, and then submits the summarize op.\n\t * This is intended to be called by the summarizer, since it is the implementation of\n\t * ISummarizerInternalsProvider.submitSummary.\n\t * It takes care of state management at the container level, including pausing inbound\n\t * op processing, updating SummarizerNode state tracking, and garbage collection.\n\t * @param options - options controlling how the summary is generated or submitted\n\t */\n\n\tpublic async submitSummary(options: ISubmitSummaryOptions): Promise<SubmitSummaryResult> {\n\t\tconst {\n\t\t\tcancellationToken,\n\t\t\tfullTree = false,\n\t\t\tfinalAttempt = false,\n\t\t\tsummaryLogger,\n\t\t\tlatestSummaryRefSeqNum,\n\t\t} = options;\n\t\t// The summary number for this summary. This will be updated during the summary process, so get it now and\n\t\t// use it for all events logged during this summary.\n\t\tconst summaryNumber = this.nextSummaryNumber;\n\t\tlet summaryRefSeqNum: number | undefined;\n\t\tconst summaryNumberLogger = createChildLogger({\n\t\t\tlogger: summaryLogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\tsummaryNumber,\n\t\t\t\t\treferenceSequenceNumber: () => summaryRefSeqNum,\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\t// legacy: assert 0x3d1\n\t\tif (!this.outbox.isEmpty) {\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t\"Can't trigger summary in the middle of a batch\",\n\t\t\t\t\"submitSummary\",\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\tsummaryNumber,\n\t\t\t\t\tpendingMessages: this.pendingMessagesCount,\n\t\t\t\t\toutboxLength: this.outbox.messageCount,\n\t\t\t\t\tmainBatchLength: this.outbox.mainBatchMessageCount,\n\t\t\t\t\tblobAttachBatchLength: this.outbox.blobAttachBatchMessageCount,\n\t\t\t\t\tidAllocationBatchLength: this.outbox.idAllocationBatchMessageCount,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// If the container is dirty, i.e., there are pending unacked ops, the summary will not be eventual consistent\n\t\t// and it may even be incorrect. So, wait for the container to be saved with a timeout. If the container is not\n\t\t// saved within the timeout, check if it should be failed or can continue.\n\t\tif (this.isDirty) {\n\t\t\tconst countBefore = this.pendingMessagesCount;\n\t\t\t// The timeout for waiting for pending ops can be overridden via configurations.\n\t\t\tconst pendingOpsTimeout =\n\t\t\t\tthis.mc.config.getNumber(\"Fluid.Summarizer.waitForPendingOpsTimeoutMs\") ??\n\t\t\t\tdefaultPendingOpsWaitTimeoutMs;\n\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\tconst timeoutId = setTimeout(() => resolve(), pendingOpsTimeout);\n\t\t\t\tthis.once(\"saved\", () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t\tthis.once(\"dispose\", () => {\n\t\t\t\t\tclearTimeout(timeoutId);\n\t\t\t\t\treject(new Error(\"Runtime is disposed while summarizing\"));\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t// Log that there are pending ops while summarizing. This will help us gather data on how often this\n\t\t\t// happens, whether we attempted to wait for these ops to be acked and what was the result.\n\t\t\tsummaryNumberLogger.sendTelemetryEvent({\n\t\t\t\teventName: \"PendingOpsWhileSummarizing\",\n\t\t\t\tsaved: !this.isDirty,\n\t\t\t\ttimeout: pendingOpsTimeout,\n\t\t\t\tcountBefore,\n\t\t\t\tcountAfter: this.pendingMessagesCount,\n\t\t\t});\n\n\t\t\t// There could still be pending ops. Check if summary should fail or continue.\n\t\t\tconst pendingMessagesFailResult = await this.shouldFailSummaryOnPendingOps(\n\t\t\t\tsummaryNumberLogger,\n\t\t\t\tthis.deltaManager.lastSequenceNumber,\n\t\t\t\tthis.deltaManager.minimumSequenceNumber,\n\t\t\t\tfinalAttempt,\n\t\t\t\ttrue /* beforeSummaryGeneration */,\n\t\t\t);\n\t\t\tif (pendingMessagesFailResult !== undefined) {\n\t\t\t\treturn pendingMessagesFailResult;\n\t\t\t}\n\t\t}\n\n\t\tconst shouldPauseInboundSignal =\n\t\t\tthis.mc.config.getBoolean(\n\t\t\t\t\"Fluid.ContainerRuntime.SubmitSummary.disableInboundSignalPause\",\n\t\t\t) !== true;\n\t\tconst shouldValidatePreSummaryState =\n\t\t\tthis.mc.config.getBoolean(\n\t\t\t\t\"Fluid.ContainerRuntime.SubmitSummary.shouldValidatePreSummaryState\",\n\t\t\t) === true;\n\n\t\ttry {\n\t\t\tawait this._deltaManager.inbound.pause();\n\t\t\tif (shouldPauseInboundSignal) {\n\t\t\t\tawait this.deltaManager.inboundSignal.pause();\n\t\t\t}\n\n\t\t\tsummaryRefSeqNum = this.deltaManager.lastSequenceNumber;\n\t\t\tconst minimumSequenceNumber = this.deltaManager.minimumSequenceNumber;\n\t\t\tconst message = `Summary @${summaryRefSeqNum}:${this.deltaManager.minimumSequenceNumber}`;\n\t\t\tconst lastAckedContext = this.lastAckedSummaryContext;\n\n\t\t\tconst startSummaryResult = this.summarizerNode.startSummary(\n\t\t\t\tsummaryRefSeqNum,\n\t\t\t\tsummaryNumberLogger,\n\t\t\t\tlatestSummaryRefSeqNum,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * This was added to validate that the summarizer node tree has the same reference sequence number from the\n\t\t\t * top running summarizer down to the lowest summarizer node.\n\t\t\t *\n\t\t\t * The order of mismatch numbers goes (validate sequence number)-(node sequence number).\n\t\t\t * Generally the validate sequence number comes from the running summarizer and the node sequence number comes from the\n\t\t\t * summarizer nodes.\n\t\t\t */\n\t\t\tif (startSummaryResult.invalidNodes > 0 || startSummaryResult.mismatchNumbers.size > 0) {\n\t\t\t\tsummaryLogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"LatestSummaryRefSeqNumMismatch\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\t...startSummaryResult,\n\t\t\t\t\t\tmismatchNumbers: [...startSummaryResult.mismatchNumbers],\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\tif (shouldValidatePreSummaryState && !finalAttempt) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstage: \"base\",\n\t\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\t\terror: new RetriableSummaryError(\n\t\t\t\t\t\t\t`Summarizer node state inconsistent with summarizer state.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Helper function to check whether we should still continue between each async step.\n\t\t\tconst checkContinue = (): { continue: true } | { continue: false; error: string } => {\n\t\t\t\t// Do not check for loss of connectivity directly! Instead leave it up to\n\t\t\t\t// RunWhileConnectedCoordinator to control policy in a single place.\n\t\t\t\t// This will allow easier change of design if we chose to. For example, we may chose to allow\n\t\t\t\t// summarizer to reconnect in the future.\n\t\t\t\t// Also checking for cancellation is a must as summary process may be abandoned for other reasons,\n\t\t\t\t// like loss of connectivity for main (interactive) client.\n\t\t\t\tif (cancellationToken.cancelled) {\n\t\t\t\t\treturn { continue: false, error: \"disconnected\" };\n\t\t\t\t}\n\t\t\t\t// That said, we rely on submitSystemMessage() that today only works in connected state.\n\t\t\t\t// So if we fail here, it either means that RunWhileConnectedCoordinator does not work correctly,\n\t\t\t\t// OR that design changed and we need to remove this check and fix submitSystemMessage.\n\t\t\t\tassert(this.connected, 0x258 /* \"connected\" */);\n\n\t\t\t\t// Ensure that lastSequenceNumber has not changed after pausing.\n\t\t\t\t// We need the summary op's reference sequence number to match our summary sequence number,\n\t\t\t\t// otherwise we'll get the wrong sequence number stamped on the summary's .protocol attributes.\n\t\t\t\tif (this.deltaManager.lastSequenceNumber !== summaryRefSeqNum) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontinue: false,\n\t\t\t\t\t\terror: `lastSequenceNumber changed before uploading to storage. ${this.deltaManager.lastSequenceNumber} !== ${summaryRefSeqNum}`,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tassert(\n\t\t\t\t\tsummaryRefSeqNum === this.deltaManager.lastMessage?.sequenceNumber,\n\t\t\t\t\t0x395 /* it's one and the same thing */,\n\t\t\t\t);\n\n\t\t\t\tif (lastAckedContext !== this.lastAckedSummaryContext) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcontinue: false,\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\t\t\terror: `Last summary changed while summarizing. ${this.lastAckedSummaryContext} !== ${lastAckedContext}`,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn { continue: true };\n\t\t\t};\n\n\t\t\tlet continueResult = checkContinue();\n\t\t\tif (!continueResult.continue) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"base\",\n\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\terror: new RetriableSummaryError(continueResult.error),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst trace = Trace.start();\n\t\t\tlet summarizeResult: ISummaryTreeWithStats;\n\t\t\ttry {\n\t\t\t\tsummarizeResult = await this.summarize({\n\t\t\t\t\tfullTree,\n\t\t\t\t\ttrackState: true,\n\t\t\t\t\tsummaryLogger: summaryNumberLogger,\n\t\t\t\t\trunGC: this.garbageCollector.shouldRunGC,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"base\",\n\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Validate that the summary generated by summarizer nodes is correct before uploading.\n\t\t\tconst validateResult = this.summarizerNode.validateSummary();\n\t\t\tif (!validateResult.success) {\n\t\t\t\tconst { success, ...loggingProps } = validateResult;\n\t\t\t\tconst error = new RetriableSummaryError(\n\t\t\t\t\tvalidateResult.reason,\n\t\t\t\t\tvalidateResult.retryAfterSeconds,\n\t\t\t\t\t{ ...loggingProps },\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"base\",\n\t\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\terror,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// If there are pending unacked ops, this summary attempt may fail as the uploaded\n\t\t\t// summary would be eventually inconsistent.\n\t\t\tconst pendingMessagesFailResult = await this.shouldFailSummaryOnPendingOps(\n\t\t\t\tsummaryNumberLogger,\n\t\t\t\tsummaryRefSeqNum,\n\t\t\t\tminimumSequenceNumber,\n\t\t\t\tfinalAttempt,\n\t\t\t\tfalse /* beforeSummaryGeneration */,\n\t\t\t);\n\t\t\tif (pendingMessagesFailResult !== undefined) {\n\t\t\t\treturn pendingMessagesFailResult;\n\t\t\t}\n\n\t\t\tconst { summary: summaryTree, stats: partialStats } = summarizeResult;\n\n\t\t\t// Now that we have generated the summary, update the message at last summary to the last message processed.\n\t\t\tthis.messageAtLastSummary = this.deltaManager.lastMessage;\n\n\t\t\t// Counting dataStores and handles\n\t\t\t// Because handles are unchanged dataStores in the current logic,\n\t\t\t// summarized dataStore count is total dataStore count minus handle count\n\t\t\tconst dataStoreTree: SummaryObject | undefined = summaryTree.tree[channelsTreeName];\n\n\t\t\tassert(dataStoreTree?.type === SummaryType.Tree, 0x1fc /* \"summary is not a tree\" */);\n\t\t\tconst handleCount = Object.values(dataStoreTree.tree).filter(\n\t\t\t\t(value) => value.type === SummaryType.Handle,\n\t\t\t).length;\n\t\t\tconst gcSummaryTreeStats =\n\t\t\t\tsummaryTree.tree[gcTreeKey] === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: calculateStats(summaryTree.tree[gcTreeKey]);\n\n\t\t\tconst summaryStats: IGeneratedSummaryStats = {\n\t\t\t\tdataStoreCount: this.channelCollection.size,\n\t\t\t\tsummarizedDataStoreCount: this.channelCollection.size - handleCount,\n\t\t\t\tgcStateUpdatedDataStoreCount: this.garbageCollector.updatedDSCountSinceLastSummary,\n\t\t\t\tgcBlobNodeCount: gcSummaryTreeStats?.blobNodeCount,\n\t\t\t\tgcTotalBlobsSize: gcSummaryTreeStats?.totalBlobSize,\n\t\t\t\tsummaryNumber,\n\t\t\t\t...partialStats,\n\t\t\t};\n\t\t\tconst generateSummaryData: Omit<IGenerateSummaryTreeResult, \"stage\" | \"error\"> = {\n\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t\tminimumSequenceNumber,\n\t\t\t\tsummaryTree,\n\t\t\t\tsummaryStats,\n\t\t\t\tgenerateDuration: trace.trace().duration,\n\t\t\t} as const;\n\n\t\t\tcontinueResult = checkContinue();\n\t\t\tif (!continueResult.continue) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"generate\",\n\t\t\t\t\t...generateSummaryData,\n\t\t\t\t\terror: new RetriableSummaryError(continueResult.error),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst summaryContext: ISummaryContext = {\n\t\t\t\tproposalHandle: this.lastAckedSummaryContext?.proposalHandle ?? undefined,\n\t\t\t\tackHandle: this.lastAckedSummaryContext?.ackHandle ?? this.loadedFromVersionId,\n\t\t\t\treferenceSequenceNumber: summaryRefSeqNum,\n\t\t\t};\n\n\t\t\tlet handle: string;\n\t\t\ttry {\n\t\t\t\thandle = await this.storage.uploadSummaryWithContext(summaryTree, summaryContext);\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"generate\",\n\t\t\t\t\t...generateSummaryData,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst parent = summaryContext.ackHandle;\n\t\t\tconst summaryMessage: ISummaryContent = {\n\t\t\t\thandle,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\thead: parent!,\n\t\t\t\tmessage,\n\t\t\t\tparents: parent === undefined ? [] : [parent],\n\t\t\t};\n\t\t\tconst uploadData = {\n\t\t\t\t...generateSummaryData,\n\t\t\t\thandle,\n\t\t\t\tuploadDuration: trace.trace().duration,\n\t\t\t} as const;\n\n\t\t\tcontinueResult = checkContinue();\n\t\t\tif (!continueResult.continue) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"upload\",\n\t\t\t\t\t...uploadData,\n\t\t\t\t\terror: new RetriableSummaryError(continueResult.error),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tlet clientSequenceNumber: number;\n\t\t\ttry {\n\t\t\t\tclientSequenceNumber = this.submitSummaryMessage(summaryMessage, summaryRefSeqNum);\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"upload\",\n\t\t\t\t\t...uploadData,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst submitData = {\n\t\t\t\tstage: \"submit\",\n\t\t\t\t...uploadData,\n\t\t\t\tclientSequenceNumber,\n\t\t\t\tsubmitOpDuration: trace.trace().duration,\n\t\t\t} as const;\n\n\t\t\ttry {\n\t\t\t\tthis.summarizerNode.completeSummary(handle);\n\t\t\t} catch (error) {\n\t\t\t\treturn {\n\t\t\t\t\tstage: \"upload\",\n\t\t\t\t\t...uploadData,\n\t\t\t\t\terror: wrapError(error, (msg) => new RetriableSummaryError(msg)),\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn submitData;\n\t\t} finally {\n\t\t\t// Cleanup wip summary in case of failure\n\t\t\tthis.summarizerNode.clearSummary();\n\n\t\t\t// ! This needs to happen before we resume inbound queues to ensure heuristics are tracked correctly\n\t\t\tthis._summarizer?.recordSummaryAttempt?.(summaryRefSeqNum);\n\n\t\t\t// Restart the delta manager\n\t\t\tthis._deltaManager.inbound.resume();\n\t\t\tif (shouldPauseInboundSignal) {\n\t\t\t\tthis.deltaManager.inboundSignal.resume();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * This helper is called during summarization. If the container is dirty, it will return a failed summarize result\n\t * (IBaseSummarizeResult) unless this is the final summarize attempt and SkipFailingIncorrectSummary option is set.\n\t * @param logger - The logger to be used for sending telemetry.\n\t * @param referenceSequenceNumber - The reference sequence number of the summary attempt.\n\t * @param minimumSequenceNumber - The minimum sequence number of the summary attempt.\n\t * @param finalAttempt - Whether this is the final summary attempt.\n\t * @param beforeSummaryGeneration - Whether this is called before summary generation or after.\n\t * @returns failed summarize result (IBaseSummarizeResult) if summary should be failed, undefined otherwise.\n\t */\n\tprivate async shouldFailSummaryOnPendingOps(\n\t\tlogger: ITelemetryLoggerExt,\n\t\treferenceSequenceNumber: number,\n\t\tminimumSequenceNumber: number,\n\t\tfinalAttempt: boolean,\n\t\tbeforeSummaryGeneration: boolean,\n\t): Promise<IBaseSummarizeResult | undefined> {\n\t\tif (!this.isDirty) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If \"SkipFailingIncorrectSummary\" option is true, don't fail the summary in the last attempt.\n\t\t// This is a fallback to make progress in documents where there are consistently pending ops in\n\t\t// the summarizer.\n\t\tif (\n\t\t\tfinalAttempt &&\n\t\t\tthis.mc.config.getBoolean(\"Fluid.Summarizer.SkipFailingIncorrectSummary\") === true\n\t\t) {\n\t\t\tconst error = DataProcessingError.create(\n\t\t\t\t\"Pending ops during summarization\",\n\t\t\t\t\"submitSummary\",\n\t\t\t\tundefined,\n\t\t\t\t{ pendingMessages: this.pendingMessagesCount },\n\t\t\t);\n\t\t\tlogger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"SkipFailingIncorrectSummary\",\n\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\tminimumSequenceNumber,\n\t\t\t\t\tbeforeGenerate: beforeSummaryGeneration,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t} else {\n\t\t\t// The retry delay when there are pending ops can be overridden via config so that we can adjust it\n\t\t\t// based on telemetry while we decide on a stable number.\n\t\t\tconst retryDelayMs =\n\t\t\t\tthis.mc.config.getNumber(\"Fluid.Summarizer.PendingOpsRetryDelayMs\") ??\n\t\t\t\tdefaultPendingOpsRetryDelayMs;\n\t\t\tconst error = new RetriableSummaryError(\n\t\t\t\t\"PendingOpsWhileSummarizing\",\n\t\t\t\tretryDelayMs / 1000,\n\t\t\t\t{\n\t\t\t\t\tcount: this.pendingMessagesCount,\n\t\t\t\t\tbeforeGenerate: beforeSummaryGeneration,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tstage: \"base\",\n\t\t\t\treferenceSequenceNumber,\n\t\t\t\tminimumSequenceNumber,\n\t\t\t\terror,\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate get pendingMessagesCount(): number {\n\t\treturn this.pendingStateManager.pendingMessagesCount + this.outbox.messageCount;\n\t}\n\n\tprivate hasPendingMessages(): boolean {\n\t\treturn this.pendingMessagesCount !== 0;\n\t}\n\n\t/**\n\t * Emit \"dirty\" or \"saved\" event based on the current dirty state of the document.\n\t * This must be called every time the states underlying the dirty state change.\n\t *\n\t * @privateRemarks It's helpful to think of this as an event handler registered\n\t * for hypothetical \"changed\" events for PendingStateManager, Outbox, and Container Attach machinery.\n\t * But those events don't exist so we manually call this wherever we know those changes happen.\n\t */\n\tprivate updateDocumentDirtyState(): void {\n\t\tconst dirty: boolean = this.computeCurrentDirtyState();\n\n\t\tif (this.lastEmittedDirty === dirty) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lastEmittedDirty = dirty;\n\t\tif (this.emitDirtyDocumentEvent) {\n\t\t\tthis.emit(dirty ? \"dirty\" : \"saved\");\n\t\t}\n\t}\n\n\t// Keep in sync with IFluidRootParentContextPrivate.submitMessage.\n\tpublic submitMessage(\n\t\tcontainerRuntimeMessage:\n\t\t\t| ContainerRuntimeDataStoreOpMessage\n\t\t\t| OutboundContainerRuntimeAttachMessage\n\t\t\t| ContainerRuntimeAliasMessage,\n\t\tlocalOpMetadata: unknown = undefined,\n\t): void {\n\t\tthis.submit(containerRuntimeMessage, localOpMetadata);\n\t}\n\n\tpublic async uploadBlob(\n\t\tblob: ArrayBufferLike,\n\t\tsignal?: AbortSignal,\n\t): Promise<IFluidHandleInternal<ArrayBufferLike>> {\n\t\tthis.verifyNotClosed();\n\t\treturn this.blobManager.createBlob(blob, signal);\n\t}\n\n\t/**\n\t * Lookup the blob storage ID for a given local blob id.\n\t * @param localId - The local blob id. Likely coming from a handle.\n\t * @returns The storage ID if found and the blob is not pending, undefined otherwise.\n\t * @remarks\n\t * This method provides access to the BlobManager's storage ID lookup functionality.\n\t * For blobs with pending payloads (localId exists but upload hasn't finished), this returns undefined.\n\t * Consumers should use the observability APIs on the handle to understand/wait for storage ID availability.\n\t *\n\t * Warning: the returned blob URL may expire and does not support permalinks.\n\t * This API is intended for temporary integration scenarios only.\n\t */\n\tpublic lookupTemporaryBlobStorageId(localId: string): string | undefined {\n\t\treturn this.blobManager.lookupTemporaryBlobStorageId(localId);\n\t}\n\n\tprivate submitIdAllocationOpIfNeeded({\n\t\tresubmitOutstandingRanges = false,\n\t\tstaged,\n\t}: {\n\t\tresubmitOutstandingRanges?: boolean;\n\t\tstaged: boolean;\n\t}): void {\n\t\tif (this._idCompressor) {\n\t\t\tconst idRange = resubmitOutstandingRanges\n\t\t\t\t? this._idCompressor.takeUnfinalizedCreationRange()\n\t\t\t\t: this._idCompressor.takeNextCreationRange();\n\t\t\t// Don't include the idRange if there weren't any Ids allocated\n\t\t\tif (idRange.ids !== undefined) {\n\t\t\t\tconst idAllocationMessage: ContainerRuntimeIdAllocationMessage = {\n\t\t\t\t\ttype: ContainerMessageType.IdAllocation,\n\t\t\t\t\tcontents: idRange,\n\t\t\t\t};\n\t\t\t\tconst idAllocationBatchMessage: LocalBatchMessage = {\n\t\t\t\t\truntimeOp: idAllocationMessage,\n\t\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\t\tstaged,\n\t\t\t\t};\n\t\t\t\tthis.outbox.submitIdAllocation(idAllocationBatchMessage);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate submit(\n\t\tcontainerRuntimeMessage: LocalContainerRuntimeMessage,\n\t\tlocalOpMetadata: unknown = undefined,\n\t\tmetadata?: { localId: string; blobId?: string },\n\t): void {\n\t\tthis.verifyNotClosed();\n\n\t\t// There should be no ops in detached container state!\n\t\tassert(\n\t\t\tthis.attachState !== AttachState.Detached,\n\t\t\t0x132 /* \"sending ops in detached container\" */,\n\t\t);\n\n\t\tassert(\n\t\t\tmetadata === undefined ||\n\t\t\t\tcontainerRuntimeMessage.type === ContainerMessageType.BlobAttach,\n\t\t\t0x93f /* metadata */,\n\t\t);\n\n\t\t// Note that the real (non-proxy) delta manager is used here to get the readonly info. This is because\n\t\t// container runtime's ability to submit ops depend on the actual readonly state of the delta manager.\n\t\tif (this.innerDeltaManager.readOnlyInfo.readonly === true) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"SubmitOpInReadonly\",\n\t\t\t\tconnected: this.connected,\n\t\t\t});\n\t\t}\n\n\t\tconst type = containerRuntimeMessage.type;\n\t\tassert(\n\t\t\ttype !== ContainerMessageType.IdAllocation,\n\t\t\t0x9a5 /* IdAllocation should be submitted directly to outbox. */,\n\t\t);\n\n\t\ttry {\n\t\t\t// If we're resubmitting a batch, keep the same \"staged\" value as before. Otherwise, use the current \"global\" state.\n\t\t\tconst staged = this.batchRunner.resubmitInfo?.staged ?? this.inStagingMode;\n\n\t\t\tassert(\n\t\t\t\t!staged || canStageMessageOfType(type),\n\t\t\t\t0xbba /* Unexpected message type submitted in Staging Mode */,\n\t\t\t);\n\n\t\t\t// Before submitting any non-staged change, submit the ID Allocation op to cover any compressed IDs included in the op.\n\t\t\tif (!staged) {\n\t\t\t\tthis.submitIdAllocationOpIfNeeded({ staged: false });\n\t\t\t}\n\n\t\t\t// Allow document schema controller to send a message if it needs to propose change in document schema.\n\t\t\t// If it needs to send a message, it will call provided callback with payload of such message and rely\n\t\t\t// on this callback to do actual sending.\n\t\t\tconst schemaChangeMessage = this.documentsSchemaController.maybeGenerateSchemaMessage();\n\t\t\tif (schemaChangeMessage) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"SchemaChangeProposal\",\n\t\t\t\t\trefSeq: schemaChangeMessage.refSeq,\n\t\t\t\t\tversion: schemaChangeMessage.version,\n\t\t\t\t\tnewRuntimeSchema: JSON.stringify(schemaChangeMessage.runtime),\n\t\t\t\t\tsessionRuntimeSchema: JSON.stringify(this.sessionSchema),\n\t\t\t\t\toldRuntimeSchema: JSON.stringify(this.metadata?.documentSchema?.runtime),\n\t\t\t\t\tminVersionForCollab: schemaChangeMessage.info?.minVersionForCollab,\n\t\t\t\t});\n\t\t\t\tconst msg: OutboundContainerRuntimeDocumentSchemaMessage = {\n\t\t\t\t\ttype: ContainerMessageType.DocumentSchemaChange,\n\t\t\t\t\tcontents: schemaChangeMessage,\n\t\t\t\t};\n\t\t\t\tthis.outbox.submit({\n\t\t\t\t\truntimeOp: msg,\n\t\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\t\tstaged,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst message: LocalBatchMessage = {\n\t\t\t\t// This will encode any handles present in this op before serializing to string\n\t\t\t\t// Note: handles may already have been encoded by the DDS layer, but encoding handles is idempotent so there's no problem.\n\t\t\t\truntimeOp: containerRuntimeMessage,\n\t\t\t\tmetadata,\n\t\t\t\tlocalOpMetadata,\n\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t\tstaged,\n\t\t\t};\n\t\t\tif (type === ContainerMessageType.BlobAttach) {\n\t\t\t\t// BlobAttach ops must have their metadata visible and cannot be grouped (see opGroupingManager.ts)\n\t\t\t\tthis.outbox.submitBlobAttach(message);\n\t\t\t} else {\n\t\t\t\tthis.outbox.submit(message);\n\t\t\t}\n\n\t\t\tthis.scheduleFlush();\n\t\t} catch (error) {\n\t\t\tconst dpe = DataProcessingError.wrapIfUnrecognized(error, \"ContainerRuntime.submit\", {\n\t\t\t\treferenceSequenceNumber: this.deltaManager.lastSequenceNumber,\n\t\t\t});\n\t\t\tthis.closeFn(dpe);\n\t\t\tthrow dpe;\n\t\t}\n\n\t\tthis.updateDocumentDirtyState();\n\t}\n\n\tprivate scheduleFlush(): void {\n\t\tif (this.flushScheduled) {\n\t\t\treturn;\n\t\t}\n\t\tthis.flushScheduled = true;\n\n\t\tswitch (this.flushMode) {\n\t\t\tcase FlushMode.Immediate: {\n\t\t\t\t// When in Immediate flush mode, flush immediately unless we are intentionally batching multiple ops (e.g. via orderSequentially)\n\t\t\t\tif (!this.batchRunner.running) {\n\t\t\t\t\tthis.flush();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase FlushMode.TurnBased: {\n\t\t\t\t// When in TurnBased flush mode the runtime will buffer operations in the current turn and send them as a single\n\t\t\t\t// batch at the end of the turn\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises -- Container will close if flush throws\n\t\t\t\tPromise.resolve().then(() => this.flush());\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t// FlushModeExperimental is experimental and not exposed directly in the runtime APIs\n\t\t\tcase FlushModeExperimental.Async as unknown as FlushMode: {\n\t\t\t\t// When in Async flush mode, the runtime will accumulate all operations across JS turns and send them as a single\n\t\t\t\t// batch when all micro-tasks are complete.\n\t\t\t\t// Compared to TurnBased, this flush mode will capture more ops into the same batch.\n\t\t\t\tsetTimeout(() => this.flush(), 0);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tfail(0x587 /* Unreachable unless manually accumulating a batch */);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate submitSummaryMessage(\n\t\tcontents: ISummaryContent,\n\t\treferenceSequenceNumber: number,\n\t): number {\n\t\tthis.verifyNotClosed();\n\t\tassert(\n\t\t\tthis.connected,\n\t\t\t0x133 /* \"Container disconnected when trying to submit system message\" */,\n\t\t);\n\n\t\t// System message should not be sent in the middle of the batch.\n\t\tassert(this.outbox.isEmpty, 0x3d4 /* System op in the middle of a batch */);\n\n\t\treturn this.submitSummaryFn(contents, referenceSequenceNumber);\n\t}\n\n\t/**\n\t * Throw an error if the runtime is closed. Methods that are expected to potentially\n\t * be called after dispose due to asynchrony should not call this.\n\t */\n\tprivate verifyNotClosed(): void {\n\t\tif (this._disposed) {\n\t\t\tthrow new Error(\"Runtime is closed\");\n\t\t}\n\t}\n\n\t/**\n\t * Resubmits each message in the batch, and then flushes the outbox.\n\t * This typically happens when we reconnect and there are pending messages.\n\t *\n\t * @remarks\n\t * Attempting to resubmit a batch that has been successfully sequenced will not happen due to\n\t * checks in the ConnectionStateHandler (Loader layer)\n\t *\n\t * The only exception to this would be if the Container \"forks\" due to misuse of the \"Offline Load\" feature.\n\t * If the \"Offline Load\" feature is enabled, the batchId is included in the resubmitted messages,\n\t * for correlation to detect container forking.\n\t */\n\tprivate reSubmitBatch(\n\t\tbatch: PendingMessageResubmitData[],\n\t\t{ batchId, staged, squash }: PendingBatchResubmitMetadata,\n\t): void {\n\t\tassert(\n\t\t\tthis._summarizer === undefined,\n\t\t\t0x8f2 /* Summarizer never reconnects so should never resubmit */,\n\t\t);\n\n\t\tconst resubmitInfo = {\n\t\t\t// Only include Batch ID if \"Offline Load\" feature is enabled\n\t\t\t// It's only needed to identify batches across container forks arising from misuse of offline load.\n\t\t\tbatchId: this.batchIdTrackingEnabled ? batchId : undefined,\n\t\t\tstaged,\n\t\t};\n\n\t\tconst resubmitFn = squash\n\t\t\t? this.reSubmitWithSquashing.bind(this)\n\t\t\t: this.reSubmit.bind(this);\n\n\t\tthis.batchRunner.run(() => {\n\t\t\tfor (const message of batch) {\n\t\t\t\tresubmitFn(message);\n\t\t\t}\n\t\t}, resubmitInfo);\n\n\t\tthis.flush(resubmitInfo);\n\t}\n\n\t/**\n\t * Resubmit the given message as part of a squash rebase upon exiting Staging Mode.\n\t * How exactly to resubmit the message is up to the subsystem that submitted the op to begin with.\n\t */\n\tprivate reSubmitWithSquashing(resubmitData: PendingMessageResubmitData): void {\n\t\tconst message = resubmitData.runtimeOp;\n\t\tassert(\n\t\t\tcanStageMessageOfType(message.type),\n\t\t\t0xbbb /* Expected message type to be compatible with staging */,\n\t\t);\n\t\tswitch (message.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp: {\n\t\t\t\tthis.channelCollection.reSubmitContainerMessage(\n\t\t\t\t\tmessage,\n\t\t\t\t\tresubmitData.localOpMetadata,\n\t\t\t\t\t/* squash: */ true,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// NOTE: Squash doesn't apply to GC or DocumentSchemaChange ops, fallback to typical resubmit logic.\n\t\t\tcase ContainerMessageType.GC:\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\tthis.reSubmit(resubmitData);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(message.type);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Resubmit the given message which was previously submitted to the ContainerRuntime but not successfully\n\t * transmitted to the ordering service (e.g. due to a disconnect, or being in Staging Mode)\n\t * How to resubmit is up to the subsystem that submitted the op to begin with\n\t */\n\tprivate reSubmit({\n\t\truntimeOp: message,\n\t\tlocalOpMetadata,\n\t\topMetadata,\n\t}: PendingMessageResubmitData): void {\n\t\tswitch (message.type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp:\n\t\t\tcase ContainerMessageType.Attach:\n\t\t\tcase ContainerMessageType.Alias: {\n\t\t\t\t// Call reSubmitContainerMessage which will find the right store\n\t\t\t\t// and trigger resubmission on it.\n\t\t\t\tthis.channelCollection.reSubmitContainerMessage(\n\t\t\t\t\tmessage,\n\t\t\t\t\tlocalOpMetadata,\n\t\t\t\t\t/* squash: */ false,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.IdAllocation: {\n\t\t\t\t// Allocation ops are never resubmitted/rebased. This is because they require special handling to\n\t\t\t\t// avoid being submitted out of order. For example, if the pending state manager contained\n\t\t\t\t// [idOp1, dataOp1, idOp2, dataOp2] and the resubmission of dataOp1 generated idOp3, that would be\n\t\t\t\t// placed into the outbox in the same batch as idOp1, but before idOp2 is resubmitted.\n\t\t\t\t// To avoid this, allocation ops are simply never resubmitted. Prior to invoking the pending state\n\t\t\t\t// manager to replay pending ops, the runtime will always submit a new allocation range that includes\n\t\t\t\t// all pending IDs. The resubmitted allocation ops are then ignored here.\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.BlobAttach: {\n\t\t\t\tthis.blobManager.reSubmit(opMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.Rejoin: {\n\t\t\t\tthis.submit(message);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\tthis.submit(message);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\t// We shouldn't directly resubmit due to Compare-And-Swap semantics.\n\t\t\t\t// If needed it will be generated from scratch before other ops are submitted.\n\t\t\t\tthis.documentsSchemaController.pendingOpNotAcked();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tconst error = getUnknownMessageTypeError(message.type, \"reSubmitCore\" /* codePath */);\n\t\t\t\tthis.closeFn(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rollback the given op which was only staged but not yet submitted.\n\t */\n\tprivate rollbackStagedChange(\n\t\t{ type, contents }: LocalContainerRuntimeMessage,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tassert(canStageMessageOfType(type), 0xbbc /* Unexpected message type to be rolled back */);\n\n\t\tswitch (type) {\n\t\t\tcase ContainerMessageType.FluidDataStoreOp: {\n\t\t\t\t// For operations, call rollbackDataStoreOp which will find the right store\n\t\t\t\t// and trigger rollback on it.\n\t\t\t\tthis.channelCollection.rollbackDataStoreOp(contents, localOpMetadata);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.GC: {\n\t\t\t\t// Just drop it, but log an error, this is not expected and not ideal, but not critical failure either.\n\t\t\t\t// Currently the only expected type here is TombstoneLoaded, which will have been preceded by one of these events as well:\n\t\t\t\t// GC_Tombstone_DataStore_Requested, GC_Tombstone_SubDataStore_Requested, GC_Tombstone_Blob_Requested\n\t\t\t\tthis.mc.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"GC_OpDiscarded\",\n\t\t\t\t\tdetails: { subType: contents.type },\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase ContainerMessageType.DocumentSchemaChange: {\n\t\t\t\t// Notify the document schema controller that the pending op was not acked.\n\t\t\t\t// This will allow it to propose the schema change again if needed.\n\t\t\t\tthis.documentsSchemaController.pendingOpNotAcked();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(type);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck\n\t */\n\tpublic async refreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise<void> {\n\t\tconst { proposalHandle, ackHandle, summaryRefSeq, summaryLogger } = options;\n\t\t// proposalHandle is always passed from RunningSummarizer.\n\t\tassert(proposalHandle !== undefined, 0x766 /* proposalHandle should be available */);\n\t\tconst result = await this.summarizerNode.refreshLatestSummary(\n\t\t\tproposalHandle,\n\t\t\tsummaryRefSeq,\n\t\t);\n\n\t\t/* eslint-disable jsdoc/check-indentation */\n\t\t/**\n\t\t * If the snapshot corresponding to the ack is not tracked by this client, it was submitted by another client.\n\t\t * Take action as per the following scenarios:\n\t\t * 1. If that snapshot is older than the one tracked by this client, ignore the ack because only the latest\n\t\t * snapshot is tracked.\n\t\t * 2. If that snapshot is newer, attempt to fetch the latest snapshot and do one of the following:\n\t\t * 2.1. If the fetched snapshot is same or newer than the one for which ack was received, close this client.\n\t\t * The next summarizer client will likely start from this snapshot and get out of this state. Fetching\n\t\t * the snapshot updates the cache for this client so if it's re-elected as summarizer, this will prevent\n\t\t * any thrashing.\n\t\t * 2.2. If the fetched snapshot is older than the one for which ack was received, ignore the ack. This can\n\t\t * happen in scenarios where the snapshot for the ack was lost in storage (in scenarios like DB rollback,\n\t\t * etc.) but the summary ack is still there because it's tracked a different service. In such cases,\n\t\t * ignoring the ack is the correct thing to do because the latest snapshot in storage is not the one for\n\t\t * the ack but is still the one tracked by this client. If we were to close the summarizer like in the\n\t\t * previous scenario, it will result in this document stuck in this state in a loop.\n\t\t */\n\t\t/* eslint-enable jsdoc/check-indentation */\n\t\tif (!result.isSummaryTracked) {\n\t\t\tif (result.isSummaryNewer) {\n\t\t\t\tawait this.fetchLatestSnapshotAndMaybeClose(summaryRefSeq, ackHandle, summaryLogger);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Notify the garbage collector so it can update its latest summary state.\n\t\tawait this.garbageCollector.refreshLatestSummary(result);\n\n\t\t// If we here, the ack was tracked by this client. Update the summary context of the last ack.\n\t\tthis.lastAckedSummaryContext = {\n\t\t\tproposalHandle,\n\t\t\tackHandle,\n\t\t\treferenceSequenceNumber: summaryRefSeq,\n\t\t};\n\t}\n\n\tprivate readonly readAndParseBlob = async <T>(id: string): Promise<T> =>\n\t\treadAndParse<T>(this.storage, id);\n\n\t/**\n\t * Fetches the latest snapshot from storage. If the fetched snapshot is same or newer than the one for which ack\n\t * was received, close this client. Fetching the snapshot will update the cache for this client so if it's\n\t * re-elected as summarizer, this will prevent any thrashing.\n\t * If the fetched snapshot is older than the one for which ack was received, ignore the ack and return. This can\n\t * happen in scenarios where the snapshot for the ack was lost in storage in scenarios like DB rollback, etc.\n\t */\n\tprivate async fetchLatestSnapshotAndMaybeClose(\n\t\ttargetRefSeq: number,\n\t\ttargetAckHandle: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<void> {\n\t\tconst fetchedSnapshotRefSeq = await PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"RefreshLatestSummaryAckFetch\" },\n\t\t\tasync (perfEvent: {\n\t\t\t\tend: (arg0: {\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tgetVersionDuration?: number | undefined;\n\t\t\t\t\t\tgetSnapshotDuration?: number | undefined;\n\t\t\t\t\t\tsnapshotRefSeq?: number | undefined;\n\t\t\t\t\t\tsnapshotVersion?: string | undefined;\n\t\t\t\t\t\tnewerSnapshotPresent?: boolean | undefined;\n\t\t\t\t\t\ttargetRefSeq?: number | undefined;\n\t\t\t\t\t\ttargetAckHandle?: string | undefined;\n\t\t\t\t\t};\n\t\t\t\t}) => void;\n\t\t\t}) => {\n\t\t\t\tconst props: {\n\t\t\t\t\tgetVersionDuration?: number;\n\t\t\t\t\tgetSnapshotDuration?: number;\n\t\t\t\t\tsnapshotRefSeq?: number;\n\t\t\t\t\tsnapshotVersion?: string;\n\t\t\t\t\tnewerSnapshotPresent?: boolean | undefined;\n\t\t\t\t\ttargetRefSeq?: number | undefined;\n\t\t\t\t\ttargetAckHandle?: string | undefined;\n\t\t\t\t} = { targetRefSeq, targetAckHandle };\n\t\t\t\tconst trace = Trace.start();\n\n\t\t\t\tlet snapshotTree: ISnapshotTree | null;\n\t\t\t\tconst scenarioName = \"RefreshLatestSummaryAckFetch\";\n\t\t\t\t// If loader supplied us the ISnapshot when loading, the new getSnapshotApi is supported and feature gate is ON, then use the\n\t\t\t\t// new API, otherwise it will reduce the service performance because the service will need to recalculate the full snapshot\n\t\t\t\t// in case previously getSnapshotApi was used and now we use the getVersions API.\n\t\t\t\tif (\n\t\t\t\t\tthis.isSnapshotInstanceOfISnapshot &&\n\t\t\t\t\tthis.storage.getSnapshot !== undefined &&\n\t\t\t\t\tthis.mc.config.getBoolean(\"Fluid.Container.UseLoadingGroupIdForSnapshotFetch2\") ===\n\t\t\t\t\t\ttrue\n\t\t\t\t) {\n\t\t\t\t\tconst snapshot = await this.storage.getSnapshot({\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\tfetchSource: FetchSource.noCache,\n\t\t\t\t\t});\n\t\t\t\t\tconst id = snapshot.snapshotTree.id;\n\t\t\t\t\tassert(id !== undefined, 0x9d0 /* id of the fetched snapshot should be defined */);\n\t\t\t\t\tprops.snapshotVersion = id;\n\t\t\t\t\tsnapshotTree = snapshot.snapshotTree;\n\t\t\t\t} else {\n\t\t\t\t\tconst versions = await this.storage.getVersions(\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\t1,\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\tFetchSource.noCache,\n\t\t\t\t\t);\n\t\t\t\t\tassert(versions[0] !== undefined, 0x137 /* \"Failed to get version from storage\" */);\n\t\t\t\t\tsnapshotTree = await this.storage.getSnapshotTree(versions[0]);\n\t\t\t\t\tassert(!!snapshotTree, 0x138 /* \"Failed to get snapshot from storage\" */);\n\t\t\t\t\tprops.snapshotVersion = versions[0].id;\n\t\t\t\t}\n\n\t\t\t\tprops.getSnapshotDuration = trace.trace().duration;\n\n\t\t\t\tconst snapshotRefSeq = await seqFromTree(snapshotTree, this.readAndParseBlob);\n\t\t\t\tprops.snapshotRefSeq = snapshotRefSeq;\n\t\t\t\tprops.newerSnapshotPresent = snapshotRefSeq >= targetRefSeq;\n\n\t\t\t\tperfEvent.end({ details: props });\n\t\t\t\treturn snapshotRefSeq;\n\t\t\t},\n\t\t);\n\n\t\t// If the snapshot that was fetched is older than the target snapshot, return. The summarizer will not be closed\n\t\t// because the snapshot is likely deleted from storage and it so, closing the summarizer will result in the\n\t\t// document being stuck in this state.\n\t\tif (fetchedSnapshotRefSeq < targetRefSeq) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait delay(this.closeSummarizerDelayMs);\n\t\tthis._summarizer?.stop(\"latestSummaryStateStale\");\n\t\tthis.disposeFn();\n\t}\n\n\tpublic getPendingLocalState(props?: IGetPendingLocalStateProps): unknown {\n\t\t// AB#46464 - Add support for serializing pending state while in staging mode\n\t\tif (this.inStagingMode) {\n\t\t\tthrow new UsageError(\"getPendingLocalState is not yet supported in staging mode\");\n\t\t}\n\n\t\tthis.verifyNotClosed();\n\t\tif (props?.notifyImminentClosure === true) {\n\t\t\tthrow new UsageError(\"notifyImminentClosure is no longer supported in ContainerRuntime\");\n\t\t}\n\n\t\tif (this.batchRunner.running) {\n\t\t\tthrow new UsageError(\"can't get state while manually accumulating a batch\");\n\t\t}\n\n\t\t// Flush pending batch.\n\t\t// getPendingLocalState() is only exposed through Container.getPendingLocalState(), so it's safe\n\t\t// to close current batch.\n\t\tthis.flush();\n\n\t\treturn PerformanceEvent.timedExec<IPendingRuntimeState | undefined>(\n\t\t\tthis.mc.logger,\n\t\t\t{\n\t\t\t\teventName: \"getPendingLocalState\",\n\t\t\t},\n\t\t\t(event) => {\n\t\t\t\tconst pending = this.pendingStateManager.getLocalState(props?.snapshotSequenceNumber);\n\t\t\t\tconst sessionExpiryTimerStarted =\n\t\t\t\t\tprops?.sessionExpiryTimerStarted ?? this.garbageCollector.sessionExpiryTimerStarted;\n\n\t\t\t\tconst pendingIdCompressorState = this._idCompressor?.serialize(true);\n\t\t\t\tconst pendingAttachmentBlobs = this.blobManager.getPendingBlobs();\n\n\t\t\t\tconst pendingRuntimeState: IPendingRuntimeState = {\n\t\t\t\t\tpending,\n\t\t\t\t\tpendingIdCompressorState,\n\t\t\t\t\tpendingAttachmentBlobs,\n\t\t\t\t\tsessionExpiryTimerStarted,\n\t\t\t\t};\n\t\t\t\tevent.end({\n\t\t\t\t\tattachmentBlobsSize: Object.keys(pendingAttachmentBlobs ?? {}).length,\n\t\t\t\t\tpendingOpsSize: pendingRuntimeState?.pending?.pendingStates.length,\n\t\t\t\t});\n\t\t\t\treturn pendingRuntimeState;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * ContainerRuntime knows about additional restrictions on when blob sharing can be resumed as compared\n\t * to BlobManager. In particular, it wants to avoid sharing blobs while in readonly state, and it also\n\t * wants to avoid sharing blobs before connection completes (otherwise it may cause the sharing to happen\n\t * before processing shared ops).\n\t *\n\t * This method can be called safely before those conditions are met. In the background, it will wait until\n\t * it is safe before initiating sharing. It will close the container on any error.\n\t */\n\tpublic sharePendingBlobs = (): void => {\n\t\tnew Promise<void>((resolve) => {\n\t\t\t// eslint-disable-next-line unicorn/consistent-function-scoping\n\t\t\tconst canStartSharing = (): boolean =>\n\t\t\t\tthis.connected && this.deltaManager.readOnlyInfo.readonly !== true;\n\n\t\t\tif (canStartSharing()) {\n\t\t\t\tresolve();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst checkCanShare = (readonly: boolean): void => {\n\t\t\t\tif (canStartSharing()) {\n\t\t\t\t\tthis.deltaManager.off(\"readonly\", checkCanShare);\n\t\t\t\t\tthis.off(\"connected\", checkCanShare);\n\t\t\t\t\tresolve();\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis.deltaManager.on(\"readonly\", checkCanShare);\n\t\t\tthis.on(\"connected\", checkCanShare);\n\t\t})\n\t\t\t.then(this.blobManager.sharePendingBlobs)\n\t\t\t// It may not be necessary to close the container on failures - this should just mean there's\n\t\t\t// a handle in the container that is stuck pending, which is a scenario that customers need to\n\t\t\t// handle anyway. Starting with this more aggressive/restrictive behavior to be cautious.\n\t\t\t.catch(this.closeFn);\n\t};\n\n\tpublic summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults {\n\t\tif (this._summarizer !== undefined) {\n\t\t\treturn this._summarizer.summarizeOnDemand(options);\n\t\t} else if (this.summaryManager === undefined) {\n\t\t\t// If we're not the summarizer, and we don't have a summaryManager, we expect that\n\t\t\t// disableSummaries is turned on. We are throwing instead of returning a failure here,\n\t\t\t// because it is a misuse of the API rather than an expected failure.\n\t\t\tthrow new UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);\n\t\t} else {\n\t\t\treturn this.summaryManager.summarizeOnDemand(options);\n\t\t}\n\t}\n\n\tpublic enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult {\n\t\tif (this._summarizer !== undefined) {\n\t\t\treturn this._summarizer.enqueueSummarize(options);\n\t\t} else if (this.summaryManager === undefined) {\n\t\t\t// If we're not the summarizer, and we don't have a summaryManager, we expect that\n\t\t\t// generateSummaries is turned off. We are throwing instead of returning a failure here,\n\t\t\t// because it is a misuse of the API rather than an expected failure.\n\t\t\tthrow new UsageError(`Can't summarize, disableSummaries: ${this.summariesDisabled}`);\n\t\t} else {\n\t\t\treturn this.summaryManager.enqueueSummarize(options);\n\t\t}\n\t}\n\n\t// While internal, ContainerRuntime has not been converted to use the new events support.\n\t// Recreate the required events (new pattern) with injected, wrapper new emitter.\n\t// It is lazily create to avoid listeners (old events) that ultimately go nowhere.\n\tprivate readonly lazyEventsForExtensions = new Lazy<Listenable<ExtensionHostEvents>>(() => {\n\t\tconst eventEmitter = createEmitter<ExtensionHostEvents>();\n\t\tif (this.getConnectionState) {\n\t\t\tthis.on(\"connectedToService\", (clientId: string, canWrite: boolean) => {\n\t\t\t\teventEmitter.emit(\"joined\", { clientId, canWrite });\n\t\t\t});\n\t\t\tthis.on(\"disconnectedFromService\", () => eventEmitter.emit(\"disconnected\"));\n\t\t\tthis.on(\"operabilityChanged\", (canWrite: boolean) =>\n\t\t\t\teventEmitter.emit(\"operabilityChanged\", canWrite),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.on(\"connected\", (clientId: string) => {\n\t\t\t\teventEmitter.emit(\"joined\", { clientId, canWrite: true });\n\t\t\t});\n\t\t\tthis.on(\"disconnected\", () => eventEmitter.emit(\"disconnected\"));\n\t\t}\n\t\treturn eventEmitter;\n\t});\n\n\tprivate getJoinedStatus(): JoinedStatus {\n\t\tconst getConnectionState = this.getConnectionState;\n\t\tif (getConnectionState) {\n\t\t\tconst connectionState = getConnectionState();\n\t\t\tif (\n\t\t\t\tconnectionState === ConnectionState.Connected ||\n\t\t\t\tconnectionState === ConnectionState.CatchingUp\n\t\t\t) {\n\t\t\t\t// Note: when CatchingUp, canSendOps will always be false.\n\t\t\t\treturn this.canSendOps ? \"joinedForWriting\" : \"joinedForReading\";\n\t\t\t}\n\t\t} else if (this.canSendOps) {\n\t\t\treturn \"joinedForWriting\";\n\t\t}\n\t\treturn \"disconnected\";\n\t}\n\n\tprivate readonly submitExtensionSignal: <TMessage extends TypedMessage>(\n\t\tid: string,\n\t\taddressChain: string[],\n\t\tmessage: OutboundExtensionMessage<TMessage>,\n\t) => void;\n\n\tpublic acquireExtension<\n\t\tT,\n\t\tTRuntimeProperties extends ExtensionRuntimeProperties,\n\t\tTUseContext extends unknown[],\n\t>(\n\t\tid: ContainerExtensionId,\n\t\tfactory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,\n\t\t...useContext: TUseContext\n\t): T {\n\t\treturn this.acquireExtensionInternal(\n\t\t\t/* injectionPermitted */ true,\n\t\t\tid,\n\t\t\tfactory,\n\t\t\t...useContext,\n\t\t);\n\t}\n\n\tpublic getExtension<\n\t\tT,\n\t\tTRuntimeProperties extends ExtensionRuntimeProperties,\n\t\tTUseContext extends unknown[],\n\t>(\n\t\tid: ContainerExtensionId,\n\t\trequirements: ContainerExtensionExpectations,\n\t\t...useContext: TUseContext\n\t): T {\n\t\t// Temporarily allow injection for extensions.\n\t\t// `requirements` are expected to be a factory as well.\n\t\treturn this.acquireExtensionInternal(\n\t\t\t/* injectionPermitted */ true,\n\t\t\tid,\n\t\t\trequirements as ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,\n\t\t\t...useContext,\n\t\t);\n\t}\n\n\tprivate acquireExtensionInternal<\n\t\tT,\n\t\tTRuntimeProperties extends ExtensionRuntimeProperties,\n\t\tTUseContext extends unknown[],\n\t>(\n\t\tinjectionPermitted: boolean,\n\t\tid: ContainerExtensionId,\n\t\tfactory: ContainerExtensionFactory<T, TRuntimeProperties, TUseContext>,\n\t\t...useContext: TUseContext\n\t): T {\n\t\tconst compatCheckResult = checkLayerCompatibility(\n\t\t\tfactory.hostRequirements,\n\t\t\tcontainerRuntimeCompatDetailsForContainerExtensions,\n\t\t);\n\t\tif (!compatCheckResult.isCompatible) {\n\t\t\tthrow new UsageError(\"Extension is not compatible with ContainerRuntime\", {\n\t\t\t\terrorDetails: JSON.stringify({\n\t\t\t\t\tcontainerRuntimeVersion:\n\t\t\t\t\t\tcontainerRuntimeCompatDetailsForContainerExtensions.pkgVersion,\n\t\t\t\t\tcontainerRuntimeGeneration:\n\t\t\t\t\t\tcontainerRuntimeCompatDetailsForContainerExtensions.generation,\n\t\t\t\t\tminSupportedGeneration: factory.hostRequirements.minSupportedGeneration,\n\t\t\t\t\tisGenerationCompatible: compatCheckResult.isGenerationCompatible,\n\t\t\t\t\tunsupportedFeatures: compatCheckResult.unsupportedFeatures,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\n\t\tlet entry = this.extensions.get(id);\n\t\tif (entry === undefined) {\n\t\t\tif (!injectionPermitted) {\n\t\t\t\tthrow new Error(`Extension ${id} not found`);\n\t\t\t}\n\n\t\t\tconst audience = this.signalAudience;\n\t\t\tconst runtime = {\n\t\t\t\tgetJoinedStatus: this.getJoinedStatus.bind(this),\n\t\t\t\tgetClientId: audience ? () => audience.getSelf()?.clientId : () => this.clientId,\n\t\t\t\tevents: this.lazyEventsForExtensions.value,\n\t\t\t\tlogger: this.baseLogger,\n\t\t\t\tsubmitAddressedSignal: (\n\t\t\t\t\taddressChain: string[],\n\t\t\t\t\tmessage: OutboundExtensionMessage<TRuntimeProperties[\"SignalMessages\"]>,\n\t\t\t\t) => {\n\t\t\t\t\tthis.submitExtensionSignal(id, addressChain, message);\n\t\t\t\t},\n\t\t\t\tgetQuorum: this.getQuorum.bind(this),\n\t\t\t\tgetAudience: audience ? () => audience : this.getAudience.bind(this),\n\t\t\t\tsupportedFeatures: this.ILayerCompatDetails.supportedFeatures,\n\t\t\t} satisfies ExtensionHost<TRuntimeProperties>;\n\t\t\tentry = factory.instantiateExtension(runtime, ...useContext);\n\t\t\tthis.extensions.set(id, entry);\n\t\t} else {\n\t\t\tconst { extension, compatibility } = entry;\n\t\t\tif (\n\t\t\t\t// Check short-circuit (re-use) for same instance which must be\n\t\t\t\t// same version and capabilities.\n\t\t\t\t!(entry instanceof factory) &&\n\t\t\t\t// Check version and capabilities if different instance. If\n\t\t\t\t// version matches and existing has all capabilities of\n\t\t\t\t// requested, then allow direct reuse.\n\t\t\t\t(compatibility.version !== factory.instanceExpectations.version ||\n\t\t\t\t\t[...factory.instanceExpectations.capabilities].some(\n\t\t\t\t\t\t(cap) => !compatibility.capabilities.has(cap),\n\t\t\t\t\t))\n\t\t\t) {\n\t\t\t\t// eslint-disable-next-line unicorn/prefer-ternary -- operations are significant and deserve own blocks\n\t\t\t\tif (\n\t\t\t\t\t!injectionPermitted ||\n\t\t\t\t\tgt(compatibility.version, factory.instanceExpectations.version)\n\t\t\t\t) {\n\t\t\t\t\t// This is an attempt to acquire an older version of an\n\t\t\t\t\t// extension that is already acquired OR updating (form of\n\t\t\t\t\t// injection) is not permitted.\n\t\t\t\t\tentry = extension.handleVersionOrCapabilitiesMismatch(\n\t\t\t\t\t\tentry,\n\t\t\t\t\t\tfactory.instanceExpectations,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// This is an attempt to acquire a newer or more capable\n\t\t\t\t\t// version of an extension that is already acquired. Replace\n\t\t\t\t\t// existing with new.\n\t\t\t\t\tentry = factory.resolvePriorInstantiation(entry);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/consistent-destructuring -- 'entry' may have been update and thus use of 'extension' would be incorrect\n\t\t\tentry.extension.onNewUse(...useContext);\n\t\t}\n\t\treturn entry.interface as T;\n\t}\n\n\tprivate get groupedBatchingEnabled(): boolean {\n\t\treturn this.sessionSchema.opGroupingEnabled === true;\n\t}\n}\n\nexport function isContainerMessageDirtyable({\n\ttype,\n\tcontents,\n}: LocalContainerRuntimeMessage): boolean {\n\t// Certain container runtime messages should not mark the container dirty such as the old built-in\n\t// AgentScheduler and Garbage collector messages.\n\tswitch (type) {\n\t\tcase ContainerMessageType.Attach: {\n\t\t\tconst attachMessage = contents as InboundAttachMessage;\n\t\t\tif (attachMessage.id === agentSchedulerId) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase ContainerMessageType.FluidDataStoreOp: {\n\t\t\tconst envelope = contents;\n\t\t\tif (envelope.address === agentSchedulerId) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase ContainerMessageType.IdAllocation:\n\t\tcase ContainerMessageType.DocumentSchemaChange:\n\t\tcase ContainerMessageType.GC: {\n\t\t\treturn false;\n\t\t}\n\t\tdefault: {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn true;\n}\n"]}