Skip to content

test: cover rewind selector restore options#4784

Merged
tanzhenxin merged 2 commits into
QwenLM:mainfrom
han-dreamer:test/rewind-selector-restore-options
Jun 9, 2026
Merged

test: cover rewind selector restore options#4784
tanzhenxin merged 2 commits into
QwenLM:mainfrom
han-dreamer:test/rewind-selector-restore-options

Conversation

@han-dreamer

Copy link
Copy Markdown
Contributor

What this PR does

Adds focused regression coverage for the rewind restore-options flow. The new tests verify that selecting a turn with file checkpointing enabled shows the restore choices, includes the diff summary for changed files, and allows returning to the turn picker with Escape.

Why it's needed

This covers part of the rewind test gap described in #4187. The restore-options phase combines selected conversation history, file checkpoint metadata, asynchronous diff stats, and keyboard navigation, so regression coverage helps keep the rewind UX stable as the flow evolves.

Reviewer Test Plan

How to verify

Run the focused CLI component test from packages/cli and confirm all RewindSelector tests pass. I verified this locally with vitest run src/ui/components/RewindSelector.test.tsx --config vitest.config.ts; the suite passed with 3 tests.

Evidence (Before & After)

N/A. This PR only adds regression tests and does not change user-visible runtime behavior.

Tested on

OS Status
🍏 macOS ⚠️ not tested
🪟 Windows ✅ tested
🐧 Linux ⚠️ not tested

Environment (optional)

Tested locally on Windows with Node.js v24.14.0. Command run from packages/cli: vitest run src/ui/components/RewindSelector.test.tsx --config vitest.config.ts.

Risk & Scope

Linked Issues

Part of #4187.

中文说明

What this PR does

这个 PR 为 rewind 的恢复选项流程添加了聚焦的回归测试。新增测试验证了在启用文件 checkpoint 的情况下选择某个历史 turn 后,会展示恢复选项、包含变更文件的 diff 摘要,并且可以通过 Escape 返回 turn 选择列表。

Why it's needed

这个 PR 覆盖了 #4187 中提到的 rewind 测试缺口的一部分。恢复选项阶段同时涉及选中的对话历史、文件 checkpoint 元数据、异步 diff stats 和键盘导航,因此补充回归测试可以帮助后续迭代时保持 rewind 用户体验稳定。

Reviewer Test Plan

How to verify

packages/cli 目录运行聚焦的 CLI 组件测试,并确认所有 RewindSelector 测试通过。我已在本地使用 vitest run src/ui/components/RewindSelector.test.tsx --config vitest.config.ts 验证,该测试套件通过,共 3 个测试。

Evidence (Before & After)

N/A。这个 PR 只新增回归测试,不改变用户可见的运行时行为。

Tested on

OS Status
🍏 macOS ⚠️ not tested
🪟 Windows ✅ tested
🐧 Linux ⚠️ not tested

Environment (optional)

本地在 Windows 上使用 Node.js v24.14.0 测试。从 packages/cli 目录运行的命令是:vitest run src/ui/components/RewindSelector.test.tsx --config vitest.config.ts

Risk & Scope

Linked Issues

Part of #4187.

@qwen-code-ci-bot

Copy link
Copy Markdown
Collaborator

@/tmp/stage-1.md

Comment thread packages/cli/src/ui/components/RewindSelector.test.tsx Outdated
Comment thread packages/cli/src/ui/components/RewindSelector.test.tsx

@wenshao wenshao 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.

No issues found. LGTM! ✅ — qwen3.7-max via Qwen Code /review

@DragonnZhang DragonnZhang 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.

Review summary

Clean test-only PR that adds focused regression coverage for the rewind restore-options flow. Well-structured and consistent with existing test patterns in the codebase.

What I verified

  • The flush helper matches the identical pattern in StandaloneSessionPicker.test.tsx and InputPrompt.test.tsx (double microtask yield inside act), and the explanatory comment is a nice touch.
  • The userTurn factory extension is backward-compatible — existing calls with two args still work, and the optional promptId parameter is correctly typed against HistoryItemUser.
  • Both new tests correctly exercise the component's restore-option phase: the first validates that getDiffStats is called with the right promptId and all three restore options render with diff stats; the second validates that Escape returns to the pick list and clears the restore options.
  • Deterministic checks (tsc, eslint): 0 findings.
  • Both previous review suggestions (rename to flush, add microtask comment) were already addressed in the latest commit.

Verdict: LGTM. No issues found.

— qwen-code via Qwen Code /review

@tanzhenxin tanzhenxin merged commit cd5e680 into QwenLM:main Jun 9, 2026
11 checks passed
@han-dreamer han-dreamer deleted the test/rewind-selector-restore-options branch June 9, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/components UI components and widgets scope/testing Test frameworks and cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants