learning_ai_invt_trdg/web/src
Saravana Achu Mac ddbffb6cd1 fix(audit-A): repair the 5 critical broken integrations
A1+A2 — CodeStrategyEditor backtest call
  Was: POST /api/backtest with { symbol, strategyCode, mode: 'code' }
  Now: POST /api/backtest/run with { symbols: [s], strategyConfig: {
       type: 'code', language: 'javascript', code } }
  The backend route is /api/backtest/run (not /api/backtest), and
  /api/backtest/run validates `symbols[]` and `strategyConfig`, not the
  ad-hoc fields we were sending. Also unwraps the { success, results }
  envelope the engine returns and surfaces success:false errors.

A3 — VisualRuleBuilder save shape
  Was: hand-rolled fetch to /api/profiles with { name, symbol, strategyType,
       visualRules, description } — backend's saveTradeProfileForUser ignored
       all of that and either 400'd or persisted a half-empty row.
  Now: uses the canonical createTradeProfile() helper from lib/profileApi
       with the documented TradeProfilePayload shape. Visual rules go inside
       strategy_config.{type:'visual', version:1, rules:[...]} so the engine
       can fan out to a visual interpreter without conflicting with the
       existing rule-based engine. Allocated capital + risk pct pulled from
       botState.settings so the profile inherits the user's current sizing.
       is_active defaults false so the user activates explicitly.

A4+A5 — RightPanel.NewsFeed auth + runtime
  Was: raw fetch() to import.meta.env.VITE_TRADING_API_URL with no
       Authorization header → 401 on every render in any environment that
       requires auth, and prod-broken where the runtime resolver is the
       only source of truth for the API base URL.
  Now: uses fetchNews() from lib/marketApi which already carries the
       platform Bearer token and routes through tradingRuntime.tradingApiUrl.
       Adds an error state in the UI for visibility instead of silently
       leaving the panel blank.

Verified: web/ tsc --noEmit passes. No behavioural change to non-affected
code paths (RightPanel portfolio summary, ResearchView other tabs, etc.).

Refs: docs/AUDIT_REDESIGN.md items A1–A5.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 06:23:52 -07:00
..
assets feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
backtest fix: web + mobile pre-beta audit — real APIs, socket routing, empty states 2026-04-14 04:50:51 +00:00
components fix(audit-A): repair the 5 critical broken integrations 2026-05-04 06:23:52 -07:00
context feat: full web dashboard redesign + 6 new API proxy endpoints 2026-05-03 23:50:01 -07:00
hooks feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
lib feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
tabs fix: web + mobile pre-beta audit — real APIs, socket routing, empty states 2026-04-14 04:50:51 +00:00
test feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
views fix(audit-A): repair the 5 critical broken integrations 2026-05-04 06:23:52 -07:00
App.css feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
App.dom.test.tsx feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
App.tsx feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
index.css feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
main.tsx feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00