@rightkit/release 0.6.45 → 0.6.47
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/affected-units.mjs +190 -0
- package/bin/rightkit-gate.mjs +629 -132
- package/build-ownership.mjs +206 -41
- package/cargo-width.mjs +49 -0
- package/ci-compile-admission.mjs +57 -0
- package/committed-cargo-workspace.mjs +58 -0
- package/cross-targets.mjs +18 -2
- package/dependency-identity.mjs +98 -0
- package/deterministic-scans.mjs +256 -57
- package/gate-acceptance.mjs +1443 -0
- package/gate-coverage.mjs +17 -6
- package/gate-serve.mjs +239 -0
- package/handle-revocation.mjs +100 -0
- package/handle-revocation.rust-vector.json +1 -0
- package/handle-revocation.vectors.json +53 -0
- package/local-publish.mjs +109 -34
- package/managed-cargo.mjs +11 -0
- package/node-check-cache.mjs +95 -0
- package/owner-process-proof.mjs +14 -0
- package/ownership-mark.mjs +10 -1
- package/ownership-recover.mjs +78 -0
- package/package.json +2 -1
- package/performance-diagnostic.mjs +19 -0
- package/provenance-verify.mjs +35 -0
- package/publication-gate.mjs +62 -29
- package/publish-cargo.mjs +19 -4
- package/qualification-verify.mjs +12 -2
- package/rightkit-drift.mjs +4 -3
- package/rightkit-versions.json +1 -1
- package/snapshot-broker.mjs +1 -1
- package/snapshot-check.mjs +91 -12
- package/snapshot-dependency-reuse.mjs +230 -0
- package/snapshot-metadata.mjs +1 -1
- package/snapshot-request.mjs +12 -5
- package/snapshot.mjs +41 -6
- package/stage-sidecar.mjs +20 -4
- package/stamp-relay.mjs +37 -0
- package/unit-gate.mjs +25 -5
- package/unit-list-compile.mjs +277 -0
package/cross-targets.mjs
CHANGED
|
@@ -68,15 +68,31 @@ export function crossCcDir({ env = process.env, exists = fs.existsSync, platform
|
|
|
68
68
|
return dir && exists(dir) ? dir : null;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
export
|
|
71
|
+
/** The cross-target pkg-config stub's file name in the wrapper directory (scripts/ci/provision-zig.mjs writes it). */
|
|
72
|
+
export const PKG_CONFIG_CROSS = "pkg-config-cross";
|
|
73
|
+
/** The cross-target windres stub (non-Windows hosts; scripts/ci/provision-zig.mjs writes it). */
|
|
74
|
+
export const WINDRES_CROSS = "windres-cross";
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* cc-rs / cmake environment pointing a target's C, C++ and archiver at the provisioned zig wrappers (none when unprovisioned).
|
|
78
|
+
* When the wrapper directory holds the pkg-config stub, a foreign target's pkg-config is that stub (GC-A14): no host has another OS's
|
|
79
|
+
* sysroot, and a cross-target row is a clippy type-check that never links, so a -sys build script (gdk-pixbuf-sys, webkit2gtk-sys under
|
|
80
|
+
* Tauri on Linux) needs pkg-config only to answer, not to locate a library. Measured 2026-11-05: every Tauri consumer's Linux cross row
|
|
81
|
+
* failed on the Mac with "pkg-config has not been configured to support cross-compilation".
|
|
82
|
+
*/
|
|
83
|
+
export function crossCompileEnv(target, dir = crossCcDir(), platform = process.platform, exists = fs.existsSync) {
|
|
73
84
|
if (!dir) return undefined;
|
|
74
85
|
const key = target.replaceAll("-", "_");
|
|
75
86
|
const ext = platform === "win32" ? ".cmd" : "";
|
|
87
|
+
const stub = path.join(dir, `${PKG_CONFIG_CROSS}${ext}`);
|
|
76
88
|
return {
|
|
77
89
|
[`CC_${key}`]: path.join(dir, `cc-${target}${ext}`),
|
|
78
90
|
[`CXX_${key}`]: path.join(dir, `cxx-${target}${ext}`),
|
|
79
91
|
[`AR_${key}`]: path.join(dir, `ar-${target}${ext}`),
|
|
92
|
+
...(exists(stub) ? { [`PKG_CONFIG_${key}`]: stub, [`PKG_CONFIG_ALLOW_CROSS_${key}`]: "1" } : {}),
|
|
93
|
+
// A windows-gnu cross row off Windows: embed-resource (tauri-winres) needs a resource compiler; the stub answers as GNU windres and
|
|
94
|
+
// writes an empty archive (the row never links). Reported by the Pulse lane, 2026-11-05: tauri-winres NotAttempted(x86_64-w64-mingw32-windres).
|
|
95
|
+
...(target.endsWith("-windows-gnu") && exists(path.join(dir, WINDRES_CROSS)) ? { [`RC_${key}`]: path.join(dir, WINDRES_CROSS) } : {}),
|
|
80
96
|
};
|
|
81
97
|
}
|
|
82
98
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// The identity of installed pnpm dependencies (GC-A24, rightkit#1506; Adrian, 2026-11-05: "if that's the best shape, do it").
|
|
2
|
+
//
|
|
3
|
+
// The gate installs `--offline --frozen-lockfile` from pnpm's content-addressed store, which checks every package against the
|
|
4
|
+
// lockfile's integrity hash, so the installed bytes are a function of the lockfile, the store and pnpm. Their identity is therefore
|
|
5
|
+
// pnpm's own record of the install, not a walk over every installed byte (the former walk read ~44k files per root and duplicated
|
|
6
|
+
// pnpm's integrity check). Per node_modules root this binds:
|
|
7
|
+
// - .modules.yaml and .pnpm-workspace-state-v1.json, with the install timestamps pnpm writes on every install removed;
|
|
8
|
+
// - .pnpm/lock.yaml, the lockfile pnpm recorded for the virtual store it built;
|
|
9
|
+
// - every top-level entry (including one level of @scope): its name, kind and link target;
|
|
10
|
+
// - any link that resolves outside the repository and outside every walked root (a `link:`/`file:` package pnpm did not take from
|
|
11
|
+
// the store), hashed whole, because no lockfile integrity covers those bytes.
|
|
12
|
+
// A root that does not exist is bound as absent.
|
|
13
|
+
import crypto from "node:crypto";
|
|
14
|
+
import fs from "node:fs";
|
|
15
|
+
import path from "node:path";
|
|
16
|
+
|
|
17
|
+
const sha = (bytes) => crypto.createHash("sha256").update(bytes).digest("hex");
|
|
18
|
+
const inside = (p, dir) => p === dir || p.startsWith(dir + path.sep);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The bytes of a pnpm install-state file as identities bind them: pnpm stamps the time of every install into `.modules.yaml`
|
|
22
|
+
* (`prunedAt`) and `.pnpm-workspace-state-v1.json` (`lastValidatedTimestamp`, `validation.recordedAtNs`, the lockfile's
|
|
23
|
+
* `mtimeNs`/`ctimeNs`). Only those fields are dropped (measured 2026-11-05: they were the only bytes of 867 entries in 104 roots
|
|
24
|
+
* that differed between two identical installs). Any other file is returned unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export function installStateBytes(name, bytes) {
|
|
27
|
+
if (name === ".modules.yaml") return Buffer.from(String(bytes).replace(/^\s*"?prunedAt"?\s*:.*$/m, ""));
|
|
28
|
+
if (name === ".pnpm-workspace-state-v1.json") {
|
|
29
|
+
try {
|
|
30
|
+
const state = JSON.parse(String(bytes)); delete state.lastValidatedTimestamp;
|
|
31
|
+
if (state.validation && typeof state.validation === "object") {
|
|
32
|
+
delete state.validation.recordedAtNs;
|
|
33
|
+
for (const entry of Object.values(state.validation.files ?? {})) if (entry && typeof entry === "object") { delete entry.mtimeNs; delete entry.ctimeNs; }
|
|
34
|
+
}
|
|
35
|
+
return Buffer.from(JSON.stringify(state));
|
|
36
|
+
} catch { return bytes; }
|
|
37
|
+
}
|
|
38
|
+
return bytes;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const STATE_FILES = [".modules.yaml", ".pnpm-workspace-state-v1.json", path.join(".pnpm", "lock.yaml")];
|
|
42
|
+
|
|
43
|
+
/** Whole-content hash of a directory or file outside the store (a linked local package). Bounded; never follows links inside it. */
|
|
44
|
+
function hashOutside(target, budget) {
|
|
45
|
+
const h = crypto.createHash("sha256");
|
|
46
|
+
const walk = (p) => {
|
|
47
|
+
if (++budget.count > budget.max) throw new Error(`linked package ${target} exceeds ${budget.max} entries`);
|
|
48
|
+
const st = fs.lstatSync(p);
|
|
49
|
+
if (st.isSymbolicLink()) { h.update(`link\0${path.relative(target, p)}\0${fs.readlinkSync(p)}\0`); return; }
|
|
50
|
+
if (st.isDirectory()) { h.update(`dir\0${path.relative(target, p)}\0`); for (const n of fs.readdirSync(p).sort()) { if (n === "node_modules" || n === ".git") continue; walk(path.join(p, n)); } return; }
|
|
51
|
+
if (st.isFile()) { h.update(`file\0${path.relative(target, p)}\0${st.mode & 0o111 ? "x" : "-"}\0${sha(fs.readFileSync(p))}\0`); return; }
|
|
52
|
+
};
|
|
53
|
+
walk(target);
|
|
54
|
+
return h.digest("hex");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The identity of the installed dependencies under `dirs` (node_modules directories, absolute or relative to `root`).
|
|
59
|
+
* `repoRoot` (default `root`) bounds what counts as "inside the repository" for linked packages.
|
|
60
|
+
*/
|
|
61
|
+
export function installIdentity(root, dirs, { repoRoot = root, maxLinkedEntries = 200000 } = {}) {
|
|
62
|
+
const h = crypto.createHash("sha256");
|
|
63
|
+
const realRepo = fs.realpathSync(repoRoot);
|
|
64
|
+
const walked = [];
|
|
65
|
+
for (const d of [...dirs].sort()) { try { walked.push(fs.realpathSync(path.resolve(root, d))); } catch { /* absent: bound below */ } }
|
|
66
|
+
const outside = new Set();
|
|
67
|
+
const budget = { count: 0, max: maxLinkedEntries };
|
|
68
|
+
const rel = (p) => (inside(p, realRepo) ? path.relative(realRepo, p).split(path.sep).join("/") : p);
|
|
69
|
+
for (const d of [...dirs].sort()) {
|
|
70
|
+
const dir = path.resolve(root, d);
|
|
71
|
+
h.update(`root\0${rel(dir)}\0`);
|
|
72
|
+
let st; try { st = fs.lstatSync(dir); } catch (error) { if (error?.code === "ENOENT" || error?.code === "ENOTDIR") { h.update("absent\0"); continue; } throw error; }
|
|
73
|
+
if (!st.isDirectory()) { h.update(`not-a-directory\0${st.mode}\0`); continue; }
|
|
74
|
+
for (const f of STATE_FILES) {
|
|
75
|
+
let bytes; try { bytes = fs.readFileSync(path.join(dir, f)); } catch (error) { if (error?.code === "ENOENT") { h.update(`${f}\0absent\0`); continue; } throw error; }
|
|
76
|
+
h.update(`${f}\0${sha(installStateBytes(path.basename(f), bytes))}\0`);
|
|
77
|
+
}
|
|
78
|
+
const entry = (p, name) => {
|
|
79
|
+
const est = fs.lstatSync(p);
|
|
80
|
+
if (est.isSymbolicLink()) {
|
|
81
|
+
const target = fs.readlinkSync(p);
|
|
82
|
+
h.update(`link\0${name}\0${target}\0`);
|
|
83
|
+
let real = null; try { real = fs.realpathSync(p); } catch (error) { if (error?.code !== "ENOENT") throw error; h.update("dangling\0"); }
|
|
84
|
+
if (real && !inside(real, realRepo) && !walked.some((w) => inside(real, w))) outside.add(real);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
h.update(`${est.isDirectory() ? "dir" : est.isFile() ? "file" : "other"}\0${name}\0`);
|
|
88
|
+
};
|
|
89
|
+
for (const name of fs.readdirSync(dir).sort()) {
|
|
90
|
+
if (name === ".pnpm" || name === ".bin" || name.startsWith(".")) continue;
|
|
91
|
+
const p = path.join(dir, name);
|
|
92
|
+
if (name.startsWith("@") && fs.lstatSync(p).isDirectory()) { for (const sub of fs.readdirSync(p).sort()) entry(path.join(p, sub), `${name}/${sub}`); }
|
|
93
|
+
else entry(p, name);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
for (const real of [...outside].sort()) h.update(`outside\0${real}\0${hashOutside(real, budget)}\0`);
|
|
97
|
+
return h.digest("hex");
|
|
98
|
+
}
|