Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

FIX: harden Claude test isolation in desktop tests - #63

Closed
aponamarev wants to merge 1 commit into
mainfrom
fix/setupStubClaude-for-tests
Closed

aponamarev wants to merge 1 commit into
mainfrom
fix/setupStubClaude-for-tests

Conversation

@aponamarev

Copy link
Copy Markdown
Contributor

Summary

Desktop unit tests that stub Claude were still able to resolve the real claude binary because getShellPath() rebuilt PATH from the login shell. That caused long-running or flaky tests (for example EVALUATE_CODE) and downstream failures when the harness shut down while a real process was still running. This PR pins shell path resolution to the stubbed PATH and tightens a few gateway and SSRF tests so they no longer depend on the developer’s real HOME or broad /tmp allowlists.

Key Changes

Core Feature:

  • setupStubClaude() now calls setShellPathForTest() after setting PATH, so symphony-style tests consistently use the fake claude shim instead of falling back to a real install.
  • Gateway plugin-discovery tests set HOME to an empty temp directory and assert pid === null, so a real ~/.claude/plugins/cache cannot spawn wrapper scripts during CI or local runs.
  • symphony-loop-ssrf tests use per-run mkdtemp allowlist roots, a synthetic repo full name that does not exist under that root, and cleanup of temp dirs—avoiding accidental matches against real checkouts under /tmp and unintended PLAN/run-loop behavior.

Supporting Changes:

  • Desktop package version bump to 0.9.10; minor prebuild script string normalization in package.json.

Branch: fix/setupStubClaude-for-tests | Ticket: FIX | Commits: 1

- isolate plugin-discovery tests from the developer HOME so they cannot spawn real cached wrappers
- lock setupStubClaude to the fake PATH so evaluate tests cannot resolve the real Claude CLI from a login shell
- tighten SSRF loop tests to use isolated allowlists and non-existent repos for deterministic early exits

Testing
- pnpm exec tsx --test test/symphony-loop-evaluate-code.test.ts test/symphony-loop-evaluate-plan.test.ts test/symphony-loop-ssrf.test.ts test/gateway-server.test.ts
- pnpm exec tsx --test test/*.test.ts

Risks
- plugin-discovery tests now intentionally assert the no-plugin-cache path and rely on separate fake-plugin tests for spawn coverage

Made-with: Cursor
@aponamarev
aponamarev requested review from a team, shafty023 and thadeusb March 31, 2026 14:08
@aponamarev aponamarev closed this Apr 1, 2026
@aponamarev
aponamarev deleted the fix/setupStubClaude-for-tests branch April 2, 2026 20:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant