test: cover rewind selector restore options#4784
Merged
tanzhenxin merged 2 commits intoJun 9, 2026
Merged
Conversation
Collaborator
|
@/tmp/stage-1.md |
This was referenced Jun 4, 2026
wenshao
reviewed
Jun 7, 2026
wenshao
approved these changes
Jun 8, 2026
wenshao
left a comment
Collaborator
There was a problem hiding this comment.
No issues found. LGTM! ✅ — qwen3.7-max via Qwen Code /review
DragonnZhang
approved these changes
Jun 8, 2026
DragonnZhang
left a comment
Collaborator
There was a problem hiding this comment.
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
flushhelper matches the identical pattern inStandaloneSessionPicker.test.tsxandInputPrompt.test.tsx(double microtask yield insideact), and the explanatory comment is a nice touch. - The
userTurnfactory extension is backward-compatible — existing calls with two args still work, and the optionalpromptIdparameter is correctly typed againstHistoryItemUser. - Both new tests correctly exercise the component's restore-option phase: the first validates that
getDiffStatsis called with the rightpromptIdand 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
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.
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/cliand confirm all RewindSelector tests pass. I verified this locally withvitest 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
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
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.