Skip to content

Conversation

@austenstone
Copy link
Contributor

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

  • Fixed an off-by-one error in the pagination loop by changing the comparison from < to <=, ensuring the last page of artifacts is fetched.
  • Updated the calculation of maxNumberOfPages to use Math.ceil() for correct pagination when the artifact count is not a multiple of the page size.

Configurability Enhancements

  • Replaced the hardcoded artifact limit (1000) with a new getMaxArtifactListCount() function, allowing configuration via the ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT environment variable.
  • Improved warning messages to reflect the actual configured artifact limit, not just the default.

Testing Improvements

  • Added comprehensive tests for pagination across multiple pages and for respecting the ACTIONS_ARTIFACT_MAX_ARTIFACT_COUNT environment variable in artifact listing.
  • Added unit tests for getMaxArtifactListCount() to verify default behavior, environment variable overrides, and error handling for invalid values.

functionstackx and others added 3 commits October 16, 2025 23:13
- 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.
@austenstone austenstone requested a review from a team as a code owner October 21, 2025 13:32
Copilot AI review requested due to automatic review settings October 21, 2025 13:32
Copy link
Contributor

Copilot AI left a 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 maxNumberOfPages calculation using Math.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.

@functionstackx
Copy link
Contributor

Lgtm

@Link- Link- self-assigned this Oct 22, 2025
@austenstone austenstone marked this pull request as draft October 22, 2025 13:47
@Link- Link- marked this pull request as ready for review October 22, 2025 14:37
@Link- Link- merged commit 5b446d2 into actions:main Oct 24, 2025
15 of 17 checks passed
mwasilew added a commit to mwasilew/meta-qcom that referenced this pull request Nov 6, 2025
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]>
lumag added a commit to qualcomm-linux/meta-qcom that referenced this pull request Nov 7, 2025
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
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.

3 participants