Skip to content

rename chain slug ton → gram + 301 redirects + Prom straddle - #705

Merged
Flotapponnier merged 1 commit into
mainfrom
chore/ton-to-gram-slug-rename
Jun 25, 2026
Merged

rename chain slug ton → gram + 301 redirects + Prom straddle#705
Flotapponnier merged 1 commit into
mainfrom
chore/ton-to-gram-slug-rename

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Follow-up to #697. The display rebrand landed but the slug 'ton' was still leaking into search results ('Ton' / 'Tonapi' title-case fallback) and into URLs (/chains/ton, /products/ton). This PR finishes the migration with full slug rename + 301 redirects + Prom regex straddle.

What lands

Slug rename (TS layer)tongram across CHAINS, PROVIDER_REGISTRY, logo-manifest, brand, chain-kpis. CANONICAL_NAMES gets gram: 'Gram' + tonapi: 'TonAPI' so the title-case fallback never produces 'Ton' or 'Tonapi'. PRODUCT_ALIASES adds ton → gram so stale inbound references resolve to the canonical.

Redirects (next.config.ts)/chains/ton/chains/gram (308), /products/ton/chains/gram, /benchmarks/:slug/ton/benchmarks/:slug/gram. CHAIN_REDIRECT_SLUGS array updated.

Bench YAMLs — per_chain_explainer.slug + provider entry slug renamed ton → gram. Template refs {{p50:ton}}{{p50:gram}}. Prom queries straddle: chain="ton"chain=~"ton|gram" (the harness still emits ton; the regex matches both during the transition window so there's zero data gap).

wallet-labels-coverage dimension value kept as ton for now (Prom label injected at runtime — flip when the wallet-labels harness redeploys).

Out of scope

Harness Go code in harnesses/l1-finality + harnesses/network-fees still emits chain="ton". Updating those = separate Railway redeploy PR. The straddle regex covers the gap.

Rollback

  • Revert the redirects in next.config.ts only — gram slug stays as a recognised alias via PRODUCT_ALIASES.ton = 'gram'.
  • The Prom straddle means data keeps flowing regardless of harness state.

Test plan

  • Cmd+K, type 'gram' → top result reads 'Gram' chain (no more 'Ton').
  • /chains/ton → 308 → /chains/gram (page renders with Gram badge, leader, p50).
  • /products/ton → 308 → /chains/gram.
  • /benchmarks/l1-finality/gram → renders per-chain explainer for Gram.
  • /benchmarks/l1-finality leaderboard row 'Gram' still has live p50 (Prom straddle works).
  • No regression on other chains in same benches.

Follow-up to the TON → Gram display rebrand (#697). The 'Ton' label
was still leaking into search results and the URL /chains/ton was
visible to users. This PR renames the chain slug ton → gram with 301
redirects so inbound links + SEO rank signal consolidate onto the new
canonical, and adds a Prom regex straddle so the existing harness
keeps feeding live data through the transition.
## Slug rename (TS layer)
- src/lib/chains.ts: slug 'ton' → 'gram' (label/description/native unchanged)
- src/data/provider-registry.ts: rekey ton → gram
- src/lib/logo-manifest.ts: gram → /logos/ton.svg (file kept, slug renamed)
- src/lib/brand.ts: rekey color entry
- src/lib/chain-kpis.ts: rekey to gram, DefiLlama API string stays 'TON' (verified live)
- src/lib/providers.ts:
- CANONICAL_NAMES: gram → 'Gram', tonapi → 'TonAPI' (was title-casing to 'Tonapi')
- PRODUCT_ALIASES: ton → gram (stale inbound references resolve to canonical)
## Redirects (next.config.ts)
- /chains/ton → /chains/gram (308 permanent)
- /products/ton → /chains/gram (308 permanent)
- /benchmarks/:slug/ton → /benchmarks/:slug/gram (308 permanent)
- CHAIN_REDIRECT_SLUGS: ton → gram so /products/gram keeps redirecting to /chains/gram
## Bench YAMLs
- per_chain_explainer.slug: ton → gram (matches the new /benchmarks/<bench>/gram URL)
- provider entry slug: ton → gram (matches CHAINS new slug for surfaces that ref by slug)
- Template refs {{p50:ton}} → {{p50:gram}}
- Prom queries: chain="ton" → chain=~"ton|gram" (straddle during harness relabel
window; the regex matches the current chain="ton" labels and the future
chain="gram" labels, so the bench keeps rendering live data with no gap)
- wallet-labels-coverage dimension value stays 'ton' (Prom label the harness
emits at runtime; flip to 'gram' once the harness redeploys)
## Out of scope (separate harness PR)
The harness Go code in harnesses/l1-finality/ and harnesses/network-fees/
emits chain="ton" labels. Updating those is a separate Railway redeploy.
The straddle regex covers the transition with zero data gap.
## Test plan
- [ ] Cmd+K, type 'gram' → top result reads 'Gram' chain (no more 'Ton').
- [ ] /chains/ton → 308 → /chains/gram (page renders with Gram badge, leader, p50).
- [ ] /products/ton → 308 → /chains/gram.
- [ ] /benchmarks/l1-finality/gram → renders per-chain explainer.
- [ ] /benchmarks/l1-finality leaderboard row Gram still has live p50 (Prom straddle works).
- [ ] No regression on other chains in same benches.
@Flotapponnier
Flotapponnier merged commit 8258ff4 into mainJun 25, 2026
1 check passed
Flotapponnier added a commit that referenced this pull request Jun 25, 2026
Diagnostic: after PR #705 (chain slug ton → gram), /chains/gram 404s
and /benchmarks/network-fees still renders 'TON' in chain headings.
Two root causes:
1. getBenchmarksForChain('gram') filters results[].slug === 'gram',
but the materialize worker's KV snapshots still hold the legacy
results[].slug === 'ton' (worker on Railway runs from the private
mobula-api repo; it hasn't redeployed with the renamed YAML yet).
→ 0 matches → notFound() at chains/[slug]/page.tsx:90.
2. ChainHeadingsSummary renders r.name verbatim. Stored snapshots
still carry name='TON', so the heading reads 'TON native transfer
fee usd' even though chains.ts now says label='Gram'.
Fix: introduce a chain-slug alias system so the canonical layer
absorbs the rebrand without waiting on the harness.
- src/lib/chains.ts:
- CHAIN_SLUG_ALIASES { ton: 'gram' } — single source of truth.
- canonicalChainSlug(slug) and chainLabelForSlug(slug) helpers.
- getBenchmarksForChain now matches on the canonical slug + any
legacy alias, so /chains/gram surfaces benches whose stored
results still carry slug='ton'.
- src/lib/spec.ts:
- overlayEditorial reconciles stale stored results against the
current spec. For each result whose slug is a known legacy alias
(e.g. 'ton'), look up the spec provider by canonical slug
('gram'), rewrite result.slug + result.name to match. Downstream
surfaces (leaderboard table, search dialog, ChainHeadings) all
see the canonical identity without any per-component patch.
- Cache keys bumped bench-unfiltered v12 → v13 and
all-benchmarks v16 → v17 so the unstable_cache regenerates
through the new reconciliation path on deploy.
- src/components/chain-headings-summary.tsx:
- Anchor id, link URL, and explainer lookup go through
canonicalChainSlug so a stale 'ton' result still hits the renamed
'gram' explainer + lands at /benchmarks/<bench>/gram.
- Display name resolves through chainLabelForSlug, with the bench
result name as a fallback. Renders 'Gram' the moment chains.ts is
updated — no wait on the materialize worker.
Test plan:
- /chains/gram → 200 with l1-finality + network-fees in the list.
- /benchmarks/network-fees → chain heading reads 'Gram transaction
fee usd', anchor id='gram', link to /benchmarks/network-fees/gram.
- /api/citable still returns rows for both old + new slug surfaces
(no impact on machine-readable consumers).
- Harness on Railway can stay on chain='ton' label; the existing Prom
regex straddle (PR #705) keeps queries hitting both labels.
@Flotapponnier
Flotapponnier deleted the chore/ton-to-gram-slug-rename branch July 17, 2026 14:41
Sign up for freeto 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

@Flotapponnier