Skip to content

Fix keyset pagination for dependency aggregations

What does this MR do and why?

Fix two issues with keyset pagination on the dependency list.

  1. All columns in the cursor need to be returned in the select statement
  2. arel_table needs to be used for column_expression to ensure that values are correctly serialized
[7] pry(main)> column_definition = Arel.sql("outer_occurrences.highest_severity")
=> "outer_occurrences.highest_severity"
[8] pry(main)> column_definition.gt('low').to_sql
=> "outer_occurrences.highest_severity > 'low'"
[10] pry(main)> column_definition = Sbom::Occurrence.arel_table.alias('outer_occurrences')[:highest_severity]
[11] pry(main)> column_definition.gt('low').to_sql
=> "\"outer_occurrences\".\"highest_severity\" > 4"

This change is currently behind a feature flag named rewrite_sbom_occurrences_query.

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

How to set up and validate locally

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

When testing locally, this still appears to be broken because there is a frontend bug which also needs to be fixed. RSpec tests have been updated to verify correct backend behavior.

Edited by Brian Williams

Merge request reports