Skip to content

Fix CI, stream routing and sub-cent precision; add tick motion and tests - #4

Merged
yuvrajnode merged 5 commits into
mainfrom
fix/live-data-precision-motion
Oct 29, 2026
Merged

yuvrajnode merged 5 commits into
mainfrom
fix/live-data-precision-motion

Conversation

@yuvrajnode

Copy link
Copy Markdown
Owner

Summary

CI has been red on main since the Next.js upgrade. eslint.config.mjs imported eslint-config-next/* as flat configs. v15 only ships eslintrc configs, so ESLint threw ERR_MODULE_NOT_FOUND before linting a single file. The configs now load through FlatCompat.

Live data (SignalingManager)

  • Cross-market leak. Listeners were keyed by event type, so every depth frame reached every depth listener. After a market switch, frames still in flight for the old market were merged into the new market's book. For example, SOL levels landing in the ETH book read as the best ask, and uncross() then wiped every ETH bid. Listeners are now keyed by stream name.
  • Shared subscriptions. Subscriptions are reference counted, so one panel unmounting no longer unsubscribes a stream another panel still uses.
  • Reconnect. A dropped socket used to stay silent until a reload. It now reconnects with capped backoff and re-subscribes every live stream. The order book shows a Live / Reconnecting indicator.
  • Live 24h change. The 24h change is now recomputed from the stream's rolling open. It had stayed frozen at the page-load value.
  • Trade tape on market switch. The tape remounts per market, so it no longer shows the previous market's trades until the first poll lands.

Precision

Every order book level, trade, 24h high/low, mid, spread and chart-axis label was hard-coded to 2 decimals. On sub-cent markets such as BONK/USDC, every level rendered as 0.00. Precision now comes from the upstream strings, which are quoted to the tick and lot. This change also removes ChartManager.update(), which nothing called.

Motion

  • The last price flashes on every tick, with a direction arrow.
  • Book levels flash when they resize, and depth bars ease to their new width.
  • New trades slide into the tape.
  • Panels stagger in on first load.

Every animation reports a real change in the data, and all of it respects prefers-reduced-motion.

Tests

Adds Vitest (37 tests) covering stream routing, ref counting, reconnect and backoff, the order book merge and uncross, ticker mapping, formatting and tick direction. CI now runs lint → typecheck → test → build.

Verification

  • npm run lint, npm run typecheck, npm test and npm run build all pass locally.
  • I drove the production build in Chromium against mocked REST and WebSocket data on BONK/USDC:
    • Prices render at 8 decimals.
    • A stale depth.SOL_USDC frame leaves the BONK book untouched.
    • A ticker frame flashes the price and updates the 24h change to +7.50%.
    • A new trade slides in.
    • No console errors.

Generated by Claude Code

eslint-config-next 15 only ships eslintrc-style configs. Importing its
subpaths as flat configs throws ERR_MODULE_NOT_FOUND before any file is
linted, which has failed every CI run on main since the Next.js upgrade.
- Listeners were keyed by event type, so every depth frame reached every
  depth listener. Frames still in flight for the market just left were
  merged into the new market's book after a switch; SOL levels landing in
  the ETH book read as the best ask and uncross() wiped every ETH bid.
  Listeners are now keyed by stream name.
- Subscriptions are reference counted, so a panel unmounting no longer
  sends UNSUBSCRIBE for a stream another panel still uses.
- A dropped socket reconnects with capped exponential backoff and
  re-subscribes every live stream. It used to go silent until a reload.
- The order book header shows whether data is live or reconnecting.
- The ticker stream's rolling 24h open now drives the 24h change, which
  had stayed frozen at the page-load snapshot.
- The trade tape remounts per market instead of showing the previous
  market's trades until the first poll landed.
- Adds Vitest with coverage for stream routing, ref counting, reconnect,
  the order book merge and ticker mapping, and runs it in CI.
Every order book level, trade, 24h high/low, mid, spread and chart axis
label was formatted to two places. On a sub-cent market such as
BONK/USDC that rendered every level as "0.00", and BTC sizes under 0.005
read "0.00" too. Precision now comes from the upstream strings
themselves (they are quoted to the tick and lot), clamped to 2..8.

Also removes ChartManager.update(), which nothing called, and the
lightweight-charts v4 fallback that the pinned v5 never takes.
Motion that reports a change in the data, never decoration:

- The last price flashes green or red on every tick, with an arrow for
  the last move, separate from the 24h-change colour.
- An order book level flashes when its resting size changes, new levels
  fade in, and depth bars ease to their new width instead of jumping.
- Trades printed since the previous poll slide into the tape, tinted by
  aggressor side. The first load doesn't animate.
- Terminal panels settle in with a short stagger on first paint.

The first value and the first value after a market switch never flash.
Everything collapses under prefers-reduced-motion via the existing base
rule, and the panel animation fills backwards only, so no transform is
left behind to trap the market picker dropdown.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
exchange Ready Ready Preview Oct 29, 2026 6:13am UTC

@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3d7cf431-a272-49ea-9638-cb2a06c60ef3
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yuvrajnode
yuvrajnode merged commit 17778df into main Oct 29, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 152ac905 Deployed Oct 29, 2026 by vercel[bot]
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