mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-11 15:39:04 +02:00
fix: sweep — every sync spawn in the test trees carries a timeout (436 sites, 157 files)
spawnSync/execSync/Bun.spawnSync BLOCK the main thread, so bun's in-process per-test timeout can never fire while one waits — a hung child (stdin read, network probe, dead daemon) wedges the whole shard until the runner's external wall-clock SIGKILL. This exact class reached main: free-tests run 33262077256, test/gstack-memory-ingest.test.ts (normally 2.3s) held shard 2 at the 360s wall while its five siblings finished in ~65s. Mechanical sweep in two waves (12 + 4 fan-out agents, every edit verified against its call site): default timeout: 30_000 (matches the free runner's per-test budget), 120_000 for genuinely slow ops (installs, builds, playwright, provider CLIs), helper wrappers fixed ONCE where call sites route through them. Sites that only LOOK like calls (string fixtures, grep needles, comments) were skipped with reasons — the enforcement commit that follows marks them exempt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
79efe395dc
commit
3e674e4c01
@@ -612,6 +612,7 @@ class AppState {
|
||||
'--output', outputDir,
|
||||
], {
|
||||
encoding: 'utf8',
|
||||
timeout: 30_000,
|
||||
env: { ...process.env, GSTACK_IOS_CACHE_ROOT: join(workDir, 'cache') },
|
||||
});
|
||||
expect(result.status).toBe(4);
|
||||
@@ -717,7 +718,7 @@ describe('render', () => {
|
||||
});
|
||||
|
||||
test('typechecks beside an internal @Observable app state using a comment marker', () => {
|
||||
if (spawnSync('swiftc', ['--version'], { encoding: 'utf8' }).status !== 0) return;
|
||||
if (spawnSync('swiftc', ['--version'], { encoding: 'utf8', timeout: 30_000 }).status !== 0) return;
|
||||
|
||||
const coreSource = join(workDir, 'DebugBridgeCore.swift');
|
||||
const coreModule = join(workDir, 'DebugBridgeCore.swiftmodule');
|
||||
@@ -752,7 +753,7 @@ public final class StateServer {
|
||||
'-module-name', 'DebugBridgeCore',
|
||||
coreSource,
|
||||
'-emit-module-path', coreModule,
|
||||
], { encoding: 'utf8' });
|
||||
], { encoding: 'utf8', timeout: 120_000 });
|
||||
if (emitModule.status !== 0) {
|
||||
throw new Error(`failed to build DebugBridgeCore test stub:\n${emitModule.stderr}`);
|
||||
}
|
||||
@@ -775,7 +776,7 @@ ${render([{
|
||||
'-D', 'DEBUG',
|
||||
'-I', workDir,
|
||||
appSource,
|
||||
], { encoding: 'utf8' });
|
||||
], { encoding: 'utf8', timeout: 120_000 });
|
||||
if (typecheck.status !== 0) {
|
||||
throw new Error(`generated accessor failed Swift type checking:\n${typecheck.stderr}`);
|
||||
}
|
||||
@@ -783,7 +784,7 @@ ${render([{
|
||||
|
||||
test('strict JSON typing and cross-model validate-before-apply restore run correctly', () => {
|
||||
if (process.platform !== 'darwin') return;
|
||||
if (spawnSync('swiftc', ['--version'], { encoding: 'utf8' }).status !== 0) return;
|
||||
if (spawnSync('swiftc', ['--version'], { encoding: 'utf8', timeout: 30_000 }).status !== 0) return;
|
||||
|
||||
const coreSource = join(workDir, 'DebugBridgeCore.swift');
|
||||
const coreModule = join(workDir, 'DebugBridgeCore.swiftmodule');
|
||||
@@ -830,7 +831,7 @@ public final class StateServer {
|
||||
'-module-name', 'DebugBridgeCore', coreSource,
|
||||
'-emit-module-path', coreModule,
|
||||
'-o', coreLibrary,
|
||||
], { encoding: 'utf8' });
|
||||
], { encoding: 'utf8', timeout: 120_000 });
|
||||
if (emitCore.status !== 0) throw new Error(`failed to build runtime stub:\n${emitCore.stderr}`);
|
||||
|
||||
const appSource = join(workDir, 'OptionalRoundTrip.swift');
|
||||
@@ -915,10 +916,11 @@ struct Runner {
|
||||
const compile = spawnSync('swiftc', [
|
||||
'-D', 'DEBUG', '-I', workDir, '-L', workDir, '-lDebugBridgeCore',
|
||||
'-parse-as-library', appSource, '-o', executable,
|
||||
], { encoding: 'utf8' });
|
||||
], { encoding: 'utf8', timeout: 120_000 });
|
||||
if (compile.status !== 0) throw new Error(`generated Optional accessor failed compilation:\n${compile.stderr}`);
|
||||
const run = spawnSync(executable, [], {
|
||||
encoding: 'utf8',
|
||||
timeout: 30_000,
|
||||
env: { ...process.env, DYLD_LIBRARY_PATH: workDir },
|
||||
});
|
||||
if (run.status !== 0) throw new Error(`generated Optional accessor failed at runtime:\n${run.stderr}`);
|
||||
@@ -928,7 +930,7 @@ struct Runner {
|
||||
describe('SwiftSyntax generator parity', () => {
|
||||
test('isolates canonical markers and rejects inaccessible fields', () => {
|
||||
if (process.platform !== 'darwin') return;
|
||||
if (spawnSync('swift', ['--version'], { encoding: 'utf8' }).status !== 0) return;
|
||||
if (spawnSync('swift', ['--version'], { encoding: 'utf8', timeout: 30_000 }).status !== 0) return;
|
||||
|
||||
const packageDir = join(import.meta.dir, 'gen-accessors-tool');
|
||||
const inputDir = join(workDir, 'swift-syntax-input');
|
||||
|
||||
@@ -739,7 +739,7 @@ export function render(specs: AccessorSpec[], buildId: string, accessorHash: str
|
||||
function detectSwiftVersion(): string {
|
||||
if (process.env.SWIFT_VERSION) return process.env.SWIFT_VERSION;
|
||||
try {
|
||||
const out = execSync('swift --version', { stdio: ['ignore', 'pipe', 'ignore'] }).toString();
|
||||
const out = execSync('swift --version', { stdio: ['ignore', 'pipe', 'ignore'], timeout: 30_000 }).toString();
|
||||
const m = out.match(/Apple Swift version (\d+\.\d+\.\d+)/);
|
||||
if (m) return m[1]!;
|
||||
} catch {
|
||||
@@ -754,6 +754,7 @@ function detectToolGitRev(): string {
|
||||
return execSync('git rev-parse --short HEAD', {
|
||||
cwd: dirname(new URL(import.meta.url).pathname),
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
timeout: 30_000,
|
||||
}).toString().trim();
|
||||
} catch {
|
||||
return 'dev';
|
||||
|
||||
Reference in New Issue
Block a user