Skip to content

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
mainfrom
fable/fresh-eyes
Open

Fresh eyes: fix sub-0.0001 SOL claimable rendering as 0, add format tests + CI gate#22
fielding wants to merge 4 commits into
mainfrom
fable/fresh-eyes

Conversation

@fielding

@fielding fielding commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Assessment

Fresh-eyes pass over the repo. State found: 255 tests green across both apps, tsc --noEmit clean, both next 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.production files 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

formatSol truncated to 4 decimal places with no small-amount fallback, so a real claimable drip below 0.0001 SOL rendered as flat "0" on /vaults while 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 in 582f983 (format.ts significant-digit fallback); the Solana formatter never got the fix, and it was duplicated in two page files.

Changes

  • fix(sol): extracted formatSol / parseSolAmount / formatCountdown from the duplicated page copies into packages/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 feeds formatSol output back into parseSolAmount. 19 new tests, including the Max round-trip invariant parseSolAmount(formatSol(x)) <= x and truncate-never-round (a claimable must not overpromise).
  • test(app): 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 the maxFractionDigits override.
  • ci (closes RG-02160b): .github/workflows/ci.yml — matrix over app + app-sol, running tsc --noEmit / eslint / vitest / next build on pushes to main and all PRs. Deliberately omits the forge job from the issue: packages/contracts is undeployed reference code and forge wasn't available locally to verify a job before shipping.
  • docs: README workspace list predated 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 --noEmit clean in both packages
  • next build passes for both apps
  • lint: 0 errors, same 2 pre-existing warnings (untouched files)

tix: 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

fielding and others added 4 commits July 2, 2026 10:56
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
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ripguard Ready Ready Preview, Comment Jul 2, 2026 4:02pm
ripguard-sol Ready Ready Preview, Comment Jul 2, 2026 4:02pm
ripguard-testnet Error Error Jul 2, 2026 4:02pm

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