Skip to content

feat(search): add --max-results flag - #67

Merged
IlyaGusev merged 1 commit into
mainfrom
feat/search-max-results
Aug 19, 2026
Merged

IlyaGusev merged 1 commit into
mainfrom
feat/search-max-results

Conversation

@IlyaGusev

Copy link
Copy Markdown
Collaborator

Summary

  • Add --max-results (1-50, server default 10) to keenable search, forwarded as max_results in the request body. Matches the backend parameter from keenable-backend-ts#370.
  • Add e2e tests: result count honors the flag, and out-of-range values return the server's Invalid parameter error.
  • Bump version to 0.2.2.

Test plan

  • cargo build --release and cargo test pass.
  • Live smoke test on the public endpoint: --max-results 3 returns 3 results, --max-results 30 returns 30, --max-results 51 exits 1 with "max_results": must be an integer between 1 and 50.

🤖 Generated with Claude Code

Forward max_results (1-50, server default 10) in the search body,
matching the backend parameter added in keenable-backend-ts#370.
Bump version to 0.2.2.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add configurable maximum result count to search

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Adds --max-results to control search result counts from 1 to 50.
• Forwards requested limits while preserving the search API’s default behavior.
• Adds end-to-end coverage for limits and validation, then bumps the CLI to 0.2.2.
Diagram

graph TD
  User["CLI User"] -->|"sets flag"| Parser["Search CLI"] -->|"passes option"| Builder["Request Builder"] -->|"submits body"| Executor["Request Executor"] -->|"POST /v1/search"| API["Search API"]
  Tests["E2E Tests"] -->|"checks limits"| Parser
  API -->|"results or error"| Executor
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Validate the range locally with Clap
  • ➕ Rejects invalid values before making a network request
  • ➕ Provides immediate command-line feedback
  • ➖ Duplicates the backend’s validation contract
  • ➖ Returns a Clap error instead of the API’s standardized Invalid parameter response
  • ➖ Requires coordinated updates if backend limits change

Recommendation: Keep the PR’s pass-through approach because the backend remains the authoritative source for the 1–50 constraint and standardized error format. Omitting the option also correctly preserves the server-controlled default; local validation should only be added if avoiding invalid network requests becomes more important than consistent API errors.

Files changed (5) +29 / -3

Enhancement (2) +11 / -1
search.rsForward maximum result limits in search requests +4/-0

Forward maximum result limits in search requests

• Extends the search command function with an optional maximum result count. When supplied, the value is serialized as 'max_results' in the search request body; otherwise the backend default remains in effect.

src/commands/search.rs

main.rsExpose the --max-results search option +7/-1

Expose the --max-results search option

• Adds the optional '--max-results' argument to the search CLI, documents its accepted range and default, and passes it into request construction.

src/main.rs

Tests (1) +16 / -0
test_search.pyCover search result limits and range errors +16/-0

Cover search result limits and range errors

• Adds live end-to-end coverage confirming small and large limits affect result counts. Also verifies that a value above 50 produces the backend’s 'Invalid parameter' response referencing 'max_results'.

tests/e2e/test_search.py

Other (2) +2 / -2
Cargo.lockRecord the CLI 0.2.2 package version +1/-1

Record the CLI 0.2.2 package version

• Updates the locked local package entry from version 0.2.1 to 0.2.2.

Cargo.lock

Cargo.tomlBump the CLI release version to 0.2.2 +1/-1

Bump the CLI release version to 0.2.2

• Advances the package version for the release containing configurable search result limits.

Cargo.toml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@IlyaGusev
IlyaGusev merged commit 40aa3b6 into main Aug 19, 2026
12 checks passed
@IlyaGusev
IlyaGusev deleted the feat/search-max-results branch August 19, 2026 19:23
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