Repository navigation
Conversation
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
…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.
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
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.