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 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export type OpActionEventName = MessageType.Summarize | MessageType.SummaryAck |
export type ReadFluidDataStoreAttributes = IFluidDataStoreAttributes0 | IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;

// @alpha @legacy
export type SemanticVersion = `${bigint}.${bigint}.${bigint}` | `${bigint}.${bigint}.${bigint}-${string}`;
export type SemanticVersion = `${1 | 2}.${bigint}.${bigint}` | `${1 | 2}.${bigint}.${bigint}-${string}`;

// @alpha @legacy
export interface SubmitSummaryFailureData {
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime/container-runtime/src/compatUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export type MinimumMinorSemanticVersion = `${bigint}.${bigint}.0` | `${bigint}.0
* @alpha
*/
export type SemanticVersion =
| `${bigint}.${bigint}.${bigint}`
| `${bigint}.${bigint}.${bigint}-${string}`;
| `${1 | 2}.${bigint}.${bigint}`
| `${1 | 2}.${bigint}.${bigint}-${string}`;

/**
* Generic type for runtimeOptionsAffectingDocSchemaConfigMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ describe("compatUtils", () => {
};

const testCases: {
minVersionForCollab: SemanticVersion;
// We use string instead of SemanticVersion for `minVersionForCollab`
// so we can test versions that don't start with 1 or 2.
minVersionForCollab: string;
expectedConfig: Partial<ITestConfigMap>;
}[] = [
{
Expand Down Expand Up @@ -212,7 +214,10 @@ describe("compatUtils", () => {

for (const testCase of testCases) {
it(`returns correct configs for minVersionForCollab = "${testCase.minVersionForCollab}"`, () => {
const config = getConfigsForCompatMode(testCase.minVersionForCollab, testConfigMap);
const config = getConfigsForCompatMode(
testCase.minVersionForCollab as SemanticVersion,
testConfigMap,
);
assert.deepEqual(
config,
testCase.expectedConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import {
type UnknownContainerRuntimeMessage,
} from "../messageTypes.js";
import type { InboundMessageResult, LocalBatchMessage } from "../opLifecycle/index.js";
import { pkgVersion } from "../packageVersion.js";
import {
IPendingLocalState,
IPendingMessage,
Expand Down Expand Up @@ -3664,28 +3665,6 @@ describe("Runtime", () => {
]);
});

// These are examples of minVersionForCollab inputs that are not valid.
// minVersionForCollab should be at least 1.0.0 and less than or equal to
// the current pkgVersion.
const invalidVersions = ["0.50.0", "100.0.0"] as const;
for (const version of invalidVersions) {
it(`throws when minVersionForCollab = ${version}`, async () => {
const logger = new MockLogger();
// These are examples of minVersionForCollab versions that are not valid.
// Currently we only
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 Expand Up @@ -3936,9 +3915,10 @@ describe("Runtime", () => {
]);
});

// Skipped since 3.0.0 is not an existing FF version yet
it.skip("minVersionForCollab = 3.0.0", async () => {
const minVersionForCollab = "3.0.0";
// Note: We may need to update `expectedRuntimeOptions` for this test
// when we bump to certain versions.
it("minVersionForCollab = pkgVersion", async () => {
const minVersionForCollab = pkgVersion;
const logger = new MockLogger();
await ContainerRuntime.loadRuntime({
context: getMockContext({ logger }) as IContainerContext,
Expand All @@ -3951,7 +3931,7 @@ describe("Runtime", () => {

const expectedRuntimeOptions: IContainerRuntimeOptionsInternal = {
summaryOptions: {},
gcOptions: { enableGCSweep: true },
gcOptions: {},
loadSequenceNumberVerification: "close",
flushMode: FlushMode.TurnBased,
compressionOptions: {
Expand Down
Loading