chore: remove test-only helpers and the duplicate confirmation map (no behaviour change)

- telegram_bot._format_scan_summary: multi-pair "auto-scan summary" leftover;
  production sends per-report format_signal_message. Its only caller was a test.
- telegram_bot.scan_keyboard: thin wrapper only a test called; main_menu_keyboard
  already builds from _scan_button_rows directly.
- telegram_bot.AUTOSCAN_CONFIRMATIONS was byte-identical to TF_CONFIRMATIONS;
  the candle loop now reads the one map (app_config comment updated).
- SignalLogger.news_for: one-line wrapper over the module-level read_news that
  every real reader uses; the test now calls read_news like its neighbours.
- pair_signals.get_supported_pairs: PAIR_PRODUCERS is the registry; the test
  lists it directly.

Suite: 461 passed, 0 failed (two helper-only tests removed).

Claude-Session: https://claude.ai/code/session_0156YhogLytzj9P2iH1skGbL
This commit is contained in:
Harwinder Sekhon
2026-09-06 16:50:21 -04:00
parent 985ec83ef3
commit 1b40f2166e
5 changed files with 6 additions and 78 deletions
+4 -25
View File
@@ -1612,9 +1612,9 @@ print("\n═══ Module 7: telegram_bot.py ═══")
from telegram_bot import (
_escape_md, _signal_label, _mtf_line, _indicator_summary,
format_signal_message, _format_scan_summary, _news_text,
format_signal_message, _news_text,
_seconds_until_boundary, _check_level_breach,
scan_keyboard, SCAN_BUTTONS, SCAN_LOOKUP,
SCAN_BUTTONS, SCAN_LOOKUP,
_update_level_cache, _last_prices, _level_cache, _level_cache_ts,
)
@@ -1757,21 +1757,6 @@ def _():
assert "[Bullish]" not in msg and "[Bearish]" not in msg and "[Neutral]" not in msg
@test("_format_scan_summary produces valid text")
def _():
config = PlatformConfig()
agg = SignalAggregator(config)
dfs = {
Timeframe.H1: make_ohlcv(300, seed=42),
Timeframe.M15: make_ohlcv(300, seed=43),
Timeframe.H4: make_ohlcv(300, seed=44),
}
reports = [agg.analyze_from_dataframes("XAU/USD", dfs, use_news=False)]
summary = _format_scan_summary(reports, Timeframe.H1)
assert "Auto-Scan" in summary
assert "XAU/USD" in summary
@test("_seconds_until_boundary returns positive value")
def _():
result = _seconds_until_boundary(15, buffer=10)
@@ -1878,12 +1863,6 @@ def _():
assert "label" in btn
@test("scan_keyboard returns InlineKeyboardMarkup")
def _():
kb = scan_keyboard()
assert kb is not None
@test("_update_level_cache populates cache from reports")
def _():
config = PlatformConfig()
@@ -2070,7 +2049,7 @@ print("\n═══ Module 9: pair_signals registry ═══")
@test("pair_signals registry includes XAU/USD only")
def _():
import pair_signals
pairs = pair_signals.get_supported_pairs()
pairs = list(pair_signals.PAIR_PRODUCERS)
assert XAUUSD in pairs, f"XAU missing from registry: {pairs}"
assert pairs == [XAUUSD], f"registry must be XAU-only: {pairs}"
@@ -8900,7 +8879,7 @@ def _():
legacy_id = lg._conn.execute("SELECT MAX(id) FROM signals").fetchone()[0]
ev, hl = slog.read_news(lg._conn, legacy_id)
assert json.loads(hl)[0]["headline"] == "legacy"
ev, hl = lg.news_for(r1)
ev, hl = slog.read_news(lg._conn, r1)
assert json.loads(hl)[0]["headline"] == "Fed signals rate hike"
view = dict(lg._conn.execute(
"SELECT id, headlines_resolved FROM signals_with_news").fetchall())