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
Do not mutate config in place during deprecations #99629
Conversation
deprecations.forEach(({ deprecation, path }) => { | ||
processed = deprecation(processed, path, createAddDeprecation(path)); | ||
const commands = deprecation(result, path, createAddDeprecation(path)); |
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.
@Bamieh In a follow-up, we can store all the commands to report them later. Do we need original values? Or config keys only?
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.
@mshustov for the telemetry collector we'd only need the deprecated config keys
Pinging @elastic/kibana-core (Team:Core) |
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.
Task manager changes LGTM
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.
Changes to spaces
and security
LGTM
commands.set.forEach(function ({ key, value }) { | ||
set(result, key, value); | ||
}); |
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.
Any reason to not use arrow func here?
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.
nope, but prefer-arrow-callback eslint is not enabled in the repo
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.
Kibana app changes LGTM, code review only
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.
LGTM. I had 1 tiny nit feel free to merge without addressing.
deprecations.forEach(({ deprecation, path }) => { | ||
processed = deprecation(processed, path, createAddDeprecation(path)); | ||
const commands = deprecation(result, path, createAddDeprecation(path)); |
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.
@mshustov for the telemetry collector we'd only need the deprecated config keys
processed = deprecation(processed, path, createAddDeprecation(path)); | ||
const commands = deprecation(result, path, createAddDeprecation(path)); | ||
if (commands) { | ||
if (commands.set) { |
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.
why not use commands?.set
instead of the two if statements?
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.
ok, I will change in a follow-up
* refactor config deprecations to avoid config mutations * remove dynamic access keys in core deprecations. * refactor custom config deprecations to match the new signature * improve config deprecations fixtures for nested keys * add a test for xpack.banner config deprecations * key --> path, add a test for invalid command
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
) * Do not mutate config in place during deprecations (#99629) * refactor config deprecations to avoid config mutations * remove dynamic access keys in core deprecations. * refactor custom config deprecations to match the new signature * improve config deprecations fixtures for nested keys * add a test for xpack.banner config deprecations * key --> path, add a test for invalid command * remove lodash usage Co-authored-by: Mikhail Shustov <restrry@gmail.com>
💔 Build Failed
Failed CI Steps
Test FailuresKibana Pipeline / general / Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/infra/metrics_anomalies·ts.InfraOps App Metrics UI Metrics UI Anomaly Flyout with anomalies present renders more anomalies on threshold changeStandard Out
Stack Trace
Kibana Pipeline / general / Chrome X-Pack UI Functional Tests.x-pack/test/functional_with_es_ssl/apps/ml/alert_flyout·ts.ML app anomaly detection alert overview page alert flyout controls can create an anomaly detection alertStandard Out
Stack Trace
Kibana Pipeline / general / X-Pack API Integration Tests.x-pack/test/api_integration/apis/management/index_lifecycle_management/policies·js.apis management index lifecycle management policies list should have a default policy to manage the Watcher history indicesStandard Out
Stack Trace
and 5 more failures, only showing the first 3. Metrics [docs]
History
To update your PR or re-run it, just comment with: |
Summary
Part of #97791
Plugin API Changes
In this PR I changed how deprecations alter
config
. When a plugin implements a custom deprecation function, it used to mutate the config object. From now on, it should return eitherset
command to extendconfig
orunset
command to removeconfig
property. see Command patternbefore
after
Note that
@kbn/config
doesn't enforceconfig
runtime immutability, but only compile-time check. It's done to prevent cases when a deprecation depends on another deprecation to be executed before, unfortunately, our test coverage is not enough to detect such cases. We have to do that manually in a follow-up if we think it's worth the effort.Checklist
Delete any items that are not applicable to this PR.