@rightkit/release 0.6.61 → 0.6.63

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.
@@ -74,6 +74,8 @@
74
74
  import fs from "node:fs";
75
75
  import { createHash, randomUUID } from "node:crypto";
76
76
  import { openClassAHistory, openClassBHistory } from "../class-a-cache-history.mjs";
77
+ /** One line, once, when the gate set an unusable cache aside and started an empty one in the same place (class-a-cache-history.mjs). */
78
+ const cacheRestartNote = (o) => ({ store, reason, storeAside }) => (o.out ?? console.log)(`rightkit-gate: cache restarted: ${store} could not be used (${reason}); ${storeAside ? `the old one is kept at ${storeAside}` : "there was no old store to keep"}; every row is checked once more and stored here`);
77
79
  import { writeFileAtomic } from "../atomic-write.mjs";
78
80
  import { envNamed, gateRunsRoot, resolveManagedRoots } from "../managed-roots.mjs";
79
81
  import { resolveBrokerClient, spawnBrokerClient } from "../broker-client.mjs";
@@ -3451,12 +3453,12 @@ async function runUnionSnapshot({ o, io, root, git, ds, union, unitListClassA })
3451
3453
  if (!await openSnapshotStage({ o, ds, root, stage: "compile", tag })) return 1;
3452
3454
  let code = 1;
3453
3455
  // Crates build together (docs/design/2026-11-10-gate-fresh-design.md; Adrian, 2026-11-04: "RK has to build all it's necessary crates together"): a list of crates on a
3454
- // broker host is compiled by gate/compile.mjs as a few Cargo calls naming every crate, each crate with its own result. RK_GATE_LEGACY_ROWS=1 keeps the per-crate rows
3455
- // until the proof runs pass on both hosts; the legacy branch and that switch are then deleted together.
3456
+ // broker host is compiled by gate/compile.mjs as a few Cargo calls naming every crate, each crate with its own result. No switch selects the per-crate rows
3457
+ // (the RK_GATE_LEGACY_ROWS switch was removed 2026-11-24, rightkit#1514: compiles are combined, GC-A27 NN09).
3456
3458
  let together = null;
3457
3459
  try {
3458
3460
  const ex = (o.resolveExecutor ?? gateResolveExecutor)({ env: o.env, platform: o.platform, exists: o.exists, which: whichIn(o), readFile: o.readFile });
3459
- if (o.env.RK_GATE_LEGACY_ROWS !== "1" && ex?.kind === "broker" && union.selected.every((row) => row.selector.startsWith("cargo:"))) together = { client: brokerClientOf(o, ex) };
3461
+ if (ex?.kind === "broker" && union.selected.every((row) => row.selector.startsWith("cargo:"))) together = { client: brokerClientOf(o, ex) };
3460
3462
  } catch { together = null; }
3461
3463
  if (together) {
3462
3464
  try {
@@ -4330,8 +4332,9 @@ export async function main(argv, io = {}) {
4330
4332
  // (snapshot.mjs repositoryOf -> snapshot-git.mjs sealedRepoInfo, cached per canonical path in this process), so the
4331
4333
  // common dir is read from that cache, never asked again. An injected spawn (tests) is asked as before.
4332
4334
  const commonDir = o.spawn === defaultSpawn ? sealedRepoInfo(snapshotCheckout).commonDir : (() => { const common = o.spawn("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], { cwd: snapshotCheckout }); if (failed(common) || !text(common).trim()) throw new Error("cannot identify Class A cache location"); return text(common).trim(); })();
4333
- const storeDir = o.env.RK_GATE_CACHE_DIR || path.join(commonDir, "rightkit-gate-cache");
4334
- history = openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
4335
+ // The store has one fixed place per repository; no caller moves it (Adrian, 2026-11-24, rightkit#1514).
4336
+ const storeDir = path.join(commonDir, "rightkit-gate-cache");
4337
+ history = openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
4335
4338
  } catch (error) { o.err(`rightkit-gate: BLOCKED: ${error.message}`); return 1; }
4336
4339
  }
4337
4340
  const ruleCache = snapshotDir && snapshotCommit && !args.includes("--worktree") && !o.appCheck ? ruleVerdictCache({ checkout: snapshotCheckout, spawn: o.spawn }) : null;
@@ -5381,9 +5384,9 @@ export async function main(argv, io = {}) {
5381
5384
  const { files, ids, digestOf } = live;
5382
5385
  const under = (dir) => (dir === "." || dir === "" ? files : files.filter((f) => f === dir || f.startsWith(`${dir}/`)));
5383
5386
  const objectId = (p) => (ids.has(p) ? ids.get(p) : under(p).length ? digestOf(under(p)) : null);
5384
- const storeDir = o.env.RK_GATE_CACHE_DIR ? path.resolve(o.env.RK_GATE_CACHE_DIR) : path.join(path.resolve(root, text(common).trim()), "rightkit-gate-cache");
5387
+ const storeDir = path.join(path.resolve(root, text(common).trim()), "rightkit-gate-cache");
5385
5388
  // Nov-18 cache rule applies to every bound full-A form (snapshot, hosted, live), not only guarded snapshot discovery.
5386
- classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
5389
+ classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
5387
5390
  const store = fileScanCache(storeDir);
5388
5391
  const listFiles = (dir) => under(dir);
5389
5392
  const readBlob = (p) => fs.readFileSync(path.join(liveBase, p), "utf8");
@@ -5433,10 +5436,10 @@ export async function main(argv, io = {}) {
5433
5436
  const line = text(r).split(/\r?\n/).find(Boolean);
5434
5437
  return line ? (line.split("\t")[0].split(/\s+/)[2] ?? null) : null;
5435
5438
  };
5436
- const storeDir = o.env.RK_GATE_CACHE_DIR ? path.resolve(o.env.RK_GATE_CACHE_DIR) : path.join(path.resolve(root, text(common).trim()), "rightkit-gate-cache");
5437
- if (needsForecast) classBHistory = openClassBHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
5439
+ const storeDir = path.join(path.resolve(root, text(common).trim()), "rightkit-gate-cache");
5440
+ if (needsForecast) classBHistory = openClassBHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
5438
5441
  // Mixed A+B in one invocation needs its Class A history too; boundFullA opened it above when that block ran.
5439
- if (needsForecast && !classAHistory && !(snapshotB && o.classAEarlier === true)) classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir });
5442
+ if (needsForecast && !classAHistory && !(snapshotB && o.classAEarlier === true)) classAHistory = o[CLASS_A_HISTORY] ?? openClassAHistory({ historyRoot: path.join(gateRunsRoot({ env: o.env, platform: o.platform }), "rightkit-class-a-history"), storeDir, onRestart: cacheRestartNote(o) });
5440
5443
  const store = fileScanCache(storeDir);
5441
5444
  const listFiles = (dir) => {
5442
5445
  const r = git("ls-tree", "-r", "--name-only", "-z", headSha, "--", dir);
@@ -18,7 +18,18 @@ export function openClassBHistory(options) {
18
18
  return openHistory(options, "B");
19
19
  }
20
20
 
21
- function openHistory({ historyRoot, storeDir }, stage) {
21
+ // A store this gate cannot use (one with no history, or with a history from before Class B was recorded) is set aside under a dated name
22
+ // beside it, and an empty store and history are started in the same fixed place. The gate does this itself and reports it once through
23
+ // `onRestart`; no caller chooses another folder (Adrian, 2026-11-24, rightkit#1514). The Cargo build output is elsewhere and is not touched.
24
+ const stamp = () => new Date().toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "Z");
25
+ function setAside(target) {
26
+ let to = target + ".set-aside-" + stamp();
27
+ for (let i = 1; fs.existsSync(to); i += 1) to = target + ".set-aside-" + stamp() + "-" + i;
28
+ fs.renameSync(target, to);
29
+ return to;
30
+ }
31
+
32
+ function openHistory({ historyRoot, storeDir, onRestart = null }, stage) {
22
33
  const label = "Class " + stage;
23
34
  const store = path.resolve(storeDir);
24
35
  const relative = path.relative(store, path.resolve(historyRoot));
@@ -42,8 +53,28 @@ function openHistory({ historyRoot, storeDir }, stage) {
42
53
  if (stage === "B" && document.schema === 1) throw new Error("Class B cache history missing at " + file + " for legacy store " + store + ". Restore verified independent Class B history or select a new store for a declared cold run.");
43
54
  return new Map(document.schema === 1 ? document.rows : document.stages[stage]);
44
55
  };
56
+ const restart = (reason) => {
57
+ // The old store goes first: if it cannot be moved (a file in it is held open), nothing has changed and the run stops with the reason.
58
+ let storeAside = null; let historyAside = null;
59
+ try {
60
+ if (fs.existsSync(store)) storeAside = setAside(store);
61
+ if (fs.existsSync(file)) historyAside = setAside(file);
62
+ fs.mkdirSync(store, { recursive: true });
63
+ } catch (cause) {
64
+ throw new Error(label + " cache at " + store + " cannot be used (" + reason + ") and could not be set aside: " + (cause.code ?? cause.message));
65
+ }
66
+ save({ schema: 2, namespace, stages: { A: [], B: [] } });
67
+ if (typeof onRestart === "function") onRestart({ store, reason, storeAside, historyAside });
68
+ return new Map();
69
+ };
45
70
  let baseline;
46
- try { baseline = rowsFor(read()); } catch (error) {
71
+ try {
72
+ const document = read();
73
+ if (stage === "B" && document.schema === 1) {
74
+ const lock = acquireFileLock(file + ".lock", label + " cache history");
75
+ try { const again = read(); baseline = again.schema === 1 ? restart("its history was written before compile results were recorded") : rowsFor(again); } finally { lock.release(); }
76
+ } else baseline = rowsFor(document);
77
+ } catch (error) {
47
78
  if (error.code !== "ENOENT") throw error;
48
79
  const lock = acquireFileLock(file + ".lock", label + " cache history");
49
80
  try {
@@ -52,14 +83,18 @@ function openHistory({ historyRoot, storeDir }, stage) {
52
83
  fs.mkdirSync(path.dirname(store), { recursive: true });
53
84
  // Exclusive creation establishes a first-use store. An already existing
54
85
  // cache without independent evidence must never silently forecast all misses.
86
+ let existing = false;
55
87
  try { fs.mkdirSync(store); } catch (cause) {
56
88
  if (cause.code !== "EEXIST") throw cause;
57
- throw new Error(label + " cache history missing at " + file + " for existing store " + store + ". Restore its verified history or select a new store for a declared cold run.");
89
+ existing = true;
90
+ }
91
+ if (existing) baseline = restart("it has no history");
92
+ else {
93
+ baseline = new Map();
94
+ // Both classes acquire their independent first-use evidence in one
95
+ // atomic write, before either class may populate the physical store.
96
+ save({ schema: 2, namespace, stages: { A: [], B: [] } });
58
97
  }
59
- baseline = new Map();
60
- // Both classes acquire their independent first-use evidence in one
61
- // atomic write, before either class may populate the physical store.
62
- save({ schema: 2, namespace, stages: { A: [], B: [] } });
63
98
  }
64
99
  } finally { lock.release(); }
65
100
  }
package/gate-serve.mjs CHANGED
@@ -13,7 +13,7 @@
13
13
  // proven", and the caller does the full verify. The server never says "clean" on a guess.
14
14
  // - Only plain verifies (no stage-output ledger) use it.
15
15
  //
16
- // Lifecycle: started detached by the first client that finds no server (RK_GATE_SERVE=0 disables it); one server per host and data root;
16
+ // Lifecycle: started detached by the first client that finds no server (no switch disables it: RK_GATE_SERVE was removed 2026-11-24, rightkit#1514); one server per host and data root;
17
17
  // exits after RK_GATE_SERVE_IDLE_MS (default 30 min) without a request, or when a client runs different gate code. No system service is
18
18
  // installed. Commands: `node gate-serve.mjs serve`, `node gate-serve.mjs status`, and the internal client ops below.
19
19
  import crypto from "node:crypto";
@@ -311,7 +311,6 @@ export function askInProcess(req, timeoutMs, { sock = socketPath() } = {}) {
311
311
 
312
312
  /** One synchronous request to the resident server; null when it is disabled, unreachable or did not answer. Starts it when absent. */
313
313
  export function serveRequest(req, { env = process.env, root = null, timeoutMs = 3000, sock = socketPath(env) } = {}) {
314
- if (env.RK_GATE_SERVE === "0") return null;
315
314
  let res = null;
316
315
  try { res = askInProcess(req, timeoutMs, { sock }); }
317
316
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.61",
3
+ "version": "0.6.63",
4
4
  "description": "Portable release CLI/SDK with fail-closed public GitHub Releases and private R2 + RightApps distribution.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -91,7 +91,7 @@
91
91
  ],
92
92
  "sideEffects": false,
93
93
  "scripts": {
94
- "test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs class-a-cache-history.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
94
+ "test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs class-a-cache-history.test.mjs gate-fixed-levers.test.mjs broker-toolchain.test.mjs snapshot-changes.test.mjs gate-serve-changes.test.mjs gate-serve-helper.test.mjs resident-answers.test.mjs probe-memo-kept.test.mjs class-a-lanes.test.mjs feature-partition-targets.test.mjs class-b-target-groups.test.mjs unit-list-lock.test.mjs cargo-profile-check.test.mjs cargo-home-real-path.test.mjs class-a-cache-admission.test.mjs class-b-cache-admission.test.mjs shellcheck-cache-inputs.test.mjs implicit-features.test.mjs test-group-failure-cache.test.mjs sealed-listing-store.test.mjs gate/gate.test.mjs package-files.test.mjs host-gate.test.mjs publish-local-cargo.test.mjs affected-units.test.mjs batch-workspace.test.mjs unit-list-plan.test.mjs compile-inputs.test.mjs snapshot-dependency-reuse.test.mjs publisher-requirement-scan.test.mjs node-check-cache.test.mjs preparation-diagnostics.test.mjs gate-coverage-timing.test.mjs ci-compile-admission.test.mjs qualification-verify.test.mjs test-run-output.test.mjs feature-partition.test.mjs feature-sets.test.mjs gate-seam.test.mjs serial-row.test.mjs seam-repairs.test.mjs snapshot-lock.test.mjs lock-identity.test.mjs stamp-relay.test.mjs install-tauri-authenticode.test.mjs gate-stage-binding.test.mjs tool-output.test.mjs publication-gate.test.mjs gate-release-admission.test.mjs cache-key-explain.test.mjs external-inputs.test.mjs built-bins.test.mjs probe-memo.test.mjs gate-serve-ask.test.mjs double-pass.test.mjs tool-version-memo.test.mjs workspace-manifests.test.mjs test-failure-cache.test.mjs served-metadata.test.mjs windows-pnpm-identity.test.mjs",
95
95
  "test:registry-parity": "node registry-parity.mjs --allow-unpublished",
96
96
  "test:signer:windows": "node sign-release-manifest.integration.mjs",
97
97
  "prepublishOnly": "pnpm test:signer:windows && pnpm test:registry-parity",
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.7.0",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.6",
52
- "@rightkit/release": "0.6.61",
52
+ "@rightkit/release": "0.6.63",
53
53
  "@rightkit/send-ui": "0.1.0",
54
54
  "@rightkit/settings-ui": "0.7.5",
55
55
  "@rightkit/social-ui": "0.2.1",
package/snapshot.mjs CHANGED
@@ -265,7 +265,6 @@ export function treeProvenByChanges({ reply, dir, tree, entries, objectFormat })
265
265
  * hash of this run.
266
266
  */
267
267
  export function beginResidentProof(dir, { env = process.env, ask = serveRequest, waitMs = 8000 } = {}) {
268
- if (env.RK_GATE_SERVE === "0") return null;
269
268
  const root = path.dirname(path.resolve(dir));
270
269
  // Only the first question may start the process (each start is a launcher of its own on Windows); the ones after it only ask.
271
270
  let r = noteChangeSource(ask({ op: "begin", dir }, { env, root }));
@@ -808,6 +807,12 @@ export const windowsSelfCheckScript = (name) => [
808
807
  "$in = $false; if (-not [RkJob]::IsProcessInJob([RkJob]::GetCurrentProcess(), $j, [ref]$in)) { 'ERR:' + [Runtime.InteropServices.Marshal]::GetLastWin32Error(); exit 0 }",
809
808
  "if ($in) { 'IN' } else { 'OUT' }",
810
809
  ].join("\n");
810
+ /** Asks Windows itself about a named job, with no holder: `GONE:<error>` when no such job exists any more, else `ACTIVE:<count>`. */
811
+ export const windowsJobProbeScript = (name) => [
812
+ "$ErrorActionPreference = 'Stop'", JOB_TYPE,
813
+ `$j = [RkJob]::OpenJobObjectW(0x0004, $false, ${psString(name)}); if ($j -eq [IntPtr]::Zero) { 'GONE:' + [Runtime.InteropServices.Marshal]::GetLastWin32Error(); exit 0 }`,
814
+ "'ACTIVE:' + [RkJob]::Active($j)",
815
+ ].join("\n");
811
816
  const readJson = (file) => { try { return JSON.parse(fs.readFileSync(file, "utf8").replace(/^/, "")); } catch { return null; } };
812
817
  const sleepMs = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
813
818
  /** The real Windows operations; tests pass their own. */
@@ -821,6 +826,18 @@ export const windowsJobOps = {
821
826
  if (r.error || r.status !== 0 || !/^(IN|OUT)$/m.test(out)) throw new Error(`the containment self-check gave no answer (${r.error?.message ?? out.slice(0, 120)})`);
822
827
  return /^IN$/m.test(out) ? "IN" : "OUT";
823
828
  },
829
+ /**
830
+ * The named job as Windows shows it, asked without its holder: `{ exists: false }` when Windows has no job of that name (a job with no open handle
831
+ * and no process in it is deleted by Windows, so every process of it has ended), else `{ exists: true, active }`. Throws when Windows gave no answer.
832
+ */
833
+ jobActive(name) {
834
+ const r = spawnSync("powershell.exe", ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(windowsJobProbeScript(name), "utf16le").toString("base64")], { encoding: "utf8", timeout: 60_000, windowsHide: true });
835
+ const out = String(r.stdout ?? "").trim(); const gone = /^GONE:(\d+)$/m.exec(out); const active = /^ACTIVE:(\d+)$/m.exec(out);
836
+ if (r.error || r.status !== 0 || (!gone && !active)) throw new Error(`Windows gave no answer about the job (${r.error?.message ?? out.slice(0, 120)})`);
837
+ // 2 is ERROR_FILE_NOT_FOUND: no object of that name. Any other failure to open it (access denied, ...) proves nothing.
838
+ if (gone) { if (Number(gone[1]) !== 2) throw new Error(`the job could not be opened (Windows error ${gone[1]})`); return { exists: false }; }
839
+ return { exists: true, active: Number(active[1]) };
840
+ },
824
841
  sleep: sleepMs,
825
842
  /** The host's last boot as Unix ms (the deleted build-ownership.mjs read it the same way: [DateTimeOffset] of LastBootUpTime, never local-time arithmetic). */
826
843
  bootTime() {
@@ -889,7 +906,7 @@ export function queryJobHolder(file, { job, timeoutMs = 5000, sleep = sleepMs }
889
906
  * A record that is not contained proves nothing, at the holder's own release or after it died: live (acquisition refuses a self-check OUT, so only a damaged record says so).
890
907
  * A dead holder's job made before the host's last boot is gone (the reboot ended it); a holder killed without a reboot leaves the lock busy (fail closed).
891
908
  */
892
- export function windowsJobLive(lockFile, { self = 0, query = queryJobHolder, bootTime = () => windowsJobOps.bootTime() } = {}) {
909
+ export function windowsJobLive(lockFile, { self = 0, query = queryJobHolder, bootTime = () => windowsJobOps.bootTime(), probe = (name) => windowsJobOps.jobActive(name) } = {}) {
893
910
  let record = null;
894
911
  try { record = JSON.parse(fs.readFileSync(jobRecordOf(lockFile), "utf8")); } catch (e) { if (e?.code === "ENOENT") return []; return [`job record unreadable (${e?.code ?? e?.message})`]; }
895
912
  if (record?.schema !== WINDOWS_JOB_SCHEMA || typeof record.job !== "string" || typeof record.holder !== "string" || !HOLDER_NAME.test(record.holder)) return ["job record malformed"];
@@ -904,7 +921,16 @@ export function windowsJobLive(lockFile, { self = 0, query = queryJobHolder, boo
904
921
  const state = readJson(file);
905
922
  if (state?.schema === WINDOWS_JOB_SCHEMA && state.job === record.job && state.state === "drained") return [];
906
923
  try { const { active } = query(file, { job: record.job }); return active - self > 0 ? [`job ${record.job} (${active - self} process(es))`] : []; }
907
- catch (e) { return [`job ${record.job} unknown (${e.message})`]; }
924
+ catch (e) {
925
+ // The holder did not answer. For a dead lock holder that is what a holder killed with its gate looks like (GC-A27 NN12: the next ordinary run must start
926
+ // by itself), so Windows is asked directly: no job of that name left, or a job with no process in it, proves every process of it has ended. Anything
927
+ // Windows cannot say stays unknown, which counts as live. A holder asking about its own job (self > 0) never takes this path.
928
+ if (self === 0) {
929
+ try { const seen = probe(record.job); if (!seen.exists || seen.active === 0) return []; return [`job ${record.job} (${seen.active} process(es); its holder is gone)`]; }
930
+ catch (p) { return [`job ${record.job} unknown (${e.message}; ${p.message})`]; }
931
+ }
932
+ return [`job ${record.job} unknown (${e.message})`];
933
+ }
908
934
  }
909
935
 
910
936
  /** The recorded process groups of `lockFile` that still answer (kill(-group, 0) is not ESRCH); a group that cannot be judged counts as alive.