Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Add a tiebreaker so sorts are deterministic on equal keys
When the sort key can repeat (name, count), rows with equal keys can come back in any order across queries; add a stable secondary key (e.g. id) so order is deterministic.
Bad example
| 1 | ORDER BY name |
Explanation (EN)
Rows with equal sort values can move between pages or repeated requests without a deterministic secondary key.
Objašnjenje (HR)
Good example
| 1 | ORDER BY name, id |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For paginated or externally consumed ordering with duplicate primary sort values, add a stable unique tie-breaker and use the same ordering in cursor predicates.
Exceptions / Tradeoffs (EN)
Do not silently change a contractual ordering or use an unstable/random tie-breaker.