fix: isolate E2E tests from production telemetry

E2E test runner now sets GSTACK_STATE_DIR to a temp directory so
skill preamble telemetry goes to /tmp/ instead of ~/.gstack/. Prevents
test runs from polluting production Supabase with fake crash events
(was causing 252 spurious "timeout" crashes from a single test session).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-20 08:20:40 -07:00
parent a961a8a394
commit d87e8fb7ef
+6
View File
@@ -155,10 +155,16 @@ export async function runSkillTest(options: {
const promptFile = path.join(workingDirectory, '.prompt-tmp');
fs.writeFileSync(promptFile, prompt);
// Isolate telemetry: E2E tests use a temp state dir so they don't pollute
// production telemetry with test events (e.g. fake timeout crashes).
const testStateDir = path.join(os.tmpdir(), `gstack-e2e-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`);
fs.mkdirSync(testStateDir, { recursive: true });
const proc = Bun.spawn(['sh', '-c', `cat "${promptFile}" | claude ${args.map(a => `"${a}"`).join(' ')}`], {
cwd: workingDirectory,
stdout: 'pipe',
stderr: 'pipe',
env: { ...process.env, GSTACK_STATE_DIR: testStateDir },
});
// Race against timeout