Skip to content

[Entity Analytics] Fix toggle ignoring V2 store status when V1 experimental flag is disabled#263918

Merged
seanrathier merged 6 commits intoelastic:mainfrom
seanrathier:feature-flag-toggle-entity-store
Apr 17, 2026
Merged

[Entity Analytics] Fix toggle ignoring V2 store status when V1 experimental flag is disabled#263918
seanrathier merged 6 commits intoelastic:mainfrom
seanrathier:feature-flag-toggle-entity-store

Conversation

@seanrathier
Copy link
Copy Markdown
Contributor

@seanrathier seanrathier commented Apr 16, 2026

Summary

Fixes the entity analytics toggle showing OFF despite the V2 entity store being fully running, when the entityStoreDisabled experimental flag is enabled alongside securitySolution:entityStoreEnableV2.

Root cause 1 — status derivation (use_entity_analytics_status.ts):
deriveEntityAnalyticsStatus checked isEntityStoreFeatureFlagDisabled before isEntityStoreV2Enabled. When entityStoreDisabled=true and V2 is enabled, the function short-circuited into deriveRiskEngineOnlyStatus, discarding the polled V2 running status entirely. The fix moves the V2 check first so it supersedes the V1 feature flag.

Root cause 2 — toggle action (use_toggle_entity_analytics.ts):
storeOn was computed as !isEntityStoreFeatureFlagDisabled && entityStoreStatus === 'running'. In V2 mode with entityStoreDisabled=true, this always evaluated to false, causing the toggle click to always try to enable the store (instead of stopping it when already running). The fix computes storeOn independently of the V1 flag when in V2 mode.

Closes https://github.com/elastic/security-team/issues/16767

Checklist

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

  • Low risk. This is a pure status-derivation and toggle-action fix. No data is written, no ES mappings changed, no API contracts altered. The only observable effect is that the toggle now correctly reflects the V2 store state when both flags are active simultaneously.

Release Notes

Fix entity analytics toggle displaying OFF when V2 entity store is running and the V1 entityStoreDisabled experimental flag is enabled.

seanrathier and others added 6 commits April 13, 2026 16:13
Tracks the changes needed in communicates_with and accesses maintainers
to align with the EntityRelationship schema introduced in elastic#262242.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ema update

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…us when V1 flag is disabled

When `entityStoreDisabled` experimental flag is true and V2 is enabled,
`deriveEntityAnalyticsStatus` was checking `isEntityStoreFeatureFlagDisabled`
before `isEntityStoreV2Enabled`, causing the V2 running status to be silently
discarded in favour of risk-engine-only derivation. The toggle showed OFF
despite the V2 entity store being fully running.

Also fixes `storeOn` in `useToggleEntityAnalytics`, which was gated on
`!isEntityStoreFeatureFlagDisabled` even in V2 mode, preventing the toggle
from correctly identifying the store as running and stopping it on click.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@seanrathier seanrathier requested a review from a team as a code owner April 16, 2026 21:44
@seanrathier seanrathier requested review from CAWilson94 and removed request for CAWilson94 April 16, 2026 21:44
@seanrathier seanrathier added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related backport:version Backport to applied version labels v9.4.0 labels Apr 16, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/contextual-security-apps (Team:Cloud Security)

@seanrathier seanrathier self-assigned this Apr 16, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 16, 2026

Approvability

Verdict: Needs human review

This PR modifies feature flag gating logic that determines whether entity analytics is enabled or disabled, changing the order of condition evaluation. All changed files are owned by @elastic/security-entity-analytics, which the author is not a member of, so the designated code owners should review these changes.

You can customize Macroscope's approvability policy. Learn more.

@seanrathier seanrathier enabled auto-merge (squash) April 16, 2026 22:29
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
securitySolution 11.7MB 11.7MB +53.0B

cc @seanrathier

@seanrathier seanrathier merged commit 9531d93 into elastic:main Apr 17, 2026
33 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

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

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
9.4

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

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 21, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.
cc: @seanrathier

kibanamachine added a commit that referenced this pull request Apr 21, 2026
…experimental flag is disabled (#263918) (#264111)

# Backport

This will backport the following commits from `main` to `9.4`:
- [[Entity Analytics] Fix toggle ignoring V2 store status when V1
experimental flag is disabled
(#263918)](#263918)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT
[{"author":{"name":"seanrathier","email":"sean.rathier@gmail.com"},"sourceCommit":{"committedDate":"2026-04-17T14:54:42Z","message":"[Entity
Analytics] Fix toggle ignoring V2 store status when V1 experimental flag
is disabled
(#263918)","sha":"9531d936e499b92f816e7282b23b153dae4c6210","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Cloud
Security","backport:version","v9.4.0","v9.5.0"],"title":"[Entity
Analytics] Fix toggle ignoring V2 store status when V1 experimental flag
is
disabled","number":263918,"url":"https://github.com/elastic/kibana/pull/263918","mergeCommit":{"message":"[Entity
Analytics] Fix toggle ignoring V2 store status when V1 experimental flag
is disabled
(#263918)","sha":"9531d936e499b92f816e7282b23b153dae4c6210"}},"sourceBranch":"main","suggestedTargetBranches":["9.4"],"targetPullRequestStates":[{"branch":"9.4","label":"v9.4.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.5.0","branchLabelMappingKey":"^v9.5.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/263918","number":263918,"mergeCommit":{"message":"[Entity
Analytics] Fix toggle ignoring V2 store status when V1 experimental flag
is disabled
(#263918)","sha":"9531d936e499b92f816e7282b23b153dae4c6210"}}]}]
BACKPORT-->

Co-authored-by: seanrathier <sean.rathier@gmail.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants