Skip to content

Improve frontend display copy and tests#175

Closed
sambazhu wants to merge 2 commits into
HKUDS:mainfrom
sambazhu:main
Closed

Improve frontend display copy and tests#175
sambazhu wants to merge 2 commits into
HKUDS:mainfrom
sambazhu:main

Conversation

@sambazhu

@sambazhu sambazhu commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add centralized frontend display copy and metric labels for Chinese/mixed UI text
  • Localize generic UI labels while preserving quant/professional terms
  • Update frontend tests around localized display copy

Tests

  • npm run build --prefix frontend
  • npm run test:run --prefix frontend
sambazhu added 2 commits June 4, 2026 13:13
Frontend (197 tests, Vitest):
- Setup: vitest.config.ts, jest-dom, jsdom, global mocks
- lib/: utils, tools, formatters, apiAuth, runReports, indicators
- stores/: Zustand agent store (messages, streaming, session cache, SSE)
- hooks/: useDarkMode (localStorage + class toggle), useSSE (reconnect, dedup, backoff)
- components/: ProgressBar, AgentAvatar, WelcomeScreen, MessageBubble,
  MetricsCard, ThinkingTimeline, ToolProgressIndicator, Skeleton,
  ErrorBoundary, ConnectionBanner

Backend (15 new tests):
- Loopback auth bypass: loopback trusted even when API_AUTH_KEY is set
- Crypto fallback: yfinance added as third-tier crypto data source
- yfinance crypto: BTC-USDT/USDC→USD conversion, crypto market registration
- Settings API: updated test to reflect loopback trust-first policy

CI (.github/workflows/test.yml):
- pytest: --cov=agent --cov-report=term-missing --cov-report=xml
- Added frontend test step (npx vitest run)

Coverage config (pyproject.toml):
- [tool.coverage.run] with source/omit rules
- [tool.coverage.report] with show_missing, skip_empty

Source changes:
- api_server.py: loopback clients bypass auth unconditionally
- registry.py: yfinance added to crypto FALLBACK_CHAINS
- yfinance_loader.py: USDT/USDC→USD symbol conversion, crypto market

.gitignore: exclude .coverage, coverage.xml, node_modules/, results/
- Add i18n display module for internationalization
- Refactor and simplify chat components (WelcomeScreen, RunnerStatus, MandateProposalCard)
- Clean up chart components (CandlestickChart, EquityChart, CorrelationMatrix)
- Update page components (Agent, AlphaZoo, Compare, Settings, RunDetail)
- Update tests to match component changes
- Minor fixes to formatters, api, layout, and router
warren618 pushed a commit that referenced this pull request Jun 5, 2026
Cherry-picked the test-infra commit from #175 (sambazhu): vitest setup + 19 frontend test files (197 tests), backend auth/path-traversal/CORS tests, yfinance crypto fallback (BTC-USDT->BTC-USD), and CI coverage + frontend-test steps. Dropped the PR's separate i18n commit to stay consistent with #163.

Fix: align @vitest/coverage-v8 to ^3.2.6 (was ^4.1.8, incompatible with vitest ^3.2.6 - blocked npm install and the new npm ci CI step).
@warren618

Copy link
Copy Markdown
Collaborator

Thanks @sambazhu — really solid test work. 🙏

I've cherry-picked the test-infra commit to main (preserving your authorship, commit 16e22b9): the vitest setup + 19 frontend test files (197 tests), the backend auth / path-traversal / CORS security tests, the yfinance crypto fallback (BTC-USDTBTC-USD), and the CI coverage + frontend-test steps. Full backend suite (3036 passed) and the 197 frontend tests are green.

One fix on the way in: @vitest/coverage-v8 was pinned to ^4.1.8 while vitest is ^3.2.6 — that peer conflict blocked npm install and would have failed the new npm ci CI step on the first run, so I aligned coverage-v8 to ^3.2.6.

I did not bring in the second commit (i18n + component cleanup), to stay consistent with the decision in #163 to hold off on bundling i18n until the UI stabilizes. Closing this PR since the test suite has landed independently — thanks again for the contribution!

@warren618 warren618 closed this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants