Skip to content
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

Deprecate ContainerRuntime class #23331

Merged
merged 16 commits into from
Dec 16, 2024
Merged

Deprecate ContainerRuntime class #23331

merged 16 commits into from
Dec 16, 2024

Conversation

markfields
Copy link
Member

@markfields markfields commented Dec 13, 2024

Description

Fixes AB#25439. Precursor to #23329.

We intend to mark the class ContainerRuntime as @internal which will give us great freedom to iterate on its internals freely - it is an implementation detail after all! To do so we need to put it on a deprecation path so any few remaining usages in partner code are migrated off ContainerRuntime, like so:

  • When using it as a type, replace it with an interface like IContainerRuntime (or in rare cases, IRuntime)
  • When using the static function ContainerRuntime.loadRuntime replace it with the free function loadContainerRuntime.

@Copilot Copilot bot review requested due to automatic review settings December 13, 2024 23:07
@markfields markfields requested a review from a team as a code owner December 13, 2024 23:07
@github-actions github-actions bot added area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: runtime Runtime related issues area: tests Tests to add, test infrastructure improvements, etc public api change Changes to a public API base: main PRs targeted against main branch labels Dec 13, 2024

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 9 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • packages/framework/aqueduct/api-report/aqueduct.legacy.alpha.api.md: Evaluated as low risk
  • packages/runtime/container-runtime/api-report/container-runtime.legacy.alpha.api.md: Evaluated as low risk
  • examples/utils/migration-tools/src/compositeRuntime/loadCompositeRuntime.ts: Evaluated as low risk
  • packages/runtime/container-runtime/src/containerRuntime.ts: Evaluated as low risk
@markfields markfields requested a review from a team as a code owner December 13, 2024 23:12
@markfields markfields added the release-blocking Must be addressed before we cut and publish the next release label Dec 13, 2024
@markfields
Copy link
Member Author

Marking as Release-Blocking to make sure this deprecation announcement makes it into the 2.12 release.

@markfields
Copy link
Member Author

@jason-ha, @sonalideshpandemsft I'm going to wait to merge this until we can talk on Monday about what to do about the Loop CI pipeline hitting lint failures.

Copy link
Member Author

@markfields markfields left a comment

Choose a reason for hiding this comment

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

New plan: deprecate the methods on BaseContainerRuntimeFactory that use ContainerRuntime. Alternative for people (I think there is no one) is to copy the implementation of the class and change the type on them to IContainerRuntime.

@jason-ha
Copy link
Contributor

For legacy+alpha's that are becoming internal I recommend an alternate pattern that keeps the deprecation to external uses and preserves internal as non-deprecated. See #23332

@jason-ha
Copy link
Contributor

@jason-ha, @sonalideshpandemsft I'm going to wait to merge this until we can talk on Monday about what to do about the Loop CI pipeline hitting lint failures.

Since you have a plan to deal with all of those in Loop, I would suggest adding lint suppressions in Loop with a comment noting that while the suppressions aren't required with current package they are required for pending update and needed to keep the integration pipeline passing.

I do not know how we make a good process generally.

@markfields
Copy link
Member Author

@alexvy86 / @Josmithr -- The interesting changes to BaseContainerRuntimeFactory and the changeset changed, JFYI in case you want to take another look.

.changeset/plain-mails-tan.md Outdated Show resolved Hide resolved
Comment on lines +18 to +22
`BaseContainerRuntimeFactory` has some changes as well, since it exposed `ContainerRuntime` in several function signatures:

* `instantiateFirstTime` - Takes the wider type `IContainerRuntime` instead of `ContainerRuntime`
* `instantiateFromExisting` - Takes the wider type `IContainerRuntime` instead of `ContainerRuntime`
* `preInitialize` - deprecated as well, since it returns `ContainerRuntime`
Copy link
Contributor

Choose a reason for hiding this comment

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

BaseContainerRuntimeFactory is not @sealed so right now people could in theory subclass it, and I believe that would make this breaking for anyone that was doing it. I don't know how confident we are that it is not happening today... and if we are confident enough, maybe we should mark it @sealed. And well, depending on that level of confidence, these might actually need to wait until 2.20?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great call-out. I discussed this at length with @jason-ha, it's technically not a breaking change based on TypeScript weirdness (kind of disappointing), but you're right that it would lead to unexpected behavior if a subclass was counting on getting ContainerRuntime and then a caller provided something outside that.

HOWEVER -- in the ecosystem in which this is used, it'll always be ContainerRuntime. We just don't want to talk about it :)

@markfields markfields enabled auto-merge (squash) December 16, 2024 22:13
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  170006 links
    1595 destination URLs
    1825 URLs ignored
       0 warnings
       0 errors


@markfields markfields merged commit dc48446 into main Dec 16, 2024
33 checks passed
@markfields markfields deleted the test/hide-cr-class branch December 16, 2024 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: runtime Runtime related issues area: tests Tests to add, test infrastructure improvements, etc base: main PRs targeted against main branch changeset-present public api change Changes to a public API release-blocking Must be addressed before we cut and publish the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants