Skip to content

(compat) Added supported features and generation across Loader / Driver boundary - Part 2 #24855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 17, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/drivers/local-driver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export { createLocalDocumentService, LocalDocumentService } from "./localDocumen
export { LocalDocumentServiceFactory } from "./localDocumentServiceFactory.js";
export { LocalDocumentStorageService } from "./localDocumentStorageService.js";
export { createLocalResolverCreateNewRequest, LocalResolver } from "./localResolver.js";
export { localDriverCompatDetailsForLoader } from "./localRuntimeLayerCompatState.js";
export { localDriverCompatDetailsForLoader } from "./localLayerCompatState.js";
export { LocalSessionStorageDbFactory } from "./localSessionStorageDb.js";
2 changes: 1 addition & 1 deletion packages/drivers/local-driver/src/localDocumentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { TestHistorian } from "@fluidframework/server-test-utils";
import { LocalDeltaStorageService } from "./localDeltaStorageService.js";
import { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection.js";
import { LocalDocumentStorageService } from "./localDocumentStorageService.js";
import { localDriverCompatDetailsForLoader } from "./localRuntimeLayerCompatState.js";
import { localDriverCompatDetailsForLoader } from "./localLayerCompatState.js";

/**
* Basic implementation of a document service for local use.
Expand Down
3 changes: 3 additions & 0 deletions packages/drivers/odsp-driver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ export {
ISnapshotContentsWithProps,
parseCompactSnapshotResponse,
} from "./compactSnapshotParser.js";

// Layer Compat details
export { odspDriverCompatDetailsForLoader } from "./odspLayerCompatState.js";
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { TypedEventEmitter } from "@fluid-internal/client-utils";
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
import { IClient } from "@fluidframework/driver-definitions";
import {
IDocumentDeltaStorageService,
Expand All @@ -18,6 +18,7 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";

import { LocalOdspDeltaStorageService } from "./localOdspDeltaStorageService.js";
import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManager.js";
import { localOdspDriverCompatDetailsForLoader } from "./localOdspLayerCompatState.js";

/**
* IDocumentService implementation that provides explicit snapshot to the document storage service.
Expand All @@ -37,6 +38,14 @@ export class LocalOdspDocumentService
super();
}

/**
* The compatibility details of the Local ODSP Driver layer that is exposed to the Loader layer
* for validating Loader-Driver compatibility.
*/
public get ILayerCompatDetails(): ILayerCompatDetails {
return localOdspDriverCompatDetailsForLoader;
}

public get resolvedUrl(): IResolvedUrl {
return this.odspResolvedUrl;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

import { type ILayerCompatDetails } from "@fluid-internal/client-utils";

import { pkgVersion } from "../packageVersion.js";

/**
* Local ODSP Driver's compatibility details that is exposed to the Loader layer.
* @internal
*/
export const localOdspDriverCompatDetailsForLoader: ILayerCompatDetails = {
/**
* The package version of the Local ODSP Driver layer.
*/
pkgVersion,
/**
* The current generation of the Local ODSP Driver layer.
*/
generation: 1,
/**
* The features supported by the Local ODSP Driver layer across the Driver / Loader boundary.
*/
supportedFeatures: new Set<string>(),
};
11 changes: 10 additions & 1 deletion packages/drivers/odsp-driver/src/odspDocumentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { TypedEventEmitter } from "@fluid-internal/client-utils";
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
import { assert } from "@fluidframework/core-utils/internal";
import { IClient } from "@fluidframework/driver-definitions";
import {
Expand Down Expand Up @@ -38,6 +38,7 @@ import {
OdspDeltaStorageWithCache,
} from "./odspDeltaStorageService.js";
import { OdspDocumentStorageService } from "./odspDocumentStorageManager.js";
import { odspDriverCompatDetailsForLoader } from "./odspLayerCompatState.js";
import { hasOdcOrigin } from "./odspUrlHelper.js";
import { getOdspResolvedUrl } from "./odspUtils.js";
import { OpsCache } from "./opsCaching.js";
Expand Down Expand Up @@ -100,6 +101,14 @@ export class OdspDocumentService
);
}

/**
* The compatibility details of the ODSP Driver layer that is exposed to the Loader layer
* for validating Loader-Driver compatibility.
*/
public get ILayerCompatDetails(): ILayerCompatDetails {
return odspDriverCompatDetailsForLoader;
}

private storageManager?: OdspDocumentStorageService;

private readonly mc: MonitoringContext;
Expand Down
27 changes: 27 additions & 0 deletions packages/drivers/odsp-driver/src/odspLayerCompatState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

import { type ILayerCompatDetails } from "@fluid-internal/client-utils";

import { pkgVersion } from "./packageVersion.js";

/**
* ODSP Driver's compatibility details that is exposed to the Loader layer.
* @internal
*/
export const odspDriverCompatDetailsForLoader: ILayerCompatDetails = {
/**
* The package version of the ODSP Driver layer.
*/
pkgVersion,
/**
* The current generation of the ODSP Driver layer.
*/
generation: 1,
/**
* The features supported by the ODSP Driver layer across the Driver / Loader boundary.
*/
supportedFeatures: new Set<string>(),
};
6 changes: 5 additions & 1 deletion packages/drivers/replay-driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@
}
},
"typeValidation": {
"broken": {},
"broken": {
"Class_ReplayDocumentService": {
"forwardCompat": false
}
},
"entrypoint": "internal"
}
}
15 changes: 13 additions & 2 deletions packages/drivers/replay-driver/src/replayDocumentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Licensed under the MIT License.
*/

import { TypedEventEmitter } from "@fluid-internal/client-utils";
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
import type { FluidObject } from "@fluidframework/core-interfaces";
import { IClient } from "@fluidframework/driver-definitions";
import {
IDocumentServiceEvents,
Expand Down Expand Up @@ -41,12 +42,22 @@ export class ReplayDocumentService
await documentService.connectToDeltaStorage(),
controller,
);
return new ReplayDocumentService(controller, deltaConnection);
const maybeDriverCompatDetails = documentService as FluidObject<ILayerCompatDetails>;
return new ReplayDocumentService(
controller,
deltaConnection,
maybeDriverCompatDetails.ILayerCompatDetails,
);
}

constructor(
private readonly controller: IDocumentStorageService,
private readonly deltaStorage: IDocumentDeltaConnection,
/**
* The compatibility details of the base Driver layer that is exposed to the Loader layer
* for validating Loader-Driver compatibility.
*/
public readonly ILayerCompatDetails: ILayerCompatDetails | undefined,
) {
super();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ declare type current_as_old_for_Class_ReplayController = requireAssignableTo<Typ
* typeValidation.broken:
* "Class_ReplayDocumentService": {"forwardCompat": false}
*/
// @ts-expect-error compatibility expected to be broken
declare type old_as_current_for_Class_ReplayDocumentService = requireAssignableTo<TypeOnly<old.ReplayDocumentService>, TypeOnly<current.ReplayDocumentService>>

/*
Expand Down
11 changes: 10 additions & 1 deletion packages/drivers/routerlicious-driver/src/documentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/

import { TypedEventEmitter } from "@fluid-internal/client-utils";
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
import { assert } from "@fluidframework/core-utils/internal";
import { IClient } from "@fluidframework/driver-definitions";
import {
Expand Down Expand Up @@ -45,6 +45,7 @@ import {
TokenFetcher,
} from "./restWrapper.js";
import { RestWrapper } from "./restWrapperBase.js";
import { r11sDriverCompatDetailsForLoader } from "./routerliciousLayerCompatState.js";
import type { IGetSessionInfoResponse } from "./sessionInfoManager.js";
import { SocketIOClientStatic } from "./socketModule.js";
import { ITokenProvider } from "./tokens.js";
Expand Down Expand Up @@ -96,6 +97,14 @@ export class DocumentService
return this._policies;
}

/**
* The compatibility details of the ODSP Driver layer that is exposed to the Loader layer
* for validating Loader-Driver compatibility.
*/
public get ILayerCompatDetails(): ILayerCompatDetails {
return r11sDriverCompatDetailsForLoader;
}

public dispose() {}

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/drivers/routerlicious-driver/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ export {

// Configuration
export { IRouterliciousDriverPolicies } from "./policies.js";

// Layer Compat details
export { r11sDriverCompatDetailsForLoader } from "./routerliciousLayerCompatState.js";
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/

import { type ILayerCompatDetails } from "@fluid-internal/client-utils";

import { pkgVersion } from "./packageVersion.js";

/**
* Routerlicious Driver's compatibility details that is exposed to the Loader layer.
* @internal
*/
export const r11sDriverCompatDetailsForLoader: ILayerCompatDetails = {
/**
* The package version of the Routerlicious Driver layer.
*/
pkgVersion,
/**
* The current generation of the Routerlicious Driver layer.
*/
generation: 1,
/**
* The features supported by the Routerlicious Driver layer across the Driver / Loader boundary.
*/
supportedFeatures: new Set<string>(),
};
11 changes: 10 additions & 1 deletion packages/loader/driver-utils/src/documentServiceProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Licensed under the MIT License.
*/

import { TypedEventEmitter } from "@fluid-internal/client-utils";
import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
import type { FluidObject } from "@fluidframework/core-interfaces";
import { IClient } from "@fluidframework/driver-definitions";
import {
IDocumentDeltaConnection,
Expand All @@ -23,8 +24,16 @@ export abstract class DocumentServiceProxy
extends TypedEventEmitter<IDocumentServiceEvents>
implements IDocumentService
{
/**
* The compatibility details of the base Driver layer that is exposed to the Loader layer
* for validating Loader-Driver compatibility.
*/
public readonly ILayerCompatDetails: ILayerCompatDetails | undefined;

constructor(private readonly _service: IDocumentService) {
super();
const maybeDriverCompatDetails = _service as FluidObject<ILayerCompatDetails>;
this.ILayerCompatDetails = maybeDriverCompatDetails.ILayerCompatDetails;
}

public get service(): IDocumentService {
Expand Down
2 changes: 2 additions & 0 deletions packages/test/test-end-to-end-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@
"@fluidframework/matrix": "workspace:~",
"@fluidframework/merge-tree": "workspace:~",
"@fluidframework/odsp-doclib-utils": "workspace:~",
"@fluidframework/odsp-driver": "workspace:~",
"@fluidframework/odsp-driver-definitions": "workspace:~",
"@fluidframework/ordered-collection": "workspace:~",
"@fluidframework/register-collection": "workspace:~",
"@fluidframework/request-handler": "workspace:~",
"@fluidframework/routerlicious-driver": "workspace:~",
"@fluidframework/runtime-definitions": "workspace:~",
"@fluidframework/runtime-utils": "workspace:~",
"@fluidframework/sequence": "workspace:~",
Expand Down
Loading
Loading