kibana icon indicating copy to clipboard operation
kibana copied to clipboard

[Security Solution][Auto migrations] Add support for hiding data errors in the ESQL editor

Open semd opened this issue 6 months ago • 4 comments

Summary

issue: https://github.com/elastic/security-team/issues/11535

Adds the switch to toggle data errors highlighting in the ESQL editor when used inside the automatic migrations.

Implementation details

  • A new dataErrorsControl property is exposed by the ESQL editor component to allow controlling the "data errors" switch state from outside. The type is defined as follows:
export interface DataErrorsControl {
  enabled: boolean;
  onChange: (value: boolean) => void;
}
  • The ESQL editor is responsible for:

    • Rendering the switch according to the dataErrorsControl state provided.
    • Hide the data errors highlighting when the dataErrorsControl.enabled is false (strictly)
    • Not rendering the switch when dataErrorsControl is not provided, and highlighting data errors.
  • The Automatic migrations flyout in Security that uses the ESQL editor is responsible for:

    • Managing the state of the dataErrorsControl provided to the editor.
    • Persist the state to local storage to be shared between all the instances of the ESQL editor on that page.

Considerations

  • Managing the "data errors" switch state internally in the ESQL editor would make it hard to apply this behaviour (including local storage persistence) only in the Automatic migrations page in Security.

  • The "data errors" validation is performed even when the highlighting is disabled. The number of errors is necessary anyway, to know whether the "N errors" popover button in the footer (where the switch is displayed) should be rendered or not.

Screenshots

Data errors enabled:

data_errors_enabled

Data errors disabled (highlights syntax errors only):

with_syntax_errors

Edge cases

No syntax errors

When there are data errors but no syntax error, and the switch is off, we render the 0 errors popover button:

no_syntax

just to be able to turn the switch on and see the underlying data errors:

no_syntax_enabled

No errors

When there is no error at all, we hide the N errors popover button, regardless of the switch value:

no_error

semd avatar Jun 12 '25 16:06 semd

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

elasticmachine avatar Jun 13 '25 15:06 elasticmachine

Thanx! I will review tmr!

stratoula avatar Jun 16 '25 04:06 stratoula

@elasticmachine merge upstream

semd avatar Jun 16 '25 11:06 semd

:hourglass_flowing_sand: Build in-progress, with failures

Failed CI Steps

History

  • :yellow_heart: Build #308779 was flaky 624cc60cf9a9d92bebd2f074fe015ac66bcbde4a
  • :green_heart: Build #308426 succeeded 96bb726749c083eb90c42eaa321eccafc383527d
  • :green_heart: Build #308277 succeeded 91b6c86d07d982d57a4880ca7cd792f8b8fe1860
  • :broken_heart: Build #308216 failed eda37395e69cb6f29c56970773fce1783a0474f5

cc @semd

elasticmachine avatar Jun 17 '25 09:06 elasticmachine

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15726806630

kibanamachine avatar Jun 18 '25 07:06 kibanamachine

💚 All backports created successfully

Status Branch Result
8.19

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine avatar Jun 18 '25 07:06 kibanamachine