Skip to content

Commit 9da45e2

Browse files
committed
fix: address review — clear auth env vars in CI, isolate sidecar import
- Add explicit SENTRY_AUTH_TOKEN="" and SENTRY_TOKEN="" env overrides to CI smoke test steps to prevent future env leakage on main/release branches where production secrets are available. - Move Ink sidecar import test to a subprocess via spawnCollect to avoid polluting the vitest process with React/Ink globals from the sidecar's bundled dependencies.
1 parent 24dd079 commit 9da45e2

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ jobs:
312312
- name: Smoke test (deep — SQLite, telemetry, auth DB)
313313
if: matrix.can-test
314314
shell: bash
315+
env:
316+
SENTRY_AUTH_TOKEN: ""
317+
SENTRY_TOKEN: ""
315318
run: |
316319
if [[ "${{ matrix.target }}" == "windows-x64" ]]; then
317320
BIN=./dist-bin/sentry-windows-x64.exe
@@ -735,6 +738,9 @@ jobs:
735738
run: node dist/bin.cjs --help
736739
- name: Smoke test (Node.js — deep)
737740
shell: bash
741+
env:
742+
SENTRY_AUTH_TOKEN: ""
743+
SENTRY_TOKEN: ""
738744
run: |
739745
# auth status without a token exercises SQLite init, schema
740746
# migrations, telemetry lazy import, and the CJS require chain.

test/e2e/bundle.test.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { spawn } from "node:child_process";
99
import { existsSync, rmSync } from "node:fs";
1010
import { readFile } from "node:fs/promises";
1111
import { join } from "node:path";
12-
import { pathToFileURL } from "node:url";
1312
import { afterAll, beforeAll, describe, expect, test } from "vitest";
1413

1514
function noop(): void {
@@ -214,11 +213,27 @@ describe("npm bundle", () => {
214213
// by Node, and exports mountApp as a function. This catches sidecar
215214
// bundling/resolution bugs — the exact class of bug where `with { type: "file" }`
216215
// crashed in tsx dev mode.
216+
//
217+
// Run in a subprocess to avoid polluting the vitest process with
218+
// React/Ink globals from the sidecar's bundled dependencies.
217219
expect(existsSync(INK_APP_PATH)).toBe(true);
218220

219-
// Node requires a file:// URL for dynamic import of absolute ESM paths
220-
const sidecar = await import(pathToFileURL(INK_APP_PATH).href);
221-
222-
expect(typeof sidecar.mountApp).toBe("function");
221+
const { stdout, stderr, exitCode } = await spawnCollect("node", [
222+
"--input-type=module",
223+
"-e",
224+
`import { mountApp } from ${JSON.stringify(`file://${INK_APP_PATH}`)};\n` +
225+
'if (typeof mountApp !== "function") {\n' +
226+
' process.stderr.write("mountApp is " + typeof mountApp + ", expected function");\n' +
227+
" process.exit(1);\n" +
228+
"}",
229+
]);
230+
231+
if (exitCode !== 0) {
232+
const output = stdout + stderr;
233+
throw new Error(
234+
`Ink sidecar import failed (exit ${exitCode}): ${output}`
235+
);
236+
}
237+
expect(exitCode).toBe(0);
223238
}, 15_000);
224239
});

0 commit comments

Comments
 (0)