(compat) Add new interface for layer incompatibility to make it simpler for consumption#25706
Conversation
There was a problem hiding this comment.
Pull Request Overview
Updates layer compatibility validation to produce more user-friendly errors and richer telemetry.
- Introduces validateLayerCompatibility helper that centralizes logic, adds structured core properties (layer, incompatibleLayer, versions, diff) and detailed JSON errorDetails.
- Exposes versions directly on telemetry properties and adds new telemetry event LayerIncompatibilityError.
- Updates tests and layer type definitions (introducing FluidLayer union with lowercase layer identifiers).
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/utils/telemetry-utils/src/layerCompatError.ts | Adds shared validation helper that throws UsageError, logs telemetry, and computes diff plus property sets. |
| packages/utils/telemetry-utils/src/index.ts | Re-exports new validateLayerCompatibility API. |
| packages/runtime/datastore/src/test/dataStoreLayerCompatValidation.spec.ts | Adjusts tests to new telemetry property names and casing. |
| packages/runtime/datastore/src/dataStoreRuntime.ts | Moves runtime compatibility validation after logger setup, passes logger. |
| packages/runtime/datastore/src/dataStoreLayerCompatState.ts | Refactors to use centralized helper with lowercase layer identifiers. |
| packages/runtime/container-runtime/src/test/runtimeLayerCompatValidation.spec.ts | Updates tests to new property names/casing and passes logger. |
| packages/runtime/container-runtime/src/runtimeLayerCompatState.ts | Refactors validation functions to use helper and require logger. |
| packages/runtime/container-runtime/src/dataStoreContext.ts | Passes logger into validation call. |
| packages/runtime/container-runtime/src/containerRuntime.ts | Defers loader compatibility check until logger is available. |
| packages/loader/container-loader/src/test/loaderLayerCompatValidation.spec.ts | Updates tests to new property names/casing and logger usage. |
| packages/loader/container-loader/src/loaderLayerCompatState.ts | Refactors runtime/driver validation to use helper; adds logger parameter. |
| packages/loader/container-loader/src/container.ts | Passes logger into validation calls. |
| packages/common/client-utils/src/layerCompat.ts | Introduces FluidLayer type with lowercase identifiers. |
| packages/common/client-utils/src/indexNode.ts | Exports FluidLayer type. |
| packages/common/client-utils/src/indexBrowser.ts | Exports FluidLayer type. |
3b432ca to
0d47a13
Compare
0d47a13 to
51d5c64
Compare
packages/runtime/container-runtime/src/test/runtimeLayerCompatValidation.spec.ts
Show resolved
Hide resolved
packages/runtime/datastore/src/test/dataStoreLayerCompatValidation.spec.ts
Outdated
Show resolved
Hide resolved
packages/test/test-end-to-end-tests/src/test/layerCompat.spec.ts
Outdated
Show resolved
Hide resolved
markfields
left a comment
There was a problem hiding this comment.
Looks good overall, left a few optional questions/comments.
|
🔗 Found some broken links! 💔 Run a link check locally to find them. See linkcheck output |
packages/common/core-interfaces/api-report/core-interfaces.legacy.beta.api.md
Outdated
Show resolved
Hide resolved
packages/loader/container-loader/src/test/loaderLayerCompatValidation.spec.ts
Show resolved
Hide resolved
packages/runtime/container-runtime/src/test/runtimeLayerCompatValidation.spec.ts
Show resolved
Hide resolved
| compatibilityRequirementsInMonths: | ||
| compatDetailsLayer1.generation - | ||
| compatSupportRequirementsLayer1.minSupportedGeneration, | ||
| actualDifferenceInMonths: |
There was a problem hiding this comment.
Have we started bumping generation each month yet?
There was a problem hiding this comment.
So won't this be kind of misleading? minSupportedGeneration is presumably 0, and compatDetailsLayer1.generation is presumably 1. So this will report a compat requirement of 1 month. Maybe I'm wrong in my assumptions though.
It's ok if it's a little wonky at first while getting this off the ground anyway, IMO.
There was a problem hiding this comment.
In the current state, this error won't be thrown because everything is compatible. It will start throwing when we update the generation and the minSupportedGeneration.
markfields
left a comment
There was a problem hiding this comment.
left a bunch of comments on the diff since I last reviewed, hopefully they show up properly for you.
Follow up to #25706. Added a new error type `layerIncompatibilityError` which will be used when a layer incompatibility is detected between Fluid layers. This will help applications detect when an error is because of layer incompatibility and take appropriate steps. The new error type is added as an legacy / alpha API. Since the `FluidErrorTypes` type is legacy / beta, added a `FluidErrorTypesAlpha` type where new error types will be added to stage them. Once the breaking change window has passed, error types will be moved to `FluidErrorTypes`. [AB#51811](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/51811)
…r for consumption (microsoft#25706) Also a new `@alpha` interface `ILayerIncompatibilityError` of error type `FluidErrorTypes.usageError`. It has properties that consumers can use to get additional details about the incompatiblity. When layer incompatibility is detected, this error will be thrown. The properties have comments that explain what these properties are for. Also, added a telemetry called `LayerIncompatibilityError` which will be logged everytime layer incompatibility is detected. [AB#43990](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/43990)
…osoft#25784) Follow up to microsoft#25706. Added a new error type `layerIncompatibilityError` which will be used when a layer incompatibility is detected between Fluid layers. This will help applications detect when an error is because of layer incompatibility and take appropriate steps. The new error type is added as an legacy / alpha API. Since the `FluidErrorTypes` type is legacy / beta, added a `FluidErrorTypesAlpha` type where new error types will be added to stage them. Once the breaking change window has passed, error types will be moved to `FluidErrorTypes`. [AB#51811](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/51811)
Also a new
@alphainterfaceILayerIncompatibilityErrorof error typeFluidErrorTypes.usageError. It has properties that consumers can use to get additional details about the incompatiblity. When layer incompatibility is detected, this error will be thrown. The properties have comments that explain what these properties are for.Also, added a telemetry called
LayerIncompatibilityErrorwhich will be logged everytime layer incompatibility is detected.AB#43990