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 named inject export from @ember/service #1001

Merged
merged 8 commits into from
Mar 8, 2024
Merged

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Dec 26, 2023

Propose deprecating named inject

Rendered

Summary

This pull request is proposing a new RFC.

To succeed, it will need to pass into the Exploring Stage), followed by the Accepted Stage.

A Proposed or Exploring RFC may also move to the Closed Stage if it is withdrawn by the author or if it is rejected by the Ember team. This requires an "FCP to Close" period.

An FCP is required before merging this PR to advance to Accepted.

Upon merging this PR, automation will open a draft PR for this RFC to move to the Ready for Released Stage.

Exploring Stage Description

This stage is entered when the Ember team believes the concept described in the RFC should be pursued, but the RFC may still need some more work, discussion, answers to open questions, and/or a champion before it can move to the next stage.

An RFC is moved into Exploring with consensus of the relevant teams. The relevant team expects to spend time helping to refine the proposal. The RFC remains a PR and will have an Exploring label applied.

An Exploring RFC that is successfully completed can move to Accepted with an FCP is required as in the existing process. It may also be moved to Closed with an FCP.

Accepted Stage Description

To move into the "accepted stage" the RFC must have complete prose and have successfully passed through an "FCP to Accept" period in which the community has weighed in and consensus has been achieved on the direction. The relevant teams believe that the proposal is well-specified and ready for implementation. The RFC has a champion within one of the relevant teams.

If there are unanswered questions, we have outlined them and expect that they will be answered before Ready for Release.

When the RFC is accepted, the PR will be merged, and automation will open a new PR to move the RFC to the Ready for Release stage. That PR should be used to track implementation progress and gain consensus to move to the next stage.

Checklist to move to Exploring

  • The team believes the concepts described in the RFC should be pursued.
  • The label S-Proposed is removed from the PR and the label S-Exploring is added.
  • The Ember team is willing to work on the proposal to get it to Accepted

Checklist to move to Accepted

  • This PR has had the Final Comment Period label has been added to start the FCP
  • The RFC is announced in #news-and-announcements in the Ember Discord.
  • The RFC has complete prose, is well-specified and ready for implementation.
    • All sections of the RFC are filled out.
    • Any unanswered questions are outlined and expected to be answered before Ready for Release.
    • "How we teach this?" is sufficiently filled out.
  • The RFC has a champion within one of the relevant teams.
  • The RFC has consensus after the FCP period.

@github-actions github-actions bot added the S-Proposed In the Proposed Stage label Dec 26, 2023
@kategengler kategengler changed the title Deprecate named inject Deprecate named inject export from @ember/service Dec 26, 2023
text/1001-deprecate-named-inject.md Outdated Show resolved Hide resolved
text/1001-deprecate-named-inject.md Show resolved Hide resolved
text/1001-deprecate-named-inject.md Outdated Show resolved Hide resolved
Co-authored-by: Katie Gengler <katie@kmg.io>

## Drawbacks

n/a
Copy link
Member

Choose a reason for hiding this comment

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

I'm surprised that there are no listed drawbacks here. Indeed, you can easily change this in your app code, but if this is being imported by an addon that you don't control, there will be a cliff of ember versions that a non-updated addon can be supported on.

This is probably true generally, but it seems like a low-value artificial cliff to do this just for an export alias.

I ran a code search on emberobserver.com and it gives us lots of results for this usage: 714 addons (6562 usages)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need better filters on emberobserver 🤔 when I was doing all the research for #1003, I found that most usages were in addons that were no longer used, updated, or not compatible with a version of ember that would even see the deprecation. Not saying that this is the case (I see the same results, btw), but I just... can't know right now -- I should see what it would take to add some more filtering to code search on emberobserver.

This is probably true generally

aye, this is every deprecation, really.

like a low-value artificial cliff to do this just for an export alias.

as an alternative, we can auto-upgrade v1 addons via ember-cli-babel -- thoughts?
v2 addons, who don't use ember-cli-babel, are either already using plain service, or can quickly update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a note here on drawbacks, and I think, in doing so, I've talked myself (or you helped me talk myself) into deferring this deprecation until Ember 6.1, targeting for removal in 7.

That gives addon authors a massive support range, should they choose to do so, of 3.28 to 6.12.x, with v7 dropping inject, making any folks with 3.28 support have to either drop it (supporting 4.1 as a minimum), or adding @embroider/macros to keep support.

This also gives the addon ecosystem a year and a half to decide how they want to support inject / service throughout the entirety of the v6 series.

Copy link
Member

Choose a reason for hiding this comment

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

If we implement deprecation staging, we can enable the deprecation sooner even if it targets 7.0.


n/a

## Alternatives
Copy link
Member

Choose a reason for hiding this comment

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

a reasonable alternative would be to add a lint against it in the default lint set, essentially nudging people towards not needing it 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, that could happen now, actually, without an RFC

do nothing, the cost of an export alias is:
- a few extra bytes
- mental gymnastics for teaching
- "another case to cover" for tooling
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this comment, can you elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When tooling tries to implement go-to-definition for services, (because we use string-based services, we have to implement this ourselves), the tool needs to know about all the potential exports (inject and service) in order to look up their usages.

It's not a lot, but it is one more thing.

And unifying on one less thing benefits simplicity of tooling implementation, as well as our learning story.

@ef4
Copy link
Contributor

ef4 commented Mar 8, 2024

Discussed at RFC review at the end of FCP, agreed to merge, with the understanding that this should probably not target 6.0, it should give people more time.

@ef4 ef4 merged commit ab625bd into master Mar 8, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the deprecate-named-inject branch March 8, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Final Comment Period S-Exploring In the Exploring RFC Stage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants