[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy#250971
[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy#250971
Conversation
|
Pinging @elastic/fleet (Team:Fleet) |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
History
cc @nchaulet |
Supplementing
left a comment
There was a problem hiding this comment.
One small question, but otherwise, LGTM 🚀
| ...copyPackagePolicy(packagePolicy), | ||
| name: await incrementPackagePolicyCopyName(soClient, packagePolicy.name), | ||
| }; | ||
| } as NewPackagePolicy & { id: undefined }; |
There was a problem hiding this comment.
Sniff test, should we use a partial or consider updating the type so we dont have to do this cast here?
There was a problem hiding this comment.
Good call, I consider updating the type, but it started to be a lot of changes around and as it's a bug fix that will be back-ported it seems it's adding a lot to manage.
|
Starting backport for target branches: 9.2, 9.3 |
💔 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 |
…gent policy (elastic#250971) (cherry picked from commit cdd9192) # Conflicts: # x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/copy_package_policy_page/index.tsx # x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/components/layout.tsx # x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/single_page_layout/hooks/form.tsx # x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/create_package_policy_page/types.ts
…r an agent policy (#250971) (#251127) # Backport This will backport the following commits from `main` to `9.3`: - [[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)](#250971) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nicolas Chaulet","email":"nicolas.chaulet@elastic.co"},"sourceCommit":{"committedDate":"2026-01-30T17:59:55Z","message":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)","sha":"cdd919287fc5c989c3ac74a18ee2ff5c79d6bde2","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:version","v9.4.0","v9.2.5","v9.3.1"],"title":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy","number":250971,"url":"https://github.com/elastic/kibana/pull/250971","mergeCommit":{"message":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)","sha":"cdd919287fc5c989c3ac74a18ee2ff5c79d6bde2"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/250971","number":250971,"mergeCommit":{"message":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)","sha":"cdd919287fc5c989c3ac74a18ee2ff5c79d6bde2"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
…r an agent policy (#250971) (#251128) # Backport This will backport the following commits from `main` to `9.2`: - [[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)](#250971) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Nicolas Chaulet","email":"nicolas.chaulet@elastic.co"},"sourceCommit":{"committedDate":"2026-01-30T17:59:55Z","message":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)","sha":"cdd919287fc5c989c3ac74a18ee2ff5c79d6bde2","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:version","v9.4.0","v9.2.5","v9.3.1"],"title":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy","number":250971,"url":"https://github.com/elastic/kibana/pull/250971","mergeCommit":{"message":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)","sha":"cdd919287fc5c989c3ac74a18ee2ff5c79d6bde2"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/250971","number":250971,"mergeCommit":{"message":"[Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (#250971)","sha":"cdd919287fc5c989c3ac74a18ee2ff5c79d6bde2"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
…iew_cps * commit '32efd9b2fb078ade51073fd2d0068bc74c029d6b': (49 commits) [Security Solution] Rules exceptions subfeatures (elastic#245722) [BK] Upgrade axios (elastic#251150) Fix AI Connector form fields resetting to default value when cleared by user (elastic#251095) deduplicate otel dependencies (elastic#250841) Adds initial agents.md file (elastic#250833) [index management] Faster index list loading (elastic#246276) skip failing test suite (elastic#251086) skip failing test suite (elastic#251048) [Security Solutions] Trial Companion - adjust UX design (elastic#250910) [Traces][Discover] Prevent flyout remount when switching document types in Trace Waterfall (elastic#250406) [DOCS][Cases][9.4 & Serverless]: Doc new `Maximum amount of cases to open` setting for case action (elastic#250993) [Discover][Traces] Explore trace.id from logs in Discover (elastic#249632) Remove ! from SOs docs link (elastic#251097) [ML] Maps: Add telemetry events for file uploads (elastic#247543) [Fleet] Fix dupplicate ids when copying an integration policy or an agent policy (elastic#250971) [Dashboards as Code] Add snake case object keys util (elastic#250962) [Core] Remove URL Overflow & Deprecate `storeInSessionStorage` setting (elastic#242972) [One Workflow] fix: Fix Variable Retrieval in Workflow Execution Engine (elastic#250852) Rework Elastic Managed LLMs page (elastic#251069) [Lens powered by ES|QL] Update Switch to Query mode modal warning message (elastic#251051) ...
Summary
Related to #249592
The newly introducing copy an integration is copying input/streams id creating duplicate ids, that PR fix that by removing the ids when creating the policy.
We found similar issue for copied package policies from copy agent policy feature #250978, that PR fix it too
Tests
I updated the types, to a type
NewPackagePolicythat would have catch that issue.You can test this by copying a package policy and verifying the resulting ids are different.