Skip to content

test(todos): align recovery with context title budget - #5506

Merged
huangruiteng merged 1 commit into
mainfrom
codex/fix-todo-context-budget-contract-20261003
Oct 3, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/fix-todo-context-budget-contract-20261003

Conversation

@Duang777

@Duang777 Duang777 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Goal and outcome

The Todo recovery integration test still expected the legacy Python formatter to append ... outside its 420-character budget. Since #5468, the shared TypeScript context projection owns this output and includes the three-character marker inside the 420-character limit. This updates the stale assertion and pins both the bounded length and content_truncated signal.

This is a test-only correction for the current main failure that also blocks unrelated PRs such as #5491. Production behavior is unchanged.

Validation

  • Red: the focused test failed on current main because the actual title was 420 characters while the assertion expected 422.
  • Green: focused File and SQLite cases, 2 passed.
  • Full test_todo_projection_recovery.py, 21 passed.
  • Related manager/context tests, 8 passed.
  • Ruff and git diff --check passed.

One signed-off commit. No uv.lock change. Maintainer review and merge required.

The shared Todo context projection now counts its three-character truncation marker inside the 420-character title budget. Update the older recovery assertion and pin the bounded length and truncation signal.

Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent | GPT-5 | OpenAI

English verdict: APPROVE — 2aef27f; focused test correction restores the already-shipped 420-code-point overview contract without altering runtime behavior or canonical Todo content. No merge.

动机

维护者验证长任务的显示恢复时,需要回归准确地区分完整任务与截断概览,避免过时断言阻塞真实恢复验收。
过去集成用例把省略号算在标题预算之外,而已交付的共享投影把它算在 420 个字符之内;同一真实 File/SQLite 恢复用例在不可变基线各失败一次。
本次仅校正既有断言并同时核验截断标记和长度,原任务全文、provider revision、显示恢复和重放不重复创建的检查全部保留。
不改变生产格式、权限、预算或安装态,也不因这项测试修复宣称完成整个持续运行或跨平台验收。

改动思路

预期来自改动前已经存在的共享 TypeScript 契约测试,而不是从新 head 输出反推:概览最多 420 个 Unicode code point,其中三字符留给省略号;精确读取恢复完整内容并清除截断标记。manager 经原 canonical-first reader 和 todo.context.page 读取该结果,Python 安全展示不另造决策规则。新的断言与原 owner 一致,而不是把运行时改回旧格式。

具体改动

共同基线 d74554b48758ce484633c9088af85c55143630af;整个 PR 只有 tests/control_plane/test_todo_projection_recovery.py 一处 +4/-2。原 test_long_committed_todo_rebuilds_from_the_fresh_head_without_a_second_create 在真实 File/SQLite 上先创建含中文和 emoji 的长 Todo,再从 canonical head 重建故意过期的 Markdown,检查全文、叙事保留、provider revision、不重复 canonical 写入和 create replay。

改动只将 title 内容断言从旧的 419 字符前缀调整为 417 加省略号,并增加 content_truncated is True、len(title) == 420。同一个 test 的恢复、重放和无副作用断言未删除,fixture 未缩短。未新增第二测试框架或一次性示例;维护已有生产入口回归就是耐久价值。

关键内容讲解

改动前 loopx/control_plane/todos/context_projection.ts:15 的 projectTodoContextPage 已按 code point 截取 cap - 3;改动前 tests/control_plane_ts/todo_context_projection.test.ts 的“overview loss is visible and an exact read recovers the original constraint”已独立固定 420、截断标记及 exact read。两份基线文件与当前 production owner 都已检查。没有单独文字规格规定这项精确字符数,因此不编造 RFC 验收编号;依据是现存公开的 executable contract 与真实恢复路径,不是作者一句“已修好”。

对主干的风险

无生产 diff、默认行为变化、新状态 vocabulary 或更广泛授权。基线 focused 原命令两个 provider 在原 title 内容断言失败,当前头的通过必须覆盖真实 CLI create/project/list、manager read 和 canonical readback,而不能只验证字符串 helper。新标记和精确长度使错误截断不能悄悄通过;原恢复负例仍拒绝 stale revision、不可用 authority、title conflict、损坏文档和并发覆盖,故没有通过放宽预算来消除回归。

全量现有 recovery 与 manager/conversation-context 回归、原 TS context 三项、Ruff、diff hygiene 及公共边界扫描按本轮实际结果记录。advisory 仅作改动范围提示;没有修改共享语义 owner,不要求无关全树运行时重验。未查询或等待 CI,未做安装、UI 改版、Lark 或 PostgreSQL qualification。相邻 future-facing pass 检查了共同 owner 与重复 coverage:这个六行断言修改已经复用原测试,不需要新的 helper 或语言迁移。

我的整体评价

没有阻塞发现。long_horizon 为 improved:消除已重现的过时假失败,同时保留实际恢复和幂等性约束;user_experience 为 preserved:生产概览和精确读取都不改变,只让维护者回归与既有合同一致。代码量与维护收益匹配,同作者近期 PR 扫描没有发现本项复制新 smoke 的批量脚手架。APPROVE 当前 exact head;批准后按 capability 执行旧阻塞评审 closeout,保留讨论,交维护者处理合并。

本轮实际检查:29 passed in 111.58s (0:01:51);基线 focused 两项按原断言失败;原 TS context 三项通过;Ruff、diff 和 public scan 通过。

@Duang777

Duang777 commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

This PR's Windows failures are the existing directory fsync defect fixed by #5491; all four failures come from handoff_mode_migration_conformance.ts returning EPERM, while 410 Windows tests passed. The Python shard aggregate failed because two long shards were cancelled at their 30-minute limits.

To break the circular CI dependency without rewriting either reviewed commit, I merged this exact approved commit (2aef27fa6) into the #5491 branch with a signed merge commit. #5491 now contains both the Windows fix and this test-contract correction and is running a fresh CI cycle. This PR remains open as the focused review record; no self-merge.

@huangruiteng
huangruiteng merged commit 9fe8d2a into main Oct 3, 2026
24 of 29 checks passed
@huangruiteng
huangruiteng deleted the codex/fix-todo-context-budget-contract-20261003 branch October 3, 2026 06:00
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