Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with duplicate references in error object when copying saved objects to space #200053

Conversation

SiddharthMantri
Copy link
Contributor

@SiddharthMantri SiddharthMantri commented Nov 13, 2024

Closes #158027

Summary

Simply dedupes references to objects if they are part of the missing_references in the copy saved objects to SO endpoint

Notes

  • Update forEach over SOs to a regular for loop since we had a couple of early exit scenarios
  • Checks against the set for references already added to the missing list and adds only if not present

Old response: Note the duplicate references

Screenshot 2024-11-14 at 01 52 54

New response

Screenshot 2024-11-14 at 01 50 41

Release note

Dedupe results from copy saved objects to spaces API when object contains references to other objects.

@SiddharthMantri SiddharthMantri marked this pull request as ready for review November 13, 2024 21:12
@SiddharthMantri SiddharthMantri requested a review from a team as a code owner November 13, 2024 21:12
@SiddharthMantri SiddharthMantri requested a review from a team November 13, 2024 21:12
@SiddharthMantri SiddharthMantri added bug Fixes for quality problems that affect the customer experience Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! Feature:Saved Objects labels Nov 13, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@SiddharthMantri SiddharthMantri added backport backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) and removed backport labels Nov 14, 2024
@SiddharthMantri
Copy link
Contributor Author

@elasticmachine merge upstream

@jeramysoucy jeramysoucy self-requested a review November 14, 2024 07:19
Copy link
Contributor

@jeramysoucy jeramysoucy left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this one, Sid! Works as expected. Just left a nit from the original implementation. And I like your idea of adding a new integration test.

// skip objects with retries that have specified `ignoreMissingReferences`
return;
continue;
}

const missingReferences = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Retro nit: I know this was here before, but we should give this a type rather than default to any[]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in: 5544b88

@jeramysoucy
Copy link
Contributor

@SiddharthMantri Should we backport to prev major to get this into 8.17?

@SiddharthMantri
Copy link
Contributor Author

@SiddharthMantri Should we backport to prev major to get this into 8.17?

Oh yeah, i keep forgetting main goes to 9.0. Yes, I've added the label for 8.17, thank you!

@SiddharthMantri SiddharthMantri added backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development v8.17.0 labels Nov 14, 2024
Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Overall LGTM, would be nice to add a case to the existing unit test for this dedupe behaviour

packages/core/saved-objects/core-saved-objects-import-export-server-internal/src/import/lib/validate_references.test.ts

@jeramysoucy
Copy link
Contributor

jeramysoucy commented Nov 18, 2024

Overall LGTM, would be nice to add a case to the existing unit test for this dedupe behaviour

+1 for adding a unit test. If an integration test is overkill/too complicated to add, just having a unit test is probably enough.

@SiddharthMantri
Copy link
Contributor Author

@elasticmachine merge upstream

@SiddharthMantri SiddharthMantri enabled auto-merge (squash) November 18, 2024 13:55
@SiddharthMantri SiddharthMantri merged commit 262b48f into elastic:main Nov 18, 2024
23 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.16, 8.x

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

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2024
…d objects to space (elastic#200053)

Closes elastic#158027

## Summary

Simply dedupes references to objects if they are part of the
missing_references in the copy saved objects to SO endpoint

### Notes
- Update forEach over SOs to a regular for loop since we had a couple of
early exit scenarios
- Checks against the set for references already added to the missing
list and adds only if not present

------

**Old response: Note the duplicate references**

<img width="400" alt="Screenshot 2024-11-14 at 01 52 54"
src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4">

**New response**

<img width="800" alt="Screenshot 2024-11-14 at 01 50 41"
src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9">

### Release note
Dedupe results from copy saved objects to spaces API when object
contains references to other objects.

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 262b48f)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2024
…d objects to space (elastic#200053)

Closes elastic#158027

## Summary

Simply dedupes references to objects if they are part of the
missing_references in the copy saved objects to SO endpoint

### Notes
- Update forEach over SOs to a regular for loop since we had a couple of
early exit scenarios
- Checks against the set for references already added to the missing
list and adds only if not present

------

**Old response: Note the duplicate references**

<img width="400" alt="Screenshot 2024-11-14 at 01 52 54"
src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4">

**New response**

<img width="800" alt="Screenshot 2024-11-14 at 01 50 41"
src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9">

### Release note
Dedupe results from copy saved objects to spaces API when object
contains references to other objects.

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 262b48f)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 18, 2024
…d objects to space (elastic#200053)

Closes elastic#158027

## Summary

Simply dedupes references to objects if they are part of the
missing_references in the copy saved objects to SO endpoint

### Notes
- Update forEach over SOs to a regular for loop since we had a couple of
early exit scenarios
- Checks against the set for references already added to the missing
list and adds only if not present

------

**Old response: Note the duplicate references**

<img width="400" alt="Screenshot 2024-11-14 at 01 52 54"
src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4">

**New response**

<img width="800" alt="Screenshot 2024-11-14 at 01 50 41"
src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9">

### Release note
Dedupe results from copy saved objects to spaces API when object
contains references to other objects.

---------

Co-authored-by: Elastic Machine <[email protected]>
(cherry picked from commit 262b48f)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.16
8.x

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

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 18, 2024
…ng saved objects to space (#200053) (#200599)

# Backport

This will backport the following commits from `main` to `8.15`:
- [Fix issue with duplicate references in error object when copying
saved objects to space
(#200053)](#200053)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT
[{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved
Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix
issue with duplicate references in error object when copying saved
objects to
space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sid <[email protected]>
kibanamachine added a commit that referenced this pull request Nov 18, 2024
…ng saved objects to space (#200053) (#200600)

# Backport

This will backport the following commits from `main` to `8.16`:
- [Fix issue with duplicate references in error object when copying
saved objects to space
(#200053)](#200053)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT
[{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved
Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix
issue with duplicate references in error object when copying saved
objects to
space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sid <[email protected]>
kibanamachine added a commit that referenced this pull request Nov 18, 2024
…g saved objects to space (#200053) (#200601)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Fix issue with duplicate references in error object when copying
saved objects to space
(#200053)](#200053)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT
[{"author":{"name":"Sid","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved
Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix
issue with duplicate references in error object when copying saved
objects to
space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sid <[email protected]>
jesuswr pushed a commit to jesuswr/kibana that referenced this pull request Nov 18, 2024
…d objects to space (elastic#200053)

Closes elastic#158027

## Summary

Simply dedupes references to objects if they are part of the
missing_references in the copy saved objects to SO endpoint

### Notes
- Update forEach over SOs to a regular for loop since we had a couple of
early exit scenarios
- Checks against the set for references already added to the missing
list and adds only if not present

------

**Old response: Note the duplicate references**

<img width="400" alt="Screenshot 2024-11-14 at 01 52 54"
src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4">


**New response**

<img width="800" alt="Screenshot 2024-11-14 at 01 50 41"
src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9">


### Release note
Dedupe results from copy saved objects to spaces API when object
contains references to other objects.

---------

Co-authored-by: Elastic Machine <[email protected]>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…d objects to space (elastic#200053)

Closes elastic#158027

## Summary

Simply dedupes references to objects if they are part of the
missing_references in the copy saved objects to SO endpoint

### Notes
- Update forEach over SOs to a regular for loop since we had a couple of
early exit scenarios
- Checks against the set for references already added to the missing
list and adds only if not present

------

**Old response: Note the duplicate references**

<img width="400" alt="Screenshot 2024-11-14 at 01 52 54"
src="https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4">


**New response**

<img width="800" alt="Screenshot 2024-11-14 at 01 50 41"
src="https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9">


### Release note
Dedupe results from copy saved objects to spaces API when object
contains references to other objects.

---------

Co-authored-by: Elastic Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) bug Fixes for quality problems that affect the customer experience Feature:Saved Objects release_note:fix Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.15.5 v8.16.1 v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicates of missing references in _copy_saved_objects API response
5 participants