Skip to content

improvement(client-runtime): type createBlobPayloadPending as true | undefined #24466

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 1 commit into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -36,7 +36,7 @@ export enum ContainerMessageType {
export interface ContainerRuntimeOptions {
readonly chunkSizeInBytes: number;
readonly compressionOptions: ICompressionRuntimeOptions;
readonly createBlobPayloadPending: boolean;
readonly createBlobPayloadPending: true | undefined;
// @deprecated
readonly enableGroupedBatching: boolean;
readonly enableRuntimeIdCompressor: IdCompressorMode;
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 @@ -150,8 +150,8 @@ const runtimeOptionsAffectingDocSchemaConfigMap = {
createBlobPayloadPending: {
// This feature is new and disabled by default. In the future we will enable it by default, but we have not
// closed on the version where that will happen yet. Probably a .10 release since blob functionality is not
// exposed on the public API surface.
"1.0.0": false,
// exposed on the `@public` API surface.
"1.0.0": undefined,
} as const,
} as const satisfies ConfigMap<RuntimeOptionsAffectingDocSchema>;

Expand Down
6 changes: 3 additions & 3 deletions packages/runtime/container-runtime/src/containerRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,10 @@ export interface ContainerRuntimeOptions {
readonly explicitSchemaControl: boolean;

/**
* Create blob handles with pending payloads when calling createBlob (default is false).
* When enabled, createBlob will return a handle before the blob upload completes.
* Create blob handles with pending payloads when calling createBlob (default is `undefined` (disabled)).
* When enabled (`true`), createBlob will return a handle before the blob upload completes.
*/
readonly createBlobPayloadPending: boolean;
readonly createBlobPayloadPending: true | undefined;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface IDocumentSchemaFeatures {
compressionLz4: boolean;
idCompressorMode: IdCompressorMode;
opGroupingEnabled: boolean;
createBlobPayloadPending: boolean;
createBlobPayloadPending: true | undefined;

/**
* List of disallowed versions of the runtime.
Expand Down Expand Up @@ -484,7 +484,7 @@ export class DocumentsSchemaController {
compressionLz4: boolToProp(features.compressionLz4),
idCompressorMode: features.idCompressorMode,
opGroupingEnabled: boolToProp(features.opGroupingEnabled),
createBlobPayloadPending: boolToProp(features.createBlobPayloadPending),
createBlobPayloadPending: features.createBlobPayloadPending,
disallowedVersions: arrayToProp(features.disallowedVersions),
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import {
IPendingRuntimeState,
defaultPendingOpsWaitTimeoutMs,
getSingleUseLegacyLogCallback,
type ContainerRuntimeOptionsInternal,
type IContainerRuntimeOptionsInternal,
} from "../containerRuntime.js";
import {
Expand Down Expand Up @@ -1565,17 +1566,17 @@ describe("Runtime", () => {
mockLogger = new MockLogger();
});

const runtimeOptions: IContainerRuntimeOptionsInternal = {
const runtimeOptions = {
compressionOptions: {
minimumBatchSizeInBytes: 1024 * 1024,
compressionAlgorithm: CompressionAlgorithms.lz4,
},
chunkSizeInBytes: 800 * 1024,
flushMode: FlushModeExperimental.Async as unknown as FlushMode,
enableGroupedBatching: true,
};
} as const satisfies IContainerRuntimeOptionsInternal;

const defaultRuntimeOptions: IContainerRuntimeOptionsInternal = {
const defaultRuntimeOptions = {
summaryOptions: {},
gcOptions: {},
loadSequenceNumberVerification: "close",
Expand All @@ -1589,8 +1590,8 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: true, // Redundant, but makes the JSON.stringify yield the same result as the logs
explicitSchemaControl: false,
createBlobPayloadPending: false, // Redundant, but makes the JSON.stringify yield the same result as the logs
};
createBlobPayloadPending: undefined,
} as const satisfies ContainerRuntimeOptionsInternal;
const mergedRuntimeOptions = { ...defaultRuntimeOptions, ...runtimeOptions };

it("Container load stats", async () => {
Expand Down Expand Up @@ -3654,7 +3655,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: true,
explicitSchemaControl: false,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3692,7 +3692,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: false,
explicitSchemaControl: false,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3730,7 +3729,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: true,
explicitSchemaControl: false,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3768,7 +3766,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: true,
explicitSchemaControl: true,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3806,7 +3803,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: true,
explicitSchemaControl: true,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3834,7 +3830,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: "on",
enableGroupedBatching: false, // By turning off batching, we will also disable compression automatically
explicitSchemaControl: true,
createBlobPayloadPending: false,
},
provideEntryPoint: mockProvideEntryPoint,
});
Expand All @@ -3853,7 +3848,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: "on",
enableGroupedBatching: false,
explicitSchemaControl: true,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3912,7 +3906,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined, // idCompressor is undefined, since that represents a logical state (off)
enableGroupedBatching: true,
explicitSchemaControl: false,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down Expand Up @@ -3949,7 +3942,6 @@ describe("Runtime", () => {
enableRuntimeIdCompressor: undefined,
enableGroupedBatching: true,
explicitSchemaControl: true,
createBlobPayloadPending: false,
};

logger.assertMatchAny([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type IDocumentSchemaFeatures,
} from "../summary/index.js";

function boolToProp(b: boolean) {
function boolToProp(b: boolean | undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you removed the use of boolToProp below but also modified its params here - are both intended or should it just be one or the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No call is the most correct, but it doesn't matter for test code. I changed this because it can handle undefined and if used when not needed -- okay.
I did not change the production version of boolToProp as in production the call would be a waste.

return b ? true : undefined;
}

Expand All @@ -33,14 +33,14 @@ describe("Runtime", () => {
},
};

const features: IDocumentSchemaFeatures = {
const features = {
explicitSchemaControl: true,
compressionLz4: true,
opGroupingEnabled: false,
idCompressorMode: "delayed",
createBlobPayloadPending: false,
createBlobPayloadPending: undefined,
disallowedVersions: [],
};
} as const satisfies IDocumentSchemaFeatures;

function createController(config: unknown) {
return new DocumentsSchemaController(
Expand Down Expand Up @@ -303,7 +303,7 @@ describe("Runtime", () => {
compressionLz4: boolToProp(featuresModified.compressionLz4),
idCompressorMode: featuresModified.idCompressorMode,
opGroupingEnabled: boolToProp(featuresModified.opGroupingEnabled),
createBlobPayloadPending: boolToProp(featuresModified.createBlobPayloadPending),
createBlobPayloadPending: featuresModified.createBlobPayloadPending,
disallowedVersions: arrayToProp(featuresModified.disallowedVersions),
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/test/test-service-load/src/optionsMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function generateRuntimeOptions(
chunkSizeInBytes: [204800],
enableRuntimeIdCompressor: ["on", undefined, "delayed"],
enableGroupedBatching: [true, false],
createBlobPayloadPending: [true, false],
createBlobPayloadPending: [true, undefined],
explicitSchemaControl: [true, false],
};

Expand Down
Loading