-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: artifact pagination bugs and configurable artifact count limits #2165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Copilot <[email protected]>
- Fix off-by-one error in pagination loop (< to <=) that prevented fetching last page - Add Math.ceil() to maxNumberOfPages calculation for proper limit handling - Replace hardcoded 2000 limit with configurable getMaxArtifactListCount() - Add pagination test for multi-page artifact listing - Add environment variable test for ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT - Add comprehensive test coverage for getMaxArtifactListCount() function Fixes compound bug where pagination and limit logic capped results at 900 artifacts instead of intended 1000.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes critical pagination bugs in artifact listing and adds configurability for artifact count limits. The changes ensure all artifacts are fetched when paginating through results and allow users to override the default 1000-artifact limit via environment variable.
Key Changes:
- Fixed off-by-one error in pagination loop (changed
<to<=) to fetch the last page - Corrected
maxNumberOfPagescalculation usingMath.ceil()for proper rounding - Replaced hardcoded limit with configurable
getMaxArtifactListCount()function
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/artifact/src/internal/shared/config.ts | Adds new getMaxArtifactListCount() function to support configurable artifact limits via environment variable |
| packages/artifact/src/internal/find/list-artifacts.ts | Fixes pagination logic and replaces hardcoded artifact limit with configurable function |
| packages/artifact/tests/list-artifacts.test.ts | Adds comprehensive tests for multi-page pagination and environment variable override behavior |
| packages/artifact/tests/config.test.ts | Adds unit tests for getMaxArtifactListCount() covering default, override, and error cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Lgtm |
v6 release fixes an off-by-one bug when there are more than 100 artifacts to download. More details in actions/toolkit PR#2165 actions/toolkit#2165 The problem manifests as downloading only 100 artifacts when there are more than 100 and fewer than 200. As default page size is 100, only 1st page is retrieved. It affected test result reporting in meta-qcom Signed-off-by: Milosz Wasilewski <[email protected]>
v6 release fixes an off-by-one bug when there are more than 100 artifacts to download. More details in actions/toolkit PR#2165 actions/toolkit#2165 The problem manifests as downloading only 100 artifacts when there are more than 100 and fewer than 200. As default page size is 100, only 1st page is retrieved. It affected test result reporting in meta-qcom
This pull request addresses critical pagination bugs in artifact listing, improves configurability for artifact limits, and adds comprehensive test coverage to prevent regressions. The changes ensure that all intended artifacts are fetched and that environment variable overrides are respected.
Pagination and Limit Handling Improvements
<to<=, ensuring the last page of artifacts is fetched.maxNumberOfPagesto useMath.ceil()for correct pagination when the artifact count is not a multiple of the page size.Configurability Enhancements
getMaxArtifactListCount()function, allowing configuration via theACTIONS_ARTIFACT_MAX_ARTIFACT_COUNTenvironment variable.Testing Improvements
ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNTenvironment variable in artifact listing.getMaxArtifactListCount()to verify default behavior, environment variable overrides, and error handling for invalid values.