Skip to content

validate retrieve --k must be > 0#65

Merged
Teingi merged 1 commit into
ob-labs:mainfrom
lesbass:fix/issue-54-validate-retrieve-k
Jun 16, 2026
Merged

validate retrieve --k must be > 0#65
Teingi merged 1 commit into
ob-labs:mainfrom
lesbass:fix/issue-54-validate-retrieve-k

Conversation

@lesbass

@lesbass lesbass commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Use an argparse custom type to reject zero and negative values for retrieve --k, producing a clear argparse-style error.

Closes #54.

Changes

  • src/contextseek/cli/main.py: Added _positive_int() custom type function and applied it to retrieve --k
  • tests/unit_tests/test_cli.py: Added tests for _positive_int and for the retrieve parser rejecting --k 0 and --k -1

Verification

Minimal standalone test confirms the behavior:

$ contextseek retrieve --k 0
error: argument --k: invalid positive int value: '0' (must be > 0)

$ contextseek retrieve --k -1
error: argument --k: invalid positive int value: '-1' (must be > 0)

$ contextseek retrieve --k 5
(works as before)

Use argparse custom type to reject zero and negative values for
the retrieve --k argument, producing a clear argparse-style error.

Closes #54

@Teingi Teingi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Teingi Teingi merged commit 04d3ccf into ob-labs:main Jun 16, 2026
3 of 4 checks passed
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.

[Enhancement]: Validate retrieve --k must be a positive integer

2 participants