Skip to content

fix: resolve issue #96 - #97

Open
Jackkp0t wants to merge 1 commit into
helsome:mainfrom
Jackkp0t:fix/issue-96
Open

Jackkp0t wants to merge 1 commit into
helsome:mainfrom
Jackkp0t:fix/issue-96

Conversation

@Jackkp0t

Copy link
Copy Markdown

改动说明

修复计划自动化规则在同一计划日期可能重复执行的问题。

  • 执行前持久化声明 ruleId + scheduled occurrence,应用重启后仍可识别已处理任务。
  • 在异步持久化前设置内存 guard,避免后续 scheduler tick 并发触发同一规则。
  • 自动化运行记录写入时保留已声明的计划 occurrence。
  • 失败的计划任务不会在同一天后续 tick 自动重试。
  • 新增重启恢复、并发 tick、失败不重试及持久化声明测试。

关联 Issue

Closes #96

测试报告(正式审核前必填)

环境

  • Bun:1.4.2
  • OS:Windows

实际执行命令与结果

C:\Users\jackpot\.bun\bin\bun.exe test packages/shared/src/automation/rules-repository.test.ts
→ 7 passed / 0 failed
→ Ran 7 tests across 1 file.

C:\Users\jackpot\.bun\bin\bun.exe test apps/electron/src/main/kernelHost.test.ts
→ 12 passed / 0 failed
→ Ran 12 tests across 1 file.

C:\Users\jackpot\.bun\bin\bun.exe run typecheck
→ @finagent/core / @finagent/i18n / @finagent/shared /
  @finagent/ui / @finagent/electron 全部 exit 0

Set-Location apps/electron
C:\Users\jackpot\.bun\bin\bun.exe run typecheck
→ tsc --noEmit exit 0

git diff --check
→ exit 0

已知失败 / Baseline(如有)

无。

  • 已提供实际测试命令与 pass/fail 结果
  • 已说明测试环境
  • 如果存在已知 baseline / 环境失败,已提供 main 对照或说明
  • 核心改动已有对应 focused test / smoke / integration 验证

UI 截图(仅可见 UI 变化时必填)

  • 本 PR 无可见 UI 变化(无需截图)
  • 本 PR 有可见 UI 变化,已提供修改后的 UI 截图
  • 已提供 Before / After 对比截图(适用时)

Before(适用时)

不适用(无可见 UI 变化)。

After(适用时)

不适用(无可见 UI 变化)。

Scope / 后续

本 PR 仅处理计划自动化的同日去重、重启恢复与并发执行保护;不修改自动化规则配置、手动执行行为或 UI。

@helsome helsome left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修复方向与 #96 的两个真实重复路径一致:执行前先占用 occurrence、内存 guard 阻止重叠 tick、持久 claim 让 host 重建后仍可去重;失败 occurrence 明确选择“当天不自动重试”,也避免了偶然的一分钟 retry storm。新增测试覆盖了重启恢复、执行跨 tick、失败不重试和跨 repository instance 的持久 claim,focused tests + typecheck 报告足够验证这个修复。

代码本身批准。当前分支基于较早的 4eca2d1,而 main 已前进到新的提交;这是持久化/调度路径,我不建议直接用旧基线合并。请只 rebase 最新 main,并重跑现有两组 focused tests + typecheck/basic CI 即可,不需要扩大 scope。action_required 是首次贡献者 Actions 授权,不作为质量失败。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Automation] Scheduled rules can run more than once on the same day

2 participants