You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 023e15e
Browse filesBrowse the repository at this point in the historyBrowse files
test(prepush): cut spawn cost in the focus and cap smoke rows
The stoppable-step row stopped after a fixed delay and ran a step with its own end, so a slow start let the step finish first; the stop now follows the step's started file and the step has no end of its own. The stopped-leg rows measured the tail from an instant recorded before the stub's own forks, so a slow fork counted against the hook; the stub reads the watchdog pid first and records the instant right before the signal, with a row that injects a slow fork. The cleanup process's deadline is read off the stamps it wrote on its own clock after its exit is awaited, not against a wall-clock bound. A hook ended by the spawn timeout now has its tree ended, so the sandbox is not held, and a row covers a cleanup process that never says it is up.
Each focus row paid for building its sandbox repo (init, add, commit, record) and two rows ran two decisions, so on a host where every spawn takes seconds they passed the 60 s limit. The first-commit sandbox is now built once per seed in a hook and copied, the origin ref is written as a file, and the two-decision rows are one row per decision with the same assertions.
// Registered after the removal above, so it runs first (stack order): the stopped step runs in dir and the cleanup process ends its tree just after the hook returns, so the directory is busy for a moment.
// Runs one bash script that sources the cap, then prints the status of cap_run_stoppable. The flag appears one second in; the child would run for 20 s if nothing ended it.
120
+
// Runs one bash script that sources the cap, then prints the status of cap_run_stoppable. The flag appears once the step has written step.started, if it does.
// The watchdog's pid is read first, so the instant recorded is followed only by builtins up to the signal: a slow fork in the stub is not part of the hook's tail.
267
+
// STUB_FORK_DELAY stands in for a fork that takes that many seconds on an overloaded host.
// The cleanup process cds to / and holds no file here, so a lingering one is invisible to the removal below: its exit is awaited by pid and a row whose cleanup process outlives its deadline fails.
299
+
// The cleanup process cds to / and holds no file here, so a lingering one is invisible to the removal below: its exit is awaited by pid as an event (the row's hang guard bounds the wait, not its verdict), and the grace is read off the stamps it wrote on its own clock, so host load moves neither.
expect(reaperGone,`the cleanup process ${reaper} outlived its deadline, past the end of the row`).toBe(true)
306
+
expect(reaperGone,`the cleanup process ${reaper} never exited`).toBe(true)
307
+
if(gone!==null&&exited!==null)expect(exited-gone,`the cleanup process outlived its deadline, past the end of the row\n${recorded}`).toBeLessThanOrEqual(REAP_GRACE_S)
299
308
// A row whose cleanup ended the runner shows up as a vitest run that exits 0 with no summary; this names the row instead, while the worker still lives to say so.
300
309
expect(runnerAlive(),`the vitest runner (pid ${process.ppid}) was ended during this row`).toBe(true)
301
310
})
@@ -307,7 +316,7 @@ describe('the hard stop ends the legs of a real hook run', () => {
@@ -326,10 +335,13 @@ describe('the hard stop ends the legs of a real hook run', () => {
326
335
// Output goes to a file, not a pipe: spawnSync on a pipe waits for every process that inherited it, so a stray survivor would turn the hook's own return time into a timeout; the file measures the hook's own exit.
// With no fired.epoch the tail is unknown: lead the output with that and the stubs listing, so a failing row shows what the stubs did; prepended so the legs line stays last.
@@ -361,6 +373,33 @@ describe('the hard stop ends the legs of a real hook run', () => {
361
373
expect(pushLines[pushLines.length-1],r.out).toContain('exited before it started')
362
374
})
363
375
376
+
// A cleanup process that is alive but slow to say it is up (an overloaded host) is the start-up the hard stop bounds: no leg starts, the push fails by name, and the hook returns within the stop plus its tail.
377
+
hookRow('a cleanup process that never says it is up fails the push at the hard stop with no leg started',()=>{
expect(stubGone,`the slow cleanup process ${stub} outlived the hook`).toBe(true)
386
+
expect(r.timedOut,r.out).toBe(false)
387
+
expect(r.status,r.out).toBe(1)
388
+
expect(r.out).toContain('the cleanup process was not up by the 8s hard-stop budget')
389
+
expect(readdirSync(stubs),'a leg started although nothing could end it').toEqual([])
390
+
})
391
+
392
+
// A hook still starting when the spawn timeout ends it leaves its tree behind; the row ends that tree, so the directory can be removed and nothing outlives the row.
393
+
hookRow('a hook the spawn timeout ended leaves no process holding its directory',()=>{
@@ -691,6 +748,15 @@ describe('the cleanup of recorded stub pids', () => {
691
748
})
692
749
693
750
// Ends the process tree of each pid a test recorded in a pid file. A pid is ended only while its command line, read right now, is a bash that names the row's own temp directory (`owner`): a bash alone is not proof, since Windows hands a freed pid to the next process it starts and a recorded winpid goes stale when a forked bash execs, so a recorded pid can now be an unrelated session's bash. The tree goes with it, since a plain kill leaves the children behind on Windows.
751
+
// A hook run the spawn timeout ended lost only its top bash: every process still naming the row's unique directory in its command line is the row's own, and holds the directory (EPERM on removal). Windows only; elsewhere the process group ends with the spawn.
0 commit comments