@quolu/lattice 0.12.31 → 0.12.33

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": "@quolu/lattice",
3
- "version": "0.12.31",
3
+ "version": "0.12.33",
4
4
  "description": "Lattice — phase-aware TODO graph compiler and conflict-aware orchestration runtime",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -272,7 +272,7 @@ export async function writeTodoDashboardDaemonDescriptor({ port, env = process.e
272
272
  }
273
273
 
274
274
  export async function ensureTodoDashboardDaemon({ env = process.env, spawnDaemon = spawn,
275
- signalProcess = process.kill, isProcessAlive = processIsAlive, startupTimeoutMs = 4_000,
275
+ signalProcess = process.kill, isProcessAlive = processIsAlive, startupTimeoutMs = 120_000,
276
276
  legacyStopTimeoutMs = 3_000, replacementIsProcessAlive = processIsAlive,
277
277
  attestationTimeoutMs = 2_000 } = {}) {
278
278
  const refs = paths(env);
@@ -299,11 +299,20 @@ export async function ensureTodoDashboardDaemon({ env = process.env, spawnDaemon
299
299
  env: { ...env, LATTICE_DASHBOARD_RUNTIME_DIR: refs.root, LATTICE_DASHBOARD_PORT: String(port) },
300
300
  });
301
301
  child.unref();
302
+ // 起動待ちの終わりを固定秒数で決めない。それは機械の速さの見積りになり、遅い側
303
+ // へ外すとpublish済みのcodeを載せたdaemonへ入れ替われず、公開面が古いまま取り
304
+ // 残される。daemonはdescriptorを書く前に登録済み全projectのstoreを読むので、
305
+ // 起動時間はproject数とstore規模に比例する(実測: 8 projectで約51秒)。
306
+ // 待つのはspawnした子が生きている間だけとし、死んだら即座に諦める。
307
+ // startupTimeoutMsは無反応な子に対するbackstopであって起動時間の上限ではない。
302
308
  const deadline = Date.now() + startupTimeoutMs;
303
309
  while (Date.now() < deadline) {
304
310
  await new Promise((resolve) => setTimeout(resolve, 50));
305
311
  const descriptor = await readJson(refs.descriptor, null);
306
- if (await daemonHealthy(descriptor) && descriptor.pid !== legacy?.pid) {
312
+ const healthy = await daemonHealthy(descriptor);
313
+ if (!healthy && typeof child.pid === 'number'
314
+ && !await replacementIsProcessAlive(child.pid)) break;
315
+ if (healthy && descriptor.pid !== legacy?.pid) {
307
316
  if (legacy !== null) {
308
317
  try {
309
318
  await stopAttestedLegacyDaemon(legacy, {
@@ -416,9 +416,15 @@ export function layoutTodoGantt(readModel, chainProjection, options = {}) {
416
416
  const layers = orderLayers(nodes, wave, incoming, outgoing);
417
417
  // A ToDo with no registered dependency has nothing to line up with. Laying
418
418
  // every one of them out in a single row makes the canvas as wide as the plan
419
- // is old — real stores have hundreds — so they wrap into a block underneath
420
- // the wired ToDos of their stage. Nodes that carry edges keep the top row:
421
- // edge routing assumes both endpoints of a stage share one baseline.
419
+ // is old — real stores have hundreds — so they wrap into a block of rows.
420
+ //
421
+ // That block goes ABOVE the wired ToDos of its stage. Below them it used to be
422
+ // pierced: a wired card's port descends from its own bottom edge to the routing
423
+ // band under the whole stage, straight through whatever independent card had
424
+ // wrapped into the same column, and the hidden half of that line read as a
425
+ // dependency the plan does not have. Independent ToDos carry no edge, so they
426
+ // have no incoming one either and always land in stage 0, which nothing ever
427
+ // arrives into — putting them on top leaves no line to cross them.
422
428
  const wired = new Set();
423
429
  for (const edge of edges) { wired.add(edge.from); wired.add(edge.to); }
424
430
  const transversePosition = new Map();
@@ -427,12 +433,15 @@ export function layoutTodoGantt(readModel, chainProjection, options = {}) {
427
433
  for (const layer of layers) {
428
434
  const connected = layer.filter((key) => wired.has(key));
429
435
  const loose = layer.filter((key) => !wired.has(key));
430
- connected.forEach((key, index) => { transversePosition.set(key, index); stageRow.set(key, 0); });
431
436
  const columns = Math.max(LOOSE_COLUMNS_MINIMUM, connected.length);
432
- const firstLooseRow = connected.length === 0 ? 0 : 1;
437
+ const looseRows = loose.length === 0 ? 0 : Math.ceil(loose.length / columns);
433
438
  loose.forEach((key, index) => {
434
439
  transversePosition.set(key, index % columns);
435
- stageRow.set(key, firstLooseRow + Math.floor(index / columns));
440
+ stageRow.set(key, Math.floor(index / columns));
441
+ });
442
+ connected.forEach((key, index) => {
443
+ transversePosition.set(key, index);
444
+ stageRow.set(key, looseRows);
436
445
  });
437
446
  stageRowCount.push(Math.max(0, ...layer.map((key) => stageRow.get(key))) + 1);
438
447
  }