✨ feat(timing): 闭合到期实例与提醒事实推进 - #210
Open
jing-gou wants to merge 4 commits into
Open
Conversation
新增 AdvanceDueTasks(now) 运行态 seam,使用共享 occurrence planner 补齐到期 occurrence,原子推进任务的 next_trigger_at,并幂等创建 TimerInstance。\n\n同一 Store 复合写入同时保存 active ReminderRule 派生的 pending ReminderTrigger、实例创建事件和提醒触发事件;取消、跳过、终止任务和存储失败不会留下半成功事实。\n\n40 项 Host 测试、公共 API、架构依赖、Profile 与 Python 检查通过;本机完整 pre-submit 仍受 Ruff 0.16.1 与仓库要求 0.12.7 不匹配影响。\n\nRefs 1024XEngineer#192\nCloses 1024XEngineer#197\nCloses 1024XEngineer#198
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
No issues found in this review.
Verification run: cmake -S tests/host -B /tmp/voicelife-host-review && cmake --build /tmp/voicelife-host-review --target timing_task_service_advance_test timing_task_service_contract_test -j2 && ctest --test-dir /tmp/voicelife-host-review -R 'timing_task_service_advance_test|timing_task_service_contract_test' --output-on-failure.
覆盖时间参数、Store 查询失败、周月年周期、已有事实幂等、完成实例和溢出错误路径。 本地 host 测试 40/40 通过,未改变生产行为。 Refs 1024XEngineer#192
按 TimingTask 字段声明顺序初始化溢出场景,并同步 clang-format-18 输出。 本地 host 测试 40/40 与快速质量门禁通过。 Refs 1024XEngineer#192
补充负向加法溢出、时间戳上限和无匹配星期的周期窗口测试,提升到期推进差异覆盖率。 本地 host 测试 40/40 与快速质量门禁通过。 Refs 1024XEngineer#192
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.
结论
完成 #192 的两个子任务:新增
AdvanceDueTasks(now)运行态 seam,物化到期 occurrence,并在同一任务级 Store 原子边界内派生ReminderTrigger与TimingEvent。请 Reviewer 重点确认:
TimingTaskAdvanceWrite是否清楚表达“任务 next_trigger_at、TimerInstance、ReminderTrigger、TimingEvent 必须同批提交”的原子性边界。背景
此前 Timing 只有管理接口和 Calendar 虚拟 occurrence,没有可恢复的本地到期事实。#193 已提供共享 planner,本 PR 将其接到运行态事实链路。
改动范围
TimingTaskService::AdvanceDueTasks(int64_t now)和AdvanceDueTasksResult。next_trigger_at,并保存实例创建事件。kInstanceCreated、kReminderTriggered事件;Store 失败时实例、trigger、event 和 next_trigger 均不落库。未改动:SQLite/FreeRTOS/真实 Runner、Outbox 领取重试、Voice/IM 投递、投递结果回写、公开 DTO 兼容字段和外部时区 SDK。
接口与依赖影响
新增平台无关的 Timing Service/Store 领域接口,仅使用标准容器和现有 Timing 类型。生产数据库 Adapter 不在本仓库当前实现范围内;其后续实现必须遵守新 Store 的全批提交合同。
TDD 记录
timing_task_service_advance_test首次编译因AdvanceDueTasks尚不存在失败。验证与构建证据
./scripts/run_host_tests.sh:40/40 通过。./scripts/run_checks.sh:公共 API、组件依赖、Profile、Python 和 Host 检查通过。git diff --check通过。python3 scripts/check_commit_message.py --range upstream/main..HEAD通过。python3 scripts/check_code_size.py --base 108ff72通过;新增实现文件 277 行,测试文件 217 行。run_pre_submit_checks.sh在 Ruff 阶段被本机版本0.16.1与仓库锁定0.12.7不匹配阻断;其余门禁已由上列替代证据覆盖,GitHub CI 将复验锁定环境。已知风险、兼容窗口与回退
当前方法处理固定
+08:00planner 已支持的周期规则;复杂 RFC 5545/IANA tzdb、生产持久化和实际投递仍由后续 Issue 负责。接口新增不破坏既有管理/查询调用方;回退本 PR 即恢复没有到期推进事实的旧行为,不需要数据迁移。关联 Issue
Closes #197
Closes #198
Refs #192