Skip to content

Fix invalid amount parsing and reject unknown output currencies - #542

Merged
gcomte merged 8 commits into
masterfrom
fix/cli-input-validation
Sep 7, 2026
Merged

Fix invalid amount parsing and reject unknown output currencies#542
gcomte merged 8 commits into
masterfrom
fix/cli-input-validation

Conversation

@gcomte

@gcomte gcomte commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Empty amounts and multibyte SI suffixes could crash the CLI, while non-finite amounts could print NaN or infinity with a successful exit status. A misspelled output currency could also unexpectedly fall back to the configured fiat conversions.

Parse SI suffixes at UTF-8 character boundaries, reject empty/non-finite/overflowed amounts and non-finite configured defaults, and report invalid explicit output currencies as usage errors with no stdout. Valid SI notation, separators, scientific notation, and omitted-argument defaults remain supported.

Validation:

  • All 28 tests pass, including the existing ignored table test and live API tests.
  • Four new regression tests cover invalid amounts, multibyte SI suffixes, supported numeric formats, and rejecting invalid outputs before fetching rates.
  • cargo fmt --all --check and cargo clippy --all-targets -- -D warnings pass.
  • Post-implementation security review found no actionable findings.

This is the base PR in the input-validation, exact-arithmetic, and CLI-output stack.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: f633cd26-1f5e-445a-a60c-693e57505afb


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gcomte
gcomte merged commit 8b8f64d into master Sep 7, 2026
7 checks passed
@gcomte
gcomte deleted the fix/cli-input-validation branch September 7, 2026 11:28
@gcomte gcomte mentioned this pull request Sep 7, 2026
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