Skip to content

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

scottn12
Copy link
Contributor

@scottn12 scottn12 commented Jun 16, 2025

Description

This PR is a follow-up to outstanding requests/improvements for newly introduced features related to minVersionForCollab.

This PR updates:

  • Test names to clarify scenarios
  • ConfigMap type to simplify logic in determining default configurations. The new structure of runtimeOptionsAffectingDocSchemaConfigMap aligns with the structure of runtimeOptionsAffectingDocSchemaConfigValidationMap.

See the following PRs for additional context: #24625, #24379

AB#42063

@github-actions github-actions bot added area: runtime Runtime related issues base: main PRs targeted against main branch and removed area: runtime Runtime related issues labels Jun 16, 2025
@scottn12 scottn12 changed the title improvement(container-runtime): Improvements to minVersionForColab improvement(container-runtime): Improvements to minVersionForColab features Jun 16, 2025
@github-actions github-actions bot added the area: runtime Runtime related issues label Jun 16, 2025
@scottn12 scottn12 marked this pull request as ready for review June 16, 2025 15:17
@scottn12 scottn12 requested review from Copilot and jason-ha June 16, 2025 15:17
Copy link
Contributor

@Copilot Copilot AI left a 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],
	]),

Copy link
Contributor

@jason-ha jason-ha left a 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.

Comment on lines +223 to 228
for (const [key, value] of Object.entries(configMap[version]) as [
keyof T,
T[keyof T],
][]) {
defaultConfigs[key] = value;
}
Copy link
Contributor

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;
}
}
Copy link
Contributor

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.

Comment on lines -139 to -161
// 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+.
Copy link
Contributor

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: runtime Runtime related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants