Skip to content

Entity store/entity maintainers min license#260170

Merged
chennn1990 merged 5 commits into
elastic:mainfrom
chennn1990:entity-store/entity-maintainers-min-license
Mar 30, 2026
Merged

Entity store/entity maintainers min license#260170
chennn1990 merged 5 commits into
elastic:mainfrom
chennn1990:entity-store/entity-maintainers-min-license

Conversation

@chennn1990
Copy link
Copy Markdown
Contributor

Summary

Entity Store entity maintainers now respect Kibana license tier at run time

  • Each maintainer can declare an optional minimum license
  • If the active license is not enough, that run is skipped and maintainer state is left unchanged
  • When no minimum is set, the framework uses the lowest tier so behavior matches a Basic-style default
  • License is evaluated when the task runs, so tier changes apply without restarting Kibana

The internal list-maintainers response includes the configured minimum license so callers can see requirements next to status

Duplicate common constants were consolidated so shared plugin constants live in one place for public code

Testing

  • Automated tests cover maintainer registration, license skip behavior, and list response shape for minimum license

How to verify

  • Run the entity maintainer unit tests
  • Run your usual repo change-validation checks

@chennn1990 chennn1990 self-assigned this Mar 29, 2026
@chennn1990 chennn1990 added the release_note:skip Skip the PR/issue when compiling release notes label Mar 29, 2026
@chennn1990 chennn1990 requested a review from a team as a code owner March 29, 2026 14:43
@chennn1990 chennn1990 added the backport:skip This PR does not require backporting label Mar 29, 2026
@chennn1990
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chennn1990 chennn1990 linked an issue Mar 29, 2026 that may be closed by this pull request
6 tasks
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Mar 29, 2026

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #5 / Entity Analytics - Risk Score Maintainer @ess @serverless @serverlessQA setup_and_status when entityAnalyticsEntityStoreV2 is true should setup risk score assets and configuration when entity store is enabled
  • [job] [logs] FTR Configs #66 / Entity Analytics - Risk Score Maintainer @ess @serverless @serverlessQA setup_and_status when entityAnalyticsEntityStoreV2 is true should setup risk score assets and configuration when entity store is enabled
  • [job] [logs] FTR Configs #66 / Entity Analytics - Risk Score Maintainer @ess @serverless @serverlessQA setup_and_status when entityAnalyticsEntityStoreV2 is true should setup risk score assets and configuration when entity store is enabled
  • [job] [logs] FTR Configs #5 / Entity Analytics - Risk Score Maintainer @ess @serverless @serverlessQA setup_and_status when entityAnalyticsEntityStoreV2 is true should setup risk score assets and configuration when entity store is enabled

History

cc @chennn1990

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 29, 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

Run ID: ed5cec1e-a9e9-4d48-9a4e-41e86f377b94

📥 Commits

Reviewing files that changed from the base of the PR and between ea737ef and 38fe6c6.

📒 Files selected for processing (17)
  • x-pack/solutions/security/plugins/entity_store/common/constants.ts
  • x-pack/solutions/security/plugins/entity_store/kibana.jsonc
  • x-pack/solutions/security/plugins/entity_store/moon.yml
  • x-pack/solutions/security/plugins/entity_store/public/bulk_update_entities_api.ts
  • 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/public/search_entities_api.ts
  • x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.test.ts
  • x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.ts
  • x-pack/solutions/security/plugins/entity_store/server/routes/apis/entity_maintainers/get_maintainers.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/entity_maintainers.test.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/entity_maintainers_registry.test.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/entity_maintainers_registry.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/index.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/types.ts
  • x-pack/solutions/security/plugins/entity_store/server/types.ts
  • x-pack/solutions/security/plugins/entity_store/tsconfig.json
💤 Files with no reviewable changes (1)
  • x-pack/solutions/security/plugins/entity_store/common/constants.ts

📝 Walkthrough

Walkthrough

The pull request consolidates the entity_store plugin by removing the constants.ts file and relocating its exports to the common module, updating all import references accordingly. It introduces licensing integration through a new required dependency on the licensing plugin. Entity maintainer tasks gain a minLicense field with gating logic that enforces license validation at runtime, defaulting to 'basic' level. The API_VERSIONS, ENTITY_STORE_ROUTES, and related constants are now centralized in the common module, reducing code fragmentation.

✨ 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 Mar 29, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 29, 2026

📝 Walkthrough

Walkthrough

This pull request implements license-gating for entity maintainer tasks in the Entity Store plugin. The licensing plugin is added as a required dependency. A constants file is removed, with its exports relocated to the common directory. The entity maintainer configuration is extended with a minLicense field (defaults to 'basic'). During task execution, the system checks the license state and skips task runs if the license is invalid. Type definitions across registry, task, and API layers are updated to carry the minLicense metadata. Related TypeScript and build configurations are updated to reference licensing types.

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

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.test.ts (1)

17-23: ⚠️ Potential issue | 🟠 Major

Mock missing DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE — tests pass incorrectly.

The mock factory completely replaces the module, so the import on line 13 resolves to undefined. All assertions using minLicense: DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE are actually testing minLicense: undefined.

Proposed fix
 jest.mock('../../tasks/entity_maintainers', () => ({
+  DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE: 'basic',
   getTaskId: jest.fn((id: string, namespace: string) => `${id}:${namespace}`),
   removeEntityMaintainer: jest.fn().mockResolvedValue(undefined),
   scheduleEntityMaintainerTask: jest.fn().mockResolvedValue(undefined),
   startEntityMaintainer: jest.fn().mockResolvedValue(undefined),
   stopEntityMaintainer: jest.fn().mockResolvedValue(undefined),
 }));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.test.ts`
around lines 17 - 23, The mock currently fully replaces the entity_maintainers
module so DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE becomes undefined in tests;
update the jest.mock call to preserve or re-export
DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE (e.g., use
jest.requireActual('../../tasks/entity_maintainers') and spread its exports,
then override only getTaskId, removeEntityMaintainer,
scheduleEntityMaintainerTask, startEntityMaintainer, and stopEntityMaintainer)
so tests see the real DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE value while the
listed functions remain mocked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.test.ts`:
- Around line 17-23: The mock currently fully replaces the entity_maintainers
module so DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE becomes undefined in tests;
update the jest.mock call to preserve or re-export
DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE (e.g., use
jest.requireActual('../../tasks/entity_maintainers') and spread its exports,
then override only getTaskId, removeEntityMaintainer,
scheduleEntityMaintainerTask, startEntityMaintainer, and stopEntityMaintainer)
so tests see the real DEFAULT_ENTITY_MAINTAINER_MIN_LICENSE value while the
listed functions remain mocked.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: 8aa248dd-962c-4ee9-9699-ceb295a55b70

📥 Commits

Reviewing files that changed from the base of the PR and between ea737ef and 38fe6c6.

📒 Files selected for processing (17)
  • x-pack/solutions/security/plugins/entity_store/common/constants.ts
  • x-pack/solutions/security/plugins/entity_store/kibana.jsonc
  • x-pack/solutions/security/plugins/entity_store/moon.yml
  • x-pack/solutions/security/plugins/entity_store/public/bulk_update_entities_api.ts
  • 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/public/search_entities_api.ts
  • x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.test.ts
  • x-pack/solutions/security/plugins/entity_store/server/domain/entity_maintainers/entity_maintainers_client.ts
  • x-pack/solutions/security/plugins/entity_store/server/routes/apis/entity_maintainers/get_maintainers.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/entity_maintainers.test.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/entity_maintainers_registry.test.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/entity_maintainers_registry.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/index.ts
  • x-pack/solutions/security/plugins/entity_store/server/tasks/entity_maintainers/types.ts
  • x-pack/solutions/security/plugins/entity_store/server/types.ts
  • x-pack/solutions/security/plugins/entity_store/tsconfig.json
💤 Files with no reviewable changes (1)
  • x-pack/solutions/security/plugins/entity_store/common/constants.ts

@uri-weisman
Copy link
Copy Markdown
Contributor

@maxcold FYI.
Don't know if you already started to handle the license check, we might be able to push it before.

Copy link
Copy Markdown
Member

@kubasobon kubasobon left a comment

Choose a reason for hiding this comment

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

LGTM

import { useEffect } from 'react';
import { EntityStoreStatus } from '../../common';
import { ENTITY_STORE_ROUTES, FF_ENABLE_ENTITY_STORE_V2 } from '../../common/constants';
import { ENTITY_STORE_ROUTES, FF_ENABLE_ENTITY_STORE_V2 } from '../../common';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice 👍

@maxcold
Copy link
Copy Markdown
Contributor

maxcold commented Mar 30, 2026

@uri-weisman awesome news, will keep an eye on this PR!

@chennn1990 chennn1990 merged commit 92e1dd1 into elastic:main Mar 30, 2026
18 checks passed
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
## Summary

Entity Store entity maintainers now respect Kibana license tier at run
time

- Each maintainer can declare an optional minimum license
- If the active license is not enough, that run is skipped and
maintainer state is left unchanged
- When no minimum is set, the framework uses the lowest tier so behavior
matches a Basic-style default
- License is evaluated when the task runs, so tier changes apply without
restarting Kibana

The internal list-maintainers response includes the configured minimum
license so callers can see requirements next to status

Duplicate common constants were consolidated so shared plugin constants
live in one place for public code

## Testing

- Automated tests cover maintainer registration, license skip behavior,
and list response shape for minimum license

## How to verify

- Run the entity maintainer unit tests
- Run your usual repo change-validation checks

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
## Summary

Entity Store entity maintainers now respect Kibana license tier at run
time

- Each maintainer can declare an optional minimum license
- If the active license is not enough, that run is skipped and
maintainer state is left unchanged
- When no minimum is set, the framework uses the lowest tier so behavior
matches a Basic-style default
- License is evaluated when the task runs, so tier changes apply without
restarting Kibana

The internal list-maintainers response includes the configured minimum
license so callers can see requirements next to status

Duplicate common constants were consolidated so shared plugin constants
live in one place for public code

## Testing

- Automated tests cover maintainer registration, license skip behavior,
and list response shape for minimum license

## How to verify

- Run the entity maintainer unit tests
- Run your usual repo change-validation checks

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add license granularity to Entity Maintainers execution

6 participants