Skip to content

Honor the LLM sample size limit for short fields - #2472

Merged
rolandwalker merged 1 commit into
dbcli:mainfrom
pcbeingused333:fix/mycli-c5675
Nov 25, 2026
Merged

rolandwalker merged 1 commit into
dbcli:mainfrom
pcbeingused333:fix/mycli-c5675

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Description

When an LLM sample row exceeds prompt_section_truncate at a field width
below 100, subtracting 100 makes the width negative. The loop exits and
returns the last oversized row.

Use single-character steps for the last 100 characters so short fields
can retain the text that fits. If width reaches zero, the function
returns empty text and byte strings and preserves the other values.

The regression test exercises four 80-character strings with the field
limit unset, set to 80, and set to 180. All three cases fail on main.
All 33 LLM tests pass with the fix.

uv run --extra dev --extra llm pytest -q mycli_test/pytests/test_special_llm.py

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the mycli/AUTHORS.txt file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

This PR was prepared with the assistance of Codex (AI).

@rolandwalker
rolandwalker merged commit bf45cab into dbcli:main Nov 25, 2026
13 checks passed
@rolandwalker

Copy link
Copy Markdown
Contributor

Thank you!

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.

2 participants