Commit Graph

8 Commits

Author SHA1 Message Date
jgrusewski
2ebacae0e0 safety(web-gateway): add per-route-group rate limiting middleware
Token-bucket rate limiter (no new dependencies) with three tiers:
- Auth routes: 10 req/min, burst 5 (brute-force protection)
- Trading/read routes: 200 req/min, burst 20
- Compute routes (backtest/training/tune): 30 req/min, burst 5

Includes background cleanup task for stale entries and 7 unit tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 09:13:19 +01:00
jgrusewski
3c3bf30062 safety(web-gateway,web-dashboard): clippy clean, gRPC timeouts, health probes, responsive grids, error boundaries
- Fix all 98 clippy warnings (0 remaining with -D warnings)
- Add 30s default gRPC timeout on all channels via Endpoint::timeout()
- Replace readiness probe is_some() with actual gRPC health check (returns 503 when degraded)
- Add responsive Tailwind breakpoints to all 5 dashboard pages
- Add ComponentErrorBoundary for crash-prone chart components
- Log JWT validation errors at debug level instead of silently discarding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 08:59:20 +01:00
jgrusewski
29aca309aa fix: resolve clippy warnings in common and web-gateway
- Replace redundant closures with function references in correlation.rs
- Use unwrap_or_default() instead of unwrap_or_else(T::new)
- Allow clippy::infinite_loop on intentional reconnect/heartbeat loops
- Allow clippy::empty_structs_with_brackets in generated proto code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 06:40:06 +01:00
jgrusewski
28774d9c34 feat(web-gateway): wire training + tune routes to real MLTrainingService gRPC
Replace 6 stub handlers returning fake JSON with real gRPC proxies:
- training.rs: list_jobs→ListTrainingJobs, start_job→StartTraining, cancel_job→StopTraining
- tune.rs: start_tune→StartTuningJob, get_status/get_best→GetTuningJobStatus, stop_tune→StopTuningJob
Add ml_training proto module and MlTrainingServiceClient factory.
All 24/24 web-gateway REST endpoints now proxy to real gRPC services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 05:20:35 +01:00
jgrusewski
f3d45cfca5 lint(web-gateway): add deny(unwrap_used, expect_used, panic, indexing_slicing)
All production code already uses safe patterns. This enforces the same
safety standard as ml, risk, common, data, and all service crates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 04:58:03 +01:00
jgrusewski
b3361f09bb lint(web-gateway): fix all clippy deny violations (49 errors → 0)
- Replace impl Trait params with concrete types or named generics
- Rename shadowed variables (tx/ch/inner → unique names per scope)
- Add -> ! return type on infinite reconnect/heartbeat loops
- Replace wildcard enum match with explicit tonic::Code variants
- Use drop() on #[must_use] broadcast send results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:27:00 +01:00
jgrusewski
a1affb0767 feat(web-gateway): WebSocket infrastructure with topic-based subscriptions
Add WebSocket support:
- ws/messages.rs: ClientMessage (subscribe/unsubscribe) and ServerMessage
  (market_data, order_update, risk_alert, position_update, ml_prediction,
  training_progress, metrics, config_update)
- ws/handler.rs: WebSocket upgrade with JWT validation from query param,
  per-client topic filtering via HashSet, dual-task architecture
  (send from broadcast, receive client commands)
- grpc/streams.rs: Background bridge tasks connecting gRPC streaming RPCs
  to broadcast channel with exponential backoff reconnection.
  Includes 30s heartbeat for connectivity verification.

WebSocket endpoint at GET /api/ws?token=<jwt>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:18:43 +01:00
jgrusewski
77ad1530cd feat(web-gateway): scaffold Axum REST gateway with all route modules
New web-gateway crate with:
- JWT auth middleware with claims extraction
- REST routes proxying to gRPC: trading, risk, ML, training, backtesting,
  performance, config, and hyperparameter tuning
- Proto compilation from shared tli/proto definitions
- AppState with lazy gRPC channels and WebSocket broadcast
- Axum server with CORS, tracing, and graceful shutdown

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