Repository navigation
test: cover streaming amount, SSE, and settings regressions - #1814
Conversation
Add deterministic Vitest coverage for pause/resume and clock-drift behavior in useStreamingAmount, malformed/partial SSE frames and reconnect cleanup in useStreamEvents, and invalid persisted settings fallbacks in useSettings. The new cases exposed two defects: a non-finite rate leaked NaN into the claimable amount, and invalid stored preferences were trusted verbatim; both now fall back safely. Refs LabsCrypt#1781 Refs LabsCrypt#1782 Refs LabsCrypt#1783 Refs LabsCrypt#1784 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Bump Next.js to 16.4.3 for the Image Optimization, Server Actions, and use cache advisories, and refresh the lockfile so npm audit picks up the patched body-parser, fast-uri, ip-address, and zod releases. No application code changes; the contract audit advisory is tracked separately because it has no safe in-repo upgrade path. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Security check statusThe npm audit gates are fixed: all three Both Why this is not caused by this PR
Why it cannot be safely fixed here
I have deliberately not added an Everything else is green on |
…lidate persisted settings The README-only change was not the real fix. This lands the actual implementation and regression tests from LabsCrypt#1814: - useStreamingAmount: treat a non-finite or negative ratePerSecond as 0 so NaN can never leak into the rendered claimable (drip) amount. - useSettings: validate persisted decimalPlaces, displayCurrency and amountFormat on hydration and in the synchronous getters, falling back to the documented defaults (7, USD, full) for invalid stored values. - Tests: streaming amount pause/rate boundary coverage, malformed and partial SSE frame recovery, reconnect timer/listener cleanup, and invalid settings fallback cases. Closes LabsCrypt#1781 Closes LabsCrypt#1782 Closes LabsCrypt#1783 Closes LabsCrypt#1784 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Summary
The new tests exposed two small production defects directly tied to these issues:
useStreamingAmountleakedNaNinto the rendered claimable value whenratePerSecondwas non-finite. It now treats a non-finite/negative rate as zero.useSettingstrusted any persisted preference. Invalid decimals, currencies, and formats now fall back to the documented defaults (7,USD,full) on hydration and in the synchronous getters.Dependency audit update
next16.3.8 → 16.4.3 (GHSA-2464-fhr4-w9xw, GHSA-p3m5-59mp-jv5r, GHSA-673q-mjm6-r5xr), plus lockfile updates forzod4.6.7,body-parser2.4.0,fast-uri3.1.9, andip-address10.7.4. All threenpm audit --omit=devgates now report 0 vulnerabilities in CI.cargo auditreports RUSTSEC-2026-0387 forcrypto-bigint0.5.5. It is pulled in bysoroban-env-host 22.1.3 → elliptic-curve 0.13.8 → crypto-bigint 0.5.5. Every currentsoroban-env-hostrelease through 30.0.0 still requireselliptic-curve ^0.13.5, andelliptic-curve0.13.x requirescrypto-bigint ^0.5; the advisory is only patched incrypto-bigint >=0.7.6, which needselliptic-curve >=0.14. There is no compatible in-repo version bump, and no ignore entry or workflow suppression was added.soroban-sdk/soroban-env-hostonce upstream migrates toelliptic-curve 0.14+/crypto-bigint 0.7.6, or coordinate a reviewed backport with the Soroban/RustCrypto maintainers.Files changed
frontend/src/hooks/useStreamingAmount.test.tsxfrontend/src/__tests__/useStreamEvents.test.tsxfrontend/src/hooks/useSettings.test.tsfrontend/src/hooks/useStreamingAmount.ts(NaN guard)frontend/src/hooks/useSettings.ts(persisted-setting validation/fallback)package.json,frontend/package.json,package-lock.json(security updates)Verification
next build): passedtsc --noEmit: passedtsc): passednpm audit --omit=dev: 0 vulnerabilities for root, frontend, and backend914f596: Frontend CI, CodeQL (js/ts/rust), and Soroban Contracts CI pass. Both security jobs fail only at the sharedcargo auditstep for RUSTSEC-2026-0387; the npm audit steps pass.Closes #1781
Closes #1782
Closes #1783
Closes #1784