app_config: reject non-object config.json sections with AppConfigError

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VPNF37MP9Kuv62B1VBrZ1b
This commit is contained in:
Harwinder Sekhon
2026-07-21 12:54:46 -04:00
parent 2c070fb9b3
commit 7455fcaa6c
2 changed files with 20 additions and 0 deletions
+4
View File
@@ -66,6 +66,8 @@ class AppConfig:
def _check_keys(section: Dict[str, Any], known: set, where: str) -> None:
if not isinstance(section, dict):
raise AppConfigError(f"config.json: {where} must be a JSON object")
unknown = sorted(set(section) - known)
if unknown:
raise AppConfigError(
@@ -141,6 +143,8 @@ def load_app_config(path: str = CONFIG_PATH) -> AppConfig:
app.scan_timeframes = [Timeframe[n] for n in names]
pair_section = raw.get("pairs", {})
if not isinstance(pair_section, dict):
raise AppConfigError('config.json: "pairs" must be a JSON object')
for symbol, overrides in pair_section.items():
if symbol not in PAIR_INFO:
raise AppConfigError(