refactor: standardize market file naming by data dimension #27

Merged
thuanle merged 2 commits from worktree-issue-26-go-filename-consistency into main 2026-04-27 09:53:34 +07:00
Owner

Summary

Refactor internal/data/market filenames to consistent data-dimension naming and align pair responsibilities by file.

Changes

  • Rename spot_price.go -> spot_prices.go
  • Rename future_price.go -> futures_prices.go
  • Rename trading_pairs.go -> spot_pairs.go
  • Add futures_pairs.go and move futures-pair specific logic there
  • Keep main.go for orchestration/cache refresh flow

Scope

  • Refactor-only change set
  • No intended behavior change

Test Plan

  • go test ./internal/data/market -v
  • go test ./...

Related

## Summary Refactor `internal/data/market` filenames to consistent data-dimension naming and align pair responsibilities by file. ### Changes - Rename `spot_price.go` -> `spot_prices.go` - Rename `future_price.go` -> `futures_prices.go` - Rename `trading_pairs.go` -> `spot_pairs.go` - Add `futures_pairs.go` and move futures-pair specific logic there - Keep `main.go` for orchestration/cache refresh flow ### Scope - Refactor-only change set - No intended behavior change ## Test Plan - [x] `go test ./internal/data/market -v` - [x] `go test ./...` ## Related - Closes #26
claudecode added 1 commit 2026-04-27 07:04:52 +07:00
Split market pair logic into spot and futures files and rename price files to plural data-dimension names without changing behavior.

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

FAIL

  1. [Medium] internal/data/market/trading_pairs_test.go still keeps the old trading_pairs filename even though trading_pairs.go was removed. The tests now cover shared canonical symbol helpers and futureCacheTokenKey, so please rename/split it to match the new file boundaries, for example spot_pairs_test.go or pair_symbols_test.go + futures_pairs_test.go.

  2. [Low] internal/data/market/main.go still contains dead code: alphaCacheRefreshLoop is no longer called after NewMarketData switched to cacheRefreshLoop, and refreshAllCaches already refreshes Alpha tokens. Since this PR is cleaning market file structure, please remove that stale helper too.

Validation:

  • go test ./internal/data/market -v
  • go test ./...
FAIL 1. [Medium] `internal/data/market/trading_pairs_test.go` still keeps the old `trading_pairs` filename even though `trading_pairs.go` was removed. The tests now cover shared canonical symbol helpers and `futureCacheTokenKey`, so please rename/split it to match the new file boundaries, for example `spot_pairs_test.go` or `pair_symbols_test.go` + `futures_pairs_test.go`. 2. [Low] `internal/data/market/main.go` still contains dead code: `alphaCacheRefreshLoop` is no longer called after `NewMarketData` switched to `cacheRefreshLoop`, and `refreshAllCaches` already refreshes Alpha tokens. Since this PR is cleaning market file structure, please remove that stale helper too. Validation: - `go test ./internal/data/market -v` - `go test ./...`
thuanle added 1 commit 2026-04-27 09:51:27 +07:00
Rename pair tests to match post-refactor boundaries and remove unused alpha cache refresh helper.

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

Đã xử lý cả 2 ý review trên branch PR.

Updates applied

  • Renamed test file:
    • internal/data/market/trading_pairs_test.go -> internal/data/market/pairs_test.go
  • Removed dead helper in internal/data/market/main.go:
    • deleted alphaCacheRefreshLoop (không còn được gọi)

Validation

  • go test ./internal/data/market -v
  • go test ./...

Nếu bạn muốn mình tách test theo 2 file riêng (spot_pairs_test.go + futures_pairs_test.go) thay vì pairs_test.go, mình có thể tách tiếp ở PR này.

Đã xử lý cả 2 ý review trên branch PR. ## Updates applied - Renamed test file: - `internal/data/market/trading_pairs_test.go` -> `internal/data/market/pairs_test.go` - Removed dead helper in `internal/data/market/main.go`: - deleted `alphaCacheRefreshLoop` (không còn được gọi) ## Validation - `go test ./internal/data/market -v` ✅ - `go test ./...` ✅ Nếu bạn muốn mình tách test theo 2 file riêng (`spot_pairs_test.go` + `futures_pairs_test.go`) thay vì `pairs_test.go`, mình có thể tách tiếp ở PR này.
Owner

PASS

No blocking issues found in the latest update. The previous review feedback has been addressed:

  • trading_pairs_test.go was renamed to pairs_test.go.
  • Dead alphaCacheRefreshLoop was removed from main.go.
  • No stale refs remain for the old market filenames or removed helper.

Validation:

  • go test ./internal/data/market -v
  • go test ./...
PASS No blocking issues found in the latest update. The previous review feedback has been addressed: - `trading_pairs_test.go` was renamed to `pairs_test.go`. - Dead `alphaCacheRefreshLoop` was removed from `main.go`. - No stale refs remain for the old market filenames or removed helper. Validation: - `go test ./internal/data/market -v` - `go test ./...`
thuanle merged commit c5ff494e13 into main 2026-04-27 09:53:34 +07:00
claudecode requested review from codex 2026-04-27 09:56:22 +07:00
Sign in to join this conversation.
No Reviewers
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: public/crypto-price-bot#27