Use plain-number fields without the calculator for settings, rates and limits
Stacked PR. Base is stack/decimal-field-helper (= head of #5939). Once the PRs below it are merged, this PR can be retargeted to main and shows only its own part.
Problem
After #5833 and #5939 every amount and decimal input is a money field with the calculator. For settings, rates and rule or filter limits that does not fit: such a value is typed once, never added up. The calculator button and operator row only crowd the field. Worse, a typed 12+3 was silently saved as 15, a value the user never saw.
Change
calculator: falseonmoney_field/decimal_fielddrops the calculator button, the operator row and the result. Parsing of comma decimals is unchanged.- Such a field takes a plain number only: digits, separators and a leading minus. Anything else, typed or pasted, is refused as a whole, with the hint "Numbers only". Nothing is filtered out, so
12+3can never become123. Text that reaches the field some other way (autofill, undo) is never worked out on blur, submit or a currency switch: it stays as typed and is marked invalid ("Enter a valid number."). Its min/max message says "number" instead of "amount". - Brackets in a paste: where the calculator is on, the money field's rule applies. A paste reads as the same text typed, so
(200.00)is 200.00,(1,200)in JPY is 1200, and-(-12)is 12. Only text typing cannot produce, like$(200.00)or(1,200.00), is a statement amount with a minus. The one exception is a single separator before exactly three digits (20,000in USD), which keeps the currency's grouping. A statement amount with two minuses (-(1,200)) is refused with a hint. A field without the calculator reads no typed brackets at all, so there every pasted pair is the statement's minus and(12)is −12, while-(-12)is refused. - Used for: credit card APR, loan interest and insurance rates, rate changes, rule amount condition and split share, the transaction amount filter, the decimal classifier settings, and the categorization confidence threshold and shadow rate.
- A "Choosing a number field" table in
docs/llm-guides/design-system.md(linked fromAGENTS.md) says which field to use when.test/architecture/calculator_choice_test.rbholds views and components to it: every field undersettings/and every field named like a rate, percentage, threshold, probability or share drops the calculator, unless it is listed with a reason (exchange_ratekeeps it). Any other calculator-free field must be listed with its reason, and stale entries fail.
Effects on other parts of the app
Only the listed inputs. What a valid value submits does not change. A value that used to be silently evaluated is now refused or marked invalid instead of saved. No model, migration or API changes.
Screenshots
Before (main) and after, phone (390 px) and desktop (1400 px):
| Phone | Desktop | |
|---|---|---|
| Credit card | ![]() | ![]() |
| Loan | ![]() | ![]() |
| Rule | ![]() | ![]() |
| Amount filter | ![]() | ![]() |
| Classifier | ![]() | ![]() |
Error cases (after):
| Phone | Desktop | |
|---|---|---|
| "+" typed | ![]() | ![]() |
| "12+3" pasted | ![]() | ![]() |
| "12+3" set by autofill/undo | ![]() | ![]() |
| Above the maximum | ![]() | ![]() |
Validation
- System tests: typed and pasted operators are refused with the hint, a script-set expression stays invalid through blur, submit and a currency switch, and
-12.5still pastes. - Form builder tests for the markup and the number wording; architecture tests for the field choice.
- Rubocop, ERB lint, Biome and Brakeman clean.
How this fits together
The money field work is split into small PRs that build on each other. Review from the top of this list; each stacked PR's base is a stack/* copy of the PR below it, so its diff shows only its own change.
- #6032: bounds checked on the submitted amount, hints for ignored input, parentheses (fixes #5944). Base:
main. - #6033: operator bar docked above the on-screen keyboard. Base: #6032.
- #5833: every amount input uses the money field. Base: #6033.
- #5850: a rejected transfer keeps its input; comma exchange rates. Base: #5833.
- #5939: the remaining decimal fields (quantities, rates) read comma decimals. Base: #5850.
- #6035: plain-number fields without the calculator for settings, rates and rule/filter limits. Base: #5939.
Standalone: #6034 (phone layout of goal, vehicle and settings number rows). Base: main; it does not depend on the stack.
🤖 Generated with Claude Code
Summary by cubic
Lets money and decimal fields drop the calculator for settings, rates and limits, so a value typed once is not offered the operator row or silently worked out. A calculator-free field takes a plain number only (digits, separators, a leading minus) and refuses anything else typed or pasted with a "Numbers only" hint, so 12+3 is no longer evaluated and saved as 15. Text that reaches the field another way (autofill, undo, a script) stays as typed, is marked invalid, and is checked again on blur and submit, so Rails cannot read an expression like 12+4 as 12.
Applied to the credit card APR, loan interest and insurance rates, rate changes, the rule amount condition and split share, the transaction amount filter, the decimal classifier settings, and the categorization confidence threshold and shadow rate.
- Bound and invalid messages say "number" instead of "amount" for calculator-free fields.
- A pasted or dropped statement amount is read the way the number would be typed, with the separator it carries: a single separator before three digits is the decimal point whether or not a symbol or sign came with it, so
$1,234and1,234both read as 1.234. A paste into a field with text already in it is typed at the caret, so the whole field must stay one plain number (0.700followed by-0,100is refused); a plain paste left to the browser is refused if the value it would leave is not a plain number. A space inside a typed number is refused at the keystroke while spaces around it are kept. - A paste is refused when a statement would not write it:
--12,-+12,+-12,-$(12),-(1,200.00),($-12)and$-(12)are not amounts. Where the calculator is on, brackets paste as the group typing reads —(12)is 12,-(12),(-12)and+(-12)are −12,-(-12)is 12 — while only accounting parentheses (a currency symbol or thousands grouping) supply the minus in the refusal. A calculator-free field reads brackets only as the statement's minus, so(12)is −12 but-(12)and(-12)are refused there. A typographic minus or en dash reads as a minus, so−12.50pastes as −12.50; a pasted+0.5keeps the value without the plus. - A typographic minus set without typing or pasting reads as a plain number, and an expression that reaches the field that way shows the same "Numbers only" hint instead of none. A keystroke after a pasted typographic minus is checked against the whole field with its minus mapped, so the next digit is not refused.
- The design system guide gains a "Choosing a number field" table, and an architecture test enforces it: every field under
settings/and every rate-like name drops the calculator, except rate-like names worked out from other figures (exchange_rate,per_share_cost_basis), which keep the calculator and are listed in the test; any other calculator-free field must be listed with its reason.
Summary by CodeRabbit
- New Features
- Rate, percentage, settings, threshold, and rule/filter fields accept plain numbers without calculator controls. Other fields retain their existing calculator behavior.
- Bug Fixes
- Calculator-free fields reject expressions and invalid input, display clearer number and range errors, and prevent form submission when values are invalid. Pasting and dropping support common negative-number formats.
- Documentation
- Added guidance on choosing number fields and when to use calculator-free inputs.

















