Skip to content

Fix dependency aggregation pagination when sorting by license

What does this MR do and why?

Fix dependency aggregation pagination when sorting by license

Keyset pagination uses relation[attribute_name] to get the value to insert into the cursor. When sorting by licenses, we want this to be the spdx_identifier but currently it is getting the entire licenses jsonb object. This causes a 500 error when trying to navigate to the second page while sorting by license. To fix this, we make the spdx_identifier available through the select statement as primary_license_spdx_identifier and we change the name of the ColumnOrderDefinition for licenses to this so that it will be inserted into the cursor.

This feature is currently behind a feature flag, so a changelog is not needed.

This change has no effect on the database query plan.

Before: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/29722/commands/92261

After: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/29722/commands/92262

Fixes: #470441 (closed)

MR acceptance checklist

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

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
Screen_Recording_2024-07-08_at_3.14.18_PM Screen_Recording_2024-07-08_at_3.13.24_PM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Enable rewrite_sbom_occurrences_query feature flag
  2. Go to the group dependency list
  3. Sort by "license"
  4. Go to the next page
  5. Success
Edited by Brian Williams

Merge request reports