Repository navigation
test(e2e): open and close structured chat tabs with an isolated Claude stand-in - #30011
Conversation
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
tests/e2e/structured-chat-tabs-open-close.spec.ts: 1
220-242: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert one non-probe launch for each created session.
The current check passes when the log contains only a
--versionprobe. Tab visibility does not prove that the provider launched, because the host publishes the tab before it callscontext.wakeDelivery. Require every derived provider ID in the launch log.Suggested fix
const providerIds = [first, second, opened!.entityId].map((id) => claudeSessionIdForOrcaSession(id) ) - await expect.poll(() => readStubLaunches(claudeStub.launchLog).length).toBeGreaterThan(0) + await expect + .poll(() => { + const launches = readStubLaunches(claudeStub.launchLog) + return providerIds.every((id) => launches.some((args) => args.includes(id))) + }) + .toBe(true) for (const args of readStubLaunches(claudeStub.launchLog)) {
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8d3c52af-c60e-41bc-9037-eb96c6789e87
📒 Files selected for processing: 2
tests/e2e/fixtures/structured-claude-stub.cjstests/e2e/structured-chat-tabs-open-close.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
|
@coderabbitai Not adopting the per-session launch check. A chat session starts its Claude process when the first message is sent, and this test sends none. An earlier draft of this spec required each chat's provider id in the stub log and failed after 30 s with only |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
fd '^structured-chat-tabs-open-close\.spec\.ts$'
ast-grep outline tests/e2e/structured-chat-tabs-open-close.spec.ts --items all
sed -n '1,280p' tests/e2e/structured-chat-tabs-open-close.spec.tsLength of output: 11420
The spec sends no messages, so requiring a Claude process for each chat is not appropriate. I verified that it checks the stub’s exact path using Orca’s resolver with the main process’s PATH and HOME. It also checks that each recorded start is a version probe or includes one of the test chats’ provider IDs. These checks fit the tab lifecycle scope. No additional launch assertion is needed. ✏️ Learnings added
You are interacting with an AI system. |
ELI5
Adds an automated end-to-end test that opens chat tabs (the structured agent chat view), checks they appear in the tab bar, and closes them. It runs Orca against a tiny stand-in for the Claude command-line tool, and it proves the stand-in is the only Claude program Orca can start, so the test never runs a real Claude install on the machine.
What Changed
Test-only. No app code changes.
tests/e2e/structured-chat-tabs-open-close.spec.ts(new). In one hidden Orca run it:agentSession.create), and checks both tabs are visible in the tab bar;session.tabs.close), and checks each tab leaves the tab bar;tests/e2e/fixtures/structured-claude-stub.cjs(new). A small stand-in for Claude: answers--version, and answers the startup handshake of Claude's streaming JSON protocol if a session is started. Every time it starts, it appends its arguments to a log file the spec reads.How the stand-in is kept apart from a real Claude, route by route:
resolveStructuredAgentCommand); it never falls back to a lookup./usr/bin,/bin,/usr/sbinand/sbin. No user bin directory, Homebrew or npm prefix. The stand-in's wrapper calls node and the script by absolute path, so it needs nothing from PATH to run./etc/pathsand/etc/paths.dstill apply.~/.local/bin,~/.claude/local, nvm and other version managers, Homebrew,/usr/local/bin, snap, linuxbrew, nix). The home-relative ones resolve under the disposable HOME, which is empty. Before Orca launches, the spec runs Orca's own lookup (resolveCliCommand) over the system directories, the macOS/etc/pathsentries and the install-directory fallback. If that finds anyclaude, the test skips and Orca is never started.--versionprobe or a launch for one of this test's chats.Windows: skipped with a reason. The stand-in runs through a POSIX
shwrapper, a.cmdversion is unverified, and the full e2e suite runs on Linux CI only.Why
No e2e test covered chat tabs being opened by the host or the New tab menu and then closed. Unit tests of the tab store cannot catch a tab that the store holds but the tab bar never draws. Other e2e fakes prepend their directory to the inherited PATH. That is not enough here: Orca also looks in fixed install directories and in the login shell's PATH, and a real Claude in any of them could be the one that runs. So this spec narrows PATH, pins the absolute command, refuses to start Orca when a system-wide Claude is present, and checks Orca's own lookup result at the end.
Chat sessions start their Claude process when the first message is sent, and this test sends none. So the stand-in's log records Orca's version probe, which uses the same resolved command, and not a session launch. Sending a message would mean a much larger fake protocol, for behaviour this test is not about.
Linked Issue
N/A (maintainer, test-only).
Visual Proof
N/A: test-only change, no UI or behaviour change.
Testing
On macOS, all hidden (
ORCA_BACKGROUND_LAUNCH=1, isolated profile and HOME):Normal build (layout switch off,
VITE_EXPOSE_STORE=true pnpm exec electron-vite build --mode e2e && pnpm run build:cli):--repeat-each=5, 5/5 passed.Switch-on build (
ORCA_LAYOUT_OWNER=main, confirmed by its build marker file): 1/1 passed.pnpm tc,pnpm run check:code-quality:changed, oxlint on the changed files, and the anti-slop lint all pass.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Security: the test never runs a real Claude, and skips rather than start Orca when one could be reached. Cross-platform: macOS and Linux run it; Windows skips cleanly. SSH, mobile, backwards compatibility, performance: not affected (test-only).
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)