Fresh eyes: fix sub-0.0001 SOL claimable rendering as 0, add format tests + CI gate#22
Open
fielding wants to merge 4 commits into
Open
Fresh eyes: fix sub-0.0001 SOL claimable rendering as 0, add format tests + CI gate#22fielding wants to merge 4 commits into
fielding wants to merge 4 commits into
Conversation
formatSol truncated to 4 decimal places with no small-amount fallback, so a genuine claimable drip below 0.0001 SOL — e.g. 0.01 SOL on the hourly 1-week preset drips ~0.0000595 SOL per reload — rendered as "0" on /vaults while the Claim button stayed live. This is the same bug class fixed on the EVM side in 582f983; the Solana formatter never got the fix. Extract the duplicated formatSol (create + vaults page copies), plus parseSolAmount and formatCountdown, into lib/format.ts. Small amounts on a zero whole part now fall back to two significant digits; output stays plain-decimal and comma-free because the Max button feeds formatSol output back into parseSolAmount. New tests cover the drip fallback, truncate-not-round, malformed input, and the Max round-trip invariant parseSolAmount(formatSol(x)) <= x. Closes RG-3061f3. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xan5eRiAXvcnAVvXHejdTz
format.ts shipped in 582f983 with every displayed amount on /vaults and /create routed through it, but no tests. Pin the behaviors that matter: 2-dp trim with thousands separators, 18-decimal BNB-chain USDC, the sub-cent significant-digit fallback that keeps a real drip from reading "0", boundary rounding, and the maxFractionDigits override. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xan5eRiAXvcnAVvXHejdTz
The only workflow was the on-demand /review bot; nothing mechanically verified the apps before merge (RG-02160b). Matrix over app + app-sol: tsc --noEmit, eslint, vitest, next build. Node from .node-version, pnpm from the packageManager field, frozen lockfile. Deliberately omits the forge job the issue mentions: packages/contracts is undeployed reference code and a forge job could not be verified locally before shipping. Closes RG-02160b. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xan5eRiAXvcnAVvXHejdTz
The workspace list predated packages/app-sol, and hardcoded test counts rot on every test commit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xan5eRiAXvcnAVvXHejdTz
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Assessment
Fresh-eyes pass over the repo. State found: 255 tests green across both apps,
tsc --noEmitclean, bothnext builds pass, lint has 0 errors (2 pre-existing warnings). The project is live on 4 surfaces and well past shippable; the handoff/tix hygiene is genuinely good. Security posture: no secrets tracked in git (.env.productionfiles are local Vercel pulls, untracked), no custom contracts deployed, known open items (Helius key domain allowlist RG-15c1c0, treasury seed backup RG-ec88b4) already tracked.The bug
formatSoltruncated to 4 decimal places with no small-amount fallback, so a real claimable drip below 0.0001 SOL rendered as flat "0" on/vaultswhile the Claim button stayed live — e.g. 0.01 SOL on the hourly 1-week preset drips ~0.0000595 SOL per reload. This is exactly the bug class fixed on the EVM side in582f983(format.tssignificant-digit fallback); the Solana formatter never got the fix, and it was duplicated in two page files.Changes
formatSol/parseSolAmount/formatCountdownfrom the duplicated page copies intopackages/app-sol/src/lib/format.ts; sub-0.0001 amounts on a zero whole part now fall back to two significant digits. Output stays plain-decimal and comma-free because Max feedsformatSoloutput back intoparseSolAmount. 19 new tests, including the Max round-trip invariantparseSolAmount(formatSol(x)) <= xand truncate-never-round (a claimable must not overpromise).formatTokenAmount(every displayed EVM amount routes through it) had zero tests — pinned 2-dp trim, thousands separators, 18-dp BNB USDC, the sub-cent drip fallback, boundary rounding, and themaxFractionDigitsoverride..github/workflows/ci.yml— matrix overapp+app-sol, runningtsc --noEmit/ eslint / vitest /next buildon pushes to main and all PRs. Deliberately omits the forge job from the issue:packages/contractsis undeployed reference code and forge wasn't available locally to verify a job before shipping.packages/app-sol; dropped the rotting hardcoded test count.Verification
pnpm --filter app test→ 115 passed (was 106)pnpm --filter app-sol test→ 168 passed (was 149)tsc --noEmitclean in both packagesnext buildpasses for both appstix: RG-02160b closed (with comment on the forge omission), new RG-3061f3 filed + closed for the formatSol bug.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Xan5eRiAXvcnAVvXHejdTz