Skip to content

feat(studio): add Phoenix state scenarios - #9

Open
92Infinitus92 wants to merge 5 commits into
feat/pump-protocol-uifrom
feat/phoenix-eternal-ui-integrated
Open

feat(studio): add Phoenix state scenarios#9
92Infinitus92 wants to merge 5 commits into
feat/pump-protocol-uifrom
feat/phoenix-eternal-ui-integrated

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Adds Phoenix Eternal scenario support to Studio:

  • Phoenix state preset with live market selection
  • collateral stress, direct mark shock, and spot/perp divergence
    flows
  • AI chip for two-stage liquidation cascade scenarios
  • Phoenix protocol icon and scenario-editor support
  • constrained, scrollable market selection
  • scenario API integration and validation feedback

Verification

  • 298 Studio tests
  • TypeScript typecheck
  • Studio lint
  • manual validation of collateral, mark-price, reference-
    divergence, and two-stage cascade scenarios

Stacking

This PR is stacked on feat/pump-protocol-ui.

Once the Pump UI PR is merged into develop, this branch will be rebased and retargeted to develop.

Greptile Summary

Adds Phoenix Eternal scenario support to Studio, backed by live template discovery and scenario creation.

  • Adds collateral-stress, direct-mark, and spot/perp-divergence preset flows.
  • Exposes Phoenix templates in the scenario editor and adds protocol icon support.
  • Adds a two-stage liquidation-cascade AI example.
  • Constrains long shared Listbox option menus and adds focused tests.

Confidence Score: 5/5

The PR appears safe to merge once its explicitly acknowledged backend dependency is available.

No blocking failure remains within the eligible follow-up findings.

Important Files Changed

Filename Overview
apps/studio/src/lib/scenarios-api.ts Adds Phoenix market discovery, generic scenario construction, MCP collateral creation, response validation, and scenario-ID extraction.
apps/studio/src/components/svm/phoenix-state-dialog.tsx Adds the Phoenix preset dialog with mode-specific inputs, catalog-aware market validation, submission state, and backend error feedback.
apps/studio/src/components/svm/scenarios-bento.tsx Integrates the Phoenix preset dialog into the scenario catalog and navigates successful creations into the editor.
apps/studio/src/components/svm/scenario-editor.tsx Enables Phoenix Eternal templates in the editor protocol catalog.
packages/ui/src/catalyst/listbox.tsx Updates Listbox positioning and dimensions so long option catalogs remain anchored and scrollable within the viewport.
.github/workflows/openai-review.yaml Adds an automated Codex review workflow for pull-request updates.

Sequence Diagram

sequenceDiagram
  actor User
  participant Dialog as Phoenix State Dialog
  participant API as Studio API / MCP
  participant Store as Scenario Store
  participant Editor as Scenario Editor
  User->>Dialog: Select state flow and enter values
  Dialog->>API: Discover templates or invoke Phoenix tool
  API->>Store: Validate and save scenario
  Store-->>Dialog: Return scenario ID
  Dialog->>Editor: Navigate to saved scenario
Loading

Reviews (7): Last reviewed commit: "fix(studio): create Phoenix scenarios th..." | Re-trigger Greptile

Context used:

@92Infinitus92 92Infinitus92 self-assigned this Aug 20, 2026
Comment thread apps/studio/src/lib/scenarios-api.ts Outdated
@github-actions

Copy link
Copy Markdown
  • P1 — Phoenix workflows call nonexistent backend routes (scenarios-api.ts:69): The coupled Surfpool router does not register phoenix-markets, phoenix-collateral, phoenix-direct-mark, or phoenix-reference-prices. All newly exposed Phoenix flows therefore fail with 404s. Add the backend routes before exposing these controls, or use existing supported endpoints.

  • P2 — Listboxes no longer avoid viewport boundaries (listbox.tsx:83): Replacing Headless UI’s anchored positioning with absolute top-full removes automatic flipping and available-height calculation. Listboxes near the bottom of a dialog or viewport can render partially off-screen. Retain anchored positioning and constrain its calculated available height.

@github-actions

Copy link
Copy Markdown
  • High: scenarios-api.ts:68 calls four new Phoenix endpoints, but this PR provides no corresponding server routes. Market discovery and all creation flows will return 404 unless the backend changes land first. Add/stack the required server implementation or gate the UI until available.

@92Infinitus92

Copy link
Copy Markdown
Collaborator Author

@greptileai

@92Infinitus92

Copy link
Copy Markdown
Collaborator Author
  • High: scenarios-api.ts:68 calls four new Phoenix endpoints, but this PR provides no corresponding server routes. Market discovery and all creation flows will return 404 unless the backend changes land first. Add/stack the required server implementation or gate the UI until available.

could you please check this PR here LimeChain/surfpool#9 as i believe it resolves the above mentioned reported problem

@github-actions

Copy link
Copy Markdown
  • P1 – Invalid Phoenix markets can be saved as scenarios. phoenix-state-dialog.tsx:68 accepts any non-empty symbol, while scenarios-api.ts:135 posts directly to the generic scenario endpoint. This bypasses live market discovery/validation, so typos like BTCC can create unusable scenarios that fail only when applied. Restore market discovery or validate through the Phoenix tool/backend before creation.

@92Infinitus92
92Infinitus92 force-pushed the feat/phoenix-eternal-ui-integrated branch from 8d8eeeb to f6fb37f Compare August 31, 2026 06:21
@92Infinitus92

Copy link
Copy Markdown
Collaborator Author

@greptileai

@github-actions

Copy link
Copy Markdown

Found one issue:

  • scenarios-api.ts:237: new URL(payload.url) rejects relative scenario URLs such as /scenarios?id=..., although these are valid MCP responses. Resolve against studioUrl, e.g. new URL(payload.url, studioUrl), and add a relative-URL test.

…narios API

The backend retired its protocol routes: collateral goes through the one
remaining MCP tool, and the market scenarios post their templates to the
generic API with tick values as the decimal strings the writers expect.
Market discovery went with the routes: the perp asset map address ships in
the templates, so the symbol is typed in and validated against live state.
@92Infinitus92
92Infinitus92 force-pushed the feat/phoenix-eternal-ui-integrated branch from f6fb37f to 9cb3fbb Compare August 31, 2026 06:38
@github-actions

Copy link
Copy Markdown
  • scenarios-bento.types.ts:95: The cascade prompt names a trader and market but instructs create_scenario values containing only quote_lot_collateral and target_ticks. Explicitly include the trader and symbol bindings in their respective overrides; otherwise the generated scenario may target unresolved/default accounts.

  • phoenix-state-dialog.tsx:142: Clear symbolOptions before each market lookup. If a previous lookup succeeded and a later one fails, the old catalog remains and incorrectly validates/rejects symbols for the new Studio instance.

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