feat(ui): action-sentence layer for extrinsic/event headlines - #8453
Merged
Conversation
Closes #8371 (client-side UI deliverable; the schema/API contract field is scoped out -- see PR description) New apps/ui/src/lib/metagraphed/chain-summaries.ts: summarizeCall()/ summarizeEvent() render a one-line action sentence over the existing decode infrastructure (#4319/#8322) -- "5GQi...sQQ committed time-locked weights for SN89, revealing at round 30,777,610" instead of "SubtensorModule.commit_timelocked_mechanism_weights" plus a raw arg table. A pallet.method with no template returns null; callers keep today's raw rendering rather than ever guessing a sentence. Every template is grounded in a real decoded payload captured live from api.metagraph.sh, including several arg-shape surprises found along the way: chain_events args are frequently POSITIONAL arrays (no field names at all) rather than the keyed objects account_events uses, and the exact positions differ per pallet.method -- confirmed individually for WeightsSet, StakeAdded/Removed, NeuronRegistered, and both TimelockedWeights* events before writing their templates. Wired into three surfaces: the extrinsic detail masthead (sentence as headline, raw module.function demoted to the existing "Call" field row), the raw all-events feed (ChainEventCard + desktop table), and an account's own "Signed extrinsics" section. Coverage measured against the most recent 10k extrinsics + 10k chain events from production (chain-summaries.coverage.test.ts, opt-in via RUN_COVERAGE=1, skipped in normal CI): 98.37% combined (97.22% extrinsics, 99.52% events) -- comfortably past the issue's 95% bar.
Contributor
|
Important 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏳ LoopOver is waiting…LoopOver has seen this pull request and is waiting on CI checks to finish before reviewing it. This comment will update once the review runs. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟨 Waiting |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
metagraphed-ui | f2548cf | Commit Preview URL Branch Preview URL |
Jul 27 2026, 06:15 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8453 +/- ##
=======================================
Coverage 97.81% 97.81%
=======================================
Files 419 419
Lines 29074 29074
Branches 10931 10931
=======================================
Hits 28440 28440
Misses 143 143
Partials 491 491 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8371 — client-side UI deliverable. Scope note posted on the issue before implementation: the schema/API
summarycontract field is deferred to a follow-up rather than bundled into this PR (see the issue comment for the full reasoning).What this does
New
apps/ui/src/lib/metagraphed/chain-summaries.ts:summarizeCall()/summarizeEvent()render a one-line action sentence over the existing decode infrastructure (#4319 nested-call decode, #8322 decoded events) — the issue's own worked example, "Validator 5GQi…sQQ committed time-locked weights for SN89, revealing at round 30,777,610", instead ofSubtensorModule.commit_timelocked_mechanism_weightsplus a raw arg table. A pallet.method with no template returnsnull; callers keep today's raw rendering — a sentence is never guessed.Grounded in real data, not assumption
GET /api/v1/chain/calls?group_by=module_functionandGET /api/v1/chain-events/stats— the top 20 calls alone cover ~97% of volume, so every template targets something that actually matters.api.metagraph.shbefore being written, not guessed.chain_eventspayloads are frequently positional arrays with no field names at all — confirmed live forWeightsSet([[89], 122]),StakeAdded/StakeRemoved([coldkey, hotkey, [amount], [amount2], [netuid], version]),NeuronRegistered([[netuid], uid, hotkey]), and bothTimelockedWeights*events — distinct fromaccount_events's keyed-object shape, and the field order differs per event. My first coverage run (94.68%, just under the 95% bar) caught this directly: templates that assumed named fields were silently returningnullon these five high-volume events. Fixed by reading positional args by index against the real captured shape for each.RootClaimedcarries nonetuidfield at all (just{coldkey}), andAutoStakeAdded's amount field is namedincentive, notamount— both fixed to match reality rather than the assumed shape.Wired into three surfaces
module.functiondemotes to the existing "Call" field row further down (unchanged).ChainEventCard+ the desktop table inchain-events-feed.tsx): leads with the sentence, falling back toPallet.Methodwhen there's no template. This is shared by/events, the embedded Chain-hub preview, and anywhere else the component is reused.Coverage: 98.37%, past the 95% bar
chain-summaries.coverage.test.ts— opt-in (RUN_COVERAGE=1 npx vitest run src/lib/metagraphed/chain-summaries.coverage.test.ts),describe.skipIf-gated so it's a no-op in normal CI (no network dependency there). Measured against the most recent ~10k extrinsics + ~10k chain events from production:Remaining extrinsic gaps are long-tail calls under ~1% volume each (
remove_stake_full_limit,serve_axon,burned_register,transfer_stake, etc.) — deliberately left asnull-returning gaps rather than guessed, since I don't have verified real arg shapes for them in this session.Verification
New tests: 52 cases in
chain-summaries.test.ts(one fixture per template family, using the real captured shapes above — including the positional-array cases and both the "found via a template with wrong assumptions" fixes).tsc --noEmitand scopedeslintclean. Full suite: 1626 passed, 1 skipped (the opt-in coverage test) across 206 files.Verified live via a local dev server against real production data:
Balances.transfer_keep_aliverenders "5FqBL9…Lxoy2s transferred 1.00 τ to 5DxQZ2…7uodow." as the headline, with the rawBalances.transfer_keep_alivestill present in the Call field row below./eventsnow reads as a stream of real sentences — "committed time-locked weights, revealing at round X", "Weights were set for SN128", "Transferred X from A to B" — instead of a wall ofPallet.Methodlabels.Maintainer PR — reviewed live via a local dev server rather than the contributor screenshot matrix (existing card/table/masthead chrome is unchanged; only the text content inside changes).