Skip to content

feat(studio): add Tessera fair-value preset and staleness chip - #11

Open
92Infinitus92 wants to merge 1 commit into
feat/phoenix-eternal-ui-integratedfrom
feat/tessera-support
Open

feat(studio): add Tessera fair-value preset and staleness chip#11
92Infinitus92 wants to merge 1 commit into
feat/phoenix-eternal-ui-integratedfrom
feat/tessera-support

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Pairs with LimeChain/surfpool#11 (the create_tessera_fair_value_scenario tool and the tessera templates) — merge after it, the preset needs that backend.

Stacked on #9 — reuses its string-values scenarios API, the constant-catalog fetch and the MCP creator seam.

  • "PMM fair value" preset: market picker fed by the 26-pair catalog (free-text address fallback when the catalog fails to load), price input, and creation through the create_tessera_fair_value_scenario MCP tool — no client-side math, the backend derives both ratio fields.
  • "Tessera Stale Quote" AI chip, goal-level like every other protocol's chip; the procedure lives in the backend template's llm_context.
  • Three file-internal phoenix helpers are generalized instead of duplicated (scenarioTemplate, createScenarioWithMcpTool, ScenarioCreationResult) — expect a small, mechanical conflict on those lines when this merges alongside the phoenix branch.
  • 317 tests green, tsc clean.

Greptile Summary

The PR adds a Tessera fair-value scenario preset and a Tessera stale-quote AI example, relying on the explicitly paired Surfpool backend change.

  • Adds a PMM dialog with catalog-backed market selection, free-text fallback, decimal-price validation, and MCP scenario creation.
  • Adds Tessera protocol presentation across scenario presets, AI examples, icons, and the raw-layout scenario editor.
  • Generalizes scenario-template lookup and MCP-backed scenario creation helpers.
  • Extends tests for the new dialog, API adapter, icon, preset, and AI prompt behavior.

Confidence Score: 5/5

The PR appears safe to merge with its explicitly paired Surfpool backend change.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/studio/src/lib/scenarios-api.ts Adds Tessera catalog loading and MCP-backed scenario creation while generalizing the existing template and MCP helper seams; no eligible blocking defect remains.
apps/studio/src/components/svm/pmm-fair-value-dialog.tsx Implements catalog-backed market selection, free-text fallback, price validation, submission state, and backend error presentation.
apps/studio/src/components/svm/scenario-editor.tsx Enables Tessera templates and derives editable fields from raw-layout metadata when an IDL account structure is unavailable.
apps/studio/src/components/svm/scenarios-bento.tsx Integrates the new preset dialog into scenario creation, refresh, and editor navigation.
apps/studio/src/components/svm/scenarios-bento.types.ts Adds the Tessera stale-quote example prompt and protocol association.

Sequence Diagram

sequenceDiagram
  actor User
  participant Dialog as PMM Fair-Value Dialog
  participant Studio as Studio Scenario API
  participant MCP as Surfpool MCP Server
  User->>Dialog: Open preset
  Dialog->>Studio: GET /v1/scenarios/templates
  Studio-->>Dialog: tessera-fair-value market catalog
  User->>Dialog: Select market and enter price
  Dialog->>MCP: create_tessera_fair_value_scenario
  MCP-->>Dialog: Scenario editor URL with id
  Dialog-->>User: Navigate to scenario editor
Loading

Reviews (4): Last reviewed commit: "feat(studio): add Tessera fair-value pre..." | Re-trigger Greptile

Context used:

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
  • pmm-fair-value-dialog.tsx:80 — The empty initial catalog is treated as a failed catalog. While loading, users see free-text input and can submit any market before the catalog resolves, bypassing catalog-only validation. Track an explicit loading state and enable fallback only after loading finishes unsuccessfully.

Comment thread apps/studio/src/lib/scenarios-api.ts
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
  • scenarios-api.ts:171Blocking: The preset calls create_tessera_fair_value_scenario and expects tessera-fair-value, but the coupled Surfpool backend exposes neither contract. Catalog loading falls back to free text, then every creation attempt fails. Land/version the backend support before enabling this UI, or feature-detect the tool/template and hide the preset.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
  • Medium — pmm-fair-value-dialog.tsx:46: canCreate remains true while marketOptions === null. After reopening, a previously selected market persists and can be submitted while the UI displays “Loading markets…”, bypassing catalog validation. Require catalog loading to finish before enabling creation, or reset market when opening.

The PMM fair-value dialog picks a market from the tessera-fair-value template's
constant catalog and posts a human price through the Tessera MCP tool. Every
atomic ratio is derived backend-side from the two mints' decimals, so there is
no price math in the client.

The staleness chip reads each market's own freshness_limit_slots out of the same
catalog and passes its negation as the slot lead, because the limit differs per
market. It goes through create_scenario and the tessera-stale-quote template
rather than a protocol-specific tool.
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
  • scenario-editor.tsx:394: Raw Tessera u64/u128 fields are classified as numeric, then converted with Number(...) when edited. Atomic ratio values can exceed Number.MAX_SAFE_INTEGER, causing precision loss before saving. Preserve these values as decimal strings, consistent with the string-values API.

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