fix(price): reopen the fetch gate, and say which failure happened - #1299
Open
zancas wants to merge 2 commits into
Open
fix(price): reopen the fetch gate, and say which failure happened#1299zancas wants to merge 2 commits into
zancas wants to merge 2 commits into
Conversation
The price store raises a `loading` flag, calls three callbacks the host screen injects, then lowers the flag. Those callbacks are `setZecPrice`, `translate` and `addLastSnackbar`, and any of them can throw. A throw skipped the teardown, so `loading` stayed raised, every later fetch returned early at the anti-spam gate, and `scheduleAuto` never rearmed the sixty-second timer. The ring kept spinning against a loop that had stopped, and the price never refreshed again for the life of the process. The teardown now runs in a `finally` block, so the gate reopens and the timer rearms whatever the callbacks do. Both call sites discarded the rejection through an empty catch, which is what kept this quiet. They now let it propagate. The store's own state no longer depends on that rejection being caught, so nothing needs to swallow it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The price fetch can fail two ways, and the snackbar said almost the same sentence for both. English read "Error fetching the price from the Internet." against "Internal Error fetching the price from the Internet", a difference of one word. A reader could not tell a failed fetch from an unreadable answer, so the distinction the code preserves never reached anyone. The pair now names its two cases. One says the price could not be fetched. The other says the price arrived in a form the app could not read. Three catalogs also leaked the English word "Error" into their first string, which the Portuguese, Russian and Turkish rewrites drop. The Turkish second string carried a trailing space, which goes with it. The four translations deserve a native reader's eye before merge. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1298. Review that one first. This branch contains its commit.
This pull request closes the two lesser findings from the price-fetch audit.
They belong to different halves of the code, so they are two commits. A
reviewer can read either one alone.
Commit one, mobile backend: the fetch gate could stay shut forever
5c8cc429,components/Components/priceFetcherStore.ts.The store raises a
loadingflag, calls three callbacks the host screeninjects, then lowers the flag. The three are
setZecPrice,translateandaddLastSnackbar. Any of them can throw.A throw skipped the teardown.
loadingstayed raised, so every later fetchreturned early at the anti-spam gate.
scheduleAutonever rearmed thesixty-second timer. The ring kept spinning against a loop that had stopped,
and the price never refreshed again for the life of the process.
The teardown now runs in a
finallyblock. The gate reopens and the timerrearms whatever the callbacks do.
Both call sites discarded the rejection through an empty catch, which is what
kept this quiet. They now let it propagate. The store's state no longer depends
on that rejection being caught.
Commit two, UI: the two failures read as one
3db073d3,app/translations/*.json.English said "Error fetching the price from the Internet." against "Internal
Error fetching the price from the Internet". That is a one-word difference. A
reader could not tell a failed fetch from an unreadable answer, so the
distinction the code preserves never reached anyone.
The pair now names its two cases. One says the price could not be fetched. The
other says the price arrived in a form the app could not read.
Three catalogs also leaked the English word "Error" into their first string.
The Portuguese, Russian and Turkish rewrites drop it. The Turkish second string
carried a trailing space, which goes with it.
The four translations deserve a native reader's eye before merge.
What this does not change
The
errorgeminikey keeps its name. Gemini is one of several price sources,so the name is stale, but it is internal and no user sees it. Renaming it would
touch the backend type that lists the catalog keys, which would put a UI concern
into a backend file.
Verification
npm run typecheckpasses.npx eslintreports nothing on the changed store, and adds no warning wherethe file had none.
npx prettier --checkpasses.walletUtilsunit suite passes with 24 tests, and thePriceFetchersnapshot passes unchanged. No test pins the old copy; the suite asserts the
error key, not its rendered prose.
🤖 Generated with Claude Code