fix(stats): skipped sync worker smoke on darwin
smokeTestSyncWorker spawned a worker via createSyncWorker on every platform, so omp --smoke-test (and the macOS signing pre-launch run in scripts/ci-macos-sign.sh) still hit the Bun-worker re-entry path the serial macOS sync default avoids. Early-return on darwin and document the carve-out. Fixes #3733
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
- Kept stats session sync on the serial parser path for `workers: 1` and macOS defaults, avoiding Bun worker re-entry aborts when launching `/stats` ([#3733](https://github.com/can1357/oh-my-pi/issues/3733)).
|
||||
- Replaced the native `Bun.JSONL.parseChunk` session parser path with a lenient JS line scanner, avoiding Bun aborts on large stats session files ([#3733](https://github.com/can1357/oh-my-pi/issues/3733)).
|
||||
- Skipped the stats sync worker smoke probe on darwin so `omp --smoke-test` (and the macOS signing/notarization pre-launch run) no longer re-enters the Bun-worker abort surface the serial macOS sync now avoids ([#3733](https://github.com/can1357/oh-my-pi/issues/3733)).
|
||||
|
||||
## [16.2.3] - 2026-06-28
|
||||
|
||||
|
||||
@@ -152,10 +152,16 @@ function dispatch(handle: WorkerHandle, request: SyncWorkerRequest): Promise<Par
|
||||
* spawn path on a fresh install (no session files = early return), so a
|
||||
* dedicated probe is the only reliable signal.
|
||||
*
|
||||
* Resolves with the worker's `import.meta.url` (caller-visible diagnostics);
|
||||
* rejects on transport error, error response, or timeout.
|
||||
* No-op on darwin: `syncAllSessions` keeps macOS on the serial parser path
|
||||
* (see {@link defaultWorkerCount}) so the worker spawn surface is unreachable
|
||||
* from the CLI, and probing it under the hardened runtime in
|
||||
* `scripts/ci-macos-sign.sh` would re-enter the Bun-worker abort surface that
|
||||
* motivated the darwin serial default in the first place.
|
||||
*
|
||||
* Rejects on transport error, error response, or timeout.
|
||||
*/
|
||||
export async function smokeTestSyncWorker({ timeoutMs = 5_000 }: { timeoutMs?: number } = {}): Promise<void> {
|
||||
if (process.platform === "darwin") return;
|
||||
const worker = createSyncWorker();
|
||||
const { promise, resolve, reject } = Promise.withResolvers<void>();
|
||||
const timer = setTimeout(() => reject(new Error(`sync worker did not pong within ${timeoutMs}ms`)), timeoutMs);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { afterEach, describe, expect, it, vi } from "bun:test";
|
||||
import { smokeTestSyncWorker } from "@oh-my-pi/omp-stats/aggregator";
|
||||
import { installStatsTestIsolation } from "./helpers/temp-agent";
|
||||
|
||||
installStatsTestIsolation("@pi-stats-smoke-darwin-");
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe("smokeTestSyncWorker", () => {
|
||||
it("skips the worker spawn on darwin so omp --smoke-test stays off the macOS abort surface", async () => {
|
||||
vi.spyOn(process, "platform", "get").mockReturnValue("darwin");
|
||||
const workerSpy = vi.spyOn(globalThis, "Worker").mockImplementation(() => {
|
||||
throw new Error("worker should not be created on darwin");
|
||||
});
|
||||
|
||||
await expect(smokeTestSyncWorker()).resolves.toBeUndefined();
|
||||
expect(workerSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user