fix(review): apply autofix feedback
This commit is contained in:
@@ -124,7 +124,7 @@ test("shouldForceFullSuite: returns true when scripts/check-test-isolation.mjs c
|
||||
});
|
||||
|
||||
test("shouldForceFullSuite: returns true when a GitHub workflow changed", () => {
|
||||
assert.equal(shouldForceFullSuite([".github/workflows/ci.yml"]), true);
|
||||
assert.equal(shouldForceFullSuite([".github/workflows/pr-checks.yml"]), true);
|
||||
});
|
||||
|
||||
test("shouldForceFullSuite: returns false for .changeset/*.md summary files", () => {
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
* (port-4040-allowlist: this file only ever AVOIDS the reserved ports — it
|
||||
* requests an ephemeral port and rejects reserved ones; it never binds,
|
||||
* probes, or kills them.)
|
||||
* (process-supervisor-allowlist: raw spawn is intentional here — this is a
|
||||
* standalone repo script outside the package graph, the child is attached
|
||||
* (not detached), and lifecycle is bounded by the timeouts + signal handlers
|
||||
* below; importing superviseSpawn from @fusion/core would invert the
|
||||
* dependency direction for a build-time smoke check.)
|
||||
* - Never binds or touches port 4040 / FUSION_RESERVED_PORTS — an ephemeral
|
||||
* port is requested from the OS (listen on 0) and double-checked against
|
||||
* the reserved list.
|
||||
@@ -128,10 +133,26 @@ async function main() {
|
||||
child.stdout.on("data", (d) => (stderrBuf += d));
|
||||
|
||||
const cleanup = () => {
|
||||
if (child.exitCode === null && !child.killed) child.kill("SIGTERM");
|
||||
// 'exit' handlers cannot await: escalate straight to SIGKILL so a child
|
||||
// that ignores SIGTERM is never orphaned holding the port/tmpdir. The
|
||||
// graceful SIGTERM path below runs before this on the success path.
|
||||
try {
|
||||
if (child.exitCode === null && !child.killed) child.kill("SIGKILL");
|
||||
} catch {
|
||||
// ESRCH: child already reaped between the check and the kill — fine.
|
||||
}
|
||||
rmSync(isolatedHome, { recursive: true, force: true });
|
||||
};
|
||||
process.on("exit", cleanup);
|
||||
// Node does NOT fire 'exit' on signals by default. A cancelled CI job
|
||||
// (timeout, manual cancel, runner eviction) sends SIGTERM — without these
|
||||
// handlers the serve child would be orphaned.
|
||||
for (const sig of ["SIGTERM", "SIGINT"]) {
|
||||
process.on(sig, () => {
|
||||
cleanup();
|
||||
process.exit(sig === "SIGINT" ? 130 : 143);
|
||||
});
|
||||
}
|
||||
|
||||
const exitedEarly = new Promise((resolve) => {
|
||||
child.once("exit", (code, signal) => resolve({ code, signal }));
|
||||
@@ -150,7 +171,12 @@ async function main() {
|
||||
console.log(`boot-smoke: GET /api/health 200 on :${port}`);
|
||||
|
||||
// 3. Clean shutdown of OUR child only.
|
||||
child.kill("SIGTERM");
|
||||
try {
|
||||
child.kill("SIGTERM");
|
||||
} catch {
|
||||
// ESRCH: server exited between the health check and the kill — the
|
||||
// exitedEarly promise below already carries its exit code.
|
||||
}
|
||||
const { code, signal } = await Promise.race([
|
||||
exitedEarly,
|
||||
new Promise((resolve) =>
|
||||
|
||||
@@ -1158,6 +1158,12 @@ export function main(argv = process.argv.slice(2)) {
|
||||
// Cache-fresh fast path: nothing to run. Emit a fast-path mode line, run only
|
||||
// the (now cheap) isolation guard, and skip skill-sync, artifact-ensure,
|
||||
// HOME creation, and prune.
|
||||
//
|
||||
// NOTE: this path is reachable only in CHANGED mode (gate mode sets hasWork
|
||||
// above), and it intentionally skips the merge-gate suite too: an all-cache-
|
||||
// fresh changed run means the engine/cli content feeding the gate suite is
|
||||
// byte-identical to a previously green run. Any shared-infra change that
|
||||
// could invalidate that reasoning routes to gate mode instead of here.
|
||||
if (!hasWork) {
|
||||
console.log("[test-changed] fast-path=cache-fresh (no packages to run).");
|
||||
console.log(
|
||||
|
||||
Reference in New Issue
Block a user