Repository navigation
test(cleanup): 分级治理源码文本断言,删除钉实现文本的测试 - #2057
Merged
Merged
Conversation
按统一准则逐条核实 36 个测试文件里被标记的 187 条源码文本断言用例: - 删除 137 条(D1 钉偶然文本 51、D5 非高危接线 45、D2 已被行为测试覆盖 25、 D4 过弱/无关 13、D3 一次性清理确认 4),另顺手删除 1 条同类未标记用例; 删光用例的 6 个文件整体移除。 - 改写 20 条为行为测试(导出函数、react-test-renderer / renderToStaticMarkup、 stub fetch / 本地回环服务、electron mock 等),均做过变异验证: 改坏 src 变红、还原后变绿。 - 保留 19 条为源码结构护栏(K4 13、K2 4、K1 2),已收敛到不变量本身、 合并同类用例,并在 it( 上方加护栏注释。 - 11 条是分类器误报,未改动。 docs 里两处测试说明随被删/改写的测试同步更新。src/ 无改动。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
本批 7 个文件、71 条被标记用例:删除 49 条、改写 1 条、保留 4 条、误报 17 条。 - 删除整文件 3 个:worker-structured-lifecycle-status(36 条 worker.ts 闭包内 indexOf 先后/整句 toContain 接线断言)、worker-transfer-detach(已被 sandbox-relay-lifecycle 真实 worker 用例覆盖,并做过变异验证)、 worker-zmx-submit-recovery(ZMX 事务接线,无 seam,记为待抽 seam 的缺口)。 - worker-screenshot-upload-hardening:17 条是切出生产函数体后执行的行为测试, 判为误报不动;单写入点约束收敛为赋值点计数并标注 K1;删除 5 条钉 PID marker 展开式的 caller 持久化断言。 - workflow-daemon-ipc-wiring:保留鉴权 seam 护栏(K2,补上 verify 先于 handler 的顺序、放宽绕过检测)与描述符目录一致性护栏(K4);删除 dashboard 代理的 表达式钉子(签名头行为已由 v3-daemon-ipc-client 覆盖)。 - wrapper-standalone-guard:编译态自毁防线保留为 K1/K3,去掉变量名与整句表达式。 - zmx-backend-helpers:源码钉子改写为 zmx-backend-recovery 中真跑 ZmxBackend.spawn 的行为测试(创建客户端固定 TERM、控制客户端不受影响), 已做两处变异验证。 - 同步删除 docs/known-issues 中对已删测试文件的引用。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
批次 6 共 31 个测试文件、220 条被标记的源码文本断言用例,逐条核实后: - 删除 96 条(D5 非高危接线 54、D2 已被行为测试覆盖 18、D1 钉偶然文本 10、 D3 一次性清理确认 9、D4 过弱 5)。其中 6 条只删去用例内的文本断言,同用例 原有的行为断言保留。25 条 D5 记为待补 seam 的缺口。 - 改写为行为测试 9 条:web 终端 IME 认领/周期边界/安装门禁、首屏跟随到底与 用户滚动取消(切出页面脚本执行),TRAE drain 的 adopt 空回答语义;均做过 变异验证(改坏 src 变红、还原变绿)。 - 保留 19 条源码结构护栏(K1 3、K2 10、K3 4、K4 2),合并为 9 个用例,断言 收敛到不变量本身并加护栏注释。 - 误报 96 条:从 src 切出真实代码执行,或读取被测代码写进临时目录的文件,未改动。 整文件删除 5 个:submit-diag-wiring、submit-failure-lifecycle-wiring、 transfer-input-gate-wiring、tui-input-failure-contract、 vc-meeting-worker-exit-recovery-wiring。只改 test/,src/ 无改动。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
按统一准则逐条处理批次 7 的 152 条被标记用例(17 个文件): - 删除 103 条:D5 巨型闭包接线 68、D2 已有行为测试覆盖 16、D1 偶然文本 13、 D4 过弱 4、D3 一次性清理 2;整文件删除 4 个(web-terminal-tmux-window-size、 web-terminal-touch-scroll、web-terminal-touch-toolbar、worker-backend-exit-crash-order)。 - 改写 10 条为行为测试:路由表经 findDashboardRoute 执行;worker-pool ready 的 replyAlreadySent 经 fake worker harness 执行;Codex runner freshness 队列去掉尾部 源码断言;其余经新增的 test/helpers/worker-function-harness.ts 抽取 worker.ts 真实函数执行(restartCliProcess 输入围栏、drain helper、close 围栏、致命错误回执、 Claude transcript 消费回执)。全部做过变异验证。 - 保留 10 条(合并为 5 个用例)并加护栏注释:K1 发出的内联脚本可解析、编译态 worker 入口加载顺序;K3 durable ambiguous 前先 drain(防副作用两次)、远端 close/suspend/restart 拒绝先于本地破坏性 teardown、入口文件 riff-only 护栏归零。 - 误报 29 条:worker-codex-session-upgrade 与 worker-exact-interrupt 是抽取真实 函数执行的行为测试,未改动。 另同步清理了 5 个测试文件注释里对上述文件的引用。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
按测试治理准则逐条核实批次 2 的 40 个测试文件、195 条被标记的源码文本断言: - 删除 120 条:钉日志/文案/CSS/表达式写法(D1)、已被行为测试覆盖(D2)、 一次性清理确认(D3)、过弱断言(D4)、巨型闭包里的非高危接线(D5); 另顺手删除 1 条无断言的空用例。整文件删除 6 个。 - 改写 21 条为行为测试:经导出函数、React 渲染、真实 worker 子进程等入口触达, 每条都做了变异验证(改坏 src 变红、还原变绿)。 - 保留 25 条结构护栏(K1 1、K2 12、K3 10、K4 2),断言收敛到不变量本身并加注释。 - 29 条为分类器误报(抽取后执行的行为用例、文件级 import 误判),未改动。 只改 test/,src/ 无改动。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
批次 1 共 19 个测试文件、167 条被标记的源码文本断言用例,逐条核实后分级处理: - 删除 94 条(另有 1 条未标记的同类用例一并删除):D5 非高危接线细节 60、 D2 已被行为测试覆盖 14、D1 钉偶然文本 14、D4 过弱 4、D3 一次性清理确认 2; 其中 14 条守过真实 bug,已在 ledger 里登记需要补的行为 seam。 - 改写为行为测试 26 条:通过导出函数、IPC 路由、renderToStaticMarkup、 ts-runner 起 CLI、worker-pool 的 fork mock、worker 集成 harness 触达真实行为, 每条都做过变异验证(改坏 src 变红、还原后变绿)。 - 保留为源码结构护栏 35 条(K2 安全/权限 24、K3 高危回归 6、K4 一致性 3、 K1 结构约束 2),断言收敛到不变量本身并合并,逐条加注释说明理由与来历。 - 误报 12 条(截取终端页脚本片段后实际执行,断言的是执行结果),未改动。 改写的用例部分落在同主题的行为测试文件里(session-lifecycle-start、 worker-remote-runner.integration);另有几处测试注释因引用了已删用例而同步更新。 没有删除整个文件,src/ 无改动。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
按测试治理准则逐条处理批次 4 的 52 个文件、221 条被标记的源码文本断言用例: - 删除 92 条(D1 钉偶然文本 7、D2 已被行为测试覆盖 14、D3 一次性清理确认 3、 D4 过弱/无关 7、D5 非高危接线细节 61),其中 33 条在 ledger 中登记了缺失的 行为 seam;8 个文件因用例全部删完而整体移除。 - 改写 39 条为行为测试(真实调用导出函数、handleCardAction、抽取的 daemon 路由 handler、mock electron 后加载 desktop 主进程、经 ts-runner 起 botmux CLI 等), 每条都做了变异验证:改坏 src 后变红、还原后变绿。 - 保留 34 条为源码结构护栏(K1 6、K2 17、K3 9、K4 2),断言收敛到不变量本身、 同文件可合并的已合并,并在用例上方注明原因与来历。 - 56 条为误报(抽取真实源码片段执行后断言行为,或读取测试自己生成的文件),未改动。 只改 test/ 与一处设计文档中的测试行号引用,src/ 无改动。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
按源码文本断言分级准则处理批次 5 的 198 条被标记用例(28 个文件): - 删除 99 条:钉偶然文本 / 已被行为测试覆盖 / 一次性清理确认 / 过弱 / 非高危接线细节; 其中 4 个文件整文件删除(sandbox-tree-worker-exit、session-rename-worker、 session-backend-selector-shape、report-daemon-ipc-auth-wiring)。 - 改写 39 条为行为测试,均做过变异验证(改坏 src 变红、还原变绿): scope-optional-autofix 改为驱动真实 checkRequiredScopes / ensureVcMeetingEventsSubscribed; send-after-the-fact-topic-quote / send-attachment-message-ids 改为经 send capture fixture 跑真实 CLI;scheduler-cli-scope 改为起真实 CLI 校验参数;restart-worker-null-reattach、 restart-live-worker-lark-tool-binding、reply-target-fallback、report-session-relay、 resume-fresh-policy 改为调用导出入口。 - 保留 10 条源码结构护栏(K1/K2/K3),收敛到不变量并加注释:读隔离冷机升级、 skill manifest 强制只读放行、强制凭证隔离闸、读隔离发送 fail-closed、frozen origin 可达性、编译态 relay 调用点、沙盒模块递归删除禁令、auto-worktree 回退闸、 restart IPC 单发送方(改为扫描整个 src/)。 - 50 条为误报(执行 AST 截取的真实 handler / 读取数据文件夹具),未改动。 send-reply-card-capture fixture 新增三个 env 门控开关(线程 id、文件上传失败、 图片上传),默认行为不变。不改 src/。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
源码文本断言治理中,有 202 条(85 个文件)被删的用例当初确实守过真实 bug,但被测逻辑在 worker.ts / daemon.ts / cli.ts 等文件的闭包里没有可调用入口,无法当场改写成行为测试。按原测试文件列出缺口条数与建议抽出的 seam,作为后续抽函数补测试的待办。 Co-Authored-By: Claude Opus 5.5 <[email protected]>
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
October 20, 2026 13:15
This was referenced Oct 20, 2026
deepcoldy
added a commit
to dbinggo/botmux
that referenced
this pull request
Oct 20, 2026
…el test removed by deepcoldy#2057) # Conflicts: # test/daemon-turn-reply-sender-wiring.test.ts
deepcoldy
added a commit
to Kerminate/botmux
that referenced
this pull request
Oct 20, 2026
Resolve conflicts for deepcoldy#2035: additive union with newer master routes (deferred-topic + link-refs), adopt deepcoldy#2040 sandbox tree rename, align final-output render snapshot, and drop the source-text-pinned test removed by deepcoldy#2057/deepcoldy#2058. Tree equals reviewed rebase.
deepcoldy
added a commit
to Kerminate/botmux
that referenced
this pull request
Oct 21, 2026
Earlier stack-of-merges both reintroduced tests removed by deepcoldy#2057/deepcoldy#2058 (git add -A picked up stray untracked files) and dropped deepcoldy#1620 Orca files. Reset the tree to the reviewed linear rebase result (base db667c6): zero resurrected deleted tests, all master Orca files present, link-ref core byte-identical, resolve/register/deferred-topic/ chat-manager all in the narrow untrusted-auth aperture.
deepcoldy
added a commit
to Kerminate/botmux
that referenced
this pull request
Oct 21, 2026
Supersedes the earlier stack-of-merges which had both resurrected deepcoldy#2057/deepcoldy#2058-deleted tests and dropped deepcoldy#1620 Orca files. Tree now equals the reviewed linear rebase on f894190: zero resurrected deleted tests, all current-master files retained, link-refs/resolve in the narrow aperture with real-server and set-invariant tests.
deepcoldy
added a commit
to Kerminate/botmux
that referenced
this pull request
Oct 21, 2026
Tree equals the reviewed linear rebase (67072e1ef) on 7d0a0d7: zero deepcoldy#2057/deepcoldy#2058-deleted test resurrections, all current-master files (including deepcoldy#1620 Orca and deepcoldy#1841) retained, link-refs/register+resolve both in routeHasNarrowUntrustedAuth with real-server/set-invariant tests.
deepcoldy
added a commit
to Kerminate/botmux
that referenced
this pull request
Oct 21, 2026
Merge current master (7d0a0d7) with the reviewed LinkRef result tree 49e8dd5 (zero deepcoldy#2057/deepcoldy#2058 test resurrections, all master Orca/card/ tmux files retained, link-refs/register+resolve in the narrow untrusted aperture). This makes current master a parent so GitHub three-way merge uses master itself as the base; content is byte-identical to the reviewed clean linear rebase and no existing branch history is rewritten.
|
🚀 Released in v3.48.0 |
deepcoldy
added a commit
to Kerminate/botmux
that referenced
this pull request
Oct 21, 2026
Bring the branch to current master (e9d0f8b, deepcoldy#1758/deepcoldy#2074/deepcoldy#1005/deepcoldy#2016); content is the clean merge with the reviewed LinkRef tree: link-ref register+resolve in the narrow aperture, zero deepcoldy#2057/deepcoldy#2058 resurrections.
deepcoldy
added a commit
that referenced
this pull request
Oct 22, 2026
merge master 后 CI 首跑 test (2/3) 红:test-hygiene 守门(#2057)检出 cursor-plan-b-wiring 的 6 个用例读 src/worker.ts 文本做断言却未标注。这些 断言守的是埋在 worker 闭包里、无行为入口的兜底链路不变量(忙时租约刷新+ 120s 硬上限、scratch 闸门三处读写、spawn 链接链、in-binding 轮转重绑、 observer 全模式通知),与 #2009 的 attach-wiring K3 同形态,按规则在 describe 总注 + 每个 it 上方补 K3 标注。非碰运气 rerun:本地复现红、修复 后 test-hygiene 26 例与 wiring 6 例全绿。
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.
改了什么
单测里有 1107 个用例(216 个文件) 把
src/源码当字符串读进来再断言:toContain某行代码,或者用indexOf比较两段代码的先后。这类断言钉的是实现文本:改个名、做个无害重构就红;代码还在但已经走不到时,却照样绿。git 历史里,这类文件几乎每次改worker.ts/daemon.ts都要跟着改字符串,例如worker-pipe-initial-screen-order.test.ts被 20 多个提交跟着改过。这是典型的「为写测试而写测试」。本 PR 按统一准则逐条判定了 1415 个被标记的用例(含分类器误报):
// 源码结构护栏(Kx):…注释说明理由test/helpers/worker-function-harness.ts:从worker.ts切出单个顶层函数,在注入的作用域里执行。沿用的是worker-codex-session-upgrade.test.ts已有的技术;函数改名时会直接报错,不会悄悄变绿。docs/plans/2026-10-20-test-seam-backlog.md里,按原测试文件列出建议抽出的 seam,作为后续补行为测试的待办。src/。docs 里 4 处指向被删用例的引用已同步更新。影响面
test/和docs/,生产代码零改动,不影响任何平台、CLI 或会话类型的运行行为。test/api-only-mode-wiring.test.ts改写后用到了vi.doMock,scripts/run-bun-tests.mjs会自动把它排除出 bun 测试链;vitest 照常运行它。worker-first-prompt-hard-cap要真实等待 90 秒,还有几处 tmux 变体。这些用例在 CI 里照常运行。测试验证
19ffa08b8):session-preview-proxy、session-rename-cli各 1 条:高负载下偶发,重跑即过。plugin-mcp-sandbox2 条:基线时因为还没有dist/被 skip 了;build 之后,在不含本 PR 的 master 上同样失败(本机 bwrap 环境)。d06d38563后,master 新增两个提交涉及的 7 个测试文件全部通过。npx tsc -p tsconfig.test-mocks.json --noEmit通过。顺带发现(本 PR 未修改)
src/dashboard/web/sessions-page.tsx筛选抽屉里的 status / adopt / chat 下拉,仍在setFilters(prev => …)回调里读event.currentTarget.value。这和07186c8118修过的白屏是同一种写法,原来那条源码断言也没有覆盖到这几处。runtimeVersion参数,在src/dashboard/web里找不到读取方。src/cli.ts里有一个 dispatch 包装,注释写明只是因为旧的源码断言才保留;该断言已删,这个包装可以另行清理。src/dashboard/web/style.css、src/core/worker-pool.ts里有几处注释还指向已删的测试。合并顺序
#2058 可以独立合并。本 PR 合入后再合 #2060(它叠在本分支之上)。#2059 和本 PR 有 3 个测试文件冲突,都很好解决,等本 PR 合入后 rebase 即可。
🤖 Generated with Claude Code