-
Notifications
You must be signed in to change notification settings - Fork 554
improvement(container-runtime): Improvements to minVersionForColab features #24852
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the handling and testing of runtime options related to minVersionForCollab by updating test case descriptions and refactoring configuration mappings to use a functional approach for default values.
- Updated test descriptions in containerRuntime.spec.ts for clearer scenario narratives.
- Modified compatibility utilities in compatUtils.ts and compatUtils.spec.ts to leverage minVersionForCollabToConfigValue for mapping defaults.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
packages/runtime/container-runtime/src/test/containerRuntime.spec.ts | Updated test names and comments to clarify runtime option expectations. |
packages/runtime/container-runtime/src/test/compatUtils.spec.ts | Refactored test config maps to use minVersionForCollabToConfigValue. |
packages/runtime/container-runtime/src/compatUtils.ts | Converted config mappings to functional mappings using minVersionForCollabToConfigValue. |
Comments suppressed due to low confidence (1)
packages/runtime/container-runtime/src/compatUtils.ts:144
- The explicitSchemaControl mapping now returns undefined instead of a boolean value. This conflicts with tests (which expect explicitSchemaControl to be true for certain versions) and the intended behavior described in the comments. Please update the mapping to provide the correct default value (e.g. false for lower versions and true for newer ones).
explicitSchemaControl: minVersionForCollabToConfigValue([
["1.0.0", undefined],
]),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't make it through the test changes yet, but wanted to post this much.
for (const [key, value] of Object.entries(configMap[version]) as [ | ||
keyof T, | ||
T[keyof T], | ||
][]) { | ||
defaultConfigs[key] = value; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this defaultConfigs = { ...defaultConfigs, ...configMap[version] };
?
keyof T, | ||
T[keyof T], | ||
][]) { | ||
defaultConfigs[key] = value; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { break; }
since once exceeded no need to process more, right?
I guess a tidy way to write would be if (lt(minVersionForCollab, version)) { break; }
followed by the gte
merge logic.
// For IdCompressorMode, `undefined` represents a logical state (off). | ||
// However, to satisfy the Required<> constraint while | ||
// `exactOptionalPropertyTypes` is `false` (TODO: AB#8215), we need | ||
// to have it defined, so we trick the type checker here. | ||
"1.0.0": undefined, | ||
// We do not yet want to enable idCompressor by default since it will | ||
// increase bundle sizes, and not all customers will benefit from it. | ||
// Therefore, we will require customers to explicitly enable it. We | ||
// are keeping it as a DocSchema affecting option for now as this may | ||
// change in the future. | ||
}, | ||
explicitSchemaControl: { | ||
"1.0.0": false, | ||
// This option's intention is to prevent 1.x clients from joining sessions | ||
// when enabled. This is set to true when the minVersionForCollab is set | ||
// to >=2.0.0 (explicitly). This is different than other 2.0 defaults | ||
// because it was not enabled by default prior to the implementation of | ||
// `minVersionForCollab`. | ||
// `defaultMinVersionForCollab` is set to "2.0.0-defaults" which "2.0.0" | ||
// does not satisfy to avoiding enabling this option by default as of | ||
// `minVersionForCollab` introduction, which could be unexpected. | ||
// Only enable as a default when `minVersionForCollab` is specified at | ||
// 2.0.0+. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want to keep any of these comments? I feel like some still apply... or the code would be different like for enableRuntimeIdCompressor
. (There is not more Required
, right? So, could be left out.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now with test comments - overall looks pretty good to me.
featureC: "c1", | ||
featureD: "d1", | ||
featureE: "e1", | ||
featureF: "f1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not leave featureF be undefined
at 1.0.0? (define as string | undefined
) Or is there never going to be a need to support that?
// Note: We may need to update `expectedRuntimeOptions` for this test | ||
// when we bump to certain versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really when we bump certain versions, but when we change the config, right?
Expectation should be the latest of all, right? If so, a better way to describe the tests than "correct runtime options" is available. :) (I don't like it ("correct") for the others but am not thinking of something really better - it is kind of like you want to have a table that says 2.20 defaults are X (stored here in test) and test is 2.20 options are selected when minVer is 2.20. Then that table is the explicit specification and the product has an encoding with logic to get there cheaply / maintainably. Anyway...)
Might want to add a mention in the product that these tests should be updated when config is changed.
This PR has been automatically marked as stale because it has had no activity for 60 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework! |
Description
This PR is a follow-up to outstanding requests/improvements for newly introduced features related to
minVersionForCollab
.This PR updates:
ConfigMap
type to simplify logic in determining default configurations. The new structure ofruntimeOptionsAffectingDocSchemaConfigMap
aligns with the structure ofruntimeOptionsAffectingDocSchemaConfigValidationMap
.See the following PRs for additional context: #24625, #24379
AB#42063