From 85509357cd87fce7598fa0bd62245643324acd36 Mon Sep 17 00:00:00 2001 From: Matt Rakow Date: Thu, 1 Feb 2024 16:08:11 -0800 Subject: [PATCH] Remove dictionary from ILoaderOptions (#19306) --- .changeset/slick-kings-wish.md | 16 ++++++++++++ .../api-report/container-definitions.api.md | 9 +++---- .../container-definitions/src/loader.ts | 19 ++++++++++---- .../container-definitions/src/runtime.ts | 11 ++++++-- packages/dds/sequence/src/sequence.ts | 6 ++--- .../loader/container-loader/src/container.ts | 26 ++++++++++--------- .../container-runtime-definitions.api.md | 3 +-- .../src/containerRuntime.ts | 5 ++-- .../api-report/container-runtime.api.md | 3 +-- .../container-runtime/src/containerRuntime.ts | 7 ++--- .../container-runtime/src/dataStoreContext.ts | 10 +++---- .../api-report/datastore-definitions.api.md | 3 +-- .../src/dataStoreRuntime.ts | 10 +++---- .../datastore/api-report/datastore.api.md | 3 +-- .../runtime/datastore/src/dataStoreRuntime.ts | 10 +++---- .../api-report/runtime-definitions.api.md | 3 +-- .../src/dataStoreContext.ts | 10 +++---- .../api-report/test-runtime-utils.api.md | 5 ++-- .../runtime/test-runtime-utils/src/mocks.ts | 10 +++---- .../src/mocksDataStoreContext.ts | 10 +++---- .../src/test/attributionEndToEnd.spec.ts | 4 ++- .../src/test/cellAttributionEndToEnd.spec.ts | 4 ++- .../src/test/migration-shim/reconnect.spec.ts | 9 ++++++- .../test-service-load/src/optionsMatrix.ts | 1 + 24 files changed, 107 insertions(+), 90 deletions(-) create mode 100644 .changeset/slick-kings-wish.md diff --git a/.changeset/slick-kings-wish.md b/.changeset/slick-kings-wish.md new file mode 100644 index 0000000000000..3d476fad011fc --- /dev/null +++ b/.changeset/slick-kings-wish.md @@ -0,0 +1,16 @@ +--- +"@fluidframework/container-definitions": major +"@fluidframework/container-loader": major +"@fluidframework/container-runtime": major +"@fluidframework/container-runtime-definitions": major +"@fluidframework/datastore": major +"@fluidframework/datastore-definitions": major +"@fluidframework/runtime-definitions": major +"@fluidframework/sequence": major +"@fluid-private/test-end-to-end-tests": major +"@fluidframework/test-runtime-utils": major +--- + +ILoaderOptions no longer accepts arbitrary key/value pairs + +ILoaderOptions has been narrowed to the specific set of supported loader options, and may no longer be used to pass arbitrary key/value pairs through to the runtime. diff --git a/packages/common/container-definitions/api-report/container-definitions.api.md b/packages/common/container-definitions/api-report/container-definitions.api.md index 15a6f8b9093cb..a93de562f7f97 100644 --- a/packages/common/container-definitions/api-report/container-definitions.api.md +++ b/packages/common/container-definitions/api-report/container-definitions.api.md @@ -170,8 +170,7 @@ export interface IContainerContext { readonly id: string; // (undocumented) readonly loader: ILoader; - // (undocumented) - readonly options: ILoaderOptions; + readonly options: Record; // (undocumented) pendingLocalState?: unknown; // (undocumented) @@ -403,11 +402,11 @@ export interface ILoaderHeader { [LoaderHeader.version]: string | undefined; } -// @public (undocumented) +// @alpha export type ILoaderOptions = { - [key in string | number]: any; -} & { cache?: boolean; + client?: IClient; + enableOfflineLoad?: boolean; provideScopeLoader?: boolean; maxClientLeaveWaitTime?: number; }; diff --git a/packages/common/container-definitions/src/loader.ts b/packages/common/container-definitions/src/loader.ts index 8500f99ff28e2..ec745a4e4cbdb 100644 --- a/packages/common/container-definitions/src/loader.ts +++ b/packages/common/container-definitions/src/loader.ts @@ -5,6 +5,7 @@ import { IRequest, FluidObject, IEvent, IEventProvider } from "@fluidframework/core-interfaces"; import { + IClient, IClientDetails, IDocumentMessage, IQuorumClients, @@ -303,7 +304,6 @@ export type ConnectionState = * The Host's view of a Container and its connection to storage * @alpha */ -// eslint-disable-next-line import/no-deprecated export interface IContainer extends IEventProvider { /** * The Delta Manager supporting the op stream for this Container @@ -531,12 +531,11 @@ export interface IHostLoader extends ILoader { } /** - * @public + * Options to configure various behaviors of the ILoader. + * @alpha */ +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions export type ILoaderOptions = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - [key in string | number]: any; -} & { /** * @deprecated This option has been deprecated and will be removed in a future release * Set caching behavior for the loader. If true, we will load a container from cache if one @@ -548,6 +547,16 @@ export type ILoaderOptions = { */ cache?: boolean; + /** + * @deprecated Do not use. + */ + client?: IClient; + + /** + * @deprecated Do not use. + */ + enableOfflineLoad?: boolean; + /** * Provide the current Loader through the scope object when creating Containers. It is added * as the `ILoader` property, and will overwrite an existing property of the same name on the diff --git a/packages/common/container-definitions/src/runtime.ts b/packages/common/container-definitions/src/runtime.ts index 2f8943618e808..f3e1de26f7464 100644 --- a/packages/common/container-definitions/src/runtime.ts +++ b/packages/common/container-definitions/src/runtime.ts @@ -20,7 +20,7 @@ import { import { IAudience } from "./audience"; import { IDeltaManager } from "./deltas"; import { ICriticalContainerError } from "./error"; -import { ILoader, ILoaderOptions } from "./loader"; +import { ILoader } from "./loader"; import { IFluidCodeDetails } from "./fluidPackage"; /** @@ -123,7 +123,14 @@ export interface IBatchMessage { * @alpha */ export interface IContainerContext { - readonly options: ILoaderOptions; + /** + * Not recommended for general use, is used in some cases to control various runtime behaviors. + * + * @remarks + * Used to be ILoaderOptions, this is staging for eventual removal. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly options: Record; readonly clientId: string | undefined; readonly clientDetails: IClientDetails; readonly storage: IDocumentStorageService; diff --git a/packages/dds/sequence/src/sequence.ts b/packages/dds/sequence/src/sequence.ts index c64507a5ed632..85b6e991a4e3d 100644 --- a/packages/dds/sequence/src/sequence.ts +++ b/packages/dds/sequence/src/sequence.ts @@ -690,7 +690,7 @@ export abstract class SharedSegmentSequence .catch((error) => { this.loadFinished(error); }); - if (this.dataStoreRuntime.options?.sequenceInitializeFromHeaderOnly !== true) { + if (this.dataStoreRuntime.options.sequenceInitializeFromHeaderOnly !== true) { // if we not doing partial load, await the catch up ops, // and the finalization of the load await loadCatchUpOps; @@ -807,7 +807,7 @@ export abstract class SharedSegmentSequence } const needsTransformation = message.referenceSequenceNumber !== message.sequenceNumber - 1; let stashMessage: Readonly = message; - if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) { + if (this.runtime.options.newMergeTreeSnapshotFormat !== true) { if (needsTransformation) { this.on("sequenceDelta", transformOps); } @@ -815,7 +815,7 @@ export abstract class SharedSegmentSequence this.client.applyMsg(message, local); - if (this.runtime.options?.newMergeTreeSnapshotFormat !== true) { + if (this.runtime.options.newMergeTreeSnapshotFormat !== true) { if (needsTransformation) { this.removeListener("sequenceDelta", transformOps); // shallow clone the message as we only overwrite top level properties, diff --git a/packages/loader/container-loader/src/container.ts b/packages/loader/container-loader/src/container.ts index 69f2346e42828..b2c3744f47f6a 100644 --- a/packages/loader/container-loader/src/container.ts +++ b/packages/loader/container-loader/src/container.ts @@ -592,6 +592,7 @@ export class Container private readonly connectionTransitionTimes: number[] = []; private _loadedFromVersion: IVersion | undefined; private _dirtyContainer = false; + private readonly offlineLoadEnabled: boolean; private readonly savedOps: ISequencedDocumentMessage[] = []; private attachmentData: AttachmentData = { state: AttachState.Detached }; private readonly _containerId: string; @@ -676,12 +677,8 @@ export class Container return this._clientId; } - private get offlineLoadEnabled(): boolean { - const enabled = - this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ?? - this.options?.enableOfflineLoad === true; - // summarizer will not have any pending state we want to save - return enabled && this.deltaManager.clientDetails.capabilities.interactive; + private get isInteractiveClient(): boolean { + return this.deltaManager.clientDetails.capabilities.interactive; } /** @@ -825,7 +822,7 @@ export class Container this.client = Container.setupClient( this._containerId, - this.options, + options.client, this.clientDetailsOverride, ); @@ -942,6 +939,10 @@ export class Container pendingLocalState?.clientId, ); + this.offlineLoadEnabled = + this.mc.config.getBoolean("Fluid.Container.enableOfflineLoad") ?? + options.enableOfflineLoad === true; + this.on(savedContainerEvent, () => { this.connectionStateHandler.containerSaved(); }); @@ -1616,7 +1617,8 @@ export class Container }; } else { assert(snapshotTree !== undefined, 0x237 /* "Snapshot should exist" */); - if (this.offlineLoadEnabled) { + // non-interactive clients will not have any pending state we want to save + if (this.offlineLoadEnabled && this.isInteractiveClient) { const blobs = await getBlobContentsFromTree(snapshotTree, this.storageAdapter); this.attachmentData = { state: AttachState.Attached, @@ -2022,13 +2024,12 @@ export class Container private static setupClient( containerId: string, - options?: ILoaderOptions, + loaderOptionsClient?: IClient, clientDetailsOverride?: IClientDetails, ): IClient { - const loaderOptionsClient = structuredClone(options?.client); const client: IClient = loaderOptionsClient !== undefined - ? (loaderOptionsClient as IClient) + ? structuredClone(loaderOptionsClient) : { details: { capabilities: { interactive: true }, @@ -2333,7 +2334,8 @@ export class Container } private processRemoteMessage(message: ISequencedDocumentMessage) { - if (this.offlineLoadEnabled) { + // non-interactive clients will not have any pending state we want to save + if (this.offlineLoadEnabled && this.isInteractiveClient) { this.savedOps.push(message); } const local = this.clientId === message.clientId; diff --git a/packages/runtime/container-runtime-definitions/api-report/container-runtime-definitions.api.md b/packages/runtime/container-runtime-definitions/api-report/container-runtime-definitions.api.md index 17485b270f48b..bfb917d0a89de 100644 --- a/packages/runtime/container-runtime-definitions/api-report/container-runtime-definitions.api.md +++ b/packages/runtime/container-runtime-definitions/api-report/container-runtime-definitions.api.md @@ -17,7 +17,6 @@ import { IEventProvider } from '@fluidframework/core-interfaces'; import { IFluidDataStoreContextDetached } from '@fluidframework/runtime-definitions'; import { IFluidHandle } from '@fluidframework/core-interfaces'; import { IFluidHandleContext } from '@fluidframework/core-interfaces'; -import { ILoaderOptions } from '@fluidframework/container-definitions'; import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; import { IResponse } from '@fluidframework/core-interfaces'; @@ -41,7 +40,7 @@ export interface IContainerRuntime extends IProvideFluidDataStoreRegistry, ICont getAliasedDataStoreEntryPoint(alias: string): Promise | undefined>; readonly isDirty: boolean; // (undocumented) - readonly options: ILoaderOptions; + readonly options: Record; // (undocumented) readonly scope: FluidObject; // (undocumented) diff --git a/packages/runtime/container-runtime-definitions/src/containerRuntime.ts b/packages/runtime/container-runtime-definitions/src/containerRuntime.ts index b8c0adf5394c5..87c9eff9ec576 100644 --- a/packages/runtime/container-runtime-definitions/src/containerRuntime.ts +++ b/packages/runtime/container-runtime-definitions/src/containerRuntime.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { AttachState, IDeltaManager, ILoaderOptions } from "@fluidframework/container-definitions"; +import { AttachState, IDeltaManager } from "@fluidframework/container-definitions"; import { IEventProvider, IRequest, @@ -57,7 +57,8 @@ export type IContainerRuntimeBaseWithCombinedEvents = IContainerRuntimeBase & export interface IContainerRuntime extends IProvideFluidDataStoreRegistry, IContainerRuntimeBaseWithCombinedEvents { - readonly options: ILoaderOptions; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly options: Record; readonly clientId: string | undefined; readonly clientDetails: IClientDetails; readonly connected: boolean; diff --git a/packages/runtime/container-runtime/api-report/container-runtime.api.md b/packages/runtime/container-runtime/api-report/container-runtime.api.md index a3426c4a56be7..fe018842094cf 100644 --- a/packages/runtime/container-runtime/api-report/container-runtime.api.md +++ b/packages/runtime/container-runtime/api-report/container-runtime.api.md @@ -33,7 +33,6 @@ import { IGarbageCollectionData } from '@fluidframework/runtime-definitions'; import { IGetPendingLocalStateProps } from '@fluidframework/container-definitions'; import type { IIdCompressor } from '@fluidframework/id-compressor'; import type { IIdCompressorCore } from '@fluidframework/id-compressor'; -import { ILoaderOptions } from '@fluidframework/container-definitions'; import { IProvideFluidHandleContext } from '@fluidframework/core-interfaces'; import { IQuorumClients } from '@fluidframework/protocol-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; @@ -180,7 +179,7 @@ export class ContainerRuntime extends TypedEventEmitter; // (undocumented) - readonly options: ILoaderOptions; + readonly options: Record; // (undocumented) orderSequentially(callback: () => T): T; // (undocumented) diff --git a/packages/runtime/container-runtime/src/containerRuntime.ts b/packages/runtime/container-runtime/src/containerRuntime.ts index 02207a913417f..60d6632f8cdfd 100644 --- a/packages/runtime/container-runtime/src/containerRuntime.ts +++ b/packages/runtime/container-runtime/src/containerRuntime.ts @@ -21,7 +21,6 @@ import { IRuntime, ICriticalContainerError, AttachState, - ILoaderOptions, ILoader, LoaderHeader, IGetPendingLocalStateProps, @@ -934,7 +933,7 @@ export class ContainerRuntime return runtime; } - public readonly options: ILoaderOptions; + public readonly options: Record; private imminentClosure: boolean = false; private readonly _getClientId: () => string | undefined; @@ -1245,7 +1244,9 @@ export class ContainerRuntime this.submitSummaryFn = submitSummaryFn; this.submitSignalFn = submitSignalFn; - this.options = options; + // TODO: After IContainerContext.options is removed, we'll just create a new blank object {} here. + // Values are generally expected to be set from the runtime side. + this.options = options ?? {}; this.clientDetails = clientDetails; this.isSummarizerClient = this.clientDetails.type === summarizerClientType; this.loadedFromVersionId = context.getLoadedFromVersion()?.id; diff --git a/packages/runtime/container-runtime/src/dataStoreContext.ts b/packages/runtime/container-runtime/src/dataStoreContext.ts index 0894ccfe8e052..cc1be622b146a 100644 --- a/packages/runtime/container-runtime/src/dataStoreContext.ts +++ b/packages/runtime/container-runtime/src/dataStoreContext.ts @@ -11,12 +11,7 @@ import { IFluidHandle, ITelemetryProperties, } from "@fluidframework/core-interfaces"; -import { - IAudience, - IDeltaManager, - AttachState, - ILoaderOptions, -} from "@fluidframework/container-definitions"; +import { IAudience, IDeltaManager, AttachState } from "@fluidframework/container-definitions"; import { TypedEventEmitter } from "@fluid-internal/client-utils"; import { assert, Deferred, LazyPromise } from "@fluidframework/core-utils"; import { IDocumentStorageService } from "@fluidframework/driver-definitions"; @@ -152,7 +147,8 @@ export abstract class FluidDataStoreContext return this.pkg; } - public get options(): ILoaderOptions { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + public get options(): Record { return this._containerRuntime.options; } diff --git a/packages/runtime/datastore-definitions/api-report/datastore-definitions.api.md b/packages/runtime/datastore-definitions/api-report/datastore-definitions.api.md index 84cc542987245..7d3bade9031f8 100644 --- a/packages/runtime/datastore-definitions/api-report/datastore-definitions.api.md +++ b/packages/runtime/datastore-definitions/api-report/datastore-definitions.api.md @@ -19,7 +19,6 @@ import { IFluidLoadable } from '@fluidframework/core-interfaces'; import { IGarbageCollectionData } from '@fluidframework/runtime-definitions'; import { IIdCompressor } from '@fluidframework/id-compressor'; import { IInboundSignalMessage } from '@fluidframework/runtime-definitions'; -import { ILoaderOptions } from '@fluidframework/container-definitions'; import { IQuorumClients } from '@fluidframework/protocol-definitions'; import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'; import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions'; @@ -117,7 +116,7 @@ export interface IFluidDataStoreRuntime extends IEventProvider; // (undocumented) readonly rootRoutingContext: IFluidHandleContext; submitSignal(type: string, content: any, targetClientId?: string): void; diff --git a/packages/runtime/datastore-definitions/src/dataStoreRuntime.ts b/packages/runtime/datastore-definitions/src/dataStoreRuntime.ts index 19d75382aea3c..1fed3715b8331 100644 --- a/packages/runtime/datastore-definitions/src/dataStoreRuntime.ts +++ b/packages/runtime/datastore-definitions/src/dataStoreRuntime.ts @@ -12,12 +12,7 @@ import { IFluidHandle, FluidObject, } from "@fluidframework/core-interfaces"; -import { - IAudience, - IDeltaManager, - AttachState, - ILoaderOptions, -} from "@fluidframework/container-definitions"; +import { IAudience, IDeltaManager, AttachState } from "@fluidframework/container-definitions"; import { IDocumentMessage, IQuorumClients, @@ -53,7 +48,8 @@ export interface IFluidDataStoreRuntime readonly channelsRoutingContext: IFluidHandleContext; readonly objectsRoutingContext: IFluidHandleContext; - readonly options: ILoaderOptions; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly options: Record; readonly deltaManager: IDeltaManager; diff --git a/packages/runtime/datastore/api-report/datastore.api.md b/packages/runtime/datastore/api-report/datastore.api.md index 121178aec0ec8..5ca8073b66423 100644 --- a/packages/runtime/datastore/api-report/datastore.api.md +++ b/packages/runtime/datastore/api-report/datastore.api.md @@ -21,7 +21,6 @@ import { IFluidHandleContext } from '@fluidframework/core-interfaces'; import { IGarbageCollectionData } from '@fluidframework/runtime-definitions'; import { IIdCompressor } from '@fluidframework/id-compressor'; import { IInboundSignalMessage } from '@fluidframework/runtime-definitions'; -import { ILoaderOptions } from '@fluidframework/container-definitions'; import { IQuorumClients } from '@fluidframework/protocol-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; import { IResponse } from '@fluidframework/core-interfaces'; @@ -96,7 +95,7 @@ export class FluidDataStoreRuntime extends TypedEventEmitter; // (undocumented) process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void; // (undocumented) diff --git a/packages/runtime/datastore/src/dataStoreRuntime.ts b/packages/runtime/datastore/src/dataStoreRuntime.ts index 3824f25a41d64..80bfbc119b4f0 100644 --- a/packages/runtime/datastore/src/dataStoreRuntime.ts +++ b/packages/runtime/datastore/src/dataStoreRuntime.ts @@ -23,12 +23,7 @@ import { IResponse, } from "@fluidframework/core-interfaces"; import { assert, Deferred, LazyPromise, unreachableCase } from "@fluidframework/core-utils"; -import { - IAudience, - IDeltaManager, - AttachState, - ILoaderOptions, -} from "@fluidframework/container-definitions"; +import { IAudience, IDeltaManager, AttachState } from "@fluidframework/container-definitions"; import { buildSnapshotTree } from "@fluidframework/driver-utils"; import { IClientDetails, @@ -176,7 +171,8 @@ export class FluidDataStoreRuntime private readonly pendingHandlesToMakeVisible: Set = new Set(); public readonly id: string; - public readonly options: ILoaderOptions; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + public readonly options: Record; public readonly deltaManager: IDeltaManager; private readonly quorum: IQuorumClients; private readonly audience: IAudience; diff --git a/packages/runtime/runtime-definitions/api-report/runtime-definitions.api.md b/packages/runtime/runtime-definitions/api-report/runtime-definitions.api.md index c33dae82419b0..ca488ce673156 100644 --- a/packages/runtime/runtime-definitions/api-report/runtime-definitions.api.md +++ b/packages/runtime/runtime-definitions/api-report/runtime-definitions.api.md @@ -16,7 +16,6 @@ import { IEvent } from '@fluidframework/core-interfaces'; import { IEventProvider } from '@fluidframework/core-interfaces'; import { IFluidHandle } from '@fluidframework/core-interfaces'; import { IIdCompressor } from '@fluidframework/id-compressor'; -import { ILoaderOptions } from '@fluidframework/container-definitions'; import { IProvideFluidHandleContext } from '@fluidframework/core-interfaces'; import { IQuorumClients } from '@fluidframework/protocol-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; @@ -230,7 +229,7 @@ export interface IFluidDataStoreContext extends IEventProvider; readonly packagePath: readonly string[]; readonly scope: FluidObject; setChannelDirty(address: string): void; diff --git a/packages/runtime/runtime-definitions/src/dataStoreContext.ts b/packages/runtime/runtime-definitions/src/dataStoreContext.ts index 43d15f0356f13..480f3898639d9 100644 --- a/packages/runtime/runtime-definitions/src/dataStoreContext.ts +++ b/packages/runtime/runtime-definitions/src/dataStoreContext.ts @@ -14,12 +14,7 @@ import { IResponse, FluidObject, } from "@fluidframework/core-interfaces"; -import { - IAudience, - IDeltaManager, - AttachState, - ILoaderOptions, -} from "@fluidframework/container-definitions"; +import { IAudience, IDeltaManager, AttachState } from "@fluidframework/container-definitions"; import { IDocumentStorageService } from "@fluidframework/driver-definitions"; import { IClientDetails, @@ -383,7 +378,8 @@ export interface IFluidDataStoreContext * The package path of the data store as per the package factory. */ readonly packagePath: readonly string[]; - readonly options: ILoaderOptions; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + readonly options: Record; readonly clientId: string | undefined; readonly connected: boolean; readonly deltaManager: IDeltaManager; diff --git a/packages/runtime/test-runtime-utils/api-report/test-runtime-utils.api.md b/packages/runtime/test-runtime-utils/api-report/test-runtime-utils.api.md index 032245b4c72c2..9e11b46477ab7 100644 --- a/packages/runtime/test-runtime-utils/api-report/test-runtime-utils.api.md +++ b/packages/runtime/test-runtime-utils/api-report/test-runtime-utils.api.md @@ -38,7 +38,6 @@ import { IGarbageCollectionDetailsBase } from '@fluidframework/runtime-definitio import { IIdCompressor } from '@fluidframework/id-compressor'; import { IIdCompressorCore } from '@fluidframework/id-compressor'; import { ILoader } from '@fluidframework/container-definitions'; -import { ILoaderOptions } from '@fluidframework/container-definitions'; import { IQuorumClients } from '@fluidframework/protocol-definitions'; import { IRequest } from '@fluidframework/core-interfaces'; import { IResponse } from '@fluidframework/core-interfaces'; @@ -363,7 +362,7 @@ export class MockFluidDataStoreContext implements IFluidDataStoreContext { // (undocumented) once(event: string | symbol, listener: (...args: any[]) => void): this; // (undocumented) - options: ILoaderOptions; + options: Record; // (undocumented) packagePath: readonly string[]; // (undocumented) @@ -465,7 +464,7 @@ export class MockFluidDataStoreRuntime extends EventEmitter implements IFluidDat // (undocumented) get objectsRoutingContext(): IFluidHandleContext; // (undocumented) - options: ILoaderOptions; + options: Record; // (undocumented) readonly path = ""; // (undocumented) diff --git a/packages/runtime/test-runtime-utils/src/mocks.ts b/packages/runtime/test-runtime-utils/src/mocks.ts index 52835394d1289..365444c7af6e4 100644 --- a/packages/runtime/test-runtime-utils/src/mocks.ts +++ b/packages/runtime/test-runtime-utils/src/mocks.ts @@ -15,12 +15,7 @@ import { IRequest, IResponse, } from "@fluidframework/core-interfaces"; -import { - IAudience, - ILoader, - AttachState, - ILoaderOptions, -} from "@fluidframework/container-definitions"; +import { IAudience, ILoader, AttachState } from "@fluidframework/container-definitions"; import { IQuorumClients, @@ -676,7 +671,8 @@ export class MockFluidDataStoreRuntime public readonly documentId: string = undefined as any; public readonly id: string; public readonly existing: boolean = undefined as any; - public options: ILoaderOptions = {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + public options: Record = {}; public clientId: string; public readonly path = ""; public readonly connected = true; diff --git a/packages/runtime/test-runtime-utils/src/mocksDataStoreContext.ts b/packages/runtime/test-runtime-utils/src/mocksDataStoreContext.ts index 374b2d6104fce..3f3f1c925e55c 100644 --- a/packages/runtime/test-runtime-utils/src/mocksDataStoreContext.ts +++ b/packages/runtime/test-runtime-utils/src/mocksDataStoreContext.ts @@ -5,12 +5,7 @@ import { ITelemetryLoggerExt, createChildLogger } from "@fluidframework/telemetry-utils"; import { IFluidHandle, IFluidHandleContext, FluidObject } from "@fluidframework/core-interfaces"; -import { - IAudience, - IDeltaManager, - AttachState, - ILoaderOptions, -} from "@fluidframework/container-definitions"; +import { IAudience, IDeltaManager, AttachState } from "@fluidframework/container-definitions"; import { IClientDetails, @@ -37,7 +32,8 @@ import { IDocumentStorageService } from "@fluidframework/driver-definitions"; export class MockFluidDataStoreContext implements IFluidDataStoreContext { public isLocalDataStore: boolean = true; public packagePath: readonly string[] = undefined as any; - public options: ILoaderOptions = undefined as any; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + public options: Record = {}; public clientId: string | undefined = uuid(); public clientDetails: IClientDetails = { capabilities: { interactive: this.interactive } }; public connected: boolean = true; diff --git a/packages/test/test-end-to-end-tests/src/test/attributionEndToEnd.spec.ts b/packages/test/test-end-to-end-tests/src/test/attributionEndToEnd.spec.ts index 59263d23b363b..0807673ab350c 100644 --- a/packages/test/test-end-to-end-tests/src/test/attributionEndToEnd.spec.ts +++ b/packages/test/test-end-to-end-tests/src/test/attributionEndToEnd.spec.ts @@ -113,12 +113,14 @@ describeCompat("Attributor", "NoCompat", (getTestObjectProvider) => { configProvider: configProvider({ [enableOnNewFileKey]: runtimeAttributor !== undefined, }), + // TODO this option shouldn't live here - this options object is global to the container + // and not specific to the individual dataStoreRuntime. options: { attribution: { track: runtimeAttributor !== undefined, policyFactory: createInsertOnlyAttributionPolicy, }, - }, + } as any, }, }); diff --git a/packages/test/test-end-to-end-tests/src/test/cellAttributionEndToEnd.spec.ts b/packages/test/test-end-to-end-tests/src/test/cellAttributionEndToEnd.spec.ts index 5c2a20c7d1aa1..1e3acfdbd9c9b 100644 --- a/packages/test/test-end-to-end-tests/src/test/cellAttributionEndToEnd.spec.ts +++ b/packages/test/test-end-to-end-tests/src/test/cellAttributionEndToEnd.spec.ts @@ -99,11 +99,13 @@ describeCompat("Attributor for SharedCell", "NoCompat", (getTestObjectProvider) configProvider: configProvider({ [enableOnNewFileKey]: runtimeAttributor !== undefined, }), + // TODO this option shouldn't live here - this options object is global to the container + // and not specific to the individual dataStoreRuntime. options: { attribution: { track: runtimeAttributor !== undefined, }, - }, + } as any, }, }); diff --git a/packages/test/test-end-to-end-tests/src/test/migration-shim/reconnect.spec.ts b/packages/test/test-end-to-end-tests/src/test/migration-shim/reconnect.spec.ts index 10c37c92b2192..a0aacca623ba8 100644 --- a/packages/test/test-end-to-end-tests/src/test/migration-shim/reconnect.spec.ts +++ b/packages/test/test-end-to-end-tests/src/test/migration-shim/reconnect.spec.ts @@ -33,6 +33,7 @@ import { import { LoaderHeader } from "@fluidframework/container-definitions"; import { type IContainerExperimental } from "@fluidframework/container-loader"; import { type IContainerRuntimeOptions } from "@fluidframework/container-runtime"; +import { type ConfigTypes, type IConfigProviderBase } from "@fluidframework/core-interfaces"; import { type IChannel } from "@fluidframework/datastore-definitions"; import { createSummarizerFromFactory, @@ -40,6 +41,10 @@ import { type ITestObjectProvider, } from "@fluidframework/test-utils"; +const configProvider = (settings: Record): IConfigProviderBase => ({ + getRawConfig: (name: string): ConfigTypes => settings[name], +}); + const legacyNodeId: TraitLabel = "inventory" as TraitLabel; function updateQuantity(tree: LegacySharedTree, quantity: number): void { @@ -196,7 +201,9 @@ describeCompat("Stamped v2 ops", "NoCompat", (getTestObjectProvider) => { let provider: ITestObjectProvider; const loaderProps = { - options: { enableOfflineLoad: true }, + configProvider: configProvider({ + "Fluid.Container.enableOfflineLoad": true, + }), }; beforeEach("setup", async () => { diff --git a/packages/test/test-service-load/src/optionsMatrix.ts b/packages/test/test-service-load/src/optionsMatrix.ts index 49e457fda0b9a..95412c739aa93 100644 --- a/packages/test/test-service-load/src/optionsMatrix.ts +++ b/packages/test/test-service-load/src/optionsMatrix.ts @@ -23,6 +23,7 @@ import { ILoadTestConfig, OptionOverride } from "./testConfigFile"; const loaderOptionsMatrix: OptionsMatrix = { cache: booleanCases, + client: [undefined], provideScopeLoader: booleanCases, maxClientLeaveWaitTime: numberCases, summarizeProtocolTree: [undefined],