Skip to content

Order duplicated push rules by id to return consistent results

What does this MR do and why?

Contributes to #493391

Problem

Projects with duplicate push rules return inconsistent records when accessing project.push_rule, causing unpredictable behavior across different requests. This happens because the database query doesn't specify an order, leading to random selection of push rules.

Solution

Introduces the push_rule_ordered_by_id feature flag that orders push rules by ID when enabled.

This ensures the push rule with the lowest ID (first created) is consistently returned for projects with duplicates, providing deterministic behavior.

References

Push rules: add a unique index by project_id (#493391)

Edited by Vasilii Iakliushin

Merge request reports

Loading