mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-04-28 02:21:16 +00:00
a2f67a7758
Code fixes: - trading/handlers + stats-handler: guard ctx.from?.id to prevent cross-user state corruption when channel posts or inline queries lack a sender - trading/prices + trading/symbols: encodeURIComponent on ticker before interpolating into TCBS API URLs - trading/stats-handler: parallelize per-stock price fetches with Promise.allSettled so N-stock portfolios don't stack serial latency - loldle/handlers: guard target champion lookup against champions.json refresh drift — start a fresh round or fall back to the stored id - wordle + loldle: explicitly initialize giveup:false in startFreshGame for stable state shape - wordle/lookup: fix stale JSDoc that claimed null return - biome: ignore auto-generated champions.json / champions-data.js / words-data.js - Apply formatter to src/index.js, loldle/handlers.js imports, and loldle/compare.test.js (previously red) Docs refresh: - README: 105+ tests -> 200+; wordle/loldle described as real modules - architecture: module tree updated, test count 105 -> 200, runtime ~500ms -> ~2s, stub list narrowed to misc only - codebase-summary: module table rewritten (wordle/loldle now Complete with real command lists and KV schema); test coverage table updated - loldle/README: full rewrite matching the current implementation (was describing the original stub) - New docs/development-roadmap.md tracking upcoming features (daily-mode for wordle + loldle, crypto/gold/forex trading, shared picker util, handler-level tests, coverage reporting, staging env) Tests: 200/200 passing. Lint: clean.
2.6 KiB
2.6 KiB
Development Roadmap
Forward-looking plan for upcoming features and milestones. This document
tracks what's next, not what's done — for completed work, see git log and
plans/*/ directories.
Guiding Principles
- Each item lists the future value, not the past state.
- Cross-module infra lands before per-module features that need it.
- Keep items small enough to ship in one PR when possible.
Modules
Wordle
- Daily mode. Wire up
pickDaily(words, todayUtc())so/wordledefaults to the shared puzzle of the day (one target per UTC date for every player). Give per-day stats a dedicated key so historical streaks aren't lost when random mode and daily mode are mixed.pickDailyalready exists insrc/modules/wordle/daily.jsand has tests; the wiring inhandlers.jsis the missing piece.- Decide: should random-mode
/wordle_newstill work alongside daily, or should the flow be "one puzzle per day, no reroll"?
- Decide: should random-mode
Loldle
- Daily mode. Same shape as wordle's daily-mode plan — use
pickDailyfromsrc/modules/loldle/daily.jsinstead ofpickRandom.
Trading
- Crypto support. Add BTC / ETH price feed + asset category. Mirror the
stock flow: dynamic symbol resolution, cache in KV, reuse
portfolio.assets. - Gold support. SJC / PNJ spot price feed, treated as a single asset.
- Currency exchange.
/trade_convert VND USD 1000000— already scaffolded as "coming soon". Needs a forex buy/sell step that debits one currency and credits another. - Leaderboard. Cross-user ranking by realized P&L over a time window.
D1 query on
trading_tradesplus portfolio snapshots.
Infrastructure
- Shared
pickerutil. Extract the duplicatedtodayUtc/pickDaily/pickRandom/ djb2 hash fromloldle/daily.jsandwordle/daily.jsinto a singlesrc/util/picker.js. Consolidate tests. - Handler-level tests for wordle + loldle mirroring
tests/modules/trading/handlers.test.js(subject resolution, giveup flow, stats rendering, finished-round branch). - Coverage reporting. Add vitest
--coverageconfig and wire a threshold gate intonpm test. - Staging environment. Separate D1 database + KV namespace for a staging Worker, so migrations can be validated before prod.
Unresolved Questions
- Daily-mode scope: global puzzle (everyone gets the same word / champion) vs per-chat daily (each group has its own seed)?
- Does daily mode count toward the existing
stats:<subject>record, or live in a separatedaily-stats:<subject>:<date>namespace? - Do we keep
/wordle_newand/loldle_newin daily mode, or hide them until the next UTC rollover?