Skip to content

test: cover rewind selector fallback states#4905

Merged
wenshao merged 1 commit into
QwenLM:mainfrom
han-dreamer:test/rewind-selector-fallback-states
Jun 10, 2026
Merged

test: cover rewind selector fallback states#4905
wenshao merged 1 commit into
QwenLM:mainfrom
han-dreamer:test/rewind-selector-fallback-states

Conversation

@han-dreamer

Copy link
Copy Markdown
Contributor

What this PR does

Adds focused regression coverage for additional RewindSelector fallback states in the rewind flow. This covers cases where file restore is unavailable because diff stats cannot be loaded, the selected turn has no prompt id, or file checkpointing is disabled and the selector uses the legacy confirmation path.

Why it's needed

This continues the test coverage work tracked in #4187. The previous PR covered restore-options rendering when file diff stats are available; this PR covers fallback paths that should still keep rewind usable and predictable when checkpoint metadata is missing or unavailable.

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 6 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 流程中的 RewindSelector 额外 fallback 状态添加了聚焦的回归测试。新增测试覆盖了文件恢复不可用的几种情况:diff stats 无法加载、选中的历史 turn 没有 prompt id,以及关闭 file checkpointing 时使用 legacy confirmation 路径。

Why it's needed

这个 PR 继续推进 #4187 中追踪的测试覆盖工作。上一个 PR 覆盖了存在文件 diff stats 时 restore-options 的渲染;这个 PR 覆盖 checkpoint 元数据缺失或不可用时的 fallback 路径,确保 rewind 在这些情况下仍然保持可用和行为可预期。

Reviewer Test Plan

How to verify

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

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.

@han-dreamer

Copy link
Copy Markdown
Contributor Author

The Windows CI failure was unrelated to the RewindSelector tests. It came from scripts/tests/dev.test.js matching POSIX-style path separators while the Windows run passed backslash paths. I pushed 00b4a50 to make that test path-portable and verified both the failing script test and the focused RewindSelector test locally:

  • vitest run scripts/tests/dev.test.js --config scripts/tests/vitest.config.ts
  • vitest run src/ui/components/RewindSelector.test.tsx --config vitest.config.ts from packages/cli

wenshao
wenshao previously approved these changes Jun 9, 2026

@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

@tanzhenxin

Copy link
Copy Markdown
Collaborator

Heads-up: #4915 just merged a fix for the same two scripts/tests/dev.test.js Windows assertions (normalize-separators approach), so this branch now conflicts with main on that file. Since the bundled fix in 00b4a50 is no longer needed, rebasing onto main and dropping that change should leave just the RewindSelector.test.tsx additions and merge cleanly. Thanks!

@han-dreamer han-dreamer force-pushed the test/rewind-selector-fallback-states branch from 00b4a50 to d9b87a8 Compare June 10, 2026 02:32
@han-dreamer

Copy link
Copy Markdown
Contributor Author

Thanks for the heads-up! I rebased onto the latest main, dropped the now-redundant scripts/tests/dev.test.js change, and force-pushed the branch. The PR now only contains the RewindSelector.test.tsx additions.

Verified locally:

  • vitest run src/ui/components/RewindSelector.test.tsx --config vitest.config.ts from packages/cli
  • vitest run scripts/tests/dev.test.js --config scripts/tests/vitest.config.ts

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

No issues found. LGTM! — Qwen Code /review

@wenshao wenshao merged commit f479f7a into QwenLM:main Jun 10, 2026
22 checks passed
@han-dreamer han-dreamer deleted the test/rewind-selector-fallback-states branch June 11, 2026 02:49
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.

4 participants