Repository navigation
test(claude): isolate real CLI fixtures and cover chat option requests - #31201
Conversation
…urrent model aliases Model ids come from the CLI's own model list instead of dated ids, tests that need a SessionStart hook or an effort bring their own project settings, and the supervised-stop test launches and reads its transcript under one Claude home, as acquisition does.
…on pickers and the context meter Drives the live CLI through the production send path (model list, set model, apply effort, read settings), checks the turn's context report, and relaunches into a new permission mode the way Orca changes it. CI only meets these requests through stand-ins.
Since #30561 a Claude send resolves with the options it ran under; the stop test only needs the send admitted, and the options flow checks the ran options are exactly the per-message pick.
c1da8d6 to
07576e1
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
|
The opt-in tests against real Claude had drifted: some required the developer’s hooks and effort setting, and supervised-stop launched Claude under a different home from the one searched for its transcript. This PR gives those tests their own required settings, uses one selected Claude home for launch and transcript lookup, and adds a two-turn contract test for model, effort, context usage and permission-mode resume. App behavior is unchanged; all four changed files are tests, including a renderer test reflow during the main merge whose 4,250 tokens and syntax tree were verified identical. The full review included an independent correctness reviewer, architecture challenger and dedicated resource scan, followed by a scoped review of the final main merge and test-assertion update. No proven code defects required fixes. The final-head delta review found no new defects. The final private reference table records each checked value’s source and whether it can gate a user action; this PR adds test assertions and no shipped action gate. The review corrected the PR’s initial light-path classification because recent commits already fixed the same test mechanisms, and narrowed claims about isolation and coverage. Verified on Deferred limits: the runner isolates the selected Claude configuration root rather than the entire filesystem, and its transcript-leak search checks matching run folders. The external runner now propagates Vitest failure status; the raw results were also inspected. The resume test checks the same session id, saved picks and a successful reply; it does not prove conversational recall or exercise the rendered picker. A near-timeout slow provider can exceed the overall test timeout before its individual waits expire; no lingering process or introduced app resource regression was demonstrated. Windows/Linux/SSH live runs and other CLI/account combinations were not exercised. App QA and screenshots are skipped ( For Brennan’s review: no app screenshots apply. The three useful inspection points are the temporary hook settings, shared launch home, and resume contract. |
…eal-cli-suite # Conflicts: # src/main/claude/claude-structured-real-cli.test.ts
ELI5
Orca's Claude chats talk to the user's own
claudeprogram. CI checks that conversation only against a fakeclaudethat replays recorded answers, so it can't tell when a realclaude, or a new version of the library Orca uses to talk to it, behaves differently. The repo has a second set of tests that drive the realclaude(opt-in withORCA_REAL_CLAUDE_CLI_TEST=1; CI skips them). They had drifted. On a realclaude2.1.302, signed in with a throwaway Claude home, these failed for reasons that had nothing to do with Orca:~/.claude, ran their real hooks, and then the test timed out looking in the wrong place. The stops themselves worked.main: since A chat's model, effort and Fast belong to the chat, not to a model #30561, a send also reports the options it ran with, and the stop test compared the whole result exactly.(Two more failed on stale model ids;
mainfixed those in #30561 and #30853 while this was being written.)Several requests behind the chat pickers also had no real-
claudetest at all: model and effort per message, the model list, the context meter, and changing permission mode. CI meets them only through stand-ins.This removes those fixture dependencies and adds one live test for the option requests behind those pickers. The isolated runner verified the suite on Claude 2.1.302 with the current SDK; it does not prove every account, CLI version or host configuration. This provides coverage for checking Claude SDK updates (the next one is tracked in #30814).
What changed for users
Nothing. Tests only; no app code changes.
What changed
effortLevel: lowthere and checks for exactlylow. The adopted-model test also checks that Orca marks the model as confirmed.realClaudeLaunchHome()plus the config-dir pin), so launch and lookup use the same selected Claude home. With the isolated runner, that is the throwaway home; without an explicit config directory, the existing opt-in contract still uses the default Claude home.src/renderer/src/components/terminal-pane/pty-connection-split-spawn.spec.ts; that change is formatting only.claude-structured-real-cli-options.test.ts, one flow over two short turns:haikuandsonnetrows with resolved ids, and Orca's model picker lists them.haikureports no model; the saved chat options still recordhaiku). Its turn reports the resolved model, no message carries an effort field, and Orca shows both as confirmed.acceptEditson the same conversation and model, and the effort survives.Why
The fixtures now supply the hook and effort they require, and transcript lookup follows the home selected for launch. One flow test covers the adapter option requests end to end in two short turns; it does not exercise the rendered picker or prove conversational recall after resume.
Plan
Keep the changes in tests: give hook-dependent tests their own temporary project settings, use the same selected Claude home for launch and transcript lookup, and exercise the chat option requests through one live two-turn flow. No app code, saved user settings or defaults change.
Review path: full
qa=none; app QA and screenshots do not apply.Linked Issue
N/A: groundwork for checking Claude SDK updates (the next one is tracked in #30814).
Visual Proof
N/A: tests only, no UI.
Testing
Real
claude2.1.302 through the team load balancer, with a throwaway Claude home (CLAUDE_CONFIG_DIR) and the calling session's own Claude environment variables cleared, on head07576e1c779in an independent review run admitted byqa-gate:~/.claude/settings.jsonwas unchanged, and the runner found no transcript folder matching this isolated run in the real~/.claude/projects. This verifies the configured Claude root, rather than a full filesystem sandbox.Before this change, on the same machine: 11 of 19 passed, and the same 8 failed on SDK 0.3.284 and 0.3.302 alike.
AI Disclosure
Written with Claude.
Agent skill upstream boundary
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)