[验证] schedule 服务重构前后行为等价性 #33

Closed
opened 2026-08-21 15:31:27 +08:00 by tao.chen · 1 comment
Owner

逐文件比对重构后 vs 3118694^(重构前 HEAD):

  • byte-identical 搬运类(scheduler / orchestrator / worker / service / executor / context / storage_client / main):diff 应该只剩 import 行 + 文档串 + 缩进
  • 合并类 execution/runners/notebook.py:三向核对(旧 execution.py helpers + ExecutionResult + 旧 notebook_runner.py CLI)
  • 追踪关键运行时契约:lifespan 顺序 / start-close / 子进程命令行 / event handler 接线

产物:一份 findings 列表(预期全部 = diff 仅限机械变更,无逻辑漂移)。


Task: lhccfbg3re8td1b2xdd8rto8

<p>逐文件比对重构后 vs 3118694^(重构前 HEAD):</p> <ul> <li>byte-identical 搬运类(scheduler / orchestrator / worker / service / executor / context / storage_client / main):diff 应该只剩 import 行 + 文档串 + 缩进</li> <li>合并类 execution/runners/notebook.py:三向核对(旧 execution.py helpers + ExecutionResult + 旧 notebook_runner.py CLI)</li> <li>追踪关键运行时契约:lifespan 顺序 / start-close / 子进程命令行 / event handler 接线</li> </ul> <p>产物:一份 findings 列表(预期全部 = diff 仅限机械变更,无逻辑漂移)。</p> --- <sub>Task: lhccfbg3re8td1b2xdd8rto8</sub>
tao.chen added the priority:highstatus:in-progress labels 2026-08-21 15:31:29 +08:00
Author
Owner

tao.chen commented:

schedule 重构前后行为等价性验证完成(commit 3118694^ vs HEAD 80130c6)。

结果

8 个 byte-identical 搬运的文件:零逻辑漂移

  • scheduler.py / orchestrator.py / worker.py / executor.py / context.py / storage_client.py / service.py / main.py
  • non-zero diff 全部只在 import 路径 + 文档串 :class:/ `` `` `` 引用

execution/runners/notebook.py 合并:三向验证通过

  • 6 个 helper(MAX_LOG_BYTES / _resolve_python / _limited_log / _execute_notebook / _execute_python / execute_artifact)+ 2 个 CLI(emit_outputs / main)= pre 文件字节级一致
  • shim 取代 if __name__ == "__main__":python -m schedule.notebook_runner 行为不变

关键运行时契约全部保留

  • 子进程 argv [sys.executable, "-m", "schedule.notebook_runner", ...]
  • start 顺序 cron.start()orchestrator.start()
  • dispatch handler 注入 self.worker.handle_node_execute_node_execute_handler
  • close 顺序 orchestrator.close()cron.close()

⚠️ 1 处非平凡行为变更(已文档化)

ExecutionResult:pre-refactor 是 plain class,post-refactor 是 @dataclass(frozen=True)

  • 影响:identity == → value ==、mutate 抛 FrozenInstanceError、repr 结构化
  • 风险评估:全仓 grep 无 mutation / 无 == 比较,唯一可见影响是日志格式
  • 用户决策:保留(选 C)。已在 domain/execution.py 文档串和根 CLAUDE.md "Schedule service layering" 笔记中显式记录,标记为 "deliberate enhancement"
**tao.chen** commented: > schedule 重构前后行为等价性验证完成(commit 3118694^ vs HEAD 80130c6)。 ## 结果 **8 个 byte-identical 搬运的文件:零逻辑漂移** - scheduler.py / orchestrator.py / worker.py / executor.py / context.py / storage_client.py / service.py / main.py - non-zero diff 全部只在 import 路径 + 文档串 `:class:`/` `` `` `` 引用` 上 **execution/runners/notebook.py 合并:三向验证通过** - 6 个 helper(`MAX_LOG_BYTES / _resolve_python / _limited_log / _execute_notebook / _execute_python / execute_artifact`)+ 2 个 CLI(`emit_outputs / main`)= pre 文件字节级一致 - shim 取代 `if __name__ == "__main__"`:`python -m schedule.notebook_runner` 行为不变 **关键运行时契约全部保留** - 子进程 argv `[sys.executable, "-m", "schedule.notebook_runner", ...]` - start 顺序 `cron.start()` → `orchestrator.start()` - dispatch handler 注入 `self.worker.handle_node_execute` → `_node_execute_handler` - close 顺序 `orchestrator.close()` → `cron.close()` ## ⚠️ 1 处非平凡行为变更(已文档化) `ExecutionResult`:pre-refactor 是 plain class,post-refactor 是 `@dataclass(frozen=True)`。 - 影响:identity `==` → value `==`、mutate 抛 FrozenInstanceError、repr 结构化 - 风险评估:全仓 grep 无 mutation / 无 `==` 比较,**唯一可见影响是日志格式** - 用户决策:**保留**(选 C)。已在 `domain/execution.py` 文档串和根 CLAUDE.md "Schedule service layering" 笔记中显式记录,标记为 "deliberate enhancement"
tao.chen added status:done and removed status:in-progress labels 2026-08-21 15:37:42 +08:00
tao.chen added status:archived and removed status:done labels 2026-08-24 10:09:10 +08:00
tao.chen reopened this issue 2026-08-24 10:09:16 +08:00
tao.chen added the status:to-do label 2026-08-24 10:09:54 +08:00
tao.chen added status:in-review and removed status:to-do labels 2026-08-24 14:23:42 +08:00
tao.chen removed the status:in-review label 2026-08-24 14:25:14 +08:00
tao.chen reopened this issue 2026-08-24 14:25:31 +08:00
tao.chen added the status:to-do label 2026-08-24 14:25:43 +08:00
tao.chen added status:done and removed status:to-do labels 2026-08-24 14:51:19 +08:00
tao.chen added status:in-review and removed status:done labels 2026-08-24 14:51:59 +08:00
tao.chen reopened this issue 2026-08-24 14:52:03 +08:00
tao.chen added status:done and removed status:in-review labels 2026-08-24 14:53:23 +08:00
tao.chen added status:in-review and removed status:done labels 2026-08-24 14:53:38 +08:00
tao.chen reopened this issue 2026-08-24 14:53:43 +08:00
tao.chen added status:done and removed status:in-review labels 2026-08-25 19:16:42 +08:00
tao.chen added status:in-review and removed status:done labels 2026-08-25 19:16:54 +08:00
tao.chen reopened this issue 2026-08-25 19:17:00 +08:00
tao.chen added status:to-do and removed status:in-review labels 2026-08-25 19:17:10 +08:00
tao.chen added status:done and removed status:to-do labels 2026-08-25 19:56:27 +08:00
Sign in to join this conversation.