Skip to content

fix: add pagination to artifact_storage.py list_all and API - #107

Open
nathanm82 wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
nathanm82:fix/artifact-storage-pagination
Open

fix: add pagination to artifact_storage.py list_all and API#107
nathanm82 wants to merge 1 commit into
OpenNSWM-Lab:mainfrom
nathanm82:fix/artifact-storage-pagination

Conversation

@nathanm82

Copy link
Copy Markdown

The GET /api/v1/artifacts endpoint 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) and offset (default 0) query parameters to the API endpoint, propagated through the service layer to the storage methods list_all and list_by_run. Pagination is applied via list slicing after sorting by createdAt descending.

Files changed:

  • backend/app/storage/artifact_storage.pylist_all(limit, offset) and list_by_run(runId, limit, offset)
  • backend/app/services/artifact_service.pylist_artifacts(runId, limit, offset)
  • backend/app/modules/platform/artifacts_api.pylimit and offset query params with validation

Backwards compatible: callers that do not pass pagination parameters get the first 100 results (same behavior as before for small datasets, bounded for large ones).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant