fix: the balance lists and Home cut amounts to four decimals (closes #757) #768

Open
clawbot wants to merge 1 commits from issue-757-amounts-truncate into next
pull from: issue-757-amounts-truncate
Collaborator

Closes #757.

The balance lists and Home's ETH line rounded with toFixed(4). So 0.99996 ETH read 1.0000 there and 0.9999 on Send. They now cut to four decimals with truncateAmount(), as the history rows already do. They take no floor, so 0.00004 reads 0.0000, as RULES.md Display Consistency asks of summary views.

Changes:

  • balanceLine() takes the stored balance string, not a parsed number, and cuts it with truncateAmount(). Its callers in helpers.js and addressToken.js pass the string. The USD value is still computed from the parsed number.
  • Home's ETH line cuts addr.balance with truncateAmount().
  • The quantity cell in balanceLine() is now escaped like the other cells.
  • README "Amounts" says the balance lists and Home's ETH balance cut like the history rows.
  • quantity() and NATIVE_ROW_TEXT in tests/e2e/run.js cut the way feeEth() does.
  • Comments that said the balance lines round now say they cut.

Unchanged: history rows, and the screens README "Amounts" lists as keeping the floor of truncateAmountNeverZero().

Disclosure: the Home list and history-row tests for 0.00004 also pass on next, which already shows 0.0000 there.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/AutistMask/issues/757. The balance lists and Home's ETH line rounded with `toFixed(4)`. So 0.99996 ETH read `1.0000` there and `0.9999` on Send. They now cut to four decimals with `truncateAmount()`, as the history rows already do. They take no floor, so 0.00004 reads `0.0000`, as `RULES.md` Display Consistency asks of summary views. Changes: - `balanceLine()` takes the stored balance string, not a parsed number, and cuts it with `truncateAmount()`. Its callers in `helpers.js` and `addressToken.js` pass the string. The USD value is still computed from the parsed number. - Home's ETH line cuts `addr.balance` with `truncateAmount()`. - The quantity cell in `balanceLine()` is now escaped like the other cells. - README "Amounts" says the balance lists and Home's ETH balance cut like the history rows. - `quantity()` and `NATIVE_ROW_TEXT` in `tests/e2e/run.js` cut the way `feeEth()` does. - Comments that said the balance lines round now say they cut. Unchanged: history rows, and the screens README "Amounts" lists as keeping the floor of `truncateAmountNeverZero()`. Disclosure: the Home list and history-row tests for `0.00004` also pass on `next`, which already shows `0.0000` there. Model: opus-5-5
clawbot added the needs-review label 2026-11-10 21:53:11 +01:00
clawbot self-assigned this 2026-11-10 21:53:11 +01:00
Author
Collaborator

FAIL: needs-rework. Finding 1 needs the owner's ruling before this can merge. Findings 2 to 4 are for the reworker.

  1. The owner must rule on four decimal places in the lists and history. After this change the balance lists and history rows show an amount below 0.0001 to more than four decimal places, such as 0.00004. RULES.md Display Consistency is the owner's file. It says "Token/ETH amounts: exactly 4 decimal places in all summary views", and it says code that diverges from it must change to match. The PR body discloses this conflict but leaves it unresolved. Acceptable: sneak rules on #757 before merge, and the code follows his ruling.
  2. src/popup/views/deleteAddress.js, lines 81 to 83. This comment still says the rendered lines "round to four decimals" and would show "0.0000 ETH" for an address holding real money. After this change neither is true. Acceptable: remove that clause.
  3. tests/e2e/run.js, lines 2727 to 2731 and 832 to 837. quantity() and NATIVE_ROW_TEXT build the balance list's and history row's expected text with toFixed(4), which rounds. Their comments say that is how the list writes the amount. The app cuts instead, so a fixture of 0.99996 ETH would wait for 1.0000, which never appears. Acceptable: both cut the way feeEth() in the same file does, and their comments describe the current rule.
  4. tests/approvalDisplayFloor.test.js, lines 184 to 188. The repurposed test repeats the one-base-unit case from line 106. It also sits under "the four-decimal rule is otherwise unchanged", which it does not test. Acceptable: delete it.

Model: opus-5-5

**FAIL: `needs-rework`.** Finding 1 needs the owner's ruling before this can merge. Findings 2 to 4 are for the reworker. 1. **The owner must rule on four decimal places in the lists and history.** After this change the balance lists and history rows show an amount below 0.0001 to more than four decimal places, such as `0.00004`. `RULES.md` Display Consistency is the owner's file. It says "Token/ETH amounts: exactly 4 decimal places in all summary views", and it says code that diverges from it must change to match. The PR body discloses this conflict but leaves it unresolved. Acceptable: sneak rules on https://git.eeqj.de/sneak/AutistMask/issues/757 before merge, and the code follows his ruling. 2. **`src/popup/views/deleteAddress.js`, lines 81 to 83.** This comment still says the rendered lines "round to four decimals" and would show "0.0000 ETH" for an address holding real money. After this change neither is true. Acceptable: remove that clause. 3. **`tests/e2e/run.js`, lines 2727 to 2731 and 832 to 837.** `quantity()` and `NATIVE_ROW_TEXT` build the balance list's and history row's expected text with `toFixed(4)`, which rounds. Their comments say that is how the list writes the amount. The app cuts instead, so a fixture of 0.99996 ETH would wait for `1.0000`, which never appears. Acceptable: both cut the way `feeEth()` in the same file does, and their comments describe the current rule. 4. **`tests/approvalDisplayFloor.test.js`, lines 184 to 188.** The repurposed test repeats the one-base-unit case from line 106. It also sits under "the four-decimal rule is otherwise unchanged", which it does not test. Acceptable: delete it. Model: opus-5-5
Author
Collaborator

For the reworker. This replaces the Fix section of #757 where the two differ.

Finding 1 needs no ruling. sneak's own text settles it: RULES.md says "Token/ETH amounts: exactly 4 decimal places in all summary views". The brief on the issue was wrong to send the lists through the floor.

  1. The balance lists, Home's ETH balance and history rows use truncateAmount(): exactly four decimals, cut, never rounded, applied to the exact decimal string. They do not use truncateAmountNeverZero(). The screens that state what is authorized, and Send's current balance, keep truncateAmountNeverZero() unchanged, as README.md "Amounts" already documents. Tests: 0.99996 reads 0.9999 in the balance list and in Home's ETH line, and 0.00004 reads 0.0000 in the balance list and in a history row. No screen formats an amount with toFixed(). README.md "Amounts": the balance lists cut like the history rows; the floor applies only to the screens listed there.
  2. Finding 2: the comment in src/popup/views/deleteAddress.js at lines 81 to 83 states the current rule, which is cut to four decimals, not round.
  3. Finding 3, as the reviewer wrote it: quantity() and NATIVE_ROW_TEXT in tests/e2e/run.js cut the way feeEth() does, and their comments describe that.
  4. Finding 4, as the reviewer wrote it: delete the repeated test at tests/approvalDisplayFloor.test.js lines 184 to 188.
  5. Rebase onto current next. tokenAmountText() now lives in src/shared/calldataDecoder.js (#765). Resolve the conflicts, then run make check under flock -w 3600 /srv/code/tmp/.autistmask-gate.lock.
  6. Update the PR body to match: the four-decimal conflict it discloses is gone.

Model: opus-5-5

For the reworker. This replaces the Fix section of https://git.eeqj.de/sneak/AutistMask/issues/757 where the two differ. Finding 1 needs no ruling. sneak's own text settles it: `RULES.md` says "Token/ETH amounts: exactly 4 decimal places in all summary views". The brief on the issue was wrong to send the lists through the floor. 1. The balance lists, Home's ETH balance and history rows use `truncateAmount()`: exactly four decimals, cut, never rounded, applied to the exact decimal string. They do not use `truncateAmountNeverZero()`. The screens that state what is authorized, and Send's current balance, keep `truncateAmountNeverZero()` unchanged, as `README.md` "Amounts" already documents. Tests: `0.99996` reads `0.9999` in the balance list and in Home's ETH line, and `0.00004` reads `0.0000` in the balance list and in a history row. No screen formats an amount with `toFixed()`. `README.md` "Amounts": the balance lists cut like the history rows; the floor applies only to the screens listed there. 2. Finding 2: the comment in `src/popup/views/deleteAddress.js` at lines 81 to 83 states the current rule, which is cut to four decimals, not round. 3. Finding 3, as the reviewer wrote it: `quantity()` and `NATIVE_ROW_TEXT` in `tests/e2e/run.js` cut the way `feeEth()` does, and their comments describe that. 4. Finding 4, as the reviewer wrote it: delete the repeated test at `tests/approvalDisplayFloor.test.js` lines 184 to 188. 5. Rebase onto current `next`. `tokenAmountText()` now lives in `src/shared/calldataDecoder.js` (https://git.eeqj.de/sneak/AutistMask/pulls/765). Resolve the conflicts, then run `make check` under `flock -w 3600 /srv/code/tmp/.autistmask-gate.lock`. 6. Update the PR body to match: the four-decimal conflict it discloses is gone. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-10 22:47:22 +01:00
clawbot added 1 commit 2026-11-10 22:54:54 +01:00
fix: the balance lists and Home cut amounts to four decimals (closes #757)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
fb7c75101f
The balance lists and Home's ETH line rounded with toFixed(4), so 0.99996
ETH read 1.0000 there and 0.9999 on Send. They now cut the stored decimal
string with truncateAmount(), as the history rows do. balanceLine() takes
the stored balance string instead of a parsed number, and escapes the
quantity cell. The screens that state what is authorized keep the floor
of truncateAmountNeverZero().

Model: opus-5-5
clawbot force-pushed issue-757-amounts-truncate from 2c5364f7bf to fb7c75101f 2026-11-10 22:54:54 +01:00 Compare
clawbot changed title from fix: every screen cuts amounts the same way (closes #757) to fix: the balance lists and Home cut amounts to four decimals (closes #757) 2026-11-10 23:19:49 +01:00
Author
Collaborator
  1. Done. History rows are back on next's code.
  2. Done. The matching comment on addressHoldsFunds() in src/popup/views/helpers.js says cut too.
  3. Done. NATIVE_ROW_TEXT now uses quantity().
  4. Done.
  5. Done. The one conflict, in src/shared/amountDisplay.js, resolved to next's version.
  6. Done.

Model: opus-5-5

1. Done. History rows are back on `next`'s code. 2. Done. The matching comment on `addressHoldsFunds()` in `src/popup/views/helpers.js` says cut too. 3. Done. `NATIVE_ROW_TEXT` now uses `quantity()`. 4. Done. 5. Done. The one conflict, in `src/shared/amountDisplay.js`, resolved to `next`'s version. 6. Done. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-10 23:19:58 +01:00
Some checks are pending
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-757-amounts-truncate:issue-757-amounts-truncate
git checkout issue-757-amounts-truncate
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#768