
kevin9327andClaude Opus 5
fd5d883c8f
fix(screener): run_all 的 as_of 与 /custom、/preset 同口径校验
/api/screener/run_all 收的是无类型 dict,as_of 只在 isinstance(str) 时才
解析,其余类型原样透传,造成两个问题:
1. 非法字符串("not-a-date"、"2026-13-01")抛未捕获 ValueError → 500;
2. JSON 数字({"as_of": 2026})不进解析分支,直接被当作日期用下去。
实测:{"as_of": 2026} 返回 200,响应 as_of="2026",
strategy_cache.json 也写入 as_of="2026"({"as_of": 20260904} → "20260904")。
其它入口写进同一份缓存的是 "2026-09-04",cached-summary /
cached-result 都按 as_of 字符串比对,格式不一致的缓存条目永远失配。
同一份 as_of 在 /api/screener/custom 和 /api/screener/preset 上走
Pydantic 模型(CustomRequest / PresetRequest 的 `as_of: Optional[date]`),
非法字符串和数字都会被 422 拦下;只有 run_all 这一处漏了。本次把 run_all
补齐到同一口径:非字符串直接 400,非法字符串 400「日期格式错误」。
补 tests/test_screener_run_all_as_of.py,同时锁住合法 as_of 仍然照常执行、
缓存仍写 ISO 日期,以及不传 as_of 时回退到 latest_date()。
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-09 07:36:21 +09:00
..
2026-09-05 20:33:31 +08:00
2026-08-30 19:05:13 +08:00
2026-08-30 19:05:32 +08:00
2026-09-05 15:41:15 +08:00
2026-09-04 12:03:06 +08:00
2026-07-18 18:31:02 +08:00
2026-09-04 12:50:50 +08:00
2026-08-13 20:16:02 +08:00
2026-08-30 19:05:27 +08:00
2026-08-30 19:05:31 +08:00
2026-08-05 17:56:27 +08:00
2026-09-05 15:41:15 +08:00
2026-07-12 13:52:49 +08:00
2026-09-03 13:26:42 +08:00
2026-09-05 22:49:52 +08:00
2026-09-05 22:49:52 +08:00
2026-08-02 10:56:03 +08:00
2026-08-02 10:56:03 +08:00
2026-08-02 10:56:03 +08:00
2026-08-05 17:56:27 +08:00
2026-09-03 13:20:59 +08:00
2026-09-05 22:49:52 +08:00
2026-08-23 19:36:00 +08:00
2026-07-25 22:51:27 +08:00
2026-08-30 19:05:20 +08:00
2026-09-05 15:41:15 +08:00
2026-09-05 15:41:15 +08:00
2026-09-05 15:41:15 +08:00
2026-07-26 18:35:31 +08:00
2026-08-23 19:13:03 +08:00
2026-09-05 15:41:15 +08:00
2026-08-16 23:39:07 +08:00
2026-09-02 20:20:38 +08:00
2026-07-08 13:42:53 +08:00
2026-08-30 19:05:32 +08:00
2026-08-30 19:05:29 +08:00
2026-09-04 12:40:04 +08:00
2026-09-07 15:25:27 +08:00
2026-09-03 13:01:43 +08:00
2026-08-16 23:39:07 +08:00
2026-09-05 15:41:15 +08:00
2026-09-06 23:16:27 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-09-07 08:10:38 +09:00
2026-09-07 08:07:02 +09:00
2026-07-18 00:49:28 +08:00
2026-09-06 18:27:33 +08:00
2026-07-16 14:34:07 +08:00
2026-09-04 11:53:15 +08:00
2026-09-07 22:54:05 +08:00
2026-09-03 13:45:12 +08:00
2026-09-08 19:56:03 +09:00
2026-07-31 19:56:33 +08:00
2026-08-30 18:51:24 +09:00
2026-08-26 00:54:39 +08:00
2026-09-05 15:41:15 +08:00
2026-09-05 15:41:15 +08:00
2026-09-05 15:41:15 +08:00
2026-09-05 15:41:15 +08:00
2026-08-16 23:39:07 +08:00
2026-09-06 18:27:33 +08:00
2026-09-06 18:27:33 +08:00
2026-09-05 15:41:15 +08:00
2026-07-19 16:42:03 +08:00
2026-08-30 19:05:25 +08:00
2026-08-16 23:39:07 +08:00
2026-09-06 17:39:43 +08:00
2026-08-30 19:05:26 +08:00
2026-09-06 17:39:43 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-07-16 12:17:27 +08:00
2026-08-16 23:39:07 +08:00
2026-07-31 19:38:36 +08:00
2026-08-30 22:29:33 +08:00
2026-08-30 22:29:33 +08:00
2026-09-06 18:26:29 +08:00
2026-08-30 19:05:27 +08:00
2026-09-01 22:42:59 +08:00
2026-09-03 17:35:16 +08:00
2026-09-08 18:09:59 +08:00
2026-08-16 23:39:07 +08:00
2026-09-08 18:09:59 +08:00
2026-09-08 18:09:59 +08:00
2026-08-16 23:39:07 +08:00
2026-07-18 00:49:28 +08:00
2026-07-28 09:46:51 +08:00
2026-09-02 20:20:38 +08:00
2026-08-16 23:39:07 +08:00
2026-09-04 11:59:00 +08:00
2026-08-16 23:39:07 +08:00
2026-09-03 13:01:43 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-08-26 13:19:16 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-08-30 19:05:25 +08:00
2026-08-16 23:39:07 +08:00
2026-08-31 22:53:24 +08:00
2026-09-08 18:09:59 +08:00
2026-08-30 19:05:11 +08:00
2026-08-30 19:05:25 +08:00
2026-07-08 12:12:29 +08:00
2026-08-22 20:26:34 +08:00
2026-07-28 21:13:10 +08:00
2026-09-05 21:14:53 +09:00
2026-09-04 16:37:06 +08:00
2026-08-16 23:39:07 +08:00
2026-07-09 17:38:44 +08:00
2026-09-04 16:37:06 +08:00
2026-08-30 18:38:24 +09:00
2026-09-07 15:25:41 +08:00
2026-09-04 16:37:06 +08:00
2026-08-16 23:39:07 +08:00
2026-07-19 09:36:55 +08:00
2026-07-19 10:06:26 +08:00
2026-07-28 21:13:10 +08:00
2026-08-30 19:05:21 +08:00
2026-09-07 22:01:12 +08:00
2026-08-16 23:39:07 +08:00
2026-07-19 10:06:26 +08:00
2026-07-30 13:09:07 +08:00
2026-08-30 19:05:27 +08:00
2026-08-16 23:39:07 +08:00
2026-09-04 12:19:35 +08:00
2026-08-16 23:39:07 +08:00
2026-07-26 18:35:31 +08:00
2026-09-06 16:20:42 +08:00
2026-09-04 11:59:00 +08:00
2026-09-07 15:25:54 +08:00
2026-09-07 15:25:54 +08:00
2026-08-31 22:53:12 +08:00
2026-09-03 13:26:42 +08:00
2026-09-03 13:45:12 +08:00
2026-09-09 07:36:21 +09:00
2026-09-07 15:25:54 +08:00
2026-08-31 16:50:21 +08:00
2026-08-16 23:39:07 +08:00
2026-08-16 23:39:07 +08:00
2026-09-05 15:41:15 +08:00
2026-07-26 18:35:31 +08:00
2026-09-02 10:53:08 +08:00
2026-08-13 20:16:02 +08:00
2026-07-20 13:01:03 +08:00
2026-08-23 19:29:44 +08:00
2026-07-22 11:21:13 +08:00
2026-08-13 20:16:02 +08:00
2026-08-26 09:36:06 +08:00
2026-09-04 16:37:06 +08:00
2026-08-13 20:16:02 +08:00
2026-09-06 13:41:51 +08:00
2026-07-16 12:17:27 +08:00
2026-08-13 20:16:02 +08:00
2026-08-23 19:36:00 +08:00
2026-09-07 15:25:48 +08:00
2026-09-07 15:25:54 +08:00
2026-08-13 20:16:02 +08:00
2026-08-13 20:16:02 +08:00
2026-08-31 22:53:24 +08:00
2026-08-25 14:07:16 +08:00
2026-09-07 15:25:41 +08:00
2026-09-05 21:11:44 +09:00
2026-07-26 18:35:31 +08:00
2026-08-20 16:15:13 +08:00
2026-09-05 21:11:44 +09:00
2026-09-05 21:11:44 +09:00
2026-09-04 16:37:06 +08:00
2026-09-07 15:25:41 +08:00