Skip to content

init on install#263732

Merged
chennn1990 merged 11 commits intoelastic:mainfrom
chennn1990:entity-store/init-maintainers-on-install
Apr 19, 2026
Merged

init on install#263732
chennn1990 merged 11 commits intoelastic:mainfrom
chennn1990:entity-store/init-maintainers-on-install

Conversation

@chennn1990
Copy link
Copy Markdown
Contributor

@chennn1990 chennn1990 commented Apr 16, 2026

Install now runs entity maintainer initialization whenever a real install happens (assetManager.init followed by entityMaintainersClient.init), so maintainer tasks are scheduled as part of the install path instead of only via a separate init call.

@chennn1990 chennn1990 self-assigned this Apr 16, 2026
@chennn1990 chennn1990 requested a review from a team as a code owner April 16, 2026 11:10
@chennn1990 chennn1990 added the release_note:skip Skip the PR/issue when compiling release notes label Apr 16, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 16, 2026

Catch flakiness early (recommended)

Recommended before merge: run the flaky test runner against this PR to catch flakiness early.

Trigger a run with the Flaky Test Runner UI or post this comment on the PR:

/flaky scoutConfig:x-pack/solutions/security/plugins/entity_store/test/scout/api/playwright.config.ts:30

This check is experimental. Share your feedback in the #appex-qa channel.

Posted via Macroscope — Flaky Test Runner nudge

Copy link
Copy Markdown
Contributor

@macroscopeapp macroscopeapp Bot left a comment

Choose a reason for hiding this comment

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

Scout Test Review

🔴 Blocker

apiTest.only left in committed code — this will skip every other test in the suite when the file runs.

Posted via Macroscope — Scout Test Review

@uri-weisman uri-weisman added backport:version Backport to applied version labels v9.4.0 labels Apr 16, 2026
@uri-weisman
Copy link
Copy Markdown
Contributor

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we are in a non default space and entity store is running, we'll not init the entity maintainers framework in case of a new maintainer was introduced.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a95fa88-895b-4e7f-8e93-a53b9ee2036a

📥 Commits

Reviewing files that changed from the base of the PR and between 1176416 and 7faec77.

📒 Files selected for processing (4)
  • x-pack/solutions/security/plugins/entity_store/public/hooks/useInstallEntityStoreV2.test.tsx
  • x-pack/solutions/security/plugins/entity_store/public/hooks/useInstallEntityStoreV2.tsx
  • x-pack/solutions/security/plugins/entity_store/server/routes/apis/install/index.ts
  • x-pack/solutions/security/plugins/entity_store/test/scout/api/tests/install_update.spec.ts

📝 Walkthrough

Walkthrough

The changes refactor Entity Store V2 installation to shift entity maintainers initialization from the client-side hook to the server-side install route handler. The useInstallEntityStoreV2 hook no longer calls ENTITY_MAINTAINERS_INIT directly; instead, the install route now calls entityMaintainersClient.init() after asset initialization completes. Control flow logic in non-default spaces was adjusted to check for v1 installation only when v2 is not already present. Test expectations were updated to verify the new HTTP call sequencing and that entity maintainers are initialized server-side with taskStatus === 'started'.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation: Commit on current branch
  • 🛠️ Update Documentation: Create PR

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

✅ Actions performed

Full review triggered.

maxcold added a commit that referenced this pull request Apr 17, 2026
…aintainer

After PR #263732 (init on install), entity maintainers are initialized
during the Entity Store install flow. The CSV upload test relied on
maintainers not being initialized, causing a race condition where the
automated-resolution maintainer links entities before the test can
assert. Stop the maintainer explicitly in the before hook with a
try/catch for backward compatibility.
@chennn1990 chennn1990 requested review from a team as code owners April 19, 2026 07:19
@chennn1990 chennn1990 requested a review from ymao1 April 19, 2026 07:19
Copy link
Copy Markdown
Contributor

@macroscopeapp macroscopeapp Bot left a comment

Choose a reason for hiding this comment

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

👍 Positive reinforcement — The new maintainers verification block in the install happy-path test is well-structured: it validates the response body (not just the status code), reuses INTERNAL_HEADERS and ENTITY_STORE_ROUTES from the shared constants file, and properly types the response. The apiTest.only blocker from the prior review has been fixed. Nice work!

Posted via Macroscope — Scout Test Review

Comment on lines 60 to 61
const uninstall = await apiClient.post(ENTITY_STORE_ROUTES.public.UNINSTALL, {
headers: defaultHeaders,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit — Validate the response body

expect(maintainers.every(…)).toBe(true) reduces the whole array to a single boolean, so a failure says "expected false to be true" with no indication of which maintainer has a wrong status. Asserting per-element gives a much better diagnostic:

Suggested change
const uninstall = await apiClient.post(ENTITY_STORE_ROUTES.public.UNINSTALL, {
headers: defaultHeaders,
expect(maintainers.length).toBeGreaterThan(0);
for (const m of maintainers) {
expect(m.taskStatus).toBe('started');
}

Posted via Macroscope — Scout Test Review

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Apr 19, 2026

⏳ Build in-progress, with failures

Failed CI Steps

History

cc @chennn1990

@chennn1990 chennn1990 enabled auto-merge (squash) April 19, 2026 12:36
Copy link
Copy Markdown
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

Entity analytics changes LGTM. Code review of test changes only. Could we run the flaky test runner on these tests?

@chennn1990 chennn1990 merged commit ed3bbba into elastic:main Apr 19, 2026
20 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.4

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

@chennn1990
Copy link
Copy Markdown
Contributor Author

Entity analytics changes LGTM. Code review of test changes only. Could we run the flaky test runner on these tests?

@ymao1 yes, green run

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 19, 2026
Install now runs entity maintainer initialization whenever a real
install happens (assetManager.init followed by
entityMaintainersClient.init), so maintainer tasks are scheduled as part
of the install path instead of only via a separate init call.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit ed3bbba)
@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

kapral18 added a commit to kapral18/kibana that referenced this pull request Apr 19, 2026
* main: (114 commits)
  Fix observability_ai_assistant_tool_call EBT error when connector is an inference endpoint (elastic#263334)
  init on install (elastic#263732)
  [One Workflow] fail-fast TaskRecovery for interrupted runs (elastic#261275)
  [Entity Store] Reset state error after successful task run (elastic#263087)
  [api-docs] 2026-04-19 Daily api_docs build (elastic#264280)
  [UII] Fix integration card row height calculation (elastic#264212)
  [scout] migrate FTR logstash api tests (elastic#262953)
  [StorageIndexAdapter] Set auto_expand_replicas to fix yellow health on single-node ES clusters (elastic#263096)
  [api-docs] 2026-04-18 Daily api_docs build (elastic#264260)
  [Scout] Update test config manifests (elastic#264257)
  [Security Solution][Detection Engine] enables AI rule creation feature flag (elastic#264036)
  [dashboards as code] only validate id on PUT route when creating new dashboard (elastic#264161)
  chore(NA): bump version to 9.5.0 (elastic#262165)
  skip failing test suite (elastic#263649)
  skip failing test suite (elastic#264236)
  [Discover] Convert remaining Enzyme tests to RTL (elastic#259676)
  auto-implement: Labels in model endpoints table of the model details flyout look misaligned (elastic#263770)
  [ci] Promote ES docker image after verification (elastic#263890)
  [Observability:Onboarding] Remove suppress global announcements that was breaking ensemble tests (elastic#264169)
  [Cases][AttachmentV2] Migrate persistable state part 2 - ML and AIOps charts (elastic#262597)
  ...
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 20, 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: @chennn1990

1 similar comment
@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: @chennn1990

kibanamachine added a commit that referenced this pull request Apr 21, 2026
# Backport

This will backport the following commits from `main` to `9.4`:
- [init on install
(#263732)](#263732)

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

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

<!--BACKPORT [{"author":{"name":"Chen
Ashuri","email":"chen.ashuri@elastic.co"},"sourceCommit":{"committedDate":"2026-04-19T14:27:02Z","message":"init
on install (#263732)\n\nInstall now runs entity maintainer
initialization whenever a real\ninstall happens (assetManager.init
followed by\nentityMaintainersClient.init), so maintainer tasks are
scheduled as part\nof the install path instead of only via a separate
init call.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ed3bbba673cb691766464f9c6965e8a55ffe1a2b","branchLabelMapping":{"^v9.5.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.4.0","v9.5.0"],"title":"init
on
install","number":263732,"url":"https://github.com/elastic/kibana/pull/263732","mergeCommit":{"message":"init
on install (#263732)\n\nInstall now runs entity maintainer
initialization whenever a real\ninstall happens (assetManager.init
followed by\nentityMaintainersClient.init), so maintainer tasks are
scheduled as part\nof the install path instead of only via a separate
init call.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ed3bbba673cb691766464f9c6965e8a55ffe1a2b"}},"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/263732","number":263732,"mergeCommit":{"message":"init
on install (#263732)\n\nInstall now runs entity maintainer
initialization whenever a real\ninstall happens (assetManager.init
followed by\nentityMaintainersClient.init), so maintainer tasks are
scheduled as part\nof the install path instead of only via a separate
init call.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"ed3bbba673cb691766464f9c6965e8a55ffe1a2b"}}]}]
BACKPORT-->

Co-authored-by: Chen Ashuri <chen.ashuri@elastic.co>
@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 v9.4.0 v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Entity maintainers are not initialized when enabling Entity Store in non-default Kibana space

5 participants