@evandu/super-pi 0.1.179 → 0.1.180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,5 +40,5 @@
40
40
  "src/client/types.ts": "34a933e47e37a8fab6b0b33a5e325d0e504cceada95e13b0a45a00c489767388",
41
41
  "src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5"
42
42
  },
43
- "recordedAt": "2026-11-09T22:56:51.284Z"
43
+ "recordedAt": "2026-11-10T00:15:53.811Z"
44
44
  }
@@ -1034,7 +1034,11 @@ export function createHttpServer(options) {
1034
1034
  restartEnv.SUPER_PI_HOST = host;
1035
1035
  const restartNow = () => {
1036
1036
  console.log("Super Pi: restart triggered.");
1037
- const restart = spawn(process.execPath, [join(rootDir, "scripts", "restart-server.mjs")], { cwd: rootDir, detached: true, stdio: "ignore", env: restartEnv });
1037
+ // INHERIT, NOT IGNORE. The restart script says what it did - which port it found, whether
1038
+ // it refused to kill a process, how long the new server took to come up. With stdio
1039
+ // "ignore" all of that went nowhere, so a failed restart left no trace anywhere and the
1040
+ // only symptom was a console that had quietly died.
1041
+ const restart = spawn(process.execPath, [join(rootDir, "scripts", "restart-server.mjs")], { cwd: rootDir, detached: true, stdio: "inherit", env: restartEnv });
1038
1042
  restart.on("error", (restartError) => console.error(`Super Pi: restart after update failed: ${restartError instanceof Error ? restartError.message : String(restartError)}`));
1039
1043
  restart.unref();
1040
1044
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evandu/super-pi",
3
- "version": "0.1.179",
3
+ "version": "0.1.180",
4
4
  "description": "Web control plane and companion for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,6 +45,7 @@
45
45
  "check:logic": [
46
46
  "scripts/update-args.test.mjs",
47
47
  "scripts/update-restart.test.mjs",
48
+ "scripts/update-restart-budget.test.mjs",
48
49
  "scripts/update-version-pinning.test.mjs",
49
50
  "scripts/test-runner.test.mjs",
50
51
  "scripts/stream-checkpoint.test.mjs",
@@ -79,5 +79,18 @@ const logPath = process.env.SUPER_PI_LOG ?? "restart-server.log";
79
79
  const logFd = openSync(logPath, "a");
80
80
  const child = spawn(process.execPath, [entry], { stdio: ["ignore", logFd, logFd], detached: true, env: process.env });
81
81
  child.unref();
82
- for (let elapsed = 0; elapsed < 10000; elapsed += 200) { try { const response = await fetch(`http://127.0.0.1:${port}/api/health`); const body = await response.json(); if (response.ok && body.status === "ok" && body.service === "super-pi") { console.log("Server ready: /api/health passed."); process.exit(0); } } catch {} await waitMs(200); }
83
- console.error(`Server failed readiness check. See ${logPath}:`); try { console.error(readFileSync(logPath, "utf8").slice(-8000)); } catch {} child.kill(); process.exit(1);
82
+ // HOW LONG THE NEW SERVER MAY TAKE TO BECOME REACHABLE.
83
+ //
84
+ // MEASURED 2026-11-10: right after `npm install` replaced the package, a COLD start took
85
+ // 17.1 seconds (the same server starts in ~1.2 seconds when the files are already in the page
86
+ // cache). The old budget was 10 seconds, so the script killed the new server WHILE IT WAS STILL
87
+ // STARTING - and the result was a console that was not merely stale but DEAD: the old process had
88
+ // already been shut down and the new one was killed before it ever listened.
89
+ //
90
+ // A slow start must never become a dead console. The budget is generous, and when it runs out
91
+ // the new server is LEFT RUNNING: a start that is merely slow will still come up, and a process
92
+ // that is stuck is worth more than no process at all.
93
+ const READINESS_BUDGET_MS = 120000;
94
+ for (let elapsed = 0; elapsed < READINESS_BUDGET_MS; elapsed += 200) { try { const response = await fetch(`http://127.0.0.1:${port}/api/health`); const body = await response.json(); if (response.ok && body.status === "ok" && body.service === "super-pi") { console.log("Server ready: /api/health passed."); process.exit(0); } } catch {} await waitMs(200); }
95
+ console.error(`Server did not become reachable within ${READINESS_BUDGET_MS}ms. It is STILL RUNNING - do not kill it, a slow start still ends up serving. See ${logPath}:`); try { console.error(readFileSync(logPath, "utf8").slice(-8000)); } catch {}
96
+ process.exit(1);