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

[backend] Share/unshare tasks should be done by creation date from olders to more recents to have correctly ordered stream events (#8843)(#9200)(#9371) #9394

Merged
merged 13 commits into from
Jan 16, 2025

Conversation

aHenryJard
Copy link
Member

@aHenryJard aHenryJard commented Dec 17, 2024

Proposed changes

  • add orderMode as parameter in task creation and use it when qureying elastic.
  • add an event on parent container at the end of sharing / unshare tasks
  • add try/catch on get file from storage issue

Other improvement:

  • change verbose log on xtm

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case (coverage and e2e)
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

@github-actions github-actions bot added the filigran team use to identify PR from the Filigran team label Dec 17, 2024
@aHenryJard aHenryJard changed the title Searching the way to send asc in tasks. Still WIP. [backend] Share/unshare tasks should be done by creation date from olders to more recents to have correctly ordered stream events Dec 19, 2024
@aHenryJard aHenryJard changed the title [backend] Share/unshare tasks should be done by creation date from olders to more recents to have correctly ordered stream events [backend] Share/unshare tasks should be done by creation date from olders to more recents to have correctly ordered stream events (#8843) Dec 19, 2024
@aHenryJard aHenryJard marked this pull request as ready for review December 19, 2024 08:49
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 58.13953% with 18 lines in your changes missing coverage. Please review.

Project coverage is 65.26%. Comparing base (dde5551) to head (f184a7d).
Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
...pencti-platform/opencti-graphql/src/domain/stix.js 40.00% 6 Missing ⚠️
...latform/opencti-graphql/src/manager/syncManager.js 0.00% 6 Missing ⚠️
...tform/opencti-graphql/src/domain/backgroundTask.js 57.14% 3 Missing ⚠️
...latform/opencti-graphql/src/manager/taskManager.js 88.23% 2 Missing ⚠️
...-platform/opencti-graphql/src/database/xtm-obas.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9394      +/-   ##
==========================================
+ Coverage   65.22%   65.26%   +0.03%     
==========================================
  Files         630      630              
  Lines       60199    60226      +27     
  Branches     6741     6752      +11     
==========================================
+ Hits        39267    39306      +39     
+ Misses      20932    20920      -12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aHenryJard aHenryJard marked this pull request as draft December 19, 2024 12:58
@aHenryJard aHenryJard changed the title [backend] Share/unshare tasks should be done by creation date from olders to more recents to have correctly ordered stream events (#8843) [backend] Share/unshare tasks should be done by creation date from olders to more recents to have correctly ordered stream events (#8843)(#9200)(#9371) Dec 26, 2024
@aHenryJard aHenryJard force-pushed the issue/8843 branch 2 times, most recently from 59ee949 to 2add871 Compare December 26, 2024 10:32
@richard-julien richard-julien force-pushed the master branch 5 times, most recently from b414944 to c7f4cb7 Compare January 13, 2025 09:27
@aHenryJard aHenryJard force-pushed the issue/8843 branch 2 times, most recently from 2f69a2b to 8e2e5e3 Compare January 13, 2025 09:56
}
const message = `Update ${organizationNames} children in \`Shared with\``;
const objectStoreBaseModified = { ...objectStoreBase, updated_at: utcDate() };
await storeUpdateEvent(context, user, objectStoreBase, objectStoreBaseModified, message, { allow_only_modified: true });
Copy link
Member

Choose a reason for hiding this comment

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

one thing I saw in my tests, is when I share a report that contains more than 500 objects, it will send this update event twice, because when we execute the query task, we paginate on 500 elements.
Also there is a '?' icon on the event displayed in the report history.

Capture d'écran 2025-01-16 161303

Copy link
Member

Choose a reason for hiding this comment

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

About the icon, I think you need to change "Update" for "updates" in the message to be consistant with "adds" / "replaces", ... and change this condition here:
image

@aHenryJard aHenryJard merged commit 1587c13 into master Jan 16, 2025
9 checks passed
@SouadHadjiat SouadHadjiat deleted the issue/8843 branch January 17, 2025 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filigran team use to identify PR from the Filigran team
Projects
None yet
4 participants