fix: /protocol leftovers — liquidity 24h-only Δ% + denser UTC volume x-axis labels #677
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#677
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
/protocolGlobal stats still has two leftover display bugs after #667 / #668:+7.782% 24h — 30d). Operators asked for 24h change only.sparseTimeLabelIndexes(..., maxLabels = 5)is the intended cap today. Phone Daily (7 bars) already skips columns (e.g.08-20, gap,08-22…). Same skip on Hourly and Monthly. Prefer a label on every bar; every second bar is acceptable if labels would wrap/collide.Bundle into one frontend issue. Do not split liquidity vs chart — both are
/protocolGlobal stats leftovers from the same QA pass.Related: #667 P667-2 (explicitly kept 24h+30d on liquidity), #668 P668 (axis exists; density was never specified), #652, #569 P569-1, #576 (trailing tiles ≠ calendar bars), #653, #489.
Current codebase
Both leftovers are implemented as specified, not missing widgets. Tests encode the old product choice, so
make verify-issue-667/668stay green while production still looks wrong.ProtocolGlobalStats.tsxSTATS[0]passes twodeltas:liquidity_change_24h_pct(protocol-stat-liquidity-24h, label24h) andliquidity_change_30d_pct(protocol-stat-liquidity-30d, label30d). One cell, one.stat-delta-cluster. Lead copy still says “24h/30d liquidity is vs indexer snapshots.”StatBox.tsxalready groups chips with the$(justify-start/ wrap, #667). Comment still says “Preferdeltasfor liquidity 24h+30d.”liquidity_change_24h_pctandliquidity_change_30d_pctstay onGET /overview(types/index.ts). Snapshot stock % (P569-2).ProtocolVolumeDailyChart.tsxbuildsxLabelsfromsparseTimeLabelIndexes(series.length)and draws SVG<text>underprotocol-volume-chart-xaxis. Tooltip /aria-labelalready have the full UTC period.protocolVolumeGrain.tssparseTimeLabelIndexes(count, maxLabels = 5): ifcount ≤ 5label all; else exactly 5 evenly spaced indexes (first + last inclusive). Comment: “do not label every hourly bar.” Daily min is 7, monthly min 6, hourly min 12 — all three grains therefore skip columns on the default phone plot.formatPeriodAxisLabel: hourly →HH(14), daily →MM-DD(08-26), monthly →YYYY-MM. FixedviewBox320×128,PAD_B = 22,fontSize="8".ProtocolPage.test.tsxassertsprotocol-stat-liquidity-30dtext.e2e/protocol-page.spec.tsrequires the 30d chip visible + grouped (desktop / tablet / phone).protocolVolumeGrain.test.tsassertssparseTimeLabelIndexes(168).length ≤ 5..stat-delta-cluster.” P668-1–P668-8: USD Y-axis + tooltip + grain tabs; no x-label density rule.Why this is needed
— 30dnext to the 24h chip on Total liquidity reads as “this TVL moved 24h and 30d,” then the 30d chip is often an em-dash (window not filled). Operators asked for 24h only in that box.#667shipped the dual-chip on purpose. P667-2 / P569-1 must be amended, not treated as a regression. Leaving the 30d chip is not a grouping leftover — it is the wrong product.08-20…08-22). Monthly (6–24) and Hourly (12–168) inherit the samemaxLabels = 5helper, so the skip is not Daily-only.Constraints / guardrails
flow_change_pct, grain GET allowlist, rollup tables, or wasm. Keepliquidity_change_30d_pcton the wire (additive / old clients). Stop rendering it on Total liquidity.#667grouping. Single remaining liquidity chip (protocol-stat-liquidity-24h) still sits immediately after the$(justify-start/ wrap). Do not restorejustify-between.#653chrome. FlatStatBoxinsideshell-panel. No nestedcard-glass. NoPriceChart.#668grain contract. Tabs Hourly / Daily / Monthly (default Daily).limitstill follows plot width + grain[min, max]. Client still rejects non-allowlisted grain/limit before fetch. Hide chart on 404/501 (P652-6).SUMswap_eventsor N+1 Llama to invent extra axis ticks.viewBox(168 bars ×MM/HH). Do not keep a globalmaxLabels = 5.TRAILING_LIQUIDITY_24H_TITLE+composeStatAriaLabelon the 24h chip. Tooltip stays text (noinnerHTML/eval/javascript:). XSS period /volume_usdstill render as text.null/ non-finite → em-dash. NeverInfinity/ fake0%.docs/frontend.md§ Protocol. Newmake verify-issue-*. Keepverify-issue-667/668/652/550/569/586/653/576green after those scripts are updated to the new product (do not leave them asserting the 30d liquidity chip or≤ 5x-labels).Relevant files
frontend-dapp/src/components/protocol/ProtocolGlobalStats.tsxdeltasentry; keep 24hfrontend-dapp/src/components/ui/StatBox.tsxdeltasstill valid for one chip; no layout revertfrontend-dapp/src/utils/trailingWindowCopy.tsfrontend-dapp/src/utils/protocolVolumeGrain.tsmaxLabels = 5with grain/width-aware step 1 or 2frontend-dapp/src/components/protocol/ProtocolVolumeDailyChart.tsxfrontend-dapp/src/utils/__tests__/protocolVolumeGrain.test.ts168 ≤ 5frontend-dapp/src/pages/ProtocolPage.test.tsxprotocol-stat-liquidity-30din the tile; x-axis text countfrontend-dapp/src/components/ui/__tests__/StatBox.test.tsxdeltasstill allowed for other callers; liquidity page no longer uses twofrontend-dapp/e2e/protocol-page.spec.tsskills/AGENTS_FRONTEND_PROTOCOL_STATS.mddocs/frontend.mdscripts/qa/verify-issue-NNN.sh+make verify-issue-NNNRecommended direction
ProtocolGlobalStatsSTATSliquiditydeltas, keep only the 24h object. Removeprotocol-stat-liquidity-30dfrom this tile. Leaveliquidity_change_30d_pctonIndexerOverviewunused here. Soften the lead sentence from “24h/30d liquidity” to “24h liquidity is vs indexer snapshots” (still not on-chain genesis).sparseTimeLabelIndexes(count, 5)with a helper that takescount,grain, and plot/slot width. Default step 1. If the formatted label width (MM-DD/HH/YYYY-MMat fontSize 8) exceeds the slot, use step 2. Hourly at highlimitmay computestep = ceil(labelPx / slotPx)but Daily/Monthly must stay 1 or 2.textAnchor="middle"; optional extraPAD_Bif dailyMM-DDwraps. Do not rotate the chart into a horizontal USD category plot (P668-1).[0..6]; 6 monthly all or every 2nd; hourly 12 all or every 2nd; hourly 168 is width-clamped, not hard-capped at 5. Playwright — Hourly / Daily / Monthly:protocol-volume-chart-xaxis textcount ≥ceil(barCount / 2)and ≤barCount.scripts/qa/verify-issue-667.sh/668.sh. Update those scripts’ assertions that still require the 30d liquidity chip or≤ 5labels.Acceptance criteria
protocol-stat-liquidity-24h(label24h). No30dtext and noprotocol-stat-liquidity-30dinsideprotocol-stat-liquidity.null24h Δ% → em-dash. NeverInfinity/ fake0%.#667grouping still holds (chip with$, notjustify-between).aria-labelstill show full UTC period + USD (unpriced → em-dash). XSS strings stay text.#653chrome,#576trailing copy, page order (stats → fees → hub → oracle) unchanged.make verify-issue-NNNgreen.Test plan — all paths
+7.782and 30d12.5: tile shows+7.782% 24honly.queryByTestId('protocol-stat-liquidity-30d')is null.liquidity_change_24h_pctnull / missing / non-finite →— 24h. 30d key present or absent must not resurrect a 30d chip.$0+ null 24h →$0+—; no0%/Infinity.liquidity_change_*→ 24h em-dash; tiles still render (P652-6).protocol-stat-volume-30d/protocol-stat-fees-30dstill visible with their own Δ%.chip.right ≤ tile.rightand not under Last 24h vol.sparse/labelIndexes(7, daily)is all 7 or[0,2,4,6]. SVG x-axis text count matches. No two-apart skip like today’s 5-label spread.YYYY-MMmust not overflow into the next label’s box at step 1 — then step 2.limitreset + ResizeObserver debounce unchanged.$0; axis label still the period.RetryError; no invented ticks.--ink-dim; bars--accent.e2e/protocol-page.spec.ts;--project=e2e-smoke --workers=5.Test plan — attack, hack, and abuse
Display-only leftover. Do not re-open fee/volume/TVL math. Fail closed on mis-attribution and injection.
liquidity_change_24h_pct,utc_day/utc_hour/utc_month,volume_usdwith<script>,javascript:,<img onerror>render as text or em-dash. NoinnerHTML. Nostyle=/classNamefrom API strings.formatPeriodAxisLabelslices trusted ISO-like keys. A hostileutc_daymust not become an SVG<a href>or event handler.— 30don Total liquidity is the abuse (operators read a filled 30d TVL move that is not this tile’s job). RTL/e2e must fail if that chip returns.1e309/ NaNInfinity%orNaNticks.—. Do not paint a$0bar then a green “flat” story.from/tostill 400. Extra query junk must not bust the 60s cache (P668-5).swap_eventsSUM. No Llama N+1. Resize debounce stays. Label helper is O(n) over the already-capped series./protocolis public census. No connect prompt, no signing, no localStorage of Δ% or grain (grain may stay React state only).?ticker=.MM-DD/YYYY-MMlabels must not cover the neighbor bar’s focus target.Verification criteria
Done when:
make verify-issue-NNN(new script) is green: skill/docs say liquidity 24h-only and x-axis step 1 or 2; Vitest covers both; Playwright e2e-smoke @ 5 workers checks the 30d liquidity chip is gone and Hourly/Daily/Monthly x-label counts meet the floor.make verify-issue-667668652550569586653576stay green after their assertions are updated to the new product (no leftover “must show liquidity-30d” / “≤ 5 x-labels”)./protocolat 390 / 820 / 1280, light + dark: Total liquidity has one 24h chip; Daily/Hourly/Monthly show a label on every bar or every second bar.Out of scope
marked as related to #667
marked as related to #668
marked as related to #652
marked as related to #569
mentioned in merge request !1181
Implemented on
issue-677-protocol-leftovers— !1181.Done
protocol-stat-liquidity-24h). Noprotocol-stat-liquidity-30don the tile. Volume / fee 30d tiles unchanged.#667grouping kept (justify-start/ wrap). Em-dash on missing 24h Δ%.maxLabels = 5.skills/AGENTS_FRONTEND_PROTOCOL_STATS.md+docs/frontend.md.make verify-issue-677green (Vitest + Playwright e2e-smoke @ 5 workers).Not done (out of scope or env)
volume_aggregator_refreshes_daily_and_changealready fails on this VM; not in this diff.mentioned in commit
b7b6f4e9camentioned in issue #686
marked as related to #686
Merged via !1181 (
b7b6f4e9) ontomain36d64528.make verify-issue-677PASS (7/7), including Playwrighte2e/protocol-page.spec.tsat 5 workers (PLAYWRIGHT_SKIP_CHAIN=1). Coolify leftover: frontend rebuild so liquidity is 24h-only Δ% and the UTC volume axis is denser. Do not reopen unless P569-1 / P668-9 is wrong. Post-merge ops: #686.mentioned in issue #689
marked as related to #689
mentioned in issue #703
marked as related to #703