Skip to content

test: cover streaming amount, SSE, and settings regressions - #1814

Merged
K1NGD4VID merged 7 commits into
LabsCrypt:mainfrom
mskdylan:test/1781-1784-hook-regression-coverage
Oct 29, 2026
Merged

K1NGD4VID merged 7 commits into
LabsCrypt:mainfrom
mskdylan:test/1781-1784-hook-regression-coverage

Conversation

@mskdylan

@mskdylan mskdylan commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The new tests exposed two small production defects directly tied to these issues:

  1. useStreamingAmount leaked NaN into the rendered claimable value when ratePerSecond was non-finite. It now treats a non-finite/negative rate as zero.
  2. useSettings trusted 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

  • npm advisories resolved: next 16.3.8 → 16.4.3 (GHSA-2464-fhr4-w9xw, GHSA-p3m5-59mp-jv5r, GHSA-673q-mjm6-r5xr), plus lockfile updates for zod 4.6.7, body-parser 2.4.0, fast-uri 3.1.9, and ip-address 10.7.4. All three npm audit --omit=dev gates now report 0 vulnerabilities in CI.
  • Remaining blocker: cargo audit reports RUSTSEC-2026-0387 for crypto-bigint 0.5.5. It is pulled in by soroban-env-host 22.1.3 → elliptic-curve 0.13.8 → crypto-bigint 0.5.5. Every current soroban-env-host release through 30.0.0 still requires elliptic-curve ^0.13.5, and elliptic-curve 0.13.x requires crypto-bigint ^0.5; the advisory is only patched in crypto-bigint >=0.7.6, which needs elliptic-curve >=0.14. There is no compatible in-repo version bump, and no ignore entry or workflow suppression was added.
  • Follow-up: bump soroban-sdk/soroban-env-host once upstream migrates to elliptic-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.tsx
  • frontend/src/__tests__/useStreamEvents.test.tsx
  • frontend/src/hooks/useSettings.test.ts
  • frontend/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

  • Focused hook tests: 113 passed (4 files)
  • Frontend suite: 814 passed (80 files)
  • Frontend build (next build): passed
  • Frontend lint: 0 errors; tsc --noEmit: passed
  • Backend build (tsc): passed
  • Backend unit suite: 815 passed; 2 token-route tests require a running Postgres and could not run locally
  • Local npm audit --omit=dev: 0 vulnerabilities for root, frontend, and backend
  • GitHub Actions on 914f596: Frontend CI, CodeQL (js/ts/rust), and Soroban Contracts CI pass. Both security jobs fail only at the shared cargo audit step for RUSTSEC-2026-0387; the npm audit steps pass.

Closes #1781
Closes #1782
Closes #1783
Closes #1784

mskdylan and others added 2 commits October 22, 2026 11:12
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>
@mskdylan

Copy link
Copy Markdown
Contributor Author

Security check status

The npm audit gates are fixed: all three npm audit --omit=dev --audit-level=high steps now report 0 vulnerabilities in the Security Checks run on 914f596.

Both Security Checks jobs still exit 1, but at the shared cargo audit step, not at any npm step. The failure is a single advisory:

Crate: crypto-bigint 0.5.5
error: 1 vulnerability found!
ID: RUSTSEC-2026-0387
Solution: Upgrade to >=0.7.6

Why this is not caused by this PR

  • This PR changes no Rust files; contracts/Cargo.lock is byte-identical to main (8a109b7).
  • The advisory was issued 2026-10-23, one day after main's last security run (2026-10-22), which passed. cargo audit downloads the advisory DB at run time, so this affects every branch and every open PR, not this change.

Why it cannot be safely fixed here

  • The dependency path is soroban-sdk 22.0.9 → soroban-env-host 22.1.3 → elliptic-curve 0.13.8 → crypto-bigint 0.5.5.
  • There is no patched 0.5.x: the only fix is crypto-bigint >=0.7.6, which is a semver-breaking release requiring elliptic-curve >=0.14.
  • Every published soroban-env-host release through 30.0.0 (and therefore every soroban-sdk through 29.0.1) still requires elliptic-curve ^0.13.5, so a Soroban SDK bump does not remove it.

I have deliberately not added an ignore entry, --ignore flag, or workflow change: the finding is real for this dependency graph, and suppressing it would hide a legitimate audit result. The correct follow-up is an upstream Soroban/RustCrypto migration to crypto-bigint 0.7.6+; once that lands, bumping soroban-sdk resolves both checks with no local workaround.

Everything else is green on 914f596: Frontend CI, all three CodeQL analyses, Soroban Contracts CI, and the preview build. Locally the frontend suite is 814/814 and the backend build plus 815 unit tests pass.

freebuff-web Bot pushed a commit to mskdylan/flowfi that referenced this pull request Oct 27, 2026
…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>
@K1NGD4VID
K1NGD4VID merged commit ec253a2 into LabsCrypt:main Oct 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants