fix(charts): blank price chart for ALPHA pairs #1320

Merged
PlasticDigits merged 4 commits from issue/1315 into main 2026-09-22 16:51:37 +00:00

Fixes #1315

Summary

UST1/ALPHA and CL8Y/ALPHA price candles now have a subject. Factory open/high/low/close stay USD of 1 human asset_0. When usd_leg=asset_1, GET /api/v1/pairs/{addr}/candles omits those four fields and sends the subject OHLC on subject_open/high/low/close, so a cached client drops the bar instead of plotting USD of asset_1 as USD of asset_0. Neither-catalog rows stay human-only (*_human, no USD label). swap_events.price_usd is unchanged. There is no ALPHA or CL8Y peg.

/charts defaults both the price pane and the pill to asset_1 when usd_leg=asset_1 and there is no ?price= or Charts session flag. defaultChartsDisplayInverted() stays false for every other pair. 24h OHLC, TWAP, and tape Price stay on swap price_usd.

Boot gap-fill writes candles only for pairs that have a positive swap price and zero candle rows. The done marker is set only when the failure count is 0, so the next boot retries pairs that still have zero rows. down.sql deletes stamped gap-fill keys, every usd_leg = 'asset_1' row, and every row with NULL open, then drops candles.usd_leg and the stamp objects.

ADR 0012 stays Proposed.

Acceptance

  • UST1/ALPHA positive USD of 1 human ALPHA is the same in either factory slot.
  • CL8Y/ALPHA uses human OHLC and is not labeled USD.
  • USD columns are omitted when neither leg is catalog.
  • Missing catalog print, non-positive H, and overflow skip the bucket.
  • A spoofed ALPHA symbol is not a special mark.
  • Empty state for a pair with no trades is unchanged.
  • A catalog pair with no positive USD stays empty even when *_human is present.

Validation

  • cargo test --lib candle_subject — 5 passed
  • cargo test --lib project_tests — 3 passed
  • cargo test --lib gap_fill — 2 passed
  • tsc -p frontend-dapp/tsconfig.app.json --noEmit — passed
  • Vitest: priceChartCandles.test.ts, tradePairDisplayOrientation.test.ts, PriceChart.test.tsx — passed (including the human-only fixture and the usd_leg=asset_1 default)
  • make verify-issue-1315 is the gate (those lib filters plus the three Vitest files). It was not run as one Make target on this VM because scripts/with-node.sh needs nvm; the same cargo filters and Vitest files were run directly.

Gaps

  • No LocalTerra, Playwright, or live indexer. The issue gate does not require them.
  • Indexer integration tests (candle_usd_mark, candle_human_usd, candle_skip_zero_price) compiled and were not executed (no Postgres on this run).
  • Cached clients show the empty pane for usd_leg=asset_1 until they load the new bundle. That is the wire contract.
Fixes #1315 ## Summary UST1/ALPHA and CL8Y/ALPHA price candles now have a subject. Factory `open/high/low/close` stay USD of 1 human `asset_0`. When `usd_leg=asset_1`, GET `/api/v1/pairs/{addr}/candles` omits those four fields and sends the subject OHLC on `subject_open/high/low/close`, so a cached client drops the bar instead of plotting USD of `asset_1` as USD of `asset_0`. Neither-catalog rows stay human-only (`*_human`, no USD label). `swap_events.price_usd` is unchanged. There is no ALPHA or CL8Y peg. `/charts` defaults both the price pane and the pill to `asset_1` when `usd_leg=asset_1` and there is no `?price=` or Charts session flag. `defaultChartsDisplayInverted()` stays false for every other pair. 24h OHLC, TWAP, and tape Price stay on swap `price_usd`. Boot gap-fill writes candles only for pairs that have a positive swap price and zero candle rows. The done marker is set only when the failure count is 0, so the next boot retries pairs that still have zero rows. `down.sql` deletes stamped gap-fill keys, every `usd_leg = 'asset_1'` row, and every row with NULL `open`, then drops `candles.usd_leg` and the stamp objects. ADR 0012 stays **Proposed**. ## Acceptance - UST1/ALPHA positive USD of 1 human ALPHA is the same in either factory slot. - CL8Y/ALPHA uses human OHLC and is not labeled USD. - USD columns are omitted when neither leg is catalog. - Missing catalog print, non-positive H, and overflow skip the bucket. - A spoofed ALPHA symbol is not a special mark. - Empty state for a pair with no trades is unchanged. - A catalog pair with no positive USD stays empty even when `*_human` is present. ## Validation - `cargo test --lib candle_subject` — 5 passed - `cargo test --lib project_tests` — 3 passed - `cargo test --lib gap_fill` — 2 passed - `tsc -p frontend-dapp/tsconfig.app.json --noEmit` — passed - Vitest: `priceChartCandles.test.ts`, `tradePairDisplayOrientation.test.ts`, `PriceChart.test.tsx` — passed (including the human-only fixture and the `usd_leg=asset_1` default) - `make verify-issue-1315` is the gate (those lib filters plus the three Vitest files). It was not run as one Make target on this VM because `scripts/with-node.sh` needs nvm; the same cargo filters and Vitest files were run directly. ## Gaps - No LocalTerra, Playwright, or live indexer. The issue gate does not require them. - Indexer integration tests (`candle_usd_mark`, `candle_human_usd`, `candle_skip_zero_price`) compiled and were not executed (no Postgres on this run). - Cached clients show the empty pane for `usd_leg=asset_1` until they load the new bundle. That is the wire contract.
ALPHA pairs stay blank because ingest skips candles when asset_1
has no catalog USD. ADR 0012 stores USD of the other leg, or human
quote-per-base when neither leg is catalog, without a peg.
Limit gap fill to pairs with no candle rows, skip a catalog pair when the print is missing, and keep Trade invert off the asset_1 chart series.
fix(charts): plot ALPHA pair prices without a false USD series
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ed3b9705b1
Factory open/high/low/close stay USD of asset_0. When the subject is asset_1, GET omits those fields and sends subject OHLC. Charts defaults the pane and pill to asset_1 together. Gap fill records done only after zero failures, and down.sql deletes rows an old binary cannot read.
Author
Owner

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue
Author
Owner

Re-checked head issue/1315 at ed3b9705. No further commit.

Validation on this checkout:

  • cargo test --lib candle_subject — 5 passed
  • cargo test --lib project_tests — 3 passed
  • cargo test --lib gap_fill — 2 passed
  • Vitest priceChartCandles.test.ts, PriceChart.test.tsx, tradePairDisplayOrientation.test.ts — 90 passed

make verify-issue-1315 still invokes scripts/with-node.sh for the Vitest step. That helper fails on this VM because nvm is not installed. The same three files passed with Node 24.11 directly.

Acceptance and the design revisions are already on this PR: classic OHLC stays USD of asset_0 and is omitted when usd_leg=asset_1 (subject_* on the wire), down.sql deletes stamped keys plus usd_leg=asset_1 and NULL open, the gap-fill done marker is set only when the failure count is 0, and /charts defaults both the pane and the pill to asset_1 when there is no ?price= and no Charts session flag.

Re-checked head `issue/1315` at ed3b9705. No further commit. Validation on this checkout: - `cargo test --lib candle_subject` — 5 passed - `cargo test --lib project_tests` — 3 passed - `cargo test --lib gap_fill` — 2 passed - Vitest `priceChartCandles.test.ts`, `PriceChart.test.tsx`, `tradePairDisplayOrientation.test.ts` — 90 passed `make verify-issue-1315` still invokes `scripts/with-node.sh` for the Vitest step. That helper fails on this VM because nvm is not installed. The same three files passed with Node 24.11 directly. Acceptance and the design revisions are already on this PR: classic OHLC stays USD of `asset_0` and is omitted when `usd_leg=asset_1` (`subject_*` on the wire), `down.sql` deletes stamped keys plus `usd_leg=asset_1` and NULL `open`, the gap-fill done marker is set only when the failure count is 0, and `/charts` defaults both the pane and the pill to `asset_1` when there is no `?price=` and no Charts session flag.
Author
Owner

drain skip: default autoland requires tip ACCEPT (#77)

drain skip: default autoland requires tip ACCEPT (#77)
Merge branch 'main' into issue/1315
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
17e51bb81e
PlasticDigits deleted branch issue/1315 2026-09-22 16:51:37 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1320
No description provided.