Skip to content

test(dispatch): 补齐任务树标题截断与空标题回退的测试 - #2840

Merged
deepcoldy merged 2 commits into
deepcoldy:masterfrom
swtxbling:test/task-tree-title-tests
Nov 5, 2026
Merged

deepcoldy merged 2 commits into
deepcoldy:masterfrom
swtxbling:test/task-tree-title-tests

Conversation

@swtxbling

Copy link
Copy Markdown
Contributor

Refs #2778

改了什么

补 #2778 合入时复审列出的 4 处测试缺口。只加测试,不改功能代码(只动了 test/dispatch-task-tree.test.ts,+19 行)。

# 缺口 新用例
1 恰好 40 字的边界没有断言 taskTreeDisplayTitle('a'.repeat(40)) 原样返回
2 卡片 header 在编排标题为空/纯空白时回退「编排任务」没有覆盖 标题为 '' 和 ' \n ' 时,header.title.content === '编排任务'
3 botmux dispatch tree 文字版表头的同款回退没有覆盖 同上两种标题,文字版首行以 编排任务( 开头
4 多行合并只测了一个连续空白段 taskTreeDisplayTitle('a\nb\nc') === 'a b c'

影响面

只改测试,生产代码没动,不影响任何 CLI、后端或会话类型。

验证

  • vitest run --project unit test/dispatch-task-tree.test.ts test/test-hygiene.test.ts:2 files / 48 tests passed
  • bun test test/dispatch-task-tree.test.ts(bun 1.4.3):22 pass / 0 fail
  • tsc -p . --noEmit:0 错

变异复验:把下面 4 处源码逐一临时改坏,每次都有对应的新用例变红(其余 21 个用例仍绿),之后已还原:

改坏的源码 变红的用例
chars.length > max 改成 >= keeps a title of exactly the max length uncut
/\s+/g 去掉 g joins every whitespace run, not only the first
卡片 header 去掉 || '编排任务' falls back to 编排任务 when the orchestration title is empty or blank
文字版表头去掉 || '编排任务' 同上

🤖 Generated with Claude Code

补 deepcoldy#2778 复审列出的 4 处测试缺口,只加测试,不改功能代码:
- 恰好 40 字的标题不截断(锁住 `>` 不被改成 `>=`)
- 多段空白全部合并(`a\nb\nc` → `a b c`,锁住 `/\s+/g` 的 g)
- 编排标题为空或纯空白时,卡片表头回退「编排任务」
- 同样情况下,`botmux dispatch tree` 文字版首行回退「编排任务」

Refs deepcoldy#2778

Co-Authored-By: Claude Opus 5.5 <[email protected]>
复审发现空标题回退用例只单向断言空/纯空白 → 「编排任务」:卡片 header 或文字版首行若恒退化成常量「编排任务」,现有 22 个用例全部仍绿(双引擎实证)。补一个非空标题用例,钉住两处渲染会显示真实编排标题;两个恒量化变异在新用例上双引擎咬红。

Refs deepcoldy#2778

Co-Authored-By: Claude Code <[email protected]>
@deepcoldy

Copy link
Copy Markdown
Owner

已按复审建议追加一个 commit(aa2e5d5b9):补「非空编排标题」的正向断言。

原因:复审发现空标题回退用例只单向断言了空/纯空白 → 「编排任务」。把卡片 header(src/core/dispatch-task-tree.ts:286)或文字版首行(:298)恒写成常量「编排任务」时,原 22 个用例在 vitest 与 bun test 下都全部通过——「真实编排标题不显示、恒退化成默认词」这类回归套件咬不住。

新增用例 shows a non-empty orchestration title verbatim in the card header and text heading,用非空标题同时钉住卡片 header 与文字版首行。

验证:

  • vitest run --project unit(含 test-hygiene)49/49 绿;bun test test/dispatch-task-tree.test.ts 23/23 绿;tsc --noEmit 0 错
  • 变异复验:两处恒量化在新用例上双引擎咬红(1 failed / 22 passed),还原后全绿
  • 仅在分支末尾追加 commit,未改写原提交 ab19c3e

最终以维护者审阅为准。

🤖 Generated with Claude Code

@deepcoldy
deepcoldy merged commit 11416c7 into deepcoldy:master Nov 5, 2026
10 checks passed
@deepcoldy

Copy link
Copy Markdown
Owner

感谢贡献,已 squash 合入 master(11416c7d)。

复审补充的「非空编排标题正向断言」一并合入,四个缺口 + 回退正向覆盖现在都有双引擎变异证据。纯测试改动,无需额外操作。

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

🚀 Released in v3.57.2

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