Skip to content

fix(crawlctl): reject malformed log tail counts - #248

Merged
vincentkoc merged 1 commit into
mainfrom
fix/log-tail-validation
Nov 16, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/log-tail-validation

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

crawlctl logs --tail silently accepts malformed counts such as 2junk, 1.5, or 1e3 by reading only their integer prefix.

User Impact

Malformed counts now return a usage error before config or log access. Both --tail VALUE and --tail=VALUE require a positive integer; valid counts retain their output behavior.

Why This Change Was Made

Parse the complete value while retaining the existing positive-count guard. No public library APIs or saved data formats change.

Evidence

  • Twelve malformed-input cases failed before the fix; both flag forms now reject trailing junk, fractions, exponent notation, and whitespace. Existing empty, nonnumeric, zero, and negative controls pass.
  • Temporary config/history/log tests confirm valid counts, including +2 and 02, print exactly the last two lines.
  • Full uncached Go suite, vet, module tidiness, formatting, and diff checks passed with GOWORK=off.
  • Independent native P0–P3 review found no findings for complete candidate 5f792e1f2e6111f9833cae4b19c1ac3aa047a3de against base 7c8666e99bb62cd03767d7dd79e368f6dfd23ac3; full diff and unchanged parsing/output/config context reviewed read-only in isolated context.

@clawsweeper

clawsweeper Bot commented Nov 16, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc
vincentkoc marked this pull request as ready for review November 16, 2026 04:45
@vincentkoc
vincentkoc merged commit 39f5766 into main Nov 16, 2026
8 checks passed
@vincentkoc
vincentkoc deleted the fix/log-tail-validation branch November 16, 2026 04:48
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