Add default ORDER BY id to Sequel model queries#5039
Open
philippthun wants to merge 1 commit intocloudfoundry:mainfrom
Open
Add default ORDER BY id to Sequel model queries#5039philippthun wants to merge 1 commit intocloudfoundry:mainfrom
philippthun wants to merge 1 commit intocloudfoundry:mainfrom
Conversation
5 tasks
75b7198 to
f39b294
Compare
johha
previously approved these changes
Apr 23, 2026
f39b294 to
eb79fd5
Compare
Adds a Sequel extension that hooks into fetch methods (all, each, first) to add ORDER BY id just before execution, ensuring deterministic query results for consistent API responses and reliable test behavior. Skips ordering when incompatible (GROUP BY, compounds, DISTINCT ON, from_self) or unnecessary (explicit ORDER BY, no id column). Remove now-redundant explicit order: :id from lifecycle data model associations. Consolidate diego/lrp_constants require into cloud_controller/diego/constants. Introduce lightweight_db_spec_helper for Sequel extension specs that only need a bare DB connection without the full app bootstrap. Extract DbConnectionString to share connection logic between DbConfig and the new helper. Switch default_order_by_id and query_length_logging specs to use it.
eb79fd5 to
c4ea2b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Sequel extension that hooks into fetch methods (
all,each,first) to addORDER BY idjust before execution, ensuring deterministic query results for consistent API responses and reliable test behavior.Skips ordering when incompatible (
GROUP BY, compounds,DISTINCT ON,from_self) or unnecessary (explicitORDER BY, noidcolumn).Remove now-redundant explicit
order: :idfrom lifecycle data model associations. Consolidatediego/lrp_constantsrequire intocloud_controller/diego/constants.Introduce
lightweight_db_spec_helperfor Sequel extension specs that only need a bare DB connection without the full app bootstrap. ExtractDbConnectionStringto share connection logic betweenDbConfigand thenew helper. Switch
default_order_by_idandquery_length_loggingspecs to use it.I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests