test: 三条负载/时序敏感用例改成确定性(同一 commit 两次跑结果相反的那三条)

1. `mount.e2e.ts` 的底部工作台入口:入口的既有产品规则是「宿主右侧栏展开时不渲染」,
   而该用例先打开右侧栏、再去等这个入口,实际是在赌 500ms 复检窗口——同一 commit
   一次绿一次红(trace 里该元素在开右侧栏前存在、之后消失)。改为「展开断言 guide →
   收起右侧栏 → 点入口 → 最后重新展开右侧栏做 shadowing 断言」,每一步都等可观测状态。
2. `perf.e2e.ts` 的 `session.cwd` 门槛:15s 窗口 / 5s 节奏下,一个轮询器本身就报 3–4
   次,而「宿主右侧栏是否真的收起了」决定是一个还是两个轮询器。改为 `< visited * 2`
   (修复前 4 个页签是 15),既不再依赖视觉状态,也仍然区分「每会话」与「每页签」。
3. `editor-host.spec.tsx` 的渲染预算 20s → 60s(describe 时钟 35s → 120s)。实测同一
   commit:绿的那次本文件 609ms、红的那次 50554ms(本机 108ms),且三条 `fs.trees`
   应答都在等待开始前就落了地——80× 的 worker 停顿,不是等待太短。断言语义不变:
   行始终不出现仍然失败。
This commit is contained in:
Menghuan1918 committed 2026-10-16 01:06:50 +08:00
1 parent 57fe6e657d
commit c765c3eb49
3 files changed
+35 -5

No files matched your search

+16
View File
@@ -731,6 +731,18 @@ test('the bottom workbench opens the plugin terminal (#774) without shadowing th
// seeded editor tab is open on arrival — clicking unconditionally would
// collapse it, and every later query would then measure the slid-off
// (translateY(102%)) panel.
//
// It is also HIDDEN while the host right sidebar is open (the plugin's own
// rule: that corner belongs to the host's Split/Fullscreen/Collapse cluster),
// so the sidebar opened above must be collapsed again before the toggle can
// be clicked at all. Waiting for it while the panel is open was a race the
// suite used to win by landing inside the 500 ms re-check window — and lost
// on 2026-10-15 (identical commit, one run green and one red).
await page.locator('[data-sidebar-right-toggle]').first().click()
await expect(
page.locator('[data-sidebar-right-expand]').first(),
'the right sidebar must be collapsed before the workbench toggle can render',
).toBeVisible({ timeout: 30_000 })
const bottomExpand = page.locator('[data-dsh-bottom-toggle]:visible').first()
await expect(bottomExpand).toBeAttached({ timeout: 60_000 })
if ((await bottomExpand.getAttribute('data-active')) !== 'true') await bottomExpand.click()
@@ -782,6 +794,10 @@ test('the bottom workbench opens the plugin terminal (#774) without shadowing th
// Shadowing check: the plugin's entry is bottom-only, so the host's own
// guide STILL lists exactly one `terminal` capsule — with the plugin's
// terminal now open beside it — and never one for `terminal-bottom`.
// The sidebar was collapsed to reach the workbench toggle above, so it is
// re-opened here: this check IS about the host's guide being intact.
await page.locator('[data-sidebar-right-expand]').first().click()
await expect(guide).toBeVisible({ timeout: 30_000 })
await expect(
hostTerminalEntry,
'the plugin must not shadow the host terminal',
+9 -2
View File
@@ -450,7 +450,14 @@ test('measure: steady-state recurring work while the visited session is parked',
const visited = record.visitedTabs
expect(
sessionCwdIdle,
`session.cwd must be polled once per session (${visited} visited tabs must not multiply it)`,
).toBeLessThanOrEqual(visited)
`session.cwd must be polled once per session, not per visited tab (${visited} tabs; `
+ 'the pre-fix code reported one poller per mounted body AND one for the shell)',
// Budget, not an exact count: the window is 15 s against a 5 s cadence, so
// ONE poller already reports 3–4, and whether the host sidebar really ended
// up collapsed decides between one and two pollers (the plugin shell adds
// one while its workbench is on screen). Pre-fix this was 15 for four
// visited tabs — `visited * 2` still separates "one per session" from "one
// per tab" without depending on that visual state.
).toBeLessThan(visited * 2)
})
+10 -3
View File
@@ -114,10 +114,17 @@ setupReactAct()
* hit the SUITE clock (15s, a real `fs.watch` + 150ms debounce) in a local
* run under heap pressure — i.e. the worker, not the wait, ran out of
* runway. The suite's own clock is now 30s (`vitest.config.ts`).
* The affected `describe` raises its clock to 35s, so a genuinely missing row
* - 20s → 60s: 2026-10-15, the same two cases in the SAME commit produced a
* green run and a red one. Measured on both: this file takes **609ms** in
* the green CI run (108ms locally) and **50554ms** in the red one, where
* the tree had received its three `fs.trees` answers (all landing before
* the wait even started) and still never rendered a row. That is an ~80x
* stall of the worker, not a slow wait, so the budget buys margin without
* weakening the assertion: a tree that never lists the row still fails.
* The affected `describe` raises its clock to 120s, so a genuinely missing row
* still fails on the ASSERTION, never on the test clock.
*/
const RENDER_WAIT_MS = 20_000
const RENDER_WAIT_MS = 60_000
/**
* Wait until the tree has rendered the row for `name` — the precondition of
@@ -655,7 +662,7 @@ describe('EditorHost (files window)', () => {
*/
// 35s clock: the tree wait above budgets 20s (and reports for 5s more when it
// expires), so the ASSERTION stays the thing that fails, not the test clock.
describe('EditorHost native-tab context-menu actions', { timeout: 35_000 }, () => {
describe('EditorHost native-tab context-menu actions', { timeout: 120_000 }, () => {
/** A service whose openTab calls are recorded (surface undefined = native). */
function spyService(store: ReturnType<typeof createSidebarStore>): {
service: ReturnType<typeof createBetterSidebarService>