Repository navigation
Conversation
原来只能 --window-hours,而且窗口终点固定为「现在」,出不了历史某天的报告; 硬凑 24 小时窗口也会因为 max_lookback_hours(默认 72 小时)被截断。 - window.day_window():本地时区里那一整天 [00:00, 次日 00:00) - compute_window() 新增 window_start/window_end,给了就完全跳过 since_last 与 max_lookback 的推断 - RunRequest 增加 window_start/window_end,并写进 run params 便于追溯 - CLI:bureau run --date YYYY-MM-DD(与 --window-hours/--demo 互斥并给中文提示) - API:POST /api/runs 支持 date 字段,格式错误返回 400 invalid_date end 取次日 00:00 而不是当天 23:59:59,是因为 report_day() 用 rc.end-1 秒推日期; 取 23:59:59 会让报告落到第二天。tests/test_window_by_date.py 专门锁住这点。
原来界面上唯一入口是「立即出报」,它 createRun({}) 只能跑当前窗口,选不了日期;
按日期补跑只能在命令行敲 --date,且 25~35 分钟全程看不见过程。
后端:
- POST /api/runs/manual:接受 date 或 date_from/date_to,展开成每天一个窗口,
交给 AppContext.start_manual_batch 在后台按日期先后串行执行。
必须由后端排队:流水线同一时间只能跑一次(runner 有锁),前端连发会立刻撞 409。
- 校验:未来日期、结束早于开始、date 与区间混用、超过 31 天、未知平台,
全部返回 400 + 中文 message。
前端(调度中心页顶部「手动出报」按钮):
- 单日 / 日期区间两种模式,实时显示将生成的报告数量与星期
- 平台多选、可选只跑部分白名单群
- 「仅预览」默认开启(补历史默认不投递),关掉才显示通道多选
- 启动后 emit started,运行历史表立刻刷新
tests/test_manual_run.py 覆盖 10 个用例,包括"省略 dry_run 时必须按 True 处理"。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个 PR 做什么
补上「按日期出报」的能力:可以指定某一天或一个日期区间生成报告,不必等定时任务到点。
包含两个提交:
1. eat(run): 支持 --date 按日期重跑某一天
原来只有 --window-hours,而且窗口终点固定为「现在」,出不了历史某天的报告;
硬凑 24 小时窗口也会被 max_lookback_hours(默认 72 小时)截断。
2. eat(ui): 新增「手动出报」——指定单日或日期区间,立刻出报
界面上原本唯一入口是「立即出报」,它 createRun({}) 只能跑当前窗口、选不了日期。
这个提交补上可视化入口:
交给 AppContext.start_manual_batch 在后台按日期先后串行执行
几个设计取舍
为什么多天必须由后端串行排队? 流水线同一时间只能跑一次(runner 有锁),
前端连发会立刻撞上 409。所以区间在服务端展开,一天跑完再起下一天。
为什么用「手动出报」而不是「日报任务」? 仓库里「任务」已经专指会重复触发的
定时任务(ScheduleCard 的「新建任务」)。再叫「任务」会让人以为能重复执行,
所以一次性执行统一叫「出报/运行」,产物叫「报告」。
为什么默认不投递? 补历史报告推到飞书/邮箱容易造成"迟到的日报"困扰,
默认只预览更安全,需要时一键勾掉即可。
验证
且已被 gitignore 的文件,CI(�ctions/checkout 后没有 .venv)不会触发
pm run typecheck 与
pm run build 通过,web/dist 已按仓库惯例一并更新
(2,655 / 4,182 / 3,350 条原始消息);另验证 2 天区间(11-14 / 11-15)能串行接续,
且 deliveries=0 确认默认不投递生效
备注
这个分支基于 main 当前 HEAD(7dbd3fe),只含上述两个提交,
不含我个人本机用的启动脚本。如果方向认可但想调整命名或默认值,我可以改。