mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-06 05:35:46 +02:00
5765bef8fe
Adds browse/test/fixtures/mock-claude/claude — an executable bun script
that parses the --prompt flag, extracts the session canary via regex,
and emits stream-json NDJSON events that exercise specific sidebar-agent
code paths.
Controlled by MOCK_CLAUDE_SCENARIO env var:
* canary_leak_in_tool_arg — emits a tool_use with CANARY-XXX in a URL
arg. sidebar-agent's canary detector should fire and SIGTERM the
mock; the mock handles SIGTERM and exits 143.
* clean — emits benign tool_use + text response.
Used by security-e2e-fullstack.test.ts. PATH-prepended during the test so
the real sidebar-agent's spawn('claude', ...) picks up the mock without
any source change to sidebar-agent.ts.
Zero LLM cost, fully deterministic, <1s per scenario. Enables gate-tier
full-stack E2E testing of the security pipeline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>