-
Notifications
You must be signed in to change notification settings - Fork 536
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
(compat) Added supported features and generation across the Loader / Runtime boundary #22877
(compat) Added supported features and generation across the Loader / Runtime boundary #22877
Conversation
53a6825
to
59e9b5f
Compare
1e03233
to
fb90aff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 14 changed files in this pull request and generated no comments.
Files not reviewed (9)
- packages/runtime/container-runtime/package.json: Language not supported
- packages/runtime/container-runtime/src/test/containerRuntime.spec.ts: Evaluated as low risk
- packages/common/container-definitions/src/runtime.ts: Evaluated as low risk
- packages/common/core-utils/src/index.ts: Evaluated as low risk
- packages/common/core-utils/src/layerCompat.ts: Evaluated as low risk
- packages/common/container-definitions/api-report/container-definitions.legacy.alpha.api.md: Evaluated as low risk
- packages/runtime/container-runtime/src/test/types/validateContainerRuntimePrevious.generated.ts: Evaluated as low risk
- packages/loader/container-loader/src/containerContext.ts: Evaluated as low risk
- packages/runtime/container-runtime/api-report/container-runtime.legacy.alpha.api.md: Evaluated as low risk
Comments suppressed due to low confidence (1)
packages/loader/container-loader/src/container.ts:529
- The new compatibility checks introduced in validateRuntimeCompatibility are not covered by tests. Please add unit tests to ensure this functionality works as intended.
private validateRuntimeCompatibility(
I expected that each layer would take the other layer's generation and then decide if it suits it. This way it's always the newer layer that fails, rather than the older layer. As it is, you'll always be constrained by the older layer's understanding of the world. This is fine when everyone speak the same language, but if you ever want to change the semantics, it may prove inconvenient. If it's the newer client deciding compatibility, you can write new logic of any kind and it immediately takes effect. If it's the older, you have to keep playing by the older rules until the new logic saturates. e.g. I'll be curious to see how you fail for clients who pre-date this stuff. I bet it won't be the older client who bails, because it doesn't know any better. |
@@ -163,6 +168,12 @@ const savedContainerEvent = "saved"; | |||
|
|||
const packageNotFactoryError = "Code package does not implement IRuntimeFactory"; | |||
|
|||
/** | |||
* The current generation of the Loader. This is used to determine compatibility between other layers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current generation of the Loader. This is used to determine it's compatibility with other layers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding recommendation in notes here on when and how this value should be updated.
.changeset/light-pears-hammer.md
Outdated
|
||
`supportedFeatures` is deprecated in `IContainerContext` | ||
|
||
This was an optional property that was used internally to communicate features supported by the Loader layer to Runtime. This has been replaced with an internal only functionality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an optional property that was used internally to communicate features supported by the Loader layer to Runtime. This has been replaced with an internal only functionality. | |
This was an optional property that was used internally to communicate features supported by the Loader layer to Runtime. This has been replaced with an internal-only functionality. |
c07841b
to
9db2e28
Compare
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output
|
Description
Added
supportedFeatures
andgeneration
properties to Runtime and Loader layer boundary. These will be used to validate that the layers are compatible.These two properties along with
pkgVersion
are added to aILayerCompatDetails
interface.ContainterContext
andContainerRuntime
implements this interface provider and uses the provider pattern to access it from the other object. Theinterface
is internal and is not exposed since this in an internal implementation.pkgVersion
is includes in the error / warning logs to give additional context to users as to what the incompatible version combination is.Also, added a
ILayerCompatSupportRequirements
interface that has properties that a layer requires other layer to be at to be compatible.Supported features
supportedFeatures
property that includes a set of features that a layer supports. This is advertised to the other layer at the layer boundary.requiredFeatures
array that includes a set of features that it requires the other layer to support in order to be compatible. Note that this is internal to that layer and is not advertised.requiredFeatures
is present in thesupportedFeatures
of the other layer. If not, it closes the container with a usage error that says layers are not compatible.Generation
generation
is also added to both the layers. This is advertised to the other layer at the layer boundary.Note: The logic to update the generation will be added in a later PR. See AB#27054 for a proposed solution.
minSupportedGeneration
that it needs the other layer to be at. Note that this is internal to that layer and is not advertised.generation
of the other layer is >=minSupportedGeneration
.minSupportedGeneration
of 8 for the Loader layer (12 month support window). If it sees that Loader's generation is lower than 8, the layers are incompatible.Backwards compatibility
To support older layers before layer compat enforcement is introduced, the
minSupportedGeneration
is set to 0 whereasgeneration
starts at 1. For older layers that did not implementILayerCompatDetails
, their generation is set to 0 and supported features is set to an empty set. So, their generation is compatible until we update theminSupportedGeneration
.AB#20805