Skip to content

Add page_size query parameter to query-resources#33

Merged
asithade merged 1 commit intomainfrom
adesilva/add-page-size-param
Feb 22, 2026
Merged

Add page_size query parameter to query-resources#33
asithade merged 1 commit intomainfrom
adesilva/add-page-size-param

Conversation

@asithade
Copy link
Contributor

Summary

  • Add page_size query parameter to query-resources endpoint (min: 1, max: 1000, default: 50)
  • Update OpenSearch client pagination logic to use actual page size instead of hardcoded default
  • Resolve pre-existing merge conflict in CLAUDE.md and add page_size documentation

Changes

Area Files What
Goa design design/types.go, design/query-svc.go Add page_size to Sortable type and HTTP params
Generated gen/ (8 files) make apigen regeneration
Converter cmd/service/converters.go Use p.PageSize instead of hardcoded constant
OpenSearch opensearch/client.go, opensearch/searcher.go Thread pageSize through interface and fix pagination token logic
Constants pkg/constants/query.go Add MaxPageSize = 1000
Tests searcher_test.go, converters_test.go New tests for page_size forwarding and explicit values
Docs CLAUDE.md Page Size section + merge conflict resolution
Version charts/.../Chart.yaml Bump to 0.4.11

Verification

  • make build — compiles
  • make test — all tests pass
  • make lint — no new lint issues

LFXV2-1135

🤖 Generated with Claude Code

Allow API consumers to control result count per page via the page_size
query parameter (min: 1, max: 1000, default: 50). The parameter maps
directly to OpenSearch's size field and works with all existing query
combinations.

LFXV2-1135

Signed-off-by: Asitha de Silva <asithade@gmail.com>
@asithade asithade requested a review from a team as a code owner February 22, 2026 00:39
Copilot AI review requested due to automatic review settings February 22, 2026 00:39
@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

The changes implement a Page Size feature across the query service stack. This includes API design enhancements, converter logic updates to propagate page size values, OpenSearch client refactoring to accept page size parameters, test coverage additions, and new constants for page size validation.

Changes

Cohort / File(s) Summary
Documentation
CLAUDE.md
Updated feature documentation to include new Page Size functionality with validation constraints, parameter details, and cross-layer implementation references.
Release & Configuration
charts/lfx-v2-query-service/Chart.yaml
Bumped Helm chart version from 0.4.10 to 0.4.11.
API Design
design/query-svc.go, design/types.go
Added page_size query parameter to the query-resources HTTP endpoint; added page_size attribute to Sortable DSL type with validation constraints (min: 1, max: 1000, default: 50).
Converter Layer
cmd/service/converters.go, cmd/service/converters_test.go
Modified payloadToCriteria to derive PageSize from incoming payload instead of hardcoded default; updated test cases to include PageSize propagation across multiple conversion scenarios.
OpenSearch Integration
internal/infrastructure/opensearch/client.go, internal/infrastructure/opensearch/searcher.go, internal/infrastructure/opensearch/searcher_test.go
Updated Search method signature across client and interface to accept pageSize parameter; refactored pagination logic to use provided pageSize for determining availability of additional results; added mock field and new test case to verify PageSize propagation to the client.
Constants
pkg/constants/query.go
Added MaxPageSize constant (1000) for page size validation upper bound.

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as API Layer
    participant Converter as Converter Layer
    participant OpenSearch as OpenSearch Client

    Client->>API: POST /query/resources<br/>(with page_size=20)
    API->>Converter: payloadToCriteria(payload)
    Note over Converter: Extract PageSize<br/>from payload
    Converter->>Converter: Create Criteria<br/>with PageSize=20
    API->>OpenSearch: Search(ctx, index, query, pageSize=20)
    Note over OpenSearch: Execute search with<br/>page size limit
    OpenSearch->>OpenSearch: Check if hasMoreResults<br/>(hits > pageSize)
    OpenSearch-->>API: SearchResponse
    API-->>Client: Query Results<br/>(with PageToken if needed)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add page_size query parameter to query-resources' clearly and concisely summarizes the main change in the pull request.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, detailing the page_size feature addition, implementation across multiple areas, and verification steps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch adesilva/add-page-size-param

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

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 adds a page_size query parameter to the query-resources endpoint, allowing API consumers to control the number of results returned per page (min: 1, max: 1000, default: 50). The implementation properly threads the page size through the entire stack from API definition to OpenSearch client, fixing the pre-existing issue where pagination token generation always used the hardcoded default page size.

Changes:

  • Added page_size attribute to the Sortable Goa design type with validation constraints
  • Updated OpenSearch client to use actual page size instead of hardcoded constant for pagination token logic
  • Added comprehensive test coverage for page_size handling in converters and searcher

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/constants/query.go Added MaxPageSize constant (1000)
design/types.go Added page_size attribute to Sortable type with min/max/default constraints
design/query-svc.go Added page_size parameter to query-resources HTTP endpoint
gen/* (8 files) Goa-generated server/client code for page_size parameter
cmd/service/converters.go Updated to use p.PageSize instead of hardcoded DefaultPageSize
internal/infrastructure/opensearch/client.go Updated Search interface to accept pageSize and use it for pagination token logic
internal/infrastructure/opensearch/searcher.go Updated to pass criteria.PageSize to client
cmd/service/converters_test.go Added test case for explicit page_size value
internal/infrastructure/opensearch/searcher_test.go Added comprehensive tests for page_size forwarding to client
CLAUDE.md Resolved merge conflict and added Page Size documentation section
charts/lfx-v2-query-service/Chart.yaml Bumped version to 0.4.11

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@asithade asithade merged commit 704c2dc into main Feb 22, 2026
9 checks passed
@asithade asithade deleted the adesilva/add-page-size-param branch February 22, 2026 01:40
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