Skip to content

Enable filtering by parent epic reference in GLQL

New Proposal

Support epic filter that takes in a reference containing project / group / namespace path and an IID in GLQL.

It should work like epic = 'project/path#34' where project/path is the project path and #34 is the IID of the object. The parent can be an epic, an issue or an objective. An epic can have other epics and issues as children, an issue can have tasks as its children and an objective can have key results as its children.

Expand old proposal

Currently ( gitlab-query-language%"0.0.5-rc1" ) epic is not implemented optimally.

Firstly, epic = n is broken for all uses of numbers (or numbers as strings)

  • epic = 1
  • epic = "1"

This is captured in task:

However, the bigger issue is that this expects an id and not an iid or reference. id is rarely exposed to the user, and there is currently no easy way to retrieve it.

Once we release GLQL it's a breaking change to reverse the decision to use epic = id so we should consider it carefully

iid is only guaranteed to be unique on the (top-level?) group level, so a query without a group or project specified would be ambiguous.

Proposals

  1. Continue supporting id but expose it to the user in the table or list so they can expose it with an epic wildcard and use it.
  2. Support gid (gid://gitlab/Epic/2211441) as an more specific id. This has the benefit of being a String, so it's not a breaking change to change it in future.
    1. So the steps would look like:

      • Add epicIid as a filterable attribute to group issues GraphQL API operation (and possibly finder also)
      • Add epicIid as a filterable attribute to project issues GraphQL API operation (and possibly finder also)
      • Alias epic in GLQL to epicIid when supplied with a number or string and target is graphql (`_components`)
      • Update semantic analyser to reject queries with epic but no scope

      Optional:

      • Add epic_iid as a filterable attribute to issue list group and project issue list params
      • Alias epic in GLQL to epic_iid when supplied with a number or string and target is url_params
  3. Support iid but require that people include the group parameter. Requires an update to GraphQL so pushes the timeline out another milestone. Also requires an update to the language to force group and possibly anticipate group from project, if given that scope.
Edited by Himanshu Kapoor