Skip to content

test: stabilize composer context ring tests - #5149

Merged
RealKai42 merged 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:fix/composer-context-ring-cold-start
Nov 20, 2026
Merged

RealKai42 merged 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:fix/composer-context-ring-cold-start

Conversation

@kimi-agent-bot

Copy link
Copy Markdown
Collaborator

Requirement or Bug

#5058 新增的 Composer context ring 首个用例在 CI 的 test (4) 分片中间歇性超过 Vitest 默认的 5 秒限制,已在多个无关 PR 和 main 上出现。这个 PR 消除冷启动对单用例计时的影响,让原有上下文圆环保底行为的验证稳定运行。

Bug Reproduction Steps

在包含 #5058 的提交上运行 pnpm run test --shard=4/5。高负载时,packages/app-components/test/composerMenuViewportClamp.test.ts 的 stays a static usage indicator while the context inspector is off 会在进入断言前报 Test timed out in 5000ms。

Root Cause

首个用例在测试函数内首次动态导入 Composer.vue,因此 Vite 对组件及依赖的冷转换也计入该用例的 5 秒超时。修复前本地冷跑此用例耗时 4.108 秒,已非常接近上限;其余用例复用已加载模块,只需 63–133 毫秒。这是测试启动计时归属问题,不是组件断言失败。

Code Changes

在文件级 beforeAll 中预加载 Composer.vue,把首次模块转换移到单个用例的计时之外。mountComposer() 和 setContextInspectorEnabled() 仍按原方式动态导入,afterEach 的 vi.resetModules() 也保持不变,因此测试的模块重置语义和全部断言均未改变。

+beforeAll: import Composer.vue for the first time
 beforeEach: install DOM and client fixtures
 test: mount Composer and verify the context ring contract

这是针对根因的修复,不是提高超时、跳过测试或重试。

Behavior Changes and Affected Users

None。仅修改测试启动顺序,没有改动产品源码、默认开关、组件行为、公开接口或发布产物。

受影响模块与测试覆盖:packages/app-components 的 Composer context ring 与菜单定位测试继续覆盖原有 7 个场景,包括开关关闭时的静态圆环、Escape 关闭卡片和菜单边界定位。

验证记录
  • 冷跑 pnpm --filter @moonshot-ai/app-components exec vitest run test/composerMenuViewportClamp.test.ts --reporter=verbose:7/7 通过;首个用例由修复前 4.108 秒降至 67 毫秒。
  • pnpm lint:通过。
  • pnpm run test --shard=4/5:本次修改的目标文件通过;完整分片另有 4 个既有失败,位于未修改的 remote-control 和 kap-server 测试。单独重跑这两个文件得到相同的 4 个失败,因此未将其记为通过,也未在本 PR 夹带修复。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e598b1d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T18:06:53.294682Z e598b1d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 19, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e598b1d
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e598b1d

commit: e598b1d

@RealKai42
RealKai42 merged commit a81958c into MoonshotAI:main Nov 20, 2026
18 checks passed
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 25, 2026
…C preload

Wrap the open-in menu in the upstream menu-pop transition with the
opacity-only enter/leave rules (MoonshotAI#5219), and preload Composer.vue before the
composer menu viewport tests so the first test does not pay for the lazy SFC
compile under Vitest (MoonshotAI#5149). Ledger: 4821 equivalent, 5160 and 5286
not-applicable, 5149 and 5219 ported.
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