mixdog 0.9.78 → 0.9.79

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixdog",
3
- "version": "0.9.78",
3
+ "version": "0.9.79",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone mixdog coding-agent CLI/TUI workspace.",
@@ -74,8 +74,8 @@
74
74
  "test:grok-oauth-race": "node --test scripts/grok-oauth-refresh-race-test.mjs",
75
75
  "test:atomiclock": "node --test scripts/atomic-lock-tryonce-test.mjs",
76
76
  "test:memory-routing": "node --test scripts/memory-cycle-routing-test.mjs scripts/maintenance-default-routes-test.mjs scripts/embedding-worker-exit-test.mjs scripts/embedding-runtime-prune-test.mjs",
77
- "test:embedding-runtime": "node --test scripts/embedding-runtime-prune-test.mjs && node scripts/verify-embedding-runtime.mjs",
78
- "test:embedding-runtime:core": "node --test scripts/embedding-runtime-prune-test.mjs && node scripts/verify-embedding-runtime.mjs --core",
77
+ "test:embedding-runtime": "node --test scripts/embedding-runtime-prune-test.mjs scripts/memory-pg-recovery-test.mjs && node scripts/verify-embedding-runtime.mjs",
78
+ "test:embedding-runtime:core": "node --test scripts/embedding-runtime-prune-test.mjs scripts/memory-pg-recovery-test.mjs && node scripts/verify-embedding-runtime.mjs --core",
79
79
  "test:embedding-runtime:warmup": "node scripts/verify-embedding-runtime.mjs --warmup",
80
80
  "test:code-graph-dispatch": "node --test scripts/code-graph-dispatch-test.mjs",
81
81
  "test:code-graph-clean-cache": "node --test scripts/code-graph-dispatch-test.mjs",
@@ -77,18 +77,11 @@ function readPostmasterInfo(pgdataDir) {
77
77
  }
78
78
  }
79
79
 
80
- function pgIsReady(runtimeDir, env, port) {
81
- const probe = spawnSync(pgBin(runtimeDir, 'pg_isready'), ['-h', '127.0.0.1', '-p', String(port)], {
82
- env, stdio: 'pipe', timeout: 3_000, windowsHide: true,
83
- })
84
- return probe.status === 0
85
- }
86
-
87
80
  async function awaitExistingPostmaster({ runtimeDir, pgdataDir, env, waitMs }) {
88
81
  const deadline = Date.now() + Math.max(0, Number(waitMs) || 0)
89
82
  let info = readPostmasterInfo(pgdataDir)
90
83
  while (info.pid && info.port) {
91
- if (pgIsReady(runtimeDir, env, info.port)) return { state: 'ready', ...info }
84
+ if (await healthcheckPg({ port: info.port })) return { state: 'ready', ...info }
92
85
  if (!isPidAlive(info.pid)) return { state: 'dead', ...info }
93
86
  if (Date.now() >= deadline) return { state: 'alive-not-ready', ...info }
94
87
  await delay(250)
@@ -185,10 +178,6 @@ export async function startPg({
185
178
  }) {
186
179
  mkdirSync(pgdataDir, { recursive: true })
187
180
 
188
- if (process.platform === 'darwin') {
189
- try { writeFileSync(join(pgdataDir, '.metadata_never_index'), '') } catch {}
190
- }
191
-
192
181
  // Idempotent v2 conf reconcile — runs before attach/init. Returns true if
193
182
  // the block was just appended (so the attach path can trigger pg_ctl reload).
194
183
  // Fresh-init path falls through to confAppend below which already includes v2.
@@ -282,6 +271,12 @@ export async function startPg({
282
271
  )
283
272
  }
284
273
  }
274
+ // PostgreSQL requires a completely empty target on first init. Creating the
275
+ // Spotlight marker before initdb makes every fresh macOS cluster fail with
276
+ // "directory exists but is not empty"; add it only after initialization.
277
+ if (process.platform === 'darwin') {
278
+ try { writeFileSync(join(pgdataDir, '.metadata_never_index'), '') } catch {}
279
+ }
285
280
 
286
281
  // Choose a free port (guards against stale postmaster from prior crash).
287
282
  const port = await findFreePort(preferredPort)
@@ -350,7 +345,7 @@ export async function startPg({
350
345
  const deadline = Date.now() + 30_000
351
346
  // eslint-disable-next-line no-constant-condition
352
347
  while (true) {
353
- if (pgIsReady(runtimeDir, env, port)) {
348
+ if (await healthcheckPg({ port })) {
354
349
  const pid = await confirmPid()
355
350
  // pid confirmed with matching port → ready. Otherwise keep polling until
356
351
  // the cap (postmaster.pid not yet written or port mismatch).