Skip to content

Validate and apply portfolio snapshot settings - #757

Draft
luokerenx4 wants to merge 1 commit into
devfrom
codex/snapshot-config-apply
Draft

Validate and apply portfolio snapshot settings#757
luokerenx4 wants to merge 1 commit into
devfrom
codex/snapshot-config-apply

Conversation

@luokerenx4

Copy link
Copy Markdown
Contributor

Summary

  • validate custom portfolio snapshot intervals in the UI and core config before they reach the UTA pump
  • keep invalid custom drafts local with an accessible format hint, while correctly revealing custom intervals loaded asynchronously
  • restart UTA through the existing Guardian protocol after a valid snapshot config save so enable/cadence changes actually take effect
  • avoid the inverse regression: merely opening Portfolio does not autosave the loaded config or restart UTA
  • migrate historical invalid snapshot.json intervals to the safe 15m default and keep the Demo API contract aligned

Root cause

Portfolio previously persisted every non-empty custom interval, while snapshotSchema accepted any string. UTA's boot-time createPump accepts only positive h/m/s durations and throws for values such as nonsense. In addition, generic snapshot config writes did not request a UTA reload, so valid changes appeared saved in the UI but the running scheduler retained its old settings until a later restart.

User impact

Users now receive immediate, field-level guidance for invalid intervals. Valid enable and cadence changes are applied to the running product through a supervised UTA restart, without causing a restart merely from visiting Portfolio. Existing invalid persisted values are repaired during upgrade before strict validation loads them.

Verification

  • pnpm exec vitest run src/core/config.spec.ts src/migrations/0027_repair_snapshot_interval/index.spec.ts src/migrations/runner.spec.ts src/webui/routes/config-snapshot.spec.ts ui/src/pages/PortfolioPage.snapshot-settings.spec.tsx ui/src/demo/handlers/configKeys.spec.ts — 55 passed
  • pnpm build:migration-index
  • npx tsc --noEmit
  • cd ui && npx tsc -b
  • pnpm -F open-alice-ui build:demo
  • pnpm -F @traderalice/guardian-runtime typecheck
  • pnpm -F @traderalice/guardian-runtime build
  • pnpm test:e2e — 30 passed, 3 skipped
  • pnpm test:smoke — isolated Alice/UTA/Vite boot, migration 0027 application, UTA startedAt change after restart, and clean teardown passed
  • pnpm test — 3400 passed, 9 skipped
  • Real Demo /portfolio: verified nonsense keeps the custom interval invalid with an inline alert; 2h15m clears the alert and becomes saveable
  • git diff --check

Boundary touch

UTA supervision and persisted snapshot configuration. No broker credentials, account state, order writes, or live-paper trading were used.

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openalice-demo Ready Ready Preview, Comment Jul 28, 2026 9:16pm

Request Review

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