@rightkit/release 0.6.92 → 0.6.94

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.
@@ -41,6 +41,32 @@ export function isClassAProgram(start) {
41
41
  if (name === "cargo") return ["deny", "audit"].includes(cargoVerb(args));
42
42
  return false;
43
43
  }
44
+ /**
45
+ * A cargo-deny row's own preparation, which it runs before `cargo deny` (deterministic-scans.mjs, the deny row): `cargo fetch --locked`, then
46
+ * `cargo metadata --format-version 1 --locked` (metadataArgs with noDeps false). Only that row starts cargo with exactly these arguments (after an
47
+ * optional `+toolchain`); every other metadata call names --no-deps, --offline, --filter-platform or --manifest-path, and every other fetch names a manifest.
48
+ */
49
+ export function isDenyPreparation(start) {
50
+ if (programName(start.program) !== "cargo") return false;
51
+ const args = (start.args ?? []).map(String).filter((a, i) => !(i === 0 && a.startsWith("+")));
52
+ const same = (want) => args.length === want.length && want.every((w, i) => args[i] === w);
53
+ return same(["fetch", "--locked"]) || same(["metadata", "--format-version", "1", "--locked"]);
54
+ }
55
+ /** NN03's view of Class A work: a row's own program, or the deny row's preparation, which starts the row on time though cargo deny starts after it. */
56
+ const isClassAWork = (start) => isClassAProgram(start) || isDenyPreparation(start);
57
+ /**
58
+ * A deny row's later programs: its `cargo metadata`, the `cargo deny` it then starts and the cargo-deny executable that one starts. The row itself began at its
59
+ * `cargo fetch --locked` (deterministic-scans.mjs, the deny row: fetch, then metadata, then deny, always in that order), so these are the row going on, not a
60
+ * row starting. 0.6.94 acceptance, 29 Nov: one row's fetch took 4.5 s; its `cargo deny` started 2225 ms after the last program of the five rows beside it and
61
+ * NN03 read the last row of the run as waiting beside a free lane.
62
+ */
63
+ export function isDenyContinuation(start) {
64
+ const name = programName(start.program);
65
+ if (name === "cargo-deny") return true;
66
+ if (name !== "cargo") return false;
67
+ const args = (start.args ?? []).map(String).filter((a, i) => !(i === 0 && a.startsWith("+")));
68
+ return cargoVerb(args) === "deny" || (args[0] === "metadata" && isDenyPreparation(start));
69
+ }
44
70
  /** The workspace, verb, feature flags and targets of a broker job: what NN09 holds against the cases file's exact list. A command that names no --target builds for the host. */
45
71
  export function groupOf(job, hostTarget) {
46
72
  const args = job.args ?? []; const snap = plain(job.gate?.snapshot); const cwd = plain(job.cwd);
@@ -216,7 +242,9 @@ const LINES = {
216
242
  const run = c.runs[0]; const fails = []; const lanes = run.lanes;
217
243
  if (!Number.isInteger(lanes) || lanes < 1) return verdict(["the launcher recorded no lane count"], "");
218
244
  if (run.processGaps.length) fails.push(`the process record is incomplete (${run.processGaps[0]})`);
219
- const progs = run.starts.filter(isClassAProgram).sort((a, b) => a.at - b.at);
245
+ // A deny row's fetch and metadata count as its work (0.6.93 acceptance, 28 Nov: cold metadata took 3.9 s, and the row's cargo deny started 3.6 s
246
+ // after the program before it, which read as a row waiting beside a free lane though the row had started on time).
247
+ const progs = run.starts.filter(isClassAWork).sort((a, b) => a.at - b.at);
220
248
  const rows = Object.values(cases.classA?.programRows ?? {}).flat().length;
221
249
  if (progs.length < 2) return verdict([...fails, `${progs.length} Class A program(s) started in a run from nothing; the cases file lists ${rows} rows that start one`], "");
222
250
  const runningAt = (t) => progs.filter((p) => p.at <= t && (p.end === null || p.end > t)).length;
@@ -224,10 +252,13 @@ const LINES = {
224
252
  const need = Math.min(lanes, progs.length);
225
253
  // A later program is a row that was still waiting at the earlier start. If a lane was free after that earlier start and the waiting row started more than
226
254
  // `slackMs` later, a row waited beside an idle lane.
255
+ // The gap is measured between ROW starts: a deny row's later programs (isDenyContinuation) are that row going on. They still count as running (runningAt),
256
+ // so a lane they hold is not read as free.
227
257
  const slackMs = cases.nn03SlackMs ?? 2000; let idle = 0; let worst = null;
228
- for (let i = 1; i < progs.length; i += 1) {
229
- const gap = progs[i].at - progs[i - 1].at; const free = runningAt(progs[i - 1].at) < lanes;
230
- if (free && gap > slackMs) { idle += 1; if (!worst || gap > worst.gap) worst = { gap, name: programName(progs[i].program) }; }
258
+ const rowStarts = progs.filter((p) => !isDenyContinuation(p));
259
+ for (let i = 1; i < rowStarts.length; i += 1) {
260
+ const gap = rowStarts[i].at - rowStarts[i - 1].at; const free = runningAt(rowStarts[i - 1].at) < lanes;
261
+ if (free && gap > slackMs) { idle += 1; if (!worst || gap > worst.gap) worst = { gap, name: programName(rowStarts[i].program) }; }
231
262
  }
232
263
  if (idle) fails.push(`${idle} Class A program(s) started more than ${slackMs} ms after the one before while a lane was free (longest: ${programName(worst.name)} after ${worst.gap} ms)`);
233
264
  if (peak < Math.min(need, 2)) fails.push(`at most ${peak} Class A program(s) ran at a time on ${lanes} lanes`);
@@ -63,7 +63,8 @@
63
63
  // statically) are all identical. Stored in <git common dir>/rightkit-gate-cache; a hit prints
64
64
  // `cached` and is listed in the result's cacheHits. A deterministic failure (NN41: a compile's authenticated or diagnosed failure, a file-only rule's violations) is cached too and prints `cached-fail`; timeouts, aborts, refusals, infrastructure errors and test runs never are.
65
65
  // Class A scan concurrency is the host's core count; no caller sets it. Class B on a broker host (rightkit#1367 step 2): the gate does not count builds; every
66
- // component's broker-carried scans (cargo, rustright, carried Swift, and npm suites that declare a broker call) start without a limit, each component in plan order,
66
+ // component's broker-carried scans (cargo, rustright, carried Swift, and npm suites that declare a broker call) are filed in plan order, at most BROKER_CLASS_B_WINDOW
67
+ // requests at the broker at once (0.6.94: a request the broker holds QUEUED past its queue deadline is ended, so the gate files the next when one ends),
67
68
  // and the broker queues and orders them. A carried scan's run limit is a stopwatch that stops while the broker holds all its requests QUEUED (broker-admission.mjs),
68
69
  // so queue time is neither charged to the scan nor bounded by a gate allowance. Only class B suites the broker never sees (npm or node tests run on this host)
69
70
  // keep a local limit of 3, one slot per suite. On a host with no broker 3 components' class B scans run at once; one
@@ -86,7 +87,7 @@ import { FOREIGN_PRE_COMMIT, retireHooksIn } from "../hook-retirement.mjs";
86
87
  import { fileURLToPath } from "node:url";
87
88
  import { installIdentity, installStateBytes } from "../dependency-identity.mjs";
88
89
  import { pnpmVersionAnswer } from "../snapshot-dependency-reuse.mjs";
89
- import { BIOME_CONFIG_FILES, CHECKER_IDENTITY, OXLINT_CONFIG_FILES, ESLINT_CONFIG_FILES, LOCAL_CLASS_B_JOBS, WORKSPACE_RUST_FILE, ancestorConfigChanged, ancestorDirsOf, canonicalJson, defaultSpawn, defaultSpawnAsync, rememberReads, judgeUnitList, blockedUnitsOf, digestScanSet, fileScanCache, findRustfmt, metadataArgs, planScans, planUnitListScans, publisherRequirementScan, runScans, sidecarBoundCrate, scanToolPolicyFromPipeline, scanDeferrals, scanFailures, seamRunState } from "../deterministic-scans.mjs";
90
+ import { BIOME_CONFIG_FILES, CHECKER_IDENTITY, OXLINT_CONFIG_FILES, ESLINT_CONFIG_FILES, LOCAL_CLASS_B_JOBS, BROKER_CLASS_B_WINDOW, WORKSPACE_RUST_FILE, ancestorConfigChanged, ancestorDirsOf, canonicalJson, defaultSpawn, defaultSpawnAsync, rememberReads, judgeUnitList, blockedUnitsOf, digestScanSet, fileScanCache, findRustfmt, metadataArgs, planScans, planUnitListScans, publisherRequirementScan, runScans, sidecarBoundCrate, scanToolPolicyFromPipeline, scanDeferrals, scanFailures, seamRunState } from "../deterministic-scans.mjs";
90
91
  import { changedLockNames, parseLock, reach } from "../lock-graph.mjs";
91
92
  import { resolveExecutor } from "../gate-executor.mjs";
92
93
  // The gate's own executor: an outer gate's cargo wrapper on PATH is never this gate's cargo (gate-executor.mjs `gateWrappers`).
@@ -111,7 +112,7 @@ import { buildCoverageReport, limitedEvidenceOf, seconds, writeCoverageReport }
111
112
  import { renderViews, renderViewsOf } from "../render-views.mjs";
112
113
  import { LINUX_BROKER_ROUTE, NO_BROKER_ENV, directCargoPath, directPlatform, managedRuntimeClient, realCargoOf, runCargoSync } from "../managed-cargo.mjs";
113
114
  import { createBrokerLive } from "../broker-admission.mjs";
114
- import { bindingOf, builtBinsOfRun, compileOutputsRecord, compileReuseProblem, endRun, readReceipt, RECEIPT_SCHEMA, receiptKey, sameBinding, sameSource, sealedFor, stagesTo, startRun, STAGES, STAGE_SOURCES, writeReceipt } from "../gate-stages.mjs";
115
+ import { bindingOf, builtBinsOfRun, compileOutputsRecord, compileReuseProblem, compileStageReuse, endRun, readReceipt, RECEIPT_SCHEMA, receiptKey, sameBinding, sameSource, sealedFor, stagesTo, startRun, STAGES, STAGE_SOURCES, writeReceipt } from "../gate-stages.mjs";
115
116
  import { spawnSync as spawnInherit } from "../background-process.mjs";
116
117
  // GC-A21: a run that stamps its own lines also stamps its inherited-output children's lines, through stamp-relay.mjs in front of the child
117
118
  // (the launch stays synchronous and the output still streams). Set by main() when the run stamps; off for machine-readable runs.
@@ -2315,8 +2316,14 @@ async function runStages(o, args, root, git, io) {
2315
2316
  // GB-13 (GATE E6/E7/E16): a recorded compile stands only while the outputs it recorded are still on disk and the compile environment is
2316
2317
  // the one it ran in; otherwise the compile runs again, warm (never a cleared target), unless the sealed bytes below carry it.
2317
2318
  const outputsProblem = (o.compileReuseProblem ?? compileReuseProblem)(receipt.stages.compile, { env: o.env });
2318
- if (!outputsProblem) { o.out(`${tag} [${stage}] already passed for this exact input (commit, tree, lockfiles, gate, toolchain) and its outputs are intact`); continue; }
2319
- if (!sealedIntact) o.out(`${tag} [${stage}] the recorded compile no longer stands: ${outputsProblem}; running it again (warm)`);
2319
+ // On a broker host a package stage that will run needs each Cargo workspace's broker output folder, which only the compile stage hands on
2320
+ // (onCompileOutputs). The recorded compile keeps the folders, not which workspace each belongs to, so skipping the stage whole left the package
2321
+ // admission with no target and it refused RK_SPLIT_TARGET_UNRESOLVED (CodeRight qualify on the Mac, 27 Nov, eaef5f533). There the compile takes
2322
+ // its ordinary path instead: every row is a cache hit, the broker is asked nothing, and the cached rows' receipts name the folders (rightkit#1800).
2323
+ const reuse = compileStageReuse({ outputsProblem, executorKind: executor.kind, stages, sealedIntact });
2324
+ if (reuse === "rows") o.out(`${tag} [${stage}] already passed for this exact input and its outputs are intact; its rows are read again from the cache so the package stage knows each workspace's Cargo target`);
2325
+ else if (reuse === "skip") { o.out(`${tag} [${stage}] already passed for this exact input (commit, tree, lockfiles, gate, toolchain) and its outputs are intact`); continue; }
2326
+ if (outputsProblem && !sealedIntact) o.out(`${tag} [${stage}] the recorded compile no longer stands: ${outputsProblem}; running it again (warm)`);
2320
2327
  }
2321
2328
  if (((stage === "check" && publisherUploadOnly) || stage === "compile" || stage === "package") && sealedIntact) {
2322
2329
  o.out(`${tag} [${stage}] already passed for the sealed set ${sealedNow.id} (manifest ${sealedNow.digest.slice(0, 12)})`); continue;
@@ -2389,7 +2396,7 @@ async function runStages(o, args, root, git, io) {
2389
2396
  const file = path.join(fs.mkdtempSync(path.join(os.tmpdir(), "rk-door-registry-")), "admission.json");
2390
2397
  o.out(`${tag} [compile] registry admission for ${platform} before any compile (right-release build --platform ${platform} --registry-admission-out)`);
2391
2398
  if (await rightRelease(stage, ["build", "--platform", platform, "--registry-admission-out", file])) doorRegistryAdmissionFile = file;
2392
- else { o.err(`${tag} BLOCKED: [compile] the registry admission (pin freshness against the registries) refused ${platform}; nothing compiled`); ok = false; }
2399
+ else { o.err(`${tag} BLOCKED: [compile] the registry admission (pin freshness against the registries; signing secrets in the environment) refused ${platform}; nothing compiled`); ok = false; }
2393
2400
  }
2394
2401
  // On the snapshot route the sidecars are staged from the snapshot's own config and sources through right-release's source split
2395
2402
  // (the staged files and receipt land beside the sources the compile reads; the caches and build trees stay the checkout's), before
@@ -5617,6 +5624,11 @@ export async function main(argv, io = {}) {
5617
5624
  live = sc.commitFiles(checkout, ct.commit, o.spawn);
5618
5625
  // Dependencies for the checks that execute repository code: installed into the snapshot from the commit's lockfile and the
5619
5626
  // primary checkout's existing store (coordinator decision A, rightkit#1257). A store miss stops here, naming the package.
5627
+ // 0.6.94: a scoped check installs only its scope's roots, and the compile stage installs every root of the commit; a root outside the scope that the store could
5628
+ // not serve showed only there, after the sidecars were staged (CodeRight 44af35273 on the Dell, 2026-11-29: apps/coderight-web, 75 minutes in). Those roots are
5629
+ // proved against the store here, with no install (the same `pnpm fetch --offline` proof a content check runs), before anything is installed or compiled.
5630
+ const unscopedRoots = npmRoots.filter((r) => !installRoots.includes(r));
5631
+ if (unscopedRoots.length) for (const r of sc.verifySnapshotStore({ checkout, snapshot: snapshotA, ...ct, roots: unscopedRoots, tmpRoot: gateTmpRoot({ env: o.env, platform: o.platform, exists: o.exists }), env: o.env, spawn: o.spawn })) o.out(`${tag} ${sc.describeStoreCheck(r)}`);
5620
5632
  const installed = sc.installSnapshotDependencies({ checkout, snapshot: snapshotA, ...ct, roots: installRoots, ...(closure ? { packageDirs: npm.filter((u) => closure.npm.has(u.name)).map((u) => u.dir) } : {}), env: o.env, spawn: o.spawn });
5621
5633
  for (const r of installed) o.out(`${tag} ${sc.describeInstall(r)}`);
5622
5634
  } catch (error) { o.err(`${tag} ${error.code === "RK_CHECK_ERROR" ? "RK_CHECK_ERROR" : "BLOCKED"}: ${error.message}`); return error.code === "RK_CHECK_ERROR" ? 2 : 1; }
@@ -5805,7 +5817,7 @@ export async function main(argv, io = {}) {
5805
5817
  // GC-A27 NN09 (Adrian, 2026-11-25: "I'm not relaxing NN09"): every carried command is handed to the broker as soon as it is ready. The broker holds one job of a
5806
5818
  // repository at a time (its `exclusive:workspace:<repo>` blocker, seen on every receipt of the 0.6.64 run), so commands of one workspace never run side by
5807
5819
  // side. 0.6.66 held them back on a misreading: the "two Cargo processes" seen then were one clippy job's own tree (cargo clippy, cargo-clippy, cargo check).
5808
- classBPipeline: Number.POSITIVE_INFINITY, ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
5820
+ classBPipeline: Number.POSITIVE_INFINITY, classBWindow: BROKER_CLASS_B_WINDOW, ...(brokerHost ? { brokerHost: true } : {}), ...(brokerLive ? { brokerLive } : {}), signal: ac.signal, ...(cache ? { cache } : {}),
5809
5821
  // NN41: the installed broker runtime's identity keys every cached compile failure; null (a direct host, an unreadable manifest) means no failure is cached.
5810
5822
  ...(brokerHost && cache ? (() => { const identity = brokerRuntimeIdentityText({ clients: [brokerClient, executor?.client, cargoCommand[0]], env: { ...o.env, ...(executor.env ?? {}) }, platform: o.platform }); return identity ? { failureIdentity: identity } : {}; })() : {}),
5811
5823
  // The declared Linux broker route: the scans are planned with the logical `rustright`, which this spawn (and scanSpawn's pass-through below) starts as the
package/build-release.mjs CHANGED
@@ -23,7 +23,7 @@ import { preflightOwnershipScope } from "./ownership-scope.mjs";
23
23
  import { spawn, spawnSync } from "./background-process.mjs";
24
24
  import { RightKitRegistryError, SNAPSHOT_ENV, SNAPSHOT_FILE, assertManifestRegistryEvidence, loadAdmittedSnapshot, prepareRightKitResolution, registryManifestFields, rightKitLockInventory, writeAdmissionRecord, writeSnapshot } from "./rightkit-registry-resolver.mjs";
25
25
  import { formatAdmission, formatNotRun, runAdmission } from "./admission.mjs";
26
- import { sccacheRefusal } from "./admission-host.mjs";
26
+ import { HOST_ROWS, sccacheRefusal } from "./admission-host.mjs";
27
27
  import { defaultReleaseConfigFile, importReleaseConfig } from "./release-config.mjs";
28
28
  import { fileURLToPath } from "node:url";
29
29
  import { dirtyBuildInputs, resolveReleaseBuildInputs } from "./release-invocation.mjs";
@@ -641,6 +641,19 @@ async function registryAdmissionOnly() {
641
641
  let config;
642
642
  try { config = await importReleaseConfig(configPath, { query: `commit=${commit}` }); }
643
643
  catch (error) { console.error(`right-release build: release config could not be loaded (${configPath}): ${error instanceof Error ? error.message : String(error)}`); process.exit(1); }
644
+ // 0.6.94: the host-secret-env row reads the environment and the declared target only, so it is judged here too, before any compile of the door run (Pulse 48127453
645
+ // on the Mac, 2026-11-29: a shell that exported APPLE_API_* was refused at the package stage, after the compile). The same row, the same words; the package stage
646
+ // judges it again. Where the target cannot be expanded yet the row is not judged here, and the package stage's admission is the one that refuses.
647
+ let secretEnv = [];
648
+ try {
649
+ const early = await runAdmission({ root: appRoot, repoRoot: sourceRoot, releaseSource, configPath, config: config ?? {}, platform, commit, tiers: ["host"], rows: HOST_ROWS.filter((row) => row.id === "host-secret-env") });
650
+ secretEnv = early.findings.filter((finding) => finding.row === "host-secret-env");
651
+ } catch { secretEnv = []; }
652
+ if (secretEnv.length) {
653
+ for (const finding of secretEnv) console.error(`right-release build: host-secret-env: ${finding.detail}`);
654
+ console.error(`right-release build: admission found ${secretEnv.length} blocking problem(s); nothing was started`);
655
+ process.exit(1);
656
+ }
644
657
  let extraLocks;
645
658
  try {
646
659
  const inputs = resolveReleaseBuildInputs({ repoRoot: sourceRoot, appRoot, configPath, config, target: config.targets?.[platform] });
@@ -2827,6 +2827,14 @@ export function isBrokerCarriedScan(scan, { brokerHost = false, seam = false } =
2827
2827
 
2828
2828
  /** Class B processes the broker never sees (npm or node test suites run on this host) are bounded here, one slot per suite; the broker bounds everything it carries (rightkit#1367 step 2). */
2829
2829
  export const LOCAL_CLASS_B_JOBS = 3;
2830
+ /**
2831
+ * How many broker-carried class B requests the gate keeps at the broker at once (rightkit-gate 0.6.94). The broker runs one build of a repository at a time and ends a
2832
+ * request that is still QUEUED after `limits.queueDeadlineMs` (two hours by default): with every row filed at once, a cold run whose rows take longer than that in total
2833
+ * lost every row still waiting (CodeRight 44af35273 on the Dell, 2026-11-29: 61 of 87 rows, then 29, "reason queue-deadline"). With a window the next row is filed when one
2834
+ * ends, so a row waits at the broker for at most the rows filed before it in the window, and the broker always holds a queued row to start next. The broker's status
2835
+ * answer reports no concurrency, so this is a constant and no caller sets it.
2836
+ */
2837
+ export const BROKER_CLASS_B_WINDOW = 4;
2830
2838
 
2831
2839
  /**
2832
2840
  * Whether a class B scan is the BROKER's to queue for scheduling: a cargo or rustright scan and a carried Swift build (isBrokerCarriedScan). An npm or node suite that merely makes broker
@@ -2855,10 +2863,12 @@ export function classBChainKey(scan, carried) {
2855
2863
 
2856
2864
  /**
2857
2865
  * Class B on a broker host (rightkit#1367 step 2): one chain per component, its scans in plan order (compile, doc, tests: they share the component's output directory),
2858
- * every chain started at once. A broker-carried scan starts without a count; the broker queues and orders it. A scan the broker never sees (an npm or node suite) holds one
2859
- * of `localJobs` local slots while it runs. `run(index)` runs one scan and never rejects.
2866
+ * every chain started at once. A broker-carried scan is filed in plan order while fewer than `window` carried requests are in flight (no bound when `window` is not
2867
+ * given), and the broker queues and orders what it holds; a row that joins an invocation already filed (`joins(index)`: a later member of a batch) is no new request
2868
+ * and takes no place in the window. A scan the broker never sees (an npm or node suite) holds one of `localJobs` local slots while it runs. `run(index)` runs one scan
2869
+ * and never rejects.
2860
2870
  */
2861
- export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJobs, run, pipeline = 1 }) {
2871
+ export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJobs, run, pipeline = 1, window = Number.POSITIVE_INFINITY, joins = () => false }) {
2862
2872
  const chains = new Map();
2863
2873
  for (const lane of ["compile", "doc", "tests"]) {
2864
2874
  for (const i of lanes[lane] ?? []) { const key = classBChainKey(scans[i], carried(scans[i])); if (!chains.has(key)) chains.set(key, []); chains.get(key).push(i); }
@@ -2867,6 +2877,18 @@ export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJob
2867
2877
  let held = 0; const waiters = [];
2868
2878
  const take = async () => { while (held >= limit) await new Promise((resolve) => waiters.push(resolve)); held += 1; };
2869
2879
  const free = () => { held -= 1; waiters.shift()?.(); };
2880
+ // The carried window: a place is handed straight to the row that has waited longest, so rows are filed in the order they asked.
2881
+ const width = Number.isFinite(Number(window)) ? Math.max(1, Math.trunc(Number(window)) || 1) : Number.POSITIVE_INFINITY;
2882
+ let filed = 0; const queued = [];
2883
+ const enter = () => { if (filed < width) { filed += 1; return Promise.resolve(); } return new Promise((resolve) => queued.push(resolve)); };
2884
+ const leave = () => { const next = queued.shift(); if (next) next(); else filed -= 1; };
2885
+ const carry = async (i) => {
2886
+ if (joins(i)) return run(i);
2887
+ await enter();
2888
+ // Its invocation was filed while it waited (the first member of its batch got a place): it gives its place back and reads that invocation's row.
2889
+ if (joins(i)) { leave(); return run(i); }
2890
+ try { return await run(i); } finally { leave(); }
2891
+ };
2870
2892
  // B4 (rightkit#1458 audit): with `pipeline` 1 a chain runs one scan at a time, so the gate's work after one job (receipt read, signed-evidence
2871
2893
  // verification, ledger check) and before the next (cache key, request file) was dead time at the broker (about 10.6 s a job on the Dell). With
2872
2894
  // `pipeline` n, up to n carried scans of one chain are in flight: the next is submitted while the previous is still running or being verified, and the
@@ -2885,7 +2907,7 @@ export async function scheduleBrokerHostClassB({ scans, lanes, carried, localJob
2885
2907
  }
2886
2908
  const scanDepth = scans[i].executionWorkspace ? 1 : depth;
2887
2909
  while (flight.size >= scanDepth) await Promise.race(flight);
2888
- const job = run(i).finally(() => flight.delete(job));
2910
+ const job = carry(i).finally(() => flight.delete(job));
2889
2911
  flight.add(job);
2890
2912
  }
2891
2913
  await Promise.all(flight);
@@ -4116,6 +4138,7 @@ export async function runScans(plan, options = {}) {
4116
4138
  } else if (brokerHost) {
4117
4139
  await scheduleBrokerHostClassB({
4118
4140
  scans: bScans, lanes, localJobs: bJobs, carried: (scan) => isBrokerScheduledScan(scan, carriedCtx), pipeline: options.classBPipeline ?? 1,
4141
+ window: options.classBWindow ?? Number.POSITIVE_INFINITY, joins: (i) => Boolean(groupOf.get(i)?.promise),
4119
4142
  run: async (i) => { try { slots[i] = await runB(i); } catch (error) { slots[i] = failedRow(i, error); } },
4120
4143
  });
4121
4144
  } else {
package/gate-stages.mjs CHANGED
@@ -350,6 +350,18 @@ export function compileReuseProblem(recorded, { env = {}, census = outputCensus
350
350
  return null;
351
351
  }
352
352
 
353
+ /**
354
+ * What a door run does with a recorded passing compile: "skip" (it stands; the stage is not run), "rows" (it stands, but the stage takes its
355
+ * ordinary path so each row answers from the cache and names its workspace's broker output folder), or "rerun" (it no longer stands).
356
+ * "rows" is for a broker host whose package stage will run: the package admission resolves each Cargo workspace's target from the folders the
357
+ * compile stage hands on, and the record keeps the folders but not which workspace each belongs to. Skipping the stage left that admission with no
358
+ * target: RK_SPLIT_TARGET_UNRESOLVED (CodeRight qualify on the Mac, 27 Nov 2026, after a compile that had already passed).
359
+ */
360
+ export function compileStageReuse({ outputsProblem, executorKind, stages, sealedIntact }) {
361
+ if (outputsProblem) return "rerun";
362
+ return executorKind === "broker" && (stages ?? []).includes("package") && !sealedIntact ? "rows" : "skip";
363
+ }
364
+
353
365
  /** The sealed release directory build-release wrote for `commit` on `platform`: { id, manifest, digest } or null. */
354
366
  export function sealedFor({ root, commit, platform, readdir = fs.readdirSync, readFile = (f) => fs.readFileSync(f) }) {
355
367
  const base = path.join(root, ".right-release", "sealed");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.92",
3
+ "version": "0.6.94",
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",
@@ -20,7 +20,7 @@
20
20
  "@rightkit/agent-ui-settings": "0.1.1",
21
21
  "@rightkit/agent-ui-web": "0.1.0",
22
22
  "@rightkit/agent-ui-workbench": "0.1.1",
23
- "@rightkit/app-update": "0.4.7",
23
+ "@rightkit/app-update": "0.4.8",
24
24
  "@rightkit/ax": "0.3.2",
25
25
  "@rightkit/blender-worker": "0.1.1",
26
26
  "@rightkit/ci": "0.3.3",
@@ -36,7 +36,7 @@
36
36
  "@rightkit/legal": "0.6.4",
37
37
  "@rightkit/legal-ui": "0.4.2",
38
38
  "@rightkit/library-ui": "0.2.6",
39
- "@rightkit/license": "0.3.5",
39
+ "@rightkit/license": "0.3.6",
40
40
  "@rightkit/logs": "0.1.7",
41
41
  "@rightkit/mail-ui": "0.2.2",
42
42
  "@rightkit/markdown-editor": "0.2.0",
@@ -48,13 +48,13 @@
48
48
  "@rightkit/platform-ui": "0.4.5",
49
49
  "@rightkit/qa": "0.7.0",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
- "@rightkit/react-shell": "0.7.9",
52
- "@rightkit/release": "0.6.92",
51
+ "@rightkit/react-shell": "0.7.10",
52
+ "@rightkit/release": "0.6.94",
53
53
  "@rightkit/send-ui": "0.1.0",
54
- "@rightkit/settings-ui": "0.7.7",
54
+ "@rightkit/settings-ui": "0.7.8",
55
55
  "@rightkit/social-ui": "0.2.1",
56
56
  "@rightkit/system-ui": "0.2.2",
57
- "@rightkit/tauri": "0.4.6",
57
+ "@rightkit/tauri": "0.4.7",
58
58
  "@rightkit/tauri-shell": "0.1.4",
59
59
  "@rightkit/terminal-ui": "0.1.0",
60
60
  "@rightkit/theme": "0.3.4",
@@ -458,7 +458,9 @@
458
458
  "0.6.88",
459
459
  "0.6.89",
460
460
  "0.6.90",
461
- "0.6.91"
461
+ "0.6.91",
462
+ "0.6.92",
463
+ "0.6.93"
462
464
  ],
463
465
  "@rightkit/settings-ui": [
464
466
  "0.1.0",
@@ -561,9 +563,9 @@
561
563
  "rightkit-agent-engine-api-workflows": "0.2.2",
562
564
  "rightkit-agent-engine-attention": "0.2.2",
563
565
  "rightkit-agent-engine-cli": "0.1.1",
564
- "rightkit-agent-engine-core": "0.2.0",
566
+ "rightkit-agent-engine-core": "0.2.1",
565
567
  "rightkit-agent-engine-history": "0.1.6",
566
- "rightkit-agent-engine-mobile-runtime": "0.1.1",
568
+ "rightkit-agent-engine-mobile-runtime": "0.1.2",
567
569
  "rightkit-agent-engine-protocol": "0.4.1",
568
570
  "rightkit-agent-engine-runtime-middleware": "0.1.4",
569
571
  "rightkit-agent-engine-runtime-resources": "0.1.2",
@@ -578,28 +580,28 @@
578
580
  "rightkit-agent-plugins": "0.1.4",
579
581
  "rightkit-agent-policy": "0.2.4",
580
582
  "rightkit-agent-recipes": "0.1.3",
581
- "rightkit-agent-server": "0.2.0",
582
- "rightkit-agent-skills": "0.1.0",
583
+ "rightkit-agent-server": "0.3.2",
584
+ "rightkit-agent-skills": "0.2.0",
583
585
  "rightkit-agent-task-contract": "0.1.2",
584
586
  "rightkit-agent-task-journal": "0.1.1",
585
587
  "rightkit-agent-telemetry": "0.1.1",
586
588
  "rightkit-agent-tools": "0.4.4",
587
589
  "rightkit-agent-transcript": "0.1.4",
588
590
  "rightkit-agents": "0.3.0",
589
- "rightkit-ai-accounts": "0.1.4",
591
+ "rightkit-ai-accounts": "0.1.6",
590
592
  "rightkit-ai-keys": "0.1.1",
591
593
  "rightkit-android": "0.3.3",
592
594
  "rightkit-app-host": "0.1.3",
593
595
  "rightkit-app-icon": "0.1.1",
594
596
  "rightkit-app-lock": "0.1.1",
595
597
  "rightkit-app-manager": "0.2.5",
596
- "rightkit-app-settings": "0.4.4",
598
+ "rightkit-app-settings": "0.4.5",
597
599
  "rightkit-app-update": "0.2.1",
598
600
  "rightkit-apple-ops": "0.2.0",
599
601
  "rightkit-approvals": "0.2.2",
600
- "rightkit-asr": "0.5.2",
602
+ "rightkit-asr": "0.5.3",
601
603
  "rightkit-assist": "0.1.1",
602
- "rightkit-audio": "0.4.5",
604
+ "rightkit-audio": "0.4.6",
603
605
  "rightkit-autoedit": "0.2.1",
604
606
  "rightkit-automation": "0.7.6",
605
607
  "rightkit-autostart": "0.1.1",
@@ -610,7 +612,7 @@
610
612
  "rightkit-captions": "0.1.1",
611
613
  "rightkit-catalog": "0.1.0",
612
614
  "rightkit-channel-memory": "0.2.3",
613
- "rightkit-chat-bridge": "0.2.5",
615
+ "rightkit-chat-bridge": "0.2.6",
614
616
  "rightkit-child-process": "0.5.17",
615
617
  "rightkit-clipboard": "0.1.0",
616
618
  "rightkit-clipboard-history": "0.4.0",
@@ -633,8 +635,8 @@
633
635
  "rightkit-context-runtime": "0.1.5",
634
636
  "rightkit-contracts": "0.1.11",
635
637
  "rightkit-contrast": "0.1.0",
636
- "rightkit-crash": "0.4.3",
637
- "rightkit-credentials": "0.5.10",
638
+ "rightkit-crash": "0.4.4",
639
+ "rightkit-credentials": "0.5.11",
638
640
  "rightkit-crypto": "0.1.4",
639
641
  "rightkit-daemon": "0.9.4",
640
642
  "rightkit-daemon-remote": "0.1.0",
@@ -646,19 +648,19 @@
646
648
  "rightkit-device-link": "0.1.0",
647
649
  "rightkit-device-link-core": "0.1.1",
648
650
  "rightkit-device-link-types": "0.1.2",
649
- "rightkit-dictation-app-runtime": "0.3.2",
651
+ "rightkit-dictation-app-runtime": "0.3.3",
650
652
  "rightkit-dictation-command-host": "0.3.4",
651
653
  "rightkit-dictation-core": "0.3.7",
652
654
  "rightkit-dictation-engine": "0.2.1",
653
655
  "rightkit-dictation-ffi": "0.2.1",
654
656
  "rightkit-dictation-inference": "0.2.5",
655
- "rightkit-dictation-models": "0.3.3",
657
+ "rightkit-dictation-models": "0.3.4",
656
658
  "rightkit-dictation-pill": "0.1.2",
657
659
  "rightkit-dictation-runtime": "0.2.7",
658
- "rightkit-dictation-tauri": "0.3.4",
660
+ "rightkit-dictation-tauri": "0.3.5",
659
661
  "rightkit-dictation-telemetry": "0.2.4",
660
662
  "rightkit-dictation-text-pipeline": "0.2.8",
661
- "rightkit-disk-cleanup": "0.2.2",
663
+ "rightkit-disk-cleanup": "0.2.3",
662
664
  "rightkit-docs": "0.1.6",
663
665
  "rightkit-doctor": "0.2.0",
664
666
  "rightkit-document-workspace": "0.2.1",
@@ -673,7 +675,7 @@
673
675
  "rightkit-evidence-governance": "0.1.1",
674
676
  "rightkit-evidence-report": "0.1.1",
675
677
  "rightkit-feed": "0.1.0",
676
- "rightkit-ffmpeg": "0.3.3",
678
+ "rightkit-ffmpeg": "0.3.4",
677
679
  "rightkit-file-watch": "0.4.4",
678
680
  "rightkit-fs": "0.5.2",
679
681
  "rightkit-fsindex": "0.6.3",
@@ -691,7 +693,7 @@
691
693
  "rightkit-launcher": "0.2.2",
692
694
  "rightkit-launcher-win": "0.2.1",
693
695
  "rightkit-library": "0.3.1",
694
- "rightkit-license": "0.3.5",
696
+ "rightkit-license": "0.3.6",
695
697
  "rightkit-llm": "0.7.2",
696
698
  "rightkit-local-gen": "0.1.4",
697
699
  "rightkit-logs": "0.4.5",
@@ -707,7 +709,7 @@
707
709
  "rightkit-media-gen-models": "0.1.1",
708
710
  "rightkit-media-pipeline": "0.2.2",
709
711
  "rightkit-memory": "0.3.1",
710
- "rightkit-memory-client": "0.1.1",
712
+ "rightkit-memory-client": "0.1.2",
711
713
  "rightkit-memory-core": "0.2.1",
712
714
  "rightkit-memory-store": "0.2.2",
713
715
  "rightkit-mesh": "0.2.3",
@@ -735,7 +737,7 @@
735
737
  "rightkit-profile": "0.1.0",
736
738
  "rightkit-prompt-recipes": "0.2.1",
737
739
  "rightkit-pty": "0.1.3",
738
- "rightkit-qa": "0.10.16",
740
+ "rightkit-qa": "0.10.17",
739
741
  "rightkit-record": "0.4.1",
740
742
  "rightkit-reframe": "0.2.1",
741
743
  "rightkit-remote-compute": "0.2.2",
@@ -760,8 +762,8 @@
760
762
  "rightkit-sync": "0.4.4",
761
763
  "rightkit-sync-keys": "0.1.0",
762
764
  "rightkit-sysmem": "0.1.0",
763
- "rightkit-system-monitor": "0.3.2",
764
- "rightkit-tauri-shell": "0.8.11",
765
+ "rightkit-system-monitor": "0.3.3",
766
+ "rightkit-tauri-shell": "0.8.12",
765
767
  "rightkit-terminal-ui": "0.2.0",
766
768
  "rightkit-text-polish": "0.1.4",
767
769
  "rightkit-theme": "0.1.1",
@@ -926,7 +928,7 @@
926
928
  "@rightkit/qa": "0.7.0",
927
929
  "@rightkit/qa-chrome": "0.1.12",
928
930
  "@rightkit/react-shell": "0.7.7",
929
- "@rightkit/release": "0.6.91",
931
+ "@rightkit/release": "0.6.93",
930
932
  "@rightkit/settings-ui": "0.7.4",
931
933
  "@rightkit/shell": "0.1.1",
932
934
  "@rightkit/tauri": "0.4.3",
@@ -947,7 +949,8 @@
947
949
  ],
948
950
  "rightkit-agent-engine-core": [
949
951
  "0.1.3",
950
- "0.1.4"
952
+ "0.1.4",
953
+ "0.2.0"
951
954
  ],
952
955
  "rightkit-agent-local-models": [
953
956
  "0.1.1",
@@ -984,7 +987,9 @@
984
987
  "rightkit-ai-accounts": [
985
988
  "0.1.1",
986
989
  "0.1.2",
987
- "0.1.3"
990
+ "0.1.3",
991
+ "0.1.4",
992
+ "0.1.5"
988
993
  ],
989
994
  "rightkit-ai-keys": [
990
995
  "0.1.0"
@@ -1007,14 +1012,16 @@
1007
1012
  "0.3.0",
1008
1013
  "0.4.1",
1009
1014
  "0.4.2",
1010
- "0.4.3"
1015
+ "0.4.3",
1016
+ "0.4.4"
1011
1017
  ],
1012
1018
  "rightkit-asr": [
1013
1019
  "0.0.2",
1014
1020
  "0.2.0",
1015
1021
  "0.2.1",
1016
1022
  "0.2.4",
1017
- "0.3.0"
1023
+ "0.3.0",
1024
+ "0.5.2"
1018
1025
  ],
1019
1026
  "rightkit-audio": [
1020
1027
  "0.1.0",
@@ -1033,7 +1040,8 @@
1033
1040
  "0.4.0",
1034
1041
  "0.4.1",
1035
1042
  "0.4.3",
1036
- "0.4.4"
1043
+ "0.4.4",
1044
+ "0.4.5"
1037
1045
  ],
1038
1046
  "rightkit-automation": [
1039
1047
  "0.3.0",
@@ -1080,7 +1088,8 @@
1080
1088
  "0.2.1",
1081
1089
  "0.2.2",
1082
1090
  "0.2.3",
1083
- "0.2.4"
1091
+ "0.2.4",
1092
+ "0.2.5"
1084
1093
  ],
1085
1094
  "rightkit-child-process": [
1086
1095
  "0.4.0",
@@ -1133,7 +1142,8 @@
1133
1142
  "0.3.5",
1134
1143
  "0.3.6",
1135
1144
  "0.4.1",
1136
- "0.4.2"
1145
+ "0.4.2",
1146
+ "0.4.3"
1137
1147
  ],
1138
1148
  "rightkit-credentials": [
1139
1149
  "0.2.0",
@@ -1144,7 +1154,8 @@
1144
1154
  "0.4.2",
1145
1155
  "0.5.5",
1146
1156
  "0.5.7",
1147
- "0.5.8"
1157
+ "0.5.8",
1158
+ "0.5.10"
1148
1159
  ],
1149
1160
  "rightkit-crypto": [
1150
1161
  "0.1.0",
@@ -1186,7 +1197,8 @@
1186
1197
  "rightkit-dictation-app-runtime": [
1187
1198
  "0.2.0",
1188
1199
  "0.2.2",
1189
- "0.3.1"
1200
+ "0.3.1",
1201
+ "0.3.2"
1190
1202
  ],
1191
1203
  "rightkit-dictation-command-host": [
1192
1204
  "0.3.0",
@@ -1208,7 +1220,8 @@
1208
1220
  ],
1209
1221
  "rightkit-dictation-models": [
1210
1222
  "0.3.0",
1211
- "0.3.1"
1223
+ "0.3.1",
1224
+ "0.3.3"
1212
1225
  ],
1213
1226
  "rightkit-dictation-pill": [
1214
1227
  "0.1.0",
@@ -1219,7 +1232,8 @@
1219
1232
  ],
1220
1233
  "rightkit-dictation-tauri": [
1221
1234
  "0.3.1",
1222
- "0.3.3"
1235
+ "0.3.3",
1236
+ "0.3.4"
1223
1237
  ],
1224
1238
  "rightkit-dictation-telemetry": [
1225
1239
  "0.2.0",
@@ -1252,7 +1266,8 @@
1252
1266
  "0.2.6",
1253
1267
  "0.2.9",
1254
1268
  "0.2.10",
1255
- "0.3.2"
1269
+ "0.3.2",
1270
+ "0.3.3"
1256
1271
  ],
1257
1272
  "rightkit-file-watch": [
1258
1273
  "0.4.0",
@@ -1358,7 +1373,8 @@
1358
1373
  "0.2.5",
1359
1374
  "0.3.1",
1360
1375
  "0.3.2",
1361
- "0.3.4"
1376
+ "0.3.4",
1377
+ "0.3.5"
1362
1378
  ],
1363
1379
  "rightkit-llm": [
1364
1380
  "0.1.0",
@@ -1548,7 +1564,8 @@
1548
1564
  "0.10.12",
1549
1565
  "0.10.13",
1550
1566
  "0.10.14",
1551
- "0.10.15"
1567
+ "0.10.15",
1568
+ "0.10.16"
1552
1569
  ],
1553
1570
  "rightkit-qa-driver": [
1554
1571
  "0.3.0",
@@ -1672,7 +1689,8 @@
1672
1689
  ],
1673
1690
  "rightkit-system-monitor": [
1674
1691
  "0.3.0",
1675
- "0.3.1"
1692
+ "0.3.1",
1693
+ "0.3.2"
1676
1694
  ],
1677
1695
  "rightkit-tauri": [
1678
1696
  "0.1.1"
@@ -1688,7 +1706,8 @@
1688
1706
  "0.8.2",
1689
1707
  "0.8.7",
1690
1708
  "0.8.9",
1691
- "0.8.10"
1709
+ "0.8.10",
1710
+ "0.8.11"
1692
1711
  ],
1693
1712
  "rightkit-text-polish": [
1694
1713
  "0.1.1",
@@ -1777,7 +1796,8 @@
1777
1796
  ],
1778
1797
  "rightkit-disk-cleanup": [
1779
1798
  "0.2.0",
1780
- "0.2.1"
1799
+ "0.2.1",
1800
+ "0.2.2"
1781
1801
  ],
1782
1802
  "rightkit-agent-task-journal": [
1783
1803
  "0.1.0"
package/smoke-run.mjs ADDED
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ // The host smoke for a peer promote (rustright-install `trusted-gate promote --peer-result --smoke`; rightkit#1848; Adrian, 27 Nov 2026: "yes promote mac").
3
+ // A host that cannot run the GC-A27 acceptance (the Mac: no process record, a Windows cases file) trusts a candidate gate on a pinned peer's passing result for
4
+ // the same archive bytes, plus this smoke, written here and verified by the installer:
5
+ // - the candidate's gate prints the archive's version;
6
+ // - the runtime manifest read through the agent shim names the broker running here;
7
+ // - one real compile through this host's broker with the candidate gate, every broker job tagged with the contract-run nonce
8
+ // (RK_GATE_CONTRACT_*: each job's signed nonce is contractJobNonce(runId, sealed, "smoke", call), the definition RustRight's job_nonce shares), so the
9
+ // installer can bind each signed claim to this candidate and a smoke for another candidate (or an earlier one) does not verify.
10
+ // It writes rightkit.host-smoke/1 and its job-claims/ beside it. Exit 0 when the smoke is written, whether or not it passed: the verdict is in the record.
11
+ //
12
+ // node smoke-run.mjs --sealed <candidate sha256> --managed <managed root> --repo <primary checkout> --out <dir> [--host mac] [--commit <sha>] [--unit cargo:rightkit-<name> | --unit none]
13
+ // --unit none compiles the whole repository (`--to compile`): a repository without a committed .rightkit-local-build.json, such as rk-witness-fixture,
14
+ // takes no unit (the gate refuses a unit there). --commit defaults to the repository's HEAD.
15
+ import fs from "node:fs";
16
+ import path from "node:path";
17
+ import crypto from "node:crypto";
18
+ import { spawnSync } from "node:child_process";
19
+ import { pathToFileURL } from "node:url";
20
+ import { CONTRACT_JOBS_ENV, CONTRACT_RUN_ID_ENV, CONTRACT_SEALED_ENV, CONTRACT_STEP_ENV } from "./gate-seam.mjs";
21
+ import { claimOf } from "./acceptance-result.mjs";
22
+
23
+ export const SMOKE_SCHEMA = "rightkit.host-smoke/1";
24
+ export const SMOKE_STEP = "smoke";
25
+ const HEX64 = /^[0-9a-f]{64}$/;
26
+
27
+ /** The `rustright` client on PATH (the agent shim on the Mac), or null. */
28
+ export function rustrightOnPath({ env = process.env, platform = process.platform, exists = fs.existsSync } = {}) {
29
+ const names = platform === "win32" ? ["rustright.exe", "rustright.cmd"] : ["rustright"];
30
+ for (const dir of String(env.PATH ?? env.Path ?? "").split(path.delimiter).filter(Boolean)) for (const name of names) { const file = path.join(dir, name); if (exists(file)) return file; }
31
+ return null;
32
+ }
33
+
34
+ /** The claims of the tagged jobs a gate launch filed in `jobsFile`: { id, bytes, sha256, call } each, read from the broker receipt each job names. */
35
+ export function claimsOfJobs(jobsFile, { read = (f) => fs.readFileSync(f, "utf8") } = {}) {
36
+ let text = ""; try { text = read(jobsFile); } catch { return { claims: [], problems: [`no tagged job was filed (${jobsFile} is missing)`] }; }
37
+ const claims = []; const problems = [];
38
+ for (const line of text.split(/\r?\n/).filter(Boolean)) {
39
+ let job; try { job = JSON.parse(line); } catch { problems.push("a filed job is not JSON"); continue; }
40
+ let receipt = job.receipt;
41
+ if (typeof receipt === "string") { try { receipt = JSON.parse(read(receipt)); } catch { problems.push(`job ${job.requestId}: its receipt ${job.receipt} cannot be read`); continue; } }
42
+ const claim = receipt && typeof receipt === "object" ? claimOf(receipt) : null;
43
+ if (!claim) { problems.push(`job ${job.requestId ?? "(no id)"}: no broker claim in its receipt`); continue; }
44
+ if (job.requestId && claim.id !== job.requestId) { problems.push(`job ${job.requestId}: its receipt is for job ${claim.id}`); continue; }
45
+ claims.push({ ...claim, call: String(job.call ?? "") });
46
+ }
47
+ return { claims, problems };
48
+ }
49
+
50
+ /** Builds the smoke record from what was observed. `pass` holds only when every observation is present and the compile passed with at least one signed job. */
51
+ export function buildSmoke({ runId, host, sealed, archive, versionPrinted, runtimeBrokerDigest, commit, tree, compileExit, claims, problems }) {
52
+ const all = [...problems];
53
+ if (versionPrinted !== archive.version) all.push(`the candidate's gate printed ${JSON.stringify(versionPrinted)}, the archive is ${archive.version}`);
54
+ if (!HEX64.test(String(runtimeBrokerDigest ?? ""))) all.push("the runtime manifest names no broker digest");
55
+ if (compileExit !== 0) all.push(`the compile through the broker exited ${compileExit}`);
56
+ if (!claims.length) all.push("no signed broker job: nothing in the smoke is signed");
57
+ return {
58
+ schema: SMOKE_SCHEMA, runId, host, pass: all.length === 0, problems: all,
59
+ gate: { sealedSha256: sealed, archiveIntegrity: archive.integrity, archiveVersion: archive.version },
60
+ versionPrinted, runtimeBrokerDigest, commit, tree,
61
+ jobs: claims.map((c) => ({ requestId: c.id, claimSha256: c.sha256, call: c.call })), jobClaims: "job-claims",
62
+ };
63
+ }
64
+
65
+ export async function main(argv = process.argv.slice(2), { out = console.log } = {}) {
66
+ const opt = (name) => { const i = argv.indexOf(name); return i < 0 ? null : argv[i + 1]; };
67
+ const sealed = opt("--sealed"); const managed = opt("--managed"); const repo = opt("--repo"); const outDir = opt("--out");
68
+ const host = opt("--host") ?? (process.platform === "darwin" ? "mac" : process.platform === "win32" ? "dell" : "linux"); const unit = opt("--unit") ?? "cargo:rightkit-time"; const wantCommit = opt("--commit");
69
+ if (!HEX64.test(String(sealed)) || !managed || !repo || !outDir) { out("usage: smoke-run.mjs --sealed <candidate sha256> --managed <root> --repo <primary RightKit checkout> --out <dir> [--host mac] [--unit cargo:rightkit-time]"); return 2; }
70
+ const candidate = path.join(managed, "trusted-gates", "candidates", sealed);
71
+ const release = path.join(candidate, "node_modules", "@rightkit", "release");
72
+ const gate = path.join(release, "bin", "rightkit-gate.mjs");
73
+ const source = JSON.parse(fs.readFileSync(path.join(candidate, "trusted-gate-source.json"), "utf8"));
74
+ const archive = { version: String(source.version ?? ""), integrity: String(source.integrity ?? "") };
75
+ fs.mkdirSync(path.join(outDir, "job-claims"), { recursive: true });
76
+ const problems = [];
77
+ const printed = spawnSync(process.execPath, [gate, "--version"], { encoding: "utf8", windowsHide: true });
78
+ const versionPrinted = String(printed.stdout ?? "").trim().split(/\r?\n/).pop() ?? "";
79
+ // The candidate's own runtimeManifestPathOf (follows the agent shim to the client it starts), so the smoke reads the manifest the way that gate will.
80
+ let runtimeBrokerDigest = null;
81
+ const client = rustrightOnPath();
82
+ if (!client) problems.push("no rustright client on PATH");
83
+ else {
84
+ try {
85
+ const { runtimeManifestPathOf } = await import(pathToFileURL(path.join(release, "seam-broker.mjs")).href);
86
+ runtimeBrokerDigest = JSON.parse(fs.readFileSync(runtimeManifestPathOf(client), "utf8")).brokerDigest ?? null;
87
+ } catch (error) { problems.push(`the runtime manifest beside ${client} cannot be read: ${error.message}`); }
88
+ }
89
+ const git = (args) => String(spawnSync("git", ["-C", repo, ...args], { encoding: "utf8", windowsHide: true }).stdout ?? "").trim();
90
+ const commit = git(["rev-parse", wantCommit ?? "HEAD"]); const tree = git(["rev-parse", `${commit}^{tree}`]);
91
+ const runId = crypto.randomBytes(32).toString("hex");
92
+ const jobsFile = path.join(path.resolve(outDir), "jobs.jsonl");
93
+ const log = fs.openSync(path.join(outDir, "compile.log"), "w");
94
+ const compiled = spawnSync(process.execPath, [gate, "--to", "compile", ...(unit === "none" ? [] : ["--unit", unit]), "--commit", commit], {
95
+ cwd: repo, windowsHide: true, stdio: ["ignore", log, log],
96
+ env: { ...process.env, [CONTRACT_RUN_ID_ENV]: runId, [CONTRACT_SEALED_ENV]: sealed, [CONTRACT_STEP_ENV]: SMOKE_STEP, [CONTRACT_JOBS_ENV]: jobsFile },
97
+ });
98
+ fs.closeSync(log);
99
+ const { claims, problems: jobProblems } = claimsOfJobs(jobsFile);
100
+ for (const c of claims) fs.writeFileSync(path.join(outDir, "job-claims", `${c.id}.json`), c.bytes);
101
+ const smoke = buildSmoke({ runId, host, sealed, archive, versionPrinted, runtimeBrokerDigest, commit, tree, compileExit: compiled.status, claims, problems: [...problems, ...jobProblems] });
102
+ fs.writeFileSync(path.join(outDir, "smoke.json"), `${JSON.stringify(smoke, null, 2)}\n`);
103
+ out(`smoke written: ${path.join(outDir, "smoke.json")} (pass ${smoke.pass}, ${claims.length} signed job(s)${smoke.problems.length ? `; ${smoke.problems.join("; ")}` : ""})`);
104
+ return 0;
105
+ }
106
+
107
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) process.exitCode = await main();
package/snapshot.mjs CHANGED
@@ -491,7 +491,7 @@ function sha256File(file) {
491
491
  return h.digest("hex");
492
492
  }
493
493
 
494
- function inspectSnapshot({ dir, entries, checkout, commit, platform = process.platform, originUrl, ledger, admitNew = false }) {
494
+ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.platform, originUrl, ledger, admitNew = false, staleDeps = null }) {
495
495
  const problem = (message) => ({ problem: message, admitted: [] });
496
496
  const ledgerMode = ledger !== undefined || admitNew === true;
497
497
  const fold = foldFor(platform);
@@ -505,6 +505,7 @@ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.pl
505
505
  let realDir; let realCheckout = checkout;
506
506
  try { realDir = fs.realpathSync.native(dir); } catch (e) { return problem(`${dir} cannot be resolved: ${e.message}`); }
507
507
  try { realCheckout = fs.realpathSync.native(checkout); } catch { /* the path as given */ }
508
+ const resolves = (p) => { try { fs.realpathSync.native(p); return true; } catch { return false; } };
508
509
  const linkProblem = (rel, p) => {
509
510
  let real;
510
511
  try { real = fs.realpathSync.native(p); } catch { return `${rel} is a link that does not resolve (dangling or looping); it cannot be proven to stay inside the snapshot`; }
@@ -606,10 +607,15 @@ function inspectSnapshot({ dir, entries, checkout, commit, platform = process.pl
606
607
  if (e.isSymbolicLink()) {
607
608
  // The landing is named first when it is the worse news (into the checkout, out of the snapshot); a link the commit lacks is refused either way.
608
609
  found = linkProblem(r, p);
610
+ // 0.6.94, the sync only (`staleDeps`): a link inside an installed dependency directory that resolves nowhere is what an install of an earlier commit left
611
+ // (a workspace package the commit no longer has; the Mac, 2026-11-29: node_modules/.pnpm/node_modules/@rightkit/lint). It is no refusal there: the
612
+ // dependency directory that holds it is named, the sync removes that directory and the next install writes it again. A link that lands in the checkout
613
+ // or outside the snapshot stays a refusal, and so does every unresolved link for every other caller.
614
+ if (found && inDeps && staleDeps && !resolves(p)) { staleDeps.push(inDeps); found = null; }
609
615
  if (!found && !inDeps) found = !byKey.has(key) ? (ledgerMode ? `${r} is a link the commit does not have: a link is never admitted to the stage-output ledger` : `${r} is not in the commit's tree (a link the commit does not have)`) : fileProblem(r, p, byKey.get(key));
610
616
  } else if (e.isDirectory()) {
611
- if (inDeps) found = walk(p, r, true);
612
- else if (deps.has(key)) { depRoots.push(p); found = walk(p, r, true); }
617
+ if (inDeps) found = walk(p, r, inDeps);
618
+ else if (deps.has(key)) { depRoots.push(p); found = walk(p, r, p); }
613
619
  else if (dirs.has(key)) found = walk(p, r, false);
614
620
  else if (key === ".git") found = gitConfigProblem(r, p);
615
621
  else found = ledgerMode ? candidateDir(p, r) : `${r} is not in the commit's tree (a directory the commit does not have)`;
@@ -1361,8 +1367,25 @@ export function syncSnapshot({ checkout, rev = "HEAD", root = snapshotRoot(), ma
1361
1367
  // NN11: this walk and hash are a proof like any other, and the first of the run. The open gate process is told (its change generation is
1362
1368
  // taken before the walk, so a change during the proof refuses the record), and every later proof of this run starts from it instead of
1363
1369
  // hashing the tree again. On a host's managed root only: a test's temporary root has no such process (`resident` is the transport, for tests).
1364
- const residentGeneration = resident ? beginResidentProof(dir, { ask: resident }) : null;
1365
- const extra = snapshotProblem({ dir, entries, checkout: repo.checkout, commit });
1370
+ let residentGeneration = resident ? beginResidentProof(dir, { ask: resident }) : null;
1371
+ // 0.6.94: installed dependency directories the sync kept that hold a link resolving nowhere are removed here (not followed: rmSync unlinks a link itself), and the
1372
+ // proof starts again; removing one can leave a member's links without a landing, so it repeats until a walk names none. The walk that ends it names none, so it
1373
+ // is the same proof as before; the install that follows finds the directory gone and installs (GC-A24, snapshot-check.mjs).
1374
+ const staleDeps = [];
1375
+ let extra = snapshotProblem({ dir, entries, checkout: repo.checkout, commit, staleDeps });
1376
+ for (let round = 0; !extra && staleDeps.length && round < 64; round += 1) {
1377
+ for (const depDir of new Set(staleDeps.splice(0))) {
1378
+ const st = fs.lstatSync(depDir, { throwIfNoEntry: false });
1379
+ if (!st) continue;
1380
+ if (!st.isDirectory() || !inside(depDir, dir)) throw new SnapshotError("mismatch", `snapshot ${dir}: the dependency directory ${depDir} holds a link that does not resolve and is not a real directory inside the snapshot`);
1381
+ fs.rmSync(depDir, { recursive: true, force: true });
1382
+ // NN22: named first, so the sync line shows it whatever else the sync removed.
1383
+ removed += 1; removedPaths.unshift(`${path.relative(dir, depDir).split(path.sep).join("/")}/ (an installed dependency directory holding a link that resolves nowhere)`);
1384
+ }
1385
+ residentGeneration = resident ? beginResidentProof(dir, { ask: resident }) : null;
1386
+ extra = snapshotProblem({ dir, entries, checkout: repo.checkout, commit, staleDeps });
1387
+ }
1388
+ if (!extra && staleDeps.length) extra = snapshotProblem({ dir, entries, checkout: repo.checkout, commit });
1366
1389
  if (extra) throw new SnapshotError("mismatch", `snapshot ${dir} is not exactly commit ${commit} after sync: ${extra}`);
1367
1390
  const actual = snapshotTree({ checkout: repo.checkout, dir, baseTree: tree, repo });
1368
1391
  if (actual !== tree) throw new SnapshotError("mismatch", `snapshot ${dir} is tree ${actual} after sync, not tree ${tree} of commit ${commit}`);