Skip to content

fix: reject negative show character limits - #37

Open
Gambit-Checkmate wants to merge 1 commit into
AgentPostmortem:mainfrom
Gambit-Checkmate:fix/nonnegative-show-limit
Open

fix: reject negative show character limits#37
Gambit-Checkmate wants to merge 1 commit into
AgentPostmortem:mainfrom
Gambit-Checkmate:fix/nonnegative-show-limit

Conversation

@Gambit-Checkmate

Copy link
Copy Markdown
Contributor

What & why

Closes #21. Negative show --max values currently reach Python's negative slicing and drop trailing characters instead of acting as a length limit. Validate the option during argument parsing and return a usage error (exit 2) before loading transcripts.

Changes

  • Add a non-negative integer argument type for show --max.
  • Preserve the default of 4000, positive limits, and zero.
  • Clarify the CLI help and README.
  • Add regression tests for negative limits (-1, -5), zero, positive limits, and the default.

Checklist

  • Focused change with a clear description
  • Ran format / lint / tests (see README)
  • Updated docs or CHANGELOG if relevant
  • Linked any related issue

Verification

Developed with AI assistance on Windows. The two negative-limit tests failed against the original implementation because transcript loading was reached; all 43 tests pass after the fix (baseline: 37).

Ruff lint and formatting checks pass for both changed Python files. The full repository lint check still reports 14 pre-existing diagnostics in unrelated files; the baseline full formatting check also flagged three unrelated files. Those files are intentionally untouched.

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.

show --max accepts negative values that corrupt output slicing

1 participant