@rightkit/release 0.6.80 → 0.6.82

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.
@@ -0,0 +1 @@
1
+ d6670e755e3c857aac3b7395a692b2760754b64b00cc4ab793db02db8fc4128d rightkit-swap
@@ -2367,7 +2367,18 @@ async function runStages(o, args, root, git, io) {
2367
2367
  else o.out(`${tag} [compile] release admission dry-run skipped here: no broker receipt names the Cargo target of ${uncovered.length ? uncovered.map((w) => path.relative(root, w).replaceAll("\\", "/") || ".").join(", ") : "the app"} yet; the package stage's build runs the same admission rows at its start`);
2368
2368
  }
2369
2369
  let compiledDirs = []; let compiledBins = null; let qualifyOwed = []; let limitedEvidence = [];
2370
- const reportOutputs = (dirs, bins = null) => { compiledDirs = [...dirs]; compiledBins = bins; };
2370
+ const reportOutputs = (dirs, bins = null, byCargoDir = []) => {
2371
+ compiledDirs = [...dirs]; compiledBins = bins;
2372
+ // The compile's broker output folder of each Cargo workspace joins the door run's known outputs (keyed by checkout workspace, as the stage
2373
+ // carriers file theirs): the package stage's map hands them to its first resolution (stage-seam.mjs carriedOutputDir knownOutputDirs).
2374
+ // A folder a stage carrier already recorded for that workspace stays: it is the one the app's own build used.
2375
+ if (!ds) return;
2376
+ let checkoutReal = root; try { checkoutReal = fs.realpathSync.native(root); } catch { /* as given */ }
2377
+ for (const [cargoDir, dir] of byCargoDir) {
2378
+ const key = path.join(checkoutReal, ...(cargoDir === "." ? [] : cargoDir.split("/")));
2379
+ if (!ds.carriedOutputs?.has(key)) (ds.carriedOutputs ??= new Map()).set(key, dir);
2380
+ }
2381
+ };
2371
2382
  if (ok) ok = (await (o.runCompile ?? (() => main(ds ? ["--all", "--commit", commit, "--snapshot", ds.path] : ["--all"], { ...io, cwd: root, readStdin: () => "", ...(ds ? { snapshotLock: ds.lock, classAEarlier: true, seamScope: appDir === "." ? null : [appDir], snapshotLedger: ds.ledger?.entries ?? [], onCompileLedger: (entries) => { ds.compileAdmitted = entries; }, onDirectReceipt: (r) => { directReceipt = r; }, onCompileOutputs: reportOutputs, onQualifyOwed: (list) => { qualifyOwed = list; }, onLimitedEvidence: (list) => { limitedEvidence = list; } } : {}) })))({ reportOutputs })) === 0;
2372
2383
  if (directReceipt) extra = { ...extra, direct: directReceipt };
2373
2384
  // What the plan left to the qualify stage is recorded with the compile, so qualification can prove it is not lost (rightkit#1332, #1333).
@@ -3193,7 +3204,7 @@ async function committedCargoManifests({ o, git, root, commit, scopeDirs, extraW
3193
3204
  const npm = discoverNpmUnits({ root, tracked, readFile, exists });
3194
3205
  const closure = tools.closureOf({ scopeDirs, npmUnits: npm, rustUnits: inventory.units, readFile: readCommitted });
3195
3206
  // Workspaces the unit's own compile builds beside its closure (a crate's consumer rows under ci/consumers/): bound when the commit tracks their manifest.
3196
- const extra = extraWorkspaces.filter((dir) => fileSet.has(`${dir}/Cargo.toml`));
3207
+ const extra = extraWorkspaces.filter((dir) => fileSet.has(dir === "." ? "Cargo.toml" : `${dir}/Cargo.toml`));
3197
3208
  const workspaces = [...new Set([...inventory.units.filter((u) => closure.rust.has(u.name)).map((u) => u.cargoDir), ...extra])].sort();
3198
3209
  o.out(`rightkit-gate: Cargo output scope ${scopeDirs.join(", ")}: ${workspaces.length} workspace(s) (${workspaces.join(", ") || "none"}); dependency directories ${closure.dependencyDirs.join(", ")}`);
3199
3210
  return { manifests: workspaces.map((dir) => path.posix.join(dir, "Cargo.toml")), hasCargo: allManifests.length > 0 };
@@ -3437,7 +3448,9 @@ async function runUnitSnapshot(o, args, root, git, io, option) {
3437
3448
  }
3438
3449
  // The gate package's package stage on the Mac builds and signs its swap helper from crates/rightkit-fs (local-publish.mjs prepareSwapHelper), so that
3439
3450
  // Cargo workspace is bound beside the package's own (0.6.80 on the Mac: RK_CARGO_UNBOUND_WORKSPACE "resolved (none)" for the helper build).
3440
- if (selector === "npm:@rightkit/release" && o.platform === "darwin") consumerScope = [...new Set([...consumerScope, "crates/rightkit-fs"])];
3451
+ // rightkit-fs is a member of the repository's one Cargo workspace (the root Cargo.toml), so the workspace bound is the root ".", not the crate's folder:
3452
+ // binding "crates/rightkit-fs" left the root manifest out of the walk and bound the crate folder, which Cargo never resolves to (0.6.81 on the Mac).
3453
+ if (selector === "npm:@rightkit/release" && o.platform === "darwin") consumerScope = [...new Set([...consumerScope, "."])];
3441
3454
  const bound = option("--to") === "check" || privateUnit.private ? { env: {}, cleanup() {} } : await bindUnitCargo({ o, git, root, ds, executor, which, scopeDirs: [path.posix.dirname(manifest)], extraWorkspaces: consumerScope, ...(toolRun ? { onlyWorkspaces: [path.posix.dirname(manifest)] } : {}) });
3442
3455
  if (bound.refusal) { o.err(`${tag} BLOCKED: RK_SNAPSHOT_OUTPUT_UNPINNED: ${bound.refusal}; nothing ran`); return 1; }
3443
3456
  if (bound.note) o.out(`${tag} ${bound.note}`);
@@ -5881,7 +5894,10 @@ export async function main(argv, io = {}) {
5881
5894
  note: (text) => o.out(`${tag} built programs: ${text}`),
5882
5895
  });
5883
5896
  const outputWorkspaces = (snapshotBroker ? scanResult.scans.map((r) => r.snapshotEvidence?.outputDir) : Object.values(targetDirs ?? {})).filter(Boolean).map((dir) => [dir]);
5884
- o.onCompileOutputs?.(outputWorkspaces.map(([dir]) => dir), builtBins);
5897
+ // Each broker row's output folder with its Cargo workspace (repository-relative), so a later stage of the same door run can resolve that workspace's
5898
+ // target before its own first Cargo call (a multi-workspace app's package admission, CodeRight on the Mac 0.6.80: RK_SPLIT_TARGET_UNRESOLVED).
5899
+ const outputsByCargoDir = snapshotBroker ? scanResult.scans.flatMap((r) => { const unit = unitByName.get(rustUnitOfScanId(r.id, known)); const dir = r.snapshotEvidence?.outputDir; return typeof unit?.cargoDir === "string" && typeof dir === "string" && dir ? [[unit.cargoDir, dir]] : []; }) : [];
5900
+ o.onCompileOutputs?.(outputWorkspaces.map(([dir]) => dir), builtBins, outputsByCargoDir);
5885
5901
  o.out(`${tag} class B keying: ${ROW_DIGEST_STATS.misses} row digest(s) computed in ${(ROW_DIGEST_STATS.ms / 1000).toFixed(1)} s, ${ROW_DIGEST_STATS.hits} reused`);
5886
5902
  if (snapshotBroker) o.out(`${tag} broker compile: ${new Set(scanResult.scans.map((r) => r.snapshotEvidence?.requestId).filter(Boolean)).size} carried request(s) with verified signed receipts (${scanResult.scans.filter((r) => r.snapshotEvidence).length} scan row(s)); no direct receipt on a broker host`);
5887
5903
  else {
package/install-app.mjs CHANGED
@@ -7,6 +7,7 @@ import { detachWithRetry } from "./hdiutil-detach.mjs";
7
7
  import { previousPathOf } from "./in-place-install.mjs";
8
8
  import { assertShippedSwapHelperSigned } from "./swap-helper-bundle.mjs";
9
9
  import { installAppWindows, InstallAppWindowsError } from "./install-app-windows.mjs";
10
+ import { createHash } from "node:crypto";
10
11
  import fs from "node:fs";
11
12
  import os from "node:os";
12
13
  import path from "node:path";
@@ -253,13 +254,31 @@ function coded(code, message) {
253
254
  // A helper that exists must be code-signed (#258): an unsigned one is a typed SWAP_HELPER_UNSIGNED error naming the fix,
254
255
  // never a silent downgrade. No helper at all keeps the documented journaled two-rename fallback, which is logged
255
256
  // (`swap-fallback`, then `replaced {swap}`).
257
+ /**
258
+ * The committed helper reaches a Mac without its executable bit when the gate package was packed on Windows (no mode bits there; 0.6.81), and an
259
+ * installed gate's folder is read-only. Such a helper runs as a private copy with mode 0755 under the temporary folder, named by its sha256; the
260
+ * copy keeps the embedded code signature, which was checked on the shipped file. An executable helper, or any failure here, runs as it is.
261
+ */
262
+ export function runnableHelper(helper, { fsImpl = fs, tmp = os.tmpdir() } = {}) {
263
+ try {
264
+ if (process.platform === "win32" || (fsImpl.statSync(helper).mode & 0o111) !== 0) return helper;
265
+ const bytes = fsImpl.readFileSync(helper);
266
+ const copy = path.join(tmp, `rightkit-swap-${createHash("sha256").update(bytes).digest("hex").slice(0, 16)}`);
267
+ let ready = false;
268
+ try { ready = fsImpl.readFileSync(copy).equals(bytes) && (fsImpl.statSync(copy).mode & 0o111) !== 0; } catch { ready = false; }
269
+ if (!ready) { fsImpl.writeFileSync(copy, bytes, { mode: 0o755 }); fsImpl.chmodSync(copy, 0o755); }
270
+ return copy;
271
+ } catch { return helper; }
272
+ }
273
+
256
274
  export function createSwapPaths({ env = process.env, resolve = resolveSwapHelper, execFileSync = nodeExecFileSync, assertSigned = assertShippedSwapHelperSigned } = {}) {
257
275
  const checked = new Set();
258
276
  return (a, b) => {
259
277
  const helper = resolve({ env });
260
278
  if (!helper) throw coded("ENOHELPER", `${SWAP_HELPER_NAME} helper not found`);
261
279
  if (!checked.has(helper)) { assertSigned({ file: helper, execFileSync }); checked.add(helper); }
262
- try { execFileSync(helper, [a, b], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }); }
280
+ const program = runnableHelper(helper);
281
+ try { execFileSync(program, [a, b], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }); }
263
282
  catch (error) {
264
283
  const text = `${error?.stderr || ""}`.trim();
265
284
  if (error?.code === "ENOENT" || error?.code === "EACCES") throw coded("ENOHELPER", `${helper} cannot run: ${error.code}`);
package/local-publish.mjs CHANGED
@@ -267,7 +267,12 @@ const defaultReadJson = (file) => { try { return JSON.parse(fs.readFileSync(file
267
267
 
268
268
  async function defaultRegistryHas({ kind, name, version }) {
269
269
  if (kind === "npm") {
270
- const view = spawnSync("npm", ["view", `${name}@${version}`, "version", "--prefer-online", "--registry", "https://registry.npmjs.org/"], { encoding: "utf8", windowsHide: true });
270
+ // npm is a .cmd shim on Windows, which Node starts only through cmd.exe: started directly it never ran and the error was empty (0.6.81 on the
271
+ // Dell, the first npm unit packaged there). The arguments are a validated package name, a version and a fixed URL.
272
+ const args = ["view", `${name}@${version}`, "version", "--prefer-online", "--registry", "https://registry.npmjs.org/"];
273
+ const view = process.platform === "win32"
274
+ ? spawnSync(process.env.ComSpec || "cmd.exe", ["/d", "/s", "/c", "npm", ...args], { encoding: "utf8", windowsHide: true })
275
+ : spawnSync("npm", args, { encoding: "utf8", windowsHide: true });
271
276
  const out = `${view.stdout ?? ""}${view.stderr ?? ""}`;
272
277
  if (!view.error && view.status === 0) return (view.stdout ?? "").trim() === version;
273
278
  if (/E404|404 Not Found/i.test(out)) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.80",
3
+ "version": "0.6.82",
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",
@@ -87,7 +87,8 @@
87
87
  "!gate/*.test.mjs",
88
88
  "!standalone-clone-evidence.json",
89
89
  "!refusals.json",
90
- "!provenance-real-receipt.fixture.json"
90
+ "!provenance-real-receipt.fixture.json",
91
+ "acceptance-lines.test.mjs"
91
92
  ],
92
93
  "sideEffects": false,
93
94
  "publishConfig": {
@@ -104,7 +105,7 @@
104
105
  "smol-toml": "1.9.1"
105
106
  },
106
107
  "scripts": {
107
- "test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs acceptance-cases.test.mjs rule-verdict-cache.test.mjs class-b-dispatch.test.mjs remember-reads.test.mjs sidecar-source.test.mjs caller-levers.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 publish-local-npm.test.mjs shell-contract-hub-window.test.mjs cargo-license-notices-paths.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",
108
+ "test": "node --test acceptance-admission.test.mjs acceptance-lines.test.mjs acceptance-cases.test.mjs rule-verdict-cache.test.mjs class-b-dispatch.test.mjs remember-reads.test.mjs sidecar-source.test.mjs caller-levers.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 publish-local-npm.test.mjs shell-contract-hub-window.test.mjs cargo-license-notices-paths.test.mjs rightkit-freshness-direct.test.mjs swap-helper-committed.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",
108
109
  "test:registry-parity": "node registry-parity.mjs --allow-unpublished",
109
110
  "test:signer:windows": "node sign-release-manifest.integration.mjs",
110
111
  "verify:standalone": "node standalone-clone-verify.mjs"
@@ -187,27 +187,68 @@ function manifestRoots(root, extraLocks) {
187
187
  /** RightKit dependencies the manifests under root declare (Cargo.toml, package.json): the inputs that need lock proof. */
188
188
  export function declaredRightKitDependencies(root, owned, extraLocks = []) {
189
189
  const found = [];
190
- const take = (ecosystem, name, file, local = false) => {
191
- if (owned[ecosystem].has(name)) found.push({ ecosystem, name, file });
192
- else if (prefixed(ecosystem, name) && !local) found.push({ ecosystem, name, file });
190
+ const take = (ecosystem, name, file, local = false, requirement = null) => {
191
+ if (owned[ecosystem].has(name)) found.push({ ecosystem, name, file, requirement });
192
+ else if (prefixed(ecosystem, name) && !local) found.push({ ecosystem, name, file, requirement });
193
193
  };
194
194
  for (const file of manifestRoots(root, extraLocks).flatMap((dir) => scanFiles(dir, new Set(["Cargo.toml", "package.json"])))) {
195
195
  try {
196
196
  if (path.basename(file) === "package.json") {
197
197
  const pkg = JSON.parse(readFileSync(file, "utf8"));
198
198
  // A git/file/link/workspace specifier never resolves from the registry; the package-contract validator refuses it by name.
199
- for (const section of NPM_DEP_SECTIONS) for (const [name, spec] of Object.entries(pkg[section] ?? {})) if (!/[:/]/.test(String(spec))) take("npm", name, file);
199
+ for (const section of NPM_DEP_SECTIONS) for (const [name, spec] of Object.entries(pkg[section] ?? {})) if (!/[:/]/.test(String(spec))) take("npm", name, file, false, String(spec));
200
200
  } else {
201
201
  const doc = parseToml(readFileSync(file, "utf8"));
202
202
  const tables = [...MANIFEST_DEP_TABLES.map((t) => doc[t]), doc.workspace?.dependencies, ...Object.values(doc.target ?? {}).flatMap((target) => MANIFEST_DEP_TABLES.map((t) => target?.[t]))];
203
203
  // A path or workspace dependency on an unowned prefixed name is app-local (see collectLockedRightKit).
204
- for (const table of tables) for (const [key, spec] of Object.entries(table ?? {})) take("cargo", typeof spec === "object" && spec && typeof spec.package === "string" ? spec.package : key, file, typeof spec === "object" && spec !== null && (typeof spec.path === "string" || spec.workspace === true));
204
+ for (const table of tables) for (const [key, spec] of Object.entries(table ?? {})) take("cargo", typeof spec === "object" && spec && typeof spec.package === "string" ? spec.package : key, file, typeof spec === "object" && spec !== null && (typeof spec.path === "string" || spec.workspace === true), typeof spec === "string" ? spec : typeof spec?.version === "string" ? spec.version : null);
205
205
  }
206
206
  } catch { /* an unreadable manifest is the manifest validators' finding */ }
207
207
  }
208
208
  return found;
209
209
  }
210
210
 
211
+
212
+ /**
213
+ * Whether `version` satisfies a declared requirement, read as the ecosystem reads it: Cargo's bare "0.5.0" is "^0.5.0", npm's is exact;
214
+ * "=", "^", "~", ">=", ">", "<=", "<" and Cargo's comma-joined sets are understood. Returns null when the requirement is not one of these
215
+ * (a tag, a range with spaces or "||", a wildcard), so the caller can stay conservative.
216
+ */
217
+ export function satisfiesRequirement(version, requirement, ecosystem) {
218
+ const parse = (v) => { const m = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-[0-9A-Za-z.-]+)?$/.exec(String(v).trim()); return m ? { parts: [Number(m[1]), m[2] === undefined ? null : Number(m[2]), m[3] === undefined ? null : Number(m[3])] } : null; };
219
+ const full = parse(version);
220
+ if (!full || full.parts.includes(null)) return null;
221
+ const [a, b, c] = full.parts;
222
+ const cmp = (x) => { const p = x.parts.map((n) => n ?? 0); return a !== p[0] ? (a < p[0] ? -1 : 1) : b !== p[1] ? (b < p[1] ? -1 : 1) : c !== p[2] ? (c < p[2] ? -1 : 1) : 0; };
223
+ const one = (text) => {
224
+ const m = /^(=|\^|~|>=|<=|>|<)?\s*v?(\S+)$/.exec(text.trim());
225
+ if (!m) return null;
226
+ const op = m[1] ?? (ecosystem === "cargo" ? "^" : "=");
227
+ const req = parse(m[2]);
228
+ if (!req) return null;
229
+ const [x, y, z] = req.parts;
230
+ if (op === "=") return a === x && (y === null || b === y) && (z === null || c === z);
231
+ if (op === ">=") return cmp(req) >= 0;
232
+ if (op === ">") return cmp(req) > 0;
233
+ if (op === "<=") return cmp(req) <= 0;
234
+ if (op === "<") return cmp(req) < 0;
235
+ if (op === "~") return cmp(req) >= 0 && a === x && (y === null || b === y);
236
+ // Caret: the left-most non-zero part is fixed.
237
+ if (cmp(req) < 0) return false;
238
+ if (x !== 0) return a === x;
239
+ if (y === null) return a === 0;
240
+ if (y !== 0) return a === 0 && b === y;
241
+ if (z === null) return a === 0 && b === 0;
242
+ return a === 0 && b === 0 && c === z;
243
+ };
244
+ const text = String(requirement ?? "").trim();
245
+ if (!text || /\|\||\*|\bx\b/.test(text)) return null;
246
+ const parts = ecosystem === "cargo" ? text.split(",") : [text];
247
+ if (ecosystem !== "cargo" && /\s/.test(text)) return null;
248
+ const results = parts.map(one);
249
+ return results.includes(null) ? null : results.every(Boolean);
250
+ }
251
+
211
252
  /** Declared RightKit dependencies that no lock entry proves: no bundled-only fallback. */
212
253
  export function coverageProblems(declared, lockedEntries) {
213
254
  const have = new Set(lockedEntries.map((e) => `${e.ecosystem}\0${e.name}`));
@@ -661,7 +702,20 @@ function holdFor(holds, name) {
661
702
  * (`tasks`), never permission to seal a stale pin; no exception is derived from right-update's hold list.
662
703
  * - otherwise (doctor): the same rows are informational `newer` lines.
663
704
  */
664
- export function evaluateRightKitFreshness(snapshot, holds, { enforce = false } = {}) {
705
+ export function evaluateRightKitFreshness(snapshot, holds, { enforce = false, declared = null } = {}) {
706
+ // `declared`: the RightKit names the app's own manifests declare (`${ecosystem}\0${name}`). A stale entry the app does not declare is a
707
+ // transitive lock entry: only the RightKit units that depend on it can move it, so it is reported, never refused (Pulse 0.6.80: rightkit-fs
708
+ // 0.4.19, required ^0.4 by the latest rightkit-http, -pdf and others). With no set given every entry is judged as before.
709
+ const isDirect = (entry) => {
710
+ if (!declared) return true;
711
+ const reqs = declared.get(`${entry.ecosystem}\0${entry.name}`);
712
+ if (!reqs) return false;
713
+ // Declared by name: direct only when its version meets one of the app's own requirements for that name (Pulse 0.6.81: it declares
714
+ // rightkit-fs =0.5.0, and the 0.4.19 the latest rightkit-http still pulls in is transitive). A name declared with no readable
715
+ // requirement (a workspace-inherited entry, an unparsed range) stays direct.
716
+ const verdicts = reqs.map((r) => (r === null ? null : satisfiesRequirement(entry.version, r, entry.ecosystem)));
717
+ return verdicts.includes(true) || verdicts.every((v) => v === null);
718
+ };
665
719
  const refusals = [];
666
720
  const newer = [];
667
721
  const tasks = [];
@@ -673,6 +727,10 @@ export function evaluateRightKitFreshness(snapshot, holds, { enforce = false } =
673
727
  const seen = newest.get(`${entry.ecosystem}\0${entry.name}`);
674
728
  if (!seen || compareVersions(entry.version, seen.latest) >= 0) continue;
675
729
  const age = seen.via === "cache" ? ` (latest from cached observation ${seen.observedAt}, ${formatAge(seen.ageMs)} old; last-observed, not current)` : "";
730
+ if (!isDirect(entry)) {
731
+ warnings.push(`${entry.name} ${entry.version} is in the lock only through other RightKit units (latest ${seen.latest}${age}); the app does not declare it, so it moves when those units republish on the new version`);
732
+ continue;
733
+ }
676
734
  const hold = holdFor(holds, entry.name);
677
735
  const line = `${entry.name} pinned ${entry.version} -> latest ${seen.latest}${age}: ${FIX}`;
678
736
  if (hold) tasks.push(`${entry.name} pinned ${entry.version}, latest ${seen.latest}: held by .rightkit/update.json (${hold}); migration lane task, not current and not permission to seal`);
@@ -721,7 +779,15 @@ export async function prepareRightKitResolution({ root, snapshotFile = null, bou
721
779
  // Freshness is an admission gate. A bound snapshot is frozen evidence: seal, resume and upload never re-check it,
722
780
  // so a publication after admission neither mutates nor restarts an admitted build.
723
781
  const enforce = admission && source === "resolved";
724
- const freshness = evaluateRightKitFreshness(snapshot, readUpdateHolds(root), { enforce });
782
+ let declared = null;
783
+ try {
784
+ declared = new Map();
785
+ for (const d of declaredRightKitDependencies(root, ownedRightKitNames(versions, ownership), options.extraLocks ?? [])) {
786
+ const key = `${d.ecosystem}\0${d.name}`;
787
+ declared.set(key, [...(declared.get(key) ?? []), d.requirement ?? null]);
788
+ }
789
+ } catch { declared = null; }
790
+ const freshness = evaluateRightKitFreshness(snapshot, readUpdateHolds(root), { enforce, declared });
725
791
  if (freshness.refusals.length) {
726
792
  throw new RightKitRegistryError("stale-pin", `RightKit pins are behind the latest published version (build admission refused):\n${freshness.refusals.map((p) => `- ${p}`).join("\n")}`, { problems: freshness.refusals });
727
793
  }
@@ -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.6",
23
+ "@rightkit/app-update": "0.4.7",
24
24
  "@rightkit/ax": "0.3.2",
25
25
  "@rightkit/blender-worker": "0.1.1",
26
26
  "@rightkit/ci": "0.3.2",
@@ -33,28 +33,28 @@
33
33
  "@rightkit/html-editor": "0.2.0",
34
34
  "@rightkit/i18n": "0.2.1",
35
35
  "@rightkit/issues-tracker": "0.1.0",
36
- "@rightkit/legal": "0.6.3",
36
+ "@rightkit/legal": "0.6.4",
37
37
  "@rightkit/legal-ui": "0.4.2",
38
- "@rightkit/library-ui": "0.2.5",
38
+ "@rightkit/library-ui": "0.2.6",
39
39
  "@rightkit/license": "0.3.5",
40
40
  "@rightkit/logs": "0.1.7",
41
41
  "@rightkit/mail-ui": "0.2.2",
42
42
  "@rightkit/markdown-editor": "0.2.0",
43
43
  "@rightkit/media-gen-ui": "0.2.1",
44
44
  "@rightkit/media-ui": "0.3.6",
45
- "@rightkit/onboarding": "0.6.9",
45
+ "@rightkit/onboarding": "0.6.10",
46
46
  "@rightkit/outdated": "0.3.1",
47
47
  "@rightkit/pdf-ui": "0.3.1",
48
48
  "@rightkit/platform-ui": "0.4.5",
49
49
  "@rightkit/qa": "0.7.0",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.9",
52
- "@rightkit/release": "0.6.80",
52
+ "@rightkit/release": "0.6.82",
53
53
  "@rightkit/send-ui": "0.1.0",
54
- "@rightkit/settings-ui": "0.7.6",
54
+ "@rightkit/settings-ui": "0.7.7",
55
55
  "@rightkit/social-ui": "0.2.1",
56
56
  "@rightkit/system-ui": "0.2.2",
57
- "@rightkit/tauri": "0.4.5",
57
+ "@rightkit/tauri": "0.4.6",
58
58
  "@rightkit/tauri-shell": "0.1.4",
59
59
  "@rightkit/terminal-ui": "0.1.0",
60
60
  "@rightkit/theme": "0.3.4",
@@ -81,7 +81,8 @@
81
81
  "0.4.0",
82
82
  "0.4.1",
83
83
  "0.4.2",
84
- "0.4.4"
84
+ "0.4.4",
85
+ "0.4.6"
85
86
  ],
86
87
  "@rightkit/ax": [
87
88
  "0.2.0",
@@ -165,7 +166,8 @@
165
166
  "0.5.0",
166
167
  "0.6.0",
167
168
  "0.6.1",
168
- "0.6.2"
169
+ "0.6.2",
170
+ "0.6.3"
169
171
  ],
170
172
  "@rightkit/legal-ui": [
171
173
  "0.1.0",
@@ -228,7 +230,8 @@
228
230
  "0.6.3",
229
231
  "0.6.5",
230
232
  "0.6.6",
231
- "0.6.7"
233
+ "0.6.7",
234
+ "0.6.9"
232
235
  ],
233
236
  "@rightkit/outdated": [
234
237
  "0.2.0",
@@ -442,7 +445,9 @@
442
445
  "0.6.75",
443
446
  "0.6.77",
444
447
  "0.6.78",
445
- "0.6.79"
448
+ "0.6.79",
449
+ "0.6.80",
450
+ "0.6.81"
446
451
  ],
447
452
  "@rightkit/settings-ui": [
448
453
  "0.1.0",
@@ -468,7 +473,8 @@
468
473
  "0.6.1",
469
474
  "0.7.0",
470
475
  "0.7.3",
471
- "0.7.4"
476
+ "0.7.4",
477
+ "0.7.6"
472
478
  ],
473
479
  "@rightkit/shell": [
474
480
  "0.1.0"
@@ -484,7 +490,8 @@
484
490
  "0.2.3",
485
491
  "0.3.0",
486
492
  "0.4.2",
487
- "0.4.3"
493
+ "0.4.3",
494
+ "0.4.5"
488
495
  ],
489
496
  "@rightkit/tauri-shell": [
490
497
  "0.1.1",
@@ -506,6 +513,9 @@
506
513
  ],
507
514
  "@rightkit/video-ui": [
508
515
  "0.2.1"
516
+ ],
517
+ "@rightkit/library-ui": [
518
+ "0.2.5"
509
519
  ]
510
520
  },
511
521
  "cargo": {
@@ -567,7 +577,7 @@
567
577
  "rightkit-agents": "0.2.8",
568
578
  "rightkit-ai-accounts": "0.1.3",
569
579
  "rightkit-ai-keys": "0.1.1",
570
- "rightkit-android": "0.3.2",
580
+ "rightkit-android": "0.3.3",
571
581
  "rightkit-app-host": "0.1.3",
572
582
  "rightkit-app-icon": "0.1.0",
573
583
  "rightkit-app-lock": "0.1.0",
@@ -578,7 +588,7 @@
578
588
  "rightkit-approvals": "0.2.2",
579
589
  "rightkit-asr": "0.5.2",
580
590
  "rightkit-assist": "0.1.1",
581
- "rightkit-audio": "0.4.3",
591
+ "rightkit-audio": "0.4.4",
582
592
  "rightkit-autoedit": "0.2.0",
583
593
  "rightkit-automation": "0.7.6",
584
594
  "rightkit-autostart": "0.1.1",
@@ -589,7 +599,7 @@
589
599
  "rightkit-captions": "0.1.1",
590
600
  "rightkit-catalog": "0.1.0",
591
601
  "rightkit-channel-memory": "0.2.3",
592
- "rightkit-chat-bridge": "0.2.2",
602
+ "rightkit-chat-bridge": "0.2.4",
593
603
  "rightkit-child-process": "0.5.17",
594
604
  "rightkit-clipboard": "0.1.0",
595
605
  "rightkit-clipboard-history": "0.4.0",
@@ -626,16 +636,16 @@
626
636
  "rightkit-device-link-core": "0.1.1",
627
637
  "rightkit-device-link-types": "0.1.2",
628
638
  "rightkit-dictation-app-runtime": "0.3.1",
629
- "rightkit-dictation-command-host": "0.3.3",
639
+ "rightkit-dictation-command-host": "0.3.4",
630
640
  "rightkit-dictation-core": "0.3.7",
631
641
  "rightkit-dictation-engine": "0.2.1",
632
642
  "rightkit-dictation-ffi": "0.2.1",
633
643
  "rightkit-dictation-inference": "0.2.4",
634
644
  "rightkit-dictation-models": "0.3.3",
635
- "rightkit-dictation-pill": "0.1.1",
645
+ "rightkit-dictation-pill": "0.1.2",
636
646
  "rightkit-dictation-runtime": "0.2.7",
637
- "rightkit-dictation-tauri": "0.3.3",
638
- "rightkit-dictation-telemetry": "0.2.3",
647
+ "rightkit-dictation-tauri": "0.3.4",
648
+ "rightkit-dictation-telemetry": "0.2.4",
639
649
  "rightkit-dictation-text-pipeline": "0.2.7",
640
650
  "rightkit-disk-cleanup": "0.2.2",
641
651
  "rightkit-docs": "0.1.6",
@@ -690,9 +700,9 @@
690
700
  "rightkit-memory-core": "0.2.0",
691
701
  "rightkit-memory-store": "0.2.2",
692
702
  "rightkit-mesh": "0.2.3",
693
- "rightkit-models": "0.7.2",
703
+ "rightkit-models": "0.7.3",
694
704
  "rightkit-motion": "0.4.0",
695
- "rightkit-notch-ui": "0.2.2",
705
+ "rightkit-notch-ui": "0.2.3",
696
706
  "rightkit-notifications": "0.1.2",
697
707
  "rightkit-now-playing": "0.1.0",
698
708
  "rightkit-oauth": "0.11.1",
@@ -714,7 +724,7 @@
714
724
  "rightkit-profile": "0.1.0",
715
725
  "rightkit-prompt-recipes": "0.2.1",
716
726
  "rightkit-pty": "0.1.3",
717
- "rightkit-qa": "0.10.11",
727
+ "rightkit-qa": "0.10.13",
718
728
  "rightkit-record": "0.4.1",
719
729
  "rightkit-reframe": "0.2.0",
720
730
  "rightkit-remote-compute": "0.2.1",
@@ -736,18 +746,18 @@
736
746
  "rightkit-social-publish": "0.2.0",
737
747
  "rightkit-speech-client": "0.5.0",
738
748
  "rightkit-spend": "0.2.4",
739
- "rightkit-sync": "0.4.3",
749
+ "rightkit-sync": "0.4.4",
740
750
  "rightkit-sync-keys": "0.1.0",
741
751
  "rightkit-sysmem": "0.1.0",
742
752
  "rightkit-system-monitor": "0.3.2",
743
- "rightkit-tauri-shell": "0.8.9",
753
+ "rightkit-tauri-shell": "0.8.10",
744
754
  "rightkit-terminal-ui": "0.1.3",
745
755
  "rightkit-text-polish": "0.1.4",
746
756
  "rightkit-theme": "0.1.1",
747
757
  "rightkit-time": "0.1.5",
748
758
  "rightkit-timeline": "0.1.1",
749
759
  "rightkit-transcript": "0.4.2",
750
- "rightkit-transcript-library": "0.1.7",
760
+ "rightkit-transcript-library": "0.1.8",
751
761
  "rightkit-tts": "0.3.2",
752
762
  "rightkit-tts-qwen": "0.3.0",
753
763
  "rightkit-tts-qwen-sys": "0.1.5",
@@ -905,7 +915,7 @@
905
915
  "@rightkit/qa": "0.7.0",
906
916
  "@rightkit/qa-chrome": "0.1.12",
907
917
  "@rightkit/react-shell": "0.7.7",
908
- "@rightkit/release": "0.6.79",
918
+ "@rightkit/release": "0.6.81",
909
919
  "@rightkit/settings-ui": "0.7.4",
910
920
  "@rightkit/shell": "0.1.1",
911
921
  "@rightkit/tauri": "0.4.3",
@@ -959,7 +969,8 @@
959
969
  "rightkit-android": [
960
970
  "0.2.0",
961
971
  "0.3.0",
962
- "0.3.1"
972
+ "0.3.1",
973
+ "0.3.2"
963
974
  ],
964
975
  "rightkit-app-manager": [
965
976
  "0.2.2",
@@ -997,7 +1008,8 @@
997
1008
  "0.3.8",
998
1009
  "0.3.9",
999
1010
  "0.4.0",
1000
- "0.4.1"
1011
+ "0.4.1",
1012
+ "0.4.3"
1001
1013
  ],
1002
1014
  "rightkit-automation": [
1003
1015
  "0.3.0",
@@ -1035,7 +1047,9 @@
1035
1047
  ],
1036
1048
  "rightkit-chat-bridge": [
1037
1049
  "0.2.0",
1038
- "0.2.1"
1050
+ "0.2.1",
1051
+ "0.2.2",
1052
+ "0.2.3"
1039
1053
  ],
1040
1054
  "rightkit-child-process": [
1041
1055
  "0.4.0",
@@ -1142,7 +1156,8 @@
1142
1156
  ],
1143
1157
  "rightkit-dictation-command-host": [
1144
1158
  "0.3.0",
1145
- "0.3.1"
1159
+ "0.3.1",
1160
+ "0.3.3"
1146
1161
  ],
1147
1162
  "rightkit-dictation-core": [
1148
1163
  "0.3.1",
@@ -1161,17 +1176,20 @@
1161
1176
  "0.3.1"
1162
1177
  ],
1163
1178
  "rightkit-dictation-pill": [
1164
- "0.1.0"
1179
+ "0.1.0",
1180
+ "0.1.1"
1165
1181
  ],
1166
1182
  "rightkit-dictation-runtime": [
1167
1183
  "0.2.5"
1168
1184
  ],
1169
1185
  "rightkit-dictation-tauri": [
1170
- "0.3.1"
1186
+ "0.3.1",
1187
+ "0.3.3"
1171
1188
  ],
1172
1189
  "rightkit-dictation-telemetry": [
1173
1190
  "0.2.0",
1174
- "0.2.2"
1191
+ "0.2.2",
1192
+ "0.2.3"
1175
1193
  ],
1176
1194
  "rightkit-dictation-text-pipeline": [
1177
1195
  "0.2.5",
@@ -1367,14 +1385,16 @@
1367
1385
  "0.3.1",
1368
1386
  "0.3.2",
1369
1387
  "0.4.4",
1370
- "0.5.1"
1388
+ "0.5.1",
1389
+ "0.7.2"
1371
1390
  ],
1372
1391
  "rightkit-motion": [
1373
1392
  "0.1.0",
1374
1393
  "0.2.0"
1375
1394
  ],
1376
1395
  "rightkit-notch-ui": [
1377
- "0.2.1"
1396
+ "0.2.1",
1397
+ "0.2.2"
1378
1398
  ],
1379
1399
  "rightkit-notifications": [
1380
1400
  "0.1.0",
@@ -1477,7 +1497,9 @@
1477
1497
  "0.9.0",
1478
1498
  "0.9.1",
1479
1499
  "0.10.8",
1480
- "0.10.10"
1500
+ "0.10.10",
1501
+ "0.10.11",
1502
+ "0.10.12"
1481
1503
  ],
1482
1504
  "rightkit-qa-driver": [
1483
1505
  "0.3.0",
@@ -1595,7 +1617,8 @@
1595
1617
  "0.3.0",
1596
1618
  "0.4.0",
1597
1619
  "0.4.1",
1598
- "0.4.2"
1620
+ "0.4.2",
1621
+ "0.4.3"
1599
1622
  ],
1600
1623
  "rightkit-system-monitor": [
1601
1624
  "0.3.0",
@@ -1613,7 +1636,8 @@
1613
1636
  "0.5.1",
1614
1637
  "0.6.0",
1615
1638
  "0.8.2",
1616
- "0.8.7"
1639
+ "0.8.7",
1640
+ "0.8.9"
1617
1641
  ],
1618
1642
  "rightkit-text-polish": [
1619
1643
  "0.1.1",
@@ -1634,7 +1658,8 @@
1634
1658
  ],
1635
1659
  "rightkit-transcript-library": [
1636
1660
  "0.1.2",
1637
- "0.1.4"
1661
+ "0.1.4",
1662
+ "0.1.7"
1638
1663
  ],
1639
1664
  "rightkit-tts": [
1640
1665
  "0.1.0",
@@ -31,6 +31,11 @@ export class SwapHelperError extends Error {
31
31
  const helperPath = (packageDir) => path.join(packageDir, ...SWAP_HELPER_BIN);
32
32
  const receiptPath = (packageDir) => path.join(packageDir, ...SWAP_HELPER_RECEIPT);
33
33
  const sha256 = (fs, file) => crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
34
+ /** The committed helper's sha256 (`bin/darwin/rightkit-swap.sha256`, `<hex> rightkit-swap`), or null when the file is absent or unreadable. */
35
+ export function committedSwapHelperDigest(packageDir, fs = nodeFs) {
36
+ try { const m = /^([0-9a-f]{64})\s+\*?rightkit-swap\s*$/m.exec(fs.readFileSync(path.join(packageDir, "bin", "darwin", "rightkit-swap.sha256"), "utf8")); return m ? m[1] : null; }
37
+ catch { return null; }
38
+ }
34
39
  const tail = (text, lines = 30) => String(text ?? "").split(/\r?\n/).slice(-lines).join("\n");
35
40
 
36
41
  /** True when `codesign --verify --strict` accepts the file. Only meaningful on macOS. */
@@ -60,6 +65,9 @@ export function prepareSwapHelper({
60
65
  }) {
61
66
  const dest = helperPath(packageDir);
62
67
  if (platform !== "darwin") {
68
+ // Off the Mac codesign cannot run: the committed helper is taken when its bytes hash to the committed digest (it was verified when it was committed).
69
+ const committed = committedSwapHelperDigest(packageDir, fs);
70
+ if (committed && fs.existsSync(dest) && sha256(fs, dest) === committed) return { file: dest, signed: true, built: false, identity: null };
63
71
  let receipt = null;
64
72
  try { receipt = JSON.parse(fs.readFileSync(receiptPath(packageDir), "utf8")); } catch { /* refused below */ }
65
73
  if (!fs.existsSync(dest) || receipt?.schema !== 1 || receipt.sha256 !== sha256(fs, dest)) {
@@ -68,6 +76,14 @@ export function prepareSwapHelper({
68
76
  return { file: dest, signed: true, built: false, identity: receipt.identity ?? null };
69
77
  }
70
78
  const fail = (code, message) => { throw new SwapHelperError(code, message); };
79
+ // The committed helper: bin/darwin/rightkit-swap is checked in with its sha256 (bin/darwin/rightkit-swap.sha256), signed once. When its bytes
80
+ // hash to the committed digest and its code signature verifies, the pack uses it as it is: no Cargo build and no signing (0.6.81).
81
+ const committedDigest = committedSwapHelperDigest(packageDir, fs);
82
+ if (committedDigest && fs.existsSync(dest) && sha256(fs, dest) === committedDigest) {
83
+ if (!isSwapHelperSigned(dest)) fail("SWAP_HELPER_UNSIGNED", `the committed ${SWAP_HELPER_BIN.join("/")} matches its sha256 but its code signature does not verify`);
84
+ log(`[right-release] using the committed signed ${SWAP_HELPER_BIN.join("/")} (sha256 ${committedDigest})`);
85
+ return { file: dest, signed: true, built: false, identity: null };
86
+ }
71
87
  const built = run("cargo", SWAP_HELPER_CARGO_ARGS, { cwd: workspaceRoot, env });
72
88
  if (built.error || built.status !== 0) fail("SWAP_HELPER_BUILD_FAILED", `rustright cargo ${SWAP_HELPER_CARGO_ARGS.join(" ")} failed (${built.error?.message ?? `exit ${built.status}`})\n${tail(`${built.stdout ?? ""}\n${built.stderr ?? ""}`)}`);
73
89
  const meta = run("cargo", SWAP_HELPER_METADATA_ARGS, { cwd: workspaceRoot, env });