Limit the merge requests that MergeRequest.stack returns in a request

What does this merge request do and why?

MergeRequest.stack returns up to 20 merge requests. Lists, nested stack fields and aliases repeat that many times in one request at almost no complexity cost, because the field is a plain list, and each returned merge request resolves its own fields.

Resolvers::MergeRequests::StackResolver now counts the merge requests that all stack fields return in one request, multiplexed queries included, and returns a LimitError above 420. That still allows one full stack listed with the stack of every member (20 + 20 x 20), and the web stack widget selects stack once. A field that finds no stack counts as one, because it still runs StackFinder, so the limit also bounds the number of finder calls. The total for each query is logged as graphql_stack_nodes through a small log_fields hook in InstrumentationTracer, next to graphql_connection_nodes, so the limit can be lowered later from real data.

References

https://gitlab.com/gitlab-org/gitlab/-/work_items/635096

Screenshots or screen recordings

Before After

Merge request acceptance checklist

Evaluate this merge request against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Phil Hughes

Merge request reports

Loading
Loading