From 52528a00ab5ae8b4ef932ca6f75bae1fb6ad9349 Mon Sep 17 00:00:00 2001 From: brrichards Date: Mon, 11 May 2026 21:51:56 +0000 Subject: [PATCH 1/2] Promote onAssert Hook to beta --- packages/common/core-utils/api-report/core-utils.alpha.api.md | 2 +- packages/common/core-utils/api-report/core-utils.beta.api.md | 3 +++ .../common/core-utils/api-report/core-utils.legacy.beta.api.md | 3 +++ packages/common/core-utils/src/assert.ts | 2 +- .../fluid-framework/api-report/fluid-framework.alpha.api.md | 2 +- .../fluid-framework/api-report/fluid-framework.beta.api.md | 3 +++ .../api-report/fluid-framework.legacy.beta.api.md | 3 +++ packages/framework/fluid-framework/src/index.ts | 2 +- 8 files changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/common/core-utils/api-report/core-utils.alpha.api.md b/packages/common/core-utils/api-report/core-utils.alpha.api.md index 7b3510abb6cd..7dd06f087315 100644 --- a/packages/common/core-utils/api-report/core-utils.alpha.api.md +++ b/packages/common/core-utils/api-report/core-utils.alpha.api.md @@ -10,7 +10,7 @@ export function emulateProductionBuild(enable?: boolean): void; // @alpha export function nonProductionConditionalsIncluded(): boolean; -// @alpha +// @beta export function onAssertionFailure(handler: (error: Error) => void): () => void; // (No @packageDocumentation comment for this package) diff --git a/packages/common/core-utils/api-report/core-utils.beta.api.md b/packages/common/core-utils/api-report/core-utils.beta.api.md index 4023aac2b7c6..4b2dbdf98de2 100644 --- a/packages/common/core-utils/api-report/core-utils.beta.api.md +++ b/packages/common/core-utils/api-report/core-utils.beta.api.md @@ -4,6 +4,9 @@ ```ts +// @beta +export function onAssertionFailure(handler: (error: Error) => void): () => void; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/common/core-utils/api-report/core-utils.legacy.beta.api.md b/packages/common/core-utils/api-report/core-utils.legacy.beta.api.md index 0c12e3dbfa66..a126899acd07 100644 --- a/packages/common/core-utils/api-report/core-utils.legacy.beta.api.md +++ b/packages/common/core-utils/api-report/core-utils.legacy.beta.api.md @@ -32,6 +32,9 @@ export class LazyPromise implements Promise { then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null | undefined): Promise; } +// @beta +export function onAssertionFailure(handler: (error: Error) => void): () => void; + // @beta @legacy export class PromiseCache { constructor({ expiry, removeOnError, }?: PromiseCacheOptions); diff --git a/packages/common/core-utils/src/assert.ts b/packages/common/core-utils/src/assert.ts index 71dac193d721..ba0f5a206942 100644 --- a/packages/common/core-utils/src/assert.ts +++ b/packages/common/core-utils/src/assert.ts @@ -114,7 +114,7 @@ const firstChanceAssertionHandler = new Set<(error: Error) => void>(); * firstAssertion ??= error; * }); * ``` - * @alpha + * @beta */ export function onAssertionFailure(handler: (error: Error) => void): () => void { // To avoid issues if the same callback is registered twice (mainly it not triggering twice and the first unregister removing it), diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md index b64bd26ab070..8ba7c9d4b2e9 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.alpha.api.md @@ -1304,7 +1304,7 @@ export interface ObservationResults { // @public export type Off = () => void; -// @alpha +// @beta export function onAssertionFailure(handler: (error: Error) => void): () => void; // @alpha diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md index 43f8f9bf5d86..77eeb8a8cbe1 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.beta.api.md @@ -783,6 +783,9 @@ export interface ObjectSchemaOptions extends NodeSche // @public export type Off = () => void; +// @beta +export function onAssertionFailure(handler: (error: Error) => void): () => void; + // @beta @system export type PopUnion void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never; diff --git a/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md b/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md index 39a844b79a76..a4bb8e500ef6 100644 --- a/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md +++ b/packages/framework/fluid-framework/api-report/fluid-framework.legacy.beta.api.md @@ -1063,6 +1063,9 @@ export interface ObjectSchemaOptions extends NodeSche // @public export type Off = () => void; +// @beta +export function onAssertionFailure(handler: (error: Error) => void): () => void; + // @beta @system export type PopUnion void : never>> = AsOverloadedFunction extends (a: infer First) => void ? First : never; diff --git a/packages/framework/fluid-framework/src/index.ts b/packages/framework/fluid-framework/src/index.ts index b0a025fc5dbf..eee19a6e88d9 100644 --- a/packages/framework/fluid-framework/src/index.ts +++ b/packages/framework/fluid-framework/src/index.ts @@ -63,7 +63,7 @@ export type { } from "@fluidframework/core-interfaces"; export type { ErasedBaseType } from "@fluidframework/core-interfaces/internal"; -// This is an alpha API, but this package doesn't have an alpha entry point so its imported from "internal". +// This is a beta API, but core-utils doesn't have a beta entry point so its imported from "internal". export { onAssertionFailure } from "@fluidframework/core-utils/internal"; export type { isFluidHandle } from "@fluidframework/runtime-utils"; From e51e3185e56caf88a3dab07df48903b6b219deae Mon Sep 17 00:00:00 2001 From: brrichards Date: Tue, 12 May 2026 08:32:19 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: brrichards --- packages/common/core-utils/src/assert.ts | 2 +- packages/framework/fluid-framework/src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/common/core-utils/src/assert.ts b/packages/common/core-utils/src/assert.ts index ba0f5a206942..088e7db61854 100644 --- a/packages/common/core-utils/src/assert.ts +++ b/packages/common/core-utils/src/assert.ts @@ -98,7 +98,7 @@ const firstChanceAssertionHandler = new Set<(error: Error) => void>(); * This does not replace the need for error handling elsewhere since errors (even bugs in Fluid) can cause other kinds of exceptions which this cannot run the callback for. * @example * ```ts - * import { onAssertionFailure } from "fluid-framework/alpha"; + * import { onAssertionFailure } from "fluid-framework/beta"; * * let firstAssertion: Error | undefined; * diff --git a/packages/framework/fluid-framework/src/index.ts b/packages/framework/fluid-framework/src/index.ts index a29358974f22..524cbd6a3e1f 100644 --- a/packages/framework/fluid-framework/src/index.ts +++ b/packages/framework/fluid-framework/src/index.ts @@ -70,7 +70,7 @@ export type { FluidReadonlyMap, } from "@fluidframework/core-interfaces/internal"; -// This is a beta API, but core-utils doesn't have a beta entry point so its imported from "internal". +// This is a beta API, but core-utils doesn't have a beta entry point so it's imported from "internal". export { onAssertionFailure } from "@fluidframework/core-utils/internal"; export type { isFluidHandle } from "@fluidframework/runtime-utils";