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

[deprecations] Remove/update core-api deprecations targeted for removal by 8.8 #147723

Conversation

TinaHeiligers
Copy link
Contributor

@TinaHeiligers TinaHeiligers commented Dec 16, 2022

Core API's need to be robust and reliable for feature development, even more so as we prepare for backward compatibility between versions.

A number of deprecated API's are currently marked for removal by 8.8 and this PR removes those that can safely be removed and removes the deprecation from those that we will not be removing.

Part of 142915

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Third party plugins may experience integration issues if still relying on deprecated API's; Low Low The API's that have been removed have been deprecated for a number of minors. Any third party consumers should have migrated away from these by now

For maintainers

Release note:

  • removes deprecated SavedObjectsMigrationLogger.warning targeted for removal by 8.8
  • removes deprecation of AppMountParameters.onAppLeave. AppLeaveHandler and OpsProcessMetrics

@TinaHeiligers TinaHeiligers added chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc deprecation_warnings release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v8.7.0 labels Dec 16, 2022
@@ -32,6 +32,7 @@ export type SavedObjectAttribute = SavedObjectAttributeSingle | SavedObjectAttri
*
* @public
* @deprecated This type reduces the type safety of your code. Create an interface for your specific saved object type or use `unknown` instead.
* @removeBy 9.0.0
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 removeBy version to encourage type-owners to implement their interfaces. If there is a 9.0.0 version, we'll probably have a bunch more deprecations to worry about and shouldn't be carrying existing ones over to a new major.

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

self review and comments to reviewers

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers marked this pull request as ready for review December 17, 2022 17:48
@TinaHeiligers TinaHeiligers requested review from a team as code owners December 17, 2022 17:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

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

kibana-presenation and kibana-gis changes LGTM
code review

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

LGTM! Just adding a couple of minor comments for us to consider/discuss (also some for my own knowledge) 😇

test/analytics/tests/analytics_from_the_browser.ts Outdated Show resolved Hide resolved
Comment on lines 90 to 92
* @deprecated Use {@link AppMountParameters.history} instead.
* @removeBy 8.8.0
*
Copy link
Member

Choose a reason for hiding this comment

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

Was this misplaced? Can't we remove appBasePath? Is it not really deprecated?

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Dec 19, 2022

Choose a reason for hiding this comment

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

Um, at first I thought some teams were blocked on using AppMountParams.history over AppMountParams.appBasePath because they couldn't use ScopedHistory.bock over onAppLeave for back button navigation in the browser.

Now though, I'm not so sure.

We have 2 options:

  1. Leave the deprecation in place until teams still using appBasePath migrate away from it
    e.g src/plugins/kibana_overview/public/application.tsx: or
  2. Carry on supporting appBasePath since we're not deprecating onAppLeave or AppLeaveHandler.

@pgayvallet could you recommend the best path forward please?

@afharo For this PR, I'll add the deprecation warning back in unless the recommendation is to continue supporting it.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC appBasePath exposition isn't directly related to the ScopedHistory.block thingy. It's exposed because applications based on the legacy (Hash) router needs to know about it to instantiate their own router. I think nothing would block them from migrating to the new (HTML5) router.

Q/A:
should it be deprecated? ihmo yes.
would it make sense to delete it? ihmo yes.
can we delete it? no, as other teams are still using it...
can we easily adapt the code ourselves to delete it? no, migrating from one router to the other is all but trivial, and multiple apps are still using it IIRC
so, what should we do? not sure. Removing the deprecation may be fine, idk.

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 have a bit of time to see if teams have the capacity to migrate their routers and don't need to make a decision right now.
If there's no actual harm in keeping appBasePath around then we can treat it in the same way as onAppLeave: remove the deprecation warning even though it's not ideal.

@TinaHeiligers TinaHeiligers requested a review from afharo December 19, 2022 21:58
Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM when remark is addressed.

* @deprecated Use `warn` instead.
* @removeBy 8.8.0
*/
warning: (msg: string) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also adapt the implementation accordingly (MigrationLogger in

export class MigrationLogger implements SavedObjectsMigrationLogger {
)

Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Dec 20, 2022

Choose a reason for hiding this comment

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

Good catch, thanks!

For the record, the discrepancy in log level type between 'SavedObjectsMigrationLogger' and 'MigrationLogLevel':

export interface SavedObjectsMigrationLogger {
  debug: (msg: string) => void;
  info: (msg: string) => void;
  warn: (msg: string) => void;
  error: <Meta extends LogMeta = LogMeta>(msg: string, meta: Meta) => void;
}

vs

/** @internal */
export type MigrationLogLevel = 'error' | 'info' | 'warning';

Is intentional. The log level gets cast from warning to warn in logStateTransition:

        case 'warning':
          return logger.warn(logMessagePrefix + message);

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@TinaHeiligers
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@TinaHeiligers TinaHeiligers enabled auto-merge (squash) January 22, 2023 19:50
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-saved-objects-server 97 95 -2
core 1019 1017 -2
total -4
Unknown metric groups

API count

id before after diff
@kbn/core-saved-objects-server 327 325 -2
core 2808 2806 -2
total -4

References to deprecated APIs

id before after diff
@kbn/core-application-browser 7 0 -7
@kbn/core-application-browser-internal 22 2 -20
@kbn/core-application-browser-mocks 4 2 -2
@kbn/core-apps-browser-internal 14 0 -14
@kbn/core-metrics-server-internal 6 0 -6
@kbn/core-saved-objects-migration-server-internal 48 44 -4
@kbn/core-status-server-internal 4 0 -4
@kbn/core-usage-data-server-internal 6 0 -6
core 39 37 -2
dashboard 149 141 -8
kibanaUsageCollection 2 0 -2
lens 226 220 -6
maps 75 67 -8
ml 212 210 -2
monitoring 4 2 -2
security 77 75 -2
securitySolution 412 386 -26
visualizations 284 276 -8
total -129

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@TinaHeiligers TinaHeiligers merged commit 188009f into elastic:main Jan 22, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 22, 2023
@TinaHeiligers TinaHeiligers self-assigned this Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting chore deprecation_warnings release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants