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

[Cases] Limit the number of attachments that can be added to a case simultaneously #161250

Closed
wants to merge 9 commits into from

Conversation

adcoelho
Copy link
Contributor

@adcoelho adcoelho commented Jul 5, 2023

Connected to #146945

Summary

I tried to create the tests following what we discussed offline.

  • Tests for every scenario covered by BulkCreateCommentRequestRt in x-pack/plugins/cases/common/api/cases/comment/index.test.ts
  • One client test to make sure BulkCreateCommentRequestRt is used by bulkCreate
  • One integration test to tie everything together
Description Limit Done? Documented?
Total number of attachments added at the same time on a case 100 No(internal)
  • Also changed the minimum of cases that can be updated to 1.

Checklist

Delete any items that are not applicable to this PR.

@adcoelho adcoelho changed the title Limit number of attachments that can be added simultaneously. [Cases] Limit the number of attachments that can be added to a case simultaneously Jul 5, 2023
@adcoelho adcoelho self-assigned this Jul 5, 2023
@adcoelho adcoelho added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.10.0 labels Jul 5, 2023
@adcoelho adcoelho marked this pull request as ready for review July 5, 2023 16:41
@adcoelho adcoelho requested review from a team as code owners July 5, 2023 16:41
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

@@ -218,17 +210,6 @@ export default ({ getService }: FtrProviderContext): void => {
});
});

it('should bulk create 100 file attachments when there is another attachment type in the request', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Do you remember why we had the test in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really 😄 @jonathan-buttner ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah so I think the file attachment code limits how many files can be attached to a case to 100, what this test was covering is that the code only counts file attachments and would ignore a different type of attachment when doing the counting.

Maybe we don't need it anymore if we're limiting the total attachments in a single request to 100 🤷‍♂️

https://github.com/elastic/kibana/blob/main/x-pack/plugins/cases/server/common/limiter_checker/limiters/files.ts#L15

I think we have some unit test coverage there too so we're probably ok.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, Jonathan. It seems it is covered by the unit tests.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 421.9KB 421.9KB +2.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cases 146.1KB 146.1KB +84.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 408 412 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 487 491 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @adcoelho

@adcoelho adcoelho closed this Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants