fix(uta): export utaConfigSchema from uta-protocol — unbreaks test-connection#209
Open
iridite wants to merge 1 commit into
Open
fix(uta): export utaConfigSchema from uta-protocol — unbreaks test-connection#209iridite wants to merge 1 commit into
iridite wants to merge 1 commit into
Conversation
…nnection The UTA service's `/test-connection` endpoint (routes-trading.ts:191) imports `utaConfigSchema` from `@traderalice/uta-protocol`, but the schema was only defined in Alice's `src/core/config.ts` and never exported from the protocol package. This caused a TypeError: Cannot read properties of undefined (reading 'parse') …on every "Test <exchange>" action in the New UTA flow (affects all exchanges, not just Bitget). Fix: define `utaConfigSchema` + `guardConfigSchema` in the protocol package (`packages/uta-protocol/src/schemas/index.ts`) and re-export from `src/core/config.ts` to keep the existing public API intact. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Moves the Unified Trading Account (UTA) config schema/type out of src/core/config.ts into the shared uta-protocol package so both server and clients can depend on one canonical definition.
Changes:
- Replaced the local
utaConfigSchemadefinition with an import from@traderalice/uta-protocol. - Added
utaConfigSchemaandUTAConfigtopackages/uta-protocol/src/schemas/index.ts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/core/config.ts | Removes in-repo UTA schema/type and re-exports the shared protocol schema/type. |
| packages/uta-protocol/src/schemas/index.ts | Introduces the canonical UTA schema/type in the protocol package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+318
to
+319
| import { utaConfigSchema, type UTAConfig } from '@traderalice/uta-protocol' | ||
| export { utaConfigSchema, UTAConfig } |
| path: ['ephemeral'], | ||
| }) | ||
| import { utaConfigSchema, type UTAConfig } from '@traderalice/uta-protocol' | ||
| export { utaConfigSchema, UTAConfig } |
Comment on lines
+17
to
+28
| export const utaConfigSchema = z.object({ | ||
| id: z.string(), | ||
| label: z.string().optional(), | ||
| presetId: z.string(), | ||
| enabled: z.boolean().default(true), | ||
| guards: z.array(guardConfigSchema).default([]), | ||
| presetConfig: z.record(z.string(), z.unknown()).default({}), | ||
| ephemeral: z.boolean().optional(), | ||
| }).refine((u) => u.ephemeral !== true || u.presetId === 'mock-simulator', { | ||
| message: 'ephemeral: true is only allowed on mock-simulator UTAs (would destroy real broker history at next boot)', | ||
| path: ['ephemeral'], | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a runtime TypeError that crashes the UTA service when testing any exchange connection (observed on Bitget, affects all presets):
Root Cause
services/uta/src/http/routes-trading.ts:191importsutaConfigSchemafrom@traderalice/uta-protocol:But
packages/uta-protocol/src/schemas/index.tswas empty (export {}). The destructuredutaConfigSchemaisundefined, and.parse()onundefinedthrows.Fix
utaConfigSchema+guardConfigSchematopackages/uta-protocol/src/schemas/index.ts(the canonical location the UTA service already expects)src/core/config.tswith a re-export from the protocol package, keeping the existing public API intactTest plan
tsc --noEmitcleanutaConfigSchemafromsrc/core/config.tsstill resolve🤖 Generated with Claude Code