Skip to content

Vault list does not expose CMS metadata #456

Description

@rossgalloway

Summary

Vault name changes made in the CMS are reflected in the vault snapshot endpoint by GET /api/rest/snapshot/:chainId/:address, but they are not reflected in the vaults list endpoint by GET /api/rest/list/vaults. As a result, yearn.fi can use the updated metadata name on a vault detail page, while the same vault continues to show an older name in the vault list.

The list response does not expose meta.name or meta.displayName, so the frontend cannot apply the same name priority without making an additional snapshot request for every vault.

Current behavior

The vault list query in packages/web/app/api/rest/list/db.ts currently resolves name as:

COALESCE(
  thing.defaults->>'name',
  snapshot.snapshot->>'name',
  snapshot.hook->'meta'->>'displayName'
) AS name

This has two consequences:

  1. thing.defaults.name and snapshot.snapshot.name take precedence over newer metadata.
  2. snapshot.hook.meta.name is not read at all.

The list schema then returns only the resolved top-level name; it does not include the underlying metadata name fields.

Live example

For Ethereum vault 0x6E9455D109202b426169F0B9B830B3d67623122E270:

GET /api/rest/list/vaults
name: "LP Yearn CRV Vault v2"

GET /api/rest/snapshot/1/0x6E9455D109202b426169F0B9B830B3d67623122E270
meta.name: "yCRV Factory yVault"
meta.displayName: ""
name: "LP Yearn CRV Vault v2"

yearn.fi's vault-detail flow has access to the snapshot and can prefer meta.name. Its vault-list flow consumes /list/vaults, where that field is unavailable, so the two surfaces show different names.

Proposed API change

Prefer an additive change that exposes the source metadata in each vault-list item while preserving the existing top-level name for compatibility:

{
  "name": "LP Yearn CRV Vault v2",
  "meta": {
    "name": "yCRV Factory yVault",
    "displayName": ""
  }
}

The fields can be selected from the snapshot hook already joined by the list query:

snapshot.hook->'meta'->>'name'
snapshot.hook->'meta'->>'displayName'

This lets yearn.fi apply one consistent frontend priority on both list and detail pages:

meta.name -> meta.displayName -> snapshot/list name

It also preserves the distinction between source fields instead of collapsing them in Kong, and avoids N+1 snapshot requests from list consumers.

Acceptance criteria

  • /api/rest/list/vaults exposes enough information for consumers to prefer meta.name, then meta.displayName, without fetching each vault snapshot.
  • /api/rest/list/vaults/:chainId returns the same naming fields/semantics.
  • Existing top-level name consumers remain compatible.
  • Empty metadata strings fall through to the next valid name.
  • The list schema, REST documentation, and cache refresh path are updated for the chosen response contract.
  • Tests cover meta.name, meta.displayName, snapshot name, and defaults/list-name fallbacks.
  • The live example above returns enough data for yearn.fi's list and detail page to display the same metadata-driven name.

Related context

Issue #300 expanded the vault-list API to avoid per-vault requests. This issue is specifically about preserving metadata-driven name updates in that expanded list contract.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions