Skip to content

refactor(todos): retire unused Python transition adapters - #5664

Merged
huangruiteng merged 1 commit into
mainfrom
codex/todo-adapter-retirement
Oct 5, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/todo-adapter-retirement

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

Two internal Python Todo transition adapters have no repository callers: bind_next_action_to_todo and plan_todo_external_wait_transition. Canonical external-wait updates already invoke public_update.ts and its typed planner directly; live Next Action transport already uses the existing typed runtime. Retaining these separate entrypoints obscures which path owns shipped behavior.

Delete the two unused functions, dead Python schema aliases and import. Keep active adapters, the external-wait error contract, generated TS schemas, Markdown projection and still-used writer/shadow/recovery paths.

  • Observable result: the functions are absent from a newly built wheel, whose actual File/SQLite CLI still creates and replays a Todo, handles valid wait/resume, rejects self-dependency without a write, and fails explicitly when the selected provider is missing.
  • Intended base: main at 896cdf1278ab2358260f4b5c59b211baa3a525ac.

Author Declaration

Criterion Disposition Evidence
Retire obsolete Python seams after their real callers use the typed owner implemented for these two functions Repository caller search; existing typed update/Next Action owners; actual installed CLI with the functions absent
Preserve live IO/transport and compatibility obligations implemented within this slice Active functions and persisted schemas unchanged; focused parity and File/SQLite failure/recovery readback
Complete writer/shadow/outbox and broader installed consumer migration out_of_scope Existing wider acceptance remains open; no writer or recovery contract is deleted

Scope And Continuation

Complete for this unused internal caller family. This source cleanup does not claim retirement of all Python, the old Markdown writer or active shadow producers. Broader work continues per real caller family and its migration/recovery obligations. The companion refactor deletes the now-dead aliases/import rather than adding a compatibility wrapper; the source diff is independently reversible.

Validation

  • Tested revision: a467d5d029230edfb104f939a69fde0b20758075; source and installed module bytes match.
  • Run state: finished.
  • Input classes: synthetic, public_fixture.
Check kind Result Evidence / limitation
unit / regression_parity passed 52 Python tests for external wait, Next Action writeback/settlement and resume adapter; 25 TS tests for Next Action and resume conditions
real_entrypoint / real_backend passed Fresh wheel installed into a separate Python environment; python -I -m loopx.cli with isolated actual File/SQLite stores. Removed symbols absent, source bytes match; creation replay, wait/resume, rejected self-dependency, missing-provider failure without Markdown fallback and restored readback pass
static passed Changed-file Ruff, advisory before full semantic vocabulary smoke, native public scan and diff hygiene
integration passed Fresh frontend bundle and wheel build. The first build correctly rejected an outdated bundle; it was rebuilt through the documented build workflow

Native premerge passes all 16 selected checks and compile/diff hygiene; exact-scope strict quality receipt passes. Unchanged maintainability debt in the Lark topic module, quota CLI and Python goal boundary is classified by native canary as inherited advisory; these files and their ceilings are untouched. CI was not consulted under the configured policy. No global installation, App/Host, Windows, PostgreSQL or complete Goal migration is claimed. PostgreSQL provider/store code is untouched.

Frontend / Visual Evidence

UI impact: none. Existing user operations keep their current typed owners and entrypoints; no new capability or control is introduced.

Type of Change

  • Refactoring

LoopX Area

  • Control plane

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机

维护 Todo 的开发者和通过 CLI 添加、等待或恢复任务的用户,会经过这两个 Python 模块。两个已无调用者的过渡适配器仍留在模块中,容易被误当成当前入口;删除后,现有 CLI 继续通过同一 TypeScript owner 执行任务规则,模块只保留实际使用的桥接。独立安装包在真实 File 和 SQLite 存储上完成添加、重放、等待绑定、拒绝自依赖、清除条件及存储恢复;与不可变 base 的 14 组观察完全一致。本次只退出两个内部无调用者的 facade,不改变 Todo 授权、持久格式、默认调度、外部 provider 或用户操作,也不完成整个 TypeScript 迁移。整个迁移的累计成本收益、其他 facade 退出及默认 cutover 仍由既有迁移 owner 验收,本 PR 不宣称完成。

这是维护性退出,不以删行数证明产品收益。最强反对理由是暂未出现用户错误,而外部程序可能依赖内部名称;因此先检查当前消费者、公开导出和持久兼容边界,再按现有调用路径判断。没有找到这两个 Python 名称的版本化公开 API 或独立消费者契约,任意第三方内部 import 不在本次资格范围。

改动思路

复用已存在的 TypeScript 任务规则 owner,保留真正使用的 Python 文本/传输适配器。canonical 更新直接调用 typed external-wait planner,旧文本推荐仍经保留的 add/settle adapter 调用 TS。删除不另建入口、状态或 Python policy,也不移走仍被 handler 使用的生成 schema。将 dead wrapper 换成另一个 shim 没有消费者价值。现有 CLI、frontend/Lark 不增加操作或编辑器,所有规则与权限归属保持原样。

具体改动

精确 head a467d5d029230edfb104f939a69fde0b20758075,实际 merge base 896cdf1278ab2358260f4b5c59b211baa3a525ac;完整两文件 +0/-56。next_action_runtime.py 删除 14 行无调用 bind wrapper;resume_condition.py 删除 37 行无调用 planner wrapper 和 5 行死 import/alias。独立 base Python 全树扫描仅找到这两项定义;head 的 TS 同名 schema/planner 仍有真实 caller,没有把它们误删。

规格依据 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,spec_revision 896cdf1278ab2358260f4b5c59b211baa3a525ac,以修改前已接受的 owner/parity/facade 退出要求核验;PR 声明不能替代规格。

  • single-typed-rule-owner:implemented。现有 TS owner 和 canonical handler 未变,Python 不新增第二规则源。
  • retire-unused-facade:implemented。bounded 当前源码/公开导出库存没有 live Python caller;独立安装包两文件 byte 对齐 exact head、旧符号确已退出。
  • real-entry-parity-recovery:implemented。相同独立 driver 在 base/source 和 head/fresh wheel,真实 File/SQLite,各 7 条路径;全诊断及语义观察一致。
  • migration-economics-and-cutover:deferred。结构 payoff 为生产 -56、两 facade 退出、新 bridge/静态 caller 0;未测全迁移延迟、token、累计效益或默认切换。本次没有宣称它们完成。

关键代码讲解

next_action_runtime.py:98::_apply_transition 仍由真实 reconcile/apply/settle 调用,规则交给 TS,Python 只物化已接受文本。原 bind wrapper 没有消费者,删除不改变这些 active branches。

:149::reconcile_added_todo_next_action 与保留的 apply/settle 是当前 recommendation seam。真实 CLI 添加后独立读取相同文本/身份,再重放同 operation 不增建任务。这里没有把旧持久回执格式当成可删的 transient wrapper。

resume_condition.py:342::evaluate_todo_resume_conditions 保留 typed evaluation 和完整证据边界。canonical public update 本来已直接使用 external-wait planner;normalize/evaluate、生成 coordination schema 与 effect method registry 均保留。清除已有 resume 条件后的独立 readback 恢复同一 actor 的工作,其他 Todo 不被改写。

对主干的风险

独立当前 source:52 Python、25 TS tests 通过,focused Ruff、diff check、advisory 后的全树 semantic smoke 通过。首次 wheel build 正确拒绝旧 chat bundle;按既有脚本从当前源码构建未改 UI 的包后,fresh wheel 在新环境安装。python -I 从合成项目目录执行实际 CLI,两 touched 文件 byte 对齐 exact head,排除 source cwd/PYTHONPATH 偷用工作树。

每个真实 provider 的七条正反路径:dependency wait 保持 open/owner 与独立 fallback;同 update replay 无增写;self-dependency 全错误 external-wait Todo cannot resume from itself 且 records 不变;明确 clear 后条件消失、owner 与无关任务保持;native add/replay 同身份/计数;冷启动时移开自有 selected store,File/SQLite 各按原诊断拒绝、无 legacy fallback;恢复同 store 后四项任务重读成功。14 组完整语义观察与 base 一致,没有归一化诊断、身份或拒绝顺序。fixture 初始化不是 active Goal migration,未触碰实际 authority。

另外对私有安装副本做 dropped-clear mutation:把 CLI 到 update 的 clear intent 丢弃,实际 public command 立即失败,独立 oracle 要求的成功恢复无法满足,fence 仍禁止 legacy 写入。恢复原文件字节后重跑全部 14 条通过。这证明对照会发现 lost intent,不只是两个输出都成功。

初始 driver 的记录字段、authority read 字段位置和“合法 mutation 不得更新展示投影”三个假设写错,base/head 同样失败;修正测试契约后保留真正负例的 records/拒绝快照检查。原失败日志保留,未冒充 PR 失败或全套通过。完整仓库 suite、PostgreSQL、任意外部内部 import、长期性能未执行;本 PR 未改 PG store/provider 或有关持久语义,不要求无关 PG 重构验收。CI 按配置未查询、轮询或等待。

语义与 CI 对齐

复用已有 typed vocabulary,没有新增状态分类、substring denylist、领域特定义务或自动加载指导。空 advisory 只覆盖其支持语法,不能证明全部动态调用不存在;consumer inventory、实装字节、真实拒绝/恢复和 drift smoke 共同约束本次边界,既有 producer 缺口仍未宣称关闭。删除 unconditional dead code,没有新增 opt-in/default-off 声称。现有权限/选择器不变,存储不可用也不会从 Markdown 猜 absence 或替换 authority。

我的整体评价

APPROVE,无阻塞 finding。delivery 为 justified_increment;long_horizon 与 user_experience 均 preserved,重复运行/重放和恢复仍可达,当前使用不增加导航、重输信息或确认。observable_semantics equivalent,authority aligned,proportionality proportionate,default_off not_applicable。兼容性保留 active bridges、TS schemas/handlers 和持久格式,删除的内部 facade 无当前必要 caller。

有界 future-facing pass 已应用:两项 obsolete facade/alias 退出,使后续规则仍定位在既有 typed owner,没有通用框架或额外迁移。本次 local evidence 足够支持两文件 cleanup 的评审;它不完成全迁移或 Goal,也不授予合并权限。合并另需 exact-head 原生 gates 和仓库维护者授权;COMMENTED 批准结论不是 GitHub formal self-approval。

English verdict: APPROVE - exact head a467d5d; two unused internal Python facades retire while active typed owners and persistent contracts remain. Independent fresh installed CLI/File/SQLite recovery, replay and refusal match immutable base in14 cases; dropped-clear mutation is caught,52 Python and25 TS tests pass. Broad migration economics and arbitrary external internal imports remain unqualified; no CI observation.

@huangruiteng
huangruiteng merged commit 5d0e214 into main Oct 5, 2026
19 of 27 checks passed
@huangruiteng
huangruiteng deleted the codex/todo-adapter-retirement branch October 5, 2026 09:07
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.

2 participants