Skip to content

fix(args): reject invalid integer values - #2300

Merged
jackwener merged 1 commit into
jackwener:mainfrom
Whxuan0701:fix/int-arg-validation
Aug 22, 2026
Merged

fix(args): reject invalid integer values#2300
jackwener merged 1 commit into
jackwener:mainfrom
Whxuan0701:fix/int-arg-validation

Conversation

@Whxuan0701

Copy link
Copy Markdown
Contributor

Description

Keep numeric argument coercion aligned with the declared argument type:

  • reject fractional values for int arguments instead of passing them to adapters
  • reject Infinity and -Infinity for both int and number arguments
  • preserve the existing coercion behavior for finite numeric values

Related issue: N/A (independently identified)

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

npm run typecheck
> tsc --noEmit

npm run build
✅ Manifest compiled: 1331 entries

npm test
Test Files  590 passed (590)
Tests       6740 passed | 1 skipped (6741)

Risks / Known Gaps

This intentionally tightens validation for values that cannot satisfy the declared numeric type. Adapters that previously accepted fractional int values will now receive an ArgumentError before execution.

@jackwener
jackwener force-pushed the fix/int-arg-validation branch from 7e6fc97 to 51a7e58 Compare August 22, 2026 19:16
@jackwener
jackwener merged commit aa0e6b0 into jackwener:main Aug 22, 2026
11 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.

2 participants