@fluidframework/container-runtime 2.115.0 → 2.116.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +5 -3
  3. package/api-report/container-runtime.legacy.alpha.api.md +6 -4
  4. package/api-report/container-runtime.legacy.beta.api.md +30 -1
  5. package/container-runtime.test-files.tar +0 -0
  6. package/dist/channelCollection.d.ts +2 -2
  7. package/dist/channelCollection.d.ts.map +1 -1
  8. package/dist/channelCollection.js +3 -3
  9. package/dist/channelCollection.js.map +1 -1
  10. package/dist/containerCompatibility.d.ts +3 -3
  11. package/dist/containerCompatibility.d.ts.map +1 -1
  12. package/dist/containerCompatibility.js +3 -3
  13. package/dist/containerCompatibility.js.map +1 -1
  14. package/dist/containerRuntime.d.ts +40 -16
  15. package/dist/containerRuntime.d.ts.map +1 -1
  16. package/dist/containerRuntime.js +33 -10
  17. package/dist/containerRuntime.js.map +1 -1
  18. package/dist/dataStoreContext.d.ts +2 -2
  19. package/dist/dataStoreContext.d.ts.map +1 -1
  20. package/dist/dataStoreContext.js.map +1 -1
  21. package/dist/legacy.d.ts +3 -0
  22. package/dist/legacyAlpha.d.ts +3 -3
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/packageVersion.js +1 -1
  25. package/dist/packageVersion.js.map +1 -1
  26. package/dist/runtimeLayerCompatState.d.ts +1 -1
  27. package/dist/summary/documentSchema.d.ts +3 -3
  28. package/dist/summary/documentSchema.js.map +1 -1
  29. package/dist/versionMarks/versionMarkResolver.d.ts +3 -3
  30. package/dist/versionMarks/versionMarkResolver.js.map +1 -1
  31. package/lib/channelCollection.d.ts +2 -2
  32. package/lib/channelCollection.d.ts.map +1 -1
  33. package/lib/channelCollection.js +4 -4
  34. package/lib/channelCollection.js.map +1 -1
  35. package/lib/containerCompatibility.d.ts +3 -3
  36. package/lib/containerCompatibility.d.ts.map +1 -1
  37. package/lib/containerCompatibility.js +3 -3
  38. package/lib/containerCompatibility.js.map +1 -1
  39. package/lib/containerRuntime.d.ts +40 -16
  40. package/lib/containerRuntime.d.ts.map +1 -1
  41. package/lib/containerRuntime.js +33 -10
  42. package/lib/containerRuntime.js.map +1 -1
  43. package/lib/dataStoreContext.d.ts +2 -2
  44. package/lib/dataStoreContext.d.ts.map +1 -1
  45. package/lib/dataStoreContext.js.map +1 -1
  46. package/lib/legacy.d.ts +3 -0
  47. package/lib/legacyAlpha.d.ts +3 -3
  48. package/lib/packageVersion.d.ts +1 -1
  49. package/lib/packageVersion.js +1 -1
  50. package/lib/packageVersion.js.map +1 -1
  51. package/lib/runtimeLayerCompatState.d.ts +1 -1
  52. package/lib/summary/documentSchema.d.ts +3 -3
  53. package/lib/summary/documentSchema.js.map +1 -1
  54. package/lib/versionMarks/versionMarkResolver.d.ts +3 -3
  55. package/lib/versionMarks/versionMarkResolver.js.map +1 -1
  56. package/package.json +22 -22
  57. package/src/channelCollection.ts +6 -6
  58. package/src/containerCompatibility.ts +6 -6
  59. package/src/containerRuntime.ts +69 -25
  60. package/src/dataStoreContext.ts +2 -2
  61. package/src/packageVersion.ts +1 -1
  62. package/src/summary/documentSchema.ts +3 -3
  63. package/src/versionMarks/versionMarkResolver.ts +3 -3
@@ -131,7 +131,7 @@ import type {
131
131
  ISummarizerNodeWithGC,
132
132
  StageControlsInternal,
133
133
  IContainerRuntimeBaseInternal,
134
- MinimumVersionForCollab,
134
+ OldestSupportedClientVersion,
135
135
  ContainerExtensionExpectations,
136
136
  } from "@fluidframework/runtime-definitions/internal";
137
137
  import {
@@ -804,25 +804,42 @@ export interface LoadContainerRuntimeParams {
804
804
  requestHandler?: (request: IRequest, runtime: IContainerRuntime) => Promise<IResponse>;
805
805
 
806
806
  /**
807
- * Minimum version of the FF runtime that is required to collaborate on new documents.
808
- * The input should be a string that represents the minimum version of the FF runtime that should be
809
- * supported for collaboration. The format of the string must be in valid semver format.
807
+ * Oldest version of Fluid Framework client that must be able to open and process documents
808
+ * written by this container runtime.
809
+ * @remarks
810
+ * Choosing an older version may limit the features and write formats the application can use to
811
+ * those supported by that version. The value must be valid SemVer.
810
812
  *
811
813
  * The inputted version will be used to determine the default configuration for
812
814
  * {@link IContainerRuntimeOptionsInternal} to ensure compatibility with the specified version.
813
815
  *
814
816
  * @example
815
- * minVersionForCollab: "2.0.0"
817
+ * oldestSupportedClient: "2.0.0"
816
818
  *
817
819
  * @privateRemarks
818
820
  * Used to determine the default configuration for {@link IContainerRuntimeOptionsInternal} that affect the document schema.
819
821
  * For example, let's say that feature `foo` was added in 2.0 which introduces a new op type. Additionally, option `bar`
820
822
  * was added to `IContainerRuntimeOptionsInternal` in 2.0 to enable/disable `foo` since clients prior to 2.0 would not
821
- * understand the new op type. If a customer were to set minVersionForCollab to 2.0.0, then `bar` would be set to
822
- * enable `foo` by default. If a customer were to set minVersionForCollab to 1.0.0, then `bar` would be set to
823
+ * understand the new op type. If a customer were to set oldestSupportedClient to 2.0.0, then `bar` would be set to
824
+ * enable `foo` by default. If a customer were to set oldestSupportedClient to 1.0.0, then `bar` would be set to
823
825
  * disable `foo` by default.
824
826
  */
825
- minVersionForCollab?: MinimumVersionForCollab;
827
+ oldestSupportedClient?: OldestSupportedClientVersion;
828
+
829
+ /**
830
+ * Oldest version of Fluid Framework client that must be able to open and process documents
831
+ * written by this container runtime.
832
+ *
833
+ * @remarks
834
+ * See {@link LoadContainerRuntimeParams.oldestSupportedClient} for compatibility implications.
835
+ *
836
+ * Specifying both `oldestSupportedClient` and `minVersionForCollab` is an error.
837
+ *
838
+ * @deprecated 2.116.0. To be removed in 3.10.0. Use
839
+ * {@link LoadContainerRuntimeParams.oldestSupportedClient} instead.
840
+ * See {@link https://github.com/microsoft/FluidFramework/issues/27851} for context.
841
+ */
842
+ minVersionForCollab?: OldestSupportedClientVersion;
826
843
  }
827
844
  /**
828
845
  * This is meant to be used by a {@link @fluidframework/container-definitions#IRuntimeFactory} to instantiate a container runtime.
@@ -833,7 +850,10 @@ export interface LoadContainerRuntimeParams {
833
850
  export async function loadContainerRuntime(
834
851
  params: LoadContainerRuntimeParams,
835
852
  ): Promise<IContainerRuntime & IRuntime> {
836
- return ContainerRuntime.loadRuntime(params);
853
+ return ContainerRuntime.loadRuntime({
854
+ ...params,
855
+ registry: new FluidDataStoreRegistry(params.registryEntries),
856
+ });
837
857
  }
838
858
 
839
859
  /**
@@ -843,6 +863,10 @@ export async function loadContainerRuntime(
843
863
  * @param params - An object which specifies all required and optional params necessary to instantiate a runtime.
844
864
  * @returns An object containing the runtime.
845
865
  *
866
+ * @privateRemarks
867
+ * By using loadRuntime2 instead of loadRuntime, this prevents mixinAttributor's overriding of loadRuntime from affecting this new API:
868
+ * this might cause unexpected issues.
869
+ *
846
870
  * @legacy @alpha
847
871
  */
848
872
  export async function loadContainerRuntimeAlpha(params: LoadContainerRuntimeParams): Promise<{
@@ -909,6 +933,8 @@ export class ContainerRuntime
909
933
  * {@link LoadContainerRuntimeParams} except internal, while still having layer compat obligations.
910
934
  * @privateRemarks
911
935
  * Despite this being `@internal`, `@fluidframework/test-utils` uses it in `createTestContainerRuntimeFactory` and assumes multiple versions of the package expose the same API.
936
+ * To enable this code to know what version of this API it should use, loadRuntimeAPIVersion has been added.
937
+ * This is a workaround for the relevant code in test-utils not tracking the package version, so it can't special case it off of that.
912
938
  *
913
939
  * Also note that `mixinAttributor` from `@fluid-experimental/attributor` overrides this function:
914
940
  * that will have to be updated if changing the signature of this function as well.
@@ -917,21 +943,21 @@ export class ContainerRuntime
917
943
  * `loadRuntime` could be removed (replaced by `loadRuntime2` which could be renamed back to `loadRuntime`).
918
944
  */
919
945
  public static async loadRuntime(
920
- params: LoadContainerRuntimeParams & {
921
- /**
922
- * Constructor to use to create the ContainerRuntime instance.
923
- * @remarks
924
- * Defaults to {@link ContainerRuntime}.
925
- */
946
+ params: Omit<LoadContainerRuntimeParams, "registryEntries" | "runtimeOptions"> & {
947
+ registry: IFluidDataStoreRegistry;
926
948
  containerRuntimeCtor?: typeof ContainerRuntime;
949
+ runtimeOptions?: IContainerRuntimeOptionsInternal;
927
950
  },
928
951
  ): Promise<ContainerRuntime> {
929
- return ContainerRuntime.loadRuntime2({
930
- ...params,
931
- registry: new FluidDataStoreRegistry(params.registryEntries),
932
- }).then((r) => r.runtime);
952
+ return ContainerRuntime.loadRuntime2(params).then((r) => r.runtime);
933
953
  }
934
954
 
955
+ /**
956
+ * Hack to allow test-utils to detect which version of loadRuntime API to expect.
957
+ * See note in loadRuntime's private remarks.
958
+ */
959
+ public static readonly loadRuntimeAPIVersion: number | undefined = 2;
960
+
935
961
  /**
936
962
  * Load the stores from a snapshot and returns an object containing the runtime.
937
963
  * @remarks
@@ -966,9 +992,27 @@ export class ContainerRuntime
966
992
  runtimeOptions = {} satisfies IContainerRuntimeOptionsInternal,
967
993
  containerScope = {},
968
994
  containerRuntimeCtor = ContainerRuntime,
969
- minVersionForCollab = defaultMinVersionForCollab,
995
+ oldestSupportedClient: oldestSupportedClientParam,
996
+ // eslint-disable-next-line import-x/no-deprecated -- accepted for compatibility. See #27851
997
+ minVersionForCollab: deprecatedMinVersionForCollab,
970
998
  } = params;
971
999
 
1000
+ if (
1001
+ oldestSupportedClientParam !== undefined &&
1002
+ deprecatedMinVersionForCollab !== undefined
1003
+ ) {
1004
+ throw new UsageError(
1005
+ "Specify only one of oldestSupportedClient or minVersionForCollab (deprecated), not both.",
1006
+ );
1007
+ }
1008
+ // Internally this value is still threaded through as `minVersionForCollab`. Renaming the
1009
+ // Runtime/DataStore/DDS propagation path crosses API layers and requires a staged migration
1010
+ // where both names coexist for old and new consumers. See #27851.
1011
+ const minVersionForCollab =
1012
+ oldestSupportedClientParam ??
1013
+ deprecatedMinVersionForCollab ??
1014
+ defaultMinVersionForCollab;
1015
+
972
1016
  // If taggedLogger exists, use it. Otherwise, wrap the vanilla logger:
973
1017
  // back-compat: Remove the TaggedLoggerAdapter fallback once all the host are using loader > 0.45
974
1018
  const backCompatContext: IContainerContext | OldContainerContextWithLogger = context;
@@ -1655,7 +1699,7 @@ export class ContainerRuntime
1655
1699
  private readonly documentsSchemaController: DocumentsSchemaController,
1656
1700
  featureGatesForTelemetry: Record<string, boolean | number | undefined>,
1657
1701
  provideEntryPoint: (containerRuntime: IContainerRuntime) => Promise<FluidObject>,
1658
- public readonly minVersionForCollab: MinimumVersionForCollab,
1702
+ public readonly minVersionForCollab: OldestSupportedClientVersion,
1659
1703
  private readonly requestHandler?: (
1660
1704
  request: IRequest,
1661
1705
  runtime: IContainerRuntime,
@@ -2365,11 +2409,11 @@ export class ContainerRuntime
2365
2409
  // #region `IFluidParentContext` APIs that should not be called on Root
2366
2410
 
2367
2411
  public makeLocallyVisible(): void {
2368
- assert(false, 0x8eb /* should not be called */);
2412
+ fail(0x8eb /* should not be called */);
2369
2413
  }
2370
2414
 
2371
2415
  public setChannelDirty(address: string): void {
2372
- assert(false, 0x909 /* should not be called */);
2416
+ fail(0x909 /* should not be called */);
2373
2417
  }
2374
2418
 
2375
2419
  // #endregion
@@ -3655,7 +3699,7 @@ export class ContainerRuntime
3655
3699
  case ContainerMessageType.ChunkedOp: {
3656
3700
  // From observability POV, we should not expose the rest of the system (including "op" events on object) to these messages.
3657
3701
  // Also resetReconnectCount() would be wrong - see comment that was there before this change was made.
3658
- assert(false, 0x93d /* should not even get here */);
3702
+ fail(0x93d /* should not even get here */);
3659
3703
  }
3660
3704
  case ContainerMessageType.Rejoin: {
3661
3705
  break;
@@ -4469,7 +4513,7 @@ export class ContainerRuntime
4469
4513
  return this.channelCollection.getDataStorePackagePath(nodePath);
4470
4514
  }
4471
4515
  default: {
4472
- assert(false, 0x2de /* "Package path requested for unsupported node type." */);
4516
+ fail(0x2de /* "Package path requested for unsupported node type." */);
4473
4517
  }
4474
4518
  }
4475
4519
  }
@@ -67,7 +67,7 @@ import type {
67
67
  IFluidDataStoreFactory,
68
68
  PackagePath,
69
69
  IRuntimeStorageService,
70
- MinimumVersionForCollab,
70
+ OldestSupportedClientVersion,
71
71
  ContainerExtensionId,
72
72
  ContainerExtensionExpectations,
73
73
  } from "@fluidframework/runtime-definitions/internal";
@@ -355,7 +355,7 @@ export abstract class FluidDataStoreContext
355
355
  /**
356
356
  * {@inheritdoc IFluidDataStoreContext.minVersionForCollab}
357
357
  */
358
- public readonly minVersionForCollab: MinimumVersionForCollab;
358
+ public readonly minVersionForCollab: OldestSupportedClientVersion;
359
359
 
360
360
  private baseSnapshotSequenceNumber: number | undefined;
361
361
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-runtime";
9
- export const pkgVersion = "2.115.0";
9
+ export const pkgVersion = "2.116.0";
@@ -107,9 +107,9 @@ export interface IDocumentSchemaInfo {
107
107
  * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams} for additional details on `minVersionForCollab`.
108
108
  *
109
109
  * @remarks
110
- * We use `SemanticVersion` instead of `MinimumVersionForCollab` since we may open future documents with a
111
- * minVersionForCollab version that `MinimumVersionForCollab` does not support.
112
- * Note that in such a case (where minVersionForCollab is not a valid `MinimumVersionForCollab`),
110
+ * We use `SemanticVersion` instead of `OldestSupportedClientVersion` since we may open future documents with a
111
+ * minVersionForCollab version that `OldestSupportedClientVersion` does not support.
112
+ * Note that in such a case (where minVersionForCollab is not a valid `OldestSupportedClientVersion`),
113
113
  * loading the document might not work since this version of the runtime may not support it.
114
114
  */
115
115
  minVersionForCollab: SemanticVersion;
@@ -33,7 +33,7 @@ export interface IHistoricalOpReader {
33
33
  /**
34
34
  * Result of resolving a pending batchId.
35
35
  *
36
- * @legacy @alpha
36
+ * @legacy @beta
37
37
  */
38
38
  export type ResolveResult =
39
39
  | { readonly kind: "resolved"; readonly sequenceNumber: number }
@@ -46,7 +46,7 @@ export type ResolveResult =
46
46
  * work, so the mark already points at a durable sequence number. The app packs its own stored record from
47
47
  * this — the runtime does not define the stored locator shape.
48
48
  *
49
- * @legacy @alpha
49
+ * @legacy @beta
50
50
  */
51
51
  export type VersionMarkCapture =
52
52
  | {
@@ -59,7 +59,7 @@ export type VersionMarkCapture =
59
59
  /**
60
60
  * Runtime-owned resolver for app-stored version mark locators.
61
61
  *
62
- * @legacy @alpha
62
+ * @legacy @beta
63
63
  */
64
64
  export interface IVersionMarkResolver {
65
65
  /**