main: build_config uses the pair factory's confirmation map (fixes an M5 divergence)

main.py kept a private confirmation table and passed it into the pair factory,
which honours any non-None list. For M5 that table said [M1, M15] while the
factory, telegram_bot.TF_CONFIRMATIONS and dashboard_publisher.CONFIRMATIONS
all use the validated [M15, H1] - so `main.py --timeframe M5` scanned with an
unvalidated pairing (and an extra M1 fetch) that no other surface used.

- build_config now returns PAIR_PRODUCERS[pair](tf, None): the factory map is
  the single source of truth. The unreachable bare-PlatformConfig fallback is
  gone here and in telegram_bot._run_signal_sync (every symbol that reaches
  either is registered).
- --timeframe offers the four validated primaries (M5, M15, H1, H4). M30 and
  D1 were never validated and silently fell through to the generic [M15, H4]
  map; they are removed from the CLI.
- The "all valid timeframes" test now asserts each CLI timeframe's
  confirmation list equals pair_signals.xauusd._CONFIRMATIONS - the check
  that would have caught this.

CLI behaviour change: M5 confirmations [M1, M15] -> [M15, H1]; M30/D1 rejected.
Bot and dashboard scans are unchanged.

Suite: 461 passed, 0 failed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0156YhogLytzj9P2iH1skGbL
This commit is contained in:
Harwinder Sekhon
2026-09-06 16:51:18 -04:00
parent fd1e136e24
commit 9b868d94d0
3 changed files with 28 additions and 41 deletions
+8 -3
View File
@@ -1594,14 +1594,19 @@ def _():
assert Timeframe.D1 in config.confirmation_timeframes
@test("build_config all valid timeframes")
@test("build_config: every CLI timeframe uses the pair factory's confirmation map")
def _():
for tf_str in ["M5", "M15", "M30", "H1", "H4", "D1"]:
from pair_signals import xauusd as _xau
for tf_str, tf in (("M5", Timeframe.M5), ("M15", Timeframe.M15),
("H1", Timeframe.H1), ("H4", Timeframe.H4)):
class FakeArgs:
pair = "XAUUSD"
timeframe = tf_str
config = build_config(FakeArgs())
assert config.primary_timeframe is not None
assert config.primary_timeframe == tf
# The CLI must not carry its own confirmation table: it once gave
# M5 an unvalidated [M1, M15] pairing that no other surface used.
assert config.confirmation_timeframes == _xau._CONFIRMATIONS[tf], tf_str
# ══════════════════════════════════════════════════════════════════════