DX: add make test-charts-integration for one-command local charts Vitest setup #205
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#205
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?
Problem statement
Frontend charts integration tests (
npm run test:integration) are implemented and run in CI, but local/agent verification is easy to get wrong when using a shared QA stack (dex_indexer+ indexer on:3001).Running integration tests without the fixture seed fails with 404 on the seeded pair candle endpoint — not because charts integration is missing, but because the harness expects a known fixture row that CI seeds automatically.
Observed during GitLab #199 verification:
ChartsPage.integration.test.tsx→GET /api/v1/pairs/{addr}/candles returns candles for seeded pairfailed untilindexer/scripts/seed-charts-integration.sqlwas applied manually todex_indexer.Requirements
Add a single Make target (proposed name:
test-charts-integration; aliastests-charts-integrationoptional) that:CHARTS_INTEGRATION_PAIR_ADDRESS=terra1paircontractabc).:5432or compose — follow existingscripts/lib/postgres-dev.env/AGENTS_LOCAL_POSTGRES_DEV.mdconventions).sqlx migrate runinindexer/).VITE_INDEXER_URL(defaulthttp://127.0.0.1:3001) — fail fast with a clear message if down (do not silently skip).npm run test:integrationviascripts/with-node.sh(same as other frontend Make targets).docs/testing.md,Makefile help, andskills/AGENTS_TESTING_P2_EPIC.md.Out of scope (for this issue)
Relevant files
Makefiletest-charts-integrationtarget; updatehelpscripts/setup-postgres-dev-databases.shscripts/lib/postgres-dev.envDATABASE_URL/ credentialsindexer/scripts/seed-charts-integration.sqlINSERT … ON CONFLICTor upsert script)frontend-dapp/src/test/chartsIntegrationConstants.tsfrontend-dapp/src/pages/ChartsPage.integration.test.tsxfrontend-dapp/vitest.config.integration.tsfrontend-dapp/package.jsontest:integrationscript.github/workflows/test.ymldocs/testing.mdskills/AGENTS_TESTING_P2_EPIC.mdskills/AGENTS_LOCAL_POSTGRES_DEV.mdRecommended fix
New script
scripts/test-charts-integration.sh(orscripts/qa/test-charts-integration.sh):scripts/lib/postgres-dev.env(+ optional repo.env).CHARTS_INT_DATABASE_URLtoDATABASE_URL(dex_indexer) so QA stacks work; allow override via env for isolated DB (e.g.cl8y_charts_intlike CI).ensure_db+cd indexer && sqlx migrate run.curl -sf "${VITE_INDEXER_URL:-http://127.0.0.1:3001}/health"— exit 1 with hint: "Start indexer first (make start-qa or make indexer-dev)".bash scripts/with-node.sh --cwd frontend-dapp -- env VITE_INDEXER_URL=… npm run test:integration.Makefile:
Docs: Replace the 5-step manual bullet list with
make test-charts-integrationas the primary local path; keep env overrides documented.Optional (nice): CI job step calls
./scripts/test-charts-integration.shwithCHARTS_INT_DATABASE_URL=…after starting its ephemeral indexer — reduces drift.Acceptance criteria
make test-charts-integrationfrom repo root passes when Postgres + indexer on:3001are up (host or QA stack).make helplists the new target.docs/testing.mdupdated — one-command path is primary.skills/AGENTS_TESTING_P2_EPIC.mdupdated with the Make command.CHARTS_INTEGRATION_PAIR_ADDRESS/ seed pair address without updating both SQL and TS constant.Verification checklist
:3001→make test-charts-integration→ all integration tests green (7/7 at time of writing).make test-charts-integrationtwice back-to-back — no duplicate-key / seed errors.make test-charts-integration→ fails fast with helpful message (not obscure Vitest 404).grep test-charts-integration Makefile docs/testing.md skills/AGENTS_TESTING_P2_EPIC.md— docs reference the target.dex_indexer(not only empty DB) — candle test passes after Make target runs.Priority
P3 — DX / agent ergonomics; CI already covers charts integration.
Related
docs/testing.md§ Integration Tests (Frontend)mentioned in commit
a09e3c02b2Implemented in
a09e3c0onmain(GitLab #205).Summary
Added
make test-charts-integration(aliasmake tests-charts-integration) backed byscripts/test-charts-integration.sh:scripts/lib/postgres-dev.env(+ optional repo.env)dex_indexer; override withCHARTS_INT_DATABASE_URL)sqlx migrate runinindexer/indexer/scripts/seed-charts-integration.sql—ON CONFLICT DO NOTHING, fixed candleopen_time)VITE_INDEXER_URL/health(default:3001)npm run test:integrationviascripts/with-node.shwith default LocalTerra LCD/RPC env for #166 pool-ref testsDocs / invariants
docs/testing.md— one-command path is primary; fixture pair invariant cross-linkedskills/AGENTS_TESTING_P2_EPIC.md— agent command + invariant rowskills/AGENTS_LOCAL_POSTGRES_DEV.md— Make target cross-linkCHARTS_INTEGRATION_PAIR_ADDRESS(terra1paircontractabc) must stay in sync with seed SQL +frontend-dapp/src/test/chartsIntegrationConstants.tsVerification checklist
:3001(+ LocalTerra LCD for full 7/7):make test-charts-integration→ all integration tests greenmake test-charts-integrationtwice back-to-back → no duplicate-key / seed errorsmake test-charts-integration→ non-zero exit with actionable message (not Vitest 404)grep test-charts-integration Makefile docs/testing.md skills/AGENTS_TESTING_P2_EPIC.md→ docs reference the targetdex_indexerstack → candle test passes after Make target runs@brouie — please verify on your QA stack when convenient. Leaving issue open until confirmed.
mentioned in issue #211
mentioned in issue #230
marked as related to #230
mentioned in commit
da335fa4e1Verification update (agent)
Verified GitLab #205 on branch
verify/issue-205, merged tomainasda335fa.What was wrong
2024-06-01timestamps; indexerGET .../candlesdefaults to a 90-day lookback (DEFAULT_CANDLE_LOOKBACK_DAYS), so the candle test returned[]even after seeding.make deploy-localthe first EMBER/CORAL pair differs.localhostfor LCD (IPv6::1hangs), hostsqlx migratetimeouts, and LCD queries from host when port-forward is flaky.Fixes shipped
indexer/scripts/seed-charts-integration.sql— delete/refresh fixture1hcandle to current UTC hour (documented vsdocs/indexer-invariants.md).scripts/test-charts-integration.sh—127.0.0.1LCD/RPC defaults, docker-network sqlx fallback,_lcd_curlvia compose exec, factory →VITE_LIMIT_ORDER_INTEGRATION_*.frontend-dapp/src/test/limitOrderIntegrationConstants.ts+ Vitestdescribe.skipIfwhen pair env unset (CI / charts-only).Checklist for @brouie
docker compose up -d postgres) + indexer on:3001(make indexer-devor QA)make test-charts-integration→ 5 charts tests pass; 2 limit tests run only aftermake deploy-local+ factory resolve (or skip with message)make test-charts-integrationtwice — no duplicate-key / seed errorsmake test-charts-integration→ non-zero exit with actionable message (not Vitest 404)grep test-charts-integration Makefile docs/testing.md skills/AGENTS_TESTING_P2_EPIC.mddex_indexer— candle test passes after Make targetNote: Full 7/7 green was confirmed for charts (5/5) with indexer + seed; limit-order 2/2 need a deployed LocalTerra factory (this agent hit chain reset / host LCD port quirks). Please confirm 7/7 on your stack before closing.
Verification complete (agent)
Re-ran full #205 checklist with infra healthy on
main(543ca70).make test-charts-integration(Postgres + indexer:3001+ LocalTerra LCD)INSERT 0 0,DELETE 1+INSERT 0 1on candle refresh only)VITE_INDEXER_URL=http://127.0.0.1:39999)grep+make helpdocs/testing.md,skills/AGENTS_TESTING_P2_EPIC.mdreference targetterra146ypndz…from factoryterra1hrpna9v7…)Harness fixes from
da335fa(90-day candle seed window,127.0.0.1LCD defaults, factory env, sqlx docker fallback) confirmed in this environment.Closing as verified.