Skip to content

feat(studio): add GoonFi state scenarios - #14

Open
92Infinitus92 wants to merge 3 commits into
feat/tessera-supportfrom
feat/goonfi-support
Open

feat(studio): add GoonFi state scenarios#14
92Infinitus92 wants to merge 3 commits into
feat/tessera-supportfrom
feat/goonfi-support

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #11 — GoonFi joins the shared PMM dialog Tessera introduced, so this builds on that branch rather than duplicating the dialog.

  • The PMM dialog gains a GoonFi entry in its protocol dropdown, backed by a live market catalog read through list_goonfi_markets, and creates scenarios with create_goonfi_price_scenario. Switching protocol reloads the catalog and re-normalises the selected market, so a market belonging to the other protocol is never carried over.
  • Three AI chips: stale quote, drained pool and price dislocation. Drained pool calls the GoonFi liquidity tool; the other two compose the raw templates on the generic scenario path, naming the template and its target account so the model does not have to guess them.
  • Protocol icon and a per-protocol catalog fetch in scenarios-api, reusing the existing createScenarioWithMcpTool seam.
  • Needs the backend branch for the GoonFi tools and templates: feat(scenarios): add GoonFi state preparation surfpool#13.

npx tsc --noEmit clean. npx vitest run: 358 passed, 27 files.

Greptile Summary

This PR extends Studio’s shared PMM scenario workflow with GoonFi support.

  • Adds live GoonFi market discovery and specialized price-scenario creation through MCP.
  • Adds GoonFi stale-quote, drained-pool, and price-dislocation AI presets.
  • Enables GoonFi templates and protocol artwork across the scenario editor.
  • Adds coverage for market switching, catalog races, validation, MCP payloads, and scenario navigation.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/studio/src/components/svm/pmm-fair-value-dialog.tsx Extends the shared PMM dialog with protocol-specific catalogs, validation, request routing, and guarded asynchronous selection normalization.
apps/studio/src/lib/scenarios-api.ts Adds GoonFi market parsing and scenario-tool wrappers using the existing MCP session and result-handling seam.
apps/studio/src/components/svm/scenarios-bento.types.ts Adds three reachable GoonFi AI scenario prompts for freshness, liquidity, and price-band state changes.
apps/studio/src/components/svm/scenario-editor.tsx Allows GoonFi templates returned by the Studio service to appear in the scenario editor.
apps/studio/src/lib/protocol-icons.ts Registers the new GoonFi protocol artwork.
apps/studio/src/lib/goonfi-scenarios-api.test.ts Covers GoonFi MCP market discovery, malformed responses, argument normalization, and default-market behavior.
apps/studio/src/components/svm/pmm-fair-value-dialog.test.tsx Covers protocol switching, asynchronous catalog races, precision limits, request routing, and scenario opening.

Sequence Diagram

sequenceDiagram
  actor User
  participant Dialog as PMM Dialog
  participant API as Scenario API
  participant MCP as Studio MCP
  participant Editor as Scenario Editor
  User->>Dialog: Select GoonFi
  Dialog->>API: fetchGoonfiMarkets(studioUrl)
  API->>MCP: list_goonfi_markets
  MCP-->>API: Live market catalog
  API-->>Dialog: Normalized market options
  User->>Dialog: Choose market and price
  Dialog->>API: createGoonfiPriceScenario(...)
  API->>MCP: create_goonfi_price_scenario
  MCP-->>API: Scenario URL containing ID
  API-->>Dialog: Scenario ID
  Dialog->>Editor: Open created scenario
Loading

Reviews (3): Last reviewed commit: "test(studio): cover an empty GoonFi cata..." | Re-trigger Greptile

Context used:

- GoonFi joins the shared PMM dialog: a protocol dropdown alongside Tessera, a
  live market catalog read through list_goonfi_markets, and a human price.
- Three AI chips (stale quote, drained pool, price dislocation) that drive the
  GoonFi MCP tools and the raw templates on the generic scenario path.
- Protocol icon and a per-protocol catalog fetch in scenarios-api.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
  • [P2] Reselecting the current protocol leaves the dialog stuck loadingpmm-fair-value-dialog.tsx:71. Selecting the already-selected option clears marketOptions, but protocol hasn’t changed, so the catalog effect doesn’t rerun. The market stays on “Loading markets…” and creation remains disabled. Return early when selectedValue === protocol; add a regression test for this interaction.

Tests weren’t run because dependencies aren’t installed.

…cted

Reselecting the already-selected protocol cleared the catalog without changing
`protocol`, so the effect that reloads it never reran and the market listbox stayed
disabled on "Loading markets…" with creation blocked.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

No concrete bugs or regressions found in the specified PR changes.

One improvement: add a dialog test where switching to GoonFi returns an empty catalog, then verify submission omits market instead of retaining the previous Tessera address.

Validation limits: dependencies aren’t installed, so I couldn’t rerun tests. Backend tool/template compatibility requires the companion surfpool PR #13.

Switching protocol when the new catalog comes back empty has to drop the previous
protocol's market, so the request omits `market` and the backend picks its default rather
than receiving a Tessera address for GoonFi.
@github-actions

Copy link
Copy Markdown
  • [P2] Keep price-dislocation quotes freshscenarios-bento.types.ts:130: The prompt requests only price and reference-band overrides, leaving last_update_slot unchanged. Once the fetched quote expires, swaps fail freshness checks instead of exercising the dislocated price. Include a persistent goonfi-freshness override targeting the default oracle, as the price-scenario workflow does.

Tests weren’t run because dependencies aren’t installed. Backend tool contracts couldn’t be verified from this repository.

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