From d4b4897f968571782ec5436ac2551131ff49a6a5 Mon Sep 17 00:00:00 2001 From: Kian Thompson <102998837+kian-thompson@users.noreply.github.com> Date: Tue, 7 Jan 2025 19:05:20 +0000 Subject: [PATCH] Remove SummarizerStopReason, ISummarizeEventProps, and ISummarizerEvents --- .changeset/sweet-tires-bathe.md | 10 +++ .../container-runtime.legacy.alpha.api.md | 63 +++--------------- .../runtime/container-runtime/package.json | 15 ++++- .../runtime/container-runtime/src/index.ts | 3 - .../container-runtime/src/summary/index.ts | 3 - .../src/summary/summarizerTypes.ts | 65 ++----------------- ...idateContainerRuntimePrevious.generated.ts | 6 ++ 7 files changed, 45 insertions(+), 120 deletions(-) create mode 100644 .changeset/sweet-tires-bathe.md diff --git a/.changeset/sweet-tires-bathe.md b/.changeset/sweet-tires-bathe.md new file mode 100644 index 000000000000..7210f7abec35 --- /dev/null +++ b/.changeset/sweet-tires-bathe.md @@ -0,0 +1,10 @@ +--- +"@fluidframework/container-runtime": minor +--- +--- +"section": legacy +--- + +Removed SummarizerStopReason, ISummarizeEventProps, and ISummarizerEvents + +`SummarizerStopReason`, `ISummarizeEventProps`, and `ISummarizerEvents` have all been removed from the `"@fluidframework/container-runtime"` package. Please migrate all uses of these APIs to their respective copies in the `"@fluidframework/container-runtime-definitions"` package. diff --git a/packages/runtime/container-runtime/api-report/container-runtime.legacy.alpha.api.md b/packages/runtime/container-runtime/api-report/container-runtime.legacy.alpha.api.md index 4ef75e70cce8..4ff6f1abfb21 100644 --- a/packages/runtime/container-runtime/api-report/container-runtime.legacy.alpha.api.md +++ b/packages/runtime/container-runtime/api-report/container-runtime.legacy.alpha.api.md @@ -287,7 +287,7 @@ export interface IBroadcastSummaryResult { // @alpha export interface ICancellableSummarizerController extends ISummaryCancellationToken { // (undocumented) - stop(reason: SummarizerStopReason_2): void; + stop(reason: SummarizerStopReason): void; } // @alpha @@ -540,33 +540,21 @@ export interface ISubmitSummaryOptions extends ISummarizeOptions { readonly summaryLogger: ITelemetryLoggerExt; } -// @alpha @deprecated (undocumented) -export interface ISummarizeEventProps { - // (undocumented) - currentAttempt: number; - // (undocumented) - error?: any; - // (undocumented) - maxAttempts: number; - // (undocumented) - result: "success" | "failure" | "canceled"; -} - // @alpha export interface ISummarizeOptions { readonly fullTree?: boolean; } // @alpha (undocumented) -export interface ISummarizer extends IEventProvider { +export interface ISummarizer extends IEventProvider { // (undocumented) close(): void; enqueueSummarize(options: IEnqueueSummarizeOptions): EnqueueSummarizeResult; readonly ISummarizer?: ISummarizer; // (undocumented) - run(onBehalfOf: string): Promise; + run(onBehalfOf: string): Promise; // (undocumented) - stop(reason: SummarizerStopReason_2): void; + stop(reason: SummarizerStopReason): void; summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults; } @@ -577,12 +565,6 @@ export interface ISummarizeResults { readonly summarySubmitted: Promise>; } -// @alpha @deprecated (undocumented) -export interface ISummarizerEvents extends IEvent { - // (undocumented) - (event: "summarize", listener: (props: ISummarizeEventProps) => void): any; -} - // @alpha (undocumented) export interface ISummarizerInternalsProvider { refreshLatestSummaryAck(options: IRefreshSummaryAckOptions): Promise; @@ -634,7 +616,7 @@ export interface ISummaryBaseConfiguration { } // @alpha -export type ISummaryCancellationToken = ICancellationToken; +export type ISummaryCancellationToken = ICancellationToken; // @alpha (undocumented) export interface ISummaryCollectionOpEvents extends IEvent { @@ -752,7 +734,7 @@ export interface SubmitSummaryFailureData { export type SubmitSummaryResult = IBaseSummarizeResult | IGenerateSummaryTreeResult | IUploadSummaryResult | ISubmitSummaryOpResult; // @alpha -export class Summarizer extends TypedEventEmitter implements ISummarizer { +export class Summarizer extends TypedEventEmitter implements ISummarizer { constructor( runtime: ISummarizerRuntime, configurationGetter: () => ISummaryConfiguration, internalsProvider: ISummarizerInternalsProvider, handleContext: IFluidHandleContext, summaryCollection: SummaryCollection, runCoordinatorCreateFn: (runtime: IConnectableRuntime) => Promise); @@ -766,9 +748,9 @@ export class Summarizer extends TypedEventEmitter implement // (undocumented) recordSummaryAttempt?(summaryRefSeqNum?: number): void; // (undocumented) - run(onBehalfOf: string): Promise; - stop(reason: SummarizerStopReason_2): void; - static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason_2): boolean; + run(onBehalfOf: string): Promise; + stop(reason: SummarizerStopReason): void; + static stopReasonCanRunLastSummary(stopReason: SummarizerStopReason): boolean; // (undocumented) summarizeOnDemand(options: IOnDemandSummarizeOptions): ISummarizeResults; // (undocumented) @@ -786,33 +768,6 @@ export type SummarizeResultPart = { error: IRetriableFailureError; }; -// @alpha @deprecated (undocumented) -export type SummarizerStopReason = -/** Summarizer client failed to summarize in all attempts. */ -"failToSummarize" -/** Parent client reported that it is no longer connected. */ -| "parentNotConnected" -/** -* Parent client reported that it is no longer elected the summarizer. -* This is the normal flow; a disconnect will always trigger the parent -* client to no longer be elected as responsible for summaries. Then it -* tries to stop its spawned summarizer client. -*/ -| "notElectedParent" -/** -* We are not already running the summarizer and we are not the current elected client id. -*/ -| "notElectedClient" -/** Summarizer client was disconnected */ -| "summarizerClientDisconnected" -/** running summarizer threw an exception */ -| "summarizerException" -/** -* The previous summary state on the summarizer is not the most recently acked summary. this also happens when the -* first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack -*/ -| "latestSummaryStateStale"; - // @alpha export class SummaryCollection extends TypedEventEmitter { constructor(deltaManager: IDeltaManager, logger: ITelemetryLoggerExt); diff --git a/packages/runtime/container-runtime/package.json b/packages/runtime/container-runtime/package.json index bd5a46090580..b586f553cecb 100644 --- a/packages/runtime/container-runtime/package.json +++ b/packages/runtime/container-runtime/package.json @@ -231,7 +231,20 @@ "typescript": "~5.4.5" }, "typeValidation": { - "broken": {}, + "broken": { + "TypeAlias_SummarizerStopReason": { + "backCompat": false, + "forwardCompat": false + }, + "Interface_ISummarizeEventProps": { + "backCompat": false, + "forwardCompat": false + }, + "Interface_ISummarizerEvents": { + "backCompat": false, + "forwardCompat": false + } + }, "entrypoint": "legacy" } } diff --git a/packages/runtime/container-runtime/src/index.ts b/packages/runtime/container-runtime/src/index.ts index c3e979d53a11..6cb1c022215b 100644 --- a/packages/runtime/container-runtime/src/index.ts +++ b/packages/runtime/container-runtime/src/index.ts @@ -55,7 +55,6 @@ export { ISummaryCancellationToken, neverCancelledSummaryToken, Summarizer, - SummarizerStopReason, SummaryCollection, EnqueueSummarizeResult, IAckSummaryResult, @@ -75,7 +74,6 @@ export { ISubmitSummaryOptions, ISerializedElection, ISummarizeOptions, - ISummarizerEvents, ISummarizerInternalsProvider, ISummarizerRuntime, ISummarizingWarning, @@ -95,7 +93,6 @@ export { SubmitSummaryFailureData, SummaryStage, IRetriableFailureError, - ISummarizeEventProps, IdCompressorMode, IDocumentSchema, DocumentSchemaValueType, diff --git a/packages/runtime/container-runtime/src/summary/index.ts b/packages/runtime/container-runtime/src/summary/index.ts index a7f77aed7039..4310aa13f131 100644 --- a/packages/runtime/container-runtime/src/summary/index.ts +++ b/packages/runtime/container-runtime/src/summary/index.ts @@ -44,12 +44,10 @@ export { ISummarizeHeuristicData, ISummarizer, ISummarizeResults, - ISummarizerEvents, ISummarizerInternalsProvider, ISummarizerRuntime, ISummaryCancellationToken, SubmitSummaryResult, - SummarizerStopReason, EnqueueSummarizeResult, IAckSummaryResult, IBaseSummarizeResult, @@ -67,7 +65,6 @@ export { SubmitSummaryFailureData, SummaryStage, IRetriableFailureError, - ISummarizeEventProps, } from "./summarizerTypes.js"; export { IAckedSummary, diff --git a/packages/runtime/container-runtime/src/summary/summarizerTypes.ts b/packages/runtime/container-runtime/src/summary/summarizerTypes.ts index 8a0d0f68cc54..a41755823461 100644 --- a/packages/runtime/container-runtime/src/summary/summarizerTypes.ts +++ b/packages/runtime/container-runtime/src/summary/summarizerTypes.ts @@ -8,11 +8,10 @@ import { ContainerWarning, } from "@fluidframework/container-definitions/internal"; import type { - ISummarizerEvents as NewISummarizerEvents, - SummarizerStopReason as NewSummarizerStopReason, + ISummarizerEvents, + SummarizerStopReason, } from "@fluidframework/container-runtime-definitions/internal"; import { - IEvent, IEventProvider, ITelemetryBaseProperties, ITelemetryBaseLogger, @@ -58,7 +57,7 @@ export interface ICancellationToken { * @legacy * @alpha */ -export type ISummaryCancellationToken = ICancellationToken; +export type ISummaryCancellationToken = ICancellationToken; /** * Data required to update internal tracking state after receiving a Summary Ack. @@ -401,60 +400,8 @@ export type EnqueueSummarizeResult = /** * @legacy * @alpha - * @deprecated Use SummarizerStopReason from the "\@fluidframework/container-runtime-definitions" package */ -export type SummarizerStopReason = - /** Summarizer client failed to summarize in all attempts. */ - | "failToSummarize" - /** Parent client reported that it is no longer connected. */ - | "parentNotConnected" - /** - * Parent client reported that it is no longer elected the summarizer. - * This is the normal flow; a disconnect will always trigger the parent - * client to no longer be elected as responsible for summaries. Then it - * tries to stop its spawned summarizer client. - */ - | "notElectedParent" - /** - * We are not already running the summarizer and we are not the current elected client id. - */ - | "notElectedClient" - /** Summarizer client was disconnected */ - | "summarizerClientDisconnected" - /** running summarizer threw an exception */ - | "summarizerException" - /** - * The previous summary state on the summarizer is not the most recently acked summary. this also happens when the - * first submitSummary attempt fails for any reason and there's a 2nd summary attempt without an ack - */ - | "latestSummaryStateStale"; - -/** - * @legacy - * @alpha - * @deprecated Use ISummarizeEventProps from the "\@fluidframework/container-runtime-definitions" package - */ -export interface ISummarizeEventProps { - result: "success" | "failure" | "canceled"; - currentAttempt: number; - maxAttempts: number; - error?: any; -} - -/** - * @legacy - * @alpha - * @deprecated Use ISummarizerEvents from the "\@fluidframework/container-runtime-definitions" package - */ -export interface ISummarizerEvents extends IEvent { - (event: "summarize", listener: (props: ISummarizeEventProps) => void); -} - -/** - * @legacy - * @alpha - */ -export interface ISummarizer extends IEventProvider { +export interface ISummarizer extends IEventProvider { /** * Allows {@link ISummarizer} to be used with our {@link @fluidframework/core-interfaces#FluidObject} pattern. */ @@ -465,12 +412,12 @@ export interface ISummarizer extends IEventProvider { * Summarizer will finish current processes, which may take a while. * For example, summarizer may complete last summary before exiting. */ - stop(reason: NewSummarizerStopReason): void; + stop(reason: SummarizerStopReason): void; /* Closes summarizer. Any pending processes (summary in flight) are abandoned. */ close(): void; - run(onBehalfOf: string): Promise; + run(onBehalfOf: string): Promise; /** * Attempts to generate a summary on demand. If already running, takes no action. diff --git a/packages/runtime/container-runtime/src/test/types/validateContainerRuntimePrevious.generated.ts b/packages/runtime/container-runtime/src/test/types/validateContainerRuntimePrevious.generated.ts index 2dbf49f28ded..9248d6224f44 100644 --- a/packages/runtime/container-runtime/src/test/types/validateContainerRuntimePrevious.generated.ts +++ b/packages/runtime/container-runtime/src/test/types/validateContainerRuntimePrevious.generated.ts @@ -742,6 +742,7 @@ declare type current_as_old_for_Interface_ISubmitSummaryOptions = requireAssigna * typeValidation.broken: * "Interface_ISummarizeEventProps": {"forwardCompat": false} */ +// @ts-expect-error compatibility expected to be broken declare type old_as_current_for_Interface_ISummarizeEventProps = requireAssignableTo, TypeOnly> /* @@ -751,6 +752,7 @@ declare type old_as_current_for_Interface_ISummarizeEventProps = requireAssignab * typeValidation.broken: * "Interface_ISummarizeEventProps": {"backCompat": false} */ +// @ts-expect-error compatibility expected to be broken declare type current_as_old_for_Interface_ISummarizeEventProps = requireAssignableTo, TypeOnly> /* @@ -814,6 +816,7 @@ declare type current_as_old_for_Interface_ISummarizeResults = requireAssignableT * typeValidation.broken: * "Interface_ISummarizerEvents": {"forwardCompat": false} */ +// @ts-expect-error compatibility expected to be broken declare type old_as_current_for_Interface_ISummarizerEvents = requireAssignableTo, TypeOnly> /* @@ -823,6 +826,7 @@ declare type old_as_current_for_Interface_ISummarizerEvents = requireAssignableT * typeValidation.broken: * "Interface_ISummarizerEvents": {"backCompat": false} */ +// @ts-expect-error compatibility expected to be broken declare type current_as_old_for_Interface_ISummarizerEvents = requireAssignableTo, TypeOnly> /* @@ -1426,6 +1430,7 @@ declare type current_as_old_for_TypeAlias_SummarizeResultPart = requireAssignabl * typeValidation.broken: * "TypeAlias_SummarizerStopReason": {"forwardCompat": false} */ +// @ts-expect-error compatibility expected to be broken declare type old_as_current_for_TypeAlias_SummarizerStopReason = requireAssignableTo, TypeOnly> /* @@ -1435,6 +1440,7 @@ declare type old_as_current_for_TypeAlias_SummarizerStopReason = requireAssignab * typeValidation.broken: * "TypeAlias_SummarizerStopReason": {"backCompat": false} */ +// @ts-expect-error compatibility expected to be broken declare type current_as_old_for_TypeAlias_SummarizerStopReason = requireAssignableTo, TypeOnly> /*