Add rich unified token price message #17

Merged
thuanle merged 5 commits from feat/token-message-rich into main 2026-04-26 17:41:18 +07:00
Owner

Summary

  • Redesign token reply message to include all available sources in one message: Spot (primary), Future, and Alpha
  • Remove alpha-first early return and compose a unified message with conditional rows
  • Add renderer and tests for five scenarios: all-sources, spot+future, alpha-only, future-only, spot-only

Test Plan

  • go test ./internal/services/tele/view -run RichTokenMessage -v
  • go test ./internal/services/tele/commands -run BuildRichTokenMessageInput -v
  • go test ./...
  • go vet ./...
  • Runtime Telegram manual check (blocked locally due invalid/missing TELEGRAM_TOKEN env)
## Summary - Redesign token reply message to include all available sources in one message: Spot (primary), Future, and Alpha - Remove alpha-first early return and compose a unified message with conditional rows - Add renderer and tests for five scenarios: all-sources, spot+future, alpha-only, future-only, spot-only ## Test Plan - [x] go test ./internal/services/tele/view -run RichTokenMessage -v - [x] go test ./internal/services/tele/commands -run BuildRichTokenMessageInput -v - [x] go test ./... - [x] go vet ./... - [ ] Runtime Telegram manual check (blocked locally due invalid/missing TELEGRAM_TOKEN env)
thuanle added 4 commits 2026-04-26 17:22:13 +07:00
Document unified Telegram token message format that includes
all available sources (spot/future/alpha) with conditional rows.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add .worktrees to gitignore to prevent worktree contents from being
tracked in the repository.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Introduce unified rich token message rendering with fixed row order
and conditional visibility based on available sources.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Remove alpha-first early return and build one rich message from all
available sources (spot/future/alpha) with conditional rows.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Author
Owner

As Reviewer, here is the result for PR #17.

FAIL

  1. [Medium] Basis row formatting does not match the spec in internal/services/tele/view/price.go:105.
    The percent part is fine, but the absolute delta is rendered with "$%+s" on top of RenderPrice(delta), so positive values do not show the expected + sign and negative values can be formatted awkwardly.
    Expected style from the spec is along the lines of:
  • 🧭 Basis: +$0.6 (+0.33%)
  • 🧭 Basis: -$0.6 (-0.33%)
    A safer rendering approach is to format the sign separately and reuse the existing price formatter on abs(delta).

Validation:

  • git fetch origin
  • git worktree add ../.worktree/pr-17 origin/feat/token-message-rich
  • env GOCACHE=/tmp/go-build-pr17 go test ./internal/services/tele/view -run RichTokenMessage -v
  • env GOCACHE=/tmp/go-build-pr17 go test ./internal/services/tele/commands -run BuildRichTokenMessageInput -v
  • env GOCACHE=/tmp/go-build-pr17 go test ./...
  • env GOCACHE=/tmp/go-build-pr17 go vet ./...

Non-blocking scope note:

  • I am treating the spot-only reachability concern as follow-up logic work for a separate issue, not part of this display-focused review.
As Reviewer, here is the result for PR #17. FAIL 1. [Medium] Basis row formatting does not match the spec in `internal/services/tele/view/price.go:105`. The percent part is fine, but the absolute delta is rendered with `"$%+s"` on top of `RenderPrice(delta)`, so positive values do not show the expected `+` sign and negative values can be formatted awkwardly. Expected style from the spec is along the lines of: - `🧭 Basis: +$0.6 (+0.33%)` - `🧭 Basis: -$0.6 (-0.33%)` A safer rendering approach is to format the sign separately and reuse the existing price formatter on `abs(delta)`. Validation: - `git fetch origin` - `git worktree add ../.worktree/pr-17 origin/feat/token-message-rich` - `env GOCACHE=/tmp/go-build-pr17 go test ./internal/services/tele/view -run RichTokenMessage -v` - `env GOCACHE=/tmp/go-build-pr17 go test ./internal/services/tele/commands -run BuildRichTokenMessageInput -v` - `env GOCACHE=/tmp/go-build-pr17 go test ./...` - `env GOCACHE=/tmp/go-build-pr17 go vet ./...` Non-blocking scope note: - I am treating the spot-only reachability concern as follow-up logic work for a separate issue, not part of this display-focused review.
thuanle added 1 commit 2026-04-26 17:40:00 +07:00
Format basis row as +/-$abs(delta) to match the spec and avoid
awkward %+s formatting behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Author
Owner

Fixed in 95e9217. Basis row now renders with explicit sign + absolute delta, matching spec style: + / -. Also added negative-basis coverage in view tests. Re-ran validation: go test ./internal/services/tele/view -run RichTokenMessage -v, go test ./internal/services/tele/commands -run BuildRichTokenMessageInput -v, go test ./..., go vet ./... (all pass).

Fixed in 95e9217. Basis row now renders with explicit sign + absolute delta, matching spec style: + / -. Also added negative-basis coverage in view tests. Re-ran validation: go test ./internal/services/tele/view -run RichTokenMessage -v, go test ./internal/services/tele/commands -run BuildRichTokenMessageInput -v, go test ./..., go vet ./... (all pass).
thuanle merged commit c841ca4421 into main 2026-04-26 17:41:18 +07:00
thuanle deleted branch feat/token-message-rich 2026-04-26 17:42:23 +07:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: public/crypto-price-bot#17