refactor(metastore): order resources returned by age#904
Merged
Conversation
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
michael-johnston
approved these changes
Apr 23, 2026
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.
Summary
This PR adds sorting functionality to the
getResourcesmethod inSQLResourceStoreto return resources ordered by theircreatedtimestamp in ascending order (oldest first). This change ensures consistency with the AGE sorting behavior used in CLI commands.Resolve #902 with a bit of a hack. Proper rework of metastore methods will be delegated to #903
Files Changed
📄
orchestrator/metastore/sqlstore.pyUpdated the
getResourcesmethod to sort the returned dictionary by thecreatedtimestamp of each resource in ascending order. The method now returns resources ordered from oldest to newest, matching the AGE sorting behavior used in CLI commands. Documentation was also enhanced to clearly describe this sorting behavior.📄
tests/metastore/test_resourcestore.pyAdded a new test
test_get_resources_sorted_by_created_ascendingto verify that thegetResourcesmethod correctly returns resources sorted by theircreatedtimestamp in ascending order. The test creates three resources with explicit timestamps, retrieves them, and validates that they are returned in the correct chronological order (oldest first).