Skip to content

UTA management overhaul: health monitoring, connection validation, UI redesign#80

Merged
luokerenx4 merged 7 commits intomasterfrom
dev
Mar 22, 2026
Merged

UTA management overhaul: health monitoring, connection validation, UI redesign#80
luokerenx4 merged 7 commits intomasterfrom
dev

Conversation

@luokerenx4
Copy link
Contributor

Summary

  • BrokerError system: Structured error with code (CONFIG/AUTH/NETWORK/EXCHANGE) and permanent flag — UTA stops recovery for permanent errors instead of retrying forever
  • Remove legacy migration: Delete crypto.json/securities.json fallback, seed empty config on first run — accounts created via UI wizard only
  • Real-time health monitoring: UTA emits health change events via eventLog → SSE push to frontend
  • Remove CcxtBroker read-only mode: All accounts require API credentials, no more silent market-data-only fallback
  • Connection validation: New POST /test-connection API verifies broker.init() + getAccount() before persisting config — bad credentials never touch config files
  • TradingPage redesign: Card-based account list with live health badges, 2-step wizard (platform+connection → credentials), exchange dropdown, visual polish (larger buttons/dialogs, btn-danger for delete)
  • PortfolioPage: Distinguish disabled (grey) from offline (red reconnecting)
  • Move data/default/default/: Project templates out of runtime data directory

Test plan

  • Fresh start (no config files) → empty accounts, no UTA created
  • Create account with wrong API key → wizard shows connection error, config untouched
  • Create account with valid key → connection verified, then persisted + UTA created
  • Account health updates in real-time via SSE on TradingPage and PortfolioPage
  • pnpm build + pnpm test pass (879 tests green)

🤖 Generated with Claude Code

Ame and others added 7 commits March 21, 2026 21:56
…keys)

Introduce BrokerError with code/permanent fields. UTA now detects
permanent errors (CONFIG, AUTH) and marks the account as disabled
instead of retrying forever.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lth monitoring

Backend:
- Remove migrateLegacyTradingConfig() and crypto.json/securities.json fallback
- Seed empty platforms.json/accounts.json on first run (accounts via UI wizard)
- Skip account creation when apiKey is missing (safety net in main.ts)
- Add onHealthChange callback to UTA, emit account.health events via eventLog
- Move eventLog creation before trading init for proper ordering

Frontend:
- Add BrokerHealthInfo/AccountSummary types
- New useAccountHealth hook (initial fetch + SSE subscription)
- TradingPage: add Status column with HealthBadge (connected/unstable/reconnecting/disabled)
- PortfolioPage: distinguish disabled (grey) from offline (red reconnecting)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Project resource templates shouldn't live inside the runtime data
directory — makes it awkward to clear data/ without losing defaults.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CcxtBroker now throws BrokerConfigError on init() without credentials
  (same as AlpacaBroker) instead of silently entering read-only mode
- Remove readOnly field and ensureWritable() — UTA = trading account = must have keys
- Wizard Step 3: API Key/Secret now required, Create button disabled when empty
- Auto-reconnect after account creation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace AccountsTable with AccountCard list (health badge, subtitle)
- Merge wizard from 3 steps to 2 (platform+connection, then credentials)
- Empty state with centered CTA card
- EditDialog: health badge in header, show/hide credentials toggle
- Upgrade all buttons to standard size, DeleteButton uses btn-danger
- Widen dialogs to 560px, increase padding throughout
- Section.title accepts ReactNode for inline controls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- UTA: expose waitForConnect() — resolves after broker.init() + getAccount()
- reconnectAccount: await waitForConnect() before returning success
- Frontend: await reconnect result in wizard, show error on failure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- New POST /test-connection API: validates broker.init() + getAccount()
  with a temporary broker before writing anything to config
- Wizard flow: test-connection → success → save config → create UTA
  (failure shows error in wizard, config untouched)
- Exchange field changed from free text to dropdown (14 common exchanges)
- Remove dead Market Type selector (not used by backend)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@luokerenx4 luokerenx4 merged commit fcf2209 into master Mar 22, 2026
2 checks passed
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