mirror of
https://ghfast.top/https://github.com/aeroxw/tick-stock-panel.git
synced 2026-09-12 16:44:15 +08:00
strategy/stream、optimize/stream、walkforward/stream 三个端点直接裸调 date.fromisoformat(start/end),前端传入 "not-a-date"、"2026-13-01"、 "2026/09/04" 之类的值会抛未捕获 ValueError,客户端只拿到 500 和 Internal Server Error,看不到是哪个参数不合法。 仓库内同类入口已有正确写法:signals.py 的 /intraday/replay 把 date.fromisoformat 包在 try 里返回 400「日期格式错误」,mining.py 的 MiningRunRequest 用 field_validator 走 422。本次只把 backtest 这三处 补齐到同一口径,不改其它行为。 补 tests/test_backtest_stream_date_guard.py:三个端点 × 非法 start/end 断言 400;另外用服务端范围保护(backtest_range_guard)让事件流立即收尾, 断言合法日期照旧返回 200,证明不是把入口收窄。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>