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] Fixes incorrectly displayed error messages #159913

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Jun 19, 2023

PR #155372 moved our error utils to a package and also made a few small code changes, one of which added isPopulatedObject to the error object type guards.
isPopulatedObject uses Object.keys under the hood which cannot be used to access the non-enumerable properties of an object, like Error's message.

image

This PR reverts all of these functions back to their original versions which had existed in ML for a while without issue.

This was change had been causing error messages to not display correctly.

image

vs

image

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for catching this!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Any counts in public APIs

Total count of every any typed public API. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats any for more detailed information.

id before after diff
@kbn/ml-error-utils 0 4 +4

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 805.3KB 805.3KB -41.0B
dataVisualizer 367.8KB 367.7KB -41.0B
ml 3.4MB 3.4MB -41.0B
synthetics 1.2MB 1.2MB +11.0B
transform 403.5KB 403.5KB -22.0B
total -134.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 13 15 +2
securitySolution 411 415 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 14 16 +2
securitySolution 494 498 +4
total +6

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

cc @jgowdyelastic

@jgowdyelastic jgowdyelastic merged commit 8ca1789 into elastic:main Jun 19, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 19, 2023
PR elastic#155372 moved our error utils
to a package and also made a few small code changes, one of which added
`isPopulatedObject` to the error object type guards.
`isPopulatedObject` uses `Object.keys` under the hood which cannot be
used to access the non-enumerable properties of an object, like Error's
`message`.

![image](https://github.com/elastic/kibana/assets/22172091/6a0269df-ca2a-494a-9364-8f35f2b52388)

This PR reverts all of these functions back to their original versions
which had existed in ML for a while without issue.

This was change had been causing error messages to not display
correctly.

![image](https://github.com/elastic/kibana/assets/22172091/1862f069-1626-4ac3-8961-dca016b91956)

vs

![image](https://github.com/elastic/kibana/assets/22172091/243143a5-0c8f-4365-a41d-7c1c09858ad8)

(cherry picked from commit 8ca1789)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.8

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Jun 19, 2023
#159923)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[ML] Reverting use of isPopulatedObject in error utils
(#159913)](#159913)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"James
Gowdy","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-19T12:52:11Z","message":"[ML]
Reverting use of isPopulatedObject in error utils (#159913)\n\nPR
#155372 moved our error
utils\r\nto a package and also made a few small code changes, one of
which added\r\n`isPopulatedObject` to the error object type
guards.\r\n`isPopulatedObject` uses `Object.keys` under the hood which
cannot be\r\nused to access the non-enumerable properties of an object,
like
Error's\r\n`message`.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/6a0269df-ca2a-494a-9364-8f35f2b52388)\r\n\r\nThis
PR reverts all of these functions back to their original
versions\r\nwhich had existed in ML for a while without
issue.\r\n\r\nThis was change had been causing error messages to not
display\r\ncorrectly.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/1862f069-1626-4ac3-8961-dca016b91956)\r\n\r\nvs\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/243143a5-0c8f-4365-a41d-7c1c09858ad8)","sha":"8ca1789faa899f2e0a7abcf58fac50fa4d552af6","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","v8.9.0","v8.8.2"],"number":159913,"url":"https://github.com/elastic/kibana/pull/159913","mergeCommit":{"message":"[ML]
Reverting use of isPopulatedObject in error utils (#159913)\n\nPR
#155372 moved our error
utils\r\nto a package and also made a few small code changes, one of
which added\r\n`isPopulatedObject` to the error object type
guards.\r\n`isPopulatedObject` uses `Object.keys` under the hood which
cannot be\r\nused to access the non-enumerable properties of an object,
like
Error's\r\n`message`.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/6a0269df-ca2a-494a-9364-8f35f2b52388)\r\n\r\nThis
PR reverts all of these functions back to their original
versions\r\nwhich had existed in ML for a while without
issue.\r\n\r\nThis was change had been causing error messages to not
display\r\ncorrectly.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/1862f069-1626-4ac3-8961-dca016b91956)\r\n\r\nvs\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/243143a5-0c8f-4365-a41d-7c1c09858ad8)","sha":"8ca1789faa899f2e0a7abcf58fac50fa4d552af6"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/159913","number":159913,"mergeCommit":{"message":"[ML]
Reverting use of isPopulatedObject in error utils (#159913)\n\nPR
#155372 moved our error
utils\r\nto a package and also made a few small code changes, one of
which added\r\n`isPopulatedObject` to the error object type
guards.\r\n`isPopulatedObject` uses `Object.keys` under the hood which
cannot be\r\nused to access the non-enumerable properties of an object,
like
Error's\r\n`message`.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/6a0269df-ca2a-494a-9364-8f35f2b52388)\r\n\r\nThis
PR reverts all of these functions back to their original
versions\r\nwhich had existed in ML for a while without
issue.\r\n\r\nThis was change had been causing error messages to not
display\r\ncorrectly.\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/1862f069-1626-4ac3-8961-dca016b91956)\r\n\r\nvs\r\n\r\n\r\n![image](https://github.com/elastic/kibana/assets/22172091/243143a5-0c8f-4365-a41d-7c1c09858ad8)","sha":"8ca1789faa899f2e0a7abcf58fac50fa4d552af6"}},{"branch":"8.8","label":"v8.8.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: James Gowdy <[email protected]>
@peteharverson peteharverson added release_note:skip Skip the PR/issue when compiling release notes release_note:enhancement release_note:fix and removed release_note:fix release_note:skip Skip the PR/issue when compiling release notes release_note:enhancement labels Jun 21, 2023
@szabosteve szabosteve changed the title [ML] Reverting use of isPopulatedObject in error utils [ML] Fixes incorrectly displayed error messages Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:ml release_note:fix release_note:skip Skip the PR/issue when compiling release notes v8.8.2 v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants