fix: add pagination to artifact_storage.py list_all and API - #107
Open
nathanm82 wants to merge 1 commit into
Open
fix: add pagination to artifact_storage.py list_all and API#107nathanm82 wants to merge 1 commit into
nathanm82 wants to merge 1 commit into
Conversation
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.
The
GET /api/v1/artifactsendpoint and underlying storage layer load every artifact JSON file from disk with no pagination. As artifacts accumulate (one per publish operation), response latency grows unboundedly.Added
limit(default 100, max 1000) andoffset(default 0) query parameters to the API endpoint, propagated through the service layer to the storage methodslist_allandlist_by_run. Pagination is applied via list slicing after sorting bycreatedAtdescending.Files changed:
backend/app/storage/artifact_storage.py—list_all(limit, offset)andlist_by_run(runId, limit, offset)backend/app/services/artifact_service.py—list_artifacts(runId, limit, offset)backend/app/modules/platform/artifacts_api.py—limitandoffsetquery params with validationBackwards compatible: callers that do not pass pagination parameters get the first 100 results (same behavior as before for small datasets, bounded for large ones).