Skip to content

container-runtime: Add API for default configuration #24422

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 32 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9741b43
rename compatVersion, add optional param
scottn12 Apr 22, 2025
0a00f9a
Update packages/runtime/container-runtime/src/containerRuntime.ts
scottn12 Apr 24, 2025
f5ca37e
Merge branch 'main' into defaultConfigsAPI
scottn12 Apr 24, 2025
90cf8c5
PR feedback
scottn12 Apr 24, 2025
b3fc9b3
Update packages/runtime/container-runtime/src/containerRuntime.ts
scottn12 Apr 24, 2025
84b1168
rename isValidMinVersionForCollab
scottn12 Apr 24, 2025
6aee854
update BaseContainerRuntimeFactory
scottn12 Apr 24, 2025
811f853
Merge branch 'main' into defaultConfigsAPI
scottn12 Apr 24, 2025
41b7e4f
update comments
scottn12 Apr 24, 2025
8d20d4c
fix defaultMinVersionForCollab name
scottn12 Apr 24, 2025
8323a4a
add comment
scottn12 Apr 24, 2025
2211e2d
Merge branch 'main' into defaultConfigsAPI
scottn12 Apr 28, 2025
5ee0550
pr feedback
scottn12 Apr 29, 2025
e25f7e5
Merge branch 'main' into defaultConfigsAPI
scottn12 Apr 29, 2025
7c37c57
Merge branch 'main' into defaultConfigsAPI
scottn12 Apr 30, 2025
2e1086d
Update packages/framework/fluid-static/src/compatibilityConfiguration.ts
scottn12 May 1, 2025
c3ee030
update comment
scottn12 May 1, 2025
2d9df35
Merge branch 'main' into defaultConfigsAPI
scottn12 May 1, 2025
2caeab3
Merge branch 'main' into defaultConfigsAPI
scottn12 May 2, 2025
07d86ef
fix naming
scottn12 May 2, 2025
81c8e8e
pr feedback
scottn12 May 5, 2025
860c991
Merge branch 'main' into defaultConfigsAPI
scottn12 May 5, 2025
7690d0c
pr feedback
scottn12 May 5, 2025
9652cd3
remove todo
scottn12 May 5, 2025
a2a8080
remove accidental leftover comment
scottn12 May 6, 2025
20b6844
Merge branch 'main' into defaultConfigsAPI
scottn12 May 6, 2025
c290f1e
change SemanticVersion type
scottn12 May 6, 2025
7f8aff6
Merge branch 'main' into defaultConfigsAPI
scottn12 May 6, 2025
5791f81
PR feedback - add back in removed tests, cleanup testing types
scottn12 May 6, 2025
dd81726
swap names for MinimumVersionForCollab/SemanticVersion
scottn12 May 6, 2025
ec34789
revert api file, fix format
scottn12 May 6, 2025
82b8c55
pr feedback
scottn12 May 6, 2025
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: 0 additions & 2 deletions packages/runtime/container-runtime/src/compatUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,7 @@ export function getConfigsForCompatMode<T extends Record<SemanticVersion, unknow
*/
export function isValidMinVersionForCollab(minVersionForCollab: SemanticVersion): boolean {
return (
minVersionForCollab !== undefined &&
valid(minVersionForCollab) !== null &&
// Note: We use semverGte/semverLte instead of a semver range because semver ranges don't include pre-releases.
gte(minVersionForCollab, lowestMinVersionForCollab) &&
lte(minVersionForCollab, pkgVersion)
);
Expand Down
5 changes: 3 additions & 2 deletions packages/runtime/container-runtime/src/containerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,9 @@ export class ContainerRuntime
const defaultsAffectingDocSchema = getMinVersionForCollabDefaults(minVersionForCollab);

// The following are the default values for the options that do not affect the DocumentSchema.
const defaultsNotAffectingDocSchema: Required<
Omit<IContainerRuntimeOptionsInternal, keyof RuntimeOptionsAffectingDocSchema>
const defaultsNotAffectingDocSchema: Omit<
ContainerRuntimeOptionsInternal,
keyof RuntimeOptionsAffectingDocSchema
> = {
summaryOptions: {},
loadSequenceNumberVerification: "close",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
import { SinonFakeTimers, createSandbox, useFakeTimers } from "sinon";

import { ChannelCollection } from "../channelCollection.js";
import type { SemanticVersion } from "../compatUtils.js";
import { CompressionAlgorithms } from "../compressionDefinitions.js";
import {
ContainerRuntime,
Expand Down Expand Up @@ -3664,6 +3665,23 @@ describe("Runtime", () => {
]);
});

it("throws when minVersionForCollab is not valid", async () => {
const logger = new MockLogger();
const invalidVersions: SemanticVersion[] = ["0.50.0", "100.0.0"];
for (const version of invalidVersions) {
await assert.rejects(async () => {
await ContainerRuntime.loadRuntime({
context: getMockContext({ logger }) as IContainerContext,
registryEntries: [],
existing: false,
runtimeOptions: {},
provideEntryPoint: mockProvideEntryPoint,
minVersionForCollab: version,
});
});
}
});

it("minVersionForCollab = 1.0.0", async () => {
const minVersionForCollab = "1.0.0";
const logger = new MockLogger();
Expand Down
Loading