Skip to content

Add warnings-count prompt format strings#1658

Merged
rolandwalker merged 1 commit intomainfrom
RW/add-warnings-count-prompt-format-strings
Feb 28, 2026
Merged

Add warnings-count prompt format strings#1658
rolandwalker merged 1 commit intomainfrom
RW/add-warnings-count-prompt-format-strings

Conversation

@rolandwalker
Copy link
Contributor

Description

  • \w - number of warnings, or "(none)" if none
  • \W - number of warnings, or the empty string

This is an alternative to having SHOW WARNINGS turned on. An example is shown in the prompt, but it is likely to be more useful in the toolbar.

warnings_in_prompt

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS 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 .

@rolandwalker rolandwalker self-assigned this Feb 28, 2026
@github-actions
Copy link

  1. Correctness risk: \w and \W can disagree in the same prompt
  • In mycli/main.py:1550 and mycli/main.py:1556, get_warning_count() is called separately for \w and \W.
  • If a prompt contains both tokens, this issues two SHOW COUNT(*) WARNINGS statements. That can produce inconsistent values (and always adds an extra round-trip).
  • Action: fetch warning count once per prompt render and reuse it for both replacements.
  1. Missing tests for the new feature
  • PR adds behavior in mycli/main.py:1550 and helper in mycli/packages/special/utils.py:86, but no tests validate prompt expansion for \w/\W.
  • Action: add tests for:
    • warnings present (\w -> count, \W -> count),
    • no warnings (\w -> (none), \W -> empty),
    • both tokens in one prompt (single count lookup / consistent output),
    • disconnected/no-conn fallback behavior.

No direct security issues found in this PR.

 * "\w" - number of warnings, or "(none)" if none
 * "\W" - number of warnings, or the empty string
@rolandwalker rolandwalker force-pushed the RW/add-warnings-count-prompt-format-strings branch from b786886 to e61b332 Compare February 28, 2026 23:22
@rolandwalker rolandwalker merged commit 6fe8738 into main Feb 28, 2026
8 checks passed
@rolandwalker rolandwalker deleted the RW/add-warnings-count-prompt-format-strings branch February 28, 2026 23:26
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