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] Decode responses from the user actions service #157971

Merged
merged 17 commits into from
May 23, 2023

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented May 17, 2023

Summary

This PR decodes the response returned by the user actions service.

Depends on: #157858, #156622

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas 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.9.0 labels May 17, 2023
@cnasikas cnasikas self-assigned this May 17, 2023
@cnasikas cnasikas marked this pull request as ready for review May 18, 2023 07:00
@cnasikas cnasikas requested a review from a team as a code owner May 18, 2023 07:00
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

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

doc,
this.context.persistableStateAttachmentTypeRegistry
);

const decodeRes = decodeOrThrow(UserActionTransformedAttributesRt)(res.attributes);

const fieldsDoc = {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Should we start doing Object.assign?

@@ -1578,6 +1587,383 @@ describe('CaseUserActionService', () => {
]
`);
});

describe('Decode', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

In my opinion this seems like a lot of work to test the transform and decode logic. If you'd like to keep them that's fine. I feel like it'd be more straightforward and readable if we test the functionality directly rather than going through these top level functions 🤷‍♂️. I can see the benefit of exercising the whole flow but it seems like we have to mock a whole lot just to get to that point.

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 talked about it offline and we decide to leave the tests as it is.

};

const mockPointInTimeFinder = (soFindRes: SavedObjectsFindResponse) => {
// console.log(soFindRes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove the comment.

@cnasikas cnasikas enabled auto-merge (squash) May 23, 2023 19:24
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 399 403 +4
total +6

References to deprecated APIs

id before after diff
cases 59 13 -46

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 479 483 +4
total +6

History

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

cc @cnasikas

@cnasikas cnasikas merged commit 7e1ba84 into elastic:main May 23, 2023
@cnasikas cnasikas deleted the decode_user_actions branch May 23, 2023 20:29
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 23, 2023
delanni pushed a commit to delanni/kibana that referenced this pull request May 25, 2023
## Summary

This PR decodes the response returned by the user actions service.

Depends on: elastic#157858,
elastic#156622

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting 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.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants