You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
container-runtime: Add API for default configuration (#24422)
## Description
This PR adds an API that allows customers to set leverage the default
configuration logic added in
#24379. The API is an
**optional** property added to the `LoadContainerRuntimeParams`
interface, which is used when instantiating a container runtime.
This PR also renames the API from `compatibilityVersion` ->
`minVersionForCollab` (it was changed from `compatibilityMode` ->
`compatibilityVersion` in
#24407).
### Considerations
The API was added to `LoadContainerRuntimeParams` for two reasons:
1. Allow us to give clear guidance to customers. For example, "Pass in
`minVersionForCollab` X to ensure collaboration works with clients
running runtime version X.
2. It provides a simple path to requiring customers to pass in a
`minVersionForCollab` in the future (by making the param required).
One alternative is to expose a helper function that will generate the
`runtimeOptions` object that is used when instantiating a container
runtime. However, this may complicate the guidance given to customers
and does not provide a clear path to making this a required step in the
future.
## Example
A customer may use the API like so:
```ts
const containerRuntime = await ContainerRuntime.loadRuntime({
context,
registryEntries,
existing,
provideEntryPoint,
runtimeOptions: {
enableGroupedBatching: false,
},
minVersionForCollab: "2.20.0",
});
```
There are two noteworthy observations:
1. `minVersionForCollab` is set to `"2.20.0"`. This will ensure the
default configurations for `IContainerRuntimeOptionsInternal` are set
such that we will ensure that clients running version 2.20.0 or later of
the runtime can collaborate.
5. We also manually set `enableGroupedBatching` in the `runtimeOptions`
param. Batching is normally enabled by default when
`minVersionForCollab` is set to `"2.0.0"` or later, but any
configurations manually set in `runtimeOptions` will override the
default configurations.
## Next Steps
- Add "fail fast" mechanism that prevents explicity setting
`runtimeOptions` in such a way that contradicts `minVersionForCollab`.
For example, setting `enableGroupedBatching` to be `true` and
`minVersionForCollab` to `"1.4.0"`. This should not be allowed since
clients running v1.4.0 of the runtime will not be able to collaborate if
batching is enabled. See
[AB#37810](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/37810)
## Misc
[AB#36088](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/36088)
---------
Co-authored-by: Joshua Smithrud <[email protected]>
Co-authored-by: Abram Sanderson <[email protected]>
* String in a valid semver format of a specific version at least specifying minor.
55
+
*
56
+
* @legacy
57
+
* @alpha
58
+
*/
59
+
exporttypeMinimumVersionForCollab=
60
+
| `${1|2}.${bigint}.${bigint}`
61
+
| `${1|2}.${bigint}.${bigint}-${string}`;
62
+
63
+
/**
64
+
* String in a valid semver format of a specific version at least specifying minor.
65
+
* Unlike {@link MinimumVersionForCollab}, this type allows any bigint for the major version.
66
+
* Used as a more generic type that allows major versions other than 1 or 2.
46
67
*/
47
68
exporttypeSemanticVersion=
48
69
| `${bigint}.${bigint}.${bigint}`
@@ -84,13 +105,13 @@ export type RuntimeOptionsAffectingDocSchema = Omit<
84
105
/**
85
106
* Mapping of RuntimeOptionsAffectingDocSchema to their compatibility related configs.
86
107
*
87
-
* Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps SemanticVersions
88
-
* to the appropriate default value for that property to supporting that SemanticVersion. If clients running SemanticVersion X are able to understand
89
-
* the format changes introduced by the property, then the default value for that SemanticVersion will enable the feature associated with the property.
108
+
* Each key in this map corresponds to a property in RuntimeOptionsAffectingDocSchema. The value is an object that maps MinimumVersionForCollab
109
+
* to the appropriate default value for that property to supporting that MinimumVersionForCollab. If clients running MinimumVersionForCollab X are able to understand
110
+
* the format changes introduced by the property, then the default value for that MinimumVersionForCollab will enable the feature associated with the property.
90
111
* Otherwise, the feature will be disabled.
91
112
*
92
-
* For example if the compatibilityVersion is a 1.x version (i.e. "1.5.0"), then the default value for `enableGroupedBatching` will be false since 1.x
93
-
* clients do not understand the document format when batching is enabled. If the compatibilityVersion is a 2.x client (i.e. "2.0.0" or later), then the
113
+
* For example if the minVersionForCollab is a 1.x version (i.e. "1.5.0"), then the default value for `enableGroupedBatching` will be false since 1.x
114
+
* clients do not understand the document format when batching is enabled. If the minVersionForCollab is a 2.x client (i.e. "2.0.0" or later), then the
94
115
* default value for `enableGroupedBatching` will be true because clients running 2.0 or later will be able to understand the format changes associated
// If the compatibility mode is less than the version, we break out of the loop since we don't need to check
207
+
// If the minVersionForCollab is less than the version, we break out of the loop since we don't need to check
187
208
// any later versions.
188
209
break;
189
210
}
@@ -193,13 +214,15 @@ export function getConfigsForCompatMode<T extends Record<SemanticVersion, unknow
193
214
}
194
215
195
216
/**
196
-
* Checks if the compatibility version is valid.
197
-
* A valid compatibility version is a string that is a valid semver version and is less than or equal to the current package version.
217
+
* Checks if the minVersionForCollab is valid.
218
+
* A valid minVersionForCollab is a MinimumVersionForCollab that is at least `lowestMinVersionForCollab` and less than or equal to the current package version.
0 commit comments