Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

Search queries were only returning the first page of results. OData feeds include <link rel="next"> elements with $skiptoken parameters for pagination, but these were being ignored.

Changes

  • choco/client.py: Modified search() to follow pagination links until exhausted

    • Extract href from <link rel="next"> elements in feed XML
    • Loop fetching pages with validation that href is a string
    • Deduplicate results across pages using existing entry ID dictionary
  • tests/test_search.py: Added pagination test and updated existing test to mock next page URL

Example

Before: Search returns 30 results (first page only)

client.search('chrome', all_versions=True, exact=True)
# Returns: 30 entries (incomplete)

After: Search returns all results across pages

client.search('chrome', all_versions=True, exact=True)  
# Returns: 150 entries (complete, across 5 pages)

Works with all search modes (exact, by_id_only, by_tag_only, id_starts_with) and both /Packages() and /FindPackagesById() endpoints.

Original prompt

This section details on the original issue you should resolve

<issue_title>client.py:130: pagination support</issue_title>
<issue_description>In both cases, pagination is not implemented. For non-exact, multiple calls to FindPackagesById() are necessary with every package found. For exact, $skiptoken must be used to paginate.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add pagination support for FindPackagesById calls Add pagination support for OData feed responses Nov 10, 2025
Copilot AI requested a review from Tatsh November 10, 2025 13:05
Copilot finished work on behalf of Tatsh November 10, 2025 13:05
@coveralls
Copy link

coveralls commented Nov 10, 2025

Pull Request Test Coverage Report for Build 19245068363

Details

  • 36 of 36 (100.0%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 19221517849: 0.0%
Covered Lines: 548
Relevant Lines: 548

💛 - Coveralls

Co-authored-by: Tatsh <724848+Tatsh@users.noreply.github.com>
@Tatsh Tatsh force-pushed the copilot/add-pagination-support branch 2 times, most recently from 5d947d1 to b15d444 Compare November 10, 2025 20:11
@Tatsh Tatsh marked this pull request as ready for review November 10, 2025 20:13
Fix search tests to use correct API endpoints and improve parameterisation.

- Updated API endpoint URLs in search tests to use '/api/v2/' path.
- Added parameterization for search tests to reduce code duplication.
- Enhanced test for handling pagination and error scenarios in XML responses.
- Ensured consistent query string formatting across tests.
@Tatsh Tatsh force-pushed the copilot/add-pagination-support branch from b15d444 to 19f93a2 Compare November 10, 2025 20:14
@Tatsh Tatsh merged commit 7cb2489 into master Nov 10, 2025
18 checks passed
@Tatsh Tatsh deleted the copilot/add-pagination-support branch November 10, 2025 20:27
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.

client.py:130: pagination support

3 participants