test(desktop): unbreak main after #4694 (E2E budget, workbar story) - #4895
Conversation
#4694 added 'right workbar visibility belongs to each Session and survives reload' to session-workbar.spec.ts without updating e2e-budget.json, so check:e2e-budget fails on main (5 recorded, 6 present). Its CI ran on a base that predated #4877's budget check. The test needs Electron: the per-Session collapse bit has to survive a renderer reload, which the budget policy lists explicitly. Record it and name the mechanism. Generated-by: Claude Code
#4694 replaced WorkbarLayoutState.rightCollapsed with activeSessionId + collapsedBySession; #4877 landed a story that builds the old shape. Both were green on their own bases, so main's typecheck fails on stories/app-shell.stories.tsx. Build the story on the new state and read the collapse bit through isSessionWorkbarCollapsed, as the controller does. Generated-by: Claude Code
jackwener
left a comment
There was a problem hiding this comment.
Approving at exact head 47a19b6e. Both breaks are real, the fixes are minimal, and I checked the numbers rather than taking them from the description.
session-workbar.spec.tscontains 6test(calls; the budget now records 6. The file totals 31 tests in 16 files, matching the summary.- The story now builds
activeSessionId+collapsedBySessionand reads the collapse bit throughisSessionWorkbarCollapsed— the same accessor the production controller uses (use-workbar-layout-state.ts, alongsideworkbar-layout.ts), not a story-local shortcut. That matters here: the point of hosting this contract in a story is that the story exercises the production rule, so reading the bit the way the app reads it is what keeps the move honest.
Recording the test rather than deleting it is the right call — per-Session collapse surviving a renderer reload is renderer-reload persistence, which the budget policy already names as Electron-owned.
One thing worth stating plainly, since it is easy to read this as the guard being a nuisance: the guard worked. #4694's CI ran on a base that predated the budget check, so the drift could only surface after merge — which is precisely the case a post-merge structural check exists to catch, and it named the exact number to type. The failure mode it prevents is a tier that quietly grows back.
The note that #4829's head carries the same two edits and whichever lands second resolves a same-text conflict is useful; worth keeping an eye on so the second one is not resolved by discarding the budget update.
简体中文
在 exact head 47a19b6e 上批准。两处断裂都是真的,修法最小,而且数字我是核过的而不是采信描述。
session-workbar.spec.ts实有 6 个test(,预算现在记 6;全量为 31 tests in 16 files,与摘要一致。- story 现在构造
activeSessionId+collapsedBySession,并通过isSessionWorkbarCollapsed读取折叠位 —— 这正是生产控制器所用的同一个 accessor(use-workbar-layout-state.ts,以及workbar-layout.ts),不是 story 自己的捷径。这一点在这里很要紧:把契约放进 story 的意义就在于 story 要触发生产规则,所以「按应用读它的方式去读」才让这次搬移是诚实的。
把测试记进预算而不是删掉它,是正确的选择 —— 「每个 Session 的折叠位熬过一次渲染器重载」属于渲染器重载持久化,而预算政策本就把它列为 Electron 拥有的机制。
有一点值得直说,因为这件事很容易被读成守卫在添乱:守卫起作用了。 #4694 的 CI 跑在预算检查落地之前的基线上,所以这次漂移只可能在合并之后才浮现 —— 而这正是一个合并后结构检查存在的意义,并且它直接报出了该填的那个数字。它防住的失败形态,是那一层悄悄长回来。
关于 #4829 的当前 head 带有同样两处编辑、后合并者需要解决同文本冲突这一点,提示得有用;值得留意别在解决冲突时把预算更新丢掉。
Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.
Summary
check:e2e-budgetfails onmain:session-workbar.spec.ts: budget records 5 test(s), the file has 6. #4694 addedright workbar visibility belongs to each Session and survives reloadto that spec without updatingapps/desktop/e2e-budget.json; its CI ran on a base that predated #4877's budget check, so the mismatch only appeared after merge (reported on #4894).The test belongs in the Electron tier: the per-Session collapse bit has to survive a renderer reload, which the budget policy lists explicitly. This records it and names the mechanism. Tier is now 31 tests in 16 files.
Second break from the same merge: #4694 replaced
WorkbarLayoutState.rightCollapsedwithactiveSessionId+collapsedBySession, and #4877 landedstories/app-shell.stories.tsxbuilding the old shape, sotsc -p tsconfig.storybook.jsonfails onmain. The story now builds the new state and reads the collapse bit throughisSessionWorkbarCollapsed, as the controller does. #4829's current head carries the same two edits; whichever merges second resolves a same-text conflict.Refs #4694, #4761, #4877
Verification
node apps/desktop/scripts/check-e2e-budget.mjs:E2E budget holds: 31 tests in 16 files.tsc -p tsconfig.storybook.json --noEmit: no errors instories/app-shell.stories.tsx(the three pre-existingpackages/uiAstryx prop errors are local-only and unrelated).biome checkon the story: clean.AI use
Select exactly one:
Tool(s) and scope: Claude Code drafted the budget entry text and this description.
Checklist
mainand passes here)Does this PR entail a change in behavior?