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] Live stream element dependency containers resolution fetching improvement (#6374) #6375

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

richard-julien
Copy link
Member

See #6374

@richard-julien richard-julien added the filigran team use to identify PR from the Filigran team label Mar 15, 2024
@richard-julien richard-julien self-assigned this Mar 15, 2024
Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 15.38462% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 66.76%. Comparing base (932c5d0) to head (02de8ad).

Files Patch % Lines
...tform/opencti-graphql/src/graphql/sseMiddleware.js 0.00% 10 Missing ⚠️
...raphql/src/utils/filtering/filtering-resolution.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6375      +/-   ##
==========================================
+ Coverage   66.74%   66.76%   +0.01%     
==========================================
  Files         541      541              
  Lines       64553    64542      -11     
  Branches     5306     5307       +1     
==========================================
+ Hits        43088    43091       +3     
+ Misses      21465    21451      -14     

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

Copy link
Member

@aHenryJard aHenryJard left a comment

Choose a reason for hiding this comment

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

Code looks good to me, however I'm not sure on how to test. Do you know if it's already covered by automated tests ?

orderBy: 'updated_at', // Get container by newly updated
orderMode: 'desc',
connectionFormat: false,
filters: {
Copy link
Member

Choose a reason for hiding this comment

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

couldn't we add streamFilters here to query only elements filtered by this stream ? we wouldn't even need to read the results, only count.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could and we should. Just commit a new approach following this remark. Thanks

if (after || before) {
const filtersContent = [];
if (after || before || extraFilters.length > 0) {
const filtersContent = [...extraFilters];
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit confused about this, how would it work with after and before ? I know in this current case extraFilters is not used with after or before, but what if it's used in the future ? what filter would it create ? would it be a "And" or "Or" condition between them ?

Copy link
Member Author

Choose a reason for hiding this comment

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

For now its a AND condition that feat the needs i needs. Don't want to complexify the options before having a real use case.

Copy link
Member

Choose a reason for hiding this comment

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

so it's an AND by default in filters ? I just find the code less easy to read when having an if condition between after before and extraFilters, since they are not related (after / before are related). I'm wondering if we really need this extraFilters param, couldn't we create the right FilterGroup object before calling this method ?

Copy link
Member Author

@richard-julien richard-julien Mar 18, 2024

Choose a reason for hiding this comment

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

Before and after are not directly related, thats extra options that can accumulate a first set of filters. Its a AND because these filters are use with

mode: FilterMode.And,
filters: filtersContent,

ExtraFilters options is the simplest way to add some filters at the firt level to accumulate with other options.

@aHenryJard aHenryJard self-requested a review March 18, 2024 13:51
@aHenryJard aHenryJard self-assigned this Mar 18, 2024
@richard-julien richard-julien added this to the Release 6.0.8 milestone Mar 18, 2024
@richard-julien richard-julien merged commit d857cc0 into master Mar 18, 2024
8 checks passed
@richard-julien richard-julien deleted the issue/6374 branch March 18, 2024 17:58
@richard-julien richard-julien added the solved use to identify issue that has been solved (must be linked to the solving PR) label Mar 18, 2024
@Kedae Kedae removed the solved use to identify issue that has been solved (must be linked to the solving PR) label Mar 19, 2024
@Kedae Kedae removed this from the Release 6.0.8 milestone Mar 19, 2024
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
Development

Successfully merging this pull request may close these issues.

4 participants