Commit Graph

11 Commits

Author SHA1 Message Date
jgrusewski
3d3a84e0b0 feat(web-gateway,web-dashboard): WS ping/pong keepalive, vite build config
- Respond to WebSocket Ping frames with Pong for keepalive detection
- Refactor WS handler to share sender between broadcast and recv tasks
  via Arc<Mutex> (required for pong responses from recv task)
- Add vite production build config: source maps, manual chunk splitting
  for vendor/charts/query bundles

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:37:29 +01:00
jgrusewski
544315e351 safety(web-gateway,web-dashboard): harden for production deployment
Backend:
- Fail fast on empty JWT_SECRET at startup
- Restrict CORS to explicit methods (GET/POST/PUT/DELETE/OPTIONS) and
  headers (Authorization, Content-Type) instead of Any
- Add 1MB request body size limit (DefaultBodyLimit)
- Add gRPC status mappings: DeadlineExceeded->408, Cancelled->499,
  AlreadyExists->409, ResourceExhausted->429, Unavailable->503

Frontend:
- Guard ErrorBoundary console.error behind import.meta.env.DEV
- Read VITE_API_URL and VITE_WS_URL from env vars with fallbacks
- Add max reconnect attempts (50) to WebSocket manager
- Tune React Query: staleTime 10s, refetchInterval 15s,
  disable refetchOnWindowFocus to prevent thundering herd

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:34:37 +01:00
jgrusewski
f4586f8982 test(web-gateway): add trading and risk route handler tests, env example
Trading tests (7): auth gating, no-service 500, order body validation, cancel/account paths
Risk tests (5): auth gating, no-service 500, emergency stop body validation

Total: 61 tests (up from 49)

Also adds web-dashboard/.env.example for production deployment configuration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:09:25 +01:00
jgrusewski
f930b4f1b7 a11y(web-dashboard): add aria labels, roles, and live regions to interactive components
- EmergencyControls: aria-label on all buttons and confirmation input
- OrderForm: aria-label and aria-pressed on buy/sell toggle buttons
- DashboardLayout: aria-label on navigation
- StatusBar: aria-live on connection status, aria-hidden on decorative indicator dot

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:06:46 +01:00
jgrusewski
5b96d64432 fix(web-dashboard): add 401 auto-logout, error states, WS backoff fix, regime data wiring
- api.ts: intercept 401 responses, clear tokens, redirect to /login
- websocket.ts: fix backoff ordering (increase before scheduling retry)
- All dashboards: add error banners with retry buttons when API queries fail
- MLDashboard: replace hardcoded regime data with WebSocket metrics stream

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:04:54 +01:00
jgrusewski
08c487bb17 feat(web-dashboard): show username in StatusBar, add Sign Out button
- Display logged-in username (from JWT sub claim) in status bar
- Add Sign Out button that clears tokens and disconnects WebSocket
- Fix useWebSocket hook with stable empty topics reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 07:53:23 +01:00
jgrusewski
4ae5fc7b0e feat(web-dashboard): add login page, route guards, and error boundary
- ErrorBoundary: catches unhandled render errors, shows recovery UI
- ProtectedRoute: redirects to /login when not authenticated
- LoginPage: username/password form that calls /api/auth/login
- All dashboard routes now require authentication
- Login page redirects to /trading on success

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 07:47:21 +01:00
jgrusewski
066d85d766 fix(web-dashboard): wire P&L chart data from API in PerformanceDashboard
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 07:33:45 +01:00
jgrusewski
9630d915b4 fix(web-dashboard): wire API data into dashboard pages, fix stub panels
- ConfigDashboard: merge fetched API config over defaults instead of ignoring it
- TradingDashboard: wire OrderBook with market_data WebSocket topic
- BacktestingDashboard: wire active backtest status polling and trade results
- PerformanceDashboard: wire sortino_ratio from API, add to PerformanceMetrics type
- Remove unused Vite scaffold react.svg asset
- Set page title to "Foxhunt Trading System"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 07:32:13 +01:00
jgrusewski
6c118d1f53 feat(web-dashboard): trading, risk, ML, performance, backtesting, config dashboards
Phase 5: Trading dashboard with candlestick chart (TradingView lightweight-charts v5),
order book, positions table, order form, and orders table with cancel support.

Phase 6: Risk dashboard with radial gauges (VaR, position utilization, drawdown),
drawdown chart, WebSocket-fed alerts panel, and emergency stop controls.

Phase 7: ML dashboard with model cards (DQN/PPO/TFT/Mamba2), ensemble voting
panel, regime state indicator, and training job progress tracking.

Phase 8: Performance dashboard with metric cards and P&L charts, backtesting
dashboard with strategy form and trade list, config dashboard with tabbed
category editor and audit log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:18:43 +01:00
jgrusewski
4f184bf9a5 feat(web-dashboard): React + TypeScript frontend scaffold with routing
Vite + React 18 + TypeScript project with:
- Tailwind CSS for styling (dark theme, trading-focused color palette)
- React Router with 6 dashboard routes (Trading, Risk, ML, Performance,
  Backtest, Config) and keyboard shortcuts (T/R/M/P/B/C)
- TanStack Query for data fetching with auto-refetch
- Shared lib layer: typed API client, WebSocket manager with auto-reconnect
  and topic subscriptions, auth (JWT in localStorage)
- React hooks: useAuth, useApi (query/mutation wrappers), useWebSocket
- DashboardLayout with nav tabs and StatusBar (WS connection, auth status)
- Stub pages with placeholder component layouts matching design doc

Vite proxy configured to forward /api/* to gateway at localhost:3000.
TypeScript passes with zero errors, production build succeeds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:18:43 +01:00