-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast #158594
[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast #158594
Conversation
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.
Nice work! Pulled down and tested, LGTM
…-use-data-view-type
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
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.
Tested locally, LGTM, thank you Kevin.
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ype as part of a cast (elastic#158594) ## Summary Fixes an issue with the field browser where all types currently display as unkown, this was because in a code path where a type cast happens, we were using the wrong type. To see this, remove the as unknown from the cast, and the typescript compiler will show the problem: ``` 'BrowserField' is deprecated.ts(6385) index.ts(70, 4): The declaration was marked as deprecated here. Conversion of type 'DataViewField' to type 'BrowserField' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. Type 'DataViewField' is missing the following properties from type 'BrowserField': category, description, example, fields, and 2 more.ts(2352) ``` DataViewField actually only has spec and kbnFieldType properties, spec is of type FieldSpec which is basically the same type as BrowserField, and has sufficient overlap for the (still unsafe, but more safe than as unknown) cast to occur. Before: <img width="338" alt="image" src="https://github.com/elastic/kibana/assets/56408403/f31c1f9e-25f0-41ee-9e1c-a70171e41d29"> After: <img width="555" alt="image" src="https://github.com/elastic/kibana/assets/56408403/8b462477-2dce-41bb-9592-f34b20634b84"> --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit 1c75903) # Conflicts: # x-pack/plugins/security_solution/public/detections/components/alerts_table/alerts_grouping.tsx # x-pack/plugins/security_solution/tsconfig.json
…rong type as part of a cast (#158594) (#158784) # Backport This will backport the following commits from `main` to `8.8`: - [[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast (#158594)](#158594) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kevin Qualters","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-05-31T21:13:36Z","message":"[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast (#158594)\n\n## Summary\r\n\r\nFixes an issue with the field browser where all types currently display\r\nas unkown, this was because in a code path where a type cast happens, we\r\nwere using the wrong type. To see this, remove the as unknown from the\r\ncast, and the typescript compiler will show the problem:\r\n```\r\n'BrowserField' is deprecated.ts(6385)\r\nindex.ts(70, 4): The declaration was marked as deprecated here.\r\nConversion of type 'DataViewField' to type 'BrowserField' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.\r\n Type 'DataViewField' is missing the following properties from type 'BrowserField': category, description, example, fields, and 2 more.ts(2352)\r\n```\r\nDataViewField actually only has spec and kbnFieldType properties, spec\r\nis of type FieldSpec which is basically the same type as BrowserField,\r\nand has sufficient overlap for the (still unsafe, but more safe than as\r\nunknown) cast to occur.\r\n\r\nBefore:\r\n<img width=\"338\" alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/56408403/f31c1f9e-25f0-41ee-9e1c-a70171e41d29\">\r\n\r\n\r\nAfter:\r\n<img width=\"555\" alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/56408403/8b462477-2dce-41bb-9592-f34b20634b84\">\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"1c75903f92b639e2dcffe76ed8b4ef4d6db3b70d","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Threat Hunting:Investigations","v8.9.0","v8.8.1"],"number":158594,"url":"https://github.com/elastic/kibana/pull/158594","mergeCommit":{"message":"[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast (#158594)\n\n## Summary\r\n\r\nFixes an issue with the field browser where all types currently display\r\nas unkown, this was because in a code path where a type cast happens, we\r\nwere using the wrong type. To see this, remove the as unknown from the\r\ncast, and the typescript compiler will show the problem:\r\n```\r\n'BrowserField' is deprecated.ts(6385)\r\nindex.ts(70, 4): The declaration was marked as deprecated here.\r\nConversion of type 'DataViewField' to type 'BrowserField' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.\r\n Type 'DataViewField' is missing the following properties from type 'BrowserField': category, description, example, fields, and 2 more.ts(2352)\r\n```\r\nDataViewField actually only has spec and kbnFieldType properties, spec\r\nis of type FieldSpec which is basically the same type as BrowserField,\r\nand has sufficient overlap for the (still unsafe, but more safe than as\r\nunknown) cast to occur.\r\n\r\nBefore:\r\n<img width=\"338\" alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/56408403/f31c1f9e-25f0-41ee-9e1c-a70171e41d29\">\r\n\r\n\r\nAfter:\r\n<img width=\"555\" alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/56408403/8b462477-2dce-41bb-9592-f34b20634b84\">\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"1c75903f92b639e2dcffe76ed8b4ef4d6db3b70d"}},"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/158594","number":158594,"mergeCommit":{"message":"[Security Solution] getDataViewStateFromIndexFields was using wrong type as part of a cast (#158594)\n\n## Summary\r\n\r\nFixes an issue with the field browser where all types currently display\r\nas unkown, this was because in a code path where a type cast happens, we\r\nwere using the wrong type. To see this, remove the as unknown from the\r\ncast, and the typescript compiler will show the problem:\r\n```\r\n'BrowserField' is deprecated.ts(6385)\r\nindex.ts(70, 4): The declaration was marked as deprecated here.\r\nConversion of type 'DataViewField' to type 'BrowserField' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.\r\n Type 'DataViewField' is missing the following properties from type 'BrowserField': category, description, example, fields, and 2 more.ts(2352)\r\n```\r\nDataViewField actually only has spec and kbnFieldType properties, spec\r\nis of type FieldSpec which is basically the same type as BrowserField,\r\nand has sufficient overlap for the (still unsafe, but more safe than as\r\nunknown) cast to occur.\r\n\r\nBefore:\r\n<img width=\"338\" alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/56408403/f31c1f9e-25f0-41ee-9e1c-a70171e41d29\">\r\n\r\n\r\nAfter:\r\n<img width=\"555\" alt=\"image\"\r\nsrc=\"https://github.com/elastic/kibana/assets/56408403/8b462477-2dce-41bb-9592-f34b20634b84\">\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"1c75903f92b639e2dcffe76ed8b4ef4d6db3b70d"}},{"branch":"8.8","label":"v8.8.1","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
Pinging @elastic/security-solution (Team: SecuritySolution) |
…jsonc (elastic#160445) ## Summary Adds missing dependency from this PR: elastic#158594 (cherry picked from commit 1ee60b0)
…ibana.jsonc (#160445) (#160464) # Backport This will backport the following commits from `main` to `8.9`: - [[Security Solution] adds missing dependency `fieldFormats` in kibana.jsonc (#160445)](#160445) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Devin W. Hurley","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-23T21:14:17Z","message":"[Security Solution] adds missing dependency `fieldFormats` in kibana.jsonc (#160445)\n\n## Summary\r\n\r\nAdds missing dependency from this PR:\r\nhttps://github.com//pull/158594","sha":"1ee60b0ba85409aaca28d65dc70956b082e66a7a","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["review","release_note:skip","v8.9.0","v8.10.0"],"number":160445,"url":"https://github.com/elastic/kibana/pull/160445","mergeCommit":{"message":"[Security Solution] adds missing dependency `fieldFormats` in kibana.jsonc (#160445)\n\n## Summary\r\n\r\nAdds missing dependency from this PR:\r\nhttps://github.com//pull/158594","sha":"1ee60b0ba85409aaca28d65dc70956b082e66a7a"}},"sourceBranch":"main","suggestedTargetBranches":["8.9"],"targetPullRequestStates":[{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/160445","number":160445,"mergeCommit":{"message":"[Security Solution] adds missing dependency `fieldFormats` in kibana.jsonc (#160445)\n\n## Summary\r\n\r\nAdds missing dependency from this PR:\r\nhttps://github.com//pull/158594","sha":"1ee60b0ba85409aaca28d65dc70956b082e66a7a"}}]}] BACKPORT--> Co-authored-by: Devin W. Hurley <[email protected]>
Summary
Fixes an issue with the field browser where all types currently display as unkown, this was because in a code path where a type cast happens, we were using the wrong type. To see this, remove the as unknown from the cast, and the typescript compiler will show the problem:
DataViewField actually only has spec and kbnFieldType properties, spec is of type FieldSpec which is basically the same type as BrowserField, and has sufficient overlap for the (still unsafe, but more safe than as unknown) cast to occur.
Before:
After: