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

[ML][Meta] Technical debt and maintenance work for 8.16.0 #187772

Open
8 of 11 tasks
peteharverson opened this issue Jul 8, 2024 · 1 comment
Open
8 of 11 tasks

[ML][Meta] Technical debt and maintenance work for 8.16.0 #187772

peteharverson opened this issue Jul 8, 2024 · 1 comment
Assignees
Labels
epic Meta :ml refactoring technical debt Improvement of the software architecture and operational architecture v8.16.0

Comments

@peteharverson
Copy link
Contributor

peteharverson commented Jul 8, 2024

This issue lists items from the dependency cache issue as well as the migration of js files to TypeScript issue as well as other tech debt to be resolved as part of 8.16.

Misc

  1. :ml Meta technical debt v8.16.0
    walterra
  2. :ml technical debt v8.16.0
  3. :ml Feature:Data Views Team:DataDiscovery impact:medium loe:needs-research technical debt v8.16.0
    darnautov
  4. :ml Team:ML
    jgowdyelastic
  5. :ml Team:ML good first issue v8.16.0
    rbrtj

Dependency cache #153476

  1. :ml backport:skip release_note:skip v8.16.0
    walterra
  2. :ml Meta refactoring technical debt v8.16.0
  3. :ml backport:skip chore non-issue release_note:skip v8.16.0
    jgowdyelastic
  4. :ml Feature:Anomaly Detection backport:skip release_note:skip v8.16.0
    jgowdyelastic

JS files that need to be migrated to TypeScript #153894

Migrate tests using enzyme to use @testing-library/react. #153288

  1. :ml backport:skip release_note:skip v8.16.0
    walterra
@peteharverson peteharverson added Meta :ml refactoring technical debt Improvement of the software architecture and operational architecture epic v8.16.0 labels Jul 8, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

walterra added a commit that referenced this issue Aug 29, 2024
## Summary

Fixes #153477.
Fixes #153476.
Part of #187772 (technical debt).
Part of #153288 (migrate enzyme tests to react-testing-lib).

Removes dependency cache. The major culprit making this PR large and not
easy to split is that `getHttp()` from the dependency cache was used
throughout the code base for services like `mlJobService` and
`ml/mlApiServices` which then themselves were directly imported and not
part of React component lifecycles.

- For functional components this means mostly migrating to hooks that
allow accessing services.
- We still have a bit of a mix of usage of `withKibana` and `context`
for class based React components. This was not consolidated in this PR,
I took what's there and adjusted how services get used. These components
access services via `this.props.kibana.services.*` or
`this.context.services.*`.
- Functions no longer access the global services provided via dependency
cache but were updated to receive services via arguments.
- Stateful services like `mlJobService` are exposed now via a factory
that makes sure the service gets instantiated only once.
- Some tests where the mocks needed quite some refactoring were ported
to `react-testing-lib`. They no longer make use of snapshots or call
component methods which should be considered implementation details.
- We have a mix of usage of the plain `toasts` via `useMlKibana` and our
own `toastNotificationServices` that wraps `toasts`. I didn't
consolidate this in this PR but used what's available for the given
code.
- For class based components, service initializations were moved from
`componentDidMount()` to `constructor()` where I spotted it.
- We have a bit of a mix of naming: `ml`, `mlApiServices`,
`useMlApiContext()` for the same thing. I didn't consolidate the naming
in this PR, to avoid making this PR even larger. This can be done in a
follow up, once this PR is in this should be more straightforward and
less risky.
- Turns out `explorer_chart_config_builder.js` is no longer used
anywhere so I deleted it.
- `jobs/jobs_list/components/utils.d.ts` was missing some definitions,
tried to fix them.
- Moved `stashJobForCloning` to be a method of `mlJobService`.
- The `MetricSelector` component was an exact copy besides the i18n
label, consolidated that so anomaly detection wizards use the same
component.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Meta :ml refactoring technical debt Improvement of the software architecture and operational architecture v8.16.0
Projects
None yet
Development

No branches or pull requests

6 participants