@rightkit/release 0.6.34 → 0.6.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rightkit/release",
3
- "version": "0.6.34",
3
+ "version": "0.6.35",
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",
@@ -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.35",
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.