Frontend: real-library Vitest hardening (large candles + visible-range autoscale) #229
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#229
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
Extend the real-library Vitest suite (#211) with a large-candle performance guard and USD autoscale integration using the chart’s actual visible logical range (not only a synthetic
original()callback).Bundled scope: large-candle perf guard · real visible-range autoscale
Current codebase
vitest.config.charts.ts,src/test/chartsSetup.tspriceChartLightweightRealLibrary.charts.test.ts— 220 candles OK; autoscale test invokes provider with mockoriginal()priceChartPriceScale.test.ts—minLowInVisibleLogicalRange,clampUsdPriceChartAutoscalePriceChartLightweightCanvas.tsx— provider readschart.timeScale().getVisibleLogicalRange()src/test/chartTestFixtures.ts,chartTestOptions.ts.github/workflows/test.yml—npm run test:chartsinfrontendjob after unit teststestTimeout: 15000in charts configWhy this is needed
original()output; production bug could mis-read visible range and still pass.Constraints and guardrails
npm run test:charts— do not slow defaulttest:run.priceChartPriceScale.test.ts— don’t duplicate all cases.Relevant files
frontend-dapp/src/components/charts/__tests__/priceChartLightweightRealLibrary.charts.test.tsfrontend-dapp/src/components/charts/__tests__/PriceChartLightweightCanvas.charts.test.tsxfrontend-dapp/src/components/charts/priceChartPriceScale.tsfrontend-dapp/src/test/chartTestFixtures.tsfrontend-dapp/vitest.config.charts.tsfrontend-dapp/package.json(test:charts)docs/testing.md,skills/AGENTS_FRONTEND_PRICE_CHART.mdRecommended direction
makeChartCandlePoints(500)or1500withtestTimeoutbump if needed; assert completes, canvas present,chart.remove()succeeds.describe.runIf(process.env.CI)for 2000+ row soak — document in testing.md.setData+fitContent, set visible logical range (or scroll) so subset of candles visible; invoke capturedautoscaleInfoProvider; assertminValue >= 0andminValue >= minLowof visible subset.Acceptance criteria
test:chartsincludes large-candle case (≥500 rows) within configured timeout.getVisibleLogicalRange()+ fixture candle lows.docs/testing.md.npm run test:rununchanged.frontendjob still passes (or separate job if split — see bundled CI issue).Test plan — functional paths
setDatarefresh 500→600remove(); no canvasesTest plan — attack vectors
getVisibleLogicalRange()nullpriceChartPriceScaleVerification criteria
npm run test:chartsgreen locally and in CI.make test-frontend-chartsgreen.docs/frontend.mdinvariant table references new tests.Related issues
marked as related to #211
marked as related to #151
marked as related to #113
mentioned in issue #230
mentioned in commit
13e8c0392fmentioned in commit
0413c55d02Implementation complete (merged to
main)@brouie — please verify when you have a moment. Leaving this issue open until QA sign-off.
Summary
Extended the real-library Vitest suite (#211) per #229:
it.runIf(process.env.CI)).setVisibleLogicalRange, autoscale uses the chart’s actualgetVisibleLogicalRange()(not only a syntheticoriginal()callback).frontend-dapp/src/test/chartRealLibraryHarness.ts— shared mount + production-mirror autoscale wiring.docs/testing.md(CI ceiling),docs/frontend.md(invariant table),skills/AGENTS_FRONTEND_PRICE_CHART.md.Merge commit on
main:13e8c03.Verification checklist
cd frontend-dapp && npm run test:charts— 21 passed, 1 skipped locally (2000 soak skipped withoutCI)CI=1 npm run test:charts— 22 passed including 2000-candle soakmake test-frontend-chartsfrom repo rootnpm run test:run— unchanged (pure scale math still inpriceChartPriceScale.test.tsonly)docs/testing.md§ Real lightweight-charts — large-candle ceiling documentedskills/AGENTS_FRONTEND_PRICE_CHART.md— #229 cross-links presentCommands
mentioned in commit
09550bc777mentioned in issue #227
mentioned in issue #211
QA verification complete (@agent verify/issue-229)
Verified on
main@54a6346using git worktreeverify/issue-229. No code changes required — implementation meets all acceptance criteria from the issue body and the post-merge checklist.Commands run
make test-frontend-chartsCI)CI=1 npm run test:chartsnpm run test:runAcceptance criteria (issue body)
test:chartsincludes large-candle case (≥500 rows) within configured timeout — 500 + 1500 tests inpriceChartLightweightRealLibrary.charts.test.tsgetVisibleLogicalRange()aftersetVisibleLogicalRange— zoom test assertsminValue >= expectedMinLowfrom fixture lowsdocs/testing.md§ Real lightweight-charts — 500/1500 always, 2000 CI-only, 15s default / 25–30s per large testsnpm run test:rununchanged (pure scale math remains inpriceChartPriceScale.test.ts)docs/frontend.mdinvariant table references #229 tests +chartRealLibraryHarness.tsFunctional test plan (issue table)
setDatarefresh 500→600remove()Attack vectors
docs/testing.mduses full-series min low when visible logical range is nulloriginal()Docs / agent cross-links
docs/testing.md— #229 row in P2 table + large-candle ceiling paragraphdocs/frontend.md— price chart invariant table cites #229, 500/1500/2000 guardsskills/AGENTS_FRONTEND_PRICE_CHART.md— harness + test file mapping for #229Closing as all verification criteria pass.
mentioned in issue #337