Skip to content

Stop offering Max Leverage guard and flag non-built-in saved guards - #1782

Open
iridite wants to merge 1 commit into
TraderAlice:devfrom
iridite:fix/1776-max-leverage-guard
Open

iridite wants to merge 1 commit into
TraderAlice:devfrom
iridite:fix/1776-max-leverage-guard

Conversation

@iridite

@iridite iridite commented Oct 11, 2026

Copy link
Copy Markdown

Summary

UTA no longer implements the max-leverage guard (removed in 9efb81d / 0b9889a), but the UTA guards editor still offered it for crypto accounts. It could be added and saved, then was skipped at load with guard: unknown type "max-leverage", skipped, so the user believed a leverage limit was active when it was not.

Fixes #1776

Cause and fix

  • ui/src/components/guards.tsx still listed max-leverage in CRYPTO_GUARD_TYPES / GUARD_DEFAULTS after the backend guard was deleted. Removed it, with its summary and editor.
  • A saved guard whose type is not in the account's guard list now shows "Not a built-in guard — UTA skips it unless an extension registers this type." This covers already-saved max-leverage entries. The wording is conditional on purpose: registerGuard() lets extensions add guard types the UI does not know, so an unknown type is not necessarily unenforced. The row keeps its JSON editor and remove action.
  • UI-only: the editor is where the user can see and fix the saved config, so no new API or health channel. UTA still logs skipped types and does not rewrite saved config.

Verification

  • New ui/src/components/guards.spec.tsx. Against origin/dev's guards.tsx it fails (2 failed, 1 passed); with the fix 3/3 pass.
  • pnpm test:select --path ui/src/components/guards.spec.tsx --path ui/src/components/uta/EditUTADialog.spec.tsx: 4 passed.
  • pnpm exec tsc -p tests/tsconfig.json --noEmit: exit 0.
  • pnpm test:owner:ui: 358/359 files and 2086/2087 tests passed. The one failure is OfficeBuilding.spec.tsx > gives Prediction its own console and skips departure motion when reduced, which also fails on an unmodified origin/dev checkout, so it is unrelated to this change.
  • Not run: UTA service tests (untouched) and a visual browser check.

Boundary touch

UI display of guard config only. No change to UTA enforcement, trading behavior, persisted config or credentials.

Open question: should UTA also surface skipped guard types through an account health/warning channel so they are visible outside the edit dialog? Kept out of this PR to stay UI-only.

UTA dropped the max-leverage guard (9efb81d, 0b9889a) but the guards
editor still offered it for crypto accounts. It could be added and saved
but was skipped at load with `guard: unknown type "max-leverage", skipped`,
so the user believed a limit was active when it was not.

- Remove max-leverage from CRYPTO_GUARD_TYPES, GUARD_DEFAULTS, the
  summary and its editor.
- Show "Not a built-in guard — UTA skips it unless an extension registers
  this type." on a saved guard whose type is not in the account's guard
  list. This covers already-saved max-leverage entries. The wording is
  deliberately conditional: registerGuard() lets extensions add guard
  types the UI does not know, so an unknown type is not necessarily
  unenforced. The row keeps its generic JSON editor and remove action.

The fix stays in the UI: the editor is the only place the user can see and
fix the saved config, and it needs no new API or health channel. UTA keeps
logging skipped types and does not rewrite saved config.

Fixes TraderAlice#1776
@vercel

vercel Bot commented Oct 11, 2026

Copy link
Copy Markdown

@iridite is attempting to deploy a commit to the luokerenx4's Team Team on Vercel.

A member of the Team first needs to authorize it.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

This branch has not been deployed

No deployments
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