Force the ordering in the package files API
Follow up of !69223 (comment 674413174).
🔥 Problem
The package files API uses package.package_files
. That call is lacking of any order.
As such, the ordering is left to the database which will, basically choose the most efficient way to return the package files whatever the order.
The issue is that specs expect a really specific order: https://gitlab.com/gitlab-org/gitlab/-/blob/342186c727e5554e67cd57e38046a2a5b3dde23e/spec/requests/api/package_files_spec.rb#L67
🚒 Solution
- Consider including https://gitlab.com/gitlab-org/gitlab/-/blob/342186c727e5554e67cd57e38046a2a5b3dde23e/app/models/concerns/sortable.rb in the package file model
- Use the
order_id_asc
scope