@rightkit/release 0.6.34 → 0.6.36

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.
@@ -64,7 +64,6 @@ export const SCAN_CLASS = Object.freeze({ A: "A", B: "B" });
64
64
  export const UNOBSERVED_NESTED_CARGO_NOTE = "cargo calls that a build script makes through $CARGO are unobserved: cargo hands build scripts its own path, not the gate's wrapper, so they are not in the cargo ledger; they inherit the parent's bound CARGO_TARGET_DIR, and the per-scan sentinel and the after-compile snapshot verify are the backstops";
65
65
 
66
66
  /** The ledger token of the gate's own tool version probes (they reach the cargo wrapper like any scan does). */
67
- const BUILD_HELPERS_COMMAND = fileURLToPath(new URL("./build-helpers-command.mjs", import.meta.url));
68
67
  const PROBE_LEDGER_TOKEN = scanTokenOf("tool-probe");
69
68
 
70
69
  /** Scan id prefixes (the text before the first ":") that belong to each class. */
@@ -1251,12 +1250,8 @@ export function planScans({
1251
1250
  }
1252
1251
  if (rustTouched) {
1253
1252
  for (const ws of touchedWs) add({ id: `cargo-metadata${wsIdSuffix(ws)}`, class: A, ...cargoReadIn(ws, ...metadataArgs()) });
1254
- // rightkit#1450 (Adrian, 2026-11-02): every build script and proc macro of the workspace must have been traced once on this host, writing only
1255
- // inside its build directories; an untraced or out-of-bounds unit refuses Class A, naming it. Runs the gate's own command, directly (GC-A11).
1256
- // It runs in its workspace (cwd), so a unit's scope keeps it only for the Cargo workspaces of its own closure (app-closure CARGO_WORKSPACE_SCAN),
1257
- // like metadata, deny and audit: an npm-only unit traces nothing.
1258
- // Build helpers are vetted only on broker hosts (Mac, Dell); a Linux host or CI runner is a throwaway container (Adrian, 2026-11-03).
1259
- if (platform === "darwin" || platform === "win32") for (const ws of touchedWs) add({ id: `build-helpers${wsIdSuffix(ws)}`, class: A, tool: "node", args: [BUILD_HELPERS_COMMAND, "check", "--manifest-path", "Cargo.toml"], ...(ws !== "." ? { cwd: ws } : {}), root: "content" });
1253
+ // The build-helper trace check (rightkit#1450) is removed from Class A (Adrian, 2026-11-03): the Mac tracer misattributed writes and
1254
+ // its sessions filled the disk (rightkit#1494), and apps waited on traces for hours. No host blocks on build-helper traces.
1260
1255
  // Locked package listings are observations in RustRight (#1216). They run through the selected executor
1261
1256
  // from the checked Cargo inputs, just like metadata; an executor refusal remains a failed scan.
1262
1257
  for (const name of crateNames.filter((n) => rustMap?.get(n).publish !== false)) add({ id: rustScanId.packageList(name), class: A, ...cargoReadIn(wsOf(name), "package", "-p", crateOf(name), "--list", "--allow-dirty", "--locked") });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.34",
3
+ "version": "0.6.36",
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",
@@ -9,8 +9,10 @@
9
9
  // 2. the gate's Class A for the package passes on that commit (`rightkit-gate --to check --unit npm:<name> --commit <sha>`, this
10
10
  // package's own gate, so a release publishes through the gate it ships);
11
11
  // 3. the version is not on npm yet.
12
- // The package folder is exported from the commit (git archive) and packed there; npm provenance is off (rightkit#1472). After publishing,
13
- // the registry's shasum must equal the packed tarball's, or the command fails.
12
+ // The commit's whole tree is exported (git archive), its dependencies are installed there offline from the commit's own lockfile and the
13
+ // checkout's pnpm store (a package whose prepack builds needs its devDependencies, rightkit#1493), and the package is packed there; the
14
+ // checkout and the gate's snapshot are never written. npm provenance is off (rightkit#1472). After publishing, the registry's shasum must
15
+ // equal the packed tarball's, or the command fails.
14
16
  import crypto from "node:crypto";
15
17
  import { spawnSync } from "node:child_process";
16
18
  import fs from "node:fs";
@@ -24,6 +26,16 @@ const GATE = fileURLToPath(new URL("./bin/rightkit-gate.mjs", import.meta.url));
24
26
 
25
27
  function fail(message) { throw new Error(message); }
26
28
 
29
+ /** The pnpm store the checkout installed from (`storeDir` in its node_modules/.modules.yaml, e.g. /Volumes/D/.pnpm-store/v11), as a `--store-dir` value (its parent). */
30
+ export function checkoutStoreDir(repo, readFile = (f) => fs.readFileSync(f, "utf8")) {
31
+ let text;
32
+ try { text = readFile(path.join(repo, "node_modules", ".modules.yaml")); } catch { fail(`${repo}/node_modules/.modules.yaml is missing: install the checkout once so its pnpm store is known`); }
33
+ const m = /"?storeDir"?\s*:\s*"?([^"\r\n]+)"?/.exec(text);
34
+ if (!m) fail(`${repo}/node_modules/.modules.yaml names no storeDir`);
35
+ const storeDir = m[1].trim();
36
+ return /^v\d+$/.test(path.basename(storeDir)) ? path.dirname(storeDir) : storeDir;
37
+ }
38
+
27
39
  export function parseArgs(argv) {
28
40
  const out = { kind: argv[0], pkg: null, commit: null, repo: process.cwd() };
29
41
  for (let i = 1; i < argv.length; i += 1) {
@@ -61,13 +73,23 @@ export function publishLocalNpm(argv, { run = spawnSync, log = console.log, plat
61
73
  const classA = run(process.execPath, [GATE, "--to", "check", "--unit", `npm:${o.pkg}`, "--commit", commit], { cwd: o.repo, stdio: ["ignore", "inherit", "inherit"] });
62
74
  if (classA.status !== 0) fail(`Class A failed for npm:${o.pkg} on ${commit} (exit ${classA.status}); nothing published`);
63
75
 
64
- const work = fs.mkdtempSync(path.join(os.tmpdir(), "rk-publish-local-"));
76
+ // The agent volume, not the internal drive: the export holds a full install (workspace rule: run output under /Volumes/D/scratch).
77
+ const scratchRoot = fs.existsSync("/Volumes/D/scratch") ? "/Volumes/D/scratch" : os.tmpdir();
78
+ const work = fs.mkdtempSync(path.join(scratchRoot, "rk-publish-local-"));
65
79
  try {
66
- const archive = run("git", ["archive", "--format=tar", commit, dir], { cwd: o.repo, maxBuffer: 1 << 30 });
67
- if (archive.status !== 0) fail(`git archive ${commit} ${dir} failed`);
68
- const tarIn = run("tar", ["-x", "-C", work], { input: archive.stdout });
69
- if (tarIn.status !== 0) fail("unpacking the commit's package folder failed");
70
- const pkgDir = path.join(work, dir);
80
+ const tree = path.join(work, "tree");
81
+ fs.mkdirSync(tree);
82
+ const archive = run("git", ["archive", "--format=tar", commit], { cwd: o.repo, maxBuffer: 1 << 30 });
83
+ if (archive.status !== 0) fail(`git archive ${commit} failed`);
84
+ const tarIn = run("tar", ["-x", "-C", tree], { input: archive.stdout });
85
+ if (tarIn.status !== 0) fail("unpacking the commit's tree failed");
86
+ // The package and its workspace dependencies, from the commit's lockfile only, offline from the store; no dependency's install scripts run.
87
+ const install = run("pnpm", ["install", "--frozen-lockfile", "--offline", "--ignore-scripts", "--ignore-pnpmfile", "--store-dir", checkoutStoreDir(o.repo), "--filter", `${o.pkg}...`], { cwd: tree, encoding: "utf8", maxBuffer: 1 << 28 });
88
+ if (install.status !== 0) fail(`pnpm install (offline, frozen lockfile) for ${o.pkg} failed: ${String(install.stderr || install.stdout || "").trim().split(/\r?\n/).slice(-3).join(" | ")}`);
89
+ // Workspace dependencies resolve through their dist/ (gitignored, so not in the export): build them first, in dependency order.
90
+ const deps = run("pnpm", ["-r", "--filter", `${o.pkg}^...`, "run", "--if-present", "build"], { cwd: tree, encoding: "utf8", maxBuffer: 1 << 28 });
91
+ if (deps.status !== 0) fail(`building ${o.pkg}'s workspace dependencies failed: ${String(deps.stderr || deps.stdout || "").trim().split(/\r?\n/).slice(-3).join(" | ")}`);
92
+ const pkgDir = path.join(tree, dir);
71
93
  const packed = run("pnpm", ["pack", "--pack-destination", work], { cwd: pkgDir, encoding: "utf8" });
72
94
  if (packed.status !== 0) fail(`pnpm pack failed: ${String(packed.stderr ?? packed.stdout ?? "").trim().split(/\r?\n/).slice(-3).join(" | ")}`);
73
95
  const tgz = fs.readdirSync(work).find((f) => f.endsWith(".tgz"));
@@ -49,7 +49,7 @@
49
49
  "@rightkit/qa": "0.6.2",
50
50
  "@rightkit/qa-chrome": "0.1.12",
51
51
  "@rightkit/react-shell": "0.7.2",
52
- "@rightkit/release": "0.6.34",
52
+ "@rightkit/release": "0.6.36",
53
53
  "@rightkit/settings-ui": "0.7.0",
54
54
  "@rightkit/social-ui": "0.1.0",
55
55
  "@rightkit/system-ui": "0.1.0",
@@ -539,7 +539,7 @@
539
539
  "rightkit-context-runtime": "0.1.0",
540
540
  "rightkit-contracts": "0.1.8",
541
541
  "rightkit-crash": "0.3.6",
542
- "rightkit-credentials": "0.4.3",
542
+ "rightkit-credentials": "0.4.4",
543
543
  "rightkit-crypto": "0.1.0",
544
544
  "rightkit-daemon": "0.5.1",
545
545
  "rightkit-db": "0.5.3",
@@ -547,7 +547,7 @@
547
547
  "rightkit-device-link-types": "0.1.0",
548
548
  "rightkit-dictation-app-runtime": "0.1.0",
549
549
  "rightkit-dictation-command-host": "0.1.0",
550
- "rightkit-dictation-core": "0.2.0",
550
+ "rightkit-dictation-core": "0.2.1",
551
551
  "rightkit-dictation-engine": "0.1.0",
552
552
  "rightkit-dictation-inference": "0.1.0",
553
553
  "rightkit-dictation-models": "0.1.0",
@@ -630,7 +630,7 @@
630
630
  "rightkit-spend": "0.2.0",
631
631
  "rightkit-sync": "0.2.2",
632
632
  "rightkit-system-monitor": "0.1.0",
633
- "rightkit-tauri-shell": "0.7.1",
633
+ "rightkit-tauri-shell": "0.7.2",
634
634
  "rightkit-terminal-ui": "0.1.0",
635
635
  "rightkit-text-polish": "0.1.0",
636
636
  "rightkit-time": "0.1.1",
package/snapshot.mjs CHANGED
@@ -360,7 +360,8 @@ export function dependencyDirs(entries, platform = process.platform) {
360
360
  * entry whose TYPE is not the commit's (a file where the commit has a link or the reverse, from `lstat`, independent of git's
361
361
  * configuration), whose link text is not the committed text, or, on POSIX, whose exec bit is not the commit's; and the first
362
362
  * non-directory outside the dependency directories with more than one hard link (a checkout file hard-linked into the snapshot
363
- * carries every later checkout edit into the build, with bytes that may still equal the commit's). Hard links inside the
363
+ * carries every later checkout edit into the build, with bytes that may still equal the commit's), unless every other name for it
364
+ * is inside the snapshot's own dependency directories (pnpm's link of a committed `file:` package). Hard links inside the
364
365
  * dependency directories are pnpm's own store links; their bytes are bound by the environment digest instead. Never follows a link
365
366
  * to enter it. Returns a message naming the path, or null.
366
367
  *
@@ -421,6 +422,8 @@ function inspectSnapshot({ dir, entries, checkout, platform = process.platform,
421
422
  const dirs = new Set();
422
423
  for (const e of entries) { const parts = e.path.split("/"); for (let i = 1; i < parts.length; i++) dirs.add(fold(parts.slice(0, i).join("/"))); }
423
424
  const deps = dependencyDirs(entries, platform);
425
+ const shared = []; // committed files with more than one hard link, judged after the walk (sharedLinkProblem)
426
+ const depRoots = []; // the dependency directories the walk entered
424
427
  let realDir; let realCheckout = checkout;
425
428
  try { realDir = fs.realpathSync.native(dir); } catch (e) { return problem(`${dir} cannot be resolved: ${e.message}`); }
426
429
  try { realCheckout = fs.realpathSync.native(checkout); } catch { /* the path as given */ }
@@ -455,7 +458,7 @@ function inspectSnapshot({ dir, entries, checkout, platform = process.platform,
455
458
  const s = lstat(p);
456
459
  if (!s) return `${r} vanished while it was checked`;
457
460
  if (!s.isFile() && !s.isSymbolicLink()) return `${r} is not a regular file or a link`;
458
- if (s.nlink > 1n) return `${r} has ${s.nlink} hard links: a checkout edit made through another name for it would reach the build`;
461
+ if (s.nlink > 1n) shared.push({ r, dev: s.dev, ino: s.ino, nlink: s.nlink });
459
462
  const committedLink = entry.mode === LINK_MODE;
460
463
  if (s.isSymbolicLink() !== committedLink) return committedLink ? `${r} is a plain file, but the commit holds a link there (a file holding the link's text is not the link)` : `${r} is a link, but the commit holds a file there`;
461
464
  if (committedLink) {
@@ -512,7 +515,7 @@ function inspectSnapshot({ dir, entries, checkout, platform = process.platform,
512
515
  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));
513
516
  } else if (e.isDirectory()) {
514
517
  if (inDeps) found = walk(p, r, true);
515
- else if (deps.has(key)) found = walk(p, r, true);
518
+ else if (deps.has(key)) { depRoots.push(p); found = walk(p, r, true); }
516
519
  else if (dirs.has(key)) found = walk(p, r, false);
517
520
  else if (key === ".git") found = gitConfigProblem(r, p);
518
521
  else found = ledgerMode ? candidateDir(p, r) : `${r} is not in the commit's tree (a directory the commit does not have)`;
@@ -521,7 +524,30 @@ function inspectSnapshot({ dir, entries, checkout, platform = process.platform,
521
524
  }
522
525
  return null;
523
526
  };
524
- const found = walk(dir, "", false);
527
+ // A committed file may share its inode only with names inside the snapshot's own installed dependencies: pnpm hard-links a
528
+ // committed `file:` package's files into node_modules/.pnpm on NTFS (ViewRight's vendor/docx-editor on the Dell). Every other
529
+ // name, a checkout file or a store file included, is unaccounted for and refused. Only files named like a shared file are stat'ed.
530
+ const sharedLinkProblem = () => {
531
+ if (!shared.length) return null;
532
+ const idOf = (s) => `${s.dev}:${s.ino}`;
533
+ const counts = new Map(shared.map((x) => [idOf(x), 0n]));
534
+ const names = new Set(shared.map((x) => fold(x.r.slice(x.r.lastIndexOf("/") + 1))));
535
+ const scan = (d) => {
536
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
537
+ const q = path.join(d, e.name);
538
+ if (e.isSymbolicLink()) continue;
539
+ if (e.isDirectory()) scan(q);
540
+ else if (names.has(fold(e.name))) { const s = lstat(q); const id = s && idOf(s); if (id && counts.has(id)) counts.set(id, counts.get(id) + 1n); }
541
+ }
542
+ };
543
+ for (const d of depRoots) scan(d);
544
+ for (const x of shared) {
545
+ const inside = counts.get(idOf(x));
546
+ if (x.nlink !== 1n + inside) return `${x.r} has ${x.nlink} hard links and only ${inside} other name(s) for it are in the snapshot's installed dependencies: a checkout edit made through another name for it would reach the build`;
547
+ }
548
+ return null;
549
+ };
550
+ const found = walk(dir, "", false) ?? sharedLinkProblem();
525
551
  if (found || !ledgerMode) return { problem: found, admitted: [] };
526
552
 
527
553
  // The ledger's entries, keyed like the walk's, must all be here and byte-identical; anything else the walk met is new.