Expose comment field on Vulnerability GraphQL type, attempt 2
What does this MR do and why?
!109661 (merged) was reverted due to performance problems (see #389497 (comment 1254563251)).
This MR attempts to solve those problems
Database review
Queries added
SELECT "vulnerability_state_transitions".* FROM "vulnerability_state_transitions" WHERE "vulnerability_state_transitions"."vulnerability_id" IN (712, 711, 710, 709, 708, 655, 654, 653, 652, 642, 641, 628, 581, 576, 574, 565, 699, 669, 660, 645, 637, 636, 632, 631, 630, 629, 625, 623, 617, 615, 612, 611, 608, 607, 606, 601, 600, 599, 597, 596, 595, 594, 592, 590, 589, 588, 586, 584, 578, 575, 571, 570, 563, 560, 559, 557, 556, 555, 553, 552, 551, 546, 545, 544, 543, 542, 713, 707, 706, 705, 704, 703, 702, 701, 700, 698, 697, 696, 695, 694, 693, 692, 691, 690, 688, 687, 685, 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, 671)
Query plan: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/14940/commands/52069
How to set up and validate locally
- Checkout this branch
- Set up a project with Vulnerabilities
- Dismiss one Vulnerability using the following GraphQL mutation
mutation {
vulnerabilityDismiss(input: { id: "gid://gitlab/Vulnerability/VULN_ID_HERE",
comment: "test comment gql"
})
{
vulnerability {
id
comment
state
dismissedAt
dismissedBy{
id
}
}
}
}
- Update the
Vulnerabilties::StateTransition#commentso it's easier to see the result
st = Vulnerabilities::StateTransition.where(vulnerability_id: VULN_ID_HERE).last
st.update(comment: "TEST STATETRANSITIONS COMMENT")
- You can verify it's different from
Vulnerabilties::Feedback#commentwith
Vulnerability.find(VULN_ID_HERE).finding.feedbacks.last.comment # comment should be `test comment gql`.
Vulnerability.find(VULN_ID_HERE).state_transitions.last.comment # comment should be `TEST STATETRANSITIONS COMMENT`
- Issue the following GraphQL
query {
project(fullPath:"root/security-reports") {
vulnerabilities {
nodes {
id
stateComment
}
}
}
}
-
stateCommentshould betest comment gql -
Feature.enable(:deprecate_vulnerabilities_feedback)in Rails console - Reissue the query from step 6.
-
stateCommentshould beTEST STATETRANSITIONS COMMENT
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #388452 (closed)